summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices
diff options
context:
space:
mode:
author andreasnaive <andreasnaive@gmail.com>2019-03-25 23:13:40 +0100
committer andreasnaive <andreasnaive@gmail.com>2019-03-25 23:13:40 +0100
commitb380514764cf857469bae61c11143a19f79a74c5 (patch)
tree63c8012e262618f08a332da31dd714281aa2c5ed /src/devices
parentc24473ddff715ecec2e258a6eb38960cf8c8e98e (diff)
Revert "conflict resolution (nw)"
This reverts commit c24473ddff715ecec2e258a6eb38960cf8c8e98e, reversing changes made to 009cba4fb8102102168ef32870892438327f3705.
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/bus/a1bus/a1bus.cpp6
-rw-r--r--src/devices/bus/a1bus/a1bus.h21
-rw-r--r--src/devices/bus/a1bus/a1cassette.cpp11
-rw-r--r--src/devices/bus/a2bus/a2alfam2.cpp44
-rw-r--r--src/devices/bus/a2bus/a2arcadebd.cpp6
-rw-r--r--src/devices/bus/a2bus/a2bus.cpp28
-rw-r--r--src/devices/bus/a2bus/a2bus.h49
-rw-r--r--src/devices/bus/a2bus/a2cffa.cpp2
-rw-r--r--src/devices/bus/a2bus/a2corvus.cpp19
-rw-r--r--src/devices/bus/a2bus/a2diskii.cpp22
-rw-r--r--src/devices/bus/a2bus/a2diskiing.cpp29
-rw-r--r--src/devices/bus/a2bus/a2diskiing.h5
-rw-r--r--src/devices/bus/a2bus/a2dx1.cpp14
-rw-r--r--src/devices/bus/a2bus/a2eauxslot.cpp37
-rw-r--r--src/devices/bus/a2bus/a2eauxslot.h59
-rw-r--r--src/devices/bus/a2bus/a2eext80col.cpp1
-rw-r--r--src/devices/bus/a2bus/a2eramworks3.cpp3
-rw-r--r--src/devices/bus/a2bus/a2eramworks3.h2
-rw-r--r--src/devices/bus/a2bus/a2estd80col.cpp1
-rw-r--r--src/devices/bus/a2bus/a2hsscsi.cpp39
-rw-r--r--src/devices/bus/a2bus/a2hsscsi.h2
-rw-r--r--src/devices/bus/a2bus/a2mcms.cpp18
-rw-r--r--src/devices/bus/a2bus/a2mcms.h2
-rw-r--r--src/devices/bus/a2bus/a2memexp.cpp5
-rw-r--r--src/devices/bus/a2bus/a2midi.cpp22
-rw-r--r--src/devices/bus/a2bus/a2mockingboard.cpp50
-rw-r--r--src/devices/bus/a2bus/a2pic.cpp8
-rw-r--r--src/devices/bus/a2bus/a2sam.cpp12
-rw-r--r--src/devices/bus/a2bus/a2scsi.cpp39
-rw-r--r--src/devices/bus/a2bus/a2scsi.h2
-rw-r--r--src/devices/bus/a2bus/a2softcard.cpp28
-rw-r--r--src/devices/bus/a2bus/a2ssc.cpp4
-rw-r--r--src/devices/bus/a2bus/a2themill.cpp28
-rw-r--r--src/devices/bus/a2bus/a2ultraterm.cpp17
-rw-r--r--src/devices/bus/a2bus/a2videoterm.cpp17
-rw-r--r--src/devices/bus/a2bus/a2zipdrive.cpp107
-rw-r--r--src/devices/bus/a2bus/a2zipdrive.h18
-rw-r--r--src/devices/bus/a2bus/agat7ports.cpp12
-rw-r--r--src/devices/bus/a2bus/agat840k_hle.cpp15
-rw-r--r--src/devices/bus/a2bus/corvfdc02.cpp6
-rw-r--r--src/devices/bus/a2bus/ezcgi.cpp34
-rw-r--r--src/devices/bus/a2bus/laser128.cpp5
-rw-r--r--src/devices/bus/a2bus/mouse.cpp4
-rw-r--r--src/devices/bus/a2bus/pc_xporter.cpp45
-rw-r--r--src/devices/bus/a2bus/pc_xporter.h1
-rw-r--r--src/devices/bus/a2bus/ssbapple.cpp9
-rw-r--r--src/devices/bus/a2bus/ssprite.cpp6
-rw-r--r--src/devices/bus/a2bus/timemasterho.cpp4
-rw-r--r--src/devices/bus/a2bus/transwarp.cpp37
-rw-r--r--src/devices/bus/a2bus/transwarp.h1
-rw-r--r--src/devices/bus/a7800/cpuwiz.cpp8
-rw-r--r--src/devices/bus/a7800/cpuwiz.h4
-rw-r--r--src/devices/bus/a7800/rom.cpp59
-rw-r--r--src/devices/bus/a7800/rom.h16
-rw-r--r--src/devices/bus/a7800/xboard.cpp12
-rw-r--r--src/devices/bus/a800/cassette.cpp13
-rw-r--r--src/devices/bus/abcbus/abc890.cpp112
-rw-r--r--src/devices/bus/abcbus/abcbus.h72
-rw-r--r--src/devices/bus/abcbus/cadmouse.cpp11
-rw-r--r--src/devices/bus/abcbus/db411223.cpp11
-rw-r--r--src/devices/bus/abcbus/unidisk.cpp5
-rw-r--r--src/devices/bus/abckb/abc77.cpp8
-rw-r--r--src/devices/bus/abckb/abc99.cpp2
-rw-r--r--src/devices/bus/abckb/abckb.h41
-rw-r--r--src/devices/bus/acorn/atom/discpack.cpp2
-rw-r--r--src/devices/bus/acorn/atom/econet.cpp2
-rw-r--r--src/devices/bus/acorn/atom/sid.cpp2
-rw-r--r--src/devices/bus/acorn/bus.cpp2
-rw-r--r--src/devices/bus/acorn/bus.h6
-rw-r--r--src/devices/bus/acorn/cms/4080term.cpp22
-rw-r--r--src/devices/bus/acorn/cms/hires.cpp15
-rw-r--r--src/devices/bus/acorn/system/cass.cpp9
-rw-r--r--src/devices/bus/acorn/system/econet.cpp2
-rw-r--r--src/devices/bus/acorn/system/fdc.cpp2
-rw-r--r--src/devices/bus/acorn/system/vdu40.cpp15
-rw-r--r--src/devices/bus/acorn/system/vdu80.cpp19
-rw-r--r--src/devices/bus/acorn/system/vib.cpp10
-rw-r--r--src/devices/bus/adam/adamlink.cpp4
-rw-r--r--src/devices/bus/adam/adamlink.h4
-rw-r--r--src/devices/bus/adam/exp.cpp8
-rw-r--r--src/devices/bus/adam/exp.h8
-rw-r--r--src/devices/bus/adam/ide.cpp4
-rw-r--r--src/devices/bus/adam/ide.h4
-rw-r--r--src/devices/bus/adam/ram.cpp4
-rw-r--r--src/devices/bus/adam/ram.h4
-rw-r--r--src/devices/bus/adamnet/adamnet.h11
-rw-r--r--src/devices/bus/adamnet/ddp.cpp27
-rw-r--r--src/devices/bus/adamnet/spi.cpp8
-rw-r--r--src/devices/bus/amiga/zorro/a2052.cpp6
-rw-r--r--src/devices/bus/amiga/zorro/a2058.cpp6
-rw-r--r--src/devices/bus/amiga/zorro/a2065.cpp10
-rw-r--r--src/devices/bus/amiga/zorro/a2232.cpp22
-rw-r--r--src/devices/bus/amiga/zorro/a590.cpp52
-rw-r--r--src/devices/bus/amiga/zorro/a590.h8
-rw-r--r--src/devices/bus/amiga/zorro/buddha.cpp18
-rw-r--r--src/devices/bus/amiga/zorro/zorro.cpp46
-rw-r--r--src/devices/bus/amiga/zorro/zorro.h112
-rw-r--r--src/devices/bus/apf/slot.h16
-rw-r--r--src/devices/bus/apricot/expansion/cards.cpp2
-rw-r--r--src/devices/bus/apricot/expansion/expansion.cpp25
-rw-r--r--src/devices/bus/apricot/expansion/expansion.h33
-rw-r--r--src/devices/bus/apricot/expansion/winchester.cpp254
-rw-r--r--src/devices/bus/apricot/expansion/winchester.h66
-rw-r--r--src/devices/bus/apricot/keyboard/hle.cpp85
-rw-r--r--src/devices/bus/apricot/keyboard/hle.h12
-rw-r--r--src/devices/bus/astrocde/accessory.cpp112
-rw-r--r--src/devices/bus/astrocde/accessory.h99
-rw-r--r--src/devices/bus/astrocde/cassette.cpp130
-rw-r--r--src/devices/bus/astrocde/cassette.h61
-rw-r--r--src/devices/bus/astrocde/ctrl.cpp120
-rw-r--r--src/devices/bus/astrocde/ctrl.h98
-rw-r--r--src/devices/bus/astrocde/exp.cpp14
-rw-r--r--src/devices/bus/astrocde/exp.h4
-rw-r--r--src/devices/bus/astrocde/joy.cpp56
-rw-r--r--src/devices/bus/astrocde/joy.h45
-rw-r--r--src/devices/bus/astrocde/lightpen.cpp87
-rw-r--r--src/devices/bus/astrocde/lightpen.h51
-rw-r--r--src/devices/bus/astrocde/ram.cpp61
-rw-r--r--src/devices/bus/astrocde/ram.h12
-rw-r--r--src/devices/bus/astrocde/rom.cpp41
-rw-r--r--src/devices/bus/astrocde/rom.h21
-rw-r--r--src/devices/bus/astrocde/slot.cpp3
-rw-r--r--src/devices/bus/astrocde/slot.h3
-rw-r--r--src/devices/bus/bbc/1mhzbus/1mhzbus.cpp19
-rw-r--r--src/devices/bus/bbc/1mhzbus/1mhzbus.h16
-rw-r--r--src/devices/bus/bbc/1mhzbus/beebsid.cpp20
-rw-r--r--src/devices/bus/bbc/1mhzbus/beebsid.h8
-rw-r--r--src/devices/bus/bbc/1mhzbus/cfa3000opt.cpp2
-rw-r--r--src/devices/bus/bbc/1mhzbus/cfa3000opt.h2
-rw-r--r--src/devices/bus/bbc/1mhzbus/emrmidi.cpp8
-rw-r--r--src/devices/bus/bbc/1mhzbus/emrmidi.h4
-rw-r--r--src/devices/bus/bbc/1mhzbus/ieee488.cpp113
-rw-r--r--src/devices/bus/bbc/1mhzbus/ieee488.h16
-rw-r--r--src/devices/bus/bbc/1mhzbus/m2000.cpp28
-rw-r--r--src/devices/bus/bbc/1mhzbus/m2000.h8
-rw-r--r--src/devices/bus/bbc/1mhzbus/opus3.cpp8
-rw-r--r--src/devices/bus/bbc/1mhzbus/opus3.h8
-rw-r--r--src/devices/bus/bbc/1mhzbus/sprite.cpp99
-rw-r--r--src/devices/bus/bbc/1mhzbus/sprite.h49
-rw-r--r--src/devices/bus/bbc/exp/exp.cpp32
-rw-r--r--src/devices/bus/bbc/exp/exp.h34
-rw-r--r--src/devices/bus/bbc/exp/mertec.cpp34
-rw-r--r--src/devices/bus/bbc/exp/mertec.h18
-rw-r--r--src/devices/bus/bbc/fdc/acorn.cpp16
-rw-r--r--src/devices/bus/bbc/fdc/acorn.h8
-rw-r--r--src/devices/bus/bbc/fdc/ams.cpp12
-rw-r--r--src/devices/bus/bbc/fdc/ams.h4
-rw-r--r--src/devices/bus/bbc/fdc/cumana.cpp4
-rw-r--r--src/devices/bus/bbc/fdc/cumana.h4
-rw-r--r--src/devices/bus/bbc/fdc/cv1797.cpp4
-rw-r--r--src/devices/bus/bbc/fdc/cv1797.h4
-rw-r--r--src/devices/bus/bbc/fdc/fdc.cpp8
-rw-r--r--src/devices/bus/bbc/fdc/fdc.h8
-rw-r--r--src/devices/bus/bbc/fdc/microware.cpp4
-rw-r--r--src/devices/bus/bbc/fdc/microware.h4
-rw-r--r--src/devices/bus/bbc/fdc/opus.cpp14
-rw-r--r--src/devices/bus/bbc/fdc/opus.h8
-rw-r--r--src/devices/bus/bbc/fdc/watford.cpp8
-rw-r--r--src/devices/bus/bbc/fdc/watford.h8
-rw-r--r--src/devices/bus/bbc/joyport/joyport.cpp8
-rw-r--r--src/devices/bus/bbc/joyport/joyport.h8
-rw-r--r--src/devices/bus/bbc/joyport/joystick.cpp2
-rw-r--r--src/devices/bus/bbc/joyport/joystick.h2
-rw-r--r--src/devices/bus/bbc/rom/dfs.cpp63
-rw-r--r--src/devices/bus/bbc/rom/dfs.h42
-rw-r--r--src/devices/bus/bbc/rom/pal.cpp312
-rw-r--r--src/devices/bus/bbc/rom/pal.h167
-rw-r--r--src/devices/bus/bbc/rom/ram.cpp57
-rw-r--r--src/devices/bus/bbc/rom/ram.h42
-rw-r--r--src/devices/bus/bbc/rom/rom.cpp50
-rw-r--r--src/devices/bus/bbc/rom/rom.h41
-rw-r--r--src/devices/bus/bbc/rom/rtc.cpp124
-rw-r--r--src/devices/bus/bbc/rom/rtc.h72
-rw-r--r--src/devices/bus/bbc/rom/slot.cpp234
-rw-r--r--src/devices/bus/bbc/rom/slot.h155
-rw-r--r--src/devices/bus/bbc/tube/tube.cpp20
-rw-r--r--src/devices/bus/bbc/tube/tube.h8
-rw-r--r--src/devices/bus/bbc/tube/tube_32016.cpp210
-rw-r--r--src/devices/bus/bbc/tube/tube_32016.h71
-rw-r--r--src/devices/bus/bbc/tube/tube_6502.cpp16
-rw-r--r--src/devices/bus/bbc/tube/tube_6502.h8
-rw-r--r--src/devices/bus/bbc/tube/tube_80186.cpp8
-rw-r--r--src/devices/bus/bbc/tube/tube_80186.h4
-rw-r--r--src/devices/bus/bbc/tube/tube_80286.cpp15
-rw-r--r--src/devices/bus/bbc/tube/tube_80286.h8
-rw-r--r--src/devices/bus/bbc/tube/tube_arm.cpp12
-rw-r--r--src/devices/bus/bbc/tube/tube_arm.h8
-rw-r--r--src/devices/bus/bbc/tube/tube_casper.cpp4
-rw-r--r--src/devices/bus/bbc/tube/tube_casper.h4
-rw-r--r--src/devices/bus/bbc/tube/tube_rc6502.cpp12
-rw-r--r--src/devices/bus/bbc/tube/tube_rc6502.h8
-rw-r--r--src/devices/bus/bbc/tube/tube_z80.cpp14
-rw-r--r--src/devices/bus/bbc/tube/tube_z80.h10
-rw-r--r--src/devices/bus/bbc/tube/tube_zep100.cpp18
-rw-r--r--src/devices/bus/bbc/tube/tube_zep100.h18
-rw-r--r--src/devices/bus/bbc/userport/beebspch.cpp2
-rw-r--r--src/devices/bus/bbc/userport/beebspch.h2
-rw-r--r--src/devices/bus/bbc/userport/cfa3000kbd.cpp2
-rw-r--r--src/devices/bus/bbc/userport/cfa3000kbd.h2
-rw-r--r--src/devices/bus/bbc/userport/pointer.cpp6
-rw-r--r--src/devices/bus/bbc/userport/pointer.h6
-rw-r--r--src/devices/bus/bbc/userport/userport.cpp8
-rw-r--r--src/devices/bus/bbc/userport/userport.h8
-rw-r--r--src/devices/bus/bml3/bml3bus.cpp6
-rw-r--r--src/devices/bus/bml3/bml3bus.h53
-rw-r--r--src/devices/bus/bw2/exp.cpp24
-rw-r--r--src/devices/bus/bw2/exp.h45
-rw-r--r--src/devices/bus/bw2/ramcard.cpp6
-rw-r--r--src/devices/bus/bw2/ramcard.h6
-rw-r--r--src/devices/bus/c64/16kb.cpp17
-rw-r--r--src/devices/bus/c64/16kb.h2
-rw-r--r--src/devices/bus/c64/c128_comal80.cpp4
-rw-r--r--src/devices/bus/c64/c128_comal80.h4
-rw-r--r--src/devices/bus/c64/c128_partner.cpp4
-rw-r--r--src/devices/bus/c64/c128_partner.h4
-rw-r--r--src/devices/bus/c64/comal80.cpp4
-rw-r--r--src/devices/bus/c64/comal80.h4
-rw-r--r--src/devices/bus/c64/cpm.cpp6
-rw-r--r--src/devices/bus/c64/cpm.h2
-rw-r--r--src/devices/bus/c64/currah_speech.cpp4
-rw-r--r--src/devices/bus/c64/currah_speech.h4
-rw-r--r--src/devices/bus/c64/dela_ep256.cpp35
-rw-r--r--src/devices/bus/c64/dela_ep256.h4
-rw-r--r--src/devices/bus/c64/dela_ep64.cpp19
-rw-r--r--src/devices/bus/c64/dela_ep64.h4
-rw-r--r--src/devices/bus/c64/dela_ep7x8.cpp52
-rw-r--r--src/devices/bus/c64/dela_ep7x8.h12
-rw-r--r--src/devices/bus/c64/dinamic.cpp2
-rw-r--r--src/devices/bus/c64/dinamic.h2
-rw-r--r--src/devices/bus/c64/dqbb.cpp4
-rw-r--r--src/devices/bus/c64/dqbb.h4
-rw-r--r--src/devices/bus/c64/easy_calc_result.cpp4
-rw-r--r--src/devices/bus/c64/easy_calc_result.h4
-rw-r--r--src/devices/bus/c64/easyflash.cpp12
-rw-r--r--src/devices/bus/c64/easyflash.h4
-rw-r--r--src/devices/bus/c64/epyx_fast_load.cpp4
-rw-r--r--src/devices/bus/c64/epyx_fast_load.h4
-rw-r--r--src/devices/bus/c64/exos.cpp2
-rw-r--r--src/devices/bus/c64/exos.h2
-rw-r--r--src/devices/bus/c64/exp.cpp8
-rw-r--r--src/devices/bus/c64/exp.h12
-rw-r--r--src/devices/bus/c64/fcc.cpp13
-rw-r--r--src/devices/bus/c64/fcc.h4
-rw-r--r--src/devices/bus/c64/final.cpp4
-rw-r--r--src/devices/bus/c64/final.h4
-rw-r--r--src/devices/bus/c64/final3.cpp4
-rw-r--r--src/devices/bus/c64/final3.h4
-rw-r--r--src/devices/bus/c64/fun_play.cpp4
-rw-r--r--src/devices/bus/c64/fun_play.h4
-rw-r--r--src/devices/bus/c64/geocable.cpp9
-rw-r--r--src/devices/bus/c64/georam.cpp4
-rw-r--r--src/devices/bus/c64/georam.h4
-rw-r--r--src/devices/bus/c64/ide64.cpp8
-rw-r--r--src/devices/bus/c64/ide64.h4
-rw-r--r--src/devices/bus/c64/ieee488.cpp12
-rw-r--r--src/devices/bus/c64/ieee488.h4
-rw-r--r--src/devices/bus/c64/kingsoft.cpp4
-rw-r--r--src/devices/bus/c64/kingsoft.h4
-rw-r--r--src/devices/bus/c64/mach5.cpp4
-rw-r--r--src/devices/bus/c64/mach5.h4
-rw-r--r--src/devices/bus/c64/magic_desk.cpp4
-rw-r--r--src/devices/bus/c64/magic_desk.h4
-rw-r--r--src/devices/bus/c64/magic_formel.cpp6
-rw-r--r--src/devices/bus/c64/magic_formel.h4
-rw-r--r--src/devices/bus/c64/magic_voice.cpp14
-rw-r--r--src/devices/bus/c64/magic_voice.h4
-rw-r--r--src/devices/bus/c64/midi_maplin.cpp22
-rw-r--r--src/devices/bus/c64/midi_maplin.h4
-rw-r--r--src/devices/bus/c64/midi_namesoft.cpp22
-rw-r--r--src/devices/bus/c64/midi_namesoft.h4
-rw-r--r--src/devices/bus/c64/midi_passport.cpp26
-rw-r--r--src/devices/bus/c64/midi_passport.h4
-rw-r--r--src/devices/bus/c64/midi_sci.cpp22
-rw-r--r--src/devices/bus/c64/midi_sci.h4
-rw-r--r--src/devices/bus/c64/midi_siel.cpp22
-rw-r--r--src/devices/bus/c64/midi_siel.h4
-rw-r--r--src/devices/bus/c64/mikro_assembler.cpp2
-rw-r--r--src/devices/bus/c64/mikro_assembler.h2
-rw-r--r--src/devices/bus/c64/multiscreen.cpp17
-rw-r--r--src/devices/bus/c64/multiscreen.h4
-rw-r--r--src/devices/bus/c64/music64.cpp8
-rw-r--r--src/devices/bus/c64/music64.h4
-rw-r--r--src/devices/bus/c64/neoram.cpp4
-rw-r--r--src/devices/bus/c64/neoram.h4
-rw-r--r--src/devices/bus/c64/ocean.cpp4
-rw-r--r--src/devices/bus/c64/ocean.h4
-rw-r--r--src/devices/bus/c64/pagefox.cpp4
-rw-r--r--src/devices/bus/c64/pagefox.h4
-rw-r--r--src/devices/bus/c64/partner.cpp4
-rw-r--r--src/devices/bus/c64/partner.h4
-rw-r--r--src/devices/bus/c64/prophet64.cpp4
-rw-r--r--src/devices/bus/c64/prophet64.h4
-rw-r--r--src/devices/bus/c64/ps64.cpp25
-rw-r--r--src/devices/bus/c64/ps64.h4
-rw-r--r--src/devices/bus/c64/reu.cpp20
-rw-r--r--src/devices/bus/c64/reu.h4
-rw-r--r--src/devices/bus/c64/rex.cpp2
-rw-r--r--src/devices/bus/c64/rex.h2
-rw-r--r--src/devices/bus/c64/rex_ep256.cpp35
-rw-r--r--src/devices/bus/c64/rex_ep256.h4
-rw-r--r--src/devices/bus/c64/ross.cpp4
-rw-r--r--src/devices/bus/c64/ross.h4
-rw-r--r--src/devices/bus/c64/sfx_sound_expander.cpp12
-rw-r--r--src/devices/bus/c64/sfx_sound_expander.h4
-rw-r--r--src/devices/bus/c64/silverrock.cpp4
-rw-r--r--src/devices/bus/c64/silverrock.h4
-rw-r--r--src/devices/bus/c64/simons_basic.cpp4
-rw-r--r--src/devices/bus/c64/simons_basic.h4
-rw-r--r--src/devices/bus/c64/speakeasy.cpp16
-rw-r--r--src/devices/bus/c64/speakeasy.h4
-rw-r--r--src/devices/bus/c64/stardos.cpp4
-rw-r--r--src/devices/bus/c64/stardos.h4
-rw-r--r--src/devices/bus/c64/std.cpp2
-rw-r--r--src/devices/bus/c64/std.h2
-rw-r--r--src/devices/bus/c64/structured_basic.cpp4
-rw-r--r--src/devices/bus/c64/structured_basic.h4
-rw-r--r--src/devices/bus/c64/super_explode.cpp4
-rw-r--r--src/devices/bus/c64/super_explode.h4
-rw-r--r--src/devices/bus/c64/super_games.cpp4
-rw-r--r--src/devices/bus/c64/super_games.h4
-rw-r--r--src/devices/bus/c64/supercpu.cpp8
-rw-r--r--src/devices/bus/c64/supercpu.h4
-rw-r--r--src/devices/bus/c64/sw8k.cpp2
-rw-r--r--src/devices/bus/c64/sw8k.h2
-rw-r--r--src/devices/bus/c64/swiftlink.cpp8
-rw-r--r--src/devices/bus/c64/swiftlink.h4
-rw-r--r--src/devices/bus/c64/system3.cpp4
-rw-r--r--src/devices/bus/c64/system3.h4
-rw-r--r--src/devices/bus/c64/tdos.cpp12
-rw-r--r--src/devices/bus/c64/tdos.h4
-rw-r--r--src/devices/bus/c64/turbo232.cpp10
-rw-r--r--src/devices/bus/c64/turbo232.h4
-rw-r--r--src/devices/bus/c64/vizastar.cpp2
-rw-r--r--src/devices/bus/c64/vizastar.h2
-rw-r--r--src/devices/bus/c64/vw64.cpp2
-rw-r--r--src/devices/bus/c64/vw64.h2
-rw-r--r--src/devices/bus/c64/warp_speed.cpp4
-rw-r--r--src/devices/bus/c64/warp_speed.h4
-rw-r--r--src/devices/bus/c64/westermann.cpp2
-rw-r--r--src/devices/bus/c64/westermann.h2
-rw-r--r--src/devices/bus/c64/xl80.cpp29
-rw-r--r--src/devices/bus/c64/xl80.h4
-rw-r--r--src/devices/bus/c64/zaxxon.cpp2
-rw-r--r--src/devices/bus/c64/zaxxon.h2
-rw-r--r--src/devices/bus/cbm2/24k.cpp4
-rw-r--r--src/devices/bus/cbm2/24k.h4
-rw-r--r--src/devices/bus/cbm2/exp.cpp8
-rw-r--r--src/devices/bus/cbm2/exp.h19
-rw-r--r--src/devices/bus/cbm2/hrg.cpp64
-rw-r--r--src/devices/bus/cbm2/hrg.h7
-rw-r--r--src/devices/bus/cbm2/std.cpp2
-rw-r--r--src/devices/bus/cbm2/std.h2
-rw-r--r--src/devices/bus/cbm2/user.h26
-rw-r--r--src/devices/bus/cbmiec/c1526.cpp22
-rw-r--r--src/devices/bus/cbmiec/c1541.cpp18
-rw-r--r--src/devices/bus/cbmiec/c1571.cpp11
-rw-r--r--src/devices/bus/cbmiec/c1581.cpp31
-rw-r--r--src/devices/bus/cbmiec/cbmiec.h45
-rw-r--r--src/devices/bus/cbmiec/interpod.cpp17
-rw-r--r--src/devices/bus/cbmiec/interpod.h10
-rw-r--r--src/devices/bus/cbmiec/serialbox.cpp9
-rw-r--r--src/devices/bus/cbmiec/vic1515.cpp11
-rw-r--r--src/devices/bus/cbmiec/vic1520.cpp9
-rw-r--r--src/devices/bus/cbus/pc9801_118.cpp4
-rw-r--r--src/devices/bus/cbus/pc9801_26.cpp4
-rw-r--r--src/devices/bus/cbus/pc9801_86.cpp30
-rw-r--r--src/devices/bus/cbus/pc9801_amd98.cpp16
-rw-r--r--src/devices/bus/cbus/pc9801_cbus.cpp11
-rw-r--r--src/devices/bus/cbus/pc9801_cbus.h106
-rw-r--r--src/devices/bus/centronics/comxpl80.cpp11
-rw-r--r--src/devices/bus/centronics/covox.cpp29
-rw-r--r--src/devices/bus/centronics/ctronics.h80
-rw-r--r--src/devices/bus/centronics/digiblst.cpp12
-rw-r--r--src/devices/bus/centronics/epson_lx810l.cpp1
-rw-r--r--src/devices/bus/centronics/nec_p72.cpp10
-rw-r--r--src/devices/bus/centronics/printer.cpp9
-rw-r--r--src/devices/bus/cgenie/expansion/expansion.cpp22
-rw-r--r--src/devices/bus/cgenie/expansion/expansion.h45
-rw-r--r--src/devices/bus/cgenie/expansion/floppy.cpp16
-rw-r--r--src/devices/bus/cgenie/parallel/parallel.h23
-rw-r--r--src/devices/bus/cgenie/parallel/printer.cpp19
-rw-r--r--src/devices/bus/chanf/slot.h16
-rw-r--r--src/devices/bus/coco/coco_dcmodem.cpp9
-rw-r--r--src/devices/bus/coco/coco_fdc.cpp15
-rw-r--r--src/devices/bus/coco/coco_fdc.h1
-rw-r--r--src/devices/bus/coco/coco_gmc.cpp8
-rw-r--r--src/devices/bus/coco/coco_multi.cpp82
-rw-r--r--src/devices/bus/coco/coco_orch90.cpp20
-rw-r--r--src/devices/bus/coco/coco_rs232.cpp9
-rw-r--r--src/devices/bus/coco/coco_ssc.cpp15
-rw-r--r--src/devices/bus/coco/coco_t4426.cpp14
-rw-r--r--src/devices/bus/coco/cococart.cpp40
-rw-r--r--src/devices/bus/coco/cococart.h46
-rw-r--r--src/devices/bus/coco/dragon_jcbsnd.cpp15
-rw-r--r--src/devices/bus/coco/dragon_jcbsnd.h1
-rw-r--r--src/devices/bus/coleco/ctrl.cpp (renamed from src/devices/bus/coleco/controller/ctrl.cpp)0
-rw-r--r--src/devices/bus/coleco/ctrl.h (renamed from src/devices/bus/coleco/controller/ctrl.h)0
-rw-r--r--src/devices/bus/coleco/exp.cpp (renamed from src/devices/bus/coleco/cartridge/exp.cpp)4
-rw-r--r--src/devices/bus/coleco/exp.h (renamed from src/devices/bus/coleco/cartridge/exp.h)4
-rw-r--r--src/devices/bus/coleco/hand.cpp (renamed from src/devices/bus/coleco/controller/hand.cpp)0
-rw-r--r--src/devices/bus/coleco/hand.h (renamed from src/devices/bus/coleco/controller/hand.h)0
-rw-r--r--src/devices/bus/coleco/sac.cpp (renamed from src/devices/bus/coleco/controller/sac.cpp)0
-rw-r--r--src/devices/bus/coleco/sac.h (renamed from src/devices/bus/coleco/controller/sac.h)0
-rw-r--r--src/devices/bus/coleco/std.cpp (renamed from src/devices/bus/coleco/cartridge/std.cpp)2
-rw-r--r--src/devices/bus/coleco/std.h (renamed from src/devices/bus/coleco/cartridge/std.h)2
-rw-r--r--src/devices/bus/coleco/xin1.cpp (renamed from src/devices/bus/coleco/cartridge/xin1.cpp)2
-rw-r--r--src/devices/bus/coleco/xin1.h (renamed from src/devices/bus/coleco/cartridge/xin1.h)2
-rw-r--r--src/devices/bus/compis/graphics.h40
-rw-r--r--src/devices/bus/compis/hrg.cpp50
-rw-r--r--src/devices/bus/compis/hrg.h4
-rw-r--r--src/devices/bus/compucolor/floppy.cpp33
-rw-r--r--src/devices/bus/compucolor/floppy.h2
-rw-r--r--src/devices/bus/comx35/clm.cpp31
-rw-r--r--src/devices/bus/comx35/clm.h4
-rw-r--r--src/devices/bus/comx35/eprom.cpp4
-rw-r--r--src/devices/bus/comx35/eprom.h4
-rw-r--r--src/devices/bus/comx35/exp.cpp16
-rw-r--r--src/devices/bus/comx35/exp.h16
-rw-r--r--src/devices/bus/comx35/expbox.cpp16
-rw-r--r--src/devices/bus/comx35/expbox.h8
-rw-r--r--src/devices/bus/comx35/fdc.cpp6
-rw-r--r--src/devices/bus/comx35/fdc.h6
-rw-r--r--src/devices/bus/comx35/joycard.cpp2
-rw-r--r--src/devices/bus/comx35/joycard.h2
-rw-r--r--src/devices/bus/comx35/printer.cpp27
-rw-r--r--src/devices/bus/comx35/printer.h6
-rw-r--r--src/devices/bus/comx35/ram.cpp6
-rw-r--r--src/devices/bus/comx35/ram.h6
-rw-r--r--src/devices/bus/comx35/thermal.cpp6
-rw-r--r--src/devices/bus/comx35/thermal.h6
-rw-r--r--src/devices/bus/cpc/amdrum.cpp12
-rw-r--r--src/devices/bus/cpc/cpc_rom.cpp21
-rw-r--r--src/devices/bus/cpc/cpc_rom.h3
-rw-r--r--src/devices/bus/cpc/cpcexp.cpp2
-rw-r--r--src/devices/bus/cpc/ddi1.cpp6
-rw-r--r--src/devices/bus/cpc/doubler.cpp13
-rw-r--r--src/devices/bus/cpc/hd20.cpp11
-rw-r--r--src/devices/bus/cpc/magicsound.cpp16
-rw-r--r--src/devices/bus/cpc/playcity.cpp12
-rw-r--r--src/devices/bus/cpc/smartwatch.cpp13
-rw-r--r--src/devices/bus/cpc/symbfac2.cpp19
-rw-r--r--src/devices/bus/dmv/dmvbus.cpp13
-rw-r--r--src/devices/bus/dmv/dmvbus.h51
-rw-r--r--src/devices/bus/dmv/k210.cpp13
-rw-r--r--src/devices/bus/dmv/k210.h4
-rw-r--r--src/devices/bus/dmv/k220.cpp3
-rw-r--r--src/devices/bus/dmv/k220.h1
-rw-r--r--src/devices/bus/dmv/k230.cpp13
-rw-r--r--src/devices/bus/dmv/k230.h3
-rw-r--r--src/devices/bus/dmv/k233.cpp2
-rw-r--r--src/devices/bus/dmv/k233.h2
-rw-r--r--src/devices/bus/dmv/k801.cpp8
-rw-r--r--src/devices/bus/dmv/k801.h8
-rw-r--r--src/devices/bus/dmv/k803.cpp17
-rw-r--r--src/devices/bus/dmv/k803.h4
-rw-r--r--src/devices/bus/dmv/k806.cpp8
-rw-r--r--src/devices/bus/dmv/k806.h4
-rw-r--r--src/devices/bus/ecbbus/ecbbus.h38
-rw-r--r--src/devices/bus/econet/e01.cpp8
-rw-r--r--src/devices/bus/econet/econet.h24
-rw-r--r--src/devices/bus/einstein/pipe/pipe.cpp44
-rw-r--r--src/devices/bus/einstein/pipe/pipe.h9
-rw-r--r--src/devices/bus/einstein/pipe/speculator.cpp13
-rw-r--r--src/devices/bus/einstein/pipe/tk02.cpp3
-rw-r--r--src/devices/bus/einstein/userport/userport.h29
-rw-r--r--src/devices/bus/ekara/rom.cpp121
-rw-r--r--src/devices/bus/ekara/rom.h46
-rw-r--r--src/devices/bus/ekara/slot.cpp38
-rw-r--r--src/devices/bus/ekara/slot.h21
-rw-r--r--src/devices/bus/electron/cart/abr.cpp16
-rw-r--r--src/devices/bus/electron/cart/abr.h4
-rw-r--r--src/devices/bus/electron/cart/ap34.cpp28
-rw-r--r--src/devices/bus/electron/cart/ap34.h6
-rw-r--r--src/devices/bus/electron/cart/ap5.cpp171
-rw-r--r--src/devices/bus/electron/cart/ap5.h60
-rw-r--r--src/devices/bus/electron/cart/aqr.cpp19
-rw-r--r--src/devices/bus/electron/cart/aqr.h4
-rw-r--r--src/devices/bus/electron/cart/click.cpp21
-rw-r--r--src/devices/bus/electron/cart/click.h6
-rw-r--r--src/devices/bus/electron/cart/cumana.cpp22
-rw-r--r--src/devices/bus/electron/cart/cumana.h6
-rw-r--r--src/devices/bus/electron/cart/mgc.cpp23
-rw-r--r--src/devices/bus/electron/cart/mgc.h4
-rw-r--r--src/devices/bus/electron/cart/peg400.cpp20
-rw-r--r--src/devices/bus/electron/cart/peg400.h6
-rw-r--r--src/devices/bus/electron/cart/romp144.cpp162
-rw-r--r--src/devices/bus/electron/cart/romp144.h60
-rw-r--r--src/devices/bus/electron/cart/slot.cpp26
-rw-r--r--src/devices/bus/electron/cart/slot.h33
-rw-r--r--src/devices/bus/electron/cart/sndexp.cpp19
-rw-r--r--src/devices/bus/electron/cart/sndexp.h4
-rw-r--r--src/devices/bus/electron/cart/sndexp3.cpp18
-rw-r--r--src/devices/bus/electron/cart/sndexp3.h4
-rw-r--r--src/devices/bus/electron/cart/sp64.cpp14
-rw-r--r--src/devices/bus/electron/cart/sp64.h4
-rw-r--r--src/devices/bus/electron/cart/std.cpp6
-rw-r--r--src/devices/bus/electron/cart/std.h2
-rw-r--r--src/devices/bus/electron/cart/stlefs.cpp32
-rw-r--r--src/devices/bus/electron/cart/stlefs.h8
-rw-r--r--src/devices/bus/electron/cart/tube.cpp91
-rw-r--r--src/devices/bus/electron/cart/tube.h47
-rw-r--r--src/devices/bus/electron/exp.cpp30
-rw-r--r--src/devices/bus/electron/exp.h52
-rw-r--r--src/devices/bus/electron/fbjoy.cpp4
-rw-r--r--src/devices/bus/electron/fbjoy.h2
-rw-r--r--src/devices/bus/electron/m2105.cpp154
-rw-r--r--src/devices/bus/electron/m2105.h9
-rw-r--r--src/devices/bus/electron/plus1.cpp79
-rw-r--r--src/devices/bus/electron/plus1.h8
-rw-r--r--src/devices/bus/electron/plus2.cpp236
-rw-r--r--src/devices/bus/electron/plus2.h62
-rw-r--r--src/devices/bus/electron/plus3.cpp31
-rw-r--r--src/devices/bus/electron/plus3.h6
-rw-r--r--src/devices/bus/electron/pwrjoy.cpp6
-rw-r--r--src/devices/bus/electron/pwrjoy.h4
-rw-r--r--src/devices/bus/electron/rombox.cpp65
-rw-r--r--src/devices/bus/electron/rombox.h4
-rw-r--r--src/devices/bus/electron/romboxp.cpp95
-rw-r--r--src/devices/bus/electron/romboxp.h8
-rw-r--r--src/devices/bus/ep64/exp.cpp3
-rw-r--r--src/devices/bus/ep64/exp.h40
-rw-r--r--src/devices/bus/epson_sio/epson_sio.h38
-rw-r--r--src/devices/bus/epson_sio/pf10.cpp22
-rw-r--r--src/devices/bus/epson_sio/pf10.h3
-rw-r--r--src/devices/bus/epson_sio/tf20.cpp36
-rw-r--r--src/devices/bus/epson_sio/tf20.h5
-rw-r--r--src/devices/bus/gamate/rom.cpp7
-rw-r--r--src/devices/bus/gamate/slot.h16
-rw-r--r--src/devices/bus/gameboy/gb_slot.cpp16
-rw-r--r--src/devices/bus/gameboy/gb_slot.h16
-rw-r--r--src/devices/bus/gameboy/mbc.cpp132
-rw-r--r--src/devices/bus/gameboy/mbc.h132
-rw-r--r--src/devices/bus/gameboy/rom.cpp34
-rw-r--r--src/devices/bus/gameboy/rom.h34
-rw-r--r--src/devices/bus/gamegear/ggext.h38
-rw-r--r--src/devices/bus/gamegear/smsctrladp.cpp11
-rw-r--r--src/devices/bus/gba/gba_slot.h17
-rw-r--r--src/devices/bus/gba/rom.cpp32
-rw-r--r--src/devices/bus/generic/ram.cpp8
-rw-r--r--src/devices/bus/generic/ram.h8
-rw-r--r--src/devices/bus/generic/rom.cpp16
-rw-r--r--src/devices/bus/generic/rom.h16
-rw-r--r--src/devices/bus/generic/slot.cpp20
-rw-r--r--src/devices/bus/generic/slot.h20
-rw-r--r--src/devices/bus/hexbus/hx5102.cpp11
-rw-r--r--src/devices/bus/hp80_io/hp80_io.h27
-rw-r--r--src/devices/bus/hp80_optroms/hp80_optrom.h13
-rw-r--r--src/devices/bus/hp9845_io/98032.cpp7
-rw-r--r--src/devices/bus/hp9845_io/98034.cpp19
-rw-r--r--src/devices/bus/hp9845_io/hp9885.cpp974
-rw-r--r--src/devices/bus/hp9845_io/hp9885.h136
-rw-r--r--src/devices/bus/hp_dio/hp98265a.cpp4
-rw-r--r--src/devices/bus/hp_dio/hp98603a.cpp5
-rw-r--r--src/devices/bus/hp_dio/hp98603b.cpp5
-rw-r--r--src/devices/bus/hp_dio/hp98620.cpp6
-rw-r--r--src/devices/bus/hp_dio/hp98643.cpp2
-rw-r--r--src/devices/bus/hp_dio/hp_dio.cpp6
-rw-r--r--src/devices/bus/hp_dio/hp_dio.h9
-rw-r--r--src/devices/bus/hp_dio/human_interface.cpp12
-rw-r--r--src/devices/bus/ieee488/c2040fdc.h19
-rw-r--r--src/devices/bus/ieee488/c8280.cpp31
-rw-r--r--src/devices/bus/ieee488/hardbox.cpp25
-rw-r--r--src/devices/bus/ieee488/hp9122c.cpp19
-rw-r--r--src/devices/bus/ieee488/ieee488.h116
-rw-r--r--src/devices/bus/ieee488/remote488.cpp7
-rw-r--r--src/devices/bus/ieee488/softbox.cpp31
-rw-r--r--src/devices/bus/imi7000/imi7000.h51
-rw-r--r--src/devices/bus/intellec4/intellec4.cpp29
-rw-r--r--src/devices/bus/intellec4/intellec4.h27
-rw-r--r--src/devices/bus/interpro/keyboard/hle.cpp8
-rw-r--r--src/devices/bus/interpro/sr/edge.cpp4
-rw-r--r--src/devices/bus/interpro/sr/sr.cpp3
-rw-r--r--src/devices/bus/interpro/sr/sr.h26
-rw-r--r--src/devices/bus/intv/ecs.cpp55
-rw-r--r--src/devices/bus/intv/ecs.h54
-rw-r--r--src/devices/bus/intv/rom.h38
-rw-r--r--src/devices/bus/intv/slot.cpp16
-rw-r--r--src/devices/bus/intv/slot.h128
-rw-r--r--src/devices/bus/intv/voice.cpp31
-rw-r--r--src/devices/bus/intv/voice.h42
-rw-r--r--src/devices/bus/intv_ctrl/ctrl.h23
-rw-r--r--src/devices/bus/intv_ctrl/ecs_ctrl.cpp9
-rw-r--r--src/devices/bus/intv_ctrl/ecs_ctrl.h22
-rw-r--r--src/devices/bus/iq151/disc2.cpp11
-rw-r--r--src/devices/bus/iq151/iq151.h52
-rw-r--r--src/devices/bus/isa/3c503.cpp13
-rw-r--r--src/devices/bus/isa/3c505.cpp4
-rw-r--r--src/devices/bus/isa/adlib.cpp14
-rw-r--r--src/devices/bus/isa/aga.cpp25
-rw-r--r--src/devices/bus/isa/aha1542.cpp200
-rw-r--r--src/devices/bus/isa/aha1542.h54
-rw-r--r--src/devices/bus/isa/aha1542b.cpp126
-rw-r--r--src/devices/bus/isa/aha1542b.h57
-rw-r--r--src/devices/bus/isa/aha1542c.cpp323
-rw-r--r--src/devices/bus/isa/aha1542c.h95
-rw-r--r--src/devices/bus/isa/aha174x.cpp160
-rw-r--r--src/devices/bus/isa/aha174x.h61
-rw-r--r--src/devices/bus/isa/bt54x.cpp201
-rw-r--r--src/devices/bus/isa/bt54x.h74
-rw-r--r--src/devices/bus/isa/cga.cpp43
-rw-r--r--src/devices/bus/isa/cl_sh260.cpp93
-rw-r--r--src/devices/bus/isa/cl_sh260.h64
-rw-r--r--src/devices/bus/isa/dcb.cpp70
-rw-r--r--src/devices/bus/isa/dcb.h43
-rw-r--r--src/devices/bus/isa/dectalk.cpp1
-rw-r--r--src/devices/bus/isa/ega.cpp45
-rw-r--r--src/devices/bus/isa/ega.h2
-rw-r--r--src/devices/bus/isa/eis_sad8852.cpp11
-rw-r--r--src/devices/bus/isa/fdc.cpp5
-rw-r--r--src/devices/bus/isa/fdc.h1
-rw-r--r--src/devices/bus/isa/finalchs.cpp9
-rw-r--r--src/devices/bus/isa/gus.cpp22
-rw-r--r--src/devices/bus/isa/gus.h43
-rw-r--r--src/devices/bus/isa/hdc.cpp32
-rw-r--r--src/devices/bus/isa/hdc.h9
-rw-r--r--src/devices/bus/isa/ibm_mfc.cpp17
-rw-r--r--src/devices/bus/isa/isa.cpp92
-rw-r--r--src/devices/bus/isa/isa.h26
-rw-r--r--src/devices/bus/isa/isa_cards.cpp23
-rw-r--r--src/devices/bus/isa/lbaenhancer.cpp7
-rw-r--r--src/devices/bus/isa/mc1502_fdc.cpp12
-rw-r--r--src/devices/bus/isa/mda.cpp57
-rw-r--r--src/devices/bus/isa/mufdc.cpp5
-rw-r--r--src/devices/bus/isa/mufdc.h1
-rw-r--r--src/devices/bus/isa/ne1000.cpp13
-rw-r--r--src/devices/bus/isa/ne2000.cpp13
-rw-r--r--src/devices/bus/isa/np600.cpp76
-rw-r--r--src/devices/bus/isa/np600.h39
-rw-r--r--src/devices/bus/isa/num9rev.cpp21
-rw-r--r--src/devices/bus/isa/omti8621.cpp5
-rw-r--r--src/devices/bus/isa/omti8621.h1
-rw-r--r--src/devices/bus/isa/p1_fdc.cpp15
-rw-r--r--src/devices/bus/isa/p1_hdc.cpp26
-rw-r--r--src/devices/bus/isa/p1_sound.cpp20
-rw-r--r--src/devices/bus/isa/pc1640_iga.cpp4
-rw-r--r--src/devices/bus/isa/pds.cpp7
-rw-r--r--src/devices/bus/isa/pgc.cpp33
-rw-r--r--src/devices/bus/isa/sb16.cpp6
-rw-r--r--src/devices/bus/isa/sblaster.cpp37
-rw-r--r--src/devices/bus/isa/sc499.cpp7
-rw-r--r--src/devices/bus/isa/ssi2001.cpp2
-rw-r--r--src/devices/bus/isa/stereo_fx.cpp5
-rw-r--r--src/devices/bus/isa/svga_cirrus.cpp28
-rw-r--r--src/devices/bus/isa/svga_s3.cpp56
-rw-r--r--src/devices/bus/isa/svga_trident.cpp16
-rw-r--r--src/devices/bus/isa/svga_tseng.cpp16
-rw-r--r--src/devices/bus/isa/vga.cpp16
-rw-r--r--src/devices/bus/isa/vga_ati.cpp53
-rw-r--r--src/devices/bus/isa/wd1007a.cpp7
-rw-r--r--src/devices/bus/isa/wdxt_gen.cpp10
-rw-r--r--src/devices/bus/isa/wdxt_gen.h1
-rw-r--r--src/devices/bus/isbx/compis_fdc.cpp14
-rw-r--r--src/devices/bus/isbx/compis_fdc.h8
-rw-r--r--src/devices/bus/isbx/isbc_218a.cpp18
-rw-r--r--src/devices/bus/isbx/isbc_218a.h12
-rw-r--r--src/devices/bus/isbx/isbx.h24
-rw-r--r--src/devices/bus/jakks_gamekey/rom.cpp111
-rw-r--r--src/devices/bus/jakks_gamekey/rom.h77
-rw-r--r--src/devices/bus/jakks_gamekey/slot.cpp237
-rw-r--r--src/devices/bus/jakks_gamekey/slot.h119
-rw-r--r--src/devices/bus/kc/d002.cpp60
-rw-r--r--src/devices/bus/kc/d004.cpp4
-rw-r--r--src/devices/bus/kc/kc.h62
-rw-r--r--src/devices/bus/lpci/mpc105.cpp4
-rw-r--r--src/devices/bus/lpci/mpc105.h10
-rw-r--r--src/devices/bus/lpci/pci.h16
-rw-r--r--src/devices/bus/lpci/southbridge.cpp55
-rw-r--r--src/devices/bus/lpci/southbridge.h1
-rw-r--r--src/devices/bus/m5/slot.h17
-rw-r--r--src/devices/bus/macpds/macpds.h16
-rw-r--r--src/devices/bus/macpds/pds_tpdfpd.cpp13
-rw-r--r--src/devices/bus/megadrive/eeprom.cpp49
-rw-r--r--src/devices/bus/megadrive/ggenie.cpp9
-rw-r--r--src/devices/bus/megadrive/jcart.cpp14
-rw-r--r--src/devices/bus/megadrive/md_slot.h18
-rw-r--r--src/devices/bus/megadrive/sk.cpp9
-rw-r--r--src/devices/bus/megadrive/svp.cpp11
-rw-r--r--src/devices/bus/midi/midi.h8
-rw-r--r--src/devices/bus/midi/midiinport.cpp9
-rw-r--r--src/devices/bus/midi/midioutport.cpp7
-rw-r--r--src/devices/bus/msx_cart/arc.cpp11
-rw-r--r--src/devices/bus/msx_cart/arc.h8
-rw-r--r--src/devices/bus/msx_cart/ascii.cpp50
-rw-r--r--src/devices/bus/msx_cart/ascii.h25
-rw-r--r--src/devices/bus/msx_cart/bm_012.cpp17
-rw-r--r--src/devices/bus/msx_cart/cartridge.cpp19
-rw-r--r--src/devices/bus/msx_cart/cartridge.h21
-rw-r--r--src/devices/bus/msx_cart/crossblaim.cpp10
-rw-r--r--src/devices/bus/msx_cart/crossblaim.h5
-rw-r--r--src/devices/bus/msx_cart/disk.cpp74
-rw-r--r--src/devices/bus/msx_cart/disk.h18
-rw-r--r--src/devices/bus/msx_cart/dooly.cpp4
-rw-r--r--src/devices/bus/msx_cart/dooly.h4
-rw-r--r--src/devices/bus/msx_cart/fmpac.cpp29
-rw-r--r--src/devices/bus/msx_cart/fmpac.h9
-rw-r--r--src/devices/bus/msx_cart/fs_sr022.cpp4
-rw-r--r--src/devices/bus/msx_cart/fs_sr022.h4
-rw-r--r--src/devices/bus/msx_cart/halnote.cpp10
-rw-r--r--src/devices/bus/msx_cart/halnote.h5
-rw-r--r--src/devices/bus/msx_cart/hfox.cpp10
-rw-r--r--src/devices/bus/msx_cart/hfox.h5
-rw-r--r--src/devices/bus/msx_cart/holy_quran.cpp10
-rw-r--r--src/devices/bus/msx_cart/holy_quran.h5
-rw-r--r--src/devices/bus/msx_cart/konami.cpp142
-rw-r--r--src/devices/bus/msx_cart/konami.h32
-rw-r--r--src/devices/bus/msx_cart/korean.cpp35
-rw-r--r--src/devices/bus/msx_cart/korean.h17
-rw-r--r--src/devices/bus/msx_cart/majutsushi.cpp22
-rw-r--r--src/devices/bus/msx_cart/majutsushi.h5
-rw-r--r--src/devices/bus/msx_cart/moonsound.cpp29
-rw-r--r--src/devices/bus/msx_cart/moonsound.h10
-rw-r--r--src/devices/bus/msx_cart/msx_audio.cpp43
-rw-r--r--src/devices/bus/msx_cart/msx_audio.h18
-rw-r--r--src/devices/bus/msx_cart/msx_audio_kb.cpp16
-rw-r--r--src/devices/bus/msx_cart/msx_audio_kb.h9
-rw-r--r--src/devices/bus/msx_cart/msxdos2.cpp10
-rw-r--r--src/devices/bus/msx_cart/msxdos2.h5
-rw-r--r--src/devices/bus/msx_cart/nomapper.cpp2
-rw-r--r--src/devices/bus/msx_cart/nomapper.h2
-rw-r--r--src/devices/bus/msx_cart/rtype.cpp10
-rw-r--r--src/devices/bus/msx_cart/rtype.h5
-rw-r--r--src/devices/bus/msx_cart/super_swangi.cpp10
-rw-r--r--src/devices/bus/msx_cart/super_swangi.h5
-rw-r--r--src/devices/bus/msx_cart/superloderunner.cpp15
-rw-r--r--src/devices/bus/msx_cart/superloderunner.h7
-rw-r--r--src/devices/bus/msx_cart/yamaha.cpp18
-rw-r--r--src/devices/bus/msx_cart/yamaha.h5
-rw-r--r--src/devices/bus/msx_slot/bunsetsu.cpp6
-rw-r--r--src/devices/bus/msx_slot/bunsetsu.h9
-rw-r--r--src/devices/bus/msx_slot/cartridge.cpp25
-rw-r--r--src/devices/bus/msx_slot/cartridge.h21
-rw-r--r--src/devices/bus/msx_slot/disk.cpp75
-rw-r--r--src/devices/bus/msx_slot/disk.h98
-rw-r--r--src/devices/bus/msx_slot/fs4600.cpp12
-rw-r--r--src/devices/bus/msx_slot/fs4600.h9
-rw-r--r--src/devices/bus/msx_slot/music.cpp11
-rw-r--r--src/devices/bus/msx_slot/music.h11
-rw-r--r--src/devices/bus/msx_slot/panasonic08.cpp12
-rw-r--r--src/devices/bus/msx_slot/panasonic08.h9
-rw-r--r--src/devices/bus/msx_slot/ram.cpp6
-rw-r--r--src/devices/bus/msx_slot/ram.h12
-rw-r--r--src/devices/bus/msx_slot/ram_mm.cpp22
-rw-r--r--src/devices/bus/msx_slot/ram_mm.h22
-rw-r--r--src/devices/bus/msx_slot/rom.cpp4
-rw-r--r--src/devices/bus/msx_slot/rom.h6
-rw-r--r--src/devices/bus/msx_slot/slot.cpp7
-rw-r--r--src/devices/bus/msx_slot/slot.h20
-rw-r--r--src/devices/bus/msx_slot/sony08.cpp12
-rw-r--r--src/devices/bus/msx_slot/sony08.h9
-rw-r--r--src/devices/bus/mtx/exp.cpp109
-rw-r--r--src/devices/bus/mtx/exp.h93
-rw-r--r--src/devices/bus/mtx/sdx.cpp425
-rw-r--r--src/devices/bus/mtx/sdx.h105
-rw-r--r--src/devices/bus/nasbus/avc.cpp15
-rw-r--r--src/devices/bus/nasbus/nasbus.cpp35
-rw-r--r--src/devices/bus/nasbus/nasbus.h42
-rw-r--r--src/devices/bus/neogeo/boot_cthd.cpp18
-rw-r--r--src/devices/bus/neogeo/boot_kof10th.cpp7
-rw-r--r--src/devices/bus/neogeo/boot_kof2k2.cpp39
-rw-r--r--src/devices/bus/neogeo/boot_kof2k3.cpp43
-rw-r--r--src/devices/bus/neogeo/boot_misc.cpp27
-rw-r--r--src/devices/bus/neogeo/boot_svc.cpp18
-rw-r--r--src/devices/bus/neogeo/cmc.cpp19
-rw-r--r--src/devices/bus/neogeo/cmc.h8
-rw-r--r--src/devices/bus/neogeo/fatfury2.cpp7
-rw-r--r--src/devices/bus/neogeo/kof2k2.cpp13
-rw-r--r--src/devices/bus/neogeo/kof98.cpp7
-rw-r--r--src/devices/bus/neogeo/mslugx.cpp7
-rw-r--r--src/devices/bus/neogeo/pcm2.cpp9
-rw-r--r--src/devices/bus/neogeo/prot_cmc.h5
-rw-r--r--src/devices/bus/neogeo/prot_cthd.h6
-rw-r--r--src/devices/bus/neogeo/prot_fatfury2.h5
-rw-r--r--src/devices/bus/neogeo/prot_kof2k2.h5
-rw-r--r--src/devices/bus/neogeo/prot_kof2k3bl.h5
-rw-r--r--src/devices/bus/neogeo/prot_kof98.h5
-rw-r--r--src/devices/bus/neogeo/prot_misc.h5
-rw-r--r--src/devices/bus/neogeo/prot_mslugx.h5
-rw-r--r--src/devices/bus/neogeo/prot_pcm2.h5
-rw-r--r--src/devices/bus/neogeo/prot_pvc.h5
-rw-r--r--src/devices/bus/neogeo/prot_sma.h5
-rw-r--r--src/devices/bus/neogeo/pvc.cpp11
-rw-r--r--src/devices/bus/neogeo/rom.cpp12
-rw-r--r--src/devices/bus/neogeo/rom.h8
-rw-r--r--src/devices/bus/neogeo/slot.h20
-rw-r--r--src/devices/bus/neogeo/sma.cpp9
-rw-r--r--src/devices/bus/neogeo_ctrl/ctrl.h32
-rw-r--r--src/devices/bus/nes/2a03pur.cpp4
-rw-r--r--src/devices/bus/nes/2a03pur.h4
-rw-r--r--src/devices/bus/nes/act53.cpp4
-rw-r--r--src/devices/bus/nes/act53.h4
-rw-r--r--src/devices/bus/nes/aladdin.cpp21
-rw-r--r--src/devices/bus/nes/aladdin.h23
-rw-r--r--src/devices/bus/nes/ave.cpp6
-rw-r--r--src/devices/bus/nes/ave.h6
-rw-r--r--src/devices/bus/nes/bandai.cpp40
-rw-r--r--src/devices/bus/nes/bandai.h22
-rw-r--r--src/devices/bus/nes/benshieng.cpp2
-rw-r--r--src/devices/bus/nes/benshieng.h2
-rw-r--r--src/devices/bus/nes/bootleg.cpp98
-rw-r--r--src/devices/bus/nes/bootleg.h98
-rw-r--r--src/devices/bus/nes/camerica.cpp6
-rw-r--r--src/devices/bus/nes/camerica.h8
-rw-r--r--src/devices/bus/nes/cne.cpp8
-rw-r--r--src/devices/bus/nes/cne.h8
-rw-r--r--src/devices/bus/nes/cony.cpp12
-rw-r--r--src/devices/bus/nes/cony.h12
-rw-r--r--src/devices/bus/nes/datach.cpp36
-rw-r--r--src/devices/bus/nes/datach.h24
-rw-r--r--src/devices/bus/nes/discrete.cpp8
-rw-r--r--src/devices/bus/nes/discrete.h8
-rw-r--r--src/devices/bus/nes/disksys.cpp19
-rw-r--r--src/devices/bus/nes/disksys.h12
-rw-r--r--src/devices/bus/nes/ggenie.cpp38
-rw-r--r--src/devices/bus/nes/ggenie.h22
-rw-r--r--src/devices/bus/nes/henggedianzi.cpp8
-rw-r--r--src/devices/bus/nes/henggedianzi.h8
-rw-r--r--src/devices/bus/nes/hes.cpp2
-rw-r--r--src/devices/bus/nes/hes.h2
-rw-r--r--src/devices/bus/nes/hosenkan.cpp2
-rw-r--r--src/devices/bus/nes/hosenkan.h2
-rw-r--r--src/devices/bus/nes/irem.cpp10
-rw-r--r--src/devices/bus/nes/irem.h10
-rw-r--r--src/devices/bus/nes/jaleco.cpp22
-rw-r--r--src/devices/bus/nes/jaleco.h28
-rw-r--r--src/devices/bus/nes/jy.cpp20
-rw-r--r--src/devices/bus/nes/jy.h14
-rw-r--r--src/devices/bus/nes/kaiser.cpp48
-rw-r--r--src/devices/bus/nes/kaiser.h46
-rw-r--r--src/devices/bus/nes/karastudio.cpp23
-rw-r--r--src/devices/bus/nes/karastudio.h25
-rw-r--r--src/devices/bus/nes/konami.cpp50
-rw-r--r--src/devices/bus/nes/konami.h18
-rw-r--r--src/devices/bus/nes/legacy.cpp12
-rw-r--r--src/devices/bus/nes/legacy.h14
-rw-r--r--src/devices/bus/nes/mmc1.cpp24
-rw-r--r--src/devices/bus/nes/mmc1.h18
-rw-r--r--src/devices/bus/nes/mmc2.cpp6
-rw-r--r--src/devices/bus/nes/mmc2.h6
-rw-r--r--src/devices/bus/nes/mmc3.cpp28
-rw-r--r--src/devices/bus/nes/mmc3.h20
-rw-r--r--src/devices/bus/nes/mmc3_clones.cpp202
-rw-r--r--src/devices/bus/nes/mmc3_clones.h112
-rw-r--r--src/devices/bus/nes/mmc5.cpp24
-rw-r--r--src/devices/bus/nes/mmc5.h20
-rw-r--r--src/devices/bus/nes/multigame.cpp128
-rw-r--r--src/devices/bus/nes/multigame.h122
-rw-r--r--src/devices/bus/nes/namcot.cpp44
-rw-r--r--src/devices/bus/nes/namcot.h40
-rw-r--r--src/devices/bus/nes/nanjing.cpp4
-rw-r--r--src/devices/bus/nes/nanjing.h4
-rw-r--r--src/devices/bus/nes/nes_slot.cpp63
-rw-r--r--src/devices/bus/nes/nes_slot.h51
-rw-r--r--src/devices/bus/nes/ntdec.cpp4
-rw-r--r--src/devices/bus/nes/ntdec.h4
-rw-r--r--src/devices/bus/nes/nxrom.cpp35
-rw-r--r--src/devices/bus/nes/nxrom.h28
-rw-r--r--src/devices/bus/nes/pirate.cpp48
-rw-r--r--src/devices/bus/nes/pirate.h46
-rw-r--r--src/devices/bus/nes/pt554.cpp2
-rw-r--r--src/devices/bus/nes/pt554.h2
-rw-r--r--src/devices/bus/nes/racermate.cpp2
-rw-r--r--src/devices/bus/nes/racermate.h2
-rw-r--r--src/devices/bus/nes/rcm.cpp12
-rw-r--r--src/devices/bus/nes/rcm.h14
-rw-r--r--src/devices/bus/nes/rexsoft.cpp8
-rw-r--r--src/devices/bus/nes/rexsoft.h10
-rw-r--r--src/devices/bus/nes/sachen.cpp26
-rw-r--r--src/devices/bus/nes/sachen.h34
-rw-r--r--src/devices/bus/nes/somari.cpp16
-rw-r--r--src/devices/bus/nes/somari.h12
-rw-r--r--src/devices/bus/nes/subor.cpp12
-rw-r--r--src/devices/bus/nes/subor.h10
-rw-r--r--src/devices/bus/nes/sunsoft.cpp30
-rw-r--r--src/devices/bus/nes/sunsoft.h24
-rw-r--r--src/devices/bus/nes/sunsoft_dcs.cpp27
-rw-r--r--src/devices/bus/nes/sunsoft_dcs.h27
-rw-r--r--src/devices/bus/nes/taito.cpp18
-rw-r--r--src/devices/bus/nes/taito.h14
-rw-r--r--src/devices/bus/nes/tengen.cpp8
-rw-r--r--src/devices/bus/nes/tengen.h8
-rw-r--r--src/devices/bus/nes/txc.cpp16
-rw-r--r--src/devices/bus/nes/txc.h16
-rw-r--r--src/devices/bus/nes/waixing.cpp46
-rw-r--r--src/devices/bus/nes/waixing.h36
-rw-r--r--src/devices/bus/nes/zemina.cpp2
-rw-r--r--src/devices/bus/nes/zemina.h2
-rw-r--r--src/devices/bus/nes_ctrl/fckeybrd.cpp11
-rw-r--r--src/devices/bus/nes_ctrl/miracle.cpp10
-rw-r--r--src/devices/bus/newbrain/eim.cpp25
-rw-r--r--src/devices/bus/newbrain/eim.h8
-rw-r--r--src/devices/bus/newbrain/exp.cpp16
-rw-r--r--src/devices/bus/newbrain/exp.h37
-rw-r--r--src/devices/bus/newbrain/fdc.cpp45
-rw-r--r--src/devices/bus/newbrain/fdc.h14
-rw-r--r--src/devices/bus/nubus/nubus.cpp56
-rw-r--r--src/devices/bus/nubus/nubus.h51
-rw-r--r--src/devices/bus/nubus/nubus_48gc.cpp19
-rw-r--r--src/devices/bus/nubus/nubus_asntmc3b.cpp13
-rw-r--r--src/devices/bus/nubus/nubus_cb264.cpp15
-rw-r--r--src/devices/bus/nubus/nubus_image.cpp7
-rw-r--r--src/devices/bus/nubus/nubus_m2hires.cpp15
-rw-r--r--src/devices/bus/nubus/nubus_m2video.cpp15
-rw-r--r--src/devices/bus/nubus/nubus_radiustpd.cpp13
-rw-r--r--src/devices/bus/nubus/nubus_spec8.cpp15
-rw-r--r--src/devices/bus/nubus/nubus_specpdq.cpp99
-rw-r--r--src/devices/bus/nubus/nubus_vikbw.cpp15
-rw-r--r--src/devices/bus/nubus/nubus_wsportrait.cpp15
-rw-r--r--src/devices/bus/nubus/pds30_30hr.cpp15
-rw-r--r--src/devices/bus/nubus/pds30_cb264.cpp15
-rw-r--r--src/devices/bus/nubus/pds30_mc30.cpp15
-rw-r--r--src/devices/bus/nubus/pds30_procolor816.cpp15
-rw-r--r--src/devices/bus/nubus/pds30_sigmalview.cpp15
-rw-r--r--src/devices/bus/odyssey2/chess.cpp11
-rw-r--r--src/devices/bus/odyssey2/slot.h16
-rw-r--r--src/devices/bus/odyssey2/voice.cpp7
-rw-r--r--src/devices/bus/pc1512/mouse.h37
-rw-r--r--src/devices/bus/pc_kbd/ec1841.cpp33
-rw-r--r--src/devices/bus/pc_kbd/iskr1030.cpp39
-rw-r--r--src/devices/bus/pc_kbd/pc_kbdc.cpp24
-rw-r--r--src/devices/bus/pc_kbd/pc_kbdc.h17
-rw-r--r--src/devices/bus/pce/pce_slot.h22
-rw-r--r--src/devices/bus/pet/2joysnd.cpp11
-rw-r--r--src/devices/bus/pet/64k.cpp6
-rw-r--r--src/devices/bus/pet/64k.h6
-rw-r--r--src/devices/bus/pet/c2n.cpp13
-rw-r--r--src/devices/bus/pet/cass.h13
-rw-r--r--src/devices/bus/pet/cb2snd.cpp11
-rw-r--r--src/devices/bus/pet/exp.cpp12
-rw-r--r--src/devices/bus/pet/exp.h32
-rw-r--r--src/devices/bus/pet/hsg.cpp66
-rw-r--r--src/devices/bus/pet/hsg.h9
-rw-r--r--src/devices/bus/pet/superpet.cpp16
-rw-r--r--src/devices/bus/pet/superpet.h6
-rw-r--r--src/devices/bus/plus4/c1551.cpp38
-rw-r--r--src/devices/bus/plus4/c1551.h26
-rw-r--r--src/devices/bus/plus4/exp.cpp8
-rw-r--r--src/devices/bus/plus4/exp.h43
-rw-r--r--src/devices/bus/plus4/sid.cpp20
-rw-r--r--src/devices/bus/plus4/sid.h4
-rw-r--r--src/devices/bus/plus4/std.cpp2
-rw-r--r--src/devices/bus/plus4/std.h2
-rw-r--r--src/devices/bus/pofo/ccm.h31
-rw-r--r--src/devices/bus/pofo/exp.h44
-rw-r--r--src/devices/bus/pofo/hpc101.cpp37
-rw-r--r--src/devices/bus/pofo/hpc101.h4
-rw-r--r--src/devices/bus/pofo/hpc102.cpp8
-rw-r--r--src/devices/bus/pofo/hpc102.h4
-rw-r--r--src/devices/bus/pofo/hpc104.cpp27
-rw-r--r--src/devices/bus/pofo/hpc104.h4
-rw-r--r--src/devices/bus/pofo/ram.cpp4
-rw-r--r--src/devices/bus/pofo/ram.h4
-rw-r--r--src/devices/bus/pofo/rom.cpp2
-rw-r--r--src/devices/bus/pofo/rom.h2
-rw-r--r--src/devices/bus/psi_kbd/ergoline.cpp11
-rw-r--r--src/devices/bus/psi_kbd/psi_kbd.h34
-rw-r--r--src/devices/bus/psx/ctlrport.cpp7
-rw-r--r--src/devices/bus/psx/ctlrport.h5
-rw-r--r--src/devices/bus/psx/gamebooster.cpp8
-rw-r--r--src/devices/bus/psx/memcard.h2
-rw-r--r--src/devices/bus/ql/cst_q_plus4.cpp43
-rw-r--r--src/devices/bus/ql/cst_q_plus4.h4
-rw-r--r--src/devices/bus/ql/cst_qdisc.cpp4
-rw-r--r--src/devices/bus/ql/cst_qdisc.h4
-rw-r--r--src/devices/bus/ql/cumana_fdi.cpp4
-rw-r--r--src/devices/bus/ql/cumana_fdi.h4
-rw-r--r--src/devices/bus/ql/exp.h34
-rw-r--r--src/devices/bus/ql/kempston_di.cpp4
-rw-r--r--src/devices/bus/ql/kempston_di.h4
-rw-r--r--src/devices/bus/ql/miracle_gold_card.cpp4
-rw-r--r--src/devices/bus/ql/miracle_gold_card.h4
-rw-r--r--src/devices/bus/ql/miracle_hd.cpp4
-rw-r--r--src/devices/bus/ql/miracle_hd.h4
-rw-r--r--src/devices/bus/ql/mp_fdi.cpp4
-rw-r--r--src/devices/bus/ql/mp_fdi.h4
-rw-r--r--src/devices/bus/ql/opd_basic_master.cpp4
-rw-r--r--src/devices/bus/ql/opd_basic_master.h4
-rw-r--r--src/devices/bus/ql/pcml_qdisk.cpp4
-rw-r--r--src/devices/bus/ql/pcml_qdisk.h4
-rw-r--r--src/devices/bus/ql/qubide.cpp4
-rw-r--r--src/devices/bus/ql/qubide.h4
-rw-r--r--src/devices/bus/ql/rom.h8
-rw-r--r--src/devices/bus/ql/sandy_superdisk.cpp4
-rw-r--r--src/devices/bus/ql/sandy_superdisk.h4
-rw-r--r--src/devices/bus/ql/sandy_superqboard.cpp4
-rw-r--r--src/devices/bus/ql/sandy_superqboard.h4
-rw-r--r--src/devices/bus/ql/std.cpp2
-rw-r--r--src/devices/bus/ql/std.h2
-rw-r--r--src/devices/bus/ql/trumpcard.cpp4
-rw-r--r--src/devices/bus/ql/trumpcard.h4
-rw-r--r--src/devices/bus/rs232/null_modem.cpp7
-rw-r--r--src/devices/bus/rs232/printer.cpp9
-rw-r--r--src/devices/bus/rs232/xvd701.cpp5
-rw-r--r--src/devices/bus/s100/dj2db.cpp8
-rw-r--r--src/devices/bus/s100/dj2db.h8
-rw-r--r--src/devices/bus/s100/djdma.cpp2
-rw-r--r--src/devices/bus/s100/djdma.h2
-rw-r--r--src/devices/bus/s100/mm65k16s.cpp4
-rw-r--r--src/devices/bus/s100/mm65k16s.h4
-rw-r--r--src/devices/bus/s100/nsmdsa.cpp14
-rw-r--r--src/devices/bus/s100/nsmdsa.h5
-rw-r--r--src/devices/bus/s100/nsmdsad.cpp14
-rw-r--r--src/devices/bus/s100/nsmdsad.h5
-rw-r--r--src/devices/bus/s100/s100.cpp16
-rw-r--r--src/devices/bus/s100/s100.h121
-rw-r--r--src/devices/bus/s100/seals8k.cpp8
-rw-r--r--src/devices/bus/s100/wunderbus.cpp16
-rw-r--r--src/devices/bus/s100/wunderbus.h4
-rw-r--r--src/devices/bus/saturn/sat_slot.h16
-rw-r--r--src/devices/bus/sbus/cgthree.cpp4
-rw-r--r--src/devices/bus/scsi/omti5100.cpp9
-rw-r--r--src/devices/bus/scsi/s1410.cpp17
-rw-r--r--src/devices/bus/scsi/sa1403d.cpp7
-rw-r--r--src/devices/bus/scsi/scsi.h88
-rw-r--r--src/devices/bus/scsi/scsicd.cpp10
-rw-r--r--src/devices/bus/scsi/scsihd.cpp8
-rw-r--r--src/devices/bus/scsi/scsihle.h6
-rw-r--r--src/devices/bus/scv/slot.h16
-rw-r--r--src/devices/bus/sega8/ccatch.cpp7
-rw-r--r--src/devices/bus/sega8/mgear.cpp9
-rw-r--r--src/devices/bus/sega8/rom.cpp112
-rw-r--r--src/devices/bus/sega8/rom.h56
-rw-r--r--src/devices/bus/sega8/sega8_slot.cpp91
-rw-r--r--src/devices/bus/sega8/sega8_slot.h262
-rw-r--r--src/devices/bus/sg1000_exp/fm_unit.cpp13
-rw-r--r--src/devices/bus/sg1000_exp/kblink.cpp179
-rw-r--r--src/devices/bus/sg1000_exp/kblink.h82
-rw-r--r--src/devices/bus/sg1000_exp/sg1000exp.h26
-rw-r--r--src/devices/bus/sg1000_exp/sk1100.cpp45
-rw-r--r--src/devices/bus/sg1000_exp/sk1100.h3
-rw-r--r--src/devices/bus/sg1000_exp/sk1100prn.cpp125
-rw-r--r--src/devices/bus/sg1000_exp/sk1100prn.h88
-rw-r--r--src/devices/bus/sms_ctrl/multitap.cpp21
-rw-r--r--src/devices/bus/sms_ctrl/rfu.cpp11
-rw-r--r--src/devices/bus/sms_ctrl/smsctrl.h34
-rw-r--r--src/devices/bus/sms_exp/gender.cpp7
-rw-r--r--src/devices/bus/sms_exp/smsexp.h23
-rw-r--r--src/devices/bus/snes/bsx.cpp38
-rw-r--r--src/devices/bus/snes/bsx.h32
-rw-r--r--src/devices/bus/snes/event.cpp23
-rw-r--r--src/devices/bus/snes/event.h12
-rw-r--r--src/devices/bus/snes/rom.cpp54
-rw-r--r--src/devices/bus/snes/rom.h54
-rw-r--r--src/devices/bus/snes/rom21.cpp8
-rw-r--r--src/devices/bus/snes/rom21.h8
-rw-r--r--src/devices/bus/snes/sa1.cpp87
-rw-r--r--src/devices/bus/snes/sa1.h32
-rw-r--r--src/devices/bus/snes/sdd1.cpp14
-rw-r--r--src/devices/bus/snes/sdd1.h12
-rw-r--r--src/devices/bus/snes/sfx.cpp26
-rw-r--r--src/devices/bus/snes/sfx.h26
-rw-r--r--src/devices/bus/snes/sgb.cpp44
-rw-r--r--src/devices/bus/snes/sgb.h33
-rw-r--r--src/devices/bus/snes/snes_slot.cpp51
-rw-r--r--src/devices/bus/snes/snes_slot.h36
-rw-r--r--src/devices/bus/snes/spc7110.cpp12
-rw-r--r--src/devices/bus/snes/spc7110.h20
-rw-r--r--src/devices/bus/snes/sufami.cpp26
-rw-r--r--src/devices/bus/snes/sufami.h10
-rw-r--r--src/devices/bus/snes/upd.cpp170
-rw-r--r--src/devices/bus/snes/upd.h30
-rw-r--r--src/devices/bus/snes_ctrl/ctrl.h22
-rw-r--r--src/devices/bus/snes_ctrl/miracle.cpp10
-rw-r--r--src/devices/bus/snes_ctrl/multitap.cpp13
-rw-r--r--src/devices/bus/spc1000/exp.h9
-rw-r--r--src/devices/bus/spectrum/beta.cpp256
-rw-r--r--src/devices/bus/spectrum/beta.h64
-rw-r--r--src/devices/bus/spectrum/exp.cpp63
-rw-r--r--src/devices/bus/spectrum/exp.h22
-rw-r--r--src/devices/bus/spectrum/fuller.cpp65
-rw-r--r--src/devices/bus/spectrum/fuller.h11
-rw-r--r--src/devices/bus/spectrum/intf1.cpp47
-rw-r--r--src/devices/bus/spectrum/intf1.h8
-rw-r--r--src/devices/bus/spectrum/intf2.cpp19
-rw-r--r--src/devices/bus/spectrum/intf2.h4
-rw-r--r--src/devices/bus/spectrum/kempjoy.cpp20
-rw-r--r--src/devices/bus/spectrum/kempjoy.h5
-rw-r--r--src/devices/bus/spectrum/melodik.cpp55
-rw-r--r--src/devices/bus/spectrum/melodik.h9
-rw-r--r--src/devices/bus/spectrum/mface.cpp321
-rw-r--r--src/devices/bus/spectrum/mface.h100
-rw-r--r--src/devices/bus/spectrum/mikroplus.cpp22
-rw-r--r--src/devices/bus/spectrum/mikroplus.h6
-rw-r--r--src/devices/bus/spectrum/opus.cpp289
-rw-r--r--src/devices/bus/spectrum/opus.h75
-rw-r--r--src/devices/bus/spectrum/plus2test.cpp2
-rw-r--r--src/devices/bus/spectrum/plus2test.h2
-rw-r--r--src/devices/bus/spectrum/protek.cpp17
-rw-r--r--src/devices/bus/spectrum/protek.h2
-rw-r--r--src/devices/bus/spectrum/specdrum.cpp73
-rw-r--r--src/devices/bus/spectrum/specdrum.h51
-rw-r--r--src/devices/bus/spectrum/uslot.cpp38
-rw-r--r--src/devices/bus/spectrum/uslot.h8
-rw-r--r--src/devices/bus/spectrum/usource.cpp13
-rw-r--r--src/devices/bus/spectrum/usource.h3
-rw-r--r--src/devices/bus/spectrum/uspeech.cpp40
-rw-r--r--src/devices/bus/spectrum/uspeech.h6
-rw-r--r--src/devices/bus/ss50/interface.cpp10
-rw-r--r--src/devices/bus/ss50/interface.h37
-rw-r--r--src/devices/bus/ss50/mpc.cpp23
-rw-r--r--src/devices/bus/ss50/mps.cpp12
-rw-r--r--src/devices/bus/sunkbd/hlekbd.cpp8
-rw-r--r--src/devices/bus/svi3x8/expander/expander.cpp16
-rw-r--r--src/devices/bus/svi3x8/expander/expander.h74
-rw-r--r--src/devices/bus/svi3x8/expander/sv601.cpp35
-rw-r--r--src/devices/bus/svi3x8/expander/sv601.h8
-rw-r--r--src/devices/bus/svi3x8/expander/sv602.cpp23
-rw-r--r--src/devices/bus/svi3x8/expander/sv602.h8
-rw-r--r--src/devices/bus/svi3x8/expander/sv603.cpp119
-rw-r--r--src/devices/bus/svi3x8/expander/sv603.h17
-rw-r--r--src/devices/bus/svi3x8/slot/slot.cpp35
-rw-r--r--src/devices/bus/svi3x8/slot/slot.h55
-rw-r--r--src/devices/bus/svi3x8/slot/sv801.cpp8
-rw-r--r--src/devices/bus/svi3x8/slot/sv801.h6
-rw-r--r--src/devices/bus/svi3x8/slot/sv802.cpp16
-rw-r--r--src/devices/bus/svi3x8/slot/sv802.h4
-rw-r--r--src/devices/bus/svi3x8/slot/sv803.cpp4
-rw-r--r--src/devices/bus/svi3x8/slot/sv803.h4
-rw-r--r--src/devices/bus/svi3x8/slot/sv805.cpp8
-rw-r--r--src/devices/bus/svi3x8/slot/sv805.h4
-rw-r--r--src/devices/bus/svi3x8/slot/sv806.cpp14
-rw-r--r--src/devices/bus/svi3x8/slot/sv806.h8
-rw-r--r--src/devices/bus/svi3x8/slot/sv807.cpp4
-rw-r--r--src/devices/bus/svi3x8/slot/sv807.h4
-rw-r--r--src/devices/bus/ti8x/bitsocket.cpp7
-rw-r--r--src/devices/bus/ti8x/teeconn.cpp19
-rw-r--r--src/devices/bus/ti8x/ti8x.h11
-rw-r--r--src/devices/bus/ti8x/tispeaker.cpp19
-rw-r--r--src/devices/bus/ti99/gromport/cartridges.cpp56
-rw-r--r--src/devices/bus/ti99/gromport/cartridges.h36
-rw-r--r--src/devices/bus/ti99/gromport/gkracker.cpp12
-rw-r--r--src/devices/bus/ti99/gromport/gkracker.h4
-rw-r--r--src/devices/bus/ti99/gromport/gromport.cpp12
-rw-r--r--src/devices/bus/ti99/gromport/gromport.h9
-rw-r--r--src/devices/bus/ti99/gromport/multiconn.cpp16
-rw-r--r--src/devices/bus/ti99/gromport/multiconn.h4
-rw-r--r--src/devices/bus/ti99/gromport/singleconn.cpp12
-rw-r--r--src/devices/bus/ti99/gromport/singleconn.h4
-rw-r--r--src/devices/bus/ti99/internal/992board.cpp10
-rw-r--r--src/devices/bus/ti99/internal/992board.h4
-rw-r--r--src/devices/bus/ti99/internal/998board.cpp78
-rw-r--r--src/devices/bus/ti99/internal/998board.h29
-rw-r--r--src/devices/bus/ti99/internal/datamux.cpp75
-rw-r--r--src/devices/bus/ti99/internal/datamux.h19
-rw-r--r--src/devices/bus/ti99/internal/genboard.cpp48
-rw-r--r--src/devices/bus/ti99/internal/genboard.h14
-rw-r--r--src/devices/bus/ti99/internal/ioport.cpp14
-rw-r--r--src/devices/bus/ti99/internal/ioport.h20
-rw-r--r--src/devices/bus/ti99/joyport/handset.cpp1
-rw-r--r--src/devices/bus/ti99/peb/bwg.cpp12
-rw-r--r--src/devices/bus/ti99/peb/bwg.h4
-rw-r--r--src/devices/bus/ti99/peb/evpc.cpp11
-rw-r--r--src/devices/bus/ti99/peb/evpc.h4
-rw-r--r--src/devices/bus/ti99/peb/hfdc.cpp22
-rw-r--r--src/devices/bus/ti99/peb/hfdc.h10
-rw-r--r--src/devices/bus/ti99/peb/horizon.cpp4
-rw-r--r--src/devices/bus/ti99/peb/horizon.h4
-rw-r--r--src/devices/bus/ti99/peb/hsgpl.cpp44
-rw-r--r--src/devices/bus/ti99/peb/hsgpl.h14
-rw-r--r--src/devices/bus/ti99/peb/memex.cpp7
-rw-r--r--src/devices/bus/ti99/peb/memex.h4
-rw-r--r--src/devices/bus/ti99/peb/myarcmem.cpp4
-rw-r--r--src/devices/bus/ti99/peb/myarcmem.h4
-rw-r--r--src/devices/bus/ti99/peb/pcode.cpp8
-rw-r--r--src/devices/bus/ti99/peb/pcode.h6
-rw-r--r--src/devices/bus/ti99/peb/peribox.cpp28
-rw-r--r--src/devices/bus/ti99/peb/peribox.h12
-rw-r--r--src/devices/bus/ti99/peb/samsmem.cpp4
-rw-r--r--src/devices/bus/ti99/peb/samsmem.h4
-rw-r--r--src/devices/bus/ti99/peb/spchsyn.cpp13
-rw-r--r--src/devices/bus/ti99/peb/spchsyn.h5
-rw-r--r--src/devices/bus/ti99/peb/ti_32kmem.cpp7
-rw-r--r--src/devices/bus/ti99/peb/ti_32kmem.h4
-rw-r--r--src/devices/bus/ti99/peb/ti_fdc.cpp8
-rw-r--r--src/devices/bus/ti99/peb/ti_fdc.h4
-rw-r--r--src/devices/bus/ti99/peb/ti_rs232.cpp27
-rw-r--r--src/devices/bus/ti99/peb/ti_rs232.h12
-rw-r--r--src/devices/bus/ti99/peb/tn_ide.cpp26
-rw-r--r--src/devices/bus/ti99/peb/tn_ide.h4
-rw-r--r--src/devices/bus/ti99/peb/tn_usbsm.cpp18
-rw-r--r--src/devices/bus/ti99/peb/tn_usbsm.h4
-rw-r--r--src/devices/bus/ti99/ti99defs.h8
-rw-r--r--src/devices/bus/ti99x/990_dk.cpp17
-rw-r--r--src/devices/bus/ti99x/990_hd.cpp12
-rw-r--r--src/devices/bus/ti99x/990_hd.h3
-rw-r--r--src/devices/bus/ti99x/990_tap.cpp22
-rw-r--r--src/devices/bus/ti99x/990_tap.h3
-rw-r--r--src/devices/bus/tiki100/8088.cpp17
-rw-r--r--src/devices/bus/tiki100/8088.h4
-rw-r--r--src/devices/bus/tiki100/exp.cpp16
-rw-r--r--src/devices/bus/tiki100/exp.h72
-rw-r--r--src/devices/bus/tiki100/hdc.cpp8
-rw-r--r--src/devices/bus/tiki100/hdc.h4
-rw-r--r--src/devices/bus/tmc600/euro.h23
-rw-r--r--src/devices/bus/tvc/tvc.h26
-rw-r--r--src/devices/bus/uts_kbd/400kbd.cpp275
-rw-r--r--src/devices/bus/uts_kbd/400kbd.h44
-rw-r--r--src/devices/bus/uts_kbd/extw.cpp290
-rw-r--r--src/devices/bus/uts_kbd/extw.h47
-rw-r--r--src/devices/bus/uts_kbd/uts_kbd.cpp89
-rw-r--r--src/devices/bus/uts_kbd/uts_kbd.h101
-rw-r--r--src/devices/bus/vboy/slot.h15
-rw-r--r--src/devices/bus/vc4000/rom.cpp12
-rw-r--r--src/devices/bus/vc4000/rom.h12
-rw-r--r--src/devices/bus/vc4000/slot.cpp16
-rw-r--r--src/devices/bus/vc4000/slot.h16
-rw-r--r--src/devices/bus/vcs/dpc.cpp7
-rw-r--r--src/devices/bus/vcs/harmony_melody.cpp9
-rw-r--r--src/devices/bus/vcs/scharger.cpp18
-rw-r--r--src/devices/bus/vcs_ctrl/ctrl.h17
-rw-r--r--src/devices/bus/vectrex/slot.h4
-rw-r--r--src/devices/bus/vic10/exp.cpp8
-rw-r--r--src/devices/bus/vic10/exp.h8
-rw-r--r--src/devices/bus/vic10/multimax.cpp4
-rw-r--r--src/devices/bus/vic10/multimax.h4
-rw-r--r--src/devices/bus/vic10/std.cpp4
-rw-r--r--src/devices/bus/vic10/std.h4
-rw-r--r--src/devices/bus/vic20/exp.cpp8
-rw-r--r--src/devices/bus/vic20/exp.h8
-rw-r--r--src/devices/bus/vic20/fe3.cpp38
-rw-r--r--src/devices/bus/vic20/fe3.h4
-rw-r--r--src/devices/bus/vic20/megacart.cpp11
-rw-r--r--src/devices/bus/vic20/megacart.h4
-rw-r--r--src/devices/bus/vic20/speakeasy.cpp16
-rw-r--r--src/devices/bus/vic20/speakeasy.h4
-rw-r--r--src/devices/bus/vic20/std.cpp2
-rw-r--r--src/devices/bus/vic20/std.h2
-rw-r--r--src/devices/bus/vic20/vic1010.cpp8
-rw-r--r--src/devices/bus/vic20/vic1010.h4
-rw-r--r--src/devices/bus/vic20/vic1110.cpp4
-rw-r--r--src/devices/bus/vic20/vic1110.h4
-rw-r--r--src/devices/bus/vic20/vic1111.cpp4
-rw-r--r--src/devices/bus/vic20/vic1111.h4
-rw-r--r--src/devices/bus/vic20/vic1112.cpp4
-rw-r--r--src/devices/bus/vic20/vic1112.h4
-rw-r--r--src/devices/bus/vic20/vic1210.cpp4
-rw-r--r--src/devices/bus/vic20/vic1210.h4
-rw-r--r--src/devices/bus/vic20/videopak.cpp29
-rw-r--r--src/devices/bus/vic20/videopak.h4
-rw-r--r--src/devices/bus/vidbrain/exp.cpp8
-rw-r--r--src/devices/bus/vidbrain/exp.h52
-rw-r--r--src/devices/bus/vidbrain/money_minder.cpp4
-rw-r--r--src/devices/bus/vidbrain/money_minder.h4
-rw-r--r--src/devices/bus/vidbrain/std.cpp2
-rw-r--r--src/devices/bus/vidbrain/std.h2
-rw-r--r--src/devices/bus/vidbrain/timeshare.cpp4
-rw-r--r--src/devices/bus/vidbrain/timeshare.h4
-rw-r--r--src/devices/bus/vip/byteio.h28
-rw-r--r--src/devices/bus/vip/exp.cpp26
-rw-r--r--src/devices/bus/vip/exp.h62
-rw-r--r--src/devices/bus/vip/vp550.cpp20
-rw-r--r--src/devices/bus/vip/vp550.h10
-rw-r--r--src/devices/bus/vip/vp570.cpp4
-rw-r--r--src/devices/bus/vip/vp570.h4
-rw-r--r--src/devices/bus/vip/vp575.cpp82
-rw-r--r--src/devices/bus/vip/vp575.h12
-rw-r--r--src/devices/bus/vip/vp585.cpp2
-rw-r--r--src/devices/bus/vip/vp585.h2
-rw-r--r--src/devices/bus/vip/vp590.cpp15
-rw-r--r--src/devices/bus/vip/vp590.h6
-rw-r--r--src/devices/bus/vip/vp595.cpp4
-rw-r--r--src/devices/bus/vip/vp595.h2
-rw-r--r--src/devices/bus/vip/vp620.cpp2
-rw-r--r--src/devices/bus/vip/vp700.cpp2
-rw-r--r--src/devices/bus/vip/vp700.h2
-rw-r--r--src/devices/bus/vme/vme.cpp30
-rw-r--r--src/devices/bus/vme/vme.h43
-rw-r--r--src/devices/bus/vme/vme_fccpu20.cpp64
-rw-r--r--src/devices/bus/vme/vme_fccpu20.h3
-rw-r--r--src/devices/bus/vme/vme_hcpu30.h2
-rw-r--r--src/devices/bus/vme/vme_mvme350.cpp11
-rw-r--r--src/devices/bus/vme/vme_mzr8105.cpp12
-rw-r--r--src/devices/bus/vme/vme_mzr8300.cpp4
-rw-r--r--src/devices/bus/vsmile/pad.cpp275
-rw-r--r--src/devices/bus/vsmile/pad.h78
-rw-r--r--src/devices/bus/vsmile/rom.cpp86
-rw-r--r--src/devices/bus/vsmile/rom.h59
-rw-r--r--src/devices/bus/vsmile/vsmile_ctrl.cpp315
-rw-r--r--src/devices/bus/vsmile/vsmile_ctrl.h153
-rw-r--r--src/devices/bus/vsmile/vsmile_slot.cpp254
-rw-r--r--src/devices/bus/vsmile/vsmile_slot.h128
-rw-r--r--src/devices/bus/vtech/ioexp/ioexp.cpp11
-rw-r--r--src/devices/bus/vtech/ioexp/ioexp.h4
-rw-r--r--src/devices/bus/vtech/ioexp/printer.cpp13
-rw-r--r--src/devices/bus/vtech/memexp/floppy.cpp3
-rw-r--r--src/devices/bus/vtech/memexp/memexp.cpp44
-rw-r--r--src/devices/bus/vtech/memexp/memexp.h9
-rw-r--r--src/devices/bus/wangpc/emb.cpp8
-rw-r--r--src/devices/bus/wangpc/emb.h8
-rw-r--r--src/devices/bus/wangpc/lic.cpp14
-rw-r--r--src/devices/bus/wangpc/lic.h8
-rw-r--r--src/devices/bus/wangpc/lvc.cpp33
-rw-r--r--src/devices/bus/wangpc/lvc.h8
-rw-r--r--src/devices/bus/wangpc/mcc.cpp14
-rw-r--r--src/devices/bus/wangpc/mcc.h4
-rw-r--r--src/devices/bus/wangpc/mvc.cpp31
-rw-r--r--src/devices/bus/wangpc/mvc.h8
-rw-r--r--src/devices/bus/wangpc/rtc.cpp8
-rw-r--r--src/devices/bus/wangpc/rtc.h8
-rw-r--r--src/devices/bus/wangpc/tig.cpp47
-rw-r--r--src/devices/bus/wangpc/tig.h8
-rw-r--r--src/devices/bus/wangpc/wangpc.cpp24
-rw-r--r--src/devices/bus/wangpc/wangpc.h117
-rw-r--r--src/devices/bus/wangpc/wdc.cpp30
-rw-r--r--src/devices/bus/wangpc/wdc.h12
-rw-r--r--src/devices/bus/wswan/rom.cpp26
-rw-r--r--src/devices/bus/wswan/rom.h20
-rw-r--r--src/devices/bus/wswan/slot.cpp28
-rw-r--r--src/devices/bus/wswan/slot.h28
-rw-r--r--src/devices/bus/x68k/x68k_midi.cpp18
-rw-r--r--src/devices/bus/x68k/x68k_neptunex.cpp17
-rw-r--r--src/devices/bus/x68k/x68k_scsiext.cpp20
-rw-r--r--src/devices/bus/x68k/x68kexp.cpp1
-rw-r--r--src/devices/bus/x68k/x68kexp.h40
-rw-r--r--src/devices/bus/z88/flash.cpp4
-rw-r--r--src/devices/bus/z88/z88.h19
-rw-r--r--src/devices/cpu/8x300/8x300.cpp330
-rw-r--r--src/devices/cpu/8x300/8x300.h47
-rw-r--r--src/devices/cpu/8x300/8x300dasm.cpp8
-rw-r--r--src/devices/cpu/alpha/alpha.cpp995
-rw-r--r--src/devices/cpu/alpha/alpha.h284
-rw-r--r--src/devices/cpu/alpha/alphad.cpp1245
-rw-r--r--src/devices/cpu/alpha/alphad.h40
-rw-r--r--src/devices/cpu/alpha/common.h19
-rw-r--r--src/devices/cpu/alto2/a2ether.cpp10
-rw-r--r--src/devices/cpu/amis2000/amis2000.h3
-rw-r--r--src/devices/cpu/amis2000/amis2000op.cpp11
-rw-r--r--src/devices/cpu/arm7/lpc210x.cpp7
-rw-r--r--src/devices/cpu/cosmac/cosmac.cpp2
-rw-r--r--src/devices/cpu/dspp/dspp.h18
-rw-r--r--src/devices/cpu/dspp/dsppdrc.cpp334
-rw-r--r--src/devices/cpu/e132xs/e132xs.h2
-rw-r--r--src/devices/cpu/f8/f8.cpp692
-rw-r--r--src/devices/cpu/f8/f8.h3
-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/g65816ds.cpp2
-rw-r--r--src/devices/cpu/g65816/g65816op.h3
-rw-r--r--src/devices/cpu/h8/h83003.cpp3
-rw-r--r--src/devices/cpu/hmcs40/hmcs40.cpp1
-rw-r--r--src/devices/cpu/hpc/hpc.cpp144
-rw-r--r--src/devices/cpu/hpc/hpc.h88
-rw-r--r--src/devices/cpu/hpc/hpcdasm.cpp764
-rw-r--r--src/devices/cpu/hpc/hpcdasm.h58
-rw-r--r--src/devices/cpu/hphybrid/hphybrid.cpp45
-rw-r--r--src/devices/cpu/hphybrid/hphybrid.h28
-rw-r--r--src/devices/cpu/i386/cache.h258
-rw-r--r--src/devices/cpu/i386/cpuidmsrs.hxx94
-rw-r--r--src/devices/cpu/i386/i386.cpp236
-rw-r--r--src/devices/cpu/i386/i386.h52
-rw-r--r--src/devices/cpu/i386/i386priv.h32
-rw-r--r--src/devices/cpu/i386/i486ops.hxx8
-rw-r--r--src/devices/cpu/i386/pentops.hxx13
-rw-r--r--src/devices/cpu/i8089/i8089.cpp2
-rw-r--r--src/devices/cpu/i8089/i8089_channel.cpp7
-rw-r--r--src/devices/cpu/i86/i186.cpp29
-rw-r--r--src/devices/cpu/i86/i186.h12
-rw-r--r--src/devices/cpu/i86/i86.cpp2
-rw-r--r--src/devices/cpu/m6502/dxavix2000.lst2
-rw-r--r--src/devices/cpu/m6502/oxavix.lst8
-rw-r--r--src/devices/cpu/m6502/oxavix2000.lst13
-rw-r--r--src/devices/cpu/m6502/xavix.h4
-rw-r--r--src/devices/cpu/m6502/xavix2000.cpp101
-rw-r--r--src/devices/cpu/m6502/xavix2000.h11
-rw-r--r--src/devices/cpu/m68000/m68000.h19
-rw-r--r--src/devices/cpu/m68000/m68k_in.cpp1
-rw-r--r--src/devices/cpu/m68000/m68kcpu.cpp21
-rw-r--r--src/devices/cpu/m68000/m68kmmu.h2
-rw-r--r--src/devices/cpu/m6809/6x09dasm.cpp22
-rw-r--r--src/devices/cpu/m6809/6x09dasm.h6
-rw-r--r--src/devices/cpu/mcs51/mcs51.cpp12
-rw-r--r--src/devices/cpu/mcs51/mcs51.h4
-rw-r--r--src/devices/cpu/mips/mips1.cpp2118
-rw-r--r--src/devices/cpu/mips/mips1.h208
-rw-r--r--src/devices/cpu/mips/mips3.cpp74
-rw-r--r--src/devices/cpu/mips/mips3.h3
-rw-r--r--src/devices/cpu/mips/mips3com.cpp7
-rw-r--r--src/devices/cpu/mips/mips3drc.cpp59
-rw-r--r--src/devices/cpu/mips/mips3fe.cpp4
-rw-r--r--src/devices/cpu/mips/r4000.cpp3067
-rw-r--r--src/devices/cpu/mips/r4000.h463
-rw-r--r--src/devices/cpu/nec/v5x.cpp8
-rw-r--r--src/devices/cpu/ns32000/ns32000.cpp160
-rw-r--r--src/devices/cpu/ns32000/ns32000.h149
-rw-r--r--src/devices/cpu/ns32000/ns32000dasm.cpp835
-rw-r--r--src/devices/cpu/ns32000/ns32000dasm.h117
-rw-r--r--src/devices/cpu/pic16c5x/pic16c5x.cpp4
-rw-r--r--src/devices/cpu/sh/sh2.cpp2
-rw-r--r--src/devices/cpu/sm510/sm510base.cpp4
-rw-r--r--src/devices/cpu/tms1000/tms0270.cpp7
-rw-r--r--src/devices/cpu/tms1000/tms0270.h9
-rw-r--r--src/devices/cpu/tms1000/tms1000c.cpp18
-rw-r--r--src/devices/cpu/tms1000/tms1000c.h1
-rw-r--r--src/devices/cpu/tms1000/tms1k_base.cpp19
-rw-r--r--src/devices/cpu/tms1000/tms1k_base.h18
-rw-r--r--src/devices/cpu/tms34010/tms34010.cpp91
-rw-r--r--src/devices/cpu/tms34010/tms34010.h26
-rw-r--r--src/devices/cpu/tms9900/tms9900.cpp87
-rw-r--r--src/devices/cpu/tms9900/tms9995.cpp108
-rw-r--r--src/devices/cpu/tms9900/tms9995.h2
-rw-r--r--src/devices/cpu/unsp/unsp.cpp840
-rw-r--r--src/devices/cpu/unsp/unsp.h181
-rw-r--r--src/devices/cpu/unsp/unspdefs.h22
-rw-r--r--src/devices/cpu/unsp/unspdrc.cpp1316
-rw-r--r--src/devices/cpu/unsp/unspfe.cpp357
-rw-r--r--src/devices/cpu/unsp/unspfe.h27
-rw-r--r--src/devices/cpu/z8/z8.cpp542
-rw-r--r--src/devices/cpu/z8/z8.h56
-rw-r--r--src/devices/cpu/z8/z8dasm.cpp5
-rw-r--r--src/devices/cpu/z80/kl5c80a12.cpp5
-rw-r--r--src/devices/imagedev/bitbngr.h4
-rw-r--r--src/devices/imagedev/cassette.h21
-rw-r--r--src/devices/imagedev/chd_cd.h11
-rw-r--r--src/devices/imagedev/diablo.h16
-rw-r--r--src/devices/imagedev/flopdrv.h40
-rw-r--r--src/devices/imagedev/floppy.cpp5
-rw-r--r--src/devices/imagedev/floppy.h13
-rw-r--r--src/devices/imagedev/harddriv.h5
-rw-r--r--src/devices/imagedev/mfmhd.cpp2
-rw-r--r--src/devices/imagedev/midiin.h5
-rw-r--r--src/devices/imagedev/midiout.h8
-rw-r--r--src/devices/imagedev/printer.h4
-rw-r--r--src/devices/imagedev/snapquik.cpp4
-rw-r--r--src/devices/imagedev/snapquik.h22
-rw-r--r--src/devices/machine/6525tpi.cpp22
-rw-r--r--src/devices/machine/6525tpi.h16
-rw-r--r--src/devices/machine/68153bim.cpp13
-rw-r--r--src/devices/machine/6821pia.cpp4
-rw-r--r--src/devices/machine/6821pia.h11
-rw-r--r--src/devices/machine/68307.cpp25
-rw-r--r--src/devices/machine/68307.h2
-rw-r--r--src/devices/machine/68340.cpp9
-rw-r--r--src/devices/machine/68340.h2
-rw-r--r--src/devices/machine/68340dma.cpp5
-rw-r--r--src/devices/machine/68340dma.h1
-rw-r--r--src/devices/machine/68340ser.cpp5
-rw-r--r--src/devices/machine/68340ser.h7
-rw-r--r--src/devices/machine/68340sim.cpp6
-rw-r--r--src/devices/machine/68340sim.h1
-rw-r--r--src/devices/machine/68340tmu.cpp10
-rw-r--r--src/devices/machine/68340tmu.h11
-rw-r--r--src/devices/machine/6840ptm.cpp4
-rw-r--r--src/devices/machine/6840ptm.h4
-rw-r--r--src/devices/machine/6850acia.cpp64
-rw-r--r--src/devices/machine/6850acia.h12
-rw-r--r--src/devices/machine/74157.cpp20
-rw-r--r--src/devices/machine/74157.h17
-rw-r--r--src/devices/machine/74165.cpp7
-rw-r--r--src/devices/machine/74166.cpp7
-rw-r--r--src/devices/machine/7474.h15
-rw-r--r--src/devices/machine/8042kbdc.cpp22
-rw-r--r--src/devices/machine/8042kbdc.h5
-rw-r--r--src/devices/machine/8364_paula.h14
-rw-r--r--src/devices/machine/adc0808.cpp14
-rw-r--r--src/devices/machine/adc0808.h8
-rw-r--r--src/devices/machine/adc0844.cpp6
-rw-r--r--src/devices/machine/adc0844.h6
-rw-r--r--src/devices/machine/aic6250.cpp17
-rw-r--r--src/devices/machine/aic6250.h13
-rw-r--r--src/devices/machine/aicartc.h7
-rw-r--r--src/devices/machine/akiko.cpp5
-rw-r--r--src/devices/machine/am9513.cpp8
-rw-r--r--src/devices/machine/am9513.h8
-rw-r--r--src/devices/machine/am9517a.cpp65
-rw-r--r--src/devices/machine/am9517a.h51
-rw-r--r--src/devices/machine/am9519.cpp8
-rw-r--r--src/devices/machine/am9519.h8
-rw-r--r--src/devices/machine/appldriv.h29
-rw-r--r--src/devices/machine/applefdc.h32
-rw-r--r--src/devices/machine/at29x.cpp4
-rw-r--r--src/devices/machine/at29x.h4
-rw-r--r--src/devices/machine/at_keybc.cpp24
-rw-r--r--src/devices/machine/at_keybc.h16
-rw-r--r--src/devices/machine/atapicdr.cpp10
-rw-r--r--src/devices/machine/ay31015.cpp70
-rw-r--r--src/devices/machine/ay31015.h20
-rw-r--r--src/devices/machine/bankdev.cpp18
-rw-r--r--src/devices/machine/bankdev.h42
-rw-r--r--src/devices/machine/clock.h8
-rw-r--r--src/devices/machine/com8116.cpp29
-rw-r--r--src/devices/machine/com8116.h22
-rw-r--r--src/devices/machine/cr511b.cpp14
-rw-r--r--src/devices/machine/cs4031.cpp80
-rw-r--r--src/devices/machine/cs4031.h72
-rw-r--r--src/devices/machine/diablo_hd.cpp15
-rw-r--r--src/devices/machine/diablo_hd.h3
-rw-r--r--src/devices/machine/dp8390.h33
-rw-r--r--src/devices/machine/dp83932c.cpp153
-rw-r--r--src/devices/machine/dp83932c.h111
-rw-r--r--src/devices/machine/ds1204.h3
-rw-r--r--src/devices/machine/ds1205.h3
-rw-r--r--src/devices/machine/ds128x.cpp58
-rw-r--r--src/devices/machine/ds128x.h25
-rw-r--r--src/devices/machine/ds1315.cpp16
-rw-r--r--src/devices/machine/ds1315.h10
-rw-r--r--src/devices/machine/ds75160a.h12
-rw-r--r--src/devices/machine/f3853.cpp353
-rw-r--r--src/devices/machine/f3853.h168
-rw-r--r--src/devices/machine/fdc37c665gt.cpp9
-rw-r--r--src/devices/machine/fdc37c93x.cpp4
-rw-r--r--src/devices/machine/gen_fifo.h11
-rw-r--r--src/devices/machine/genpc.cpp60
-rw-r--r--src/devices/machine/genpc.h29
-rw-r--r--src/devices/machine/hdc92x4.cpp4
-rw-r--r--src/devices/machine/hdc92x4.h4
-rw-r--r--src/devices/machine/i2cmem.cpp121
-rw-r--r--src/devices/machine/i2cmem.h89
-rw-r--r--src/devices/machine/i7220.cpp65
-rw-r--r--src/devices/machine/i8087.cpp14
-rw-r--r--src/devices/machine/i8087.h13
-rw-r--r--src/devices/machine/i8155.cpp26
-rw-r--r--src/devices/machine/i8155.h14
-rw-r--r--src/devices/machine/i82357.cpp307
-rw-r--r--src/devices/machine/i82357.h91
-rw-r--r--src/devices/machine/i82371sb.cpp25
-rw-r--r--src/devices/machine/i82371sb.h1
-rw-r--r--src/devices/machine/i8251.cpp8
-rw-r--r--src/devices/machine/i8251.h8
-rw-r--r--src/devices/machine/i8271.cpp37
-rw-r--r--src/devices/machine/i8271.h18
-rw-r--r--src/devices/machine/idectrl.cpp13
-rw-r--r--src/devices/machine/idectrl.h6
-rw-r--r--src/devices/machine/idehd.cpp7
-rw-r--r--src/devices/machine/ie15.cpp32
-rw-r--r--src/devices/machine/ie15_kbd.cpp5
-rw-r--r--src/devices/machine/input_merger.h22
-rw-r--r--src/devices/machine/ins8154.cpp71
-rw-r--r--src/devices/machine/ins8154.h13
-rw-r--r--src/devices/machine/ins8250.cpp2
-rw-r--r--src/devices/machine/intelfsh.h8
-rw-r--r--src/devices/machine/k054321.cpp2
-rw-r--r--src/devices/machine/keyboard.cpp6
-rw-r--r--src/devices/machine/ldp1000.h7
-rw-r--r--src/devices/machine/ldp1450.h7
-rw-r--r--src/devices/machine/ldpr8210.h2
-rw-r--r--src/devices/machine/ldstub.cpp8
-rw-r--r--src/devices/machine/ldstub.h21
-rw-r--r--src/devices/machine/ldv1000.cpp5
-rw-r--r--src/devices/machine/ldv1000.h6
-rw-r--r--src/devices/machine/ldvp931.cpp80
-rw-r--r--src/devices/machine/ldvp931.h18
-rw-r--r--src/devices/machine/legscsi.h2
-rw-r--r--src/devices/machine/mb8421.cpp16
-rw-r--r--src/devices/machine/mb8421.h16
-rw-r--r--src/devices/machine/mc146818.cpp12
-rw-r--r--src/devices/machine/mc146818.h8
-rw-r--r--src/devices/machine/mc6843.h2
-rw-r--r--src/devices/machine/mc6852.cpp7
-rw-r--r--src/devices/machine/mc6852.h32
-rw-r--r--src/devices/machine/mc6854.cpp4
-rw-r--r--src/devices/machine/mc6854.h4
-rw-r--r--src/devices/machine/mc68681.cpp35
-rw-r--r--src/devices/machine/mc68681.h37
-rw-r--r--src/devices/machine/mccs1850.h22
-rw-r--r--src/devices/machine/mcf5206e.cpp2
-rw-r--r--src/devices/machine/mcf5206e.h9
-rw-r--r--src/devices/machine/meters.h5
-rw-r--r--src/devices/machine/microtch.h12
-rw-r--r--src/devices/machine/mm5740.h38
-rw-r--r--src/devices/machine/mm58167.cpp4
-rw-r--r--src/devices/machine/mm58167.h13
-rw-r--r--src/devices/machine/mm58274c.cpp4
-rw-r--r--src/devices/machine/mm58274c.h17
-rw-r--r--src/devices/machine/mm74c922.h44
-rw-r--r--src/devices/machine/mos6526.cpp12
-rw-r--r--src/devices/machine/mos6526.h61
-rw-r--r--src/devices/machine/mos6530.h21
-rw-r--r--src/devices/machine/mos6530n.h128
-rw-r--r--src/devices/machine/mos6551.cpp36
-rw-r--r--src/devices/machine/mos6551.h6
-rw-r--r--src/devices/machine/mos6702.cpp4
-rw-r--r--src/devices/machine/mos6702.h14
-rw-r--r--src/devices/machine/mos8706.h11
-rw-r--r--src/devices/machine/mos8722.cpp2
-rw-r--r--src/devices/machine/mos8722.h2
-rw-r--r--src/devices/machine/mos8726.cpp4
-rw-r--r--src/devices/machine/mos8726.h15
-rw-r--r--src/devices/machine/mpu401.cpp10
-rw-r--r--src/devices/machine/msm58321.h31
-rw-r--r--src/devices/machine/msm6242.h5
-rw-r--r--src/devices/machine/myb3k_kbd.h21
-rw-r--r--src/devices/machine/ncr5380.h3
-rw-r--r--src/devices/machine/ncr5380n.cpp116
-rw-r--r--src/devices/machine/ncr5380n.h45
-rw-r--r--src/devices/machine/ncr5385.cpp4
-rw-r--r--src/devices/machine/ncr5385.h13
-rw-r--r--src/devices/machine/ncr5390.cpp337
-rw-r--r--src/devices/machine/ncr5390.h135
-rw-r--r--src/devices/machine/ncr539x.cpp4
-rw-r--r--src/devices/machine/ncr539x.h11
-rw-r--r--src/devices/machine/netlist.cpp375
-rw-r--r--src/devices/machine/netlist.h74
-rw-r--r--src/devices/machine/nmc9306.h11
-rw-r--r--src/devices/machine/nsc810.cpp4
-rw-r--r--src/devices/machine/nsc810.h63
-rw-r--r--src/devices/machine/nscsi_bus.cpp67
-rw-r--r--src/devices/machine/nscsi_bus.h28
-rw-r--r--src/devices/machine/nscsi_cb.h46
-rw-r--r--src/devices/machine/nscsi_cd.cpp296
-rw-r--r--src/devices/machine/nscsi_cd.h12
-rw-r--r--src/devices/machine/nscsi_hd.cpp147
-rw-r--r--src/devices/machine/nscsi_hd.h3
-rw-r--r--src/devices/machine/output_latch.h25
-rw-r--r--src/devices/machine/pc_fdc.cpp2
-rw-r--r--src/devices/machine/pc_lpt.cpp8
-rw-r--r--src/devices/machine/pckeybrd.h25
-rw-r--r--src/devices/machine/pdc.cpp3
-rw-r--r--src/devices/machine/pic8259.h4
-rw-r--r--src/devices/machine/pit8253.cpp11
-rw-r--r--src/devices/machine/pit8253.h6
-rw-r--r--src/devices/machine/pla.h21
-rw-r--r--src/devices/machine/pxa255.cpp26
-rw-r--r--src/devices/machine/rtc65271.cpp8
-rw-r--r--src/devices/machine/rtc65271.h8
-rw-r--r--src/devices/machine/scc2698b.cpp5
-rw-r--r--src/devices/machine/scnxx562.cpp9
-rw-r--r--src/devices/machine/sis85c496.cpp27
-rw-r--r--src/devices/machine/smc91c9x.cpp1141
-rw-r--r--src/devices/machine/smc91c9x.h252
-rw-r--r--src/devices/machine/smpc.cpp2
-rw-r--r--src/devices/machine/sonydriv.h18
-rw-r--r--src/devices/machine/spg110.cpp669
-rw-r--r--src/devices/machine/spg110.h220
-rw-r--r--src/devices/machine/spg2xx.cpp2451
-rw-r--r--src/devices/machine/spg2xx.h434
-rw-r--r--src/devices/machine/spg2xx_audio.cpp1258
-rw-r--r--src/devices/machine/spg2xx_audio.h372
-rw-r--r--src/devices/machine/spg2xx_io.cpp1313
-rw-r--r--src/devices/machine/spg2xx_io.h183
-rw-r--r--src/devices/machine/strata.cpp20
-rw-r--r--src/devices/machine/strata.h12
-rw-r--r--src/devices/machine/stvcd.cpp18
-rw-r--r--src/devices/machine/tc009xlvc.cpp2
-rw-r--r--src/devices/machine/terminal.cpp21
-rw-r--r--src/devices/machine/terminal.h2
-rw-r--r--src/devices/machine/ticket.h16
-rw-r--r--src/devices/machine/timekpr.cpp264
-rw-r--r--src/devices/machine/timekpr.h68
-rw-r--r--src/devices/machine/timer.h58
-rw-r--r--src/devices/machine/tmp68301.cpp62
-rw-r--r--src/devices/machine/tmp68301.h24
-rw-r--r--src/devices/machine/tms5501.cpp3
-rw-r--r--src/devices/machine/tms9901.cpp111
-rw-r--r--src/devices/machine/tms9901.h15
-rw-r--r--src/devices/machine/tms9902.cpp127
-rw-r--r--src/devices/machine/tms9902.h4
-rw-r--r--src/devices/machine/tms9914.cpp4
-rw-r--r--src/devices/machine/tms9914.h5
-rw-r--r--src/devices/machine/tube.cpp8
-rw-r--r--src/devices/machine/tube.h8
-rw-r--r--src/devices/machine/upd7002.cpp6
-rw-r--r--src/devices/machine/upd7002.h6
-rw-r--r--src/devices/machine/upd765.cpp139
-rw-r--r--src/devices/machine/upd765.h43
-rw-r--r--src/devices/machine/wd1010.cpp583
-rw-r--r--src/devices/machine/wd1010.h143
-rw-r--r--src/devices/machine/wd11c00_17.cpp9
-rw-r--r--src/devices/machine/wd11c00_17.h1
-rw-r--r--src/devices/machine/wd2010.cpp10
-rw-r--r--src/devices/machine/wd2010.h4
-rw-r--r--src/devices/machine/wd33c93.cpp984
-rw-r--r--src/devices/machine/wd33c93.h112
-rw-r--r--src/devices/machine/wd33c9x.cpp1064
-rw-r--r--src/devices/machine/wd33c9x.h32
-rw-r--r--src/devices/machine/wd7600.cpp128
-rw-r--r--src/devices/machine/wd7600.h88
-rw-r--r--src/devices/machine/x2201.cpp11
-rw-r--r--src/devices/machine/x2201.h1
-rw-r--r--src/devices/machine/xc1700e.cpp91
-rw-r--r--src/devices/machine/xc1700e.h118
-rw-r--r--src/devices/machine/ym2148.cpp4
-rw-r--r--src/devices/machine/ym2148.h4
-rw-r--r--src/devices/machine/z80scc.cpp14
-rw-r--r--src/devices/machine/z80scc.h1
-rw-r--r--src/devices/machine/z80sio.cpp20
-rw-r--r--src/devices/sound/2203intf.cpp20
-rw-r--r--src/devices/sound/2203intf.h12
-rw-r--r--src/devices/sound/2608intf.cpp4
-rw-r--r--src/devices/sound/2608intf.h4
-rw-r--r--src/devices/sound/2610intf.cpp4
-rw-r--r--src/devices/sound/2610intf.h4
-rw-r--r--src/devices/sound/2612intf.cpp4
-rw-r--r--src/devices/sound/2612intf.h4
-rw-r--r--src/devices/sound/262intf.cpp4
-rw-r--r--src/devices/sound/262intf.h4
-rw-r--r--src/devices/sound/3526intf.cpp12
-rw-r--r--src/devices/sound/3526intf.h12
-rw-r--r--src/devices/sound/3812intf.cpp12
-rw-r--r--src/devices/sound/3812intf.h12
-rw-r--r--src/devices/sound/8950intf.cpp12
-rw-r--r--src/devices/sound/8950intf.h12
-rw-r--r--src/devices/sound/ad1848.cpp1
-rw-r--r--src/devices/sound/astrocde.cpp6
-rw-r--r--src/devices/sound/astrocde.h4
-rw-r--r--src/devices/sound/ay8910.cpp140
-rw-r--r--src/devices/sound/ay8910.h85
-rw-r--r--src/devices/sound/bsmt2000.cpp8
-rw-r--r--src/devices/sound/c140.cpp4
-rw-r--r--src/devices/sound/c140.h4
-rw-r--r--src/devices/sound/cdp1864.cpp12
-rw-r--r--src/devices/sound/cdp1869.cpp5
-rw-r--r--src/devices/sound/dac.h2
-rw-r--r--src/devices/sound/es1373.cpp5
-rw-r--r--src/devices/sound/es5506.cpp15
-rw-r--r--src/devices/sound/es5506.h2
-rw-r--r--src/devices/sound/es8712.cpp2
-rw-r--r--src/devices/sound/es8712.h2
-rw-r--r--src/devices/sound/esqpump.cpp20
-rw-r--r--src/devices/sound/esqpump.h5
-rw-r--r--src/devices/sound/gaelco.cpp4
-rw-r--r--src/devices/sound/ics2115.cpp517
-rw-r--r--src/devices/sound/ics2115.h102
-rw-r--r--src/devices/sound/k051649.cpp23
-rw-r--r--src/devices/sound/k051649.h20
-rw-r--r--src/devices/sound/k054539.cpp4
-rw-r--r--src/devices/sound/k054539.h4
-rw-r--r--src/devices/sound/meg.cpp384
-rw-r--r--src/devices/sound/meg.h122
-rw-r--r--src/devices/sound/megd.cpp118
-rw-r--r--src/devices/sound/megd.h39
-rw-r--r--src/devices/sound/mos6560.cpp10
-rw-r--r--src/devices/sound/mos6581.cpp4
-rw-r--r--src/devices/sound/mos6581.h4
-rw-r--r--src/devices/sound/mos7360.cpp5
-rw-r--r--src/devices/sound/msm5205.h10
-rw-r--r--src/devices/sound/nile.cpp5
-rw-r--r--src/devices/sound/okim6258.cpp6
-rw-r--r--src/devices/sound/okim6258.h6
-rw-r--r--src/devices/sound/okim6295.cpp28
-rw-r--r--src/devices/sound/okim6295.h7
-rw-r--r--src/devices/sound/okim6376.cpp2
-rw-r--r--src/devices/sound/okim6376.h2
-rw-r--r--src/devices/sound/pokey.cpp119
-rw-r--r--src/devices/sound/pokey.h13
-rw-r--r--src/devices/sound/qs1000.h1
-rw-r--r--src/devices/sound/rf5c68.cpp8
-rw-r--r--src/devices/sound/rf5c68.h8
-rw-r--r--src/devices/sound/sn76496.cpp4
-rw-r--r--src/devices/sound/sn76496.h5
-rw-r--r--src/devices/sound/spkrdev.h4
-rw-r--r--src/devices/sound/swp30.cpp61
-rw-r--r--src/devices/sound/swp30.h9
-rw-r--r--src/devices/sound/t6721a.cpp4
-rw-r--r--src/devices/sound/t6721a.h4
-rw-r--r--src/devices/sound/t6w28.cpp2
-rw-r--r--src/devices/sound/t6w28.h4
-rw-r--r--src/devices/sound/upd7752.cpp6
-rw-r--r--src/devices/sound/vlm5030.cpp4
-rw-r--r--src/devices/sound/vlm5030.h2
-rw-r--r--src/devices/sound/volt_reg.cpp2
-rw-r--r--src/devices/sound/volt_reg.h5
-rw-r--r--src/devices/sound/votrax.cpp4
-rw-r--r--src/devices/sound/votrax.h4
-rw-r--r--src/devices/sound/vrc6.cpp4
-rw-r--r--src/devices/sound/vrc6.h2
-rw-r--r--src/devices/sound/ym2151.cpp16
-rw-r--r--src/devices/sound/ym2151.h10
-rw-r--r--src/devices/sound/ym2413.cpp134
-rw-r--r--src/devices/sound/ym2413.h29
-rw-r--r--src/devices/sound/ymf271.cpp4
-rw-r--r--src/devices/sound/ymf271.h4
-rw-r--r--src/devices/sound/ymf278b.cpp4
-rw-r--r--src/devices/sound/ymf278b.h4
-rw-r--r--src/devices/sound/ymz280b.cpp4
-rw-r--r--src/devices/sound/ymz280b.h4
-rw-r--r--src/devices/video/315_5124.cpp196
-rw-r--r--src/devices/video/315_5124.h157
-rw-r--r--src/devices/video/315_5313.cpp10
-rw-r--r--src/devices/video/315_5313.h53
-rw-r--r--src/devices/video/cdp1862.cpp2
-rw-r--r--src/devices/video/cdp1862.h2
-rw-r--r--src/devices/video/cesblit.h24
-rw-r--r--src/devices/video/crt9007.cpp5
-rw-r--r--src/devices/video/crt9021.h6
-rw-r--r--src/devices/video/crt9028.cpp371
-rw-r--r--src/devices/video/crt9028.h142
-rw-r--r--src/devices/video/crtc_ega.cpp6
-rw-r--r--src/devices/video/crtc_ega.h48
-rw-r--r--src/devices/video/decsfb.cpp175
-rw-r--r--src/devices/video/decsfb.h38
-rw-r--r--src/devices/video/dl1416.h12
-rw-r--r--src/devices/video/dm9368.h15
-rw-r--r--src/devices/video/ef9340_1.h12
-rw-r--r--src/devices/video/ef9345.cpp43
-rw-r--r--src/devices/video/ef9345.h6
-rw-r--r--src/devices/video/ef9364.cpp5
-rw-r--r--src/devices/video/ef9364.h8
-rw-r--r--src/devices/video/ef9365.cpp9
-rw-r--r--src/devices/video/ef9365.h17
-rw-r--r--src/devices/video/epic12.h6
-rw-r--r--src/devices/video/fixfreq.cpp408
-rw-r--r--src/devices/video/fixfreq.h278
-rw-r--r--src/devices/video/gba_lcd.cpp13
-rw-r--r--src/devices/video/gba_lcd.h33
-rw-r--r--src/devices/video/hd44102.h21
-rw-r--r--src/devices/video/hd44780.h12
-rw-r--r--src/devices/video/hd61830.cpp5
-rw-r--r--src/devices/video/hd61830.h13
-rw-r--r--src/devices/video/hd63484.h24
-rw-r--r--src/devices/video/hd66421.cpp5
-rw-r--r--src/devices/video/hlcd0515.cpp44
-rw-r--r--src/devices/video/hlcd0515.h8
-rw-r--r--src/devices/video/hlcd0538.cpp29
-rw-r--r--src/devices/video/hlcd0538.h12
-rw-r--r--src/devices/video/huc6202.h61
-rw-r--r--src/devices/video/huc6260.h17
-rw-r--r--src/devices/video/huc6261.h10
-rw-r--r--src/devices/video/huc6270.h7
-rw-r--r--src/devices/video/huc6271.cpp5
-rw-r--r--src/devices/video/huc6272.cpp14
-rw-r--r--src/devices/video/huc6272.h13
-rw-r--r--src/devices/video/i8244.cpp16
-rw-r--r--src/devices/video/i8244.h24
-rw-r--r--src/devices/video/i8275.h24
-rw-r--r--src/devices/video/ims_cvc.cpp297
-rw-r--r--src/devices/video/ims_cvc.h144
-rw-r--r--src/devices/video/jangou_blitter.h8
-rw-r--r--src/devices/video/m50458.cpp23
-rw-r--r--src/devices/video/m50458.h17
-rw-r--r--src/devices/video/mb88303.h21
-rw-r--r--src/devices/video/mb90082.cpp9
-rw-r--r--src/devices/video/mb90082.h8
-rw-r--r--src/devices/video/mb_vcu.cpp30
-rw-r--r--src/devices/video/mb_vcu.h15
-rw-r--r--src/devices/video/mc6845.cpp73
-rw-r--r--src/devices/video/mc6845.h27
-rw-r--r--src/devices/video/mc6847.cpp33
-rw-r--r--src/devices/video/mc6847.h71
-rw-r--r--src/devices/video/mm5445.cpp106
-rw-r--r--src/devices/video/mm5445.h101
-rw-r--r--src/devices/video/mos6566.cpp14
-rw-r--r--src/devices/video/mos6566.h4
-rw-r--r--src/devices/video/msm6222b.h5
-rw-r--r--src/devices/video/msm6255.cpp5
-rw-r--r--src/devices/video/nt7534.h5
-rw-r--r--src/devices/video/pc_vga.cpp14
-rw-r--r--src/devices/video/pc_vga.h15
-rw-r--r--src/devices/video/pcd8544.h8
-rw-r--r--src/devices/video/ppu2c0x.cpp13
-rw-r--r--src/devices/video/ps2gs.cpp7
-rw-r--r--src/devices/video/ramdac.cpp13
-rw-r--r--src/devices/video/saa5050.h16
-rw-r--r--src/devices/video/scn2674.cpp326
-rw-r--r--src/devices/video/scn2674.h18
-rw-r--r--src/devices/video/sda5708.h7
-rw-r--r--src/devices/video/sed1200.h11
-rw-r--r--src/devices/video/sed1330.cpp5
-rw-r--r--src/devices/video/t6a04.h3
-rw-r--r--src/devices/video/tea1002.h9
-rw-r--r--src/devices/video/tlc34076.cpp4
-rw-r--r--src/devices/video/tlc34076.h13
-rw-r--r--src/devices/video/tms34061.cpp32
-rw-r--r--src/devices/video/tms34061.h70
-rw-r--r--src/devices/video/tms3556.cpp5
-rw-r--r--src/devices/video/tms3556.h6
-rw-r--r--src/devices/video/tms9927.cpp2
-rw-r--r--src/devices/video/tms9928a.cpp53
-rw-r--r--src/devices/video/tms9928a.h12
-rw-r--r--src/devices/video/upd3301.h24
-rw-r--r--src/devices/video/upd7220.cpp13
-rw-r--r--src/devices/video/upd7220.h51
-rw-r--r--src/devices/video/v9938.cpp4
-rw-r--r--src/devices/video/v9938.h4
-rw-r--r--src/devices/video/vector.h3
-rw-r--r--src/devices/video/vic4567.h49
-rw-r--r--src/devices/video/voodoo.h29
-rw-r--r--src/devices/video/voodoo_pci.cpp54
1866 files changed, 23869 insertions, 52446 deletions
diff --git a/src/devices/bus/a1bus/a1bus.cpp b/src/devices/bus/a1bus/a1bus.cpp
index 1dee51c40b2..b9370c084d6 100644
--- a/src/devices/bus/a1bus/a1bus.cpp
+++ b/src/devices/bus/a1bus/a1bus.cpp
@@ -82,7 +82,7 @@ a1bus_device::a1bus_device(const machine_config &mconfig, const char *tag, devic
a1bus_device::a1bus_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_space(*this, finder_base::DUMMY_TAG, -1)
+ , m_maincpu(*this, finder_base::DUMMY_TAG)
, m_out_irq_cb(*this)
, m_out_nmi_cb(*this)
, m_device(nullptr)
@@ -136,13 +136,13 @@ void a1bus_device::set_nmi_line(int state)
void a1bus_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler)
{
- m_space->install_readwrite_handler(start, end, rhandler, whandler);
+ m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler);
}
void a1bus_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data)
{
// printf("install_bank: %s @ %x->%x\n", tag, start, end);
- m_space->install_readwrite_bank(start, end, tag);
+ m_maincpu->space(AS_PROGRAM).install_readwrite_bank(start, end, tag);
machine().root_device().membank(siblingtag(tag).c_str())->set_base(data);
}
diff --git a/src/devices/bus/a1bus/a1bus.h b/src/devices/bus/a1bus/a1bus.h
index 7970f150719..484cba5b70f 100644
--- a/src/devices/bus/a1bus/a1bus.h
+++ b/src/devices/bus/a1bus/a1bus.h
@@ -13,6 +13,19 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_A1BUS_CPU(_cputag) \
+ downcast<a1bus_device &>(*device).set_cputag(_cputag);
+
+#define MCFG_A1BUS_OUT_IRQ_CB(_devcb) \
+ downcast<a1bus_device &>(*device).set_out_irq_callback(DEVCB_##_devcb);
+
+#define MCFG_A1BUS_OUT_NMI_CB(_devcb) \
+ downcast<a1bus_device &>(*device).set_out_nmi_callback(DEVCB_##_devcb);
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -59,9 +72,9 @@ public:
a1bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration
- template <typename T> void set_space(T &&tag, int spacenum) { m_space.set_tag(std::forward<T>(tag), spacenum); }
- auto out_irq_callback() { return m_out_irq_cb.bind(); }
- auto out_nmi_callback() { return m_out_nmi_cb.bind(); }
+ template <typename T> void set_cputag(T &&tag) { m_maincpu.set_tag(std::forward<T>(tag)); }
+ template <class Object> devcb_base &set_out_irq_callback(Object &&cb) { return m_out_irq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_nmi_callback(Object &&cb) { return m_out_nmi_cb.set_callback(std::forward<Object>(cb)); }
void add_a1bus_card(device_a1bus_card_interface *card);
device_a1bus_card_interface *get_a1bus_card();
@@ -84,7 +97,7 @@ protected:
virtual void device_reset() override;
// internal state
- required_address_space m_space;
+ required_device<cpu_device> m_maincpu;
devcb_write_line m_out_irq_cb;
devcb_write_line m_out_nmi_cb;
diff --git a/src/devices/bus/a1bus/a1cassette.cpp b/src/devices/bus/a1bus/a1cassette.cpp
index 13140382f48..5605e156304 100644
--- a/src/devices/bus/a1bus/a1cassette.cpp
+++ b/src/devices/bus/a1bus/a1cassette.cpp
@@ -36,12 +36,11 @@ ROM_END
/* sound output */
-void a1bus_cassette_device::device_add_mconfig(machine_config &config)
-{
- CASSETTE(config, m_cassette);
- m_cassette->set_default_state(CASSETTE_STOPPED);
- m_cassette->set_interface("apple1_cass");
-}
+MACHINE_CONFIG_START(a1bus_cassette_device::device_add_mconfig)
+ MCFG_CASSETTE_ADD("cassette")
+ MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)
+ MCFG_CASSETTE_INTERFACE("apple1_cass")
+MACHINE_CONFIG_END
const tiny_rom_entry *a1bus_cassette_device::device_rom_region() const
{
diff --git a/src/devices/bus/a2bus/a2alfam2.cpp b/src/devices/bus/a2bus/a2alfam2.cpp
index e97722708da..6817176c202 100644
--- a/src/devices/bus/a2bus/a2alfam2.cpp
+++ b/src/devices/bus/a2bus/a2alfam2.cpp
@@ -39,39 +39,37 @@ DEFINE_DEVICE_TYPE(A2BUS_AESMS, a2bus_aesms_device, "a2aesms", "Applied Engin
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_sn76489_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a2bus_sn76489_device::device_add_mconfig)
SPEAKER(config, "alf_l").front_left();
SPEAKER(config, "alf_r").front_right();
- SN76489(config, m_sn1, 1020484);
- m_sn1->add_route(ALL_OUTPUTS, "alf_l", 0.50);
- SN76489(config, m_sn2, 1020484);
- m_sn2->add_route(ALL_OUTPUTS, "alf_l", 0.50);
- m_sn2->add_route(ALL_OUTPUTS, "alf_r", 0.50);
- SN76489(config, m_sn3, 1020484);
- m_sn3->add_route(ALL_OUTPUTS, "alf_r", 0.50);
-}
+ MCFG_DEVICE_ADD(SN1_TAG, SN76489, 1020484)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "alf_l", 0.50)
+ MCFG_DEVICE_ADD(SN2_TAG, SN76489, 1020484)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "alf_l", 0.50)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "alf_r", 0.50)
+ MCFG_DEVICE_ADD(SN3_TAG, SN76489, 1020484)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "alf_r", 0.50)
+MACHINE_CONFIG_END
-void a2bus_aesms_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a2bus_aesms_device::device_add_mconfig)
SPEAKER(config, "alf_l").front_left();
SPEAKER(config, "alf_r").front_right();
- SN76489(config, m_sn1, 1020484);
- m_sn1->add_route(ALL_OUTPUTS, "alf_l", 0.50);
+ MCFG_DEVICE_ADD(SN1_TAG, SN76489, 1020484)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "alf_l", 0.50)
- SN76489(config, m_sn2, 1020484);
- m_sn2->add_route(ALL_OUTPUTS, "alf_l", 0.50);
- m_sn2->add_route(ALL_OUTPUTS, "alf_r", 0.50);
+ MCFG_DEVICE_ADD(SN2_TAG, SN76489, 1020484)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "alf_l", 0.50)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "alf_r", 0.50)
- SN76489(config, m_sn3, 1020484);
- m_sn3->add_route(ALL_OUTPUTS, "alf_r", 0.50);
+ MCFG_DEVICE_ADD(SN3_TAG, SN76489, 1020484)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "alf_r", 0.50)
- SN76489(config, m_sn4, 1020484);
- m_sn4->add_route(ALL_OUTPUTS, "alf_l", 0.50);
- m_sn4->add_route(ALL_OUTPUTS, "alf_r", 0.50);
-}
+ MCFG_DEVICE_ADD(SN4_TAG, SN76489, 1020484)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "alf_l", 0.50)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "alf_r", 0.50)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/bus/a2bus/a2arcadebd.cpp b/src/devices/bus/a2bus/a2arcadebd.cpp
index 169971ea3e5..4bdd0a6911b 100644
--- a/src/devices/bus/a2bus/a2arcadebd.cpp
+++ b/src/devices/bus/a2bus/a2arcadebd.cpp
@@ -97,7 +97,7 @@ uint8_t a2bus_arcboard_device::read_c0nx(uint8_t offset)
return m_tms->register_read();
case 6:
- return m_ay->data_r();
+ return m_ay->read_data();
}
return 0xff;
@@ -118,11 +118,11 @@ void a2bus_arcboard_device::write_c0nx(uint8_t offset, uint8_t data)
break;
case 5:
- m_ay->address_w(data);
+ m_ay->write_address(data);
break;
case 6:
- m_ay->data_w(data);
+ m_ay->write_data(data);
break;
}
}
diff --git a/src/devices/bus/a2bus/a2bus.cpp b/src/devices/bus/a2bus/a2bus.cpp
index 7adcaf368a7..84df6f73b35 100644
--- a/src/devices/bus/a2bus/a2bus.cpp
+++ b/src/devices/bus/a2bus/a2bus.cpp
@@ -145,11 +145,8 @@ a2bus_device::a2bus_device(const machine_config &mconfig, const char *tag, devic
a2bus_device::a2bus_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_maincpu_space(*this, finder_base::DUMMY_TAG, -1)
- , m_out_irq_cb(*this)
- , m_out_nmi_cb(*this)
- , m_out_inh_cb(*this)
- , m_out_dma_cb(*this)
+ , m_maincpu(*this, finder_base::DUMMY_TAG), m_maincpu_space(nullptr)
+ , m_out_irq_cb(*this) , m_out_nmi_cb(*this), m_out_inh_cb(*this)
, m_slot_irq_mask(0), m_slot_nmi_mask(0)
{
}
@@ -160,11 +157,12 @@ a2bus_device::a2bus_device(const machine_config &mconfig, device_type type, cons
void a2bus_device::device_resolve_objects()
{
+ m_maincpu_space = &m_maincpu->space(AS_PROGRAM);
+
// resolve callbacks
m_out_irq_cb.resolve_safe();
m_out_nmi_cb.resolve_safe();
m_out_inh_cb.resolve_safe();
- m_out_dma_cb.resolve_safe();
}
void a2bus_device::device_start()
@@ -241,17 +239,27 @@ void a2bus_device::set_nmi_line(int state, int slot)
}
}
-void a2bus_device::set_dma_line(int state)
+void a2bus_device::set_maincpu_halt(int state)
{
- m_out_dma_cb(state);
+ m_maincpu->set_input_line(INPUT_LINE_HALT, state);
+}
+
+uint8_t a2bus_device::dma_r(address_space &space, uint16_t offset)
+{
+ return m_maincpu_space->read_byte(offset);
+}
+
+void a2bus_device::dma_w(address_space &space, uint16_t offset, uint8_t data)
+{
+ m_maincpu_space->write_byte(offset, data);
}
-uint8_t a2bus_device::dma_r(uint16_t offset)
+uint8_t a2bus_device::dma_nospace_r(uint16_t offset)
{
return m_maincpu_space->read_byte(offset);
}
-void a2bus_device::dma_w(uint16_t offset, uint8_t data)
+void a2bus_device::dma_nospace_w(uint16_t offset, uint8_t data)
{
m_maincpu_space->write_byte(offset, data);
}
diff --git a/src/devices/bus/a2bus/a2bus.h b/src/devices/bus/a2bus/a2bus.h
index 502ff72e854..862aeca3803 100644
--- a/src/devices/bus/a2bus/a2bus.h
+++ b/src/devices/bus/a2bus/a2bus.h
@@ -25,6 +25,22 @@
#define INH_READ 0x01
#define INH_WRITE 0x02
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_A2BUS_CPU(_cputag) \
+ downcast<a2bus_device &>(*device).set_cputag(_cputag);
+
+#define MCFG_A2BUS_OUT_IRQ_CB(_devcb) \
+ downcast<a2bus_device &>(*device).set_out_irq_callback(DEVCB_##_devcb);
+
+#define MCFG_A2BUS_OUT_NMI_CB(_devcb) \
+ downcast<a2bus_device &>(*device).set_out_nmi_callback(DEVCB_##_devcb);
+
+#define MCFG_A2BUS_OUT_INH_CB(_devcb) \
+ downcast<a2bus_device &>(*device).set_out_inh_callback(DEVCB_##_devcb);
+
// 7M = XTAL(14'318'181) / 2 or XTAL(28'636'363) / 4 (for IIgs)
static constexpr uint32_t A2BUS_7M_CLOCK = 7159090;
@@ -83,11 +99,15 @@ public:
a2bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration
- template <typename T> void set_space(T &&tag, int spacenum) { m_maincpu_space.set_tag(std::forward<T>(tag), spacenum); }
+ template <typename T> void set_cputag(T &&tag) { m_maincpu.set_tag(std::forward<T>(tag)); }
+ template <class Object> devcb_base &set_out_irq_callback(Object &&cb) { return m_out_irq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_nmi_callback(Object &&cb) { return m_out_nmi_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_inh_callback(Object &&cb) { return m_out_inh_cb.set_callback(std::forward<Object>(cb)); }
+
+ // devcb3
auto irq_w() { return m_out_irq_cb.bind(); }
auto nmi_w() { return m_out_nmi_cb.bind(); }
auto inh_w() { return m_out_inh_cb.bind(); }
- auto dma_w() { return m_out_dma_cb.bind(); }
void add_a2bus_card(int slot, device_a2bus_card_interface *card);
device_a2bus_card_interface *get_a2bus_card(int slot);
@@ -96,10 +116,12 @@ public:
void set_irq_line(int state, int slot);
void set_nmi_line(int state, int slot);
- void set_dma_line(int state);
+ void set_maincpu_halt(int state);
void recalc_inh(int slot);
- uint8_t dma_r(uint16_t offset);
- void dma_w(uint16_t offset, uint8_t data);
+ uint8_t dma_r(address_space &space, uint16_t offset);
+ void dma_w(address_space &space, uint16_t offset, uint8_t data);
+ uint8_t dma_nospace_r(uint16_t offset);
+ void dma_nospace_w(uint16_t offset, uint8_t data);
DECLARE_WRITE_LINE_MEMBER( irq_w );
DECLARE_WRITE_LINE_MEMBER( nmi_w );
@@ -113,12 +135,12 @@ protected:
virtual void device_reset() override;
// internal state
- required_address_space m_maincpu_space;
+ required_device<cpu_device> m_maincpu;
+ address_space *m_maincpu_space;
devcb_write_line m_out_irq_cb;
devcb_write_line m_out_nmi_cb;
devcb_write8 m_out_inh_cb;
- devcb_write_line m_out_dma_cb;
device_a2bus_card_interface *m_device_list[8];
@@ -159,8 +181,14 @@ public:
void set_a2bus(a2bus_device *a2bus, const char *slottag) { m_a2bus = a2bus; m_a2bus_slottag = slottag; }
template <typename T> void set_onboard(T &&a2bus) { m_a2bus_finder.set_tag(std::forward<T>(a2bus)); m_a2bus_slottag = device().tag(); }
- uint8_t slot_dma_read(uint16_t offset) { return m_a2bus->dma_r(offset); }
- void slot_dma_write(uint16_t offset, uint8_t data) { m_a2bus->dma_w(offset, data); }
+ // pass through the original address space if any for debugger protection
+ // when debugging e.g. coprocessor cards (Z80 SoftCard etc).
+ uint8_t slot_dma_read(address_space &space, uint16_t offset) { return m_a2bus->dma_r(space, offset); }
+ void slot_dma_write(address_space &space, uint16_t offset, uint8_t data) { m_a2bus->dma_w(space, offset, data); }
+
+ // these versions forego that protection for when the DMA isn't coming from a debuggable CPU device
+ uint8_t slot_dma_read_no_space(uint16_t offset) { return m_a2bus->dma_nospace_r(offset); }
+ void slot_dma_write_no_space(uint16_t offset, uint8_t data) { m_a2bus->dma_nospace_w(offset, data); }
protected:
uint32_t get_slotromspace() { return 0xc000 | (m_slot<<8); } // return Cn00 address for this slot
@@ -171,8 +199,7 @@ protected:
void raise_slot_nmi() { m_a2bus->set_nmi_line(ASSERT_LINE, m_slot); }
void lower_slot_nmi() { m_a2bus->set_nmi_line(CLEAR_LINE, m_slot); }
void recalc_slot_inh() { m_a2bus->recalc_inh(m_slot); }
- void raise_slot_dma() { m_a2bus->set_dma_line(ASSERT_LINE); }
- void lower_slot_dma() { m_a2bus->set_dma_line(CLEAR_LINE); }
+ void set_maincpu_halt(int state) { m_a2bus->set_maincpu_halt(state); }
device_a2bus_card_interface(const machine_config &mconfig, device_t &device);
diff --git a/src/devices/bus/a2bus/a2cffa.cpp b/src/devices/bus/a2bus/a2cffa.cpp
index 41c5a1603f6..4eb5c7d2d98 100644
--- a/src/devices/bus/a2bus/a2cffa.cpp
+++ b/src/devices/bus/a2bus/a2cffa.cpp
@@ -56,7 +56,7 @@ void a2bus_cffa2000_device::device_add_mconfig(machine_config &config)
ATA_INTERFACE(config, m_ata).options(ata_devices, "hdd", nullptr, false);
// not yet, the core explodes
-// SOFTWARE_LIST(config, "hdd_list").set_original("apple2gs_hdd");
+// MCFG_SOFTWARE_LIST_ADD("hdd_list", "apple2gs_hdd")
}
//-------------------------------------------------
diff --git a/src/devices/bus/a2bus/a2corvus.cpp b/src/devices/bus/a2bus/a2corvus.cpp
index 3b0af093659..251485d3f28 100644
--- a/src/devices/bus/a2bus/a2corvus.cpp
+++ b/src/devices/bus/a2bus/a2corvus.cpp
@@ -71,14 +71,17 @@ ROM_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_corvus_device::device_add_mconfig(machine_config &config)
-{
- CORVUS_HDC(config, m_corvushd, 0);
- HARDDISK(config, "harddisk1", "corvus_hdd");
- HARDDISK(config, "harddisk2", "corvus_hdd");
- HARDDISK(config, "harddisk3", "corvus_hdd");
- HARDDISK(config, "harddisk4", "corvus_hdd");
-}
+MACHINE_CONFIG_START(a2bus_corvus_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(CORVUS_HD_TAG, CORVUS_HDC, 0)
+ MCFG_HARDDISK_ADD("harddisk1")
+ MCFG_HARDDISK_INTERFACE("corvus_hdd")
+ MCFG_HARDDISK_ADD("harddisk2")
+ MCFG_HARDDISK_INTERFACE("corvus_hdd")
+ MCFG_HARDDISK_ADD("harddisk3")
+ MCFG_HARDDISK_INTERFACE("corvus_hdd")
+ MCFG_HARDDISK_ADD("harddisk4")
+ MCFG_HARDDISK_INTERFACE("corvus_hdd")
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/a2bus/a2diskii.cpp b/src/devices/bus/a2bus/a2diskii.cpp
index 20aff173549..9673abbb1da 100644
--- a/src/devices/bus/a2bus/a2diskii.cpp
+++ b/src/devices/bus/a2bus/a2diskii.cpp
@@ -61,19 +61,15 @@ ROM_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_floppy_device::device_add_mconfig(machine_config &config)
-{
- APPLEFDC(config, m_fdc, &fdc_interface);
- FLOPPY_APPLE(config, FLOPPY_0, &floppy_interface, 15, 16);
- FLOPPY_APPLE(config, FLOPPY_1, &floppy_interface, 15, 16);
-}
-
-void a2bus_iwmflop_device::device_add_mconfig(machine_config &config)
-{
- IWM(config, m_fdc, &fdc_interface);
- FLOPPY_APPLE(config, FLOPPY_0, &floppy_interface, 15, 16);
- FLOPPY_APPLE(config, FLOPPY_1, &floppy_interface, 15, 16);
-}
+MACHINE_CONFIG_START(a2bus_floppy_device::device_add_mconfig)
+ MCFG_APPLEFDC_ADD(FDC_TAG, fdc_interface)
+ MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(floppy_interface,15,16)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(a2bus_iwmflop_device::device_add_mconfig)
+ MCFG_IWM_ADD(FDC_TAG, fdc_interface)
+ MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(floppy_interface,15,16)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/a2bus/a2diskiing.cpp b/src/devices/bus/a2bus/a2diskiing.cpp
index 1846b447a04..28194db0421 100644
--- a/src/devices/bus/a2bus/a2diskiing.cpp
+++ b/src/devices/bus/a2bus/a2diskiing.cpp
@@ -54,19 +54,17 @@ FLOPPY_FORMATS_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void diskiing_device::device_add_mconfig(machine_config &config)
-{
- DISKII_FDC(config, m_wozfdc, 1021800*2);
- for (auto &floppy : m_floppy)
- FLOPPY_CONNECTOR(config, floppy, a2_floppies, "525", diskiing_device::floppy_formats);
-}
-
-void a2bus_diskiing13_device::device_add_mconfig(machine_config &config)
-{
- DISKII_FDC(config, m_wozfdc, 1021800*2);
- for (auto &floppy : m_floppy)
- FLOPPY_CONNECTOR(config, floppy, a2_floppies, "525", a2bus_diskiing13_device::floppy_formats);
-}
+MACHINE_CONFIG_START(diskiing_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(WOZFDC_TAG, DISKII_FDC, 1021800*2)
+ MCFG_FLOPPY_DRIVE_ADD("0", a2_floppies, "525", diskiing_device::floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD("1", a2_floppies, "525", diskiing_device::floppy_formats)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(a2bus_diskiing13_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(WOZFDC_TAG, DISKII_FDC, 1021800*2)
+ MCFG_FLOPPY_DRIVE_ADD("0", a2_floppies, "525", a2bus_diskiing13_device::floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD("1", a2_floppies, "525", a2bus_diskiing13_device::floppy_formats)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -90,7 +88,8 @@ diskiing_device::diskiing_device(const machine_config &mconfig, device_type type
device_t(mconfig, type, tag, owner, clock),
device_a2bus_card_interface(mconfig, *this),
m_wozfdc(*this, WOZFDC_TAG),
- m_floppy(*this, "%u", 0U),
+ floppy0(*this, "0"),
+ floppy1(*this, "1"),
m_rom(nullptr)
{
}
@@ -116,7 +115,7 @@ void diskiing_device::device_start()
void diskiing_device::device_reset()
{
- m_wozfdc->set_floppies(m_floppy[0], m_floppy[1]);
+ m_wozfdc->set_floppies(floppy0, floppy1);
}
/*-------------------------------------------------
diff --git a/src/devices/bus/a2bus/a2diskiing.h b/src/devices/bus/a2bus/a2diskiing.h
index c30d49ebf0d..e6476cb29a7 100644
--- a/src/devices/bus/a2bus/a2diskiing.h
+++ b/src/devices/bus/a2bus/a2diskiing.h
@@ -42,10 +42,11 @@ protected:
virtual void write_c0nx(uint8_t offset, uint8_t data) override;
virtual uint8_t read_cnxx(uint8_t offset) override;
+private:
required_device<diskii_fdc_device> m_wozfdc;
- required_device_array<floppy_connector, 2> m_floppy;
+ required_device<floppy_connector> floppy0;
+ required_device<floppy_connector> floppy1;
-private:
const uint8_t *m_rom;
DECLARE_FLOPPY_FORMATS( floppy_formats );
diff --git a/src/devices/bus/a2bus/a2dx1.cpp b/src/devices/bus/a2bus/a2dx1.cpp
index 9c1a0733405..5efd112a779 100644
--- a/src/devices/bus/a2bus/a2dx1.cpp
+++ b/src/devices/bus/a2bus/a2dx1.cpp
@@ -31,14 +31,14 @@ DEFINE_DEVICE_TYPE(A2BUS_DX1, a2bus_dx1_device, "a2dx1", "Decillonix DX-1")
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_dx1_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a2bus_dx1_device::device_add_mconfig)
SPEAKER(config, "speaker").front_center();
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5); // unknown DAC
- DAC_8BIT_R2R(config, m_dacvol, 0).add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT).add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT); // unknown DAC
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dacvol", 1.0, DAC_VREF_POS_INPUT);
-}
+ MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.5) // unknown DAC
+ MCFG_DEVICE_ADD("dacvol", DAC_8BIT_R2R, 0) // unknown DAC
+ MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT)
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "dacvol", 1.0, DAC_VREF_POS_INPUT)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/bus/a2bus/a2eauxslot.cpp b/src/devices/bus/a2bus/a2eauxslot.cpp
index 5fab40ba9ae..6885d528128 100644
--- a/src/devices/bus/a2bus/a2eauxslot.cpp
+++ b/src/devices/bus/a2bus/a2eauxslot.cpp
@@ -33,16 +33,20 @@ a2eauxslot_slot_device::a2eauxslot_slot_device(const machine_config &mconfig, co
a2eauxslot_slot_device::a2eauxslot_slot_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_slot_interface(mconfig, *this)
- , m_a2eauxslot(*this, finder_base::DUMMY_TAG)
+ , m_a2eauxslot_tag(nullptr)
+ , m_a2eauxslot_slottag(nullptr)
{
}
-void a2eauxslot_slot_device::device_resolve_objects()
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void a2eauxslot_slot_device::device_start()
{
device_a2eauxslot_card_interface *dev = dynamic_cast<device_a2eauxslot_card_interface *>(get_card_device());
- if (dev)
- dev->set_a2eauxslot_device(m_a2eauxslot.target());
+ if (dev) dev->set_a2eauxslot_tag(m_a2eauxslot_tag, m_a2eauxslot_slottag);
}
//**************************************************************************
@@ -66,31 +70,34 @@ a2eauxslot_device::a2eauxslot_device(const machine_config &mconfig, const char *
a2eauxslot_device::a2eauxslot_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_space(*this, finder_base::DUMMY_TAG, -1)
+ , m_maincpu(nullptr)
, m_out_irq_cb(*this)
, m_out_nmi_cb(*this)
, m_device(nullptr)
+ , m_cputag(nullptr)
{
}
-
//-------------------------------------------------
-// device_resolve_objects - resolve objects that
-// may be needed for other devices to set
-// initial conditions at start time
+// device_start - device-specific startup
//-------------------------------------------------
-void a2eauxslot_device::device_resolve_objects()
+void a2eauxslot_device::device_start()
{
+ m_maincpu = machine().device<cpu_device>(m_cputag);
+
// resolve callbacks
m_out_irq_cb.resolve_safe();
m_out_nmi_cb.resolve_safe();
+
+ // clear slot
+ m_device = nullptr;
}
//-------------------------------------------------
-// device_start - device-specific startup
+// device_reset - device-specific reset
//-------------------------------------------------
-void a2eauxslot_device::device_start()
+void a2eauxslot_device::device_reset()
{
}
@@ -134,7 +141,7 @@ WRITE_LINE_MEMBER( a2eauxslot_device::nmi_w ) { m_out_nmi_cb(state); }
device_a2eauxslot_card_interface::device_a2eauxslot_card_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device),
m_a2eauxslot(nullptr),
- m_slot(0), m_next(nullptr)
+ m_a2eauxslot_tag(nullptr), m_a2eauxslot_slottag(nullptr), m_slot(0), m_next(nullptr)
{
}
@@ -147,8 +154,8 @@ device_a2eauxslot_card_interface::~device_a2eauxslot_card_interface()
{
}
-void device_a2eauxslot_card_interface::set_a2eauxslot_device(a2eauxslot_device *a2eauxslot)
+void device_a2eauxslot_card_interface::set_a2eauxslot_device()
{
- m_a2eauxslot = a2eauxslot;
+ m_a2eauxslot = dynamic_cast<a2eauxslot_device *>(device().machine().device(m_a2eauxslot_tag));
m_a2eauxslot->add_a2eauxslot_card(this);
}
diff --git a/src/devices/bus/a2bus/a2eauxslot.h b/src/devices/bus/a2bus/a2eauxslot.h
index 4351bc6112a..1da89b18d7a 100644
--- a/src/devices/bus/a2bus/a2eauxslot.h
+++ b/src/devices/bus/a2bus/a2eauxslot.h
@@ -15,6 +15,25 @@
#include "a2bus.h"
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_A2EAUXSLOT_CPU(_cputag) \
+ downcast<a2eauxslot_device &>(*device).set_cputag(_cputag);
+
+#define MCFG_A2EAUXSLOT_OUT_IRQ_CB(_devcb) \
+ downcast<a2eauxslot_device &>(*device).set_out_irq_callback(DEVCB_##_devcb);
+
+#define MCFG_A2EAUXSLOT_OUT_NMI_CB(_devcb) \
+ downcast<a2eauxslot_device &>(*device).set_out_nmi_callback(DEVCB_##_devcb);
+
+#define MCFG_A2EAUXSLOT_SLOT_ADD(_nbtag, _tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, A2EAUXSLOT_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<a2eauxslot_slot_device &>(*device).set_a2eauxslot_slot(_nbtag, _tag);
+#define MCFG_A2EAUXSLOT_SLOT_REMOVE(_tag) \
+ MCFG_DEVICE_REMOVE(_tag)
//**************************************************************************
// TYPE DEFINITIONS
@@ -27,28 +46,19 @@ class a2eauxslot_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T, typename U>
- a2eauxslot_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&slottag, U &&opts, char const *dflt)
- : a2eauxslot_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- m_a2eauxslot.set_tag(std::forward<T>(slottag));
- }
-
- a2eauxslot_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ a2eauxslot_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void device_resolve_objects() override;
- virtual void device_start() override { }
+ virtual void device_start() override;
+
+ // inline configuration
+ void set_a2eauxslot_slot(const char *tag, const char *slottag) { m_a2eauxslot_tag = tag; m_a2eauxslot_slottag = slottag; }
protected:
a2eauxslot_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// configuration
- required_device<a2eauxslot_device> m_a2eauxslot;
+ const char *m_a2eauxslot_tag, *m_a2eauxslot_slottag;
};
// device type definition
@@ -65,9 +75,9 @@ public:
a2eauxslot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration
- template <typename T> void set_space(T &&tag, int spacenum) { m_space.set_tag(std::forward<T>(tag), spacenum); }
- auto out_irq_callback() { return m_out_irq_cb.bind(); }
- auto out_nmi_callback() { return m_out_nmi_cb.bind(); }
+ void set_cputag(const char *tag) { m_cputag = tag; }
+ template <class Object> devcb_base &set_out_irq_callback(Object &&cb) { return m_out_irq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_nmi_callback(Object &&cb) { return m_out_nmi_cb.set_callback(std::forward<Object>(cb)); }
void add_a2eauxslot_card(device_a2eauxslot_card_interface *card);
device_a2eauxslot_card_interface *get_a2eauxslot_card();
@@ -82,16 +92,17 @@ protected:
a2eauxslot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void device_resolve_objects() override;
virtual void device_start() override;
+ virtual void device_reset() override;
// internal state
- required_address_space m_space;
+ cpu_device *m_maincpu;
devcb_write_line m_out_irq_cb;
devcb_write_line m_out_nmi_cb;
device_a2eauxslot_card_interface *m_device;
+ const char *m_cputag;
};
@@ -110,24 +121,28 @@ public:
virtual uint8_t read_auxram(uint16_t offset) { printf("a2eauxslot: unhandled auxram read @ %04x\n", offset); return 0xff; }
virtual void write_auxram(uint16_t offset, uint8_t data) { printf("a2eauxslot: unhandled auxram write %02x @ %04x\n", data, offset); }
- virtual void write_c07x(uint8_t offset, uint8_t data) {}
+ virtual void write_c07x(address_space &space, uint8_t offset, uint8_t data) {}
virtual uint8_t *get_vram_ptr() = 0;
virtual uint8_t *get_auxbank_ptr() = 0;
virtual bool allow_dhr() { return true; }
device_a2eauxslot_card_interface *next() const { return m_next; }
- void set_a2eauxslot_device(a2eauxslot_device *a2eauxslot);
+ void set_a2eauxslot_device();
void raise_slot_irq() { m_a2eauxslot->set_irq_line(ASSERT_LINE); }
void lower_slot_irq() { m_a2eauxslot->set_irq_line(CLEAR_LINE); }
void raise_slot_nmi() { m_a2eauxslot->set_nmi_line(ASSERT_LINE); }
void lower_slot_nmi() { m_a2eauxslot->set_nmi_line(CLEAR_LINE); }
+ // inline configuration
+ void set_a2eauxslot_tag(const char *tag, const char *slottag) { m_a2eauxslot_tag = tag; m_a2eauxslot_slottag = slottag; }
+
protected:
device_a2eauxslot_card_interface(const machine_config &mconfig, device_t &device);
a2eauxslot_device *m_a2eauxslot;
+ const char *m_a2eauxslot_tag, *m_a2eauxslot_slottag;
int m_slot;
device_a2eauxslot_card_interface *m_next;
};
diff --git a/src/devices/bus/a2bus/a2eext80col.cpp b/src/devices/bus/a2bus/a2eext80col.cpp
index 2ddb4a0b476..b98d31c0d5c 100644
--- a/src/devices/bus/a2bus/a2eext80col.cpp
+++ b/src/devices/bus/a2bus/a2eext80col.cpp
@@ -43,6 +43,7 @@ a2eaux_ext80col_device::a2eaux_ext80col_device(const machine_config &mconfig, de
void a2eaux_ext80col_device::device_start()
{
+ set_a2eauxslot_device();
memset(m_ram, 0, sizeof(m_ram));
save_item(NAME(m_ram));
}
diff --git a/src/devices/bus/a2bus/a2eramworks3.cpp b/src/devices/bus/a2bus/a2eramworks3.cpp
index 46ada4066a1..e82225cbd27 100644
--- a/src/devices/bus/a2bus/a2eramworks3.cpp
+++ b/src/devices/bus/a2bus/a2eramworks3.cpp
@@ -45,6 +45,7 @@ a2eaux_ramworks3_device::a2eaux_ramworks3_device(const machine_config &mconfig,
void a2eaux_ramworks3_device::device_start()
{
+ set_a2eauxslot_device();
save_item(NAME(m_ram));
save_item(NAME(m_bank));
}
@@ -87,7 +88,7 @@ uint8_t *a2eaux_ramworks3_device::get_auxbank_ptr()
However, the software will recognize and correctly use a configuration in which
all of banks 00-7F are populated for a total of 8 megabytes. So that's what we do.
*/
-void a2eaux_ramworks3_device::write_c07x(uint8_t offset, uint8_t data)
+void a2eaux_ramworks3_device::write_c07x(address_space &space, uint8_t offset, uint8_t data)
{
// write to C073?
if (offset == 3)
diff --git a/src/devices/bus/a2bus/a2eramworks3.h b/src/devices/bus/a2bus/a2eramworks3.h
index d47d88c37d9..f2b327ebfab 100644
--- a/src/devices/bus/a2bus/a2eramworks3.h
+++ b/src/devices/bus/a2bus/a2eramworks3.h
@@ -36,7 +36,7 @@ protected:
virtual uint8_t *get_vram_ptr() override;
virtual uint8_t *get_auxbank_ptr() override;
virtual bool allow_dhr() override { return true; }
- virtual void write_c07x(uint8_t offset, uint8_t data) override;
+ virtual void write_c07x(address_space &space, uint8_t offset, uint8_t data) override;
private:
uint8_t m_ram[8*1024*1024];
diff --git a/src/devices/bus/a2bus/a2estd80col.cpp b/src/devices/bus/a2bus/a2estd80col.cpp
index 8eecf223c48..e5a9741e7a0 100644
--- a/src/devices/bus/a2bus/a2estd80col.cpp
+++ b/src/devices/bus/a2bus/a2estd80col.cpp
@@ -43,6 +43,7 @@ a2eaux_std80col_device::a2eaux_std80col_device(const machine_config &mconfig, de
void a2eaux_std80col_device::device_start()
{
+ set_a2eauxslot_device();
save_item(NAME(m_ram));
}
diff --git a/src/devices/bus/a2bus/a2hsscsi.cpp b/src/devices/bus/a2bus/a2hsscsi.cpp
index ec4eea8080a..6be63715d88 100644
--- a/src/devices/bus/a2bus/a2hsscsi.cpp
+++ b/src/devices/bus/a2bus/a2hsscsi.cpp
@@ -57,6 +57,14 @@ DEFINE_DEVICE_TYPE(A2BUS_HSSCSI, a2bus_hsscsi_device, "a2hsscsi", "Apple II High
#define SCSI_BUS_TAG "scsibus"
#define SCSI_5380_TAG "scsibus:7:ncr5380"
+void a2bus_hsscsi_device::ncr5380(device_t *device)
+{
+ devcb_base *devcb;
+ (void)devcb;
+ MCFG_DEVICE_CLOCK(10000000)
+ MCFG_NCR5380N_DRQ_HANDLER(WRITELINE("^^", a2bus_hsscsi_device, drq_w))
+}
+
static void hsscsi_devices(device_slot_interface &device)
{
device.option_add("cdrom", NSCSI_CDROM);
@@ -77,21 +85,18 @@ ROM_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_hsscsi_device::device_add_mconfig(machine_config &config)
-{
- NSCSI_BUS(config, m_scsibus);
- NSCSI_CONNECTOR(config, "scsibus:0", hsscsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsibus:1", hsscsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsibus:2", hsscsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsibus:3", hsscsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsibus:4", hsscsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsibus:5", hsscsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsibus:6", hsscsi_devices, "harddisk", false);
- NSCSI_CONNECTOR(config, "scsibus:7", hsscsi_devices, "ncr5380", true).set_option_machine_config("ncr5380", [this](device_t *device) {
- device->set_clock(10000000);
- downcast<ncr5380n_device &>(*device).drq_handler().set(*this, FUNC(a2bus_hsscsi_device::drq_w));
- });
-}
+MACHINE_CONFIG_START(a2bus_hsscsi_device::device_add_mconfig)
+ MCFG_NSCSI_BUS_ADD(SCSI_BUS_TAG)
+ MCFG_NSCSI_ADD("scsibus:0", hsscsi_devices, nullptr, false)
+ MCFG_NSCSI_ADD("scsibus:1", hsscsi_devices, nullptr, false)
+ MCFG_NSCSI_ADD("scsibus:2", hsscsi_devices, nullptr, false)
+ MCFG_NSCSI_ADD("scsibus:3", hsscsi_devices, nullptr, false)
+ MCFG_NSCSI_ADD("scsibus:4", hsscsi_devices, nullptr, false)
+ MCFG_NSCSI_ADD("scsibus:5", hsscsi_devices, nullptr, false)
+ MCFG_NSCSI_ADD("scsibus:6", hsscsi_devices, "harddisk", false)
+ MCFG_NSCSI_ADD("scsibus:7", hsscsi_devices, "ncr5380", true)
+ MCFG_SLOT_OPTION_MACHINE_CONFIG("ncr5380", ncr5380)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -163,7 +168,7 @@ uint8_t a2bus_hsscsi_device::read_c0nx(uint8_t offset)
case 6:
case 7:
// logerror("Read 5380 @ %x\n", offset);
- return m_ncr5380->read(offset);
+ return m_ncr5380->read(machine().dummy_space(), offset);
case 0xc:
return 0x00; // indicate watchdog?
@@ -200,7 +205,7 @@ void a2bus_hsscsi_device::write_c0nx(uint8_t offset, uint8_t data)
case 6:
case 7:
// logerror("%02x to 5380 reg %x\n", data, offset);
- m_ncr5380->write(offset, data);
+ m_ncr5380->write(machine().dummy_space(), offset, data);
break;
#if 0
case 8: // DMA address low
diff --git a/src/devices/bus/a2bus/a2hsscsi.h b/src/devices/bus/a2bus/a2hsscsi.h
index da96b3e8776..c3534ede770 100644
--- a/src/devices/bus/a2bus/a2hsscsi.h
+++ b/src/devices/bus/a2bus/a2hsscsi.h
@@ -30,6 +30,8 @@ public:
DECLARE_WRITE_LINE_MEMBER( drq_w );
+ static void ncr5380(device_t *device);
+
protected:
a2bus_hsscsi_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/bus/a2bus/a2mcms.cpp b/src/devices/bus/a2bus/a2mcms.cpp
index 7e2cab57b6b..1442d7d68bc 100644
--- a/src/devices/bus/a2bus/a2mcms.cpp
+++ b/src/devices/bus/a2bus/a2mcms.cpp
@@ -38,6 +38,8 @@ DEFINE_DEVICE_TYPE(A2BUS_MCMS2, a2bus_mcms2_device, "a2mcms2", "Mountain Compute
#define ENGINE_TAG "engine"
+#define MCFG_MCMS_IRQ_CALLBACK(_cb) \
+ downcast<mcms_device &>(*device).set_irq_cb(DEVCB_##_cb);
/***************************************************************************
FUNCTION PROTOTYPES
@@ -47,16 +49,16 @@ DEFINE_DEVICE_TYPE(A2BUS_MCMS2, a2bus_mcms2_device, "a2mcms2", "Mountain Compute
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_mcms1_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a2bus_mcms1_device::device_add_mconfig)
SPEAKER(config, "mcms_l").front_left();
SPEAKER(config, "mcms_r").front_right();
- MCMS(config, m_mcms, 1000000);
- m_mcms->irq_cb().set(FUNC(a2bus_mcms1_device::irq_w));
- m_mcms->add_route(0, "mcms_l", 1.0);
- m_mcms->add_route(1, "mcms_r", 1.0);
-}
+ MCFG_DEVICE_ADD(ENGINE_TAG, MCMS, 1000000)
+ MCFG_MCMS_IRQ_CALLBACK(WRITELINE(*this, a2bus_mcms1_device, irq_w))
+
+ MCFG_SOUND_ROUTE(0, "mcms_l", 1.0)
+ MCFG_SOUND_ROUTE(1, "mcms_r", 1.0)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE - Card 1
@@ -275,7 +277,7 @@ void mcms_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
wptr = (m_table[v]<<8) | (m_acc[v]>>8);
m_rand = (m_acc[v]>>8) & 0x1f;
- sample = (m_pBusDevice->slot_dma_read(wptr) ^ 0x80);
+ sample = (m_pBusDevice->slot_dma_read_no_space(wptr) ^ 0x80);
if (v & 1)
{
mixL += sample * m_vols[v];
diff --git a/src/devices/bus/a2bus/a2mcms.h b/src/devices/bus/a2bus/a2mcms.h
index 9a183a9313d..f1026d97afd 100644
--- a/src/devices/bus/a2bus/a2mcms.h
+++ b/src/devices/bus/a2bus/a2mcms.h
@@ -33,7 +33,7 @@ public:
void set_bus_device(a2bus_mcms1_device *pDev) { m_pBusDevice = pDev; }
- auto irq_cb() { return m_write_irq.bind(); }
+ template<class Object> devcb_base &set_irq_cb(Object &&wr) { return m_write_irq.set_callback(std::forward<Object>(wr)); }
devcb_write_line m_write_irq;
protected:
diff --git a/src/devices/bus/a2bus/a2memexp.cpp b/src/devices/bus/a2bus/a2memexp.cpp
index 6b088a1ea12..a544713abb7 100644
--- a/src/devices/bus/a2bus/a2memexp.cpp
+++ b/src/devices/bus/a2bus/a2memexp.cpp
@@ -46,9 +46,8 @@ ROM_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_memexp_device::device_add_mconfig(machine_config &config)
-{
-}
+MACHINE_CONFIG_START(a2bus_memexp_device::device_add_mconfig)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/a2bus/a2midi.cpp b/src/devices/bus/a2bus/a2midi.cpp
index dfd6ce71694..d73aaf82bbc 100644
--- a/src/devices/bus/a2bus/a2midi.cpp
+++ b/src/devices/bus/a2bus/a2midi.cpp
@@ -32,8 +32,7 @@ DEFINE_DEVICE_TYPE(A2BUS_MIDI, a2bus_midi_device, "a2midi", "6850 MIDI card")
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_midi_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a2bus_midi_device::device_add_mconfig)
PTM6840(config, m_ptm, 1021800);
m_ptm->set_external_clocks(1021800.0f, 1021800.0f, 1021800.0f);
m_ptm->irq_callback().set(FUNC(a2bus_midi_device::ptm_irq_w));
@@ -42,13 +41,14 @@ void a2bus_midi_device::device_add_mconfig(machine_config &config)
m_acia->txd_handler().set("mdout", FUNC(midi_port_device::write_txd));
m_acia->irq_handler().set(FUNC(a2bus_midi_device::acia_irq_w));
- MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(m_acia, FUNC(acia6850_device::write_rxd));
+ MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
+ MCFG_MIDI_RX_HANDLER(WRITELINE(MIDI_ACIA_TAG, acia6850_device, write_rxd))
- MIDI_PORT(config, "mdout", midiout_slot, "midiout");
+ MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
- clock_device &acia_clock(CLOCK(config, "acia_clock", 31250*16));
- acia_clock.signal_handler().set(FUNC(a2bus_midi_device::write_acia_clock));
-}
+ MCFG_DEVICE_ADD("acia_clock", CLOCK, 31250*16)
+ MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, a2bus_midi_device, write_acia_clock))
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
@@ -91,11 +91,11 @@ uint8_t a2bus_midi_device::read_c0nx(uint8_t offset)
if (offset < 8)
{
- return m_ptm->read(offset & 7);
+ return m_ptm->read(machine().dummy_space(), offset & 7);
}
else if (offset == 8 || offset == 9)
{
- return m_acia->read(offset & 1);
+ return m_acia->read(machine().dummy_space(), offset & 1);
}
return 0;
@@ -109,11 +109,11 @@ void a2bus_midi_device::write_c0nx(uint8_t offset, uint8_t data)
{
if (offset < 8)
{
- m_ptm->write(offset & 7, data);
+ m_ptm->write(machine().dummy_space(), offset & 7, data);
}
else if (offset == 8 || offset == 9)
{
- m_acia->write(offset & 1, data);
+ m_acia->write(machine().dummy_space(), offset & 1, data);
}
}
diff --git a/src/devices/bus/a2bus/a2mockingboard.cpp b/src/devices/bus/a2bus/a2mockingboard.cpp
index c4c45b6975b..c1d67bfa7d3 100644
--- a/src/devices/bus/a2bus/a2mockingboard.cpp
+++ b/src/devices/bus/a2bus/a2mockingboard.cpp
@@ -238,7 +238,7 @@ WRITE8_MEMBER( a2bus_ayboard_device::via1_out_b )
{
if (!BIT(data, 2))
{
- m_ay1->reset_w();
+ m_ay1->reset_w(space, 0, 0);
}
else
{
@@ -248,15 +248,15 @@ WRITE8_MEMBER( a2bus_ayboard_device::via1_out_b )
break;
case 1: // BDIR=0, BC1=1 (read PSG)
- m_porta1 = m_ay1->data_r();
+ m_porta1 = m_ay1->read_data();
break;
case 2: // BDIR=1, BC1=0 (write PSG)
- m_ay1->data_w(m_porta1);
+ m_ay1->write_data(m_porta1);
break;
case 3: // BDIR=1, BC1=1 (latch)
- m_ay1->address_w(m_porta1);
+ m_ay1->write_address(m_porta1);
break;
}
}
@@ -266,10 +266,10 @@ WRITE8_MEMBER( a2bus_phasor_device::via1_out_b )
{
if (!(data & 4))
{
- m_ay1->reset_w();
+ m_ay1->reset_w(space, 0, 0);
if (m_native)
{
- m_ay2->reset_w();
+ m_ay2->reset_w(space, 0, 0);
}
}
else
@@ -289,23 +289,23 @@ WRITE8_MEMBER( a2bus_phasor_device::via1_out_b )
case 1: // BDIR=0, BC1=1 (read PSG)
if (BIT(chip_sel, 0))
- m_porta1 = m_ay1->data_r();
+ m_porta1 = m_ay1->read_data();
if (BIT(chip_sel, 1))
- m_porta1 = m_ay2->data_r();
+ m_porta1 = m_ay2->read_data();
break;
case 2: // BDIR=1, BC1=0 (write PSG)
if (BIT(chip_sel, 0))
- m_ay1->data_w(m_porta1);
+ m_ay1->write_data(m_porta1);
if (BIT(chip_sel, 1))
- m_ay2->data_w(m_porta1);
+ m_ay2->write_data(m_porta1);
break;
case 3: // BDIR=1, BC1=1 (latch)
if (BIT(chip_sel, 0))
- m_ay1->address_w(m_porta1);
+ m_ay1->write_address(m_porta1);
if (BIT(chip_sel, 1))
- m_ay2->address_w(m_porta1);
+ m_ay2->write_address(m_porta1);
break;
}
}
@@ -320,7 +320,7 @@ WRITE8_MEMBER( a2bus_ayboard_device::via2_out_b )
{
if (!BIT(data, 2))
{
- m_ay2->reset_w();
+ m_ay2->reset_w(space, 0, 0);
}
else
{
@@ -330,15 +330,15 @@ WRITE8_MEMBER( a2bus_ayboard_device::via2_out_b )
break;
case 1: // BDIR=0, BC1=1 (read PSG)
- m_porta2 = m_ay2->data_r();
+ m_porta2 = m_ay2->read_data();
break;
case 2: // BDIR=1, BC1=0 (write PSG)
- m_ay2->data_w(m_porta2);
+ m_ay2->write_data(m_porta2);
break;
case 3: // BDIR=1, BC1=1 (latch)
- m_ay2->data_w(m_porta2);
+ m_ay2->write_data(m_porta2);
break;
}
}
@@ -350,12 +350,12 @@ WRITE8_MEMBER( a2bus_phasor_device::via2_out_b )
{
if (m_native)
{
- m_ay3->reset_w();
- m_ay4->reset_w();
+ m_ay3->reset_w(space, 0, 0);
+ m_ay4->reset_w(space, 0, 0);
}
else
{
- m_ay2->reset_w();
+ m_ay2->reset_w(space, 0, 0);
}
}
else
@@ -375,23 +375,23 @@ WRITE8_MEMBER( a2bus_phasor_device::via2_out_b )
case 1: // BDIR=0, BC1=1 (read PSG)
if (BIT(chip_sel, 0))
- m_porta2 = m_ay3->data_r();
+ m_porta2 = m_ay3->read_data();
if (BIT(chip_sel, 1))
- m_porta2 = m_ay4->data_r();
+ m_porta2 = m_ay4->read_data();
break;
case 2: // BDIR=1, BC1=0 (write PSG)
if (BIT(chip_sel, 0))
- m_ay3->data_w(m_porta2);
+ m_ay3->write_data(m_porta2);
if (BIT(chip_sel, 1))
- m_ay4->data_w(m_porta2);
+ m_ay4->write_data(m_porta2);
break;
case 3: // BDIR=1, BC1=1 (latch)
if (BIT(chip_sel, 0))
- m_ay3->address_w(m_porta2);
+ m_ay3->write_address(m_porta2);
if (BIT(chip_sel, 1))
- m_ay4->address_w(m_porta2);
+ m_ay4->write_address(m_porta2);
break;
}
}
diff --git a/src/devices/bus/a2bus/a2pic.cpp b/src/devices/bus/a2bus/a2pic.cpp
index 21c749eb50c..218d3ac6892 100644
--- a/src/devices/bus/a2bus/a2pic.cpp
+++ b/src/devices/bus/a2bus/a2pic.cpp
@@ -71,16 +71,14 @@ ioport_constructor a2bus_pic_device::device_input_ports() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_pic_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a2bus_pic_device::device_add_mconfig)
CENTRONICS(config, m_ctx, centronics_devices, "printer");
m_ctx->set_data_input_buffer(m_ctx_data_in);
m_ctx->ack_handler().set(FUNC(a2bus_pic_device::ack_w));
INPUT_BUFFER(config, m_ctx_data_in);
- OUTPUT_LATCH(config, m_ctx_data_out);
- m_ctx->set_output_latch(*m_ctx_data_out);
-}
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("ctx_data_out", PIC_CENTRONICS_TAG)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/a2bus/a2sam.cpp b/src/devices/bus/a2bus/a2sam.cpp
index 16b8b5affe8..21ea8d1fdca 100644
--- a/src/devices/bus/a2bus/a2sam.cpp
+++ b/src/devices/bus/a2bus/a2sam.cpp
@@ -31,14 +31,12 @@ DEFINE_DEVICE_TYPE(A2BUS_SAM, a2bus_sam_device, "a2sam", "Don't Ask Software S.A
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_sam_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a2bus_sam_device::device_add_mconfig)
SPEAKER(config, "speaker").front_center();
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5); // unknown DAC
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
-}
+ MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.5) // unknown DAC
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/bus/a2bus/a2scsi.cpp b/src/devices/bus/a2bus/a2scsi.cpp
index 014414e7e98..ef3422e9783 100644
--- a/src/devices/bus/a2bus/a2scsi.cpp
+++ b/src/devices/bus/a2bus/a2scsi.cpp
@@ -50,6 +50,14 @@ DEFINE_DEVICE_TYPE(A2BUS_SCSI, a2bus_scsi_device, "a2scsi", "Apple II SCSI Card"
#define SCSI_BUS_TAG "scsibus"
#define SCSI_5380_TAG "scsibus:7:ncr5380"
+void a2bus_scsi_device::ncr5380(device_t *device)
+{
+ devcb_base *devcb;
+ (void)devcb;
+ MCFG_DEVICE_CLOCK(10000000)
+ MCFG_NCR5380N_DRQ_HANDLER(WRITELINE("^^", a2bus_scsi_device, drq_w))
+}
+
static void scsi_devices(device_slot_interface &device)
{
device.option_add("cdrom", NSCSI_CDROM);
@@ -70,21 +78,18 @@ ROM_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_scsi_device::device_add_mconfig(machine_config &config)
-{
- NSCSI_BUS(config, m_scsibus);
- NSCSI_CONNECTOR(config, "scsibus:0", scsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsibus:1", scsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsibus:2", scsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsibus:3", scsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsibus:4", scsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsibus:5", scsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsibus:6", scsi_devices, "harddisk", false);
- NSCSI_CONNECTOR(config, "scsibus:7", scsi_devices, "ncr5380", true).set_option_machine_config("ncr5380", [this](device_t *device) {
- device->set_clock(10000000);
- downcast<ncr5380n_device &>(*device).drq_handler().set(*this, FUNC(a2bus_scsi_device::drq_w));
- });
-}
+MACHINE_CONFIG_START(a2bus_scsi_device::device_add_mconfig)
+ MCFG_NSCSI_BUS_ADD(SCSI_BUS_TAG)
+ MCFG_NSCSI_ADD("scsibus:0", scsi_devices, nullptr, false)
+ MCFG_NSCSI_ADD("scsibus:1", scsi_devices, nullptr, false)
+ MCFG_NSCSI_ADD("scsibus:2", scsi_devices, nullptr, false)
+ MCFG_NSCSI_ADD("scsibus:3", scsi_devices, nullptr, false)
+ MCFG_NSCSI_ADD("scsibus:4", scsi_devices, nullptr, false)
+ MCFG_NSCSI_ADD("scsibus:5", scsi_devices, nullptr, false)
+ MCFG_NSCSI_ADD("scsibus:6", scsi_devices, "harddisk", false)
+ MCFG_NSCSI_ADD("scsibus:7", scsi_devices, "ncr5380", true)
+ MCFG_SLOT_OPTION_MACHINE_CONFIG("ncr5380", ncr5380)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -154,7 +159,7 @@ uint8_t a2bus_scsi_device::read_c0nx(uint8_t offset)
case 6:
case 7:
// logerror("Read 5380 @ %x\n", offset);
- return m_ncr5380->read(offset);
+ return m_ncr5380->read(machine().dummy_space(), offset);
case 8: // read and DACK
return m_ncr5380->dma_r();
@@ -194,7 +199,7 @@ void a2bus_scsi_device::write_c0nx(uint8_t offset, uint8_t data)
case 6:
case 7:
// logerror("%02x to 5380 reg %x\n", data, offset);
- m_ncr5380->write(offset, data);
+ m_ncr5380->write(machine().dummy_space(), offset, data);
break;
case 8: // write and DACK
diff --git a/src/devices/bus/a2bus/a2scsi.h b/src/devices/bus/a2bus/a2scsi.h
index f1a556eeab7..d9d143da6e9 100644
--- a/src/devices/bus/a2bus/a2scsi.h
+++ b/src/devices/bus/a2bus/a2scsi.h
@@ -30,6 +30,8 @@ public:
DECLARE_WRITE_LINE_MEMBER( drq_w );
+ static void ncr5380(device_t *device);
+
protected:
a2bus_scsi_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/bus/a2bus/a2softcard.cpp b/src/devices/bus/a2bus/a2softcard.cpp
index d41c84b9425..b8c71153e7b 100644
--- a/src/devices/bus/a2bus/a2softcard.cpp
+++ b/src/devices/bus/a2bus/a2softcard.cpp
@@ -82,7 +82,7 @@ void a2bus_softcard_device::write_cnxx(uint8_t offset, uint8_t data)
if (!m_bEnabled)
{
m_z80->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
- raise_slot_dma();
+ set_maincpu_halt(ASSERT_LINE);
if (m_FirstZ80Boot)
{
@@ -95,7 +95,7 @@ void a2bus_softcard_device::write_cnxx(uint8_t offset, uint8_t data)
else
{
m_z80->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
- lower_slot_dma();
+ set_maincpu_halt(CLEAR_LINE);
m_bEnabled = false;
}
}
@@ -106,27 +106,27 @@ READ8_MEMBER( a2bus_softcard_device::dma_r )
{
if (offset <= 0xafff)
{
- return slot_dma_read(offset+0x1000);
+ return slot_dma_read(space, offset+0x1000);
}
else if (offset <= 0xbfff) // LC bank 2 d000-dfff
{
- return slot_dma_read((offset&0xfff) + 0xd000);
+ return slot_dma_read(space, (offset&0xfff) + 0xd000);
}
else if (offset <= 0xcfff) // LC e000-efff
{
- return slot_dma_read((offset&0xfff) + 0xe000);
+ return slot_dma_read(space, (offset&0xfff) + 0xe000);
}
else if (offset <= 0xdfff) // LC f000-ffff (or ROM?)
{
- return slot_dma_read((offset&0xfff) + 0xf000);
+ return slot_dma_read(space, (offset&0xfff) + 0xf000);
}
else if (offset <= 0xefff) // I/O space c000-cfff
{
- return slot_dma_read((offset&0xfff) + 0xc000);
+ return slot_dma_read(space, (offset&0xfff) + 0xc000);
}
else // zero page
{
- return slot_dma_read(offset&0xfff);
+ return slot_dma_read(space, offset&0xfff);
}
}
@@ -144,27 +144,27 @@ WRITE8_MEMBER( a2bus_softcard_device::dma_w )
{
if (offset <= 0xafff)
{
- slot_dma_write(offset+0x1000, data);
+ slot_dma_write(space, offset+0x1000, data);
}
else if (offset <= 0xbfff) // LC bank 2 d000-dfff
{
- slot_dma_write((offset&0xfff) + 0xd000, data);
+ slot_dma_write(space, (offset&0xfff) + 0xd000, data);
}
else if (offset <= 0xcfff) // LC e000-efff
{
- slot_dma_write((offset&0xfff) + 0xe000, data);
+ slot_dma_write(space, (offset&0xfff) + 0xe000, data);
}
else if (offset <= 0xdfff) // LC f000-ffff (or ROM?)
{
- slot_dma_write((offset&0xfff) + 0xf000, data);
+ slot_dma_write(space, (offset&0xfff) + 0xf000, data);
}
else if (offset <= 0xefff) // I/O space c000-cfff
{
- slot_dma_write((offset&0xfff) + 0xc000, data);
+ slot_dma_write(space, (offset&0xfff) + 0xc000, data);
}
else // zero page
{
- slot_dma_write(offset&0xfff, data);
+ slot_dma_write(space, offset&0xfff, data);
}
}
}
diff --git a/src/devices/bus/a2bus/a2ssc.cpp b/src/devices/bus/a2bus/a2ssc.cpp
index 773f4db246f..0261835e1d7 100644
--- a/src/devices/bus/a2bus/a2ssc.cpp
+++ b/src/devices/bus/a2bus/a2ssc.cpp
@@ -189,7 +189,7 @@ uint8_t a2bus_ssc_device::read_c0nx(uint8_t offset)
case 9:
case 0xa:
case 0xb:
- return m_acia->read(offset-8);
+ return m_acia->read(machine().dummy_space(), offset-8);
}
@@ -208,7 +208,7 @@ void a2bus_ssc_device::write_c0nx(uint8_t offset, uint8_t data)
case 9:
case 0xa:
case 0xb:
- m_acia->write(offset-8, data);
+ m_acia->write(machine().dummy_space(), offset-8, data);
break;
}
}
diff --git a/src/devices/bus/a2bus/a2themill.cpp b/src/devices/bus/a2bus/a2themill.cpp
index 14474662ef8..effa5ac9cfb 100644
--- a/src/devices/bus/a2bus/a2themill.cpp
+++ b/src/devices/bus/a2bus/a2themill.cpp
@@ -238,34 +238,34 @@ READ8_MEMBER( a2bus_themill_device::dma_r )
{
if (offset <= 0x7fff)
{
- return slot_dma_read(offset+0x1000);
+ return slot_dma_read(space, offset+0x1000);
}
else if (offset <= 0xafff)
{
- return slot_dma_read((offset&0x3fff) + 0xd000);
+ return slot_dma_read(space, (offset&0x3fff) + 0xd000);
}
else if (offset <= 0xbfff)
{
- return slot_dma_read((offset&0xfff) + 0xc000);
+ return slot_dma_read(space, (offset&0xfff) + 0xc000);
}
else if (offset <= 0xcfff) // 6809 Cxxx -> 6502 ZP
{
- return slot_dma_read((offset&0xfff));
+ return slot_dma_read(space, (offset&0xfff));
}
else // 6809 Dxxx -> 6502 9000
{
- return slot_dma_read((offset-0xd000)+0x9000);
+ return slot_dma_read(space, (offset-0xd000)+0x9000);
}
}
else
{
if (m_flipAddrSpace)
{
- return slot_dma_read(offset^0x8000);
+ return slot_dma_read(space, offset^0x8000);
}
else
{
- return slot_dma_read(offset);
+ return slot_dma_read(space, offset);
}
}
@@ -283,34 +283,34 @@ WRITE8_MEMBER( a2bus_themill_device::dma_w )
{
if (offset <= 0x7fff)
{
- slot_dma_write(offset+0x1000, data);
+ slot_dma_write(space, offset+0x1000, data);
}
else if (offset <= 0xafff)
{
- slot_dma_write((offset&0x3fff) + 0xd000, data);
+ slot_dma_write(space, (offset&0x3fff) + 0xd000, data);
}
else if (offset <= 0xbfff)
{
- slot_dma_write((offset&0xfff) + 0xc000, data);
+ slot_dma_write(space, (offset&0xfff) + 0xc000, data);
}
else if (offset <= 0xcfff)
{
- slot_dma_write((offset&0xfff), data);
+ slot_dma_write(space, (offset&0xfff), data);
}
else // 6809 Dxxx -> 6502 9000
{
- slot_dma_write((offset-0xd000)+0x9000, data);
+ slot_dma_write(space, (offset-0xd000)+0x9000, data);
}
}
else
{
if (m_flipAddrSpace)
{
- slot_dma_write(offset^0x8000, data);
+ slot_dma_write(space, offset^0x8000, data);
}
else
{
- slot_dma_write(offset, data);
+ slot_dma_write(space, offset, data);
}
}
}
diff --git a/src/devices/bus/a2bus/a2ultraterm.cpp b/src/devices/bus/a2bus/a2ultraterm.cpp
index fd8fb2a895a..9ea36ea2496 100644
--- a/src/devices/bus/a2bus/a2ultraterm.cpp
+++ b/src/devices/bus/a2bus/a2ultraterm.cpp
@@ -104,11 +104,10 @@ ROM_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_videx160_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, ULTRATERM_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_raw(CLOCK_LOW, 882, 0, 720, 370, 0, 350);
- screen.set_screen_update(ULTRATERM_MC6845_NAME, FUNC(mc6845_device::screen_update));
+MACHINE_CONFIG_START(a2bus_videx160_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( ULTRATERM_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_RAW_PARAMS(CLOCK_LOW, 882, 0, 720, 370, 0, 350 )
+ MCFG_SCREEN_UPDATE_DEVICE( ULTRATERM_MC6845_NAME, mc6845_device, screen_update )
MC6845(config, m_crtc, CLOCK_LOW/9);
m_crtc->set_screen(ULTRATERM_SCREEN_NAME);
@@ -116,7 +115,7 @@ void a2bus_videx160_device::device_add_mconfig(machine_config &config)
m_crtc->set_char_width(8);
m_crtc->set_update_row_callback(FUNC(a2bus_videx160_device::crtc_update_row), this);
m_crtc->out_vsync_callback().set(FUNC(a2bus_videx160_device::vsync_changed));
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -195,7 +194,7 @@ uint8_t a2bus_videx160_device::read_c0nx(uint8_t offset)
switch (offset)
{
case 1:
- return m_crtc->register_r(); // status_r?
+ return m_crtc->read_register(); // status_r?
case 2:
return m_ctrl1;
@@ -219,11 +218,11 @@ void a2bus_videx160_device::write_c0nx(uint8_t offset, uint8_t data)
switch (offset)
{
case 0:
- m_crtc->address_w(data);
+ m_crtc->write_address(data);
break;
case 1:
- m_crtc->register_w(data);
+ m_crtc->write_register(data);
break;
case 2:
diff --git a/src/devices/bus/a2bus/a2videoterm.cpp b/src/devices/bus/a2bus/a2videoterm.cpp
index 35cb657afd9..519496b1b1b 100644
--- a/src/devices/bus/a2bus/a2videoterm.cpp
+++ b/src/devices/bus/a2bus/a2videoterm.cpp
@@ -117,11 +117,10 @@ ROM_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_videx80_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, VIDEOTERM_SCREEN_NAME, SCREEN_TYPE_RASTER)); // 560x216? (80x24 7x9 characters)
- screen.set_raw(MDA_CLOCK, 882, 0, 720, 370, 0, 350);
- screen.set_screen_update(VIDEOTERM_MC6845_NAME, FUNC(mc6845_device::screen_update));
+MACHINE_CONFIG_START(a2bus_videx80_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( VIDEOTERM_SCREEN_NAME, RASTER) // 560x216? (80x24 7x9 characters)
+ MCFG_SCREEN_RAW_PARAMS(MDA_CLOCK, 882, 0, 720, 370, 0, 350 )
+ MCFG_SCREEN_UPDATE_DEVICE( VIDEOTERM_MC6845_NAME, mc6845_device, screen_update )
MC6845(config, m_crtc, MDA_CLOCK/9);
m_crtc->set_screen(VIDEOTERM_SCREEN_NAME);
@@ -129,7 +128,7 @@ void a2bus_videx80_device::device_add_mconfig(machine_config &config)
m_crtc->set_char_width(8);
m_crtc->set_update_row_callback(FUNC(a2bus_videx80_device::crtc_update_row), this);
m_crtc->out_vsync_callback().set(FUNC(a2bus_videx80_device::vsync_changed));
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -241,7 +240,7 @@ uint8_t a2bus_videx80_device::read_c0nx(uint8_t offset)
if (offset == 1)
{
- return m_crtc->register_r(); // status_r?
+ return m_crtc->read_register(); // status_r?
}
return 0xff;
@@ -256,11 +255,11 @@ void a2bus_videx80_device::write_c0nx(uint8_t offset, uint8_t data)
{
if (offset == 0)
{
- m_crtc->address_w(data);
+ m_crtc->write_address(data);
}
else if (offset == 1)
{
- m_crtc->register_w(data);
+ m_crtc->write_register(data);
}
m_rambank = ((offset>>2) & 3) * 512;
diff --git a/src/devices/bus/a2bus/a2zipdrive.cpp b/src/devices/bus/a2bus/a2zipdrive.cpp
index 41034fab231..aaeb6ed6219 100644
--- a/src/devices/bus/a2bus/a2zipdrive.cpp
+++ b/src/devices/bus/a2bus/a2zipdrive.cpp
@@ -2,19 +2,16 @@
// copyright-holders:R. Belmont
/*********************************************************************
- a2zipdrive.cpp
+ a2zipdrive.c
ZIP Technologies ZipDrive IDE card
- Parsons Engineering Focus Drive IDE card
- These cards are very, very similar. Maybe Parsons designed both?
-
- NOTE: No known dump exists of the Zip formatter utility and the
+ NOTE: No known dump exists of the formatter utility and the
format of the custom partition record (block 0) that the card
expects has not yet been determined, so this is largely untested
and will work only with a drive dump from real h/w.
- PLEASE use it only on a backup copy of said dump and contact MAMEdev
+ PLEASE use it only on a backup copy of said dump and contact MESSdev
if you have one!
Partition block format:
@@ -32,7 +29,6 @@
//**************************************************************************
DEFINE_DEVICE_TYPE(A2BUS_ZIPDRIVE, a2bus_zipdrive_device, "a2zipdrv", "Zip Technologies ZipDrive")
-DEFINE_DEVICE_TYPE(A2BUS_FOCUSDRIVE, a2bus_focusdrive_device, "a2focdrv", "Parsons Engineering Focus Drive")
#define ZIPDRIVE_ROM_REGION "zipdrive_rom"
#define ZIPDRIVE_ATA_TAG "zipdrive_ata"
@@ -42,11 +38,6 @@ ROM_START( zipdrive )
ROM_LOAD( "zip drive - rom.bin", 0x000000, 0x002000, CRC(fd800a40) SHA1(46636bfed88c864139e3d2826661908a8c07c459) )
ROM_END
-ROM_START( focusdrive )
- ROM_REGION(0x2000, ZIPDRIVE_ROM_REGION, 0)
- ROM_LOAD( "focusrom.bin", 0x001000, 0x001000, CRC(0fd0ba25) SHA1(acf414aa145fcfa1c12aca0269f1f7ada82f1c04) )
-ROM_END
-
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
@@ -69,11 +60,6 @@ const tiny_rom_entry *a2bus_zipdrivebase_device::device_rom_region() const
return ROM_NAME( zipdrive );
}
-const tiny_rom_entry *a2bus_focusdrive_device::device_rom_region() const
-{
- return ROM_NAME( focusdrive );
-}
-
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
@@ -90,11 +76,6 @@ a2bus_zipdrive_device::a2bus_zipdrive_device(const machine_config &mconfig, cons
{
}
-a2bus_focusdrive_device::a2bus_focusdrive_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- a2bus_zipdrivebase_device(mconfig, A2BUS_FOCUSDRIVE, tag, owner, clock)
-{
-}
-
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -108,12 +89,9 @@ void a2bus_zipdrivebase_device::device_start()
void a2bus_zipdrivebase_device::device_reset()
{
+ popmessage("Zip Drive partition format unknown, contact MESSdev if you have the software or a drive dump!");
}
-void a2bus_focusdrive_device::device_reset()
-{
- m_rom[0x1c6c] = 0x03; // eat 3 IDE words here instead of 1, fixes a bug? in the original ROM
-}
/*-------------------------------------------------
read_c0nx - called for reads from this card's c0nx space
@@ -134,7 +112,7 @@ uint8_t a2bus_zipdrivebase_device::read_c0nx(uint8_t offset)
return m_ata->read_cs0(offset, 0xff);
case 8: // data port
- m_lastdata = m_ata->read_cs0(offset, 0xffff);
+ m_lastdata = m_ata->read_cs0(offset);
// printf("%04x @ IDE data\n", m_lastdata);
return m_lastdata&0xff;
@@ -142,42 +120,13 @@ uint8_t a2bus_zipdrivebase_device::read_c0nx(uint8_t offset)
return (m_lastdata>>8) & 0xff;
default:
- logerror("unhandled read @ C0n%x\n", offset);
+ logerror("a2zipdrive: unhandled read @ C0n%x\n", offset);
break;
}
return 0xff;
}
-uint8_t a2bus_focusdrive_device::read_c0nx(uint8_t offset)
-{
- switch (offset)
- {
- case 8:
- case 9:
- case 0xa:
- case 0xb:
- case 0xc:
- case 0xd:
- case 0xe:
- case 0xf:
- return m_ata->read_cs0(offset&7, 0xff);
-
- case 0: // data port
- m_lastdata = m_ata->read_cs0(offset, 0xffff);
- //printf("%04x @ IDE data\n", m_lastdata);
- return m_lastdata&0xff;
-
- case 1:
- return (m_lastdata>>8) & 0xff;
-
- default:
- logerror("unhandled read @ C0n%x\n", offset);
- break;
- }
-
- return 0xff;
-}
/*-------------------------------------------------
write_c0nx - called for writes to this card's c0nx space
@@ -208,7 +157,7 @@ void a2bus_zipdrivebase_device::write_c0nx(uint8_t offset, uint8_t data)
// printf("%02x to IDE data hi\n", data);
m_lastdata &= 0x00ff;
m_lastdata |= (data << 8);
- m_ata->write_cs0(0, m_lastdata, 0xffff);
+ m_ata->write_cs0(0, m_lastdata);
break;
default:
@@ -217,48 +166,6 @@ void a2bus_zipdrivebase_device::write_c0nx(uint8_t offset, uint8_t data)
}
}
-void a2bus_focusdrive_device::write_c0nx(uint8_t offset, uint8_t data)
-{
- switch (offset)
- {
- case 8:
- case 9:
- case 0xa:
- case 0xb:
- case 0xc:
- case 0xd:
- case 0xe:
- case 0xf:
- // due to a bug in the 6502 firmware, eat data if DRQ is set
- #if 0
- while (m_ata->read_cs0(7, 0xff) & 0x08)
- {
- m_ata->read_cs0(0, 0xffff);
- printf("eating 2 bytes to clear DRQ\n");
- }
- #endif
-// printf("%02x to IDE controller @ %x\n", data, offset);
- m_ata->write_cs0(offset & 7, data, 0xff);
- break;
-
- case 0:
-// printf("%02x to IDE data lo\n", data);
- m_lastdata = data;
- break;
-
- case 1:
-// printf("%02x to IDE data hi\n", data);
- m_lastdata &= 0x00ff;
- m_lastdata |= (data << 8);
- m_ata->write_cs0(0, m_lastdata, 0xffff);
- break;
-
- default:
- printf("focus: write %02x @ unhandled C0n%x\n", data, offset);
- break;
- }
-}
-
/*-------------------------------------------------
read_cnxx - called for reads from this card's cnxx space
-------------------------------------------------*/
diff --git a/src/devices/bus/a2bus/a2zipdrive.h b/src/devices/bus/a2bus/a2zipdrive.h
index 9e3e68e79f2..8187e04cdd2 100644
--- a/src/devices/bus/a2bus/a2zipdrive.h
+++ b/src/devices/bus/a2bus/a2zipdrive.h
@@ -5,9 +5,8 @@
a2zipdrive.h
ZIP Technologies ZipDrive IDE card
- Parsons Engineering Focus Drive IDE card
- See important NOTE at the top of a2zipdrive.cpp!
+ See important NOTE at the top of a2zipdrive.c!
*********************************************************************/
@@ -45,6 +44,8 @@ protected:
required_device<ata_interface_device> m_ata;
uint8_t *m_rom;
+
+private:
uint16_t m_lastdata;
};
@@ -54,20 +55,7 @@ public:
a2bus_zipdrive_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-class a2bus_focusdrive_device : public a2bus_zipdrivebase_device
-{
-public:
- a2bus_focusdrive_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- virtual void device_reset() override;
- virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t read_c0nx(uint8_t offset) override;
- virtual void write_c0nx(uint8_t offset, uint8_t data) override;
-};
-
// device type definition
DECLARE_DEVICE_TYPE(A2BUS_ZIPDRIVE, a2bus_zipdrive_device)
-DECLARE_DEVICE_TYPE(A2BUS_FOCUSDRIVE, a2bus_focusdrive_device)
#endif // MAME_BUS_A2BUS_ZIPDRIVE_H
diff --git a/src/devices/bus/a2bus/agat7ports.cpp b/src/devices/bus/a2bus/agat7ports.cpp
index 5c24d8fac8f..d7c12ad81d9 100644
--- a/src/devices/bus/a2bus/agat7ports.cpp
+++ b/src/devices/bus/a2bus/agat7ports.cpp
@@ -51,20 +51,18 @@ INPUT_PORTS_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_agat7_ports_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a2bus_agat7_ports_device::device_add_mconfig)
I8255(config, m_d9);
m_d9->out_pa_callback().set("cent_data_out", FUNC(output_latch_device::bus_w));
m_d9->out_pb_callback().set(FUNC(a2bus_agat7_ports_device::write_portb));
m_d9->in_pc_callback().set(FUNC(a2bus_agat7_ports_device::read_portc));
- CENTRONICS(config, m_centronics, centronics_devices, "printer");
- m_centronics->busy_handler().set(FUNC(a2bus_agat7_ports_device::write_centronics_busy));
- output_latch_device &cent_data_out(OUTPUT_LATCH(config, "cent_data_out"));
- m_centronics->set_output_latch(cent_data_out);
+ MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer")
+ MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, a2bus_agat7_ports_device, write_centronics_busy))
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
I8251(config, m_d10, 0);
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
// input_ports - device-specific input ports
diff --git a/src/devices/bus/a2bus/agat840k_hle.cpp b/src/devices/bus/a2bus/agat840k_hle.cpp
index c95d66a09e9..3571513b7d5 100644
--- a/src/devices/bus/a2bus/agat840k_hle.cpp
+++ b/src/devices/bus/a2bus/agat840k_hle.cpp
@@ -51,12 +51,13 @@ static const floppy_interface agat840k_hle_floppy_interface =
"floppy_5_25"
};
-void a2bus_agat840k_hle_device::device_add_mconfig(machine_config &config)
-{
- legacy_floppy_image_device &floppy0(LEGACY_FLOPPY(config, FLOPPY_0, 0, &agat840k_hle_floppy_interface));
- floppy0.out_idx_cb().set(FUNC(a2bus_agat840k_hle_device::index_0_w));
- legacy_floppy_image_device &floppy1(LEGACY_FLOPPY(config, FLOPPY_1, 0, &agat840k_hle_floppy_interface));
- floppy1.out_idx_cb().set(FUNC(a2bus_agat840k_hle_device::index_1_w));
+MACHINE_CONFIG_START(a2bus_agat840k_hle_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(FLOPPY_0, LEGACY_FLOPPY, 0)
+ MCFG_LEGACY_FLOPPY_CONFIG(agat840k_hle_floppy_interface)
+ MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(*this, a2bus_agat840k_hle_device, index_0_w))
+ MCFG_DEVICE_ADD(FLOPPY_1, LEGACY_FLOPPY, 0)
+ MCFG_LEGACY_FLOPPY_CONFIG(agat840k_hle_floppy_interface)
+ MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(*this, a2bus_agat840k_hle_device, index_1_w))
I8255(config, m_d14);
// PA not connected
@@ -68,7 +69,7 @@ void a2bus_agat840k_hle_device::device_add_mconfig(machine_config &config)
// m_d15->out_pb_callback().set(FUNC(a2bus_agat840k_hle_device::d15_o_b)); // write data
m_d15->in_pc_callback().set(FUNC(a2bus_agat840k_hle_device::d15_i_c));
m_d15->out_pc_callback().set(FUNC(a2bus_agat840k_hle_device::d15_o_c));
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/a2bus/corvfdc02.cpp b/src/devices/bus/a2bus/corvfdc02.cpp
index 36f5dbbd09c..7d4bc6ed785 100644
--- a/src/devices/bus/a2bus/corvfdc02.cpp
+++ b/src/devices/bus/a2bus/corvfdc02.cpp
@@ -132,10 +132,10 @@ uint8_t a2bus_corvfdc02_device::read_c0nx(uint8_t offset)
switch (offset)
{
case 0: // 765 FIFO
- return m_fdc->fifo_r();
+ return m_fdc->read_fifo();
case 1: // 765 MSR
- return m_fdc->msr_r();
+ return m_fdc->read_msr();
case 2: // buffer address
return (m_bufptr>>1) & 0xff;
@@ -170,7 +170,7 @@ void a2bus_corvfdc02_device::write_c0nx(uint8_t offset, uint8_t data)
switch (offset)
{
case 0: // FDC FIFO write
- m_fdc->fifo_w(data);
+ m_fdc->write_fifo(data);
break;
case 1: // FDC ???
diff --git a/src/devices/bus/a2bus/ezcgi.cpp b/src/devices/bus/a2bus/ezcgi.cpp
index a9bc648f08e..ec9dce1cad4 100644
--- a/src/devices/bus/a2bus/ezcgi.cpp
+++ b/src/devices/bus/a2bus/ezcgi.cpp
@@ -48,35 +48,33 @@ void a2bus_ezcgi_device::device_add_mconfig(machine_config &config)
SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER);
}
-void a2bus_ezcgi_9938_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a2bus_ezcgi_9938_device::device_add_mconfig)
V9938(config, m_tms, XTAL(21'477'272)); // typical 9938 clock, not verified
m_tms->set_vram_size(0x30000); // 192K of VRAM
m_tms->set_screen(SCREEN_TAG);
m_tms->int_cb().set(FUNC(a2bus_ezcgi_9938_device::tms_irq_w));
- screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER));
- screen.set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
- screen.set_refresh_hz(60);
- screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
- screen.set_size(MSX2_TOTAL_XRES_PIXELS, 262*2);
- screen.set_visarea(MSX2_XBORDER_PIXELS - MSX2_VISIBLE_XBORDER_PIXELS, MSX2_TOTAL_XRES_PIXELS - MSX2_XBORDER_PIXELS + MSX2_VISIBLE_XBORDER_PIXELS - 1, MSX2_YBORDER_PIXELS - MSX2_VISIBLE_YBORDER_PIXELS, MSX2_TOTAL_YRES_PIXELS - MSX2_YBORDER_PIXELS + MSX2_VISIBLE_YBORDER_PIXELS - 1);
-}
+ MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
+ MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
+ MCFG_SCREEN_REFRESH_RATE(60)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
+ MCFG_SCREEN_SIZE(MSX2_TOTAL_XRES_PIXELS, 262*2)
+ MCFG_SCREEN_VISIBLE_AREA(MSX2_XBORDER_PIXELS - MSX2_VISIBLE_XBORDER_PIXELS, MSX2_TOTAL_XRES_PIXELS - MSX2_XBORDER_PIXELS + MSX2_VISIBLE_XBORDER_PIXELS - 1, MSX2_YBORDER_PIXELS - MSX2_VISIBLE_YBORDER_PIXELS, MSX2_TOTAL_YRES_PIXELS - MSX2_YBORDER_PIXELS + MSX2_VISIBLE_YBORDER_PIXELS - 1)
+MACHINE_CONFIG_END
-void a2bus_ezcgi_9958_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a2bus_ezcgi_9958_device::device_add_mconfig)
V9958(config, m_tms, XTAL(21'477'272)); // typical 9938/9958 clock, not verified
m_tms->set_vram_size(0x30000); // 192K of VRAM
m_tms->set_screen(SCREEN_TAG);
m_tms->int_cb().set(FUNC(a2bus_ezcgi_9958_device::tms_irq_w));
- screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER));
- screen.set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
- screen.set_refresh_hz(60);
- screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
- screen.set_size(MSX2_TOTAL_XRES_PIXELS, 262*2);
- screen.set_visarea(MSX2_XBORDER_PIXELS - MSX2_VISIBLE_XBORDER_PIXELS, MSX2_TOTAL_XRES_PIXELS - MSX2_XBORDER_PIXELS + MSX2_VISIBLE_XBORDER_PIXELS - 1, MSX2_YBORDER_PIXELS - MSX2_VISIBLE_YBORDER_PIXELS, MSX2_TOTAL_YRES_PIXELS - MSX2_YBORDER_PIXELS + MSX2_VISIBLE_YBORDER_PIXELS - 1);
-}
+ MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
+ MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
+ MCFG_SCREEN_REFRESH_RATE(60)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
+ MCFG_SCREEN_SIZE(MSX2_TOTAL_XRES_PIXELS, 262*2)
+ MCFG_SCREEN_VISIBLE_AREA(MSX2_XBORDER_PIXELS - MSX2_VISIBLE_XBORDER_PIXELS, MSX2_TOTAL_XRES_PIXELS - MSX2_XBORDER_PIXELS + MSX2_VISIBLE_XBORDER_PIXELS - 1, MSX2_YBORDER_PIXELS - MSX2_VISIBLE_YBORDER_PIXELS, MSX2_TOTAL_YRES_PIXELS - MSX2_YBORDER_PIXELS + MSX2_VISIBLE_YBORDER_PIXELS - 1)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/bus/a2bus/laser128.cpp b/src/devices/bus/a2bus/laser128.cpp
index e0c7626aa93..dc7ae4fea21 100644
--- a/src/devices/bus/a2bus/laser128.cpp
+++ b/src/devices/bus/a2bus/laser128.cpp
@@ -32,9 +32,8 @@ DEFINE_DEVICE_TYPE(A2BUS_LASER128, a2bus_laser128_device, "a2laser128", "VTech L
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_laser128_device::device_add_mconfig(machine_config &config)
-{
-}
+MACHINE_CONFIG_START(a2bus_laser128_device::device_add_mconfig)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/bus/a2bus/mouse.cpp b/src/devices/bus/a2bus/mouse.cpp
index a960c74e52c..e95bb6f019a 100644
--- a/src/devices/bus/a2bus/mouse.cpp
+++ b/src/devices/bus/a2bus/mouse.cpp
@@ -203,7 +203,7 @@ void a2bus_mouse_device::device_reset()
uint8_t a2bus_mouse_device::read_c0nx(uint8_t offset)
{
- return m_pia->read(offset & 3);
+ return m_pia->reg_r(offset & 3);
}
/*-------------------------------------------------
@@ -212,7 +212,7 @@ uint8_t a2bus_mouse_device::read_c0nx(uint8_t offset)
void a2bus_mouse_device::write_c0nx(uint8_t offset, uint8_t data)
{
- m_pia->write(offset & 3, data);
+ m_pia->reg_w(offset & 3, data);
}
/*-------------------------------------------------
diff --git a/src/devices/bus/a2bus/pc_xporter.cpp b/src/devices/bus/a2bus/pc_xporter.cpp
index 305da9aa868..6334463533b 100644
--- a/src/devices/bus/a2bus/pc_xporter.cpp
+++ b/src/devices/bus/a2bus/pc_xporter.cpp
@@ -115,15 +115,14 @@ void a2bus_pcxporter_device::pc_io(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_pcxporter_device::device_add_mconfig(machine_config &config)
-{
- V30(config, m_v30, A2BUS_7M_CLOCK); // 7.16 MHz as per manual
- m_v30->set_addrmap(AS_PROGRAM, &a2bus_pcxporter_device::pc_map);
- m_v30->set_addrmap(AS_IO, &a2bus_pcxporter_device::pc_io);
- m_v30->set_irq_acknowledge_callback("pic8259", FUNC(pic8259_device::inta_cb));
- m_v30->set_disable();
-
- PIT8253(config, m_pit8253);
+MACHINE_CONFIG_START(a2bus_pcxporter_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(m_v30, V30, A2BUS_7M_CLOCK) // 7.16 MHz as per manual
+ MCFG_DEVICE_PROGRAM_MAP(pc_map)
+ MCFG_DEVICE_IO_MAP(pc_io)
+ MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb)
+ MCFG_DEVICE_DISABLE()
+
+ PIT8253(config, m_pit8253, 0);
m_pit8253->set_clk<0>(A2BUS_7M_CLOCK / 6.0); // heartbeat IRQ
m_pit8253->out_handler<0>().set(m_pic8259, FUNC(pic8259_device::ir0_w));
m_pit8253->set_clk<1>(A2BUS_7M_CLOCK / 6.0); // DRAM refresh
@@ -148,12 +147,11 @@ void a2bus_pcxporter_device::device_add_mconfig(machine_config &config)
m_dma8237->out_dack_callback<2>().set(FUNC(a2bus_pcxporter_device::pc_dack2_w));
m_dma8237->out_dack_callback<3>().set(FUNC(a2bus_pcxporter_device::pc_dack3_w));
- PIC8259(config, m_pic8259);
+ PIC8259(config, m_pic8259, 0);
m_pic8259->out_int_callback().set_inputline(m_v30, 0);
ISA8(config, m_isabus, 0);
- m_isabus->set_memspace(m_v30, AS_PROGRAM);
- m_isabus->set_iospace(m_v30, AS_IO);
+ m_isabus->set_cputag(m_v30);
m_isabus->irq2_callback().set(m_pic8259, FUNC(pic8259_device::ir2_w));
m_isabus->irq3_callback().set(m_pic8259, FUNC(pic8259_device::ir3_w));
m_isabus->irq4_callback().set(m_pic8259, FUNC(pic8259_device::ir4_w));
@@ -164,18 +162,18 @@ void a2bus_pcxporter_device::device_add_mconfig(machine_config &config)
m_isabus->drq2_callback().set(m_dma8237, FUNC(am9517a_device::dreq2_w));
m_isabus->drq3_callback().set(m_dma8237, FUNC(am9517a_device::dreq3_w));
- PC_KBDC(config, m_pc_kbdc, 0);
- m_pc_kbdc->out_clock_cb().set(FUNC(a2bus_pcxporter_device::keyboard_clock_w));
- m_pc_kbdc->out_data_cb().set(FUNC(a2bus_pcxporter_device::keyboard_data_w));
- PC_KBDC_SLOT(config, "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270).set_pc_kbdc_slot(m_pc_kbdc);
+ MCFG_DEVICE_ADD(m_pc_kbdc, PC_KBDC, 0)
+ MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(*this, a2bus_pcxporter_device, keyboard_clock_w))
+ MCFG_PC_KBDC_OUT_DATA_CB(WRITELINE(*this, a2bus_pcxporter_device, keyboard_data_w))
+ MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 1.00);
- ISA8_SLOT(config, "isa1", 0, m_isabus, pc_isa8_cards, "cga", true); // FIXME: determine ISA bus clock
- ISA8_SLOT(config, "isa2", 0, m_isabus, pc_isa8_cards, "fdc_xt", true);
-}
+ MCFG_DEVICE_ADD("isa1", ISA8_SLOT, 0, m_isabus, pc_isa8_cards, "cga", true) // FIXME: determine ISA bus clock
+ MCFG_DEVICE_ADD("isa2", ISA8_SLOT, 0, m_isabus, pc_isa8_cards, "fdc_xt", true)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
@@ -633,12 +631,5 @@ WRITE_LINE_MEMBER( a2bus_pcxporter_device::keyboard_data_w )
WRITE8_MEMBER( a2bus_pcxporter_device::nmi_enable_w )
{
m_nmi_enabled = BIT(data,7);
- if (!m_nmi_enabled)
- m_v30->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
-}
-
-WRITE_LINE_MEMBER( a2bus_pcxporter_device::iochck_w )
-{
- if (m_nmi_enabled && !state)
- m_v30->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
+ m_isabus->set_nmi_state(m_nmi_enabled);
}
diff --git a/src/devices/bus/a2bus/pc_xporter.h b/src/devices/bus/a2bus/pc_xporter.h
index 2a449ed4019..da9aecc6c6c 100644
--- a/src/devices/bus/a2bus/pc_xporter.h
+++ b/src/devices/bus/a2bus/pc_xporter.h
@@ -113,7 +113,6 @@ private:
DECLARE_WRITE8_MEMBER(pc_page_w);
DECLARE_WRITE8_MEMBER(nmi_enable_w);
- DECLARE_WRITE_LINE_MEMBER(iochck_w);
void pc_select_dma_channel(int channel, bool state);
diff --git a/src/devices/bus/a2bus/ssbapple.cpp b/src/devices/bus/a2bus/ssbapple.cpp
index 89165617867..bde53973c13 100644
--- a/src/devices/bus/a2bus/ssbapple.cpp
+++ b/src/devices/bus/a2bus/ssbapple.cpp
@@ -34,12 +34,11 @@ DEFINE_DEVICE_TYPE(A2BUS_SSBAPPLE, a2bus_ssb_device, "a2ssbapl", "Multitech Indu
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_ssb_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a2bus_ssb_device::device_add_mconfig)
SPEAKER(config, "ssbapple").front_center();
- TMS5220(config, m_tms, 640000); // guess - this gives 8 kHz output according to the datasheet
- m_tms->add_route(ALL_OUTPUTS, "ssbapple", 1.0);
-}
+ MCFG_DEVICE_ADD(TMS_TAG, TMS5220, 640000) // guess - this gives 8 kHz output according to the datasheet
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "ssbapple", 1.0)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/bus/a2bus/ssprite.cpp b/src/devices/bus/a2bus/ssprite.cpp
index 69e12dc98dd..818bde14b89 100644
--- a/src/devices/bus/a2bus/ssprite.cpp
+++ b/src/devices/bus/a2bus/ssprite.cpp
@@ -104,7 +104,7 @@ uint8_t a2bus_ssprite_device::read_c0nx(uint8_t offset)
return 0x1f | m_tms5220->status_r();
case 14:
case 15:
- return m_ay->data_r();
+ return m_ay->read_data();
}
return 0xff;
@@ -125,11 +125,11 @@ void a2bus_ssprite_device::write_c0nx(uint8_t offset, uint8_t data)
break;
case 12:
case 13:
- m_ay->data_w(data);
+ m_ay->write_data(data);
break;
case 14:
case 15:
- m_ay->address_w(data);
+ m_ay->write_address(data);
break;
}
}
diff --git a/src/devices/bus/a2bus/timemasterho.cpp b/src/devices/bus/a2bus/timemasterho.cpp
index 6b7f0b1f5eb..ad0e96f2ab3 100644
--- a/src/devices/bus/a2bus/timemasterho.cpp
+++ b/src/devices/bus/a2bus/timemasterho.cpp
@@ -157,7 +157,7 @@ uint8_t a2bus_timemasterho_device::read_c0nx(uint8_t offset)
{
if (offset <= 3)
{
- return m_pia->read(offset);
+ return m_pia->reg_r(offset);
}
return 0xff;
@@ -172,7 +172,7 @@ void a2bus_timemasterho_device::write_c0nx(uint8_t offset, uint8_t data)
{
if (offset <= 3)
{
- m_pia->write(offset, data);
+ m_pia->reg_w(offset, data);
}
}
diff --git a/src/devices/bus/a2bus/transwarp.cpp b/src/devices/bus/a2bus/transwarp.cpp
index 97e02eb8b4e..06557e28cb0 100644
--- a/src/devices/bus/a2bus/transwarp.cpp
+++ b/src/devices/bus/a2bus/transwarp.cpp
@@ -121,11 +121,10 @@ ioport_constructor a2bus_transwarp_device::device_input_ports() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void a2bus_transwarp_device::device_add_mconfig(machine_config &config)
-{
- M65C02(config, m_ourcpu, A2BUS_7M_CLOCK / 2);
- m_ourcpu->set_addrmap(AS_PROGRAM, &a2bus_transwarp_device::m65c02_mem);
-}
+MACHINE_CONFIG_START(a2bus_transwarp_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(CPU_TAG, M65C02, A2BUS_7M_CLOCK / 2)
+ MCFG_DEVICE_PROGRAM_MAP(m65c02_mem)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
@@ -162,7 +161,7 @@ void a2bus_transwarp_device::device_reset()
{
m_bEnabled = true;
m_bReadA2ROM = false;
- raise_slot_dma();
+ set_maincpu_halt(ASSERT_LINE);
if (!(m_dsw2->read() & 0x80))
{
if (m_dsw1->read() & 0x80)
@@ -190,11 +189,6 @@ void a2bus_transwarp_device::device_timer(emu_timer &timer, device_timer_id id,
READ8_MEMBER( a2bus_transwarp_device::dma_r )
{
- if (offset == 0xc070)
- {
- hit_slot_joy();
- }
-
if ((offset >= 0xc090) && (offset <= 0xc0ff))
{
hit_slot(((offset >> 4) & 0xf) - 8);
@@ -205,7 +199,7 @@ READ8_MEMBER( a2bus_transwarp_device::dma_r )
return m_rom[offset & 0xfff];
}
- return slot_dma_read(offset);
+ return slot_dma_read(space, offset);
}
@@ -217,11 +211,6 @@ WRITE8_MEMBER( a2bus_transwarp_device::dma_w )
{
//if ((offset >= 0xc070) && (offset <= 0xc07f)) printf("%02x to %04x\n", data, offset);
- if (offset == 0xc070)
- {
- hit_slot_joy();
- }
-
if (offset == 0xc072)
{
m_bReadA2ROM = true;
@@ -232,7 +221,7 @@ WRITE8_MEMBER( a2bus_transwarp_device::dma_w )
hit_slot(((offset >> 4) & 0xf) - 8);
}
- slot_dma_write(offset, data);
+ slot_dma_write(space, offset, data);
}
bool a2bus_transwarp_device::take_c800()
@@ -254,15 +243,3 @@ void a2bus_transwarp_device::hit_slot(int slot)
}
}
}
-
-void a2bus_transwarp_device::hit_slot_joy()
-{
- // only do slot slowdown if acceleration is enabled
- if (!(m_dsw2->read() & 0x80))
- {
- // accleration's on
- m_ourcpu->set_unscaled_clock(1021800);
- // PREAD main loop counts up to 11*256 uSec, add 1 to cover the setup
- m_timer->adjust(attotime::from_usec(11*257));
- }
-}
diff --git a/src/devices/bus/a2bus/transwarp.h b/src/devices/bus/a2bus/transwarp.h
index e687ae6d350..8b42aefa7e5 100644
--- a/src/devices/bus/a2bus/transwarp.h
+++ b/src/devices/bus/a2bus/transwarp.h
@@ -54,7 +54,6 @@ private:
void m65c02_mem(address_map &map);
void hit_slot(int slot);
- void hit_slot_joy();
};
// device type definition
diff --git a/src/devices/bus/a7800/cpuwiz.cpp b/src/devices/bus/a7800/cpuwiz.cpp
index 0b76f7b2233..8c39f5bf001 100644
--- a/src/devices/bus/a7800/cpuwiz.cpp
+++ b/src/devices/bus/a7800/cpuwiz.cpp
@@ -120,9 +120,9 @@ WRITE8_MEMBER(a78_megacart_device::write_40xx)
// VersaBoard + POKEY @ 0x0450
-void a78_rom_p450_vb_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a78_rom_p450_vb_device::device_add_mconfig)
SPEAKER(config, "addon").front_center();
- POKEY(config, m_pokey450, XTAL(14'318'181)/8).add_route(ALL_OUTPUTS, "addon", 1.00);
-}
+ MCFG_DEVICE_ADD("pokey450", POKEY, XTAL(14'318'181)/8)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00)
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/a7800/cpuwiz.h b/src/devices/bus/a7800/cpuwiz.h
index e9f52a24d4f..1d9b33693d9 100644
--- a/src/devices/bus/a7800/cpuwiz.h
+++ b/src/devices/bus/a7800/cpuwiz.h
@@ -56,8 +56,8 @@ public:
a78_rom_p450_vb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual DECLARE_READ8_MEMBER(read_04xx) override { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(offset & 0x0f); else return 0xff; }
- virtual DECLARE_WRITE8_MEMBER(write_04xx) override { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(offset & 0x0f, data); }
+ virtual DECLARE_READ8_MEMBER(read_04xx) override { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_04xx) override { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); }
protected:
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/bus/a7800/rom.cpp b/src/devices/bus/a7800/rom.cpp
index 362902dbe51..b40eea850c4 100644
--- a/src/devices/bus/a7800/rom.cpp
+++ b/src/devices/bus/a7800/rom.cpp
@@ -229,7 +229,7 @@ READ8_MEMBER(a78_rom_device::read_40xx)
READ8_MEMBER(a78_rom_pokey_device::read_40xx)
{
if (offset < 0x4000)
- return m_pokey->read(offset & 0x0f);
+ return m_pokey->read(space, offset & 0x0f);
if (offset + 0x4000 < m_base_rom)
return 0xff;
@@ -240,16 +240,16 @@ READ8_MEMBER(a78_rom_pokey_device::read_40xx)
WRITE8_MEMBER(a78_rom_pokey_device::write_40xx)
{
if (offset < 0x4000)
- m_pokey->write(offset & 0x0f, data);
+ m_pokey->write(space, offset & 0x0f, data);
}
// TO DO: do we need a PAL variant?!?
-void a78_rom_pokey_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a78_rom_pokey_device::device_add_mconfig)
SPEAKER(config, "addon").front_center();
- POKEY(config, m_pokey, XTAL(14'318'181)/8).add_route(ALL_OUTPUTS, "addon", 1.00);
-}
+ MCFG_DEVICE_ADD("pokey", POKEY, XTAL(14'318'181)/8)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00)
+MACHINE_CONFIG_END
/*-------------------------------------------------
@@ -327,7 +327,7 @@ WRITE8_MEMBER(a78_rom_sg_device::write_40xx)
READ8_MEMBER(a78_rom_sg_pokey_device::read_40xx)
{
if (offset < 0x4000)
- return m_pokey->read(offset & 0x0f);
+ return m_pokey->read(space, offset & 0x0f);
else if (offset < 0x8000)
return m_rom[(offset & 0x3fff) + (m_bank * 0x4000)];
else
@@ -337,17 +337,17 @@ READ8_MEMBER(a78_rom_sg_pokey_device::read_40xx)
WRITE8_MEMBER(a78_rom_sg_pokey_device::write_40xx)
{
if (offset < 0x4000)
- m_pokey->write(offset & 0x0f, data);
+ m_pokey->write(space, offset & 0x0f, data);
else if (offset < 0x8000)
m_bank = data & m_bank_mask;
}
-void a78_rom_sg_pokey_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a78_rom_sg_pokey_device::device_add_mconfig)
SPEAKER(config, "addon").front_center();
- POKEY(config, m_pokey, XTAL(14'318'181)/8).add_route(ALL_OUTPUTS, "addon", 1.00);
-}
+ MCFG_DEVICE_ADD("pokey", POKEY, XTAL(14'318'181)/8)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00)
+MACHINE_CONFIG_END
/*-------------------------------------------------
@@ -497,33 +497,34 @@ WRITE8_MEMBER(a78_rom_act_device::write_40xx)
// Machine configs for PCB variants with a POKEY at $0450
-void a78_rom_p450_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a78_rom_p450_device::device_add_mconfig)
SPEAKER(config, "pokey_450").front_center();
- POKEY(config, m_pokey450, XTAL(14'318'181)/8).add_route(ALL_OUTPUTS, "pokey_450", 1.00);
-}
+ MCFG_DEVICE_ADD("pokey450", POKEY, XTAL(14'318'181)/8)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "pokey_450", 1.00)
+MACHINE_CONFIG_END
-void a78_rom_p450_pokey_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a78_rom_p450_pokey_device::device_add_mconfig)
SPEAKER(config, "addon").front_center();
- POKEY(config, m_pokey, XTAL(14'318'181)/8).add_route(ALL_OUTPUTS, "addon", 1.00);
+ MCFG_DEVICE_ADD("pokey", POKEY, XTAL(14'318'181)/8)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00)
- POKEY(config, m_pokey450, XTAL(14'318'181)/8).add_route(ALL_OUTPUTS, "addon", 1.00);
-}
+ MCFG_DEVICE_ADD("pokey450", POKEY, XTAL(14'318'181)/8)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00)
+MACHINE_CONFIG_END
-void a78_rom_p450_sg_ram_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a78_rom_p450_sg_ram_device::device_add_mconfig)
SPEAKER(config, "pokey_450").front_center();
- POKEY(config, m_pokey450, XTAL(14'318'181)/8).add_route(ALL_OUTPUTS, "pokey_450", 1.00);
-}
+ MCFG_DEVICE_ADD("pokey450", POKEY, XTAL(14'318'181)/8)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "pokey_450", 1.00)
+MACHINE_CONFIG_END
-void a78_rom_p450_sg9_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(a78_rom_p450_sg9_device::device_add_mconfig)
SPEAKER(config, "pokey_450").front_center();
- POKEY(config, m_pokey450, XTAL(14'318'181)/8).add_route(ALL_OUTPUTS, "pokey_450", 1.00);
-}
+ MCFG_DEVICE_ADD("pokey450", POKEY, XTAL(14'318'181)/8)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "pokey_450", 1.00)
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/a7800/rom.h b/src/devices/bus/a7800/rom.h
index 1ad27663b6f..406746c4e93 100644
--- a/src/devices/bus/a7800/rom.h
+++ b/src/devices/bus/a7800/rom.h
@@ -197,8 +197,8 @@ public:
a78_rom_p450_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual DECLARE_READ8_MEMBER(read_04xx) override { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(offset & 0x0f); else return 0xff; }
- virtual DECLARE_WRITE8_MEMBER(write_04xx) override { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(offset & 0x0f, data); }
+ virtual DECLARE_READ8_MEMBER(read_04xx) override { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_04xx) override { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); }
protected:
virtual void device_add_mconfig(machine_config &config) override;
@@ -216,8 +216,8 @@ public:
a78_rom_p450_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual DECLARE_READ8_MEMBER(read_04xx) override { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(offset & 0x0f); else return 0xff; }
- virtual DECLARE_WRITE8_MEMBER(write_04xx) override { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(offset & 0x0f, data); }
+ virtual DECLARE_READ8_MEMBER(read_04xx) override { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_04xx) override { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); }
protected:
virtual void device_add_mconfig(machine_config &config) override;
@@ -235,8 +235,8 @@ public:
a78_rom_p450_sg_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual DECLARE_READ8_MEMBER(read_04xx) override { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(offset & 0x0f); else return 0xff; }
- virtual DECLARE_WRITE8_MEMBER(write_04xx) override { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(offset & 0x0f, data); }
+ virtual DECLARE_READ8_MEMBER(read_04xx) override { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_04xx) override { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); }
protected:
virtual void device_add_mconfig(machine_config &config) override;
@@ -254,8 +254,8 @@ public:
a78_rom_p450_sg9_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual DECLARE_READ8_MEMBER(read_04xx) override { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(offset & 0x0f); else return 0xff; }
- virtual DECLARE_WRITE8_MEMBER(write_04xx) override { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(offset & 0x0f, data); }
+ virtual DECLARE_READ8_MEMBER(read_04xx) override { if (offset >= 0x50 && offset < 0x60) return m_pokey450->read(space, offset & 0x0f); else return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_04xx) override { if (offset >= 0x50 && offset < 0x60) m_pokey450->write(space, offset & 0x0f, data); }
protected:
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/bus/a7800/xboard.cpp b/src/devices/bus/a7800/xboard.cpp
index 0005e595a88..d2e610f666e 100644
--- a/src/devices/bus/a7800/xboard.cpp
+++ b/src/devices/bus/a7800/xboard.cpp
@@ -158,7 +158,7 @@ WRITE8_MEMBER(a78_xboard_device::write_40xx)
READ8_MEMBER(a78_xboard_device::read_04xx)
{
if (BIT(m_reg, 4) && offset >= 0x50 && offset < 0x60)
- return m_pokey->read(offset & 0x0f);
+ return m_pokey->read(space, offset & 0x0f);
else if (BIT(m_reg, 4) && offset >= 0x60 && offset < 0x70)
return m_xbslot->read_04xx(space, offset - 0x10); // access second POKEY
else
@@ -168,7 +168,7 @@ READ8_MEMBER(a78_xboard_device::read_04xx)
WRITE8_MEMBER(a78_xboard_device::write_04xx)
{
if (BIT(m_reg, 4) && offset >= 0x50 && offset < 0x60)
- m_pokey->write(offset & 0x0f, data);
+ m_pokey->write(space, offset & 0x0f, data);
else if (BIT(m_reg, 4) && offset >= 0x60 && offset < 0x70)
m_xbslot->write_04xx(space, offset - 0x10, data); // access second POKEY
else if (offset >= 0x70 && offset < 0x80)
@@ -203,9 +203,9 @@ READ8_MEMBER(a78_xm_device::read_30xx)
READ8_MEMBER(a78_xm_device::read_04xx)
{
if (BIT(m_reg, 4) && offset >= 0x50 && offset < 0x60)
- return m_pokey->read(offset & 0x0f);
+ return m_pokey->read(space, offset & 0x0f);
else if (m_ym_enabled && offset >= 0x60 && offset <= 0x61)
- return m_ym->read(offset & 1);
+ return m_ym->read(space, offset & 1);
else if (BIT(m_reg, 4) && offset >= 0x60 && offset < 0x70)
return m_xbslot->read_04xx(space, offset - 0x10); // access second POKEY
else
@@ -215,9 +215,9 @@ READ8_MEMBER(a78_xm_device::read_04xx)
WRITE8_MEMBER(a78_xm_device::write_04xx)
{
if (BIT(m_reg, 4) && offset >= 0x50 && offset < 0x60)
- m_pokey->write(offset & 0x0f, data);
+ m_pokey->write(space, offset & 0x0f, data);
else if (m_ym_enabled && offset >= 0x60 && offset <= 0x61)
- m_ym->write(offset & 1, data);
+ m_ym->write(space, offset & 1, data);
else if (BIT(m_reg, 4) && offset >= 0x60 && offset < 0x70)
m_xbslot->write_04xx(space, offset - 0x10, data); // access second POKEY
else if (offset >= 0x70 && offset < 0x80)
diff --git a/src/devices/bus/a800/cassette.cpp b/src/devices/bus/a800/cassette.cpp
index fb08819e5ae..1545cf434c7 100644
--- a/src/devices/bus/a800/cassette.cpp
+++ b/src/devices/bus/a800/cassette.cpp
@@ -28,13 +28,12 @@ TODO:
DEFINE_DEVICE_TYPE(A8SIO_CASSETTE, a8sio_cassette_device, "a8sio_cass", "Atari 8 bit cassette")
const device_timer_id TIMER_CASSETTE_READ = 1;
-void a8sio_cassette_device::device_add_mconfig(machine_config &config)
-{
- CASSETTE(config, m_cassette);
- //m_cassette->set_default_state(CASSETTE_STOPPED);
- m_cassette->set_default_state(CASSETTE_PLAY);
- m_cassette->set_interface("atari8bit_cass");
-}
+MACHINE_CONFIG_START(a8sio_cassette_device::device_add_mconfig)
+ MCFG_CASSETTE_ADD("cassette")
+ //MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)
+ MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY)
+ MCFG_CASSETTE_INTERFACE("atari8bit_cass")
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/bus/abcbus/abc890.cpp b/src/devices/bus/abcbus/abc890.cpp
index 27530439929..4807a09a9f5 100644
--- a/src/devices/bus/abcbus/abc890.cpp
+++ b/src/devices/bus/abcbus/abc890.cpp
@@ -27,95 +27,89 @@ DEFINE_DEVICE_TYPE(ABC856, abc856_device, "abc856", "ABC
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void abc890_device::device_add_mconfig(machine_config &config)
-{
- ABCBUS_SLOT(config, "io1", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io2", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io3", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io4", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "mem1", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "mem2", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "mem3", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
-}
+MACHINE_CONFIG_START(abc890_device::device_add_mconfig)
+ MCFG_ABCBUS_SLOT_ADD("io1", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io2", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io3", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io4", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("mem1", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("mem2", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("mem3", abcbus_cards, nullptr)
+MACHINE_CONFIG_END
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void abc_expansion_unit_device::device_add_mconfig(machine_config &config)
-{
- ABCBUS_SLOT(config, "io1", DERIVED_CLOCK(1, 1), abc80_cards, "abc830");
- ABCBUS_SLOT(config, "io2", DERIVED_CLOCK(1, 1), abc80_cards, nullptr);
- ABCBUS_SLOT(config, "io3", DERIVED_CLOCK(1, 1), abc80_cards, nullptr);
- ABCBUS_SLOT(config, "io4", DERIVED_CLOCK(1, 1), abc80_cards, nullptr);
- ABCBUS_SLOT(config, "mem1", DERIVED_CLOCK(1, 1), abc80_cards, "memcard");
- ABCBUS_SLOT(config, "mem2", DERIVED_CLOCK(1, 1), abc80_cards, "16k");
- ABCBUS_SLOT(config, "mem3", DERIVED_CLOCK(1, 1), abc80_cards, nullptr);
-}
+MACHINE_CONFIG_START(abc_expansion_unit_device::device_add_mconfig)
+ MCFG_ABCBUS_SLOT_ADD("io1", abc80_cards, "abc830")
+ MCFG_ABCBUS_SLOT_ADD("io2", abc80_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io3", abc80_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io4", abc80_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("mem1", abc80_cards, "memcard")
+ MCFG_ABCBUS_SLOT_ADD("mem2", abc80_cards, "16k")
+ MCFG_ABCBUS_SLOT_ADD("mem3", abc80_cards, nullptr)
+MACHINE_CONFIG_END
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void abc894_device::device_add_mconfig(machine_config &config)
-{
- ABCBUS_SLOT(config, "io1", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io2", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io3", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
-}
+MACHINE_CONFIG_START(abc894_device::device_add_mconfig)
+ MCFG_ABCBUS_SLOT_ADD("io1", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io2", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io3", abcbus_cards, nullptr)
+MACHINE_CONFIG_END
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void abc850_device::device_add_mconfig(machine_config &config)
-{
- ABCBUS_SLOT(config, "io1", DERIVED_CLOCK(1, 1), abcbus_cards, "abc850fdd");
- ABCBUS_SLOT(config, "io2", DERIVED_CLOCK(1, 1), abcbus_cards, "xebec")
- .set_option_default_bios("xebec", "ro202");
- ABCBUS_SLOT(config, "io3", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io4", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io5", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io6", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io7", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
-}
+MACHINE_CONFIG_START(abc850_device::device_add_mconfig)
+ MCFG_ABCBUS_SLOT_ADD("io1", abcbus_cards, "abc850fdd")
+ MCFG_ABCBUS_SLOT_ADD("io2", abcbus_cards, "xebec")
+ MCFG_SLOT_OPTION_DEFAULT_BIOS("xebec", "ro202")
+ MCFG_ABCBUS_SLOT_ADD("io3", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io4", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io5", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io6", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io7", abcbus_cards, nullptr)
+MACHINE_CONFIG_END
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void abc852_device::device_add_mconfig(machine_config &config)
-{
- ABCBUS_SLOT(config, "io1", DERIVED_CLOCK(1, 1), abcbus_cards, "abc850fdd");
- ABCBUS_SLOT(config, "io2", DERIVED_CLOCK(1, 1), abcbus_cards, "xebec")
- .set_option_default_bios("xebec", "basf6185");
- ABCBUS_SLOT(config, "io3", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io4", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io5", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io6", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io7", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
-}
+MACHINE_CONFIG_START(abc852_device::device_add_mconfig)
+ MCFG_ABCBUS_SLOT_ADD("io1", abcbus_cards, "abc850fdd")
+ MCFG_ABCBUS_SLOT_ADD("io2", abcbus_cards, "xebec")
+ MCFG_SLOT_OPTION_DEFAULT_BIOS("xebec", "basf6185")
+ MCFG_ABCBUS_SLOT_ADD("io3", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io4", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io5", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io6", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io7", abcbus_cards, nullptr)
+MACHINE_CONFIG_END
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void abc856_device::device_add_mconfig(machine_config &config)
-{
- ABCBUS_SLOT(config, "io1", DERIVED_CLOCK(1, 1), abcbus_cards, "abc850fdd");
- ABCBUS_SLOT(config, "io2", DERIVED_CLOCK(1, 1), abcbus_cards, "xebec")
- .set_option_default_bios("xebec", "micr1325");
- ABCBUS_SLOT(config, "io3", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io4", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io5", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io6", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
- ABCBUS_SLOT(config, "io7", DERIVED_CLOCK(1, 1), abcbus_cards, nullptr);
-}
+MACHINE_CONFIG_START(abc856_device::device_add_mconfig)
+ MCFG_ABCBUS_SLOT_ADD("io1", abcbus_cards, "abc850fdd")
+ MCFG_ABCBUS_SLOT_ADD("io2", abcbus_cards, "xebec")
+ MCFG_SLOT_OPTION_DEFAULT_BIOS("xebec", "micr1325")
+ MCFG_ABCBUS_SLOT_ADD("io3", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io4", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io5", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io6", abcbus_cards, nullptr)
+ MCFG_ABCBUS_SLOT_ADD("io7", abcbus_cards, nullptr)
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/abcbus/abcbus.h b/src/devices/bus/abcbus/abcbus.h
index 2388fbc73cf..5bd338b05d7 100644
--- a/src/devices/bus/abcbus/abcbus.h
+++ b/src/devices/bus/abcbus/abcbus.h
@@ -111,6 +111,47 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_ABCBUS_SLOT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, ABCBUS_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+#define MCFG_ABCBUS_SLOT_IRQ_CALLBACK(_irq) \
+ downcast<abcbus_slot_device *>(device)->set_irq_callback(DEVCB_##_irq);
+
+#define MCFG_ABCBUS_SLOT_NMI_CALLBACK(_nmi) \
+ downcast<abcbus_slot_device *>(device)->set_nmi_callback(DEVCB_##_nmi);
+
+#define MCFG_ABCBUS_SLOT_RDY_CALLBACK(_rdy) \
+ downcast<abcbus_slot_device *>(device)->set_rdy_callback(DEVCB_##_rdy);
+
+#define MCFG_ABCBUS_SLOT_RESIN_CALLBACK(_resin) \
+ downcast<abcbus_slot_device *>(device)->set_resin_callback(DEVCB_##_resin);
+
+#define MCFG_ABCBUS_SLOT_PREN_CALLBACK(_pren) \
+ downcast<abcbus_slot_device *>(device)->set_pren_callback(DEVCB_##_pren);
+
+#define MCFG_ABCBUS_SLOT_TRRQ_CALLBACK(_trrq) \
+ downcast<abcbus_slot_device *>(device)->set_trrq_callback(DEVCB_##_trrq);
+
+#define MCFG_ABCBUS_SLOT_XINT2_CALLBACK(_xint2) \
+ downcast<abcbus_slot_device *>(device)->set_xint2_callback(DEVCB_##_xint2);
+
+#define MCFG_ABCBUS_SLOT_XINT3_CALLBACK(_xint3) \
+ downcast<abcbus_slot_device *>(device)->set_xint3_callback(DEVCB_##_xint3);
+
+#define MCFG_ABCBUS_SLOT_XINT4_CALLBACK(_xint4) \
+ downcast<abcbus_slot_device *>(device)->set_xint4_callback(DEVCB_##_xint4);
+
+#define MCFG_ABCBUS_SLOT_XINT5_CALLBACK(_xint5) \
+ downcast<abcbus_slot_device *>(device)->set_xint5_callback(DEVCB_##_xint5);
+
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -166,26 +207,17 @@ class abcbus_slot_device : public device_t,
public:
// construction/destruction
abcbus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template <typename T>
- abcbus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&opts, const char *dflt)
- : abcbus_slot_device(mconfig, tag, owner, clock)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- auto irq_callback() { return m_write_irq.bind(); }
- auto nmi_callback() { return m_write_nmi.bind(); }
- auto rdy_callback() { return m_write_rdy.bind(); }
- auto resin_callback() { return m_write_resin.bind(); }
- auto pren_callback() { return m_write_pren.bind(); }
- auto trrq_callback() { return m_write_trrq.bind(); }
- auto xint2_callback() { return m_write_xint2.bind(); }
- auto xint3_callback() { return m_write_xint3.bind(); }
- auto xint4_callback() { return m_write_xint4.bind(); }
- auto xint5_callback() { return m_write_xint5.bind(); }
+
+ template <class Object> devcb_base &set_irq_callback(Object &&cb) { return m_write_irq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_nmi_callback(Object &&cb) { return m_write_nmi.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_rdy_callback(Object &&cb) { return m_write_rdy.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_resin_callback(Object &&cb) { return m_write_resin.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_pren_callback(Object &&cb) { return m_write_pren.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_trrq_callback(Object &&cb) { return m_write_trrq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_xint2_callback(Object &&cb) { return m_write_xint2.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_xint3_callback(Object &&cb) { return m_write_xint3.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_xint4_callback(Object &&cb) { return m_write_xint4.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_xint5_callback(Object &&cb) { return m_write_xint5.set_callback(std::forward<Object>(cb)); }
// computer interface
void write_cs(uint8_t data) { if (m_card) m_card->abcbus_cs(data); }
diff --git a/src/devices/bus/abcbus/cadmouse.cpp b/src/devices/bus/abcbus/cadmouse.cpp
index 7a4d90916f9..9cee7326cf4 100644
--- a/src/devices/bus/abcbus/cadmouse.cpp
+++ b/src/devices/bus/abcbus/cadmouse.cpp
@@ -125,12 +125,11 @@ void abc_cadmouse_device::abc_cadmouse_io(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void abc_cadmouse_device::device_add_mconfig(machine_config &config)
-{
- Z80(config, m_maincpu, XTAL(8'000'000)/2);
- m_maincpu->set_addrmap(AS_PROGRAM, &abc_cadmouse_device::abc_cadmouse_mem);
- m_maincpu->set_addrmap(AS_IO, &abc_cadmouse_device::abc_cadmouse_io);
-}
+MACHINE_CONFIG_START(abc_cadmouse_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(Z80_TAG, Z80, XTAL(8'000'000)/2)
+ MCFG_DEVICE_PROGRAM_MAP(abc_cadmouse_mem)
+ MCFG_DEVICE_IO_MAP(abc_cadmouse_io)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/bus/abcbus/db411223.cpp b/src/devices/bus/abcbus/db411223.cpp
index 86ba1f22ee9..d9d2906f6d6 100644
--- a/src/devices/bus/abcbus/db411223.cpp
+++ b/src/devices/bus/abcbus/db411223.cpp
@@ -68,12 +68,11 @@ void databoard_4112_23_t::databoard_4112_23_io(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void databoard_4112_23_t::device_add_mconfig(machine_config &config)
-{
- Z80(config, m_maincpu, 4000000);
- m_maincpu->set_addrmap(AS_PROGRAM, &databoard_4112_23_t::databoard_4112_23_mem);
- m_maincpu->set_addrmap(AS_IO, &databoard_4112_23_t::databoard_4112_23_io);
-}
+MACHINE_CONFIG_START(databoard_4112_23_t::device_add_mconfig)
+ MCFG_DEVICE_ADD(Z80_TAG, Z80, 4000000)
+ MCFG_DEVICE_PROGRAM_MAP(databoard_4112_23_mem)
+ MCFG_DEVICE_IO_MAP(databoard_4112_23_io)
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/abcbus/unidisk.cpp b/src/devices/bus/abcbus/unidisk.cpp
index 0b068000193..0d5968aa71b 100644
--- a/src/devices/bus/abcbus/unidisk.cpp
+++ b/src/devices/bus/abcbus/unidisk.cpp
@@ -73,12 +73,11 @@ void unidisk_t::unidisk_io(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void unidisk_t::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(unidisk_t::device_add_mconfig)
TMS9995(config, m_maincpu, 12000000);
m_maincpu->set_addrmap(AS_PROGRAM, &unidisk_t::unidisk_mem);
m_maincpu->set_addrmap(AS_IO, &unidisk_t::unidisk_io);
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/abckb/abc77.cpp b/src/devices/bus/abckb/abc77.cpp
index 996a5af23c9..87acedf4fb8 100644
--- a/src/devices/bus/abckb/abc77.cpp
+++ b/src/devices/bus/abckb/abc77.cpp
@@ -129,8 +129,7 @@ DISCRETE_SOUND_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void abc77_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(abc77_device::device_add_mconfig)
// keyboard cpu
I8035(config, m_maincpu, XTAL(4'608'000));
m_maincpu->set_addrmap(AS_PROGRAM, &abc77_device::abc77_map);
@@ -145,8 +144,9 @@ void abc77_device::device_add_mconfig(machine_config &config)
// discrete sound
SPEAKER(config, "mono").front_center();
- DISCRETE(config, m_discrete, abc77_discrete).add_route(ALL_OUTPUTS, "mono", 0.80);
-}
+ MCFG_DEVICE_ADD(DISCRETE_TAG, DISCRETE, abc77_discrete)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/abckb/abc99.cpp b/src/devices/bus/abckb/abc99.cpp
index 4b49e73548e..6782fbd8a59 100644
--- a/src/devices/bus/abckb/abc99.cpp
+++ b/src/devices/bus/abckb/abc99.cpp
@@ -169,7 +169,7 @@ void abc99_device::device_add_mconfig(machine_config &config)
m_mousecpu->set_addrmap(AS_PROGRAM, &abc99_device::abc99_z5_mem);
//m_mousecpu->p1_in_cb().set(FUNC(abc99_device::z5_p1_r));
//m_mousecpu->p2_out_cb().set(FUNC(abc99_device::z5_p2_w));
- //m_mousecpu->set_t0_clk_cb(); // Z2 CLK
+ //MCFG_MCS48_PORT_T0_CLK_CUSTOM() // Z2 CLK
//m_mousecpu->t1_in_cb().set(FUNC(abc99_device::z5_t1_r));
m_mousecpu->set_disable(); // HACK fix for broken serial I/O
diff --git a/src/devices/bus/abckb/abckb.h b/src/devices/bus/abckb/abckb.h
index d7ab8b6162a..7ec223fc942 100644
--- a/src/devices/bus/abckb/abckb.h
+++ b/src/devices/bus/abckb/abckb.h
@@ -12,6 +12,27 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_ABC_KEYBOARD_PORT_ADD(_tag, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, ABC_KEYBOARD_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(abc_keyboard_devices, _def_slot, false)
+
+#define MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(_devcb) \
+ downcast<abc_keyboard_port_device &>(*device).set_out_rx_handler(DEVCB_##_devcb);
+
+#define MCFG_ABC_KEYBOARD_OUT_TRXC_HANDLER(_devcb) \
+ downcast<abc_keyboard_port_device &>(*device).set_out_trxc_handler(DEVCB_##_devcb);
+
+#define MCFG_ABC_KEYBOARD_OUT_KEYDOWN_HANDLER(_devcb) \
+ downcast<abc_keyboard_port_device &>(*device).set_out_keydown_handler(DEVCB_##_devcb);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -22,21 +43,11 @@ class abc_keyboard_port_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- template <typename T>
- abc_keyboard_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : abc_keyboard_port_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- abc_keyboard_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
-
- auto out_rx_handler() { return m_out_rx_handler.bind(); }
- auto out_trxc_handler() { return m_out_trxc_handler.bind(); }
- auto out_keydown_handler() { return m_out_keydown_handler.bind(); }
+ abc_keyboard_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ template <class Object> devcb_base &set_out_rx_handler(Object &&cb) { return m_out_rx_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_trxc_handler(Object &&cb) { return m_out_trxc_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_keydown_handler(Object &&cb) { return m_out_keydown_handler.set_callback(std::forward<Object>(cb)); }
// computer interface
DECLARE_WRITE_LINE_MEMBER( txd_w );
diff --git a/src/devices/bus/acorn/atom/discpack.cpp b/src/devices/bus/acorn/atom/discpack.cpp
index fd33ec293a6..63a29d403f1 100644
--- a/src/devices/bus/acorn/atom/discpack.cpp
+++ b/src/devices/bus/acorn/atom/discpack.cpp
@@ -84,7 +84,7 @@ void atom_discpack_device::device_start()
address_space &space = m_bus->memspace();
space.install_device(0x0a00, 0x0a03, *m_fdc, &i8271_device::map);
- space.install_readwrite_handler(0x0a04, 0x0a04, 0, 0x1f8, 0, read8smo_delegate(FUNC(i8271_device::data_r), m_fdc.target()), write8smo_delegate(FUNC(i8271_device::data_w), m_fdc.target()));
+ space.install_readwrite_handler(0x0a04, 0x0a04, 0, 0x1f8, 0, read8_delegate(FUNC(i8271_device::data_r), m_fdc.target()), write8_delegate(FUNC(i8271_device::data_w), m_fdc.target()));
space.install_ram(0x2000, 0x23ff);
space.install_ram(0x2400, 0x27ff);
space.install_ram(0x3c00, 0x3fff);
diff --git a/src/devices/bus/acorn/atom/econet.cpp b/src/devices/bus/acorn/atom/econet.cpp
index 5051fd0e8e7..210ca895445 100644
--- a/src/devices/bus/acorn/atom/econet.cpp
+++ b/src/devices/bus/acorn/atom/econet.cpp
@@ -63,7 +63,7 @@ void atom_econet_device::device_start()
{
address_space &space = m_bus->memspace();
- space.install_readwrite_handler(0xb400, 0xb403, read8sm_delegate(FUNC(mc6854_device::read), m_adlc.target()), write8sm_delegate(FUNC(mc6854_device::write), m_adlc.target()));
+ space.install_readwrite_handler(0xb400, 0xb403, read8_delegate(FUNC(mc6854_device::read), m_adlc.target()), write8_delegate(FUNC(mc6854_device::write), m_adlc.target()));
space.install_read_handler(0xb404, 0xb404, read8_delegate(FUNC(atom_econet_device::statid_r), this));
}
diff --git a/src/devices/bus/acorn/atom/sid.cpp b/src/devices/bus/acorn/atom/sid.cpp
index 8b5cd738cfe..950f4de2c58 100644
--- a/src/devices/bus/acorn/atom/sid.cpp
+++ b/src/devices/bus/acorn/atom/sid.cpp
@@ -55,5 +55,5 @@ void atom_sid_device::device_start()
{
address_space &space = m_bus->memspace();
- space.install_readwrite_handler(0xbdc0, 0xbddf, read8sm_delegate(FUNC(mos6581_device::read), m_sid.target()), write8sm_delegate(FUNC(mos6581_device::write), m_sid.target()));
+ space.install_readwrite_handler(0xbdc0, 0xbddf, read8_delegate(FUNC(mos6581_device::read), m_sid.target()), write8_delegate(FUNC(mos6581_device::write), m_sid.target()));
}
diff --git a/src/devices/bus/acorn/bus.cpp b/src/devices/bus/acorn/bus.cpp
index 2ecb509c30f..ed759be82af 100644
--- a/src/devices/bus/acorn/bus.cpp
+++ b/src/devices/bus/acorn/bus.cpp
@@ -80,7 +80,7 @@ DEFINE_DEVICE_TYPE(ACORN_BUS, acorn_bus_device, "acorn_bus", "Acorn Bus")
acorn_bus_device::acorn_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, ACORN_BUS, tag, owner, clock)
- , m_space(*this, finder_base::DUMMY_TAG, -1)
+ , m_maincpu(*this, finder_base::DUMMY_TAG)
, m_out_irq_cb(*this)
, m_out_nmi_cb(*this)
{
diff --git a/src/devices/bus/acorn/bus.h b/src/devices/bus/acorn/bus.h
index 149da10d447..9ebcafdad73 100644
--- a/src/devices/bus/acorn/bus.h
+++ b/src/devices/bus/acorn/bus.h
@@ -64,11 +64,11 @@ public:
acorn_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration
- template <typename T> void set_space(T &&tag, int spacenum) { m_space.set_tag(std::forward<T>(tag), spacenum); }
+ template <typename T> void set_cputag(T &&tag) { m_maincpu.set_tag(std::forward<T>(tag)); }
auto out_irq_callback() { return m_out_irq_cb.bind(); }
auto out_nmi_callback() { return m_out_nmi_cb.bind(); }
- address_space &memspace() const { return *m_space; }
+ address_space &memspace() const { return m_maincpu->space(AS_PROGRAM); }
DECLARE_WRITE_LINE_MEMBER(irq_w);
DECLARE_WRITE_LINE_MEMBER(nmi_w);
@@ -81,7 +81,7 @@ protected:
virtual void device_reset() override;
// internal state
- required_address_space m_space;
+ required_device<cpu_device> m_maincpu;
devcb_write_line m_out_irq_cb;
devcb_write_line m_out_nmi_cb;
diff --git a/src/devices/bus/acorn/cms/4080term.cpp b/src/devices/bus/acorn/cms/4080term.cpp
index 7bb64493481..0bf9cf5a7ea 100644
--- a/src/devices/bus/acorn/cms/4080term.cpp
+++ b/src/devices/bus/acorn/cms/4080term.cpp
@@ -68,23 +68,22 @@ DEVICE_INPUT_DEFAULTS_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void cms_4080term_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(cms_4080term_device::device_add_mconfig)
/* video hardware */
- SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
+ device = &SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(50);
m_screen->set_size(768, 312);
m_screen->set_visarea(0, 492 - 1, 0, 270 - 1);
- m_screen->set_screen_update("ef9345", FUNC(ef9345_device::screen_update));
+ MCFG_SCREEN_UPDATE_DEVICE("ef9345", ef9345_device, screen_update)
- GFXDECODE(config, "gfxdecode", "palette", gfx_cms_4080term);
- PALETTE(config, "palette").set_entries(8);
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cms_4080term)
+ MCFG_PALETTE_ADD("palette", 8)
EF9345(config, m_ef9345, 0);
m_ef9345->set_screen("screen");
m_ef9345->set_palette_tag("palette");
- TIMER(config, "scantimer").configure_scanline(FUNC(cms_4080term_device::update_scanline), "screen", 0, 10);
+ MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", cms_4080term_device, update_scanline, "screen", 0, 10)
VIA6522(config, m_via, 1_MHz_XTAL);
m_via->writepa_handler().set("cent_data_out", FUNC(output_latch_device::bus_w));
@@ -108,9 +107,8 @@ void cms_4080term_device::device_add_mconfig(machine_config &config)
/* printer */
CENTRONICS(config, m_centronics, centronics_devices, "printer");
m_centronics->ack_handler().set(m_via, FUNC(via6522_device::write_ca1));
- output_latch_device &cent_data_out(OUTPUT_LATCH(config, "cent_data_out"));
- m_centronics->set_output_latch(cent_data_out);
-}
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
+MACHINE_CONFIG_END
const tiny_rom_entry *cms_4080term_device::device_rom_region() const
@@ -147,9 +145,9 @@ void cms_4080term_device::device_start()
{
address_space &space = m_bus->memspace();
- space.install_readwrite_handler(0xfd20, 0xfd2f, read8sm_delegate(FUNC(ef9345_device::data_r), m_ef9345.target()), write8sm_delegate(FUNC(ef9345_device::data_w), m_ef9345.target()));
+ space.install_readwrite_handler(0xfd20, 0xfd2f, read8_delegate(FUNC(ef9345_device::data_r), m_ef9345.target()), write8_delegate(FUNC(ef9345_device::data_w), m_ef9345.target()));
space.install_readwrite_handler(0xfd30, 0xfd3f, read8sm_delegate(FUNC(via6522_device::read), m_via.target()), write8sm_delegate(FUNC(via6522_device::write), m_via.target()));
- space.install_readwrite_handler(0xfd40, 0xfd4f, read8sm_delegate(FUNC(mos6551_device::read), m_acia.target()), write8sm_delegate(FUNC(mos6551_device::write), m_acia.target()));
+ space.install_readwrite_handler(0xfd40, 0xfd4f, read8_delegate(FUNC(mos6551_device::read), m_acia.target()), write8_delegate(FUNC(mos6551_device::write), m_acia.target()));
uint8_t *FNT = memregion("ef9345")->base();
uint16_t dest = 0x2000;
diff --git a/src/devices/bus/acorn/cms/hires.cpp b/src/devices/bus/acorn/cms/hires.cpp
index 9e6e169737b..d15032bd30c 100644
--- a/src/devices/bus/acorn/cms/hires.cpp
+++ b/src/devices/bus/acorn/cms/hires.cpp
@@ -25,24 +25,23 @@ DEFINE_DEVICE_TYPE(CMS_HIRES, cms_hires_device, "cms_hires", "CMS High Resolutio
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void cms_hires_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(cms_hires_device::device_add_mconfig)
/* video hardware */
- SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
+ device = &SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_size(512, 312);
m_screen->set_visarea(0, 512 - 1, 0, 256 - 1);
m_screen->set_refresh_hz(50);
- m_screen->set_screen_update("ef9366", FUNC(ef9365_device::screen_update));
- PALETTE(config, "palette").set_entries(16);
+ MCFG_SCREEN_UPDATE_DEVICE("ef9366", ef9365_device, screen_update)
+ MCFG_PALETTE_ADD("palette", 16)
- TIMER(config, "flash_rate").configure_periodic(FUNC(cms_hires_device::flash_rate), attotime::from_hz(3)); // from 555 timer (4.7uF, 100K, 470R)
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("flash_rate", cms_hires_device, flash_rate, attotime::from_hz(3)) // from 555 timer (4.7uF, 100K, 470R)
EF9365(config, m_gdp, 14_MHz_XTAL / 8);
m_gdp->set_screen("screen");
m_gdp->set_palette_tag("palette");
m_gdp->set_nb_bitplanes(4);
m_gdp->set_display_mode(ef9365_device::DISPLAY_MODE_512x256);
-}
+MACHINE_CONFIG_END
//**************************************************************************
@@ -71,7 +70,7 @@ void cms_hires_device::device_start()
{
address_space &space = m_bus->memspace();
- space.install_readwrite_handler(0xfc10, 0xfc1f, read8sm_delegate(FUNC(ef9365_device::data_r), m_gdp.target()), write8sm_delegate(FUNC(ef9365_device::data_w), m_gdp.target()));
+ space.install_readwrite_handler(0xfc10, 0xfc1f, read8_delegate(FUNC(ef9365_device::data_r), m_gdp.target()), write8_delegate(FUNC(ef9365_device::data_w), m_gdp.target()));
space.install_write_handler(0xfc20, 0xfc2f, write8_delegate(FUNC(cms_hires_device::colour_reg_w), this));
save_item(NAME(m_flash_state));
diff --git a/src/devices/bus/acorn/system/cass.cpp b/src/devices/bus/acorn/system/cass.cpp
index 6e5b8faf40c..092a72f40a3 100644
--- a/src/devices/bus/acorn/system/cass.cpp
+++ b/src/devices/bus/acorn/system/cass.cpp
@@ -24,16 +24,15 @@ DEFINE_DEVICE_TYPE(ACORN_CASS, acorn_cass_device, "acorn_cass", "Acorn Cassette
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void acorn_cass_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(acorn_cass_device::device_add_mconfig)
/* sound hardware */
SPEAKER(config, "mono").front_center();
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25);
CASSETTE(config, "cassette", 0);
- TIMER(config, "cass_c").configure_periodic(FUNC(acorn_cass_device::cass_c), attotime::from_hz(4800));
- TIMER(config, "cass_p").configure_periodic(FUNC(acorn_cass_device::cass_p), attotime::from_hz(40000));
-}
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("cass_c", acorn_cass_device, cass_c, attotime::from_hz(4800))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("cass_p", acorn_cass_device, cass_p, attotime::from_hz(40000))
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/acorn/system/econet.cpp b/src/devices/bus/acorn/system/econet.cpp
index f8e2c6f0ce4..d6613f35bf7 100644
--- a/src/devices/bus/acorn/system/econet.cpp
+++ b/src/devices/bus/acorn/system/econet.cpp
@@ -72,7 +72,7 @@ void acorn_econet_device::device_reset()
{
address_space &space = m_bus->memspace();
- space.install_readwrite_handler(0x1940, 0x1943, read8sm_delegate(FUNC(mc6854_device::read), m_adlc.target()), write8sm_delegate(FUNC(mc6854_device::write), m_adlc.target()));
+ space.install_readwrite_handler(0x1940, 0x1943, read8_delegate(FUNC(mc6854_device::read), m_adlc.target()), write8_delegate(FUNC(mc6854_device::write), m_adlc.target()));
space.install_read_handler(0x1944, 0x1944, read8_delegate(FUNC(acorn_econet_device::statid_r), this));
}
diff --git a/src/devices/bus/acorn/system/fdc.cpp b/src/devices/bus/acorn/system/fdc.cpp
index 179b914d3cf..398736eab9e 100644
--- a/src/devices/bus/acorn/system/fdc.cpp
+++ b/src/devices/bus/acorn/system/fdc.cpp
@@ -85,7 +85,7 @@ void acorn_fdc_device::device_reset()
address_space &space = m_bus->memspace();
space.install_device(0x0a00, 0x0a03, *m_fdc, &i8271_device::map);
- space.install_readwrite_handler(0x0a04, 0x0a04, 0, 0x1f8, 0, read8smo_delegate(FUNC(i8271_device::data_r), m_fdc.target()), write8smo_delegate(FUNC(i8271_device::data_w), m_fdc.target()));
+ space.install_readwrite_handler(0x0a04, 0x0a04, 0, 0x1f8, 0, read8_delegate(FUNC(i8271_device::data_r), m_fdc.target()), write8_delegate(FUNC(i8271_device::data_w), m_fdc.target()));
}
diff --git a/src/devices/bus/acorn/system/vdu40.cpp b/src/devices/bus/acorn/system/vdu40.cpp
index 4f97b778a5b..93d54819fa5 100644
--- a/src/devices/bus/acorn/system/vdu40.cpp
+++ b/src/devices/bus/acorn/system/vdu40.cpp
@@ -25,13 +25,12 @@ DEFINE_DEVICE_TYPE(ACORN_VDU40, acorn_vdu40_device, "acorn_vdu40", "Acorn 40 Col
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void acorn_vdu40_device::device_add_mconfig(machine_config &config)
-{
- SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
+MACHINE_CONFIG_START(acorn_vdu40_device::device_add_mconfig)
+ device = &SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(12_MHz_XTAL, 768, 132, 612, 311, 20, 270);
- m_screen->set_screen_update("mc6845", FUNC(mc6845_device::screen_update));
+ MCFG_SCREEN_UPDATE_DEVICE("mc6845", mc6845_device, screen_update)
- PALETTE(config, "palette").set_entries(8);
+ MCFG_PALETTE_ADD("palette", 8)
HD6845(config, m_crtc, 12_MHz_XTAL / 6);
m_crtc->set_screen("screen");
@@ -42,7 +41,7 @@ void acorn_vdu40_device::device_add_mconfig(machine_config &config)
SAA5050(config, m_trom, 12_MHz_XTAL / 2);
m_trom->set_screen_size(40, 25, 40);
-}
+MACHINE_CONFIG_END
//**************************************************************************
@@ -82,8 +81,8 @@ void acorn_vdu40_device::device_reset()
address_space &space = m_bus->memspace();
space.install_ram(0x0400, 0x07ff, m_videoram.get());
- space.install_readwrite_handler(0x0800, 0x0800, read8smo_delegate(FUNC(mc6845_device::status_r), m_crtc.target()), write8smo_delegate(FUNC(mc6845_device::address_w), m_crtc.target()));
- space.install_readwrite_handler(0x0801, 0x0801, read8smo_delegate(FUNC(mc6845_device::register_r), m_crtc.target()), write8smo_delegate(FUNC(mc6845_device::register_w), m_crtc.target()));
+ space.install_readwrite_handler(0x0800, 0x0800, read8_delegate(FUNC(mc6845_device::status_r), m_crtc.target()), write8_delegate(FUNC(mc6845_device::address_w), m_crtc.target()));
+ space.install_readwrite_handler(0x0801, 0x0801, read8_delegate(FUNC(mc6845_device::register_r), m_crtc.target()), write8_delegate(FUNC(mc6845_device::register_w), m_crtc.target()));
}
diff --git a/src/devices/bus/acorn/system/vdu80.cpp b/src/devices/bus/acorn/system/vdu80.cpp
index ef6cd463baa..65e22414e94 100644
--- a/src/devices/bus/acorn/system/vdu80.cpp
+++ b/src/devices/bus/acorn/system/vdu80.cpp
@@ -87,14 +87,13 @@ GFXDECODE_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void acorn_vdu80_device::device_add_mconfig(machine_config &config)
-{
- SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
+MACHINE_CONFIG_START(acorn_vdu80_device::device_add_mconfig)
+ device = &SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_color(rgb_t::white());
m_screen->set_raw(12_MHz_XTAL, 768, 132, 612, 312, 20, 270);
- m_screen->set_screen_update("mc6845", FUNC(mc6845_device::screen_update));
+ MCFG_SCREEN_UPDATE_DEVICE("mc6845", mc6845_device, screen_update)
- GFXDECODE(config, "gfxdecode", m_palette, gfx_acorn_vdu80);
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_acorn_vdu80)
PALETTE(config, m_palette, palette_device::MONOCHROME);
H46505(config, m_crtc, 2_MHz_XTAL);
@@ -102,7 +101,7 @@ void acorn_vdu80_device::device_add_mconfig(machine_config &config)
m_crtc->set_show_border_area(false);
m_crtc->set_char_width(6);
m_crtc->set_update_row_callback(FUNC(acorn_vdu80_device::crtc_update_row), this);
-}
+MACHINE_CONFIG_END
const tiny_rom_entry *acorn_vdu80_device::device_rom_region() const
@@ -152,15 +151,15 @@ void acorn_vdu80_device::device_reset()
{
space.install_ram(0xf000, 0x0f7ff, m_videoram.get());
- space.install_readwrite_handler(0xe840, 0xe840, 0, 0x3f, 0, read8smo_delegate(FUNC(mc6845_device::status_r), m_crtc.target()), write8smo_delegate(FUNC(mc6845_device::address_w), m_crtc.target()));
- space.install_readwrite_handler(0xe841, 0xe841, 0, 0x3e, 0, read8smo_delegate(FUNC(mc6845_device::register_r), m_crtc.target()), write8smo_delegate(FUNC(mc6845_device::register_w), m_crtc.target()));
+ space.install_readwrite_handler(0xe840, 0xe840, 0, 0x3f, 0, read8_delegate(FUNC(mc6845_device::status_r), m_crtc.target()), write8_delegate(FUNC(mc6845_device::address_w), m_crtc.target()));
+ space.install_readwrite_handler(0xe841, 0xe841, 0, 0x3e, 0, read8_delegate(FUNC(mc6845_device::register_r), m_crtc.target()), write8_delegate(FUNC(mc6845_device::register_w), m_crtc.target()));
}
else
{
space.install_ram(0x1000, 0x017ff, m_videoram.get());
- space.install_readwrite_handler(0x1840, 0x1840, 0, 0x3f, 0, read8smo_delegate(FUNC(mc6845_device::status_r), m_crtc.target()), write8smo_delegate(FUNC(mc6845_device::address_w), m_crtc.target()));
- space.install_readwrite_handler(0x1841, 0x1841, 0, 0x3e, 0, read8smo_delegate(FUNC(mc6845_device::register_r), m_crtc.target()), write8smo_delegate(FUNC(mc6845_device::register_w), m_crtc.target()));
+ space.install_readwrite_handler(0x1840, 0x1840, 0, 0x3f, 0, read8_delegate(FUNC(mc6845_device::status_r), m_crtc.target()), write8_delegate(FUNC(mc6845_device::address_w), m_crtc.target()));
+ space.install_readwrite_handler(0x1841, 0x1841, 0, 0x3e, 0, read8_delegate(FUNC(mc6845_device::register_r), m_crtc.target()), write8_delegate(FUNC(mc6845_device::register_w), m_crtc.target()));
}
}
diff --git a/src/devices/bus/acorn/system/vib.cpp b/src/devices/bus/acorn/system/vib.cpp
index e392225f1e0..69a5d2189a4 100644
--- a/src/devices/bus/acorn/system/vib.cpp
+++ b/src/devices/bus/acorn/system/vib.cpp
@@ -26,8 +26,7 @@ DEFINE_DEVICE_TYPE(ACORN_VIB, acorn_vib_device, "acorn_vib", "Acorn Versatile In
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void acorn_vib_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(acorn_vib_device::device_add_mconfig)
INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set(FUNC(acorn_vib_device::irq_w));
VIA6522(config, m_via6522, XTAL(1'000'000));
@@ -38,8 +37,7 @@ void acorn_vib_device::device_add_mconfig(machine_config &config)
CENTRONICS(config, m_centronics, centronics_devices, "printer");
m_centronics->ack_handler().set(m_via6522, FUNC(via6522_device::write_ca1));
m_centronics->busy_handler().set(m_via6522, FUNC(via6522_device::write_pa7));
- output_latch_device &cent_data_out(OUTPUT_LATCH(config, "cent_data_out"));
- m_centronics->set_output_latch(cent_data_out);
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
I8255(config, m_ppi8255, 0);
@@ -55,7 +53,7 @@ void acorn_vib_device::device_add_mconfig(machine_config &config)
CLOCK(config, m_acia_clock, 1.8432_MHz_XTAL);
m_acia_clock->signal_handler().set(FUNC(acorn_vib_device::write_acia_clock));
-}
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
@@ -96,7 +94,7 @@ void acorn_vib_device::device_reset()
address_space &space = m_bus->memspace();
space.install_readwrite_handler(0x0c00, 0x0c0f, 0, 0x10, 0, read8sm_delegate(FUNC(via6522_device::read), m_via6522.target()), write8sm_delegate(FUNC(via6522_device::write), m_via6522.target()));
- space.install_readwrite_handler(0x0c20, 0x0c21, 0, 0x1e, 0, read8sm_delegate(FUNC(acia6850_device::read), m_acia.target()), write8sm_delegate(FUNC(acia6850_device::write), m_acia.target()));
+ space.install_readwrite_handler(0x0c20, 0x0c21, 0, 0x1e, 0, read8_delegate(FUNC(acia6850_device::read), m_acia.target()), write8_delegate(FUNC(acia6850_device::write), m_acia.target()));
space.install_readwrite_handler(0x0c40, 0x0c43, 0, 0x1c, 0, read8sm_delegate(FUNC(i8255_device::read), m_ppi8255.target()), write8sm_delegate(FUNC(i8255_device::write), m_ppi8255.target()));
}
diff --git a/src/devices/bus/adam/adamlink.cpp b/src/devices/bus/adam/adamlink.cpp
index 4dc2d44b3d7..f4227273421 100644
--- a/src/devices/bus/adam/adamlink.cpp
+++ b/src/devices/bus/adam/adamlink.cpp
@@ -47,7 +47,7 @@ void adamlink_device::device_start()
// adam_bd_r - buffered data read
//-------------------------------------------------
-uint8_t adamlink_device::adam_bd_r(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
+uint8_t adamlink_device::adam_bd_r(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
{
if (!biorq)
{
@@ -69,7 +69,7 @@ uint8_t adamlink_device::adam_bd_r(offs_t offset, uint8_t data, int bmreq, int b
// adam_bd_w - buffered data write
//-------------------------------------------------
-void adamlink_device::adam_bd_w(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
+void adamlink_device::adam_bd_w(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
{
if (!biorq)
{
diff --git a/src/devices/bus/adam/adamlink.h b/src/devices/bus/adam/adamlink.h
index 6fb07f81c6f..42fd06490f9 100644
--- a/src/devices/bus/adam/adamlink.h
+++ b/src/devices/bus/adam/adamlink.h
@@ -33,8 +33,8 @@ protected:
virtual void device_start() override;
// device_adam_expansion_slot_card_interface overrides
- virtual uint8_t adam_bd_r(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override;
- virtual void adam_bd_w(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override;
+ virtual uint8_t adam_bd_r(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override;
+ virtual void adam_bd_w(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override;
};
diff --git a/src/devices/bus/adam/exp.cpp b/src/devices/bus/adam/exp.cpp
index 4555ed961eb..c9d529a68ab 100644
--- a/src/devices/bus/adam/exp.cpp
+++ b/src/devices/bus/adam/exp.cpp
@@ -123,11 +123,11 @@ std::string adam_expansion_slot_device::get_default_card_software(get_default_ca
// bd_r - buffered data read
//-------------------------------------------------
-uint8_t adam_expansion_slot_device::bd_r(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
+uint8_t adam_expansion_slot_device::bd_r(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
{
if (m_card != nullptr)
{
- data = m_card->adam_bd_r(offset, data, bmreq, biorq, aux_rom_cs, cas1, cas2);
+ data = m_card->adam_bd_r(space, offset, data, bmreq, biorq, aux_rom_cs, cas1, cas2);
}
return data;
@@ -138,11 +138,11 @@ uint8_t adam_expansion_slot_device::bd_r(offs_t offset, uint8_t data, int bmreq,
// cd_w - cartridge data write
//-------------------------------------------------
-void adam_expansion_slot_device::bd_w(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
+void adam_expansion_slot_device::bd_w(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
{
if (m_card != nullptr)
{
- m_card->adam_bd_w(offset, data, bmreq, biorq, aux_rom_cs, cas1, cas2);
+ m_card->adam_bd_w(space, offset, data, bmreq, biorq, aux_rom_cs, cas1, cas2);
}
}
diff --git a/src/devices/bus/adam/exp.h b/src/devices/bus/adam/exp.h
index 618bc3d365a..063d28b4271 100644
--- a/src/devices/bus/adam/exp.h
+++ b/src/devices/bus/adam/exp.h
@@ -51,8 +51,8 @@ public:
auto irq() { return m_write_irq.bind(); }
// computer interface
- uint8_t bd_r(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2);
- void bd_w(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2);
+ uint8_t bd_r(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2);
+ void bd_w(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2);
// cartridge interface
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_write_irq(state); }
@@ -96,8 +96,8 @@ protected:
device_adam_expansion_slot_card_interface(const machine_config &mconfig, device_t &device);
// runtime
- virtual uint8_t adam_bd_r(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) { return data; }
- virtual void adam_bd_w(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) { }
+ virtual uint8_t adam_bd_r(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) { return data; }
+ virtual void adam_bd_w(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) { }
adam_expansion_slot_device *m_slot;
diff --git a/src/devices/bus/adam/ide.cpp b/src/devices/bus/adam/ide.cpp
index 98078003f4b..fe97b7be512 100644
--- a/src/devices/bus/adam/ide.cpp
+++ b/src/devices/bus/adam/ide.cpp
@@ -103,7 +103,7 @@ void powermate_ide_device::device_start()
// adam_bd_r - buffered data read
//-------------------------------------------------
-uint8_t powermate_ide_device::adam_bd_r(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
+uint8_t powermate_ide_device::adam_bd_r(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
{
if (!biorq)
{
@@ -164,7 +164,7 @@ uint8_t powermate_ide_device::adam_bd_r(offs_t offset, uint8_t data, int bmreq,
// adam_bd_w - buffered data write
//-------------------------------------------------
-void powermate_ide_device::adam_bd_w(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
+void powermate_ide_device::adam_bd_w(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
{
if (!biorq)
{
diff --git a/src/devices/bus/adam/ide.h b/src/devices/bus/adam/ide.h
index bfce0f9851f..992b66aee3d 100644
--- a/src/devices/bus/adam/ide.h
+++ b/src/devices/bus/adam/ide.h
@@ -39,8 +39,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_adam_expansion_slot_card_interface overrides
- virtual uint8_t adam_bd_r(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override;
- virtual void adam_bd_w(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override;
+ virtual uint8_t adam_bd_r(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override;
+ virtual void adam_bd_w(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override;
private:
required_device<ata_interface_device> m_ata;
diff --git a/src/devices/bus/adam/ram.cpp b/src/devices/bus/adam/ram.cpp
index a7e79719867..2a756000dc2 100644
--- a/src/devices/bus/adam/ram.cpp
+++ b/src/devices/bus/adam/ram.cpp
@@ -49,7 +49,7 @@ void adam_ram_expansion_device::device_start()
// adam_bd_r - buffered data read
//-------------------------------------------------
-uint8_t adam_ram_expansion_device::adam_bd_r(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
+uint8_t adam_ram_expansion_device::adam_bd_r(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
{
if (!cas2)
{
@@ -64,7 +64,7 @@ uint8_t adam_ram_expansion_device::adam_bd_r(offs_t offset, uint8_t data, int bm
// adam_bd_w - buffered data write
//-------------------------------------------------
-void adam_ram_expansion_device::adam_bd_w(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
+void adam_ram_expansion_device::adam_bd_w(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
{
if (!cas2)
{
diff --git a/src/devices/bus/adam/ram.h b/src/devices/bus/adam/ram.h
index 780d51be726..80ec417f3cc 100644
--- a/src/devices/bus/adam/ram.h
+++ b/src/devices/bus/adam/ram.h
@@ -33,8 +33,8 @@ protected:
virtual void device_start() override;
// device_adam_expansion_slot_card_interface overrides
- virtual uint8_t adam_bd_r(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override;
- virtual void adam_bd_w(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override;
+ virtual uint8_t adam_bd_r(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override;
+ virtual void adam_bd_w(address_space &space, offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override;
private:
optional_shared_ptr<uint8_t> m_ram;
diff --git a/src/devices/bus/adamnet/adamnet.h b/src/devices/bus/adamnet/adamnet.h
index 51fc46a38dd..c9090bf5482 100644
--- a/src/devices/bus/adamnet/adamnet.h
+++ b/src/devices/bus/adamnet/adamnet.h
@@ -21,6 +21,17 @@
#define ADAMNET_TAG "adamnet"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_ADAMNET_SLOT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, ADAMNET_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/devices/bus/adamnet/ddp.cpp b/src/devices/bus/adamnet/ddp.cpp
index ede3719c910..cf267e95a36 100644
--- a/src/devices/bus/adamnet/ddp.cpp
+++ b/src/devices/bus/adamnet/ddp.cpp
@@ -70,8 +70,7 @@ static const struct CassetteOptions adam_cassette_options =
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void adam_digital_data_pack_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(adam_digital_data_pack_device::device_add_mconfig)
M6801(config, m_maincpu, XTAL(4'000'000));
m_maincpu->set_addrmap(AS_PROGRAM, &adam_digital_data_pack_device::adam_ddp_mem);
m_maincpu->out_p1_cb().set(FUNC(adam_digital_data_pack_device::p1_w));
@@ -80,18 +79,18 @@ void adam_digital_data_pack_device::device_add_mconfig(machine_config &config)
// Port 3 = Multiplexed Address/Data
m_maincpu->in_p4_cb().set(FUNC(adam_digital_data_pack_device::p4_r));
- CASSETTE(config, m_ddp0);
- m_ddp0->set_formats(coleco_adam_cassette_formats);
- m_ddp0->set_create_opts(&adam_cassette_options);
- m_ddp0->set_default_state(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED);
- m_ddp0->set_interface("adam_cass");
-
- CASSETTE(config, m_ddp1);
- m_ddp1->set_formats(coleco_adam_cassette_formats);
- m_ddp1->set_create_opts(&adam_cassette_options);
- m_ddp1->set_default_state(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED);
- m_ddp1->set_interface("adam_cass");
-}
+ MCFG_CASSETTE_ADD("cassette")
+ MCFG_CASSETTE_FORMATS(coleco_adam_cassette_formats)
+ MCFG_CASSETTE_CREATE_OPTS(&adam_cassette_options)
+ MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED)
+ MCFG_CASSETTE_INTERFACE("adam_cass")
+
+ MCFG_CASSETTE_ADD("cassette2")
+ MCFG_CASSETTE_FORMATS(coleco_adam_cassette_formats)
+ MCFG_CASSETTE_CREATE_OPTS(&adam_cassette_options)
+ MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED)
+ MCFG_CASSETTE_INTERFACE("adam_cass")
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/adamnet/spi.cpp b/src/devices/bus/adamnet/spi.cpp
index 6ad84bbed7c..612bb11c547 100644
--- a/src/devices/bus/adamnet/spi.cpp
+++ b/src/devices/bus/adamnet/spi.cpp
@@ -64,8 +64,7 @@ void adam_spi_device::adam_spi_mem(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void adam_spi_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(adam_spi_device::device_add_mconfig)
M6801(config, m_maincpu, XTAL(4'000'000));
m_maincpu->set_addrmap(AS_PROGRAM, &adam_spi_device::adam_spi_mem);
m_maincpu->in_p2_cb().set(FUNC(adam_spi_device::p2_r));
@@ -79,9 +78,8 @@ void adam_spi_device::device_add_mconfig(machine_config &config)
centronics_device &centronics(CENTRONICS(config, "centronics", centronics_devices, "printer"));
centronics.set_data_input_buffer("cent_data_in");
INPUT_BUFFER(config, "cent_data_in");
- output_latch_device &cent_data_out(OUTPUT_LATCH(config, "cent_data_out"));
- centronics.set_output_latch(cent_data_out);
-}
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/amiga/zorro/a2052.cpp b/src/devices/bus/amiga/zorro/a2052.cpp
index 515c568c019..f2cef15b32e 100644
--- a/src/devices/bus/amiga/zorro/a2052.cpp
+++ b/src/devices/bus/amiga/zorro/a2052.cpp
@@ -81,10 +81,10 @@ void a2052_device::autoconfig_base_address(offs_t address)
logerror("-> installing a2052\n");
// stop responding to default autoconfig
- m_slot->space().unmap_readwrite(0xe80000, 0xe8007f);
+ m_slot->m_space->unmap_readwrite(0xe80000, 0xe8007f);
// install access to the rom space
- m_slot->space().install_ram(address, address + m_ram.size()*2 - 1, &m_ram[0]);
+ m_slot->m_space->install_ram(address, address + m_ram.size()*2 - 1, &m_ram[0]);
// we're done
m_slot->cfgout_w(0);
@@ -128,7 +128,7 @@ WRITE_LINE_MEMBER( a2052_device::cfgin_w )
autoconfig_can_shutup(true); // ?
// install autoconfig handler
- m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f,
+ m_slot->m_space->install_readwrite_handler(0xe80000, 0xe8007f,
read16_delegate(FUNC(amiga_autoconfig::autoconfig_read), static_cast<amiga_autoconfig *>(this)),
write16_delegate(FUNC(amiga_autoconfig::autoconfig_write), static_cast<amiga_autoconfig *>(this)), 0xffff);
}
diff --git a/src/devices/bus/amiga/zorro/a2058.cpp b/src/devices/bus/amiga/zorro/a2058.cpp
index e8d6e8c28fb..8fc58669d14 100644
--- a/src/devices/bus/amiga/zorro/a2058.cpp
+++ b/src/devices/bus/amiga/zorro/a2058.cpp
@@ -89,10 +89,10 @@ void a2058_device::autoconfig_base_address(offs_t address)
logerror("-> installing a2058\n");
// stop responding to default autoconfig
- m_slot->space().unmap_readwrite(0xe80000, 0xe8007f);
+ m_slot->m_space->unmap_readwrite(0xe80000, 0xe8007f);
// install access to the rom space
- m_slot->space().install_ram(address, address + (m_ram_size << 20) - 1, m_ram.get());
+ m_slot->m_space->install_ram(address, address + (m_ram_size << 20) - 1, m_ram.get());
// we're done
m_slot->cfgout_w(0);
@@ -140,7 +140,7 @@ WRITE_LINE_MEMBER( a2058_device::cfgin_w )
autoconfig_can_shutup(true); // ?
// install autoconfig handler
- m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f,
+ m_slot->m_space->install_readwrite_handler(0xe80000, 0xe8007f,
read16_delegate(FUNC(amiga_autoconfig::autoconfig_read), static_cast<amiga_autoconfig *>(this)),
write16_delegate(FUNC(amiga_autoconfig::autoconfig_write), static_cast<amiga_autoconfig *>(this)), 0xffff);
}
diff --git a/src/devices/bus/amiga/zorro/a2065.cpp b/src/devices/bus/amiga/zorro/a2065.cpp
index b1b747594cc..9eb0d835db2 100644
--- a/src/devices/bus/amiga/zorro/a2065.cpp
+++ b/src/devices/bus/amiga/zorro/a2065.cpp
@@ -81,20 +81,20 @@ void a2065_device::autoconfig_base_address(offs_t address)
LOG("-> installing a2065\n");
// stop responding to default autoconfig
- m_slot->space().unmap_readwrite(0xe80000, 0xe8007f);
+ m_slot->m_space->unmap_readwrite(0xe80000, 0xe8007f);
// install autoconfig handler to new location
- m_slot->space().install_readwrite_handler(address, address + 0x7f,
+ m_slot->m_space->install_readwrite_handler(address, address + 0x7f,
read16_delegate(FUNC(amiga_autoconfig::autoconfig_read), static_cast<amiga_autoconfig *>(this)),
write16_delegate(FUNC(amiga_autoconfig::autoconfig_write), static_cast<amiga_autoconfig *>(this)), 0xffff);
// install access to lance registers
- m_slot->space().install_readwrite_handler(address + 0x4000, address + 0x4003,
+ m_slot->m_space->install_readwrite_handler(address + 0x4000, address + 0x4003,
read16_delegate(FUNC(am7990_device::regs_r), &(*m_lance)),
write16_delegate(FUNC(am7990_device::regs_w), &(*m_lance)), 0xffff);
// install access to onboard ram (32k)
- m_slot->space().install_readwrite_handler(address + 0x8000, address + 0x8000 + 0x7fff,
+ m_slot->m_space->install_readwrite_handler(address + 0x8000, address + 0x8000 + 0x7fff,
read16_delegate(FUNC(a2065_device::host_ram_r), this),
write16_delegate(FUNC(a2065_device::host_ram_w), this), 0xffff);
@@ -123,7 +123,7 @@ WRITE_LINE_MEMBER( a2065_device::cfgin_w )
autoconfig_can_shutup(true); // ?
// install autoconfig handler
- m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f,
+ m_slot->m_space->install_readwrite_handler(0xe80000, 0xe8007f,
read16_delegate(FUNC(amiga_autoconfig::autoconfig_read), static_cast<amiga_autoconfig *>(this)),
write16_delegate(FUNC(amiga_autoconfig::autoconfig_write), static_cast<amiga_autoconfig *>(this)), 0xffff);
}
diff --git a/src/devices/bus/amiga/zorro/a2232.cpp b/src/devices/bus/amiga/zorro/a2232.cpp
index 24020d7a25d..41334067412 100644
--- a/src/devices/bus/amiga/zorro/a2232.cpp
+++ b/src/devices/bus/amiga/zorro/a2232.cpp
@@ -188,25 +188,25 @@ void a2232_device::autoconfig_base_address(offs_t address)
logerror("-> installing a2232\n");
// stop responding to default autoconfig
- m_slot->space().unmap_readwrite(0xe80000, 0xe8007f);
+ m_slot->m_space->unmap_readwrite(0xe80000, 0xe8007f);
- m_slot->space().install_readwrite_handler(address, address + 0x3fff,
+ m_slot->m_space->install_readwrite_handler(address, address + 0x3fff,
read16_delegate(FUNC(a2232_device::shared_ram_r), this),
write16_delegate(FUNC(a2232_device::shared_ram_w), this), 0xffff);
- m_slot->space().install_readwrite_handler(address + 0x4000, address + 0x4001,
+ m_slot->m_space->install_readwrite_handler(address + 0x4000, address + 0x4001,
read16_delegate(FUNC(a2232_device::irq_ack_r), this),
write16_delegate(FUNC(a2232_device::irq_ack_w), this), 0xffff);
- m_slot->space().install_readwrite_handler(address + 0x8000, address + 0x8001,
+ m_slot->m_space->install_readwrite_handler(address + 0x8000, address + 0x8001,
read16_delegate(FUNC(a2232_device::reset_low_r), this),
write16_delegate(FUNC(a2232_device::reset_low_w), this), 0xffff);
- m_slot->space().install_readwrite_handler(address + 0xa000, address + 0xa001,
+ m_slot->m_space->install_readwrite_handler(address + 0xa000, address + 0xa001,
read16_delegate(FUNC(a2232_device::irq_r), this),
write16_delegate(FUNC(a2232_device::irq_w), this), 0xffff);
- m_slot->space().install_readwrite_handler(address + 0xc000, address + 0xc001,
+ m_slot->m_space->install_readwrite_handler(address + 0xc000, address + 0xc001,
read16_delegate(FUNC(a2232_device::reset_high_r), this),
write16_delegate(FUNC(a2232_device::reset_high_w), this), 0xffff);
@@ -236,7 +236,7 @@ WRITE_LINE_MEMBER( a2232_device::cfgin_w )
autoconfig_can_shutup(true); // ?
// install autoconfig handler
- m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f,
+ m_slot->m_space->install_readwrite_handler(0xe80000, 0xe8007f,
read16_delegate(FUNC(amiga_autoconfig::autoconfig_read), static_cast<amiga_autoconfig *>(this)),
write16_delegate(FUNC(amiga_autoconfig::autoconfig_write), static_cast<amiga_autoconfig *>(this)), 0xffff);
}
@@ -344,13 +344,13 @@ WRITE16_MEMBER( a2232_device::reset_high_w )
template<int N>
READ8_MEMBER( a2232_device::acia_r )
{
- return m_acia[N]->read(offset >> 1);
+ return m_acia[N]->read(space, offset >> 1);
}
template<int N>
WRITE8_MEMBER( a2232_device::acia_w )
{
- m_acia[N]->write(offset >> 1, data);
+ m_acia[N]->write(space, offset >> 1, data);
}
@@ -360,12 +360,12 @@ WRITE8_MEMBER( a2232_device::acia_w )
READ8_MEMBER( a2232_device::cia_r )
{
- return m_cia->read(offset >> 1);
+ return m_cia->read(space, offset >> 1);
}
WRITE8_MEMBER( a2232_device::cia_w )
{
- m_cia->write(offset >> 1, data);
+ m_cia->write(space, offset >> 1, data);
}
READ8_MEMBER( a2232_device::cia_port_a_r )
diff --git a/src/devices/bus/amiga/zorro/a590.cpp b/src/devices/bus/amiga/zorro/a590.cpp
index 045a0eab7c8..32328b2f944 100644
--- a/src/devices/bus/amiga/zorro/a590.cpp
+++ b/src/devices/bus/amiga/zorro/a590.cpp
@@ -10,9 +10,8 @@
#include "emu.h"
#include "a590.h"
-#include "machine/nscsi_bus.h"
-#include "machine/nscsi_cd.h"
-#include "machine/nscsi_hd.h"
+#include "bus/scsi/scsi.h"
+#include "bus/scsi/scsihd.h"
//**************************************************************************
@@ -115,19 +114,6 @@ ioport_constructor a2091_device::device_input_ports() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void dmac_hdc_device::scsi_devices(device_slot_interface &device)
-{
- device.option_add("cdrom", NSCSI_CDROM);
- device.option_add("harddisk", NSCSI_HARDDISK);
-}
-
-void dmac_hdc_device::wd33c93(device_t *device)
-{
- device->set_clock(10000000);
- downcast<wd33c93a_device *>(device)->irq_cb().set(*this, FUNC(dmac_hdc_device::scsi_irq_w));
- downcast<wd33c93a_device *>(device)->drq_cb().set(*this, FUNC(dmac_hdc_device::scsi_drq_w));
-}
-
void dmac_hdc_device::device_add_mconfig(machine_config &config)
{
amiga_dmac_device &dmac(AMIGA_DMAC(config, "dmac", 0));
@@ -136,15 +122,12 @@ void dmac_hdc_device::device_add_mconfig(machine_config &config)
dmac.int_handler().set(FUNC(dmac_hdc_device::dmac_int_w));
dmac.cfgout_handler().set(FUNC(dmac_hdc_device::dmac_cfgout_w));
- NSCSI_BUS(config, "scsi", 0);
- NSCSI_CONNECTOR(config, "scsi:0", scsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsi:1", scsi_devices, "harddisk", false);
- NSCSI_CONNECTOR(config, "scsi:3", scsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsi:4", scsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsi:5", scsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsi:6", scsi_devices, nullptr, false);
- NSCSI_CONNECTOR(config, "scsi:7").option_set("wd33c93", WD33C93A)
- .machine_config([this](device_t *device) { wd33c93(device); });
+ scsi_port_device &scsi(SCSI_PORT(config, "scsi"));
+ scsi.set_slot_device(1, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_1));
+
+ wd33c93_device &scsi_ctrl(WD33C93(config, "wd33c93"));
+ scsi_ctrl.set_scsi_port("scsi");
+ scsi_ctrl.irq_cb().set(FUNC(dmac_hdc_device::scsi_irq_w));
}
@@ -222,7 +205,7 @@ dmac_hdc_device::dmac_hdc_device(const machine_config &mconfig, device_type type
device_t(mconfig, type, tag, owner, clock),
m_int6(false),
m_dmac(*this, "dmac"),
- m_wdc(*this, "scsi:7:wd33c93")
+ m_wdc(*this, "wd33c93")
{
}
@@ -260,7 +243,7 @@ void a590_device::device_start()
set_zorro_device();
// setup DMAC
- m_dmac->set_address_space(&m_slot->space());
+ m_dmac->set_address_space(m_slot->m_space);
m_dmac->set_rom(memregion("bootrom")->base());
}
@@ -269,7 +252,7 @@ void a2091_device::device_start()
set_zorro_device();
// setup DMAC
- m_dmac->set_address_space(&m_slot->space());
+ m_dmac->set_address_space(m_slot->m_space);
m_dmac->set_rom(memregion("bootrom")->base());
}
@@ -344,8 +327,8 @@ READ8_MEMBER( dmac_hdc_device::dmac_scsi_r )
{
switch (offset)
{
- case 0x48: return m_wdc->indir_addr_r();
- case 0x49: return m_wdc->indir_reg_r();
+ case 0x48: return m_wdc->read(space, 0);
+ case 0x49: return m_wdc->read(space, 1);
}
return 0xff;
@@ -355,8 +338,8 @@ WRITE8_MEMBER( dmac_hdc_device::dmac_scsi_w )
{
switch (offset)
{
- case 0x48: m_wdc->indir_addr_w(data); break;
- case 0x49: m_wdc->indir_reg_w(data); break;
+ case 0x48: m_wdc->write(space, 0, data); break;
+ case 0x49: m_wdc->write(space, 1, data); break;
}
}
@@ -373,8 +356,3 @@ WRITE_LINE_MEMBER( dmac_hdc_device::scsi_irq_w )
// should be or'ed with xt-ide IRQ
m_dmac->intx_w(state);
}
-
-WRITE_LINE_MEMBER( dmac_hdc_device::scsi_drq_w )
-{
- m_dmac->xdreq_w(state);
-}
diff --git a/src/devices/bus/amiga/zorro/a590.h b/src/devices/bus/amiga/zorro/a590.h
index 62ea3bd189f..cf051fd30dc 100644
--- a/src/devices/bus/amiga/zorro/a590.h
+++ b/src/devices/bus/amiga/zorro/a590.h
@@ -15,7 +15,7 @@
#include "zorro.h"
#include "machine/dmac.h"
-#include "machine/wd33c9x.h"
+#include "machine/wd33c93.h"
//**************************************************************************
@@ -51,7 +51,7 @@ protected:
// sub-devices
required_device<amiga_dmac_device> m_dmac;
- required_device<wd33c93a_device> m_wdc;
+ required_device<wd33c93_device> m_wdc;
std::vector<uint8_t> m_ram;
@@ -61,10 +61,6 @@ private:
DECLARE_WRITE_LINE_MEMBER( dmac_int_w );
DECLARE_WRITE_LINE_MEMBER( dmac_cfgout_w ) { cfgout_w(state); }
DECLARE_WRITE_LINE_MEMBER( scsi_irq_w );
- DECLARE_WRITE_LINE_MEMBER( scsi_drq_w );
-
- static void scsi_devices(device_slot_interface &device);
- void wd33c93(device_t *device);
};
// ======================> a590_device
diff --git a/src/devices/bus/amiga/zorro/buddha.cpp b/src/devices/bus/amiga/zorro/buddha.cpp
index 376e2824660..b82f2d8818b 100644
--- a/src/devices/bus/amiga/zorro/buddha.cpp
+++ b/src/devices/bus/amiga/zorro/buddha.cpp
@@ -143,18 +143,18 @@ void buddha_device::autoconfig_base_address(offs_t address)
logerror("-> installing buddha\n");
// stop responding to default autoconfig
- m_slot->space().unmap_readwrite(0xe80000, 0xe8007f);
+ m_slot->m_space->unmap_readwrite(0xe80000, 0xe8007f);
// buddha registers
- m_slot->space().install_device(address, address + 0xfff, *this, &buddha_device::mmio_map);
+ m_slot->m_space->install_device(address, address + 0xfff, *this, &buddha_device::mmio_map);
// install autoconfig handler to new location
- m_slot->space().install_readwrite_handler(address, address + 0x7f,
+ m_slot->m_space->install_readwrite_handler(address, address + 0x7f,
read16_delegate(FUNC(amiga_autoconfig::autoconfig_read), static_cast<amiga_autoconfig *>(this)),
write16_delegate(FUNC(amiga_autoconfig::autoconfig_write), static_cast<amiga_autoconfig *>(this)), 0xffff);
// install access to the rom space
- m_slot->space().install_rom(address + 0x1000, address + 0xffff, memregion("bootrom")->base() + 0x1000);
+ m_slot->m_space->install_rom(address + 0x1000, address + 0xffff, memregion("bootrom")->base() + 0x1000);
// we're done
m_slot->cfgout_w(0);
@@ -181,7 +181,7 @@ WRITE_LINE_MEMBER( buddha_device::cfgin_w )
autoconfig_rom_vector(0x1000);
// install autoconfig handler
- m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f,
+ m_slot->m_space->install_readwrite_handler(0xe80000, 0xe8007f,
read16_delegate(FUNC(amiga_autoconfig::autoconfig_read), static_cast<amiga_autoconfig *>(this)),
write16_delegate(FUNC(amiga_autoconfig::autoconfig_write), static_cast<amiga_autoconfig *>(this)), 0xffff);
}
@@ -231,8 +231,8 @@ READ16_MEMBER( buddha_device::ide_0_interrupt_r )
data = m_ide_0_interrupt << 15;
-// if (VERBOSE)
-// logerror("ide_0_interrupt_r %04x [mask = %04x]\n", data, mem_mask);
+ if (VERBOSE && 0)
+ logerror("ide_0_interrupt_r %04x [mask = %04x]\n", data, mem_mask);
return data;
}
@@ -243,8 +243,8 @@ READ16_MEMBER( buddha_device::ide_1_interrupt_r )
data = m_ide_1_interrupt << 15;
-// if (VERBOSE)
-// logerror("ide_1_interrupt_r %04x [mask = %04x]\n", data, mem_mask);
+ if (VERBOSE && 0)
+ logerror("ide_1_interrupt_r %04x [mask = %04x]\n", data, mem_mask);
return data;
}
diff --git a/src/devices/bus/amiga/zorro/zorro.cpp b/src/devices/bus/amiga/zorro/zorro.cpp
index b4f06507d55..fec5d745015 100644
--- a/src/devices/bus/amiga/zorro/zorro.cpp
+++ b/src/devices/bus/amiga/zorro/zorro.cpp
@@ -30,7 +30,7 @@ zorro_slot_device::zorro_slot_device(const machine_config &mconfig, const char *
zorro_slot_device::zorro_slot_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_slot_interface(mconfig, *this),
- m_zorro_bus(*this, finder_base::DUMMY_TAG)
+ m_zorro_tag(nullptr)
{
}
@@ -43,7 +43,10 @@ void zorro_slot_device::device_start()
device_zorro_card_interface *dev = dynamic_cast<device_zorro_card_interface *>(get_card_device());
if (dev)
+ {
+ zorro_device *m_zorro_bus = downcast<zorro_device *>(m_owner->subdevice(m_zorro_tag));
m_zorro_bus->add_card(dev);
+ }
}
@@ -57,7 +60,8 @@ void zorro_slot_device::device_start()
zorro_device::zorro_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_space(*this, finder_base::DUMMY_TAG, -1),
+ m_space(nullptr),
+ m_cputag(nullptr),
m_ovr_handler(*this),
m_int2_handler(*this),
m_int6_handler(*this)
@@ -65,27 +69,21 @@ zorro_device::zorro_device(const machine_config &mconfig, device_type type, cons
}
//-------------------------------------------------
-// device_resolve_objects - resolve objects that
-// may be needed for other devices to set
-// initial conditions at start time
+// device_start - device-specific startup
//-------------------------------------------------
-void zorro_device::device_resolve_objects()
+void zorro_device::device_start()
{
+ // get address space
+ device_t *cpu = machine().device(m_cputag);
+ m_space = &cpu->memory().space(AS_PROGRAM);
+
// resolve callbacks
m_ovr_handler.resolve_safe();
m_int2_handler.resolve_safe();
m_int6_handler.resolve_safe();
}
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void zorro_device::device_start()
-{
-}
-
// from slot device
WRITE_LINE_MEMBER( zorro_device::ovr_w ) { m_ovr_handler(state); }
WRITE_LINE_MEMBER( zorro_device::int2_w ) { m_int2_handler(state); }
@@ -117,18 +115,16 @@ exp_slot_device::exp_slot_device(const machine_config &mconfig, device_type type
}
//-------------------------------------------------
-// device_resolve_objects - resolve objects that
-// may be needed for other devices to set
-// initial conditions at start time
+// device_start - device-specific startup
//-------------------------------------------------
-void exp_slot_device::device_resolve_objects()
+void exp_slot_device::device_start()
{
// resolve callbacks
m_ipl_handler.resolve_safe();
- // call base device
- zorro_device::device_resolve_objects();
+ // call base device start
+ zorro_device::device_start();
}
//-------------------------------------------------
@@ -194,12 +190,10 @@ zorro2_device::~zorro2_device()
}
//-------------------------------------------------
-// device_resolve_objects - resolve objects that
-// may be needed for other devices to set
-// initial conditions at start time
+// device_start - device-specific startup
//-------------------------------------------------
-void zorro2_device::device_resolve_objects()
+void zorro2_device::device_start()
{
// resolve callbacks
m_eint1_handler.resolve_safe();
@@ -207,8 +201,8 @@ void zorro2_device::device_resolve_objects()
m_eint5_handler.resolve_safe();
m_eint7_handler.resolve_safe();
- // call base device
- zorro_device::device_resolve_objects();
+ // call base device start
+ zorro_device::device_start();
}
//-------------------------------------------------
diff --git a/src/devices/bus/amiga/zorro/zorro.h b/src/devices/bus/amiga/zorro/zorro.h
index 4ad72da638b..3686f050002 100644
--- a/src/devices/bus/amiga/zorro/zorro.h
+++ b/src/devices/bus/amiga/zorro/zorro.h
@@ -145,6 +145,76 @@
//**************************************************************************
+// CONSTANTS / MACROS
+//**************************************************************************
+
+#define EXP_SLOT_TAG "exp"
+#define ZORROBUS_TAG "zorrobus"
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_ZORRO_SLOT_ADD(_zorrotag, _tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, ZORRO_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<zorro_slot_device &>(*device).set_zorro_slot(this, _zorrotag);
+
+// ======================> expansion slot
+
+#define MCFG_EXPANSION_SLOT_ADD(_cputag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(EXP_SLOT_TAG, EXP_SLOT, 0) \
+ device_t *temp = device; \
+ downcast<zorro_device &>(*device).set_cputag(_cputag); \
+ MCFG_ZORRO_SLOT_ADD(EXP_SLOT_TAG, "slot", _slot_intf, _def_slot) \
+ device = temp;
+
+// callbacks
+#define MCFG_EXPANSION_SLOT_OVR_HANDLER(_devcb) \
+ downcast<zorro_device &>(*device).set_ovr_handler(DEVCB_##_devcb);
+
+#define MCFG_EXPANSION_SLOT_INT2_HANDLER(_devcb) \
+ downcast<zorro_device &>(*device).set_int2_handler(DEVCB_##_devcb);
+
+#define MCFG_EXPANSION_SLOT_INT6_HANDLER(_devcb) \
+ downcast<zorro_device &>(*device).set_int6_handler(DEVCB_##_devcb);
+
+#define MCFG_EXPANSION_SLOT_IPL_HANDLER(_devcb) \
+ downcast<exp_slot_device &>(*device).set_ipl_handler(DEVCB_##_devcb);
+
+// ======================> zorro 2 bus
+
+#define MCFG_ZORRO2_ADD(_cputag) \
+ MCFG_DEVICE_ADD(ZORROBUS_TAG, ZORRO2, 0) \
+ downcast<zorro_device &>(*device).set_cputag(_cputag);
+
+#define MCFG_ZORRO2_SLOT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_ZORRO_SLOT_ADD(ZORROBUS_TAG, _tag, _slot_intf, _def_slot)
+
+#define MCFG_ZORRO2_OVR_HANDLER(_devcb) \
+ downcast<zorro_device &>(*device).set_ovr_handler(DEVCB_##_devcb);
+
+#define MCFG_ZORRO2_INT2_HANDLER(_devcb) \
+ downcast<zorro_device &>(*device).set_int2_handler(DEVCB_##_devcb);
+
+#define MCFG_ZORRO2_INT6_HANDLER(_devcb) \
+ downcast<zorro_device &>(*device).set_int6_handler(DEVCB_##_devcb);
+
+#define MCFG_ZORRO2_EINT1_HANDLER(_devcb) \
+ downcast<zorro2_device &>(*device).set_eint1_handler(DEVCB_##_devcb);
+
+#define MCFG_ZORRO2_EINT4_HANDLER(_devcb) \
+ downcast<zorro2_device &>(*device).set_eint4_handler(DEVCB_##_devcb);
+
+#define MCFG_ZORRO2_EINT5_HANDLER(_devcb) \
+ downcast<zorro2_device &>(*device).set_eint5_handler(DEVCB_##_devcb);
+
+#define MCFG_ZORRO2_EINT7_HANDLER(_devcb) \
+ downcast<zorro2_device &>(*device).set_eint7_handler(DEVCB_##_devcb);
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -152,7 +222,6 @@
class device_zorro_card_interface;
class device_exp_card_interface;
class device_zorro2_card_interface;
-class zorro_device;
// ======================> zorro slot device
@@ -161,28 +230,18 @@ class zorro_slot_device : public device_t, public device_slot_interface
public:
// construction/destruction
zorro_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template <typename T, typename O>
- zorro_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&zorrotag, O &&opts, const char *dflt)
- : zorro_slot_device(mconfig, tag, owner, 0)
- {
- set_zorro_slot(std::forward<T>(zorrotag));
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
// device-level overrides
virtual void device_start() override;
// inline configuration
- template <class T> void set_zorro_slot(T &&zorro_tag) { m_zorro_bus.set_tag(zorro_tag); }
+ void set_zorro_slot(device_t *owner, const char *zorro_tag) { m_owner = owner; m_zorro_tag = zorro_tag; }
protected:
zorro_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// configuration
- required_device<zorro_device> m_zorro_bus;
+ const char *m_zorro_tag;
};
// device type definition
@@ -194,11 +253,11 @@ class zorro_device : public device_t
{
public:
// configuration helpers
- template <class T> void set_space(T &&tag, int spacenum) { m_space.set_tag(std::forward<T>(tag), spacenum); }
+ void set_cputag(const char *tag) { m_cputag = tag; }
- auto int2_handler() { return m_int2_handler.bind(); }
- auto int6_handler() { return m_int6_handler.bind(); }
- auto ovr_handler() { return m_ovr_handler.bind(); }
+ template <class Object> devcb_base &set_int2_handler(Object &&cb) { return m_int2_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_int6_handler(Object &&cb) { return m_int6_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ovr_handler(Object &&cb) { return m_ovr_handler.set_callback(std::forward<Object>(cb)); }
virtual void add_card(device_zorro_card_interface *card) = 0;
@@ -213,18 +272,17 @@ public:
virtual void fc_w(int code) = 0;
// access to the host space
- address_space &space() const { return *m_space; }
+ address_space *m_space;
protected:
// construction/destruction
zorro_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void device_resolve_objects() override;
virtual void device_start() override;
private:
- required_address_space m_space;
+ const char *m_cputag;
devcb_write_line m_ovr_handler;
devcb_write_line m_int2_handler;
@@ -239,7 +297,7 @@ public:
// construction/destruction
exp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto ipl_handler() { return m_ipl_handler.bind(); }
+ template <class Object> devcb_base &set_ipl_handler(Object &&cb) { return m_ipl_handler.set_callback(std::forward<Object>(cb)); }
// the expansion slot can only have a single card
virtual void add_card(device_zorro_card_interface *card) override;
@@ -254,7 +312,7 @@ protected:
exp_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void device_resolve_objects() override;
+ virtual void device_start() override;
virtual void device_reset() override;
private:
@@ -275,10 +333,10 @@ public:
zorro2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
~zorro2_device();
- auto eint1_handler() { return m_eint1_handler.bind(); }
- auto eint4_handler() { return m_eint4_handler.bind(); }
- auto eint5_handler() { return m_eint5_handler.bind(); }
- auto eint7_handler() { return m_eint7_handler.bind(); }
+ template <class Object> devcb_base &set_eint1_handler(Object &&cb) { return m_eint1_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_eint4_handler(Object &&cb) { return m_eint4_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_eint5_handler(Object &&cb) { return m_eint5_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_eint7_handler(Object &&cb) { return m_eint7_handler.set_callback(std::forward<Object>(cb)); }
// the zorro2 bus supports multiple cards
virtual void add_card(device_zorro_card_interface *card) override;
@@ -298,7 +356,7 @@ protected:
zorro2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void device_resolve_objects() override;
+ virtual void device_start() override;
virtual void device_reset() override;
private:
diff --git a/src/devices/bus/apf/slot.h b/src/devices/bus/apf/slot.h
index 3678124c3e9..92ebbe4ad43 100644
--- a/src/devices/bus/apf/slot.h
+++ b/src/devices/bus/apf/slot.h
@@ -59,17 +59,7 @@ class apf_cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- apf_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : apf_cart_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- apf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ apf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~apf_cart_slot_device();
// device-level overrides
@@ -120,4 +110,8 @@ DECLARE_DEVICE_TYPE(APF_CART_SLOT, apf_cart_slot_device)
#define APFSLOT_ROM_REGION_TAG ":cart:rom"
+#define MCFG_APF_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, APF_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
#endif // MAME_BUS_APF_SLOT_H
diff --git a/src/devices/bus/apricot/expansion/cards.cpp b/src/devices/bus/apricot/expansion/cards.cpp
index ef0243bf412..d2c35366e42 100644
--- a/src/devices/bus/apricot/expansion/cards.cpp
+++ b/src/devices/bus/apricot/expansion/cards.cpp
@@ -9,12 +9,10 @@
#include "emu.h"
#include "cards.h"
#include "ram.h"
-#include "winchester.h"
void apricot_expansion_cards(device_slot_interface &device)
{
device.option_add("128k", APRICOT_128K_RAM);
device.option_add("256k", APRICOT_256K_RAM);
device.option_add("512k", APRICOT_512K_RAM);
- device.option_add("winchester", APRICOT_WINCHESTER);
}
diff --git a/src/devices/bus/apricot/expansion/expansion.cpp b/src/devices/bus/apricot/expansion/expansion.cpp
index 5a89c9a8868..98141860782 100644
--- a/src/devices/bus/apricot/expansion/expansion.cpp
+++ b/src/devices/bus/apricot/expansion/expansion.cpp
@@ -59,16 +59,18 @@ DEFINE_DEVICE_TYPE(APRICOT_EXPANSION_BUS, apricot_expansion_bus_device, "apricot
apricot_expansion_bus_device::apricot_expansion_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, APRICOT_EXPANSION_BUS, tag, owner, clock),
- m_program(*this, finder_base::DUMMY_TAG, -1),
- m_io(*this, finder_base::DUMMY_TAG, -1),
- m_program_iop(*this, finder_base::DUMMY_TAG, -1),
- m_io_iop(*this, finder_base::DUMMY_TAG, -1),
+ m_program(nullptr),
+ m_io(nullptr),
+ m_program_iop(nullptr),
+ m_io_iop(nullptr),
m_dma1_handler(*this),
m_dma2_handler(*this),
m_ext1_handler(*this),
m_ext2_handler(*this),
m_int2_handler(*this),
- m_int3_handler(*this)
+ m_int3_handler(*this),
+ m_cpu(*this, finder_base::DUMMY_TAG),
+ m_iop(*this, finder_base::DUMMY_TAG)
{
}
@@ -97,6 +99,19 @@ void apricot_expansion_bus_device::device_start()
}
//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void apricot_expansion_bus_device::device_reset()
+{
+ m_program = &m_cpu->space(AS_PROGRAM);
+ m_io = &m_cpu->space(AS_IO);
+
+ m_program_iop = &m_iop->space(AS_PROGRAM);
+ m_io_iop = &m_iop->space(AS_IO);
+}
+
+//-------------------------------------------------
// add_card - add new card to our bus
//-------------------------------------------------
diff --git a/src/devices/bus/apricot/expansion/expansion.h b/src/devices/bus/apricot/expansion/expansion.h
index 93c529f24e3..85b0e47dc5e 100644
--- a/src/devices/bus/apricot/expansion/expansion.h
+++ b/src/devices/bus/apricot/expansion/expansion.h
@@ -89,14 +89,16 @@ class apricot_expansion_bus_device : public device_t
{
public:
// construction/destruction
+ template <typename T, typename U>
+ apricot_expansion_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&cpu_tag, U &&iop_tag)
+ : apricot_expansion_bus_device(mconfig, tag, owner, (uint32_t)0)
+ {
+ m_cpu.set_tag(std::forward<T>(cpu_tag));
+ m_iop.set_tag(std::forward<U>(iop_tag));
+ }
apricot_expansion_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~apricot_expansion_bus_device();
- template <typename T> void set_program_space(T &&tag, int spacenum) { m_program.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_io_space(T &&tag, int spacenum) { m_io.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_program_iop_space(T &&tag, int spacenum) { m_program_iop.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_io_iop_space(T &&tag, int spacenum) { m_io_iop.set_tag(std::forward<T>(tag), spacenum); }
-
auto dma1() { return m_dma1_handler.bind(); }
auto dma2() { return m_dma2_handler.bind(); }
auto ext1() { return m_ext1_handler.bind(); }
@@ -116,26 +118,19 @@ public:
void install_ram(offs_t addrstart, offs_t addrend, void *baseptr);
- template<typename T> void install_io_device(offs_t addrstart, offs_t addrend, T &device, void (T::*map)(class address_map &map), uint64_t unitmask = ~u64(0))
- {
- m_io->install_device(addrstart, addrend, device, map, unitmask);
-
- if (m_io_iop)
- m_io_iop->install_device(addrstart, addrend, device, map, unitmask);
- }
-
protected:
// device-level overrides
virtual void device_start() override;
+ virtual void device_reset() override;
private:
simple_list<device_apricot_expansion_card_interface> m_dev;
// address spaces we have access to
- required_address_space m_program;
- required_address_space m_io;
- optional_address_space m_program_iop;
- optional_address_space m_io_iop;
+ address_space *m_program;
+ address_space *m_io;
+ address_space *m_program_iop;
+ address_space *m_io_iop;
devcb_write_line m_dma1_handler;
devcb_write_line m_dma2_handler;
@@ -143,6 +138,10 @@ private:
devcb_write_line m_ext2_handler;
devcb_write_line m_int2_handler;
devcb_write_line m_int3_handler;
+
+ // configuration
+ required_device<cpu_device> m_cpu;
+ required_device<cpu_device> m_iop;
};
// device type definition
diff --git a/src/devices/bus/apricot/expansion/winchester.cpp b/src/devices/bus/apricot/expansion/winchester.cpp
deleted file mode 100644
index f16752b3ede..00000000000
--- a/src/devices/bus/apricot/expansion/winchester.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Dirk Best
-/***************************************************************************
-
- ACT Apricot Winchester Controller
-
- Version Rev 9
-
-***************************************************************************/
-
-#include "emu.h"
-#include "winchester.h"
-#include "imagedev/harddriv.h"
-
-//#define LOG_GENERAL (1U << 0)
-#define LOG_REGS (1U << 1)
-#define LOG_DATA (1U << 2)
-
-//#define VERBOSE (LOG_REGS)
-//#define LOG_OUTPUT_STREAM std::cout
-
-#include "logmacro.h"
-
-#define LOGREGS(...) LOGMASKED(LOG_REGS, __VA_ARGS__)
-#define LOGDATA(...) LOGMASKED(LOG_DATA, __VA_ARGS__)
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(APRICOT_WINCHESTER, apricot_winchester_device, "apricot_winchester", "Apricot Winchester Controller Board")
-
-//-------------------------------------------------
-// regs - controller register i/o map
-//-------------------------------------------------
-
-void apricot_winchester_device::regs(address_map &map)
-{
- map(0x0e0, 0x0ef).rw(m_hdc, FUNC(wd1010_device::read), FUNC(wd1010_device::write)).umask16(0x00ff);
- map(0x1e0, 0x1e0).rw(FUNC(apricot_winchester_device::int_r), FUNC(apricot_winchester_device::head_w<0>)).umask16(0x00ff);
- map(0x1e2, 0x1e2).w(FUNC(apricot_winchester_device::head_w<1>)).umask16(0x00ff);
- map(0x1e4, 0x1e4).w(FUNC(apricot_winchester_device::head_w<2>)).umask16(0x00ff);
- map(0x1e6, 0x1e6).w(FUNC(apricot_winchester_device::drive_w<0>)).umask16(0x00ff);
- map(0x1e8, 0x1e8).w(FUNC(apricot_winchester_device::xferd_w)).umask16(0x00ff); // transferred
- map(0x1ea, 0x1ea).w(FUNC(apricot_winchester_device::hbcr_w)).umask16(0x00ff); // host buffer clear register
- map(0x1ec, 0x1ec).w(FUNC(apricot_winchester_device::clksel_w)).umask16(0x00ff); // buffer chip read/write clock select (host or wdc)
- map(0x1ee, 0x1ee).w(FUNC(apricot_winchester_device::drive_w<1>)).umask16(0x00ff);
- map(0x1f0, 0x1f0).rw(FUNC(apricot_winchester_device::data_r), FUNC(apricot_winchester_device::data_w)).umask16(0x00ff);
-}
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void apricot_winchester_device::device_add_mconfig(machine_config &config)
-{
- WD1010(config, m_hdc, 5000000);
- m_hdc->out_intrq_callback().set(FUNC(apricot_winchester_device::hdc_intrq_w));
- m_hdc->in_data_callback().set(FUNC(apricot_winchester_device::hdc_data_r));
- m_hdc->out_data_callback().set(FUNC(apricot_winchester_device::hdc_data_w));
-
- HARDDISK(config, "hdc:0", 0);
- HARDDISK(config, "hdc:1", 0);
-}
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// apricot_winchester_device - constructor
-//-------------------------------------------------
-
-apricot_winchester_device::apricot_winchester_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, APRICOT_WINCHESTER, tag, owner, clock),
- device_apricot_expansion_card_interface(mconfig, *this),
- m_hdc(*this, "hdc"),
- m_ram_ptr(0),
- m_int(0),
- m_drive(0),
- m_head(0),
- m_hbcr(0),
- m_clksel(0)
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void apricot_winchester_device::device_start()
-{
- // allocate 8-bit buffer ram (8k)
- m_ram = std::make_unique<uint8_t[]>(0x2000);
-
- // register for save states
- save_pointer(NAME(m_ram), 0x2000);
- save_item(NAME(m_ram_ptr));
- save_item(NAME(m_int));
- save_item(NAME(m_drive));
- save_item(NAME(m_head));
- save_item(NAME(m_hbcr));
- save_item(NAME(m_clksel));
-}
-
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void apricot_winchester_device::device_reset()
-{
- m_bus->install_io_device(0x000, 0xfff, *this, &apricot_winchester_device::regs);
-}
-
-
-//**************************************************************************
-// IMPLEMENTATION
-//**************************************************************************
-
-WRITE_LINE_MEMBER( apricot_winchester_device::hdc_intrq_w )
-{
- LOGREGS("hdc_intrq_w: %d\n", state);
-
- m_int = state;
- m_bus->int2_w(state);
-}
-
-READ8_MEMBER( apricot_winchester_device::hdc_data_r )
-{
- uint8_t data = 0xff;
-
- if (m_clksel == 1)
- {
- LOGDATA("hdc_data_r[%04x]\n", m_ram_ptr);
-
- data = m_ram[m_ram_ptr];
- if (m_ram_ptr < 0x1fff)
- m_ram_ptr++;
- }
-
- return data;
-}
-
-WRITE8_MEMBER( apricot_winchester_device::hdc_data_w )
-{
- if (m_clksel == 1)
- {
- LOGDATA("hdc_data_w[%04x] = %02x\n", m_ram_ptr, data);
-
- m_ram[m_ram_ptr] = data;
- if (m_ram_ptr < 0x1fff)
- m_ram_ptr++;
- }
-}
-
-READ8_MEMBER( apricot_winchester_device::int_r )
-{
- return m_int;
-}
-
-template<int N>
-WRITE8_MEMBER( apricot_winchester_device::head_w )
-{
- m_head = (m_head & ~(1 << N)) | (BIT(data, 0) << N);
- LOGREGS("Select head: %d\n", m_head);
-}
-
-template<int N>
-WRITE8_MEMBER( apricot_winchester_device::drive_w )
-{
- m_drive = (m_drive & ~(1 << N)) | (BIT(data, 0) << N);
- LOGREGS("Select drive: %d\n", m_drive);
-
- // forward drive status to the hdc
- harddisk_image_device *drive = nullptr;
-
- switch (m_drive)
- {
- case 0:
- drive = nullptr;
- break;
- case 1:
- drive = m_hdc->subdevice<harddisk_image_device>("0");
- break;
- case 2:
- drive = m_hdc->subdevice<harddisk_image_device>("1");
- break;
- case 3:
- // both (invalid?)
- drive = nullptr;
- break;
- }
-
- m_hdc->drdy_w(drive != nullptr && drive->exists());
-}
-
-WRITE8_MEMBER( apricot_winchester_device::xferd_w )
-{
- LOGREGS("xferd_w: %02x\n", data);
-
- m_hdc->brdy_w(BIT(data, 0));
-}
-
-WRITE8_MEMBER( apricot_winchester_device::hbcr_w )
-{
- LOGREGS("hbcr_w: %02x\n", data);
-
- // reset ram pointer on high->low transition
- if (m_hbcr == 1 && data == 0)
- m_ram_ptr = 0;
-
- m_hbcr = BIT(data, 0);
-}
-
-WRITE8_MEMBER( apricot_winchester_device::clksel_w )
-{
- LOGREGS("clksel_w: %02x\n", data);
-
- m_clksel = BIT(data, 0);
-}
-
-READ8_MEMBER( apricot_winchester_device::data_r )
-{
- uint8_t data = 0xff;
-
- if (m_clksel == 0)
- {
- LOGDATA("data_r[%04x]\n", m_ram_ptr);
-
- data = m_ram[m_ram_ptr];
-
- // wrap or stop at end?
- if (m_ram_ptr < 0x1fff)
- m_ram_ptr++;
- }
-
- return data;
-}
-
-WRITE8_MEMBER( apricot_winchester_device::data_w )
-{
- if (m_clksel == 0)
- {
- LOGDATA("data_w[%04x] = %02x\n", m_ram_ptr, data);
-
- m_ram[m_ram_ptr] = data;
-
- // wrap or stop at end?
- if (m_ram_ptr < 0x1fff)
- m_ram_ptr++;
- }
-}
diff --git a/src/devices/bus/apricot/expansion/winchester.h b/src/devices/bus/apricot/expansion/winchester.h
deleted file mode 100644
index c4c82ab0585..00000000000
--- a/src/devices/bus/apricot/expansion/winchester.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Dirk Best
-/***************************************************************************
-
- ACT Apricot Winchester Controller
-
-***************************************************************************/
-
-#ifndef MAME_BUS_APRICOT_WINCHESTER_H
-#define MAME_BUS_APRICOT_WINCHESTER_H
-
-#pragma once
-
-#include "expansion.h"
-#include "machine/wd1010.h"
-
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> apricot_winchester_device
-
-class apricot_winchester_device : public device_t, public device_apricot_expansion_card_interface
-{
-public:
- // construction/destruction
- apricot_winchester_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device-level overrides
- virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_start() override;
- virtual void device_reset() override;
-
-private:
- DECLARE_WRITE_LINE_MEMBER(hdc_intrq_w);
- DECLARE_READ8_MEMBER(hdc_data_r);
- DECLARE_WRITE8_MEMBER(hdc_data_w);
- DECLARE_READ8_MEMBER(int_r);
- template<int N> DECLARE_WRITE8_MEMBER(head_w);
- template<int N> DECLARE_WRITE8_MEMBER(drive_w);
- DECLARE_WRITE8_MEMBER(xferd_w);
- DECLARE_WRITE8_MEMBER(hbcr_w);
- DECLARE_WRITE8_MEMBER(clksel_w);
- DECLARE_WRITE8_MEMBER(drvsel2_w);
- DECLARE_READ8_MEMBER(data_r);
- DECLARE_WRITE8_MEMBER(data_w);
-
- void regs(address_map &map);
-
- required_device<wd1010_device> m_hdc;
-
- std::unique_ptr<uint8_t[]> m_ram;
- unsigned m_ram_ptr;
- int m_int;
- int m_drive;
- int m_head;
- int m_hbcr;
- int m_clksel;
-};
-
-// device type definition
-DECLARE_DEVICE_TYPE(APRICOT_WINCHESTER, apricot_winchester_device)
-
-#endif // MAME_BUS_APRICOT_WINCHESTER_H
diff --git a/src/devices/bus/apricot/keyboard/hle.cpp b/src/devices/bus/apricot/keyboard/hle.cpp
index 28e98b9fb50..c8df35cd0cb 100644
--- a/src/devices/bus/apricot/keyboard/hle.cpp
+++ b/src/devices/bus/apricot/keyboard/hle.cpp
@@ -6,6 +6,7 @@
TODO:
- MicroScreen emulation
+ - Mouse emulation
- LEDs
Keyboard to System:
@@ -187,17 +188,6 @@ static INPUT_PORTS_START( keyboard )
PORT_START("row_c")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
-
- PORT_START("mouse_b")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Right Button")
- PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button")
- PORT_BIT(0x0c, IP_ACTIVE_HIGH, IPT_UNUSED)
-
- PORT_START("mouse_x")
- PORT_BIT(0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(75) PORT_KEYDELTA(5)
-
- PORT_START("mouse_y")
- PORT_BIT(0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(50) PORT_KEYDELTA(5)
INPUT_PORTS_END
ioport_constructor apricot_keyboard_hle_device::device_input_ports() const
@@ -205,12 +195,9 @@ ioport_constructor apricot_keyboard_hle_device::device_input_ports() const
return INPUT_PORTS_NAME( keyboard );
}
-void apricot_keyboard_hle_device::device_add_mconfig(machine_config &config)
-{
- MSM5832(config, m_rtc, 32.768_kHz_XTAL);
-
- TIMER(config, "timer").configure_periodic(FUNC(apricot_keyboard_hle_device::mouse_callback), attotime::from_hz(60));
-}
+MACHINE_CONFIG_START(apricot_keyboard_hle_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("rtc", MSM5832, 32.768_kHz_XTAL)
+MACHINE_CONFIG_END
//**************************************************************************
@@ -227,12 +214,7 @@ apricot_keyboard_hle_device::apricot_keyboard_hle_device(const machine_config &m
device_buffered_serial_interface(mconfig, *this),
device_matrix_keyboard_interface(mconfig, *this, "row_0", "row_1", "row_2", "row_3", "row_4", "row_5", "row_6", "row_7", "row_8", "row_9", "row_a", "row_b", "row_c"),
m_rtc(*this, "rtc"),
- m_mouse_b(*this, "mouse_b"),
- m_mouse_x(*this, "mouse_x"),
- m_mouse_y(*this, "mouse_y"),
- m_rtc_index(0),
- m_mouse_enabled(false),
- m_mouse_last_b(0), m_mouse_last_x(0), m_mouse_last_y(0)
+ m_rtc_index(0)
{
}
@@ -242,12 +224,6 @@ apricot_keyboard_hle_device::apricot_keyboard_hle_device(const machine_config &m
void apricot_keyboard_hle_device::device_start()
{
- // register for save states
- save_item(NAME(m_rtc_index));
- save_item(NAME(m_mouse_enabled));
- save_item(NAME(m_mouse_last_b));
- save_item(NAME(m_mouse_last_x));
- save_item(NAME(m_mouse_last_y));
}
//-------------------------------------------------
@@ -332,16 +308,6 @@ void apricot_keyboard_hle_device::received_byte(uint8_t byte)
break;
- case CMD_ENABLE_MOUSE:
- logerror("System enables mouse\n");
- m_mouse_enabled = true;
- break;
-
- case CMD_DISABLE_MOUSE:
- logerror("System disables mouse\n");
- m_mouse_enabled = false;
- break;
-
case CMD_KEYBOARD_RESET:
logerror("System requests keyboard reset\n");
transmit_byte(ACK_DIAGNOSTICS);
@@ -381,44 +347,3 @@ void apricot_keyboard_hle_device::out_w(int state)
{
device_buffered_serial_interface::rx_w(state);
}
-
-//-------------------------------------------------
-// mouse_callback - check for new mouse events
-//-------------------------------------------------
-
-TIMER_DEVICE_CALLBACK_MEMBER( apricot_keyboard_hle_device::mouse_callback )
-{
- if (m_mouse_enabled)
- {
- // get mouse state
- uint8_t buttons = m_mouse_b->read();
- uint8_t x = m_mouse_x->read();
- uint8_t y = m_mouse_y->read();
-
- // anything changed since last time?
- if (buttons != m_mouse_last_b || x != m_mouse_last_x || y != m_mouse_last_y)
- {
- // mouse header
- transmit_byte(0xef);
-
- // button state
- transmit_byte(0x70 | buttons);
-
- int8_t dx = x - m_mouse_last_x;
- int8_t dy = y - m_mouse_last_y;
-
- // y direction change
- transmit_byte(0x70 | ((dy >> 4) & 0x0f));
- transmit_byte(0x70 | ((dy >> 0) & 0x0f));
-
- // x direction change
- transmit_byte(0x70 | ((dx >> 4) & 0x0f));
- transmit_byte(0x70 | ((dx >> 0) & 0x0f));
-
- // save mouse state for next run
- m_mouse_last_b = buttons;
- m_mouse_last_x = x;
- m_mouse_last_y = y;
- }
- }
-}
diff --git a/src/devices/bus/apricot/keyboard/hle.h b/src/devices/bus/apricot/keyboard/hle.h
index c9738598a57..5565ff6026a 100644
--- a/src/devices/bus/apricot/keyboard/hle.h
+++ b/src/devices/bus/apricot/keyboard/hle.h
@@ -14,7 +14,6 @@
#include "keyboard.h"
#include "machine/keyboard.h"
#include "machine/msm5832.h"
-#include "machine/timer.h"
#include "diserial.h"
@@ -52,13 +51,9 @@ protected:
virtual void key_break(uint8_t row, uint8_t column) override;
private:
- TIMER_DEVICE_CALLBACK_MEMBER(mouse_callback);
-
enum {
CMD_REQ_TIME_AND_DATE = 0xe1,
CMD_SET_TIME_AND_DATE = 0xe4,
- CMD_ENABLE_MOUSE = 0xe5,
- CMD_DISABLE_MOUSE = 0xe6,
CMD_KEYBOARD_RESET = 0xe8
};
@@ -67,15 +62,8 @@ private:
};
required_device<msm5832_device> m_rtc;
- required_ioport m_mouse_b;
- required_ioport m_mouse_x;
- required_ioport m_mouse_y;
int m_rtc_index;
- bool m_mouse_enabled;
- uint8_t m_mouse_last_b;
- uint8_t m_mouse_last_x;
- uint8_t m_mouse_last_y;
};
diff --git a/src/devices/bus/astrocde/accessory.cpp b/src/devices/bus/astrocde/accessory.cpp
deleted file mode 100644
index fe7727b855d..00000000000
--- a/src/devices/bus/astrocde/accessory.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-
-#include "emu.h"
-#include "accessory.h"
-
-#include <cassert>
-
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(ASTROCADE_ACCESSORY_PORT, astrocade_accessory_port_device, "astrocade_accessory_port", "Bally Astrocade Accessory Port")
-
-
-//**************************************************************************
-// Bally Astrocade accessory interface
-//**************************************************************************
-
-device_astrocade_accessory_interface::device_astrocade_accessory_interface(const machine_config &mconfig, device_t &device)
- : device_slot_card_interface(mconfig, device)
- , m_port(dynamic_cast<astrocade_accessory_port_device *>(device.owner()))
-{
-}
-
-device_astrocade_accessory_interface::~device_astrocade_accessory_interface()
-{
-}
-
-void device_astrocade_accessory_interface::interface_validity_check(validity_checker &valid) const
-{
- device_slot_card_interface::interface_validity_check(valid);
-
- if (device().owner() && !m_port)
- {
- osd_printf_error("Owner device %s (%s) is not an astrocade_accessory_port_device\n", device().owner()->tag(), device().owner()->name());
- }
-}
-
-void device_astrocade_accessory_interface::interface_pre_start()
-{
- device_slot_card_interface::interface_pre_start();
-
- if (m_port && !m_port->started())
- throw device_missing_dependencies();
-}
-
-
-//**************************************************************************
-// Bally Astrocade accessory port
-//**************************************************************************
-
-astrocade_accessory_port_device::astrocade_accessory_port_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ASTROCADE_ACCESSORY_PORT, tag, owner, clock)
- , device_slot_interface(mconfig, *this)
- , m_ltpen(0)
- , m_ltpen_handler(*this)
- , m_screen(*this, finder_base::DUMMY_TAG)
- , m_device(nullptr)
-{
-}
-
-astrocade_accessory_port_device::~astrocade_accessory_port_device()
-{
-}
-
-void astrocade_accessory_port_device::device_validity_check(validity_checker &valid) const
-{
- device_t *const card(get_card_device());
- if (card && !dynamic_cast<device_astrocade_accessory_interface *>(card))
- {
- osd_printf_error("Card device %s (%s) does not implement device_astrocade_accessory_interface\n", card->tag(), card->name());
- }
-}
-
-void astrocade_accessory_port_device::device_resolve_objects()
-{
- device_astrocade_accessory_interface *const card(dynamic_cast<device_astrocade_accessory_interface *>(get_card_device()));
- if (card)
- {
- m_device = card;
- m_device->set_screen(m_screen);
- }
-
- m_ltpen_handler.resolve_safe();
-}
-
-void astrocade_accessory_port_device::device_start()
-{
- device_t *const card(get_card_device());
- if (card)
- {
- if (!m_device)
- {
- throw emu_fatalerror("astrocade_accessory_port_device: card device %s (%s) does not implement device_astrocade_accessory_interface\n", card->tag(), card->name());
- }
- }
-
- save_item(NAME(m_ltpen));
-
- m_ltpen = 0;
-
- m_ltpen_handler(0);
-}
-
-#include "lightpen.h"
-
-void astrocade_accessories(device_slot_interface &device)
-{
- device.option_add("lightpen", ASTROCADE_LIGHTPEN);
-}
diff --git a/src/devices/bus/astrocde/accessory.h b/src/devices/bus/astrocde/accessory.h
deleted file mode 100644
index d745e464cd2..00000000000
--- a/src/devices/bus/astrocde/accessory.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-#ifndef MAME_BUS_ASTROCDE_ACCESSORY_H
-#define MAME_BUS_ASTROCDE_ACCESSORY_H
-
-#pragma once
-
-#include "screen.h"
-
-
-/***************************************************************************
- FORWARD DECLARATIONS
- ***************************************************************************/
-
-class device_astrocade_accessory_interface;
-
-
-/***************************************************************************
- TYPE DEFINITIONS
- ***************************************************************************/
-
-// ======================> astrocade_accessory_port_device
-
-class astrocade_accessory_port_device : public device_t, public device_slot_interface
-{
-public:
- // construction/destruction
- template <typename T, typename U>
- astrocade_accessory_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&screen_tag, U &&opts, char const *dflt)
- : astrocade_accessory_port_device(mconfig, tag, owner, 0U)
- {
- m_screen.set_tag(std::forward<T>(screen_tag));
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- astrocade_accessory_port_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U);
- virtual ~astrocade_accessory_port_device();
-
- auto ltpen_handler() { return m_ltpen_handler.bind(); }
-
-protected:
- // device_t implementation
- virtual void device_validity_check(validity_checker &valid) const override ATTR_COLD;
- virtual void device_resolve_objects() override;
- virtual void device_start() override;
-
- int m_ltpen;
- devcb_write_line m_ltpen_handler;
- required_device<screen_device> m_screen;
-
-private:
- device_astrocade_accessory_interface *m_device;
-
- friend class device_astrocade_accessory_interface;
-};
-
-
-// ======================> device_astrocade_accessory_interface
-
-class device_astrocade_accessory_interface : public device_slot_card_interface
-{
-public:
- virtual ~device_astrocade_accessory_interface();
-
- DECLARE_WRITE_LINE_MEMBER( write_ltpen ) { m_port->m_ltpen = state; m_port->m_ltpen_handler(state); }
-
-protected:
- device_astrocade_accessory_interface(machine_config const &mconfig, device_t &device);
-
- // device_interface implementation
- virtual void interface_validity_check(validity_checker &valid) const override ATTR_COLD;
- virtual void interface_pre_start() override;
-
- void set_screen(screen_device *screen) { m_screen = screen; }
- screen_device *m_screen;
-
-private:
- astrocade_accessory_port_device *const m_port;
-
- friend class astrocade_accessory_port_device;
-};
-
-
-/***************************************************************************
- FUNCTIONS
- ***************************************************************************/
-
-void astrocade_accessories(device_slot_interface &device);
-
-
-/***************************************************************************
- DEVICE TYPES
- ***************************************************************************/
-
-DECLARE_DEVICE_TYPE(ASTROCADE_ACCESSORY_PORT, astrocade_accessory_port_device)
-
-#endif // MAME_BUS_ASTROCDE_ACCESSORY_H
diff --git a/src/devices/bus/astrocde/cassette.cpp b/src/devices/bus/astrocde/cassette.cpp
deleted file mode 100644
index 3e4cc80deb8..00000000000
--- a/src/devices/bus/astrocde/cassette.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-//
-// Decoding is done in hardware by an external box, and decoded bits are fed to bit 0 of the controller port,
-// with sync bits being fed to bit 1. The current HLE is not remotely accurate to hardware, but works.
-
-#include "emu.h"
-#include "cassette.h"
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(ASTROCADE_CASSETTE, astrocade_cassette_device, "astrocade_cass", "Bally Astrocade Cassette")
-
-
-//**************************************************************************
-// Bally Astrocade cassette input
-//**************************************************************************
-
-astrocade_cassette_device::astrocade_cassette_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ASTROCADE_CASSETTE, tag, owner, clock)
- , device_astrocade_ctrl_interface(mconfig, *this)
- , m_cassette(*this, "cassette")
-{
-}
-
-astrocade_cassette_device::~astrocade_cassette_device()
-{
-}
-
-void astrocade_cassette_device::device_start()
-{
- save_item(NAME(m_cass_wave));
- save_item(NAME(m_cass_delta));
- save_item(NAME(m_cass_wave_ticks));
- save_item(NAME(m_cass_cycles));
- save_item(NAME(m_cass_mark));
-}
-
-void astrocade_cassette_device::device_reset()
-{
- m_cass_wave = 0.0;
- m_cass_delta = 0.0;
- m_cass_wave_ticks = 0;
- m_cass_cycles = 0;
- m_cass_mark = false;
-}
-
-uint8_t astrocade_cassette_device::read_handle()
-{
- if (m_cass_data.size())
- {
- const uint8_t data = m_cass_data.front();
- m_cass_data.pop();
- return data;
- }
- return 0;
-}
-
-uint8_t astrocade_cassette_device::read_knob()
-{
- return 0;
-}
-
-TIMER_DEVICE_CALLBACK_MEMBER(astrocade_cassette_device::check_cassette_wave)
-{
- if (m_cassette->get_state() & CASSETTE_MOTOR_DISABLED)
- return;
-
- double old_cass_wave = m_cass_wave;
- m_cass_wave = m_cassette->input();
-
- bool cycled = false;
- if (old_cass_wave != m_cass_wave)
- {
- double old_delta = m_cass_delta;
- m_cass_delta = m_cass_wave - old_cass_wave;
- if (old_delta < 0.0 && m_cass_delta > 0.0)
- {
- cycled = true;
- }
- }
-
- if (cycled)
- {
- m_cass_mark = m_cass_wave_ticks <= 30;
-
- m_cass_wave_ticks = 0;
-
- m_cass_cycles++;
- if (m_cass_mark)
- {
- if (m_cass_cycles >= 8)
- {
- m_cass_data.push(1);
- m_cass_cycles = 0;
- }
- }
- else
- {
- if (m_cass_cycles >= 4)
- {
- m_cass_data.push(0);
- m_cass_cycles = 0;
- }
- }
- }
-
- m_cass_wave_ticks++;
-}
-
-TIMER_DEVICE_CALLBACK_MEMBER(astrocade_cassette_device::pulse_cassette_clock)
-{
- if (m_cass_data.size())
- {
- write_ltpen(1);
- write_ltpen(0);
- }
-}
-
-void astrocade_cassette_device::device_add_mconfig(machine_config &config)
-{
- CASSETTE(config, m_cassette);
- m_cassette->set_default_state(CASSETTE_STOPPED);
- m_cassette->set_interface("astrocade_cass");
-
- TIMER(config, "kcs_hle").configure_periodic(FUNC(astrocade_cassette_device::check_cassette_wave), attotime::from_hz(48000));
- TIMER(config, "kcs_clk").configure_periodic(FUNC(astrocade_cassette_device::pulse_cassette_clock), attotime::from_hz(300));
-}
diff --git a/src/devices/bus/astrocde/cassette.h b/src/devices/bus/astrocde/cassette.h
deleted file mode 100644
index d36e8a1bfd7..00000000000
--- a/src/devices/bus/astrocde/cassette.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-#ifndef MAME_BUS_ASTROCDE_CASSETTE_H
-#define MAME_BUS_ASTROCDE_CASSETTE_H
-
-#pragma once
-
-#include "ctrl.h"
-#include "imagedev/cassette.h"
-#include "machine/timer.h"
-
-#include <queue>
-
-
-/***************************************************************************
- TYPE DEFINITIONS
- ***************************************************************************/
-
-// ======================> astrocade_cassette_device
-
-class astrocade_cassette_device : public device_t,
- public device_astrocade_ctrl_interface
-{
-public:
- static constexpr feature_type imperfect_features() { return feature::TAPE; }
-
- // construction/destruction
- astrocade_cassette_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U);
- virtual ~astrocade_cassette_device();
-
- // device_astrocade_ctrl_interface implementation
- virtual uint8_t read_handle() override;
- virtual uint8_t read_knob() override;
-
-protected:
- // device_t implementation
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_add_mconfig(machine_config &config) override;
-
- TIMER_DEVICE_CALLBACK_MEMBER(check_cassette_wave);
- TIMER_DEVICE_CALLBACK_MEMBER(pulse_cassette_clock);
-
-private:
- required_device<cassette_image_device> m_cassette;
- double m_cass_wave;
- double m_cass_delta;
- uint32_t m_cass_wave_ticks;
- uint32_t m_cass_cycles;
- bool m_cass_mark;
- std::queue<uint8_t> m_cass_data;
-};
-
-
-/***************************************************************************
- DEVICE TYPES
- ***************************************************************************/
-
-DECLARE_DEVICE_TYPE(ASTROCADE_CASSETTE, astrocade_cassette_device)
-
-#endif // MAME_BUS_ASTROCDE_CASSETTE_H
diff --git a/src/devices/bus/astrocde/ctrl.cpp b/src/devices/bus/astrocde/ctrl.cpp
deleted file mode 100644
index 89cd60ca6a5..00000000000
--- a/src/devices/bus/astrocde/ctrl.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-
-#include "emu.h"
-#include "ctrl.h"
-
-#include <cassert>
-
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(ASTROCADE_CTRL_PORT, astrocade_ctrl_port_device, "astrocade_ctrl_port", "Bally Astrocade Control Port")
-
-
-//**************************************************************************
-// Bally Astrocade controller interface
-//**************************************************************************
-
-device_astrocade_ctrl_interface::device_astrocade_ctrl_interface(const machine_config &mconfig, device_t &device)
- : device_slot_card_interface(mconfig, device)
- , m_port(dynamic_cast<astrocade_ctrl_port_device *>(device.owner()))
-{
-}
-
-device_astrocade_ctrl_interface::~device_astrocade_ctrl_interface()
-{
-}
-
-void device_astrocade_ctrl_interface::interface_validity_check(validity_checker &valid) const
-{
- device_slot_card_interface::interface_validity_check(valid);
-
- if (device().owner() && !m_port)
- {
- osd_printf_error("Owner device %s (%s) is not an astrocade_ctrl_port_device\n", device().owner()->tag(), device().owner()->name());
- }
-}
-
-void device_astrocade_ctrl_interface::interface_pre_start()
-{
- device_slot_card_interface::interface_pre_start();
-
- if (m_port && !m_port->started())
- throw device_missing_dependencies();
-}
-
-
-//**************************************************************************
-// Bally Astrocade controller port
-//**************************************************************************
-
-astrocade_ctrl_port_device::astrocade_ctrl_port_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ASTROCADE_CTRL_PORT, tag, owner, clock)
- , device_slot_interface(mconfig, *this)
- , m_ltpen(0)
- , m_ltpen_handler(*this)
- , m_device(nullptr)
-{
-}
-
-astrocade_ctrl_port_device::~astrocade_ctrl_port_device()
-{
-}
-
-void astrocade_ctrl_port_device::device_validity_check(validity_checker &valid) const
-{
- device_t *const card(get_card_device());
- if (card && !dynamic_cast<device_astrocade_ctrl_interface *>(card))
- {
- osd_printf_error("Card device %s (%s) does not implement device_astrocade_ctrl_interface\n", card->tag(), card->name());
- }
-}
-
-void astrocade_ctrl_port_device::device_resolve_objects()
-{
- device_astrocade_ctrl_interface *const card(dynamic_cast<device_astrocade_ctrl_interface *>(get_card_device()));
- if (card)
- m_device = card;
-
- m_ltpen_handler.resolve_safe();
-}
-
-void astrocade_ctrl_port_device::device_start()
-{
- device_t *const card(get_card_device());
- if (card)
- {
- if (!m_device)
- {
- throw emu_fatalerror("astrocade_ctrl_port_device: card device %s (%s) does not implement device_astrocade_ctrl_interface\n", card->tag(), card->name());
- }
- }
-
- save_item(NAME(m_ltpen));
-
- m_ltpen = 0;
-
- m_ltpen_handler(0);
-}
-
-uint8_t astrocade_ctrl_port_device::read_handle()
-{
- return m_device ? m_device->read_handle() : 0;
-}
-
-uint8_t astrocade_ctrl_port_device::read_knob()
-{
- return m_device ? m_device->read_knob() : 0;
-}
-
-#include "joy.h"
-#include "cassette.h"
-
-void astrocade_controllers(device_slot_interface &device)
-{
- device.option_add("joy", ASTROCADE_JOY);
- device.option_add("cassette", ASTROCADE_CASSETTE);
-}
diff --git a/src/devices/bus/astrocde/ctrl.h b/src/devices/bus/astrocde/ctrl.h
deleted file mode 100644
index 0cc34ea4dcc..00000000000
--- a/src/devices/bus/astrocde/ctrl.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-#ifndef MAME_BUS_ASTROCDE_CTRL_H
-#define MAME_BUS_ASTROCDE_CTRL_H
-
-#pragma once
-
-
-/***************************************************************************
- FORWARD DECLARATIONS
- ***************************************************************************/
-
-class device_astrocade_ctrl_interface;
-
-
-/***************************************************************************
- TYPE DEFINITIONS
- ***************************************************************************/
-
-// ======================> astrocade_ctrl_port_device
-
-class astrocade_ctrl_port_device : public device_t, public device_slot_interface
-{
-public:
- // construction/destruction
- template <typename T>
- astrocade_ctrl_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : astrocade_ctrl_port_device(mconfig, tag, owner, 0U)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- astrocade_ctrl_port_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U);
- virtual ~astrocade_ctrl_port_device();
-
- auto ltpen_handler() { return m_ltpen_handler.bind(); }
-
- uint8_t read_handle();
- uint8_t read_knob();
-
-protected:
- // device_t implementation
- virtual void device_validity_check(validity_checker &valid) const override ATTR_COLD;
- virtual void device_resolve_objects() override;
- virtual void device_start() override;
-
- int m_ltpen;
- devcb_write_line m_ltpen_handler;
-
-private:
- device_astrocade_ctrl_interface *m_device;
-
- friend class device_astrocade_ctrl_interface;
-};
-
-
-// ======================> device_astrocade_ctrl_interface
-
-class device_astrocade_ctrl_interface : public device_slot_card_interface
-{
-public:
- virtual ~device_astrocade_ctrl_interface();
-
- virtual uint8_t read_handle() { return 0; }
- virtual uint8_t read_knob() { return 0; }
-
- DECLARE_WRITE_LINE_MEMBER( write_ltpen ) { m_port->m_ltpen = state; m_port->m_ltpen_handler(state); }
-
-protected:
- device_astrocade_ctrl_interface(machine_config const &mconfig, device_t &device);
-
- // device_interface implementation
- virtual void interface_validity_check(validity_checker &valid) const override ATTR_COLD;
- virtual void interface_pre_start() override;
-
-private:
- astrocade_ctrl_port_device *const m_port;
-
- friend class astrocade_ctrl_port_device;
-};
-
-
-/***************************************************************************
- FUNCTIONS
- ***************************************************************************/
-
-void astrocade_controllers(device_slot_interface &device);
-
-
-/***************************************************************************
- DEVICE TYPES
- ***************************************************************************/
-
-DECLARE_DEVICE_TYPE(ASTROCADE_CTRL_PORT, astrocade_ctrl_port_device)
-
-#endif // MAME_BUS_ASTROCDE_CTRL_H
diff --git a/src/devices/bus/astrocde/exp.cpp b/src/devices/bus/astrocde/exp.cpp
index 9fe3c9f3fda..40b6fbecbc4 100644
--- a/src/devices/bus/astrocde/exp.cpp
+++ b/src/devices/bus/astrocde/exp.cpp
@@ -74,14 +74,6 @@ READ8_MEMBER(astrocade_exp_device::read)
return 0xff;
}
-READ8_MEMBER(astrocade_exp_device::read_io)
-{
- if (m_card)
- return m_card->read_io(space, offset);
- else
- return 0xff;
-}
-
/*-------------------------------------------------
write
-------------------------------------------------*/
@@ -91,9 +83,3 @@ WRITE8_MEMBER(astrocade_exp_device::write)
if (m_card)
m_card->write(space, offset, data);
}
-
-WRITE8_MEMBER(astrocade_exp_device::write_io)
-{
- if (m_card)
- m_card->write_io(space, offset, data);
-}
diff --git a/src/devices/bus/astrocde/exp.h b/src/devices/bus/astrocde/exp.h
index a01db130974..e6c97862224 100644
--- a/src/devices/bus/astrocde/exp.h
+++ b/src/devices/bus/astrocde/exp.h
@@ -14,8 +14,6 @@ public:
// reading and writing
virtual DECLARE_READ8_MEMBER(read) { return 0xff; }
virtual DECLARE_WRITE8_MEMBER(write) { }
- virtual DECLARE_READ8_MEMBER(read_io) { return 0xff; }
- virtual DECLARE_WRITE8_MEMBER(write_io) { }
protected:
device_astrocade_card_interface(const machine_config &mconfig, device_t &device);
@@ -48,8 +46,6 @@ public:
// reading and writing
virtual DECLARE_READ8_MEMBER(read);
virtual DECLARE_WRITE8_MEMBER(write);
- virtual DECLARE_READ8_MEMBER(read_io);
- virtual DECLARE_WRITE8_MEMBER(write_io);
protected:
bool m_card_mounted;
diff --git a/src/devices/bus/astrocde/joy.cpp b/src/devices/bus/astrocde/joy.cpp
deleted file mode 100644
index cbf75da0c5c..00000000000
--- a/src/devices/bus/astrocde/joy.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-
-#include "emu.h"
-#include "joy.h"
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(ASTROCADE_JOY, astrocade_joy_device, "astrocade_joy", "Bally Astrocade Joystick")
-
-
-//**************************************************************************
-// Bally Astrocade joystick control
-//**************************************************************************
-
-astrocade_joy_device::astrocade_joy_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ASTROCADE_JOY, tag, owner, clock)
- , device_astrocade_ctrl_interface(mconfig, *this)
- , m_handle(*this, "HANDLE")
- , m_knob(*this, "KNOB")
-{
-}
-
-astrocade_joy_device::~astrocade_joy_device()
-{
-}
-
-uint8_t astrocade_joy_device::read_handle()
-{
- return m_handle->read();
-}
-
-uint8_t astrocade_joy_device::read_knob()
-{
- return m_knob->read();
-}
-
-static INPUT_PORTS_START( astrocade_joy )
- PORT_START("HANDLE")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_8WAY
- PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_8WAY
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_8WAY
- PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_8WAY
- PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)
- PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
-
- PORT_START("KNOB")
- PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X)
-INPUT_PORTS_END
-
-ioport_constructor astrocade_joy_device::device_input_ports() const
-{
- return INPUT_PORTS_NAME( astrocade_joy );
-}
diff --git a/src/devices/bus/astrocde/joy.h b/src/devices/bus/astrocde/joy.h
deleted file mode 100644
index bb8f755c845..00000000000
--- a/src/devices/bus/astrocde/joy.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-#ifndef MAME_BUS_ASTROCDE_JOY_H
-#define MAME_BUS_ASTROCDE_JOY_H
-
-#pragma once
-
-#include "ctrl.h"
-
-/***************************************************************************
- TYPE DEFINITIONS
- ***************************************************************************/
-
-// ======================> astrocade_joy_device
-
-class astrocade_joy_device : public device_t,
- public device_astrocade_ctrl_interface
-{
-public:
- // construction/destruction
- astrocade_joy_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U);
- virtual ~astrocade_joy_device();
-
- // device_astrocade_ctrl_interface implementation
- virtual uint8_t read_handle() override;
- virtual uint8_t read_knob() override;
-
-protected:
- // device_t implementation
- virtual ioport_constructor device_input_ports() const override;
- virtual void device_start() override { }
-
-private:
- required_ioport m_handle;
- required_ioport m_knob;
-};
-
-
-/***************************************************************************
- DEVICE TYPES
- ***************************************************************************/
-
-DECLARE_DEVICE_TYPE(ASTROCADE_JOY, astrocade_joy_device)
-
-#endif // MAME_BUS_ASTROCDE_JOY_H
diff --git a/src/devices/bus/astrocde/lightpen.cpp b/src/devices/bus/astrocde/lightpen.cpp
deleted file mode 100644
index e31eed122be..00000000000
--- a/src/devices/bus/astrocde/lightpen.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-
-#include "emu.h"
-#include "lightpen.h"
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(ASTROCADE_LIGHTPEN, astrocade_lightpen_device, "astrocade_lightpen", "Bally Astrocade Light Pen")
-
-
-//**************************************************************************
-// Bally Astrocade light pen input
-//**************************************************************************
-
-astrocade_lightpen_device::astrocade_lightpen_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ASTROCADE_LIGHTPEN, tag, owner, clock)
- , device_astrocade_accessory_interface(mconfig, *this)
- , m_trigger(*this, "TRIGGER")
- , m_lightx(*this, "LIGHTX")
- , m_lighty(*this, "LIGHTY")
- , m_pen_timer(nullptr)
-{
-}
-
-astrocade_lightpen_device::~astrocade_lightpen_device()
-{
-}
-
-void astrocade_lightpen_device::device_start()
-{
- m_pen_timer = timer_alloc(TIMER_TRIGGER);
-
- save_item(NAME(m_retrigger));
-}
-
-void astrocade_lightpen_device::device_reset()
-{
- m_pen_timer->adjust(attotime::never);
- m_retrigger = false;
-}
-
-void astrocade_lightpen_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- if (id == TIMER_TRIGGER)
- {
- write_ltpen(1);
- write_ltpen(0);
- if (m_retrigger)
- m_pen_timer->adjust(m_screen->time_until_pos(m_lighty->read(), m_lightx->read()));
- else
- m_pen_timer->adjust(attotime::never);
- }
-}
-
-INPUT_CHANGED_MEMBER( astrocade_lightpen_device::trigger )
-{
- if (newval)
- {
- m_retrigger = true;
- m_pen_timer->adjust(m_screen->time_until_pos(m_lighty->read(), m_lightx->read()));
- }
- else
- {
- m_retrigger = false;
- m_pen_timer->adjust(attotime::never);
- }
-}
-
-static INPUT_PORTS_START( astrocade_lightpen )
- PORT_START("TRIGGER")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, astrocade_lightpen_device, trigger, nullptr)
- PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
-
- PORT_START("LIGHTX")
- PORT_BIT(0x1ff, 0x000, IPT_LIGHTGUN_X) PORT_MINMAX(0x000, 0x15f) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15)
-
- PORT_START("LIGHTY")
- PORT_BIT(0x0ff, 0x000, IPT_LIGHTGUN_Y) PORT_MINMAX(0x000, 0x0f0) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15)
-INPUT_PORTS_END
-
-ioport_constructor astrocade_lightpen_device::device_input_ports() const
-{
- return INPUT_PORTS_NAME( astrocade_lightpen );
-}
diff --git a/src/devices/bus/astrocde/lightpen.h b/src/devices/bus/astrocde/lightpen.h
deleted file mode 100644
index a0863d5d3e8..00000000000
--- a/src/devices/bus/astrocde/lightpen.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-#ifndef MAME_BUS_ASTROCDE_LIGHTPEN_H
-#define MAME_BUS_ASTROCDE_LIGHTPEN_H
-
-#pragma once
-
-#include "accessory.h"
-
-
-/***************************************************************************
- TYPE DEFINITIONS
- ***************************************************************************/
-
-// ======================> astrocade_lightpen_device
-
-class astrocade_lightpen_device : public device_t,
- public device_astrocade_accessory_interface
-{
-public:
- // construction/destruction
- astrocade_lightpen_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U);
- virtual ~astrocade_lightpen_device();
-
- DECLARE_INPUT_CHANGED_MEMBER( trigger );
-
-protected:
- // device_t implementation
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual ioport_constructor device_input_ports() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
-
- static const device_timer_id TIMER_TRIGGER = 0;
-
-private:
- required_ioport m_trigger;
- required_ioport m_lightx;
- required_ioport m_lighty;
- emu_timer *m_pen_timer;
- bool m_retrigger;
-};
-
-
-/***************************************************************************
- DEVICE TYPES
- ***************************************************************************/
-
-DECLARE_DEVICE_TYPE(ASTROCADE_LIGHTPEN, astrocade_lightpen_device)
-
-#endif // MAME_BUS_ASTROCDE_LIGHTPEN_H
diff --git a/src/devices/bus/astrocde/ram.cpp b/src/devices/bus/astrocde/ram.cpp
index 8f20b0256fa..36d1ed9ab77 100644
--- a/src/devices/bus/astrocde/ram.cpp
+++ b/src/devices/bus/astrocde/ram.cpp
@@ -21,10 +21,10 @@
switch and run it as a cartridge. This is useful for cartridge development.
Blue RAM -- available in 4K, 16K, and 32K. These also use an INS8154 chip,
- which has an additional $80 bytes of RAM mapped immediately after the end of
- the expansion address space (not yet implemented). This memory can't be write
- protected. The INS8154 has I/O features needed for loading tape programs into
- Blue RAM BASIC, as well as running the Blue RAM Utility cart.
+ (not yet implemented) which has an additional $80 bytes of RAM mapped
+ immediately after the end of the expansion address space. This memory
+ can't be write protected. The INS8154 has I/O features needed for loading
+ tape programs into Blue RAM BASIC, as well as running the Blue RAM Utility cart.
4K: $6000 to $6FFF (can't run VIPERSoft BASIC, because this program needs memory
past this range)
16K: $6000 to $9FFF
@@ -69,11 +69,9 @@ DEFINE_DEVICE_TYPE(ASTROCADE_RL64RAM, astrocade_rl64ram_device, "astroca
astrocade_blueram_4k_device::astrocade_blueram_4k_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_astrocade_card_interface(mconfig, *this)
- , m_write_prot(*this, "RAM_PROTECT")
- , m_ramio(*this, "ramio")
- , m_cassette(*this, "cassette")
+ : device_t(mconfig, type, tag, owner, clock),
+ device_astrocade_card_interface(mconfig, *this),
+ m_write_prot(*this, "RAM_PROTECT")
{
}
@@ -165,35 +163,7 @@ WRITE8_MEMBER(astrocade_blueram_4k_device::write)
m_ram[offset - 0x1000] = data;
}
-READ8_MEMBER(astrocade_blueram_4k_device::read_io)
-{
- return m_ramio->read_io(offset & 0x7f);
-}
-
-WRITE8_MEMBER(astrocade_blueram_4k_device::write_io)
-{
- logerror("write_io: %04x = %02x\n", offset, data);
- m_ramio->write_io(offset & 0x7f, data);
-}
-
-uint8_t astrocade_blueram_4k_device::porta_r()
-{
- return 0;
-}
-
-uint8_t astrocade_blueram_4k_device::portb_r()
-{
- return m_cassette->input() > 0.0 ? 1 : 0;
-}
-
-void astrocade_blueram_4k_device::porta_w(uint8_t data)
-{
-}
-void astrocade_blueram_4k_device::portb_w(uint8_t data)
-{
- m_cassette->output(BIT(data, 0) ? +1 : -1);
-}
// Viper System 1 expansion has RAM in 0x6000-0x9fff
READ8_MEMBER(astrocade_viper_sys1_device::read)
@@ -237,20 +207,3 @@ WRITE8_MEMBER(astrocade_rl64ram_device::write)
if (!m_write_prot->read())
m_ram[offset] = data;
}
-
-/*-------------------------------------------------
- machine configuration
- -------------------------------------------------*/
-
-void astrocade_blueram_4k_device::device_add_mconfig(machine_config &config)
-{
- CASSETTE(config, m_cassette);
- m_cassette->set_default_state(CASSETTE_STOPPED);
- m_cassette->set_interface("astrocade_cass");
-
- INS8154(config, m_ramio);
- m_ramio->out_a().set(FUNC(astrocade_blueram_4k_device::porta_w));
- m_ramio->out_b().set(FUNC(astrocade_blueram_4k_device::portb_w));
- m_ramio->in_a().set(FUNC(astrocade_blueram_4k_device::porta_r));
- m_ramio->in_b().set(FUNC(astrocade_blueram_4k_device::portb_r));
-}
diff --git a/src/devices/bus/astrocde/ram.h b/src/devices/bus/astrocde/ram.h
index ee5ed884ef4..83f9483d2e8 100644
--- a/src/devices/bus/astrocde/ram.h
+++ b/src/devices/bus/astrocde/ram.h
@@ -6,8 +6,6 @@
#pragma once
#include "exp.h"
-#include "imagedev/cassette.h"
-#include "machine/ins8154.h"
// ======================> astrocade_blueram_4k_device
@@ -24,25 +22,15 @@ public:
// reading and writing
virtual DECLARE_READ8_MEMBER(read) override;
virtual DECLARE_WRITE8_MEMBER(write) override;
- virtual DECLARE_READ8_MEMBER(read_io) override;
- virtual DECLARE_WRITE8_MEMBER(write_io) override;
-
- uint8_t porta_r();
- uint8_t portb_r();
- void porta_w(uint8_t data);
- void portb_w(uint8_t data);
protected:
astrocade_blueram_4k_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_start() override { m_ram.resize(0x1000); save_item(NAME(m_ram)); }
virtual void device_reset() override { }
- virtual void device_add_mconfig(machine_config &config) override;
std::vector<uint8_t> m_ram;
required_ioport m_write_prot;
- required_device<ins8154_device> m_ramio;
- required_device<cassette_image_device> m_cassette;
};
// ======================> astrocade_blueram_16k_device
diff --git a/src/devices/bus/astrocde/rom.cpp b/src/devices/bus/astrocde/rom.cpp
index bb5d6912fc2..fcebedfc81d 100644
--- a/src/devices/bus/astrocde/rom.cpp
+++ b/src/devices/bus/astrocde/rom.cpp
@@ -17,10 +17,9 @@
// astrocade_rom_device - constructor
//-------------------------------------------------
-DEFINE_DEVICE_TYPE(ASTROCADE_ROM_STD, astrocade_rom_device, "astrocade_rom", "Bally Astrocade Standard Carts")
-DEFINE_DEVICE_TYPE(ASTROCADE_ROM_256K, astrocade_rom_256k_device, "astrocade_rom_256k", "Bally Astrocade 256K Carts")
-DEFINE_DEVICE_TYPE(ASTROCADE_ROM_512K, astrocade_rom_512k_device, "astrocade_rom_512k", "Bally Astrocade 512K Carts")
-DEFINE_DEVICE_TYPE(ASTROCADE_ROM_CASS, astrocade_rom_cass_device, "astrocade_rom_cass", "Bally Astrocade AstroBASIC Cart")
+DEFINE_DEVICE_TYPE(ASTROCADE_ROM_STD, astrocade_rom_device, "astrocade_rom", "Bally Astrocade Standard Carts")
+DEFINE_DEVICE_TYPE(ASTROCADE_ROM_256K, astrocade_rom_256k_device, "astrocade_256k", "Bally Astrocade 256K Carts")
+DEFINE_DEVICE_TYPE(ASTROCADE_ROM_512K, astrocade_rom_512k_device, "astrocade_512k", "Bally Astrocade 512K Carts")
astrocade_rom_device::astrocade_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
@@ -43,12 +42,6 @@ astrocade_rom_512k_device::astrocade_rom_512k_device(const machine_config &mconf
{
}
-astrocade_rom_cass_device::astrocade_rom_cass_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : astrocade_rom_device(mconfig, ASTROCADE_ROM_CASS, tag, owner, clock)
- , m_cassette(*this, "cassette")
-{
-}
-
void astrocade_rom_256k_device::device_start()
{
@@ -102,31 +95,3 @@ READ8_MEMBER(astrocade_rom_512k_device::read_rom)
else // 0x3fc0-0x3fff
return m_base_bank = offset & 0x7f;
}
-
-READ8_MEMBER(astrocade_rom_cass_device::read_rom)
-{
- if (offset < m_rom_size)
- return m_rom[offset];
- else if ((offset & 0x1c00) == 0x1800)
- {
- m_cassette->output(+1);
- return 0xff;
- }
- else if ((offset & 0x1c00) == 0x1c00)
- {
- m_cassette->output(-1);
- return m_cassette->input() > 0.0 ? 0 : 1;
- }
- return 0xff;
-}
-
-/*-------------------------------------------------
- mapper specific device configuration
- -------------------------------------------------*/
-
-void astrocade_rom_cass_device::device_add_mconfig(machine_config &config)
-{
- CASSETTE(config, m_cassette);
- m_cassette->set_default_state(CASSETTE_STOPPED);
- m_cassette->set_interface("astrocade_cass");
-}
diff --git a/src/devices/bus/astrocde/rom.h b/src/devices/bus/astrocde/rom.h
index efd17b16ded..0471ada8dd1 100644
--- a/src/devices/bus/astrocde/rom.h
+++ b/src/devices/bus/astrocde/rom.h
@@ -6,7 +6,6 @@
#pragma once
#include "slot.h"
-#include "imagedev/cassette.h"
// ======================> astrocade_rom_device
@@ -65,30 +64,10 @@ private:
uint8_t m_base_bank;
};
-// ======================> astrocade_rom_cass_device
-
-class astrocade_rom_cass_device : public astrocade_rom_device
-{
-public:
- // construction/destruction
- astrocade_rom_cass_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- // reading and writing
- virtual DECLARE_READ8_MEMBER(read_rom) override;
-
-private:
- virtual void device_start() override { }
- virtual void device_reset() override { }
- virtual void device_add_mconfig(machine_config &config) override;
-
- required_device<cassette_image_device> m_cassette;
-};
-
// device type definition
DECLARE_DEVICE_TYPE(ASTROCADE_ROM_STD, astrocade_rom_device)
DECLARE_DEVICE_TYPE(ASTROCADE_ROM_256K, astrocade_rom_256k_device)
DECLARE_DEVICE_TYPE(ASTROCADE_ROM_512K, astrocade_rom_512k_device)
-DECLARE_DEVICE_TYPE(ASTROCADE_ROM_CASS, astrocade_rom_cass_device)
#endif // MAME_BUS_ASTROCADE_ROM_H
diff --git a/src/devices/bus/astrocde/slot.cpp b/src/devices/bus/astrocde/slot.cpp
index 2aa78be98d9..b83b8e576ad 100644
--- a/src/devices/bus/astrocde/slot.cpp
+++ b/src/devices/bus/astrocde/slot.cpp
@@ -104,8 +104,7 @@ static const astrocade_slot slot_list[] =
{
{ ASTROCADE_STD, "rom" },
{ ASTROCADE_256K, "rom_256k" },
- { ASTROCADE_512K, "rom_512k" },
- { ASTROCADE_CASS, "rom_cass" }
+ { ASTROCADE_512K, "rom_512k" }
};
static int astrocade_get_pcb_id(const char *slot)
diff --git a/src/devices/bus/astrocde/slot.h b/src/devices/bus/astrocde/slot.h
index 419f4672985..88c34fa0d8e 100644
--- a/src/devices/bus/astrocde/slot.h
+++ b/src/devices/bus/astrocde/slot.h
@@ -19,8 +19,7 @@ enum
{
ASTROCADE_STD = 0,
ASTROCADE_256K,
- ASTROCADE_512K,
- ASTROCADE_CASS
+ ASTROCADE_512K
};
diff --git a/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp b/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp
index 41e9bc0e8cb..43cabfdfec3 100644
--- a/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp
+++ b/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp
@@ -92,18 +92,18 @@ void bbc_1mhzbus_slot_device::device_reset()
// read
//-------------------------------------------------
-uint8_t bbc_1mhzbus_slot_device::fred_r(offs_t offset)
+READ8_MEMBER(bbc_1mhzbus_slot_device::fred_r)
{
if (m_card)
- return m_card->fred_r(offset);
+ return m_card->fred_r(space, offset);
else
return 0xff;
}
-uint8_t bbc_1mhzbus_slot_device::jim_r(offs_t offset)
+READ8_MEMBER(bbc_1mhzbus_slot_device::jim_r)
{
if (m_card)
- return m_card->jim_r(offset);
+ return m_card->jim_r(space, offset);
else
return 0xff;
}
@@ -112,16 +112,16 @@ uint8_t bbc_1mhzbus_slot_device::jim_r(offs_t offset)
// write
//-------------------------------------------------
-void bbc_1mhzbus_slot_device::fred_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_1mhzbus_slot_device::fred_w)
{
if (m_card)
- m_card->fred_w(offset, data);
+ m_card->fred_w(space, offset, data);
}
-void bbc_1mhzbus_slot_device::jim_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_1mhzbus_slot_device::jim_w)
{
if (m_card)
- m_card->jim_w(offset, data);
+ m_card->jim_w(space, offset, data);
}
//-------------------------------------------------
@@ -142,7 +142,6 @@ void bbc_1mhzbus_slot_device::jim_w(offs_t offset, uint8_t data)
//#include "graduate.h"
#include "beebsid.h"
//#include "prisma3.h"
-#include "sprite.h"
#include "cfa3000opt.h"
@@ -162,7 +161,6 @@ void bbc_1mhzbus_devices(device_slot_interface &device)
//device.option_add("graduate", BBC_GRADUATE); /* The Torch Graduate G400/G800 */
device.option_add("beebsid", BBC_BEEBSID); /* BeebSID */
//device.option_add("prisma3", BBC_PRISMA3); /* PRISMA-3 - Millipede 1989 */
- device.option_add("sprite", BBC_SPRITE); /* Logotron Sprite Board */
}
void bbcm_1mhzbus_devices(device_slot_interface &device)
@@ -185,6 +183,5 @@ void bbcm_1mhzbus_devices(device_slot_interface &device)
//device.option_add("graduate", BBC_GRADUATE); /* The Torch Graduate G400/G800 */
device.option_add("beebsid", BBC_BEEBSID); /* BeebSID */
//device.option_add("prisma3", BBC_PRISMA3); /* PRISMA-3 - Millipede 1989 */
- device.option_add("sprite", BBC_SPRITE); /* Logotron Sprite Board */
device.option_add("cfa3000opt", CFA3000_OPT); /* Henson CFA 3000 Option Board */
}
diff --git a/src/devices/bus/bbc/1mhzbus/1mhzbus.h b/src/devices/bus/bbc/1mhzbus/1mhzbus.h
index 80e48425973..ad435876bf0 100644
--- a/src/devices/bus/bbc/1mhzbus/1mhzbus.h
+++ b/src/devices/bus/bbc/1mhzbus/1mhzbus.h
@@ -107,10 +107,10 @@ public:
auto irq_handler() { return m_irq_handler.bind(); }
auto nmi_handler() { return m_nmi_handler.bind(); }
- virtual uint8_t fred_r(offs_t offset);
- virtual void fred_w(offs_t offset, uint8_t data);
- virtual uint8_t jim_r(offs_t offset);
- virtual void jim_w(offs_t offset, uint8_t data);
+ virtual DECLARE_READ8_MEMBER(fred_r);
+ virtual DECLARE_WRITE8_MEMBER(fred_w);
+ virtual DECLARE_READ8_MEMBER(jim_r);
+ virtual DECLARE_WRITE8_MEMBER(jim_w);
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_handler(state); }
DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); }
@@ -134,10 +134,10 @@ private:
class device_bbc_1mhzbus_interface : public device_slot_card_interface
{
public:
- virtual uint8_t fred_r(offs_t offset) { return 0xff; }
- virtual void fred_w(offs_t offset, uint8_t data) { }
- virtual uint8_t jim_r(offs_t offset) { return 0xff; }
- virtual void jim_w(offs_t offset, uint8_t data) { }
+ virtual DECLARE_READ8_MEMBER(fred_r) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(fred_w) { }
+ virtual DECLARE_READ8_MEMBER(jim_r) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(jim_w) { }
protected:
device_bbc_1mhzbus_interface(const machine_config &mconfig, device_t &device);
diff --git a/src/devices/bus/bbc/1mhzbus/beebsid.cpp b/src/devices/bus/bbc/1mhzbus/beebsid.cpp
index d50449ede99..c0e6ea62c46 100644
--- a/src/devices/bus/bbc/1mhzbus/beebsid.cpp
+++ b/src/devices/bus/bbc/1mhzbus/beebsid.cpp
@@ -65,40 +65,40 @@ void bbc_beebsid_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_beebsid_device::fred_r(offs_t offset)
+READ8_MEMBER(bbc_beebsid_device::fred_r)
{
uint8_t data = 0xff;
if (offset >= 0x20 && offset < 0x40)
{
- data = m_sid->read(offset);
+ data = m_sid->read(space, offset);
}
- data &= m_1mhzbus->fred_r(offset);
+ data &= m_1mhzbus->fred_r(space, offset);
return data;
}
-void bbc_beebsid_device::fred_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_beebsid_device::fred_w)
{
if (offset >= 0x20 && offset < 0x40)
{
- m_sid->write(offset, data);
+ m_sid->write(space, offset, data);
}
- m_1mhzbus->fred_w(offset, data);
+ m_1mhzbus->fred_w(space, offset, data);
}
-uint8_t bbc_beebsid_device::jim_r(offs_t offset)
+READ8_MEMBER(bbc_beebsid_device::jim_r)
{
uint8_t data = 0xff;
- data &= m_1mhzbus->jim_r(offset);
+ data &= m_1mhzbus->jim_r(space, offset);
return data;
}
-void bbc_beebsid_device::jim_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_beebsid_device::jim_w)
{
- m_1mhzbus->jim_w(offset, data);
+ m_1mhzbus->jim_w(space, offset, data);
}
diff --git a/src/devices/bus/bbc/1mhzbus/beebsid.h b/src/devices/bus/bbc/1mhzbus/beebsid.h
index 107e875abde..d78d5486c10 100644
--- a/src/devices/bus/bbc/1mhzbus/beebsid.h
+++ b/src/devices/bus/bbc/1mhzbus/beebsid.h
@@ -34,10 +34,10 @@ protected:
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
- virtual uint8_t fred_r(offs_t offset) override;
- virtual void fred_w(offs_t offset, uint8_t data) override;
- virtual uint8_t jim_r(offs_t offset) override;
- virtual void jim_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(fred_r) override;
+ virtual DECLARE_WRITE8_MEMBER(fred_w) override;
+ virtual DECLARE_READ8_MEMBER(jim_r) override;
+ virtual DECLARE_WRITE8_MEMBER(jim_w) override;
private:
required_device<bbc_1mhzbus_slot_device> m_1mhzbus;
diff --git a/src/devices/bus/bbc/1mhzbus/cfa3000opt.cpp b/src/devices/bus/bbc/1mhzbus/cfa3000opt.cpp
index e5ac755e006..0946d9cdf82 100644
--- a/src/devices/bus/bbc/1mhzbus/cfa3000opt.cpp
+++ b/src/devices/bus/bbc/1mhzbus/cfa3000opt.cpp
@@ -98,7 +98,7 @@ void cfa3000_opt_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t cfa3000_opt_device::fred_r(offs_t offset)
+READ8_MEMBER(cfa3000_opt_device::fred_r)
{
uint8_t data = 0xff;
diff --git a/src/devices/bus/bbc/1mhzbus/cfa3000opt.h b/src/devices/bus/bbc/1mhzbus/cfa3000opt.h
index 64913e95604..5a4e413754b 100644
--- a/src/devices/bus/bbc/1mhzbus/cfa3000opt.h
+++ b/src/devices/bus/bbc/1mhzbus/cfa3000opt.h
@@ -35,7 +35,7 @@ protected:
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t fred_r(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(fred_r) override;
private:
required_ioport m_opt;
diff --git a/src/devices/bus/bbc/1mhzbus/emrmidi.cpp b/src/devices/bus/bbc/1mhzbus/emrmidi.cpp
index 6cfbacf23da..9c7c036f44c 100644
--- a/src/devices/bus/bbc/1mhzbus/emrmidi.cpp
+++ b/src/devices/bus/bbc/1mhzbus/emrmidi.cpp
@@ -81,23 +81,23 @@ void bbc_emrmidi_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_emrmidi_device::fred_r(offs_t offset)
+READ8_MEMBER(bbc_emrmidi_device::fred_r)
{
uint8_t data = 0xff;
if (offset >= 0xf0 && offset < 0xf2)
{
- data = m_acia->read(offset & 1);
+ data = m_acia->read(space, offset & 1);
}
return data;
}
-void bbc_emrmidi_device::fred_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_emrmidi_device::fred_w)
{
if (offset >= 0xf0 && offset < 0xf2)
{
- m_acia->write(offset & 1, data);
+ m_acia->write(space, offset & 1, data);
}
}
diff --git a/src/devices/bus/bbc/1mhzbus/emrmidi.h b/src/devices/bus/bbc/1mhzbus/emrmidi.h
index 341e487ce24..bbc41992948 100644
--- a/src/devices/bus/bbc/1mhzbus/emrmidi.h
+++ b/src/devices/bus/bbc/1mhzbus/emrmidi.h
@@ -36,8 +36,8 @@ protected:
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
- virtual uint8_t fred_r(offs_t offset) override;
- virtual void fred_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(fred_r) override;
+ virtual DECLARE_WRITE8_MEMBER(fred_w) override;
private:
DECLARE_WRITE_LINE_MEMBER(write_acia_clock);
diff --git a/src/devices/bus/bbc/1mhzbus/ieee488.cpp b/src/devices/bus/bbc/1mhzbus/ieee488.cpp
index 3aae6fe2f54..383ceef537b 100644
--- a/src/devices/bus/bbc/1mhzbus/ieee488.cpp
+++ b/src/devices/bus/bbc/1mhzbus/ieee488.cpp
@@ -54,8 +54,7 @@ ROM_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void bbc_ieee488_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(bbc_ieee488_device::device_add_mconfig)
TMS9914(config, m_tms9914, 5_MHz_XTAL);
m_tms9914->int_write_cb().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::irq_w));
m_tms9914->dio_read_cb().set(IEEE488_TAG, FUNC(ieee488_device::dio_r));
@@ -68,25 +67,23 @@ void bbc_ieee488_device::device_add_mconfig(machine_config &config)
m_tms9914->srq_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_srq_w));
m_tms9914->atn_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_atn_w));
m_tms9914->ren_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ren_w));
-
- IEEE488(config, m_ieee);
- m_ieee->eoi_callback().set(m_tms9914, FUNC(tms9914_device::eoi_w));
- m_ieee->dav_callback().set(m_tms9914, FUNC(tms9914_device::dav_w));
- m_ieee->nrfd_callback().set(m_tms9914, FUNC(tms9914_device::nrfd_w));
- m_ieee->ndac_callback().set(m_tms9914, FUNC(tms9914_device::ndac_w));
- m_ieee->ifc_callback().set(m_tms9914, FUNC(tms9914_device::ifc_w));
- m_ieee->srq_callback().set(m_tms9914, FUNC(tms9914_device::srq_w));
- m_ieee->atn_callback().set(m_tms9914, FUNC(tms9914_device::atn_w));
- m_ieee->ren_callback().set(m_tms9914, FUNC(tms9914_device::ren_w));
- IEEE488_SLOT(config, "ieee_dev", 0, cbm_ieee488_devices, nullptr);
+ MCFG_IEEE488_BUS_ADD()
+ MCFG_IEEE488_EOI_CALLBACK(WRITELINE(m_tms9914, tms9914_device, eoi_w))
+ MCFG_IEEE488_DAV_CALLBACK(WRITELINE(m_tms9914, tms9914_device, dav_w))
+ MCFG_IEEE488_NRFD_CALLBACK(WRITELINE(m_tms9914, tms9914_device, nrfd_w))
+ MCFG_IEEE488_NDAC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ndac_w))
+ MCFG_IEEE488_IFC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ifc_w))
+ MCFG_IEEE488_SRQ_CALLBACK(WRITELINE(m_tms9914, tms9914_device, srq_w))
+ MCFG_IEEE488_ATN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, atn_w))
+ MCFG_IEEE488_REN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ren_w))
+ MCFG_IEEE488_SLOT_ADD("ieee_dev", 0, cbm_ieee488_devices, nullptr)
BBC_1MHZBUS_SLOT(config, m_1mhzbus, DERIVED_CLOCK(1, 1), bbc_1mhzbus_devices, nullptr);
m_1mhzbus->irq_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::irq_w));
m_1mhzbus->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::nmi_w));
-}
+MACHINE_CONFIG_END
-void bbc_b488_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(bbc_b488_device::device_add_mconfig)
TMS9914(config, m_tms9914, 5_MHz_XTAL); // TODO: verify clock
m_tms9914->int_write_cb().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::irq_w));
m_tms9914->dio_read_cb().set(IEEE488_TAG, FUNC(ieee488_device::dio_r));
@@ -99,37 +96,35 @@ void bbc_b488_device::device_add_mconfig(machine_config &config)
m_tms9914->srq_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_srq_w));
m_tms9914->atn_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_atn_w));
m_tms9914->ren_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ren_w));
-
- IEEE488(config, m_ieee);
- m_ieee->eoi_callback().set(m_tms9914, FUNC(tms9914_device::eoi_w));
- m_ieee->dav_callback().set(m_tms9914, FUNC(tms9914_device::dav_w));
- m_ieee->nrfd_callback().set(m_tms9914, FUNC(tms9914_device::nrfd_w));
- m_ieee->ndac_callback().set(m_tms9914, FUNC(tms9914_device::ndac_w));
- m_ieee->ifc_callback().set(m_tms9914, FUNC(tms9914_device::ifc_w));
- m_ieee->srq_callback().set(m_tms9914, FUNC(tms9914_device::srq_w));
- m_ieee->atn_callback().set(m_tms9914, FUNC(tms9914_device::atn_w));
- m_ieee->ren_callback().set(m_tms9914, FUNC(tms9914_device::ren_w));
- IEEE488_SLOT(config, "ieee_dev", 0, cbm_ieee488_devices, nullptr);
+ MCFG_IEEE488_BUS_ADD()
+ MCFG_IEEE488_EOI_CALLBACK(WRITELINE(m_tms9914, tms9914_device, eoi_w))
+ MCFG_IEEE488_DAV_CALLBACK(WRITELINE(m_tms9914, tms9914_device, dav_w))
+ MCFG_IEEE488_NRFD_CALLBACK(WRITELINE(m_tms9914, tms9914_device, nrfd_w))
+ MCFG_IEEE488_NDAC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ndac_w))
+ MCFG_IEEE488_IFC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ifc_w))
+ MCFG_IEEE488_SRQ_CALLBACK(WRITELINE(m_tms9914, tms9914_device, srq_w))
+ MCFG_IEEE488_ATN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, atn_w))
+ MCFG_IEEE488_REN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ren_w))
+ MCFG_IEEE488_SLOT_ADD("ieee_dev", 0, cbm_ieee488_devices, nullptr)
// TODO: LED's for ATN, TALK, and DATA
-}
+MACHINE_CONFIG_END
-//void bbc_procyon_device::device_add_mconfig(machine_config &config)
-//{
+//MACHINE_CONFIG_START(bbc_procyon_device::device_add_mconfig)
// TODO: Implement MC68488
- //IEEE488(config, m_ieee);
- //m_ieee->eoi_callback(m_mc68488, FUNC(mc68488_device::eoi_w));
- //m_ieee->dav_callback(m_mc68488, FUNC(mc68488_device::dav_w));
- //m_ieee->nrfd_callback(m_mc68488, FUNC(mc68488_device::nrfd_w));
- //m_ieee->ndac_callback(m_mc68488, FUNC(mc68488_device::ndac_w));
- //m_ieee->ifc_callback(m_mc68488, FUNC(mc68488_device::ifc_w));
- //m_ieee->srq_callback(m_mc68488, FUNC(mc68488_device::srq_w));
- //m_ieee->atn_callback(m_mc68488, FUNC(mc68488_device::atn_w));
- //m_ieee->ren_callback(m_mc68488, FUNC(mc68488_device::ren_w));
- //IEEE488_SLOT(config, "ieee_dev", 0, cbm_ieee488_devices, nullptr);
+ //MCFG_IEEE488_BUS_ADD()
+ //MCFG_IEEE488_EOI_CALLBACK(WRITELINE(m_mc68488, mc68488_device, eoi_w))
+ //MCFG_IEEE488_DAV_CALLBACK(WRITELINE(m_mc68488, mc68488_device, dav_w))
+ //MCFG_IEEE488_NRFD_CALLBACK(WRITELINE(m_mc68488, mc68488_device, nrfd_w))
+ //MCFG_IEEE488_NDAC_CALLBACK(WRITELINE(m_mc68488, mc68488_device, ndac_w))
+ //MCFG_IEEE488_IFC_CALLBACK(WRITELINE(m_mc68488, mc68488_device, ifc_w))
+ //MCFG_IEEE488_SRQ_CALLBACK(WRITELINE(m_mc68488, mc68488_device, srq_w))
+ //MCFG_IEEE488_ATN_CALLBACK(WRITELINE(m_mc68488, mc68488_device, atn_w))
+ //MCFG_IEEE488_REN_CALLBACK(WRITELINE(m_mc68488, mc68488_device, ren_w))
+ //MCFG_IEEE488_SLOT_ADD("ieee_dev", 0, cbm_ieee488_devices, nullptr)
// TODO: LED's for Bus Active, Byte Out, and Byte In
-//}
+//MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -197,82 +192,82 @@ void bbc_b488_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_ieee488_device::fred_r(offs_t offset)
+READ8_MEMBER(bbc_ieee488_device::fred_r)
{
uint8_t data = 0xff;
if (offset >= 0x20 && offset < 0x28)
{
- data = m_tms9914->read(offset & 0x07);
+ data = m_tms9914->reg8_r(space, offset & 0x07);
}
- data &= m_1mhzbus->fred_r(offset);
+ data &= m_1mhzbus->fred_r(space, offset);
return data;
}
-void bbc_ieee488_device::fred_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_ieee488_device::fred_w)
{
if (offset >= 0x20 && offset < 0x28)
{
- m_tms9914->write(offset & 0x07, data);
+ m_tms9914->reg8_w(space, offset & 0x07, data);
}
- m_1mhzbus->fred_w(offset, data);
+ m_1mhzbus->fred_w(space, offset, data);
}
-uint8_t bbc_ieee488_device::jim_r(offs_t offset)
+READ8_MEMBER(bbc_ieee488_device::jim_r)
{
uint8_t data = 0xff;
- data &= m_1mhzbus->jim_r(offset);
+ data &= m_1mhzbus->jim_r(space, offset);
return data;
}
-void bbc_ieee488_device::jim_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_ieee488_device::jim_w)
{
- m_1mhzbus->jim_w(offset, data);
+ m_1mhzbus->jim_w(space, offset, data);
}
-uint8_t bbc_b488_device::fred_r(offs_t offset)
+READ8_MEMBER(bbc_b488_device::fred_r)
{
uint8_t data = 0xff;
if (offset >= 0x20 && offset < 0x28)
{
- data = m_tms9914->read(offset & 0x07);
+ data = m_tms9914->reg8_r(space, offset & 0x07);
}
return data;
}
-void bbc_b488_device::fred_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_b488_device::fred_w)
{
if (offset >= 0x20 && offset < 0x28)
{
- m_tms9914->write(offset & 0x07, data);
+ m_tms9914->reg8_w(space, offset & 0x07, data);
}
}
-//uint8_t bbc_procyon_device::fred_r(offs_t offset)
+//READ8_MEMBER(bbc_procyon_device::fred_r)
//{
//uint8_t data = 0xff;
//if (offset >= 0x20 && offset < 0x28)
//{
- // data = mc68488_device->read(offset & 0x07);
+ // data = mc68488_device->reg8_r(space, offset & 0x07);
//}
//return data;
//}
-//void bbc_procyon_device::fred_w(offs_t offset, uint8_t data)
+//WRITE8_MEMBER(bbc_procyon_device::fred_w)
//{
//if (offset >= 0x20 && offset < 0x28)
//{
- // mc68488_device->write(offset & 0x07, data);
+ // mc68488_device->reg8_w(space, offset & 0x07, data);
//}
//}
diff --git a/src/devices/bus/bbc/1mhzbus/ieee488.h b/src/devices/bus/bbc/1mhzbus/ieee488.h
index 9b810b4bf8d..05a9e60c928 100644
--- a/src/devices/bus/bbc/1mhzbus/ieee488.h
+++ b/src/devices/bus/bbc/1mhzbus/ieee488.h
@@ -42,10 +42,10 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t fred_r(offs_t offset) override;
- virtual void fred_w(offs_t offset, uint8_t data) override;
- virtual uint8_t jim_r(offs_t offset) override;
- virtual void jim_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(fred_r) override;
+ virtual DECLARE_WRITE8_MEMBER(fred_w) override;
+ virtual DECLARE_READ8_MEMBER(jim_r) override;
+ virtual DECLARE_WRITE8_MEMBER(jim_w) override;
private:
required_device<ieee488_device> m_ieee;
@@ -69,8 +69,8 @@ protected:
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
- virtual uint8_t fred_r(offs_t offset) override;
- virtual void fred_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(fred_r) override;
+ virtual DECLARE_WRITE8_MEMBER(fred_w) override;
private:
required_device<ieee488_device> m_ieee;
@@ -94,8 +94,8 @@ private:
// virtual void device_add_mconfig(machine_config &config) override;
// virtual const tiny_rom_entry *device_rom_region() const override;
//
-// virtual uint8_t fred_r(offs_t offset) override;
-// virtual void fred_w(offs_t offset, uint8_t data) override;
+// virtual DECLARE_READ8_MEMBER(fred_r) override;
+// virtual DECLARE_WRITE8_MEMBER(fred_w) override;
//
//private:
// required_device<ieee488_device> m_ieee;
diff --git a/src/devices/bus/bbc/1mhzbus/m2000.cpp b/src/devices/bus/bbc/1mhzbus/m2000.cpp
index 8203cada22e..88a713d1ff8 100644
--- a/src/devices/bus/bbc/1mhzbus/m2000.cpp
+++ b/src/devices/bus/bbc/1mhzbus/m2000.cpp
@@ -91,7 +91,7 @@ void bbc_m2000_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_m2000_device::fred_r(offs_t offset)
+READ8_MEMBER(bbc_m2000_device::fred_r)
{
uint8_t data = 0xff;
@@ -100,59 +100,59 @@ uint8_t bbc_m2000_device::fred_r(offs_t offset)
switch (offset & 0x06)
{
case 0x00:
- data = m_acia1->read(offset & 1);
+ data = m_acia1->read(space, offset & 1);
break;
case 0x02:
- data = m_acia2->read(offset & 1);
+ data = m_acia2->read(space, offset & 1);
break;
case 0x04:
- data = m_acia3->read(offset & 1);
+ data = m_acia3->read(space, offset & 1);
break;
case 0x06:
break;
}
}
- data &= m_1mhzbus->fred_r(offset);
+ data &= m_1mhzbus->fred_r(space, offset);
return data;
}
-void bbc_m2000_device::fred_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_m2000_device::fred_w)
{
if (offset >= 0x08 && offset < 0x10)
{
switch (offset & 0x06)
{
case 0x00:
- m_acia1->write(offset & 1, data);
+ m_acia1->write(space, offset & 1, data);
break;
case 0x02:
- m_acia2->write(offset & 1, data);
+ m_acia2->write(space, offset & 1, data);
break;
case 0x04:
- m_acia3->write(offset & 1, data);
+ m_acia3->write(space, offset & 1, data);
break;
case 0x06:
break;
}
}
- m_1mhzbus->fred_w(offset, data);
+ m_1mhzbus->fred_w(space, offset, data);
}
-uint8_t bbc_m2000_device::jim_r(offs_t offset)
+READ8_MEMBER(bbc_m2000_device::jim_r)
{
uint8_t data = 0xff;
- data &= m_1mhzbus->jim_r(offset);
+ data &= m_1mhzbus->jim_r(space, offset);
return data;
}
-void bbc_m2000_device::jim_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_m2000_device::jim_w)
{
- m_1mhzbus->jim_w(offset, data);
+ m_1mhzbus->jim_w(space, offset, data);
}
WRITE_LINE_MEMBER(bbc_m2000_device::write_acia_clock)
diff --git a/src/devices/bus/bbc/1mhzbus/m2000.h b/src/devices/bus/bbc/1mhzbus/m2000.h
index eeee1034a4e..f476c92dac5 100644
--- a/src/devices/bus/bbc/1mhzbus/m2000.h
+++ b/src/devices/bus/bbc/1mhzbus/m2000.h
@@ -38,10 +38,10 @@ protected:
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
- virtual uint8_t fred_r(offs_t offset) override;
- virtual void fred_w(offs_t offset, uint8_t data) override;
- virtual uint8_t jim_r(offs_t offset) override;
- virtual void jim_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(fred_r) override;
+ virtual DECLARE_WRITE8_MEMBER(fred_w) override;
+ virtual DECLARE_READ8_MEMBER(jim_r) override;
+ virtual DECLARE_WRITE8_MEMBER(jim_w) override;
private:
DECLARE_WRITE_LINE_MEMBER(write_acia_clock);
diff --git a/src/devices/bus/bbc/1mhzbus/opus3.cpp b/src/devices/bus/bbc/1mhzbus/opus3.cpp
index 77f21ac199a..65a8a3134ec 100644
--- a/src/devices/bus/bbc/1mhzbus/opus3.cpp
+++ b/src/devices/bus/bbc/1mhzbus/opus3.cpp
@@ -159,7 +159,7 @@ void bbc_opusa_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_opus3_device::fred_r(offs_t offset)
+READ8_MEMBER(bbc_opus3_device::fred_r)
{
uint8_t data = 0xff;
@@ -175,7 +175,7 @@ uint8_t bbc_opus3_device::fred_r(offs_t offset)
return data;
}
-void bbc_opus3_device::fred_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_opus3_device::fred_w)
{
floppy_image_device *floppy = nullptr;
@@ -219,7 +219,7 @@ WRITE_LINE_MEMBER(bbc_opus3_device::fdc_drq_w)
m_slot->nmi_w((m_fdc_drq && m_fdc_ie) ? ASSERT_LINE : CLEAR_LINE);
}
-uint8_t bbc_opus3_device::jim_r(offs_t offset)
+READ8_MEMBER(bbc_opus3_device::jim_r)
{
if ((m_ramdisk_page << 8) < m_ramdisk->size())
return m_ramdisk->read((m_ramdisk_page << 8) + offset);
@@ -227,7 +227,7 @@ uint8_t bbc_opus3_device::jim_r(offs_t offset)
return 0xff;
}
-void bbc_opus3_device::jim_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_opus3_device::jim_w)
{
if ((m_ramdisk_page << 8) < m_ramdisk->size())
m_ramdisk->write((m_ramdisk_page << 8) + offset, data);
diff --git a/src/devices/bus/bbc/1mhzbus/opus3.h b/src/devices/bus/bbc/1mhzbus/opus3.h
index 7d287f1622c..ef7a2174f5c 100644
--- a/src/devices/bus/bbc/1mhzbus/opus3.h
+++ b/src/devices/bus/bbc/1mhzbus/opus3.h
@@ -39,10 +39,10 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t fred_r(offs_t offset) override;
- virtual void fred_w(offs_t offset, uint8_t data) override;
- virtual uint8_t jim_r(offs_t offset) override;
- virtual void jim_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(fred_r) override;
+ virtual DECLARE_WRITE8_MEMBER(fred_w) override;
+ virtual DECLARE_READ8_MEMBER(jim_r) override;
+ virtual DECLARE_WRITE8_MEMBER(jim_w) override;
private:
DECLARE_FLOPPY_FORMATS(floppy_formats);
diff --git a/src/devices/bus/bbc/1mhzbus/sprite.cpp b/src/devices/bus/bbc/1mhzbus/sprite.cpp
deleted file mode 100644
index ee7f5f292e7..00000000000
--- a/src/devices/bus/bbc/1mhzbus/sprite.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- Logotron Sprite Board
-
-**********************************************************************/
-
-
-#include "emu.h"
-#include "sprite.h"
-#include "screen.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(BBC_SPRITE, bbc_sprite_device, "bbc_sprite", "Logotron Sprite Board");
-
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void bbc_sprite_device::device_add_mconfig(machine_config &config)
-{
- TMS9129(config, m_vdp, 10.738635_MHz_XTAL);
- m_vdp->int_callback().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::irq_w));
- m_vdp->set_screen("screen");
- m_vdp->set_vram_size(0x4000);
-
- SCREEN(config, "screen", SCREEN_TYPE_RASTER);
-}
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// bbc_sprite_device - constructor
-//-------------------------------------------------
-
-bbc_sprite_device::bbc_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, BBC_SPRITE, tag, owner, clock)
- , device_bbc_1mhzbus_interface(mconfig, *this)
- , m_vdp(*this, "vdp")
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void bbc_sprite_device::device_start()
-{
-}
-
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void bbc_sprite_device::device_reset()
-{
-}
-
-
-//**************************************************************************
-// IMPLEMENTATION
-//**************************************************************************
-
-uint8_t bbc_sprite_device::fred_r(offs_t offset)
-{
- uint8_t data = 0xff;
-
- switch (offset)
- {
- case 0xa0:
- data = m_vdp->vram_read();
- break;
- case 0xa2:
- data = m_vdp->register_read();
- break;
- }
- return data;
-}
-
-void bbc_sprite_device::fred_w(offs_t offset, uint8_t data)
-{
- switch (offset)
- {
- case 0xa1:
- m_vdp->vram_write(data);
- break;
- case 0xa3:
- m_vdp->register_write(data);
- break;
- }
-}
diff --git a/src/devices/bus/bbc/1mhzbus/sprite.h b/src/devices/bus/bbc/1mhzbus/sprite.h
deleted file mode 100644
index 02b0cff5dc2..00000000000
--- a/src/devices/bus/bbc/1mhzbus/sprite.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- Logotron Sprite Board
-
-**********************************************************************/
-
-
-#ifndef MAME_BUS_BBC_1MHZBUS_SPRITE_H
-#define MAME_BUS_BBC_1MHZBUS_SPRITE_H
-
-#include "1mhzbus.h"
-#include "video/tms9928a.h"
-
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-class bbc_sprite_device:
- public device_t,
- public device_bbc_1mhzbus_interface
-{
-public:
- // construction/destruction
- bbc_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
- // optional information overrides
- virtual void device_add_mconfig(machine_config &config) override;
-
- virtual uint8_t fred_r(offs_t offset) override;
- virtual void fred_w(offs_t offset, uint8_t data) override;
-
-private:
- required_device<tms9129_device> m_vdp;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(BBC_SPRITE, bbc_sprite_device);
-
-
-#endif /* MAME_BUS_BBC_1MHZBUS_SPRITE_H */
diff --git a/src/devices/bus/bbc/exp/exp.cpp b/src/devices/bus/bbc/exp/exp.cpp
index 25f19746b72..d2a5cca3611 100644
--- a/src/devices/bus/bbc/exp/exp.cpp
+++ b/src/devices/bus/bbc/exp/exp.cpp
@@ -97,26 +97,26 @@ void bbc_exp_slot_device::device_reset()
// read
//-------------------------------------------------
-uint8_t bbc_exp_slot_device::fred_r(offs_t offset)
+READ8_MEMBER(bbc_exp_slot_device::fred_r)
{
if (m_card)
- return m_card->fred_r(offset);
+ return m_card->fred_r(space, offset);
else
return 0xff;
}
-uint8_t bbc_exp_slot_device::jim_r(offs_t offset)
+READ8_MEMBER(bbc_exp_slot_device::jim_r)
{
if (m_card)
- return m_card->jim_r(offset);
+ return m_card->jim_r(space, offset);
else
return 0xff;
}
-uint8_t bbc_exp_slot_device::sheila_r(offs_t offset)
+READ8_MEMBER(bbc_exp_slot_device::sheila_r)
{
if (m_card)
- return m_card->sheila_r(offset);
+ return m_card->sheila_r(space, offset);
else
return 0xfe;
}
@@ -125,32 +125,32 @@ uint8_t bbc_exp_slot_device::sheila_r(offs_t offset)
// write
//-------------------------------------------------
-void bbc_exp_slot_device::fred_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_exp_slot_device::fred_w)
{
if (m_card)
- m_card->fred_w(offset, data);
+ m_card->fred_w(space, offset, data);
}
-void bbc_exp_slot_device::jim_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_exp_slot_device::jim_w)
{
if (m_card)
- m_card->jim_w(offset, data);
+ m_card->jim_w(space, offset, data);
}
-void bbc_exp_slot_device::sheila_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_exp_slot_device::sheila_w)
{
if (m_card)
- m_card->sheila_w(offset, data);
+ m_card->sheila_w(space, offset, data);
}
//-------------------------------------------------
// pb_r
//-------------------------------------------------
-uint8_t bbc_exp_slot_device::pb_r()
+READ8_MEMBER(bbc_exp_slot_device::pb_r)
{
if (m_card)
- return 0x1f | m_card->pb_r();
+ return 0x1f | m_card->pb_r(space, 0);
else
return 0xff;
}
@@ -160,10 +160,10 @@ uint8_t bbc_exp_slot_device::pb_r()
// pb_w
//-------------------------------------------------
-void bbc_exp_slot_device::pb_w(uint8_t data)
+WRITE8_MEMBER(bbc_exp_slot_device::pb_w)
{
if (m_card)
- m_card->pb_w(data);
+ m_card->pb_w(space, 0, data);
}
//-------------------------------------------------
diff --git a/src/devices/bus/bbc/exp/exp.h b/src/devices/bus/bbc/exp/exp.h
index ef1a0174b1a..5269deb3900 100644
--- a/src/devices/bus/bbc/exp/exp.h
+++ b/src/devices/bus/bbc/exp/exp.h
@@ -75,12 +75,12 @@ public:
auto cb1_handler() { return m_cb1_handler.bind(); }
auto cb2_handler() { return m_cb2_handler.bind(); }
- uint8_t fred_r(offs_t offset);
- void fred_w(offs_t offset, uint8_t data);
- uint8_t jim_r(offs_t offset);
- void jim_w(offs_t offset, uint8_t data);
- uint8_t sheila_r(offs_t offset);
- void sheila_w(offs_t offset, uint8_t data);
+ virtual DECLARE_READ8_MEMBER(fred_r);
+ virtual DECLARE_WRITE8_MEMBER(fred_w);
+ virtual DECLARE_READ8_MEMBER(jim_r);
+ virtual DECLARE_WRITE8_MEMBER(jim_w);
+ virtual DECLARE_READ8_MEMBER(sheila_r);
+ virtual DECLARE_WRITE8_MEMBER(sheila_w);
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_handler(state); }
DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); }
@@ -89,8 +89,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(cb1_w) { m_cb1_handler(state); }
DECLARE_WRITE_LINE_MEMBER(cb2_w) { m_cb2_handler(state); }
- uint8_t pb_r();
- void pb_w(uint8_t data);
+ DECLARE_READ8_MEMBER(pb_r);
+ DECLARE_WRITE8_MEMBER(pb_w);
protected:
// device-level overrides
@@ -114,15 +114,15 @@ private:
class device_bbc_exp_interface : public device_slot_card_interface
{
public:
- virtual uint8_t fred_r(offs_t offset) { return 0xff; }
- virtual void fred_w(offs_t offset, uint8_t data) { }
- virtual uint8_t jim_r(offs_t offset) { return 0xff; }
- virtual void jim_w(offs_t offset, uint8_t data) { }
- virtual uint8_t sheila_r(offs_t offset) { return 0xfe; }
- virtual void sheila_w(offs_t offset, uint8_t data) { }
-
- virtual uint8_t pb_r() { return 0xff; }
- virtual void pb_w(uint8_t data) { }
+ virtual DECLARE_READ8_MEMBER(fred_r) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(fred_w) { }
+ virtual DECLARE_READ8_MEMBER(jim_r) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(jim_w) { }
+ virtual DECLARE_READ8_MEMBER(sheila_r) { return 0xfe; }
+ virtual DECLARE_WRITE8_MEMBER(sheila_w) { }
+
+ virtual DECLARE_READ8_MEMBER(pb_r) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(pb_w) { }
protected:
device_bbc_exp_interface(const machine_config &mconfig, device_t &device);
diff --git a/src/devices/bus/bbc/exp/mertec.cpp b/src/devices/bus/bbc/exp/mertec.cpp
index ab9dc3c2f6e..8f896da0359 100644
--- a/src/devices/bus/bbc/exp/mertec.cpp
+++ b/src/devices/bus/bbc/exp/mertec.cpp
@@ -52,7 +52,7 @@ void bbc_mertec_device::device_add_mconfig(machine_config &config)
//m_pia->irq_handler().set("irqs", FUNC(input_merger_device::in_w<0>));
/* adc */
- UPD7002(config, m_upd7002, DERIVED_CLOCK(1, 8));
+ UPD7002(config, m_upd7002, 0);
m_upd7002->set_get_analogue_callback(FUNC(bbc_mertec_device::get_analogue_input), this);
m_upd7002->set_eoc_callback(FUNC(bbc_mertec_device::upd7002_eoc), this);
@@ -114,52 +114,52 @@ void bbc_mertec_device::upd7002_eoc(int data)
//m_via6522_0->write_cb1(data);
}
-uint8_t bbc_mertec_device::fred_r(offs_t offset)
+READ8_MEMBER(bbc_mertec_device::fred_r)
{
- return m_2mhzbus->fred_r(offset);
+ return m_2mhzbus->fred_r(space, offset);
}
-void bbc_mertec_device::fred_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_mertec_device::fred_w)
{
- m_2mhzbus->fred_w(offset, data);
+ m_2mhzbus->fred_w(space, offset, data);
}
-uint8_t bbc_mertec_device::jim_r(offs_t offset)
+READ8_MEMBER(bbc_mertec_device::jim_r)
{
- return m_2mhzbus->jim_r(offset);
+ return m_2mhzbus->jim_r(space, offset);
}
-void bbc_mertec_device::jim_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_mertec_device::jim_w)
{
- m_2mhzbus->jim_w(offset, data);
+ m_2mhzbus->jim_w(space, offset, data);
}
-uint8_t bbc_mertec_device::sheila_r(offs_t offset)
+READ8_MEMBER(bbc_mertec_device::sheila_r)
{
uint8_t data = 0xfe;
if (offset >= 0x18 && offset < 0x20)
{
- data = m_upd7002->read(offset & 0x03);
+ data = m_upd7002->read(space, offset & 0x03);
}
return data;
}
-void bbc_mertec_device::sheila_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_mertec_device::sheila_w)
{
if (offset >= 0x18 && offset < 0x20)
{
- m_upd7002->write(offset & 0x03, data);
+ m_upd7002->write(space, offset & 0x03, data);
}
}
-uint8_t bbc_mertec_device::pb_r()
+READ8_MEMBER(bbc_mertec_device::pb_r)
{
- return m_userport->pb_r();
+ return m_userport->pb_r(space, 0);
}
-void bbc_mertec_device::pb_w(uint8_t data)
+WRITE8_MEMBER(bbc_mertec_device::pb_w)
{
- m_userport->pb_w(data);
+ m_userport->pb_w(space, 0, data);
}
diff --git a/src/devices/bus/bbc/exp/mertec.h b/src/devices/bus/bbc/exp/mertec.h
index 33d71ab2ce9..bd87c0d5398 100644
--- a/src/devices/bus/bbc/exp/mertec.h
+++ b/src/devices/bus/bbc/exp/mertec.h
@@ -40,15 +40,15 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t fred_r(offs_t offset) override;
- virtual void fred_w(offs_t offset, uint8_t data) override;
- virtual uint8_t jim_r(offs_t offset) override;
- virtual void jim_w(offs_t offset, uint8_t data) override;
- virtual uint8_t sheila_r(offs_t offset) override;
- virtual void sheila_w(offs_t offset, uint8_t data) override;
-
- virtual uint8_t pb_r() override;
- virtual void pb_w(uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(fred_r) override;
+ virtual DECLARE_WRITE8_MEMBER(fred_w) override;
+ virtual DECLARE_READ8_MEMBER(jim_r) override;
+ virtual DECLARE_WRITE8_MEMBER(jim_w) override;
+ virtual DECLARE_READ8_MEMBER(sheila_r) override;
+ virtual DECLARE_WRITE8_MEMBER(sheila_w) override;
+
+ virtual DECLARE_READ8_MEMBER(pb_r) override;
+ virtual DECLARE_WRITE8_MEMBER(pb_w) override;
private:
int get_analogue_input(int channel_number);
diff --git a/src/devices/bus/bbc/fdc/acorn.cpp b/src/devices/bus/bbc/fdc/acorn.cpp
index 0df7b38b076..dd5d8f28559 100644
--- a/src/devices/bus/bbc/fdc/acorn.cpp
+++ b/src/devices/bus/bbc/fdc/acorn.cpp
@@ -166,30 +166,30 @@ void bbc_acorn1770_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_acorn8271_device::read(offs_t offset)
+READ8_MEMBER(bbc_acorn8271_device::read)
{
uint8_t data;
if (offset & 0x04)
{
- data = m_fdc->data_r();
+ data = m_fdc->data_r(space , 0);
}
else
{
- data = m_fdc->read(offset & 0x03);
+ data = m_fdc->read(space, offset & 0x03);
}
return data;
}
-void bbc_acorn8271_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_acorn8271_device::write)
{
if (offset & 0x04)
{
- m_fdc->data_w(data);
+ m_fdc->data_w(space, 0, data);
}
else
{
- m_fdc->write(offset & 0x03, data);
+ m_fdc->write(space, offset & 0x03, data);
}
}
@@ -207,7 +207,7 @@ WRITE_LINE_MEMBER(bbc_acorn8271_device::side_w)
}
-uint8_t bbc_acorn1770_device::read(offs_t offset)
+READ8_MEMBER(bbc_acorn1770_device::read)
{
uint8_t data = 0xff;
@@ -222,7 +222,7 @@ uint8_t bbc_acorn1770_device::read(offs_t offset)
return data;
}
-void bbc_acorn1770_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_acorn1770_device::write)
{
if (offset & 0x04)
{
diff --git a/src/devices/bus/bbc/fdc/acorn.h b/src/devices/bus/bbc/fdc/acorn.h
index 13b434b156b..951b7e33e1d 100644
--- a/src/devices/bus/bbc/fdc/acorn.h
+++ b/src/devices/bus/bbc/fdc/acorn.h
@@ -42,8 +42,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
private:
DECLARE_WRITE_LINE_MEMBER(motor_w);
@@ -70,8 +70,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
private:
DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w);
diff --git a/src/devices/bus/bbc/fdc/ams.cpp b/src/devices/bus/bbc/fdc/ams.cpp
index db9eb7e3012..02af01be5c5 100644
--- a/src/devices/bus/bbc/fdc/ams.cpp
+++ b/src/devices/bus/bbc/fdc/ams.cpp
@@ -89,30 +89,30 @@ void bbc_ams3_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_ams3_device::read(offs_t offset)
+READ8_MEMBER(bbc_ams3_device::read)
{
uint8_t data;
if (offset & 0x04)
{
- data = m_fdc->data_r();
+ data = m_fdc->data_r(space , 0);
}
else
{
- data = m_fdc->read(offset & 0x03);
+ data = m_fdc->read(space, offset & 0x03);
}
return data;
}
-void bbc_ams3_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_ams3_device::write)
{
if (offset & 0x04)
{
- m_fdc->data_w(data);
+ m_fdc->data_w(space, 0, data);
}
else
{
- m_fdc->write(offset & 0x03, data);
+ m_fdc->write(space, offset & 0x03, data);
}
}
diff --git a/src/devices/bus/bbc/fdc/ams.h b/src/devices/bus/bbc/fdc/ams.h
index 304666b5392..a97a6b762c5 100644
--- a/src/devices/bus/bbc/fdc/ams.h
+++ b/src/devices/bus/bbc/fdc/ams.h
@@ -39,8 +39,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
private:
DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w);
diff --git a/src/devices/bus/bbc/fdc/cumana.cpp b/src/devices/bus/bbc/fdc/cumana.cpp
index f4490b1922d..23cecd3ebcf 100644
--- a/src/devices/bus/bbc/fdc/cumana.cpp
+++ b/src/devices/bus/bbc/fdc/cumana.cpp
@@ -137,7 +137,7 @@ void bbc_cumanafdc_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_cumanafdc_device::read(offs_t offset)
+READ8_MEMBER(bbc_cumanafdc_device::read)
{
uint8_t data;
@@ -152,7 +152,7 @@ uint8_t bbc_cumanafdc_device::read(offs_t offset)
return data;
}
-void bbc_cumanafdc_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_cumanafdc_device::write)
{
if (offset & 0x04)
{
diff --git a/src/devices/bus/bbc/fdc/cumana.h b/src/devices/bus/bbc/fdc/cumana.h
index 6e1a4f25011..5b2439000ec 100644
--- a/src/devices/bus/bbc/fdc/cumana.h
+++ b/src/devices/bus/bbc/fdc/cumana.h
@@ -39,8 +39,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
required_device<mb8877_device> m_fdc;
required_device<floppy_connector> m_floppy0;
diff --git a/src/devices/bus/bbc/fdc/cv1797.cpp b/src/devices/bus/bbc/fdc/cv1797.cpp
index d14098a3fa3..98f54718c42 100644
--- a/src/devices/bus/bbc/fdc/cv1797.cpp
+++ b/src/devices/bus/bbc/fdc/cv1797.cpp
@@ -100,7 +100,7 @@ void bbc_cv1797_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_cv1797_device::read(offs_t offset)
+READ8_MEMBER(bbc_cv1797_device::read)
{
uint8_t data;
@@ -115,7 +115,7 @@ uint8_t bbc_cv1797_device::read(offs_t offset)
return data;
}
-void bbc_cv1797_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_cv1797_device::write)
{
if (offset & 0x04)
{
diff --git a/src/devices/bus/bbc/fdc/cv1797.h b/src/devices/bus/bbc/fdc/cv1797.h
index 86207c8fcd0..a887a1b18a4 100644
--- a/src/devices/bus/bbc/fdc/cv1797.h
+++ b/src/devices/bus/bbc/fdc/cv1797.h
@@ -40,8 +40,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
private:
DECLARE_FLOPPY_FORMATS(floppy_formats);
diff --git a/src/devices/bus/bbc/fdc/fdc.cpp b/src/devices/bus/bbc/fdc/fdc.cpp
index 2269bb3370a..10f9131351f 100644
--- a/src/devices/bus/bbc/fdc/fdc.cpp
+++ b/src/devices/bus/bbc/fdc/fdc.cpp
@@ -89,10 +89,10 @@ void bbc_fdc_slot_device::device_reset()
// read
//-------------------------------------------------
-uint8_t bbc_fdc_slot_device::read(offs_t offset)
+READ8_MEMBER(bbc_fdc_slot_device::read)
{
if (m_card)
- return m_card->read(offset);
+ return m_card->read(space, offset);
else
return 0xff;
}
@@ -101,10 +101,10 @@ uint8_t bbc_fdc_slot_device::read(offs_t offset)
// write
//-------------------------------------------------
-void bbc_fdc_slot_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_fdc_slot_device::write)
{
if (m_card)
- m_card->write(offset, data);
+ m_card->write(space, offset, data);
}
//-------------------------------------------------
diff --git a/src/devices/bus/bbc/fdc/fdc.h b/src/devices/bus/bbc/fdc/fdc.h
index 3264172a25d..0cc256961ee 100644
--- a/src/devices/bus/bbc/fdc/fdc.h
+++ b/src/devices/bus/bbc/fdc/fdc.h
@@ -41,8 +41,8 @@ public:
auto intrq_wr_callback() { return m_intrq_cb.bind(); }
auto drq_wr_callback() { return m_drq_cb.bind(); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ virtual DECLARE_READ8_MEMBER(read);
+ virtual DECLARE_WRITE8_MEMBER(write);
DECLARE_WRITE_LINE_MEMBER( intrq_w ) { m_intrq_cb(state); }
DECLARE_WRITE_LINE_MEMBER( drq_w) { m_drq_cb(state); }
@@ -66,8 +66,8 @@ private:
class device_bbc_fdc_interface : public device_slot_card_interface
{
public:
- virtual uint8_t read(offs_t offset) { return 0xff; }
- virtual void write(offs_t offset, uint8_t data) { }
+ virtual DECLARE_READ8_MEMBER(read) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write) { }
protected:
device_bbc_fdc_interface(const machine_config &mconfig, device_t &device);
diff --git a/src/devices/bus/bbc/fdc/microware.cpp b/src/devices/bus/bbc/fdc/microware.cpp
index 477ac0f3f9e..29489af382c 100644
--- a/src/devices/bus/bbc/fdc/microware.cpp
+++ b/src/devices/bus/bbc/fdc/microware.cpp
@@ -101,7 +101,7 @@ void bbc_microware_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_microware_device::read(offs_t offset)
+READ8_MEMBER(bbc_microware_device::read)
{
uint8_t data;
@@ -116,7 +116,7 @@ uint8_t bbc_microware_device::read(offs_t offset)
return data;
}
-void bbc_microware_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_microware_device::write)
{
if (offset & 0x04)
{
diff --git a/src/devices/bus/bbc/fdc/microware.h b/src/devices/bus/bbc/fdc/microware.h
index 61c0cb358cf..117159b407d 100644
--- a/src/devices/bus/bbc/fdc/microware.h
+++ b/src/devices/bus/bbc/fdc/microware.h
@@ -42,8 +42,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
private:
DECLARE_FLOPPY_FORMATS(floppy_formats);
diff --git a/src/devices/bus/bbc/fdc/opus.cpp b/src/devices/bus/bbc/fdc/opus.cpp
index f6b07df6bcb..f25de315c58 100644
--- a/src/devices/bus/bbc/fdc/opus.cpp
+++ b/src/devices/bus/bbc/fdc/opus.cpp
@@ -212,7 +212,7 @@ void bbc_opusfdc_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_opus8272_device::read(offs_t offset)
+READ8_MEMBER(bbc_opus8272_device::read)
{
uint8_t data = 0xff;
@@ -227,20 +227,20 @@ uint8_t bbc_opus8272_device::read(offs_t offset)
if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(1);
if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(1);
case 0x04:
- data = m_fdc->msr_r();
+ data = m_fdc->msr_r(space, 0);
break;
case 0x05:
if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(0);
if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(0);
case 0x07:
- data = m_fdc->fifo_r();
+ data = m_fdc->fifo_r(space, 0);
break;
}
return data;
}
-void bbc_opus8272_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_opus8272_device::write)
{
floppy_image_device *floppy = nullptr;
@@ -259,13 +259,13 @@ void bbc_opus8272_device::write(offs_t offset, uint8_t data)
if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(0);
if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(0);
case 0x07:
- m_fdc->fifo_w(data);
+ m_fdc->fifo_w(space, 0, data);
break;
}
}
-uint8_t bbc_opusfdc_device::read(offs_t offset)
+READ8_MEMBER(bbc_opusfdc_device::read)
{
uint8_t data;
@@ -280,7 +280,7 @@ uint8_t bbc_opusfdc_device::read(offs_t offset)
return data;
}
-void bbc_opusfdc_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_opusfdc_device::write)
{
if (offset & 0x04)
{
diff --git a/src/devices/bus/bbc/fdc/opus.h b/src/devices/bus/bbc/fdc/opus.h
index 033fccc02c4..721f3ebab5c 100644
--- a/src/devices/bus/bbc/fdc/opus.h
+++ b/src/devices/bus/bbc/fdc/opus.h
@@ -36,8 +36,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
private:
required_device<i8272a_device> m_fdc;
@@ -62,8 +62,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
required_device<wd_fdc_device_base> m_fdc;
required_device<floppy_connector> m_floppy0;
diff --git a/src/devices/bus/bbc/fdc/watford.cpp b/src/devices/bus/bbc/fdc/watford.cpp
index 4c3f31344ee..b888840314f 100644
--- a/src/devices/bus/bbc/fdc/watford.cpp
+++ b/src/devices/bus/bbc/fdc/watford.cpp
@@ -147,7 +147,7 @@ void bbc_weddb3_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_weddb2_device::read(offs_t offset)
+READ8_MEMBER(bbc_weddb2_device::read)
{
uint8_t data;
@@ -162,7 +162,7 @@ uint8_t bbc_weddb2_device::read(offs_t offset)
return data;
}
-void bbc_weddb2_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_weddb2_device::write)
{
if (offset & 0x04)
{
@@ -192,7 +192,7 @@ void bbc_weddb2_device::write(offs_t offset, uint8_t data)
}
}
-uint8_t bbc_weddb3_device::read(offs_t offset)
+READ8_MEMBER(bbc_weddb3_device::read)
{
uint8_t data;
@@ -207,7 +207,7 @@ uint8_t bbc_weddb3_device::read(offs_t offset)
return data;
}
-void bbc_weddb3_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_weddb3_device::write)
{
if (offset & 0x04)
{
diff --git a/src/devices/bus/bbc/fdc/watford.h b/src/devices/bus/bbc/fdc/watford.h
index 2f1cfa65c64..02bbf59f523 100644
--- a/src/devices/bus/bbc/fdc/watford.h
+++ b/src/devices/bus/bbc/fdc/watford.h
@@ -45,8 +45,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
private:
required_device<wd_fdc_device_base> m_fdc;
@@ -68,8 +68,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
private:
required_device<wd_fdc_device_base> m_fdc;
diff --git a/src/devices/bus/bbc/joyport/joyport.cpp b/src/devices/bus/bbc/joyport/joyport.cpp
index 0c1bae50ee2..5ed3f8d2fff 100644
--- a/src/devices/bus/bbc/joyport/joyport.cpp
+++ b/src/devices/bus/bbc/joyport/joyport.cpp
@@ -91,11 +91,11 @@ void bbc_joyport_slot_device::device_reset()
// pb_r
//-------------------------------------------------
-uint8_t bbc_joyport_slot_device::pb_r()
+READ8_MEMBER(bbc_joyport_slot_device::pb_r)
{
// TODO: Joyport connected to PB0-PB4 only. PB5-PB7 are expansion port.
if (m_device)
- return 0xe0 | m_device->pb_r();
+ return 0xe0 | m_device->pb_r(space, 0);
else
return 0xff;
}
@@ -105,10 +105,10 @@ uint8_t bbc_joyport_slot_device::pb_r()
// pb_w
//-------------------------------------------------
-void bbc_joyport_slot_device::pb_w(uint8_t data)
+WRITE8_MEMBER(bbc_joyport_slot_device::pb_w)
{
if (m_device)
- m_device->pb_w(data);
+ m_device->pb_w(space, 0, data);
}
diff --git a/src/devices/bus/bbc/joyport/joyport.h b/src/devices/bus/bbc/joyport/joyport.h
index 6abda62633d..572e41f7612 100644
--- a/src/devices/bus/bbc/joyport/joyport.h
+++ b/src/devices/bus/bbc/joyport/joyport.h
@@ -64,8 +64,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(cb1_w) { m_cb1_handler(state); }
DECLARE_WRITE_LINE_MEMBER(cb2_w) { m_cb2_handler(state); }
- uint8_t pb_r();
- void pb_w(uint8_t data);
+ DECLARE_READ8_MEMBER(pb_r);
+ DECLARE_WRITE8_MEMBER(pb_w);
protected:
// device-level overrides
@@ -86,8 +86,8 @@ private:
class device_bbc_joyport_interface : public device_slot_card_interface
{
public:
- virtual uint8_t pb_r() { return 0xff; }
- virtual void pb_w(uint8_t data) { }
+ virtual DECLARE_READ8_MEMBER(pb_r) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(pb_w) { }
protected:
device_bbc_joyport_interface(const machine_config &mconfig, device_t &device);
diff --git a/src/devices/bus/bbc/joyport/joystick.cpp b/src/devices/bus/bbc/joyport/joystick.cpp
index d53186f118d..5f4047c13a3 100644
--- a/src/devices/bus/bbc/joyport/joystick.cpp
+++ b/src/devices/bus/bbc/joyport/joystick.cpp
@@ -78,7 +78,7 @@ void bbcmc_joystick_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbcmc_joystick_device::pb_r()
+READ8_MEMBER(bbcmc_joystick_device::pb_r)
{
return m_joy->read();
}
diff --git a/src/devices/bus/bbc/joyport/joystick.h b/src/devices/bus/bbc/joyport/joystick.h
index 8d0cc5a0458..0e9cea22716 100644
--- a/src/devices/bus/bbc/joyport/joystick.h
+++ b/src/devices/bus/bbc/joyport/joystick.h
@@ -36,7 +36,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual uint8_t pb_r() override;
+ virtual DECLARE_READ8_MEMBER(pb_r) override;
private:
required_ioport m_joy;
diff --git a/src/devices/bus/bbc/rom/dfs.cpp b/src/devices/bus/bbc/rom/dfs.cpp
deleted file mode 100644
index 8a3aac6d588..00000000000
--- a/src/devices/bus/bbc/rom/dfs.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/***************************************************************************
-
- BBC Micro MRM E00 DFS emulation
-
- Comprises of 8K ROM and 2K/4K? RAM on a carrier board, with flying lead
- to RW line to enable writing to RAM.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "dfs.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(BBC_MRME00, bbc_mrme00_device, "bbc_mrme00", "BBC Micro MRM E00 DFS")
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// bbc_rom_device - constructor
-//-------------------------------------------------
-
-bbc_mrme00_device::bbc_mrme00_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, BBC_MRME00, tag, owner, clock)
- , device_bbc_rom_interface(mconfig, *this)
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void bbc_mrme00_device::device_start()
-{
-}
-
-//-------------------------------------------------
-// read
-//-------------------------------------------------
-
-uint8_t bbc_mrme00_device::read(offs_t offset)
-{
- if (offset < get_rom_size())
- return get_rom_base()[offset & (get_rom_size() - 1)];
- else
- return get_ram_base()[offset & (get_ram_size() - 1)];
-}
-
-//-------------------------------------------------
-// write
-//-------------------------------------------------
-
-void bbc_mrme00_device::write(offs_t offset, uint8_t data)
-{
- get_ram_base()[offset & (get_ram_size() - 1)] = data;
-}
diff --git a/src/devices/bus/bbc/rom/dfs.h b/src/devices/bus/bbc/rom/dfs.h
deleted file mode 100644
index b76a7ab26ed..00000000000
--- a/src/devices/bus/bbc/rom/dfs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/***************************************************************************
-
- BBC Micro MRM E00 DFS emulation
-
-***************************************************************************/
-
-#ifndef MAME_BUS_BBC_ROM_DFS_H
-#define MAME_BUS_BBC_ROM_DFS_H
-
-#pragma once
-
-#include "slot.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> bbc_mrme00_device
-
-class bbc_mrme00_device : public device_t,
- public device_bbc_rom_interface
-{
-public:
- // construction/destruction
- bbc_mrme00_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
-
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
-};
-
-// device type definition
-DECLARE_DEVICE_TYPE(BBC_MRME00, bbc_mrme00_device)
-
-
-#endif // MAME_BUS_BBC_ROM_DFS_H
diff --git a/src/devices/bus/bbc/rom/pal.cpp b/src/devices/bus/bbc/rom/pal.cpp
deleted file mode 100644
index 51667f70955..00000000000
--- a/src/devices/bus/bbc/rom/pal.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/***************************************************************************
-
- BBC Micro PALPROM carrier boards
-
- Computer Concepts PALPROM carrier boards (PAL16R4):
- These were the first to provide a 32K ROM banked into a 16K slot using
- a PAL to perform the switching upon reads from pre-programmed zones. In
- addition to being able to provide larger ROM based applications such
- as Inter-Word and Inter-Base, it also served as copy protection since
- the carrier board and PAL would have to be reproduced to support the
- ROM.
- Other publishers such as Beebug and PMS also used the carrier boards
- and PAL provided by Computer Concepts.
-
- Watford Electronics PALPROM carrier boards (PAL16L8):
- The PALPROM device provides a means of running 32K software within the
- space allocated to a 16K sideways ROM whilst providing a good degree of
- software protection.
- Within a PALPROM, a 32K EPROM is divided into 4 banks of 8K. These are
- arranged in a 3 plus 1 arrangement. Bank 0, which occupies &8000 to
- &9FFF is permanently enabled, whilst banks 1 to 3, which occupy the
- region &A000 to &BFFF, are swapped in one at a time. This swapping is
- made by performing an access to a special switching zone, of which there
- are 8 in total. Accessing a switching zone, which is 32 bytes in length
- and aligned to start on a 32 byte boundary, selects a pre-specified bank
- (1 to 3)
-
- P.R.E.S. PALPROM carrier boards:
- This was based on the Computer Concepts carrier board.
-
- Instant Mini Office 2:
- Not a PALPROM carrier board but a larger ROM carrier containing 4x32K
- and TTL circuits to enable and page each ROM into 16K banks.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "pal.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(BBC_CCIWORD, bbc_cciword_device, "bbc_cciword", "Computer Concepts 32K ROM Carrier (Inter-Word)")
-DEFINE_DEVICE_TYPE(BBC_CCIBASE, bbc_ccibase_device, "bbc_ccibase", "Computer Concepts 64K ROM Carrier (Inter-Base)")
-DEFINE_DEVICE_TYPE(BBC_CCISPELL, bbc_ccispell_device, "bbc_ccispell", "Computer Concepts 128K ROM Carrier (SpellMaster)")
-DEFINE_DEVICE_TYPE(BBC_PALQST, bbc_palqst_device, "bbc_palqst", "Watford Electronics ROM Carrier (Quest Paint)")
-DEFINE_DEVICE_TYPE(BBC_PALWAP, bbc_palwap_device, "bbc_palwap", "Watford Electronics ROM Carrier (Wapping Editor)")
-DEFINE_DEVICE_TYPE(BBC_PALTED, bbc_palted_device, "bbc_palted", "Watford Electronics ROM Carrier (TED)")
-DEFINE_DEVICE_TYPE(BBC_PALABEP, bbc_palabep_device, "bbc_palabep", "P.R.E.S. 32K ROM Carrier (ABE+)")
-DEFINE_DEVICE_TYPE(BBC_PALABE, bbc_palabe_device, "bbc_palabe", "P.R.E.S. 32K ROM Carrier (ABE)")
-DEFINE_DEVICE_TYPE(BBC_PALMO2, bbc_palmo2_device, "bbc_palmo2", "Instant Mini Office 2 ROM Carrier")
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// bbc_palprom_device - constructor
-//-------------------------------------------------
-
-bbc_pal_device::bbc_pal_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_bbc_rom_interface(mconfig, *this)
- , m_bank(0)
-{
-}
-
-bbc_cciword_device::bbc_cciword_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : bbc_pal_device(mconfig, BBC_CCIWORD, tag, owner, clock)
-{
-}
-
-bbc_ccibase_device::bbc_ccibase_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : bbc_pal_device(mconfig, BBC_CCIBASE, tag, owner, clock)
-{
-}
-
-bbc_ccispell_device::bbc_ccispell_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : bbc_pal_device(mconfig, BBC_CCISPELL, tag, owner, clock)
-{
-}
-
-bbc_palqst_device::bbc_palqst_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : bbc_pal_device(mconfig, BBC_PALQST, tag, owner, clock)
-{
-}
-
-bbc_palwap_device::bbc_palwap_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : bbc_pal_device(mconfig, BBC_PALWAP, tag, owner, clock)
-{
-}
-
-bbc_palted_device::bbc_palted_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : bbc_pal_device(mconfig, BBC_PALTED, tag, owner, clock)
-{
-}
-
-bbc_palabep_device::bbc_palabep_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : bbc_pal_device(mconfig, BBC_PALABEP, tag, owner, clock)
-{
-}
-
-bbc_palabe_device::bbc_palabe_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : bbc_pal_device(mconfig, BBC_PALABE, tag, owner, clock)
-{
-}
-
-bbc_palmo2_device::bbc_palmo2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : bbc_pal_device(mconfig, BBC_PALMO2, tag, owner, clock)
-{
-}
-
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void bbc_pal_device::device_start()
-{
- save_item(NAME(m_bank));
-}
-
-//-------------------------------------------------
-// read
-//-------------------------------------------------
-
-uint8_t bbc_cciword_device::read(offs_t offset)
-{
- if (!machine().side_effects_disabled())
- {
- /* switching zones for Inter-Word */
- switch (offset & 0x3fe0)
- {
- case 0x0060:
- case 0x3fc0: m_bank = 0; break;
- case 0x0040:
- case 0x3fa0:
- case 0x3fe0: m_bank = 1; break;
- }
- }
-
- return get_rom_base()[(offset & 0x3fff) | (m_bank << 14)];
-}
-
-uint8_t bbc_ccibase_device::read(offs_t offset)
-{
- if (!machine().side_effects_disabled())
- {
- /* switching zones for Inter-Base */
- switch (offset & 0x3fe0)
- {
- case 0x3f80: m_bank = 0; break;
- case 0x3fa0: m_bank = 1; break;
- case 0x3fc0: m_bank = 2; break;
- case 0x3fe0: m_bank = 3; break;
- }
- }
-
- return get_rom_base()[(offset & 0x3fff) | (m_bank << 14)];
-}
-
-uint8_t bbc_ccispell_device::read(offs_t offset)
-{
- if (!machine().side_effects_disabled())
- {
- /* switching zones for SpellMaster */
- if (offset == 0x3fe0)
- {
- m_bank = 0;
- }
- else if (m_bank == 0)
- {
- switch (offset & 0x3fe0)
- {
- case 0x3fc0: m_bank = 1; break;
- case 0x3fa0: m_bank = 2; break;
- case 0x3f80: m_bank = 3; break;
- case 0x3f60: m_bank = 4; break;
- case 0x3f40: m_bank = 5; break;
- case 0x3f20: m_bank = 6; break;
- case 0x3f00: m_bank = 7; break;
- }
- }
- }
-
- return get_rom_base()[(offset & 0x3fff) | (m_bank << 14)];
-}
-
-uint8_t bbc_palqst_device::read(offs_t offset)
-{
- if (!machine().side_effects_disabled())
- {
- /* switching zones for Quest Paint and ConQuest */
- switch (offset & 0x3fe0)
- {
- case 0x0820: m_bank = 2; break;
- case 0x11e0: m_bank = 1; break;
- case 0x12c0: m_bank = 3; break;
- case 0x1340: m_bank = 0; break;
- }
- }
-
- if (offset & 0x2000)
- {
- return get_rom_base()[(offset & 0x1fff) | (m_bank << 13)];
- }
- else
- {
- return get_rom_base()[offset & 0x1fff];
- }
-}
-
-uint8_t bbc_palwap_device::read(offs_t offset)
-{
- if (!machine().side_effects_disabled())
- {
- /* switching zones for Wapping Editor */
- switch (offset & 0x3fe0)
- {
- case 0x1f00: m_bank = 0; break;
- case 0x1f20: m_bank = 1; break;
- case 0x1f40: m_bank = 2; break;
- case 0x1f60: m_bank = 3; break;
- case 0x1f80: m_bank = 4; break;
- case 0x1fa0: m_bank = 5; break;
- case 0x1fc0: m_bank = 6; break;
- case 0x1fe0: m_bank = 7; break;
- }
- }
-
- if (offset & 0x2000)
- {
- return get_rom_base()[(offset & 0x1fff) | (m_bank << 13)];
- }
- else
- {
- return get_rom_base()[offset & 0x1fff];
- }
-}
-
-uint8_t bbc_palted_device::read(offs_t offset)
-{
- if (!machine().side_effects_disabled())
- {
- /* switching zones for TED */
- switch (offset & 0x3fe0)
- {
- case 0x1f80: m_bank = 0; break;
- case 0x1fa0: m_bank = 1; break;
- case 0x1fc0: m_bank = 2; break;
- case 0x1fe0: m_bank = 3; break;
- }
- }
-
- if (offset & 0x2000)
- {
- return get_rom_base()[(offset & 0x1fff) | (m_bank << 13)];
- }
- else
- {
- return get_rom_base()[offset & 0x1fff];
- }
-}
-
-uint8_t bbc_palabep_device::read(offs_t offset)
-{
- if (!machine().side_effects_disabled())
- {
- /* switching zones for Advanced BASIC Editor Plus */
- switch (offset & 0x3ffc)
- {
- case 0x3ff8: m_bank = 0; break;
- case 0x3ffc: m_bank = 1; break;
- }
- }
-
- return get_rom_base()[(offset & 0x3fff) | (m_bank << 14)];
-}
-
-uint8_t bbc_palabe_device::read(offs_t offset)
-{
- if (!machine().side_effects_disabled())
- {
- /* switching zones for Advanced BASIC Editor */
- switch (offset & 0x3ffc)
- {
- case 0x3ff8: m_bank = 1; break;
- case 0x3ffc: m_bank = 0; break;
- }
- }
-
- return get_rom_base()[(offset & 0x3fff) | (m_bank << 14)];
-}
-
-uint8_t bbc_palmo2_device::read(offs_t offset)
-{
- if (!machine().side_effects_disabled())
- {
- /* switching zones for Instant Mini Office 2 */
- switch (offset & 0x3ff0)
- {
- case 0x2000: m_bank = offset & 0x0f; break;
- }
- }
-
- return get_rom_base()[(offset & 0x3fff) | (m_bank << 13)];
-}
diff --git a/src/devices/bus/bbc/rom/pal.h b/src/devices/bus/bbc/rom/pal.h
deleted file mode 100644
index 31c8dcd0d78..00000000000
--- a/src/devices/bus/bbc/rom/pal.h
+++ /dev/null
@@ -1,167 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/***************************************************************************
-
- BBC Micro PALPROM carrier boards
-
-***************************************************************************/
-
-#ifndef MAME_BUS_BBC_ROM_PAL_H
-#define MAME_BUS_BBC_ROM_PAL_H
-
-#pragma once
-
-#include "slot.h"
-
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> bbc_pal_device
-
-class bbc_pal_device : public device_t,
- public device_bbc_rom_interface
-{
-protected:
- // construction/destruction
- bbc_pal_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
- // device-level overrides
- virtual void device_start() override;
-
- // device_bbc_rom_interface overrides
- virtual uint32_t get_rom_size() override { return 0x4000; }
-
- uint8_t m_bank;
-};
-
-// ======================> bbc_cciword_device
-
-class bbc_cciword_device : public bbc_pal_device
-{
-public:
- // construction/destruction
- bbc_cciword_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
-};
-
-// ======================> bbc_ccibase_device
-
-class bbc_ccibase_device : public bbc_pal_device
-{
-public:
- // construction/destruction
- bbc_ccibase_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
-};
-
-// ======================> bbc_ccispell_device
-
-class bbc_ccispell_device : public bbc_pal_device
-{
-public:
- // construction/destruction
- bbc_ccispell_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
-};
-
-// ======================> bbc_palqst_device
-
-class bbc_palqst_device : public bbc_pal_device
-{
-public:
- bbc_palqst_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
-};
-
-// ======================> bbc_palwap_device
-
-class bbc_palwap_device : public bbc_pal_device
-{
-public:
- bbc_palwap_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
-};
-
-// ======================> bbc_palted_device
-
-class bbc_palted_device : public bbc_pal_device
-{
-public:
- // construction/destruction
- bbc_palted_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
-};
-
-// ======================> bbc_palabep_device
-
-class bbc_palabep_device : public bbc_pal_device
-{
-public:
- // construction/destruction
- bbc_palabep_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
-};
-
-// ======================> bbc_palabe_device
-
-class bbc_palabe_device : public bbc_pal_device
-{
-public:
- // construction/destruction
- bbc_palabe_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
-};
-
-// ======================> bbc_palmo2_device
-
-class bbc_palmo2_device : public bbc_pal_device
-{
-public:
- // construction/destruction
- bbc_palmo2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(BBC_CCIWORD, bbc_cciword_device)
-DECLARE_DEVICE_TYPE(BBC_CCIBASE, bbc_ccibase_device)
-DECLARE_DEVICE_TYPE(BBC_CCISPELL, bbc_ccispell_device)
-DECLARE_DEVICE_TYPE(BBC_PALQST, bbc_palqst_device)
-DECLARE_DEVICE_TYPE(BBC_PALWAP, bbc_palwap_device)
-DECLARE_DEVICE_TYPE(BBC_PALTED, bbc_palted_device)
-DECLARE_DEVICE_TYPE(BBC_PALABEP, bbc_palabep_device)
-DECLARE_DEVICE_TYPE(BBC_PALABE, bbc_palabe_device)
-DECLARE_DEVICE_TYPE(BBC_PALMO2, bbc_palmo2_device)
-
-
-#endif // MAME_BUS_BBC_ROM_PAL_H
diff --git a/src/devices/bus/bbc/rom/ram.cpp b/src/devices/bus/bbc/rom/ram.cpp
deleted file mode 100644
index 0d626955812..00000000000
--- a/src/devices/bus/bbc/rom/ram.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/***************************************************************************
-
- BBC Micro Sideways RAM emulation
-
-***************************************************************************/
-
-#include "emu.h"
-#include "ram.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(BBC_RAM, bbc_ram_device, "bbc_ram", "BBC Micro Sideways RAM")
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// bbc_ram_device - constructor
-//-------------------------------------------------
-
-bbc_ram_device::bbc_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, BBC_RAM, tag, owner, clock)
- , device_bbc_rom_interface(mconfig, *this)
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void bbc_ram_device::device_start()
-{
-}
-
-//-------------------------------------------------
-// read
-//-------------------------------------------------
-
-uint8_t bbc_ram_device::read(offs_t offset)
-{
- return get_ram_base()[offset & (get_ram_size() - 1)];
-}
-
-//-------------------------------------------------
-// write
-//-------------------------------------------------
-
-void bbc_ram_device::write(offs_t offset, uint8_t data)
-{
- get_ram_base()[offset & (get_ram_size() - 1)] = data;
-}
diff --git a/src/devices/bus/bbc/rom/ram.h b/src/devices/bus/bbc/rom/ram.h
deleted file mode 100644
index 85267147a35..00000000000
--- a/src/devices/bus/bbc/rom/ram.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/***************************************************************************
-
- BBC Micro Sideways RAM emulation
-
-***************************************************************************/
-
-#ifndef MAME_BUS_BBC_ROM_RAM_H
-#define MAME_BUS_BBC_ROM_RAM_H
-
-#pragma once
-
-#include "slot.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> bbc_ram_device
-
-class bbc_ram_device : public device_t,
- public device_bbc_rom_interface
-{
-public:
- // construction/destruction
- bbc_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
-
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(BBC_RAM, bbc_ram_device)
-
-#endif // MAME_BUS_BBC_ROM_RAM_H
diff --git a/src/devices/bus/bbc/rom/rom.cpp b/src/devices/bus/bbc/rom/rom.cpp
deleted file mode 100644
index f798de11c6a..00000000000
--- a/src/devices/bus/bbc/rom/rom.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/***************************************************************************
-
- BBC Micro Sideways ROM emulation
-
-***************************************************************************/
-
-#include "emu.h"
-#include "rom.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(BBC_ROM, bbc_rom_device, "bbc_rom", "BBC Micro Sideways ROM")
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// bbc_rom_device - constructor
-//-------------------------------------------------
-
-bbc_rom_device::bbc_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, BBC_ROM, tag, owner, clock)
- , device_bbc_rom_interface(mconfig, *this)
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void bbc_rom_device::device_start()
-{
-}
-
-//-------------------------------------------------
-// read
-//-------------------------------------------------
-
-uint8_t bbc_rom_device::read(offs_t offset)
-{
- uint32_t size = std::min((int32_t)get_rom_size(), 0x4000);
-
- return get_rom_base()[offset & (size - 1)];
-}
diff --git a/src/devices/bus/bbc/rom/rom.h b/src/devices/bus/bbc/rom/rom.h
deleted file mode 100644
index 282e5471781..00000000000
--- a/src/devices/bus/bbc/rom/rom.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/***************************************************************************
-
- BBC Micro Sideways ROM emulation
-
-***************************************************************************/
-
-#ifndef MAME_BUS_BBC_ROM_ROM_H
-#define MAME_BUS_BBC_ROM_ROM_H
-
-#pragma once
-
-#include "slot.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> bbc_rom_device
-
-class bbc_rom_device : public device_t,
- public device_bbc_rom_interface
-{
-public:
- // construction/destruction
- bbc_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
-
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
-};
-
-// device type definition
-DECLARE_DEVICE_TYPE(BBC_ROM, bbc_rom_device)
-
-
-#endif // MAME_BUS_BBC_ROM_ROM_H
diff --git a/src/devices/bus/bbc/rom/rtc.cpp b/src/devices/bus/bbc/rom/rtc.cpp
deleted file mode 100644
index 7d73c24b53e..00000000000
--- a/src/devices/bus/bbc/rom/rtc.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/***************************************************************************
-
- Solidisk Real Time Clock
-
- http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Solidisk_RTC.html
-
- PMS Genie Watch (RTC for the BBC)
-
-***************************************************************************/
-
-#include "emu.h"
-#include "rtc.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(BBC_STLRTC, bbc_stlrtc_device, "bbc_stlrtc", "Solidisk Real Time Clock")
-DEFINE_DEVICE_TYPE(BBC_PMSRTC, bbc_pmsrtc_device, "bbc_pmsrtc", "PMS Genie Real Time Clock")
-
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void bbc_stlrtc_device::device_add_mconfig(machine_config &config)
-{
- MC146818(config, m_rtc, 32.768_kHz_XTAL); // TODO: verify clock
-}
-
-void bbc_pmsrtc_device::device_add_mconfig(machine_config &config)
-{
- /* Dallas DS1216 SmartWatch RAM */
- DS1315(config, m_rtc, 0);
-}
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// bbc_stlrtc_device - constructor
-//-------------------------------------------------
-
-bbc_stlrtc_device::bbc_stlrtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, BBC_STLRTC, tag, owner, clock)
- , device_bbc_rom_interface(mconfig, *this)
- , m_rtc(*this, "rtc")
-{
-}
-
-bbc_pmsrtc_device::bbc_pmsrtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, BBC_PMSRTC, tag, owner, clock)
- , device_bbc_rom_interface(mconfig, *this)
- , m_rtc(*this, "rtc")
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void bbc_stlrtc_device::device_start()
-{
-}
-
-void bbc_pmsrtc_device::device_start()
-{
-}
-
-//-------------------------------------------------
-// read
-//-------------------------------------------------
-
-uint8_t bbc_stlrtc_device::read(offs_t offset)
-{
- uint8_t data = get_rom_base()[offset & 0x3fff];
-
- switch (offset & 0x3fc0)
- {
- case 0x3e00:
- data = m_rtc->read(1);
- break;
- case 0x3e40:
- if (!machine().side_effects_disabled())
- m_rtc->write(0, data);
- break;
- case 0x3e80:
- case 0x3ec0:
- data = m_rtc->read(0);
- break;
- case 0x3f00:
- case 0x3f40:
- case 0x3f80:
- case 0x3fc0:
- if (!machine().side_effects_disabled())
- m_rtc->write(1, data);
- break;
- }
- return data;
-}
-
-uint8_t bbc_pmsrtc_device::read(offs_t offset)
-{
- uint8_t data = get_rom_base()[offset & 0x1fff];
-
- switch (offset)
- {
- case 0x00:
- data |= m_rtc->read_0();
- break;
- case 0x01:
- data |= m_rtc->read_1();
- break;
- case 0x04:
- if (m_rtc->chip_enable())
- data = m_rtc->read_data() & 0x01;
- break;
- }
- return data;
-}
diff --git a/src/devices/bus/bbc/rom/rtc.h b/src/devices/bus/bbc/rom/rtc.h
deleted file mode 100644
index d37b2174b9b..00000000000
--- a/src/devices/bus/bbc/rom/rtc.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/***************************************************************************
-
- Solidisk Real Time Clock emulation
-
- PMS Genie Watch (RTC for the BBC)
-
-***************************************************************************/
-
-#ifndef MAME_BUS_BBC_ROM_RTC_H
-#define MAME_BUS_BBC_ROM_RTC_H
-
-#pragma once
-
-#include "slot.h"
-#include "machine/mc146818.h"
-#include "machine/ds1315.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> bbc_stlrtc_device
-
-class bbc_stlrtc_device : public device_t,
- public device_bbc_rom_interface
-{
-public:
- // construction/destruction
- bbc_stlrtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device-level overrides
- virtual void device_add_mconfig(machine_config &config) override;
-
- virtual void device_start() override;
-
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
-
-private:
- required_device<mc146818_device> m_rtc;
-};
-
-// ======================> bbc_pmsrtc_device
-
-class bbc_pmsrtc_device : public device_t,
- public device_bbc_rom_interface
-{
-public:
- // construction/destruction
- bbc_pmsrtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device-level overrides
- virtual void device_add_mconfig(machine_config &config) override;
-
- virtual void device_start() override;
-
- // device_bbc_rom_interface overrides
- virtual uint8_t read(offs_t offset) override;
-
-private:
- required_device<ds1315_device> m_rtc;
-};
-
-// device type definition
-DECLARE_DEVICE_TYPE(BBC_STLRTC, bbc_stlrtc_device)
-DECLARE_DEVICE_TYPE(BBC_PMSRTC, bbc_pmsrtc_device)
-
-#endif // MAME_BUS_BBC_ROM_RTC_H
diff --git a/src/devices/bus/bbc/rom/slot.cpp b/src/devices/bus/bbc/rom/slot.cpp
deleted file mode 100644
index af8ae212d6d..00000000000
--- a/src/devices/bus/bbc/rom/slot.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/*********************************************************************
-
- BBC Micro ROM slot emulation
-
-*********************************************************************/
-
-#include "emu.h"
-#include "slot.h"
-
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(BBC_ROMSLOT16, bbc_romslot16_device, "bbc_romslot16", "BBC Micro 16K ROM Slot")
-DEFINE_DEVICE_TYPE(BBC_ROMSLOT32, bbc_romslot32_device, "bbc_romslot32", "BBC Micro 32K ROM Slot")
-
-
-//**************************************************************************
-// DEVICE BBC_ROMSLOT CARD INTERFACE
-//**************************************************************************
-
-//-------------------------------------------------
-// device_bbc_rom_interface - constructor
-//-------------------------------------------------
-
-device_bbc_rom_interface::device_bbc_rom_interface(const machine_config &mconfig, device_t &device)
- : device_slot_card_interface(mconfig, device)
- , m_rom(nullptr)
- , m_rom_size(0)
-{
-}
-
-
-//-------------------------------------------------
-// ~device_bbc_rom_interface - destructor
-//-------------------------------------------------
-
-device_bbc_rom_interface::~device_bbc_rom_interface()
-{
-}
-
-//-------------------------------------------------
-// rom_alloc - alloc the space for the ROM
-//-------------------------------------------------
-
-void device_bbc_rom_interface::rom_alloc(uint32_t size, const char *tag)
-{
- if (m_rom == nullptr)
- {
- m_rom = device().machine().memory().region_alloc(std::string(tag).append(BBC_ROM_REGION_TAG).c_str(), size, 1, ENDIANNESS_LITTLE)->base();
- m_rom_size = size;
- }
-}
-
-//-------------------------------------------------
-// ram_alloc - alloc the space for the RAM
-//-------------------------------------------------
-
-void device_bbc_rom_interface::ram_alloc(uint32_t size)
-{
- m_ram.resize(size);
- device().save_item(NAME(m_ram));
-}
-
-//-------------------------------------------------
-// nvram_alloc - alloc the space for the NVRAM
-//-------------------------------------------------
-
-void device_bbc_rom_interface::nvram_alloc(uint32_t size)
-{
- m_nvram.resize(size);
-}
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// bbc_romslot_device - constructor
-//-------------------------------------------------
-bbc_romslot_device::bbc_romslot_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_image_interface(mconfig, *this)
- , device_slot_interface(mconfig, *this)
- , m_cart(nullptr)
-{
-}
-
-bbc_romslot16_device::bbc_romslot16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : bbc_romslot_device(mconfig, BBC_ROMSLOT16, tag, owner, clock)
-{
-}
-
-bbc_romslot32_device::bbc_romslot32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : bbc_romslot_device(mconfig, BBC_ROMSLOT32, tag, owner, clock)
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void bbc_romslot_device::device_start()
-{
- m_cart = dynamic_cast<device_bbc_rom_interface *>(get_card_device());
-}
-
-
-//-------------------------------------------------
-// call load
-//-------------------------------------------------
-
-image_init_result bbc_romslot_device::call_load()
-{
- if (m_cart)
- {
- uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
-
- if (size % 0x2000)
- {
- seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid ROM size");
- return image_init_result::FAIL;
- }
-
- m_cart->rom_alloc(size, tag());
-
- if (!loaded_through_softlist())
- fread(m_cart->get_rom_base(), size);
- else
- memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
-
- if (get_software_region("ram"))
- m_cart->ram_alloc(get_software_region_length("ram"));
-
- if (get_software_region("nvram"))
- m_cart->nvram_alloc(get_software_region_length("nvram"));
- }
-
- return image_init_result::PASS;
-}
-
-//-------------------------------------------------
-// call_unload
-//-------------------------------------------------
-
-void bbc_romslot_device::call_unload()
-{
- if (m_cart && m_cart->get_nvram_base() && m_cart->get_nvram_size())
- battery_save(m_cart->get_nvram_base(), m_cart->get_nvram_size());
-}
-
-
-//-------------------------------------------------
-// get default card software
-//-------------------------------------------------
-
-std::string bbc_romslot_device::get_default_card_software(get_default_card_software_hook &hook) const
-{
- return software_get_default_slot("rom");
-}
-
-
-//-------------------------------------------------
-// rom size
-//-------------------------------------------------
-
-uint32_t bbc_romslot_device::get_rom_size()
-{
- if (m_cart)
- return m_cart->get_rom_size();
- else
- return 0;
-}
-
-
-//-------------------------------------------------
-// read - rom read
-//-------------------------------------------------
-
-uint8_t bbc_romslot_device::read(offs_t offset)
-{
- if (m_cart)
- return m_cart->read(offset);
- else
- return 0xff;
-}
-
-
-//-------------------------------------------------
-// write - rom write
-//-------------------------------------------------
-
-void bbc_romslot_device::write(offs_t offset, uint8_t data)
-{
- if (m_cart)
- m_cart->write(offset, data);
-}
-
-
-//-------------------------------------------------
-// SLOT_INTERFACE( bbc_rom )
-//-------------------------------------------------
-
-#include "rom.h"
-#include "ram.h"
-#include "dfs.h"
-//#include "genie.h"
-#include "pal.h"
-//#include "replay.h"
-#include "rtc.h"
-
-
-void bbc_rom_devices(device_slot_interface &device)
-{
- device.option_add_internal("rom", BBC_ROM);
- device.option_add_internal("ram", BBC_RAM);
- device.option_add_internal("cciword", BBC_CCIWORD);
- device.option_add_internal("ccibase", BBC_CCIBASE);
- device.option_add_internal("ccispell", BBC_CCISPELL);
- device.option_add_internal("palqst", BBC_PALQST);
- device.option_add_internal("palwap", BBC_PALWAP);
- device.option_add_internal("palted", BBC_PALTED);
- device.option_add_internal("palabep", BBC_PALABEP);
- device.option_add_internal("palabe", BBC_PALABE);
- device.option_add_internal("palmo2", BBC_PALMO2);
- //device.option_add_internal("genie", BBC_PMSGENIE);
- device.option_add_internal("mrme00", BBC_MRME00);
- //device.option_add_internal("replay", BBC_REPLAY);
- device.option_add_internal("stlrtc", BBC_STLRTC);
- device.option_add_internal("pmsrtc", BBC_PMSRTC);
-}
diff --git a/src/devices/bus/bbc/rom/slot.h b/src/devices/bus/bbc/rom/slot.h
deleted file mode 100644
index 40818d9e619..00000000000
--- a/src/devices/bus/bbc/rom/slot.h
+++ /dev/null
@@ -1,155 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/*********************************************************************
-
- BBC Micro ROM slot emulation
-
-*********************************************************************/
-
-#ifndef MAME_BUS_BBC_ROM_SLOT_H
-#define MAME_BUS_BBC_ROM_SLOT_H
-
-#pragma once
-
-#include "softlist_dev.h"
-
-
-#define BBC_ROM_REGION_TAG ":cart:rom"
-
-/***************************************************************************
- TYPE DEFINITIONS
-***************************************************************************/
-
-// ======================> bbc_romslot_device
-
-class device_bbc_rom_interface;
-
-class bbc_romslot_device : public device_t,
- public device_image_interface,
- public device_slot_interface
-{
-public:
- // image-level overrides
- virtual image_init_result call_load() override;
- virtual void call_unload() override;
- virtual const software_list_loader &get_software_list_loader() const override { return rom_software_list_loader::instance(); }
-
- virtual iodevice_t image_type() const override { return IO_ROM; }
- virtual bool is_readable() const override { return 1; }
- virtual bool is_writeable() const override { return 0; }
- virtual bool is_creatable() const override { return 0; }
- virtual bool must_be_loaded() const override { return 0; }
- virtual bool is_reset_on_load() const override { return 1; }
- virtual const char *image_interface() const override { return "bbc_rom"; }
- virtual const char *file_extensions() const override { return "rom,bin"; }
-
- // slot interface overrides
- virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
-
- // reading and writing
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
-
- uint32_t get_rom_size();
- uint32_t get_slot_size() const { return m_slot_size; }
-
-protected:
- // construction/destruction
- bbc_romslot_device(const machine_config &mconfig, device_type type, char const *tag, device_t *owner, uint32_t clock);
-
- // device-level overrides
- virtual void device_start() override;
-
- uint32_t m_slot_size;
-
-private:
- device_bbc_rom_interface* m_cart;
-};
-
-// ======================> bbc_romslot16_device
-
-class bbc_romslot16_device : public bbc_romslot_device
-{
-public:
- // construction/destruction
- template <typename T>
- bbc_romslot16_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&slot_options, char const *default_option)
- : bbc_romslot16_device(mconfig, tag, owner)
- {
- option_reset();
- slot_options(*this);
- set_default_option(default_option);
- set_fixed(false);
- m_slot_size = 0x4000;
- }
-
- bbc_romslot16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
-};
-
-// ======================> bbc_romslot32_device
-
-class bbc_romslot32_device : public bbc_romslot_device
-{
-public:
- // construction/destruction
- template <typename T>
- bbc_romslot32_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&slot_options, char const *default_option)
- : bbc_romslot32_device(mconfig, tag, owner)
- {
- option_reset();
- slot_options(*this);
- set_default_option(default_option);
- set_fixed(false);
- m_slot_size = 0x8000;
- }
-
- bbc_romslot32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
-};
-
-
-// ======================> device_bbc_rom_interface
-
-class device_bbc_rom_interface : public device_slot_card_interface
-{
-public:
- // construction/destruction
- virtual ~device_bbc_rom_interface();
-
- // reading and writing
- virtual uint8_t read(offs_t offset) { return 0xff; }
- virtual void write(offs_t offset, uint8_t data) { m_device.logerror("unhandled ROM write to %04X = %02X\n", offset | 0x8000, data); }
-
- void rom_alloc(uint32_t size, const char *tag);
- void ram_alloc(uint32_t size);
- void nvram_alloc(uint32_t size);
-
- uint8_t* get_rom_base() { return m_rom; }
- virtual uint32_t get_rom_size() { return m_rom_size; }
-
- uint8_t* get_ram_base() { return &m_ram[0]; }
- uint32_t get_ram_size() { return m_ram.size(); }
-
- uint8_t* get_nvram_base() { return &m_nvram[0]; }
- uint32_t get_nvram_size() { return m_nvram.size(); }
-
-protected:
- device_bbc_rom_interface(const machine_config &mconfig, device_t &device);
-
- bbc_romslot_device *m_slot;
-
-private:
- // internal state
- uint8_t *m_rom;
- uint32_t m_rom_size;
- std::vector<uint8_t> m_ram;
- std::vector<uint8_t> m_nvram;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(BBC_ROMSLOT16, bbc_romslot16_device)
-DECLARE_DEVICE_TYPE(BBC_ROMSLOT32, bbc_romslot32_device)
-
-void bbc_rom_devices(device_slot_interface &device);
-
-#endif // MAME_BUS_BBC_ROM_SLOT_H
diff --git a/src/devices/bus/bbc/tube/tube.cpp b/src/devices/bus/bbc/tube/tube.cpp
index 602ea3c845a..2ac1bf5fb15 100644
--- a/src/devices/bus/bbc/tube/tube.cpp
+++ b/src/devices/bus/bbc/tube/tube.cpp
@@ -92,10 +92,10 @@ void bbc_tube_slot_device::device_reset()
// host_r
//-------------------------------------------------
-uint8_t bbc_tube_slot_device::host_r(offs_t offset)
+READ8_MEMBER(bbc_tube_slot_device::host_r)
{
if (m_card)
- return m_card->host_r(offset);
+ return m_card->host_r(space, offset);
else
return 0xfe;
}
@@ -104,15 +104,14 @@ uint8_t bbc_tube_slot_device::host_r(offs_t offset)
// host_w
//-------------------------------------------------
-void bbc_tube_slot_device::host_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_slot_device::host_w)
{
if (m_card)
- m_card->host_w(offset, data);
+ m_card->host_w(space, offset, data);
}
// slot devices
-#include "tube_32016.h"
#include "tube_6502.h"
#include "tube_80186.h"
#include "tube_80286.h"
@@ -134,7 +133,7 @@ void bbc_tube_devices(device_slot_interface &device)
{
device.option_add("6502", BBC_TUBE_6502); /* Acorn ANC01 6502 2nd processor */
device.option_add("z80", BBC_TUBE_Z80); /* Acorn ANC04 Z80 2nd processor */
- device.option_add("32016", BBC_TUBE_32016); /* Acorn ANC05 32016 2nd processor */
+ //device.option_add("32016", BBC_TUBE_32016); /* Acorn ANC05 32016 2nd processor */
device.option_add("arm", BBC_TUBE_ARM); /* Acorn ANC13 ARM Evaluation System */
device.option_add("80286", BBC_TUBE_80286); /* Acorn 80286 2nd Processor */
//device.option_add("a500", BBC_TUBE_A500); /* Acorn A500 2nd Processor */
@@ -143,8 +142,8 @@ void bbc_tube_devices(device_slot_interface &device)
//device.option_add("hdp68k", BBC_TUBE_HDP68K); /* Torch Unicorn (HDP68K) */
//device.option_add("x25", BBC_TUBE_X25); /* Econet X25 Gateway */
device.option_add("zep100", BBC_TUBE_ZEP100); /* Torch Z80 Communicator (ZEP100) (Torch) */
- //device.option_add("zep100l", BBC_TUBE_ZEP100L); /* Torch Z80 Communicator (ZEP100) (Model B) */
- //device.option_add("zep100w", BBC_TUBE_ZEP100W); /* Torch Z80 Communicator (ZEP100) (Model B+) */
+ //device.option_add("zep100l", BBC_TUBE_ZEP100L); /* Torch Z80 Communicator (ZEP100) (Acorn 8271) */
+ //device.option_add("zep100w", BBC_TUBE_ZEP100W); /* Torch Z80 Communicator (ZEP100) (Acorn 1770) */
/* Acorn ANC21 Universal 2nd Processor Unit */
device.option_add("65c102", BBC_TUBE_65C102); /* Acorn ADC06 65C102 co-processor */
device.option_add("80186", BBC_TUBE_80186); /* Acorn ADC08 80186 co-processor */
@@ -161,12 +160,11 @@ void bbc_extube_devices(device_slot_interface &device)
{
device.option_add("6502", BBC_TUBE_6502); /* Acorn ANC01 6502 2nd processor */
device.option_add("z80", BBC_TUBE_Z80); /* Acorn ANC04 Z80 2nd processor */
- device.option_add("32016", BBC_TUBE_32016); /* Acorn ANC05 32016 2nd processor */
+ //device.option_add("32016", BBC_TUBE_32016); /* Acorn ANC05 32016 2nd processor */
device.option_add("arm", BBC_TUBE_ARM); /* Acorn ANC13 ARM Evaluation System */
device.option_add("80286", BBC_TUBE_80286); /* Acorn 80286 2nd Processor */
//device.option_add("a500", BBC_TUBE_A500); /* Acorn A500 2nd Processor */
//device.option_add("pmsb2p", BBC_TUBE_PMSB2P); /* PMS B2P-6502 */
- //device.option_add("zep100m", BBC_TUBE_ZEP100M); /* Torch Z80 Communicator (ZEP100) (Master) */
/* Acorn ANC21 Universal 2nd Processor Unit */
device.option_add("65c102", BBC_TUBE_65C102); /* Acorn ADC06 65C102 co-processor */
device.option_add("80186", BBC_TUBE_80186); /* Acorn ADC08 80186 co-processor */
@@ -183,6 +181,7 @@ void bbc_intube_devices(device_slot_interface &device)
{
device.option_add("65c102", BBC_TUBE_65C102); /* Acorn ADC06 65C102 co-processor */
device.option_add("80186", BBC_TUBE_80186); /* Acorn ADC08 80186 co-processor */
+ //device.option_add("zep100m", BBC_TUBE_ZEP100M); /* Torch Z80 Communicator (ZEP100) (Master) */
//device.option_add("arm7", BBC_TUBE_ARM7); /* Sprow ARM7 co-processor */
device.option_add("rc6502", BBC_TUBE_RC6502); /* ReCo6502 (6502) */
device.option_add("rc65816", BBC_TUBE_RC65816); /* ReCo6502 (65816) */
@@ -197,7 +196,6 @@ void electron_tube_devices(device_slot_interface &device)
{
device.option_add("6502", BBC_TUBE_6502); /* Acorn ANC01 6502 2nd processor */
device.option_add("z80", BBC_TUBE_Z80); /* Acorn ANC04 Z80 2nd processor */
- device.option_add("32016", BBC_TUBE_32016); /* Acorn ANC05 32016 2nd processor */
device.option_add("arm", BBC_TUBE_ARM); /* Acorn ANC13 ARM Evaluation System */
device.option_add("65c102", BBC_TUBE_65C102); /* Acorn ADC06 65C102 co-processor */
device.option_add("80186", BBC_TUBE_80186); /* Acorn ADC08 80186 co-processor */
diff --git a/src/devices/bus/bbc/tube/tube.h b/src/devices/bus/bbc/tube/tube.h
index e0d66907cb6..954867f0b7f 100644
--- a/src/devices/bus/bbc/tube/tube.h
+++ b/src/devices/bus/bbc/tube/tube.h
@@ -66,8 +66,8 @@ public:
// callbacks
auto irq_handler() { return m_irq_handler.bind(); }
- uint8_t host_r(offs_t offset);
- void host_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( host_r );
+ DECLARE_WRITE8_MEMBER( host_w );
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_handler(state); }
@@ -90,8 +90,8 @@ class device_bbc_tube_interface : public device_slot_card_interface
{
public:
// reading and writing
- virtual uint8_t host_r(offs_t offset) { return 0xfe; }
- virtual void host_w(offs_t offset, uint8_t data) { }
+ virtual DECLARE_READ8_MEMBER(host_r) { return 0xfe; }
+ virtual DECLARE_WRITE8_MEMBER(host_w) { }
protected:
device_bbc_tube_interface(const machine_config &mconfig, device_t &device);
diff --git a/src/devices/bus/bbc/tube/tube_32016.cpp b/src/devices/bus/bbc/tube/tube_32016.cpp
deleted file mode 100644
index 7b6ac355e42..00000000000
--- a/src/devices/bus/bbc/tube/tube_32016.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- Acorn ANC05 32016 2nd processor
-
- http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ANC05_320162ndproc.html
-
- Acorn ANC06 Cambridge Co-Processor
-
- http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ANC06_CamCoPro.html
-
- IC1 (ULA) TUBE
- IC2 (MMU) NS32082 Not fitted
- IC3 (CPU) NS32016
- IC4 (TCU) NS32201
- IC20 (FPU) NS32081
-
-**********************************************************************/
-
-
-#include "emu.h"
-#include "tube_32016.h"
-#include "softlist_dev.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(BBC_TUBE_32016, bbc_tube_32016_device, "bbc_tube_32016", "Acorn 32016 2nd processor")
-
-
-//-------------------------------------------------
-// ADDRESS_MAP( tube_32016_mem )
-//-------------------------------------------------
-
-void bbc_tube_32016_device::tube_32016_mem(address_map &map)
-{
- map(0x000000, 0xffffff).rw(FUNC(bbc_tube_32016_device::read), FUNC(bbc_tube_32016_device::write));
- map(0xf90000, 0xf90001).portr("CONFIG");
- map(0xfffff0, 0xffffff).rw("ula", FUNC(tube_device::parasite_r), FUNC(tube_device::parasite_w)).umask32(0x00ff);
-}
-
-//-------------------------------------------------
-// ROM( tube_32016 )
-//-------------------------------------------------
-
-ROM_START(tube_32016)
- ROM_REGION(0x8000, "rom", 0)
- ROM_DEFAULT_BIOS("200")
- ROM_SYSTEM_BIOS(0, "200", "Pandora v2.00")
- ROMX_LOAD("pan200lo.rom", 0x0000, 0x4000, CRC(b1980fd0) SHA1(8084f8896cd22953abefbd43c51e1a422b30e28d), ROM_SKIP(1) | ROM_BIOS(0)) // 0201-764-02 Pandora Lo
- ROMX_LOAD("pan200hi.rom", 0x0001, 0x4000, CRC(cab98d6b) SHA1(dfad1f4180c50757a74fcfe3a0ee7d7b48eb1bee), ROM_SKIP(1) | ROM_BIOS(0)) // 0201-763-02 Pandora Hi
- ROM_SYSTEM_BIOS(1, "100", "Pandora v1.00")
- ROMX_LOAD("pan100.rom", 0x0000, 0x8000, BAD_DUMP CRC(75333006) SHA1(996cd120103039390c9b979b16c327bb95da72e4), ROM_BIOS(1)) // 0201-763-01, 0201-764-01 Pandora
- ROM_SYSTEM_BIOS(2, "061", "Pandora v0.61")
- ROMX_LOAD("pan061lo.rom", 0x0000, 0x4000, CRC(6f801b35) SHA1(ce31f7c10603f3d15a06a8e32bde40df0639e446), ROM_SKIP(1) | ROM_BIOS(2))
- ROMX_LOAD("pan061hi.rom", 0x0001, 0x4000, CRC(c00b1ab0) SHA1(e6a705232278c518340ddc69ea51af91965fa332), ROM_SKIP(1) | ROM_BIOS(2))
-ROM_END
-
-//-------------------------------------------------
-// INPUT_PORTS( tube_32016 )
-//-------------------------------------------------
-
-static INPUT_PORTS_START(tube_32016)
- PORT_START("CONFIG")
- PORT_DIPNAME(0x80, 0x80, "H") PORT_DIPLOCATION("LKS:1")
- PORT_DIPSETTING(0x80, "FPU")
- PORT_DIPSETTING(0x00, "No FPU")
-
- PORT_DIPNAME(0x40, 0x00, "G") PORT_DIPLOCATION("LKS:2")
- PORT_DIPSETTING(0x40, "MMU")
- PORT_DIPSETTING(0x00, "No MMU")
-
- PORT_DIPNAME(0x20, 0x00, "F") PORT_DIPLOCATION("LKS:3")
- PORT_DIPSETTING(0x20, "Reserved")
- PORT_DIPSETTING(0x00, "Reserved")
-
- PORT_DIPNAME(0x10, 0x00, "E") PORT_DIPLOCATION("LKS:4")
- PORT_DIPSETTING(0x10, "Reserved")
- PORT_DIPSETTING(0x00, "Reserved")
-
- PORT_DIPNAME(0x08, 0x00, "D") PORT_DIPLOCATION("LKS:5")
- PORT_DIPSETTING(0x08, "Reserved")
- PORT_DIPSETTING(0x00, "Reserved")
-
- PORT_DIPNAME(0x04, 0x00, "C") PORT_DIPLOCATION("LKS:6")
- PORT_DIPSETTING(0x04, "Reserved")
- PORT_DIPSETTING(0x00, "Reserved")
-
- PORT_DIPNAME(0x02, 0x00, "B") PORT_DIPLOCATION("LKS:7")
- PORT_DIPSETTING(0x02, "Reserved")
- PORT_DIPSETTING(0x00, "Reserved")
-
- PORT_DIPNAME(0x01, 0x00, "A") PORT_DIPLOCATION("LKS:8")
- PORT_DIPSETTING(0x01, "Reserved")
- PORT_DIPSETTING(0x00, "Reserved")
-INPUT_PORTS_END
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void bbc_tube_32016_device::device_add_mconfig(machine_config &config)
-{
- NS32016(config, m_maincpu, 12_MHz_XTAL / 2);
- m_maincpu->set_addrmap(AS_PROGRAM, &bbc_tube_32016_device::tube_32016_mem);
-
- TUBE(config, m_ula);
- m_ula->pnmi_handler().set_inputline(m_maincpu, INPUT_LINE_NMI);
- m_ula->pirq_handler().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
-
- /* internal ram */
- RAM(config, m_ram).set_default_size("1M").set_default_value(0);
-
- /* software lists */
- SOFTWARE_LIST(config, "flop_ls_32016").set_original("bbc_flop_32016");
-}
-
-//-------------------------------------------------
-// rom_region - device-specific ROM region
-//-------------------------------------------------
-
-const tiny_rom_entry *bbc_tube_32016_device::device_rom_region() const
-{
- return ROM_NAME( tube_32016 );
-}
-
-//-------------------------------------------------
-// input_ports - device-specific input ports
-//-------------------------------------------------
-
-ioport_constructor bbc_tube_32016_device::device_input_ports() const
-{
- return INPUT_PORTS_NAME( tube_32016 );
-}
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// bbc_tube_32016_device - constructor
-//-------------------------------------------------
-
-bbc_tube_32016_device::bbc_tube_32016_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, BBC_TUBE_32016, tag, owner, clock)
- , device_bbc_tube_interface(mconfig, *this)
- , m_maincpu(*this, "maincpu")
- , m_ula(*this, "ula")
- , m_ram(*this, "ram")
- , m_rom(*this, "rom")
- , m_rom_enabled(true)
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void bbc_tube_32016_device::device_start()
-{
-}
-
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void bbc_tube_32016_device::device_reset()
-{
- m_rom_enabled = true;
-}
-
-
-//**************************************************************************
-// IMPLEMENTATION
-//**************************************************************************
-
-uint8_t bbc_tube_32016_device::host_r(offs_t offset)
-{
- return m_ula->host_r(offset);
-}
-
-void bbc_tube_32016_device::host_w(offs_t offset, uint8_t data)
-{
- m_ula->host_w(offset, data);
-}
-
-
-READ8_MEMBER(bbc_tube_32016_device::read)
-{
- uint16_t data = 0xffff;
-
- if (m_rom_enabled)
- data = m_rom->base()[offset & 0x3fff];
- else if (offset < m_ram->size())
- data = m_ram->pointer()[offset];
-
- return data;
-}
-
-WRITE8_MEMBER(bbc_tube_32016_device::write)
-{
- /* clear ROM select on first write */
- if (!machine().side_effects_disabled()) m_rom_enabled = false;
-
- if (offset < m_ram->size())
- m_ram->pointer()[offset] = data;
-}
diff --git a/src/devices/bus/bbc/tube/tube_32016.h b/src/devices/bus/bbc/tube/tube_32016.h
deleted file mode 100644
index 864b8173703..00000000000
--- a/src/devices/bus/bbc/tube/tube_32016.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- Acorn ANC05 32016 2nd processor
-
- http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ANC05_320162ndproc.html
-
- Acorn ANC06 Cambridge Co-Processor
-
- http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ANC06_CamCoPro.html
-
-**********************************************************************/
-
-
-#ifndef MAME_BUS_BBC_TUBE_32016_H
-#define MAME_BUS_BBC_TUBE_32016_H
-
-#include "tube.h"
-#include "cpu/ns32000/ns32000.h"
-#include "machine/ram.h"
-#include "machine/tube.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> bbc_tube_32016_device
-
-class bbc_tube_32016_device :
- public device_t,
- public device_bbc_tube_interface
-{
-public:
- // construction/destruction
- bbc_tube_32016_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
- // optional information overrides
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
- virtual ioport_constructor device_input_ports() const override;
-
- virtual uint8_t host_r(offs_t offset) override;
- virtual void host_w(offs_t offset, uint8_t data) override;
-
-private:
- required_device<ns32016_cpu_device> m_maincpu;
- required_device<tube_device> m_ula;
- required_device<ram_device> m_ram;
- required_memory_region m_rom;
-
- DECLARE_READ8_MEMBER(read);
- DECLARE_WRITE8_MEMBER(write);
-
- void tube_32016_mem(address_map &map);
-
- bool m_rom_enabled;
-};
-
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(BBC_TUBE_32016, bbc_tube_32016_device)
-
-
-#endif /* MAME_BUS_BBC_TUBE_32016_H */
diff --git a/src/devices/bus/bbc/tube/tube_6502.cpp b/src/devices/bus/bbc/tube/tube_6502.cpp
index 99852ca8d90..8120ab16812 100644
--- a/src/devices/bus/bbc/tube/tube_6502.cpp
+++ b/src/devices/bus/bbc/tube/tube_6502.cpp
@@ -168,27 +168,27 @@ void bbc_tube_6502_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_tube_6502_device::host_r(offs_t offset)
+READ8_MEMBER(bbc_tube_6502_device::host_r)
{
- return m_ula->host_r(offset);
+ return m_ula->host_r(space, offset);
}
-void bbc_tube_6502_device::host_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_6502_device::host_w)
{
- m_ula->host_w(offset, data);
+ m_ula->host_w(space, offset, data);
}
-uint8_t bbc_tube_6502_device::tube_r(offs_t offset)
+READ8_MEMBER(bbc_tube_6502_device::tube_r)
{
// Disable ROM on first access
if (!machine().side_effects_disabled())
m_bankdev->set_bank(1);
- return m_ula->parasite_r(offset);
+ return m_ula->parasite_r(space, offset);
}
-void bbc_tube_6502_device::tube_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_6502_device::tube_w)
{
- m_ula->parasite_w(offset, data);
+ m_ula->parasite_w(space, offset, data);
}
diff --git a/src/devices/bus/bbc/tube/tube_6502.h b/src/devices/bus/bbc/tube/tube_6502.h
index abb907ef3bd..244eb9f2105 100644
--- a/src/devices/bus/bbc/tube/tube_6502.h
+++ b/src/devices/bus/bbc/tube/tube_6502.h
@@ -52,11 +52,11 @@ protected:
void add_common_devices(machine_config &config);
- virtual uint8_t host_r(offs_t offset) override;
- virtual void host_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( host_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( host_w ) override;
- virtual uint8_t tube_r(offs_t offset);
- virtual void tube_w(offs_t offset, uint8_t data);
+ virtual DECLARE_READ8_MEMBER( tube_r );
+ virtual DECLARE_WRITE8_MEMBER( tube_w );
required_device<cpu_device> m_maincpu;
required_device<address_map_bank_device> m_bankdev;
diff --git a/src/devices/bus/bbc/tube/tube_80186.cpp b/src/devices/bus/bbc/tube/tube_80186.cpp
index 85331ab1b2a..4721d48e534 100644
--- a/src/devices/bus/bbc/tube/tube_80186.cpp
+++ b/src/devices/bus/bbc/tube/tube_80186.cpp
@@ -126,12 +126,12 @@ void bbc_tube_80186_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_tube_80186_device::host_r(offs_t offset)
+READ8_MEMBER(bbc_tube_80186_device::host_r)
{
- return m_ula->host_r(offset);
+ return m_ula->host_r(space, offset);
}
-void bbc_tube_80186_device::host_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_80186_device::host_w)
{
- m_ula->host_w(offset, data);
+ m_ula->host_w(space, offset, data);
}
diff --git a/src/devices/bus/bbc/tube/tube_80186.h b/src/devices/bus/bbc/tube/tube_80186.h
index 42f757e75e4..3081acbddac 100644
--- a/src/devices/bus/bbc/tube/tube_80186.h
+++ b/src/devices/bus/bbc/tube/tube_80186.h
@@ -40,8 +40,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t host_r(offs_t offset) override;
- virtual void host_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( host_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( host_w ) override;
private:
required_device<i80186_cpu_device> m_i80186;
diff --git a/src/devices/bus/bbc/tube/tube_80286.cpp b/src/devices/bus/bbc/tube/tube_80286.cpp
index e8ff167d0fb..f38761341f5 100644
--- a/src/devices/bus/bbc/tube/tube_80286.cpp
+++ b/src/devices/bus/bbc/tube/tube_80286.cpp
@@ -129,25 +129,24 @@ void bbc_tube_80286_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_tube_80286_device::host_r(offs_t offset)
+READ8_MEMBER(bbc_tube_80286_device::host_r)
{
- return m_ula->host_r(offset);
+ return m_ula->host_r(space, offset);
}
-void bbc_tube_80286_device::host_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_80286_device::host_w)
{
- m_ula->host_w(offset, data);
+ m_ula->host_w(space, offset, data);
}
-uint8_t bbc_tube_80286_device::disable_boot_rom()
+READ8_MEMBER(bbc_tube_80286_device::disable_boot_rom)
{
- if (!machine().side_effects_disabled())
- m_i80286->space(AS_PROGRAM).install_ram(0xc0000, 0xfffff, m_ram->pointer() + 0xc0000);
+ m_i80286->space(AS_PROGRAM).install_ram(0xc0000, 0xfffff, m_ram->pointer() + 0xc0000);
return 0xff;
}
-void bbc_tube_80286_device::irq_latch_w(uint8_t data)
+WRITE8_MEMBER(bbc_tube_80286_device::irq_latch_w)
{
m_irq_latch = data;
}
diff --git a/src/devices/bus/bbc/tube/tube_80286.h b/src/devices/bus/bbc/tube/tube_80286.h
index a6e952d6bf2..da2d807477b 100644
--- a/src/devices/bus/bbc/tube/tube_80286.h
+++ b/src/devices/bus/bbc/tube/tube_80286.h
@@ -38,8 +38,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t host_r(offs_t offset) override;
- virtual void host_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( host_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( host_w ) override;
private:
uint8_t m_irq_latch;
@@ -51,8 +51,8 @@ private:
required_device<ram_device> m_ram;
required_memory_region m_bootstrap;
- uint8_t disable_boot_rom();
- void irq_latch_w(uint8_t data);
+ DECLARE_READ8_MEMBER( disable_boot_rom );
+ DECLARE_WRITE8_MEMBER( irq_latch_w );
void tube_80286_io(address_map &map);
void tube_80286_mem(address_map &map);
diff --git a/src/devices/bus/bbc/tube/tube_arm.cpp b/src/devices/bus/bbc/tube/tube_arm.cpp
index 463a82713be..444e188a657 100644
--- a/src/devices/bus/bbc/tube/tube_arm.cpp
+++ b/src/devices/bus/bbc/tube/tube_arm.cpp
@@ -120,18 +120,18 @@ void bbc_tube_arm_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_tube_arm_device::host_r(offs_t offset)
+READ8_MEMBER(bbc_tube_arm_device::host_r)
{
- return m_ula->host_r(offset);
+ return m_ula->host_r(space, offset);
}
-void bbc_tube_arm_device::host_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_arm_device::host_w)
{
- m_ula->host_w(offset, data);
+ m_ula->host_w(space, offset, data);
}
-uint8_t bbc_tube_arm_device::ram_r(offs_t offset)
+READ8_MEMBER(bbc_tube_arm_device::ram_r)
{
uint8_t data;
@@ -143,7 +143,7 @@ uint8_t bbc_tube_arm_device::ram_r(offs_t offset)
return data;
}
-void bbc_tube_arm_device::ram_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_arm_device::ram_w)
{
/* clear ROM select on first write */
if (!machine().side_effects_disabled()) m_rom_select = false;
diff --git a/src/devices/bus/bbc/tube/tube_arm.h b/src/devices/bus/bbc/tube/tube_arm.h
index 8470fec84ef..7b58d2b40bd 100644
--- a/src/devices/bus/bbc/tube/tube_arm.h
+++ b/src/devices/bus/bbc/tube/tube_arm.h
@@ -38,8 +38,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t host_r(offs_t offset) override;
- virtual void host_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( host_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( host_w ) override;
private:
required_device<arm_cpu_device> m_arm;
@@ -49,8 +49,8 @@ private:
bool m_rom_select;
- uint8_t ram_r(offs_t offset);
- void ram_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( ram_r );
+ DECLARE_WRITE8_MEMBER( ram_w );
void tube_arm_mem(address_map &map);
};
diff --git a/src/devices/bus/bbc/tube/tube_casper.cpp b/src/devices/bus/bbc/tube/tube_casper.cpp
index f6bb4bdce84..db84143f553 100644
--- a/src/devices/bus/bbc/tube/tube_casper.cpp
+++ b/src/devices/bus/bbc/tube/tube_casper.cpp
@@ -109,12 +109,12 @@ void bbc_tube_casper_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_tube_casper_device::host_r(offs_t offset)
+READ8_MEMBER(bbc_tube_casper_device::host_r)
{
return m_via6522_0->read(offset & 0xf);
}
-void bbc_tube_casper_device::host_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_casper_device::host_w)
{
m_via6522_0->write(offset & 0xf, data);
}
diff --git a/src/devices/bus/bbc/tube/tube_casper.h b/src/devices/bus/bbc/tube/tube_casper.h
index 965ac703355..e464f4a8c68 100644
--- a/src/devices/bus/bbc/tube/tube_casper.h
+++ b/src/devices/bus/bbc/tube/tube_casper.h
@@ -36,8 +36,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t host_r(offs_t offset) override;
- virtual void host_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( host_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( host_w ) override;
private:
required_device<cpu_device> m_m68000;
diff --git a/src/devices/bus/bbc/tube/tube_rc6502.cpp b/src/devices/bus/bbc/tube/tube_rc6502.cpp
index c567be6f98a..80061f8a5ca 100644
--- a/src/devices/bus/bbc/tube/tube_rc6502.cpp
+++ b/src/devices/bus/bbc/tube/tube_rc6502.cpp
@@ -233,23 +233,23 @@ void bbc_tube_rc6502_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_tube_rc6502_device::host_r(offs_t offset)
+READ8_MEMBER(bbc_tube_rc6502_device::host_r)
{
- return m_ula->host_r(offset);
+ return m_ula->host_r(space, offset);
}
-void bbc_tube_rc6502_device::host_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_rc6502_device::host_w)
{
- m_ula->host_w(offset, data);
+ m_ula->host_w(space, offset, data);
}
-uint8_t bbc_tube_rc6502_device::config_r()
+READ8_MEMBER(bbc_tube_rc6502_device::config_r)
{
return m_banknum;
}
-void bbc_tube_rc6502_device::register_w(uint8_t data)
+WRITE8_MEMBER(bbc_tube_rc6502_device::register_w)
{
switch (data & 0x06)
{
diff --git a/src/devices/bus/bbc/tube/tube_rc6502.h b/src/devices/bus/bbc/tube/tube_rc6502.h
index eadb460cc96..77542cf4a45 100644
--- a/src/devices/bus/bbc/tube/tube_rc6502.h
+++ b/src/devices/bus/bbc/tube/tube_rc6502.h
@@ -47,11 +47,11 @@ protected:
void add_common_devices(machine_config &config);
- virtual uint8_t host_r(offs_t offset) override;
- virtual void host_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( host_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( host_w ) override;
- uint8_t config_r();
- void register_w(uint8_t data);
+ DECLARE_READ8_MEMBER(config_r);
+ DECLARE_WRITE8_MEMBER(register_w);
void tube_rc6502_bank(address_map &map);
diff --git a/src/devices/bus/bbc/tube/tube_z80.cpp b/src/devices/bus/bbc/tube/tube_z80.cpp
index 06e6931c7a3..cc6f87527bf 100644
--- a/src/devices/bus/bbc/tube/tube_z80.cpp
+++ b/src/devices/bus/bbc/tube/tube_z80.cpp
@@ -134,18 +134,18 @@ void bbc_tube_z80_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_tube_z80_device::host_r(offs_t offset)
+READ8_MEMBER(bbc_tube_z80_device::host_r)
{
- return m_ula->host_r(offset);
+ return m_ula->host_r(space, offset);
}
-void bbc_tube_z80_device::host_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_z80_device::host_w)
{
- m_ula->host_w(offset, data);
+ m_ula->host_w(space, offset, data);
}
-uint8_t bbc_tube_z80_device::opcode_r(offs_t offset)
+READ8_MEMBER(bbc_tube_z80_device::opcode_r)
{
if (!machine().side_effects_disabled())
{
@@ -158,7 +158,7 @@ uint8_t bbc_tube_z80_device::opcode_r(offs_t offset)
}
-uint8_t bbc_tube_z80_device::mem_r(offs_t offset)
+READ8_MEMBER(bbc_tube_z80_device::mem_r)
{
uint8_t data;
@@ -170,7 +170,7 @@ uint8_t bbc_tube_z80_device::mem_r(offs_t offset)
return data;
}
-void bbc_tube_z80_device::mem_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_z80_device::mem_w)
{
m_ram->pointer()[offset] = data;
}
diff --git a/src/devices/bus/bbc/tube/tube_z80.h b/src/devices/bus/bbc/tube/tube_z80.h
index 536e506d43d..e35dfa02ef4 100644
--- a/src/devices/bus/bbc/tube/tube_z80.h
+++ b/src/devices/bus/bbc/tube/tube_z80.h
@@ -40,8 +40,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t host_r(offs_t offset) override;
- virtual void host_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( host_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( host_w ) override;
private:
IRQ_CALLBACK_MEMBER( irq_callback );
@@ -54,9 +54,9 @@ private:
bool m_rom_enabled;
- uint8_t mem_r(offs_t offset);
- void mem_w(offs_t offset, uint8_t data);
- uint8_t opcode_r(offs_t offset);
+ DECLARE_READ8_MEMBER( mem_r );
+ DECLARE_WRITE8_MEMBER( mem_w );
+ DECLARE_READ8_MEMBER( opcode_r );
void tube_z80_fetch(address_map &map);
void tube_z80_io(address_map &map);
diff --git a/src/devices/bus/bbc/tube/tube_zep100.cpp b/src/devices/bus/bbc/tube/tube_zep100.cpp
index f11f0af6415..6ec898bb705 100644
--- a/src/devices/bus/bbc/tube/tube_zep100.cpp
+++ b/src/devices/bus/bbc/tube/tube_zep100.cpp
@@ -146,12 +146,12 @@ void bbc_tube_zep100_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-uint8_t bbc_tube_zep100_device::host_r(offs_t offset)
+READ8_MEMBER(bbc_tube_zep100_device::host_r)
{
return m_via->read(offset & 0x0f);
}
-void bbc_tube_zep100_device::host_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_zep100_device::host_w)
{
if (offset & 0x10)
m_z80->reset();
@@ -160,7 +160,7 @@ void bbc_tube_zep100_device::host_w(offs_t offset, uint8_t data)
}
-uint8_t bbc_tube_zep100_device::mem_r(offs_t offset)
+READ8_MEMBER(bbc_tube_zep100_device::mem_r)
{
uint8_t data;
@@ -172,13 +172,13 @@ uint8_t bbc_tube_zep100_device::mem_r(offs_t offset)
return data;
}
-void bbc_tube_zep100_device::mem_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_zep100_device::mem_w)
{
m_ram->pointer()[offset] = data;
}
-uint8_t bbc_tube_zep100_device::io_r(offs_t offset)
+READ8_MEMBER(bbc_tube_zep100_device::io_r)
{
uint8_t data = 0xff;
@@ -190,23 +190,23 @@ uint8_t bbc_tube_zep100_device::io_r(offs_t offset)
return data;
}
-void bbc_tube_zep100_device::io_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(bbc_tube_zep100_device::io_w)
{
m_ppi->write(offset & 0x03, data);
}
-void bbc_tube_zep100_device::via_pb_w(uint8_t data)
+WRITE8_MEMBER(bbc_tube_zep100_device::via_pb_w)
{
m_port_b = data;
}
-uint8_t bbc_tube_zep100_device::ppi_pb_r()
+READ8_MEMBER(bbc_tube_zep100_device::ppi_pb_r)
{
return m_port_b;
}
-void bbc_tube_zep100_device::ppi_pc_w(uint8_t data)
+WRITE8_MEMBER(bbc_tube_zep100_device::ppi_pc_w)
{
m_via->write_ca1(BIT(data, 7));
m_via->write_cb1(BIT(data, 1));
diff --git a/src/devices/bus/bbc/tube/tube_zep100.h b/src/devices/bus/bbc/tube/tube_zep100.h
index b7f881fcfac..24b07ea4269 100644
--- a/src/devices/bus/bbc/tube/tube_zep100.h
+++ b/src/devices/bus/bbc/tube/tube_zep100.h
@@ -43,8 +43,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t host_r(offs_t offset) override;
- virtual void host_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( host_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( host_w ) override;
bool m_rom_enabled;
@@ -57,14 +57,14 @@ private:
uint8_t m_port_b;
- uint8_t mem_r(offs_t offset);
- void mem_w(offs_t offset, uint8_t data);
- uint8_t io_r(offs_t offset);
- void io_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( mem_r );
+ DECLARE_WRITE8_MEMBER( mem_w );
+ DECLARE_READ8_MEMBER( io_r );
+ DECLARE_WRITE8_MEMBER( io_w );
- void via_pb_w(uint8_t data);
- uint8_t ppi_pb_r();
- void ppi_pc_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( via_pb_w );
+ DECLARE_READ8_MEMBER( ppi_pb_r );
+ DECLARE_WRITE8_MEMBER( ppi_pc_w );
void tube_zep100_io(address_map &map);
void tube_zep100_mem(address_map &map);
diff --git a/src/devices/bus/bbc/userport/beebspch.cpp b/src/devices/bus/bbc/userport/beebspch.cpp
index 728d8ae6658..291179b54c6 100644
--- a/src/devices/bus/bbc/userport/beebspch.cpp
+++ b/src/devices/bus/bbc/userport/beebspch.cpp
@@ -82,7 +82,7 @@ void bbc_beebspch_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-void bbc_beebspch_device::pb_w(uint8_t data)
+WRITE8_MEMBER(bbc_beebspch_device::pb_w)
{
switch (data & 0xc0)
{
diff --git a/src/devices/bus/bbc/userport/beebspch.h b/src/devices/bus/bbc/userport/beebspch.h
index 79e6abf64ab..94c36b0cc84 100644
--- a/src/devices/bus/bbc/userport/beebspch.h
+++ b/src/devices/bus/bbc/userport/beebspch.h
@@ -38,7 +38,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual void pb_w(uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(pb_w) override;
private:
required_device<sp0256_device> m_nsp;
diff --git a/src/devices/bus/bbc/userport/cfa3000kbd.cpp b/src/devices/bus/bbc/userport/cfa3000kbd.cpp
index 5b2d5586f56..d07d7b6dd2f 100644
--- a/src/devices/bus/bbc/userport/cfa3000kbd.cpp
+++ b/src/devices/bus/bbc/userport/cfa3000kbd.cpp
@@ -113,7 +113,7 @@ void cfa3000_kbd_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-uint8_t cfa3000_kbd_device::pb_r()
+READ8_MEMBER(cfa3000_kbd_device::pb_r)
{
uint8_t data = 0x00;
diff --git a/src/devices/bus/bbc/userport/cfa3000kbd.h b/src/devices/bus/bbc/userport/cfa3000kbd.h
index ff9951399c8..2ece3cbf380 100644
--- a/src/devices/bus/bbc/userport/cfa3000kbd.h
+++ b/src/devices/bus/bbc/userport/cfa3000kbd.h
@@ -36,7 +36,7 @@ protected:
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t pb_r() override;
+ virtual DECLARE_READ8_MEMBER(pb_r) override;
private:
required_ioport_array<4> m_kbd;
diff --git a/src/devices/bus/bbc/userport/pointer.cpp b/src/devices/bus/bbc/userport/pointer.cpp
index d8272766d98..9a222388989 100644
--- a/src/devices/bus/bbc/userport/pointer.cpp
+++ b/src/devices/bus/bbc/userport/pointer.cpp
@@ -261,17 +261,17 @@ TIMER_CALLBACK_MEMBER(bbc_pointer_device::pointer_poll)
}
}
-uint8_t bbc_amxmouse_device::pb_r()
+READ8_MEMBER(bbc_amxmouse_device::pb_r)
{
return (m_buttons->read() & 0xe0) | (m_xdir << 0) | (m_ydir << 2) | 0x1a;
}
-uint8_t bbc_m512mouse_device::pb_r()
+READ8_MEMBER(bbc_m512mouse_device::pb_r)
{
return (m_buttons->read() & 0x07) | (m_xdir << 3) | (m_ydir << 4) | 0xe0;
}
-uint8_t bbc_tracker_device::pb_r()
+READ8_MEMBER(bbc_tracker_device::pb_r)
{
return (m_buttons->read() & 0x07) | (m_xdir << 3) | (m_ydir << 4) | 0xe0;
}
diff --git a/src/devices/bus/bbc/userport/pointer.h b/src/devices/bus/bbc/userport/pointer.h
index a6e1bd0a629..5551a2c82dd 100644
--- a/src/devices/bus/bbc/userport/pointer.h
+++ b/src/devices/bus/bbc/userport/pointer.h
@@ -58,7 +58,7 @@ public:
// construction/destruction
bbc_amxmouse_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- uint8_t pb_r() override;
+ DECLARE_READ8_MEMBER(pb_r) override;
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
@@ -73,7 +73,7 @@ public:
// construction/destruction
bbc_m512mouse_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- uint8_t pb_r() override;
+ DECLARE_READ8_MEMBER(pb_r) override;
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
@@ -88,7 +88,7 @@ public:
// construction/destruction
bbc_tracker_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- uint8_t pb_r() override;
+ DECLARE_READ8_MEMBER(pb_r) override;
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
diff --git a/src/devices/bus/bbc/userport/userport.cpp b/src/devices/bus/bbc/userport/userport.cpp
index 601a6845801..a4610217651 100644
--- a/src/devices/bus/bbc/userport/userport.cpp
+++ b/src/devices/bus/bbc/userport/userport.cpp
@@ -89,10 +89,10 @@ void bbc_userport_slot_device::device_reset()
// pb_r
//-------------------------------------------------
-uint8_t bbc_userport_slot_device::pb_r()
+READ8_MEMBER(bbc_userport_slot_device::pb_r)
{
if (m_device)
- return m_device->pb_r();
+ return m_device->pb_r(space, 0);
else
return 0xff;
}
@@ -102,10 +102,10 @@ uint8_t bbc_userport_slot_device::pb_r()
// pb_w
//-------------------------------------------------
-void bbc_userport_slot_device::pb_w(uint8_t data)
+WRITE8_MEMBER(bbc_userport_slot_device::pb_w)
{
if (m_device)
- m_device->pb_w(data);
+ m_device->pb_w(space, 0, data);
}
diff --git a/src/devices/bus/bbc/userport/userport.h b/src/devices/bus/bbc/userport/userport.h
index e3040283a5a..e2807146efe 100644
--- a/src/devices/bus/bbc/userport/userport.h
+++ b/src/devices/bus/bbc/userport/userport.h
@@ -64,8 +64,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(cb1_w) { m_cb1_handler(state); }
DECLARE_WRITE_LINE_MEMBER(cb2_w) { m_cb2_handler(state); }
- uint8_t pb_r();
- void pb_w(uint8_t data);
+ DECLARE_READ8_MEMBER(pb_r);
+ DECLARE_WRITE8_MEMBER(pb_w);
protected:
// device-level overrides
@@ -88,8 +88,8 @@ public:
// construction/destruction
virtual ~device_bbc_userport_interface();
- virtual uint8_t pb_r() { return 0xff; }
- virtual void pb_w(uint8_t data) { }
+ virtual DECLARE_READ8_MEMBER(pb_r) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(pb_w) { }
protected:
device_bbc_userport_interface(const machine_config &mconfig, device_t &device);
diff --git a/src/devices/bus/bml3/bml3bus.cpp b/src/devices/bus/bml3/bml3bus.cpp
index 9acb1b9acb5..e1ff1ad39ab 100644
--- a/src/devices/bus/bml3/bml3bus.cpp
+++ b/src/devices/bus/bml3/bml3bus.cpp
@@ -102,13 +102,13 @@ bml3bus_device::bml3bus_device(const machine_config &mconfig, const char *tag, d
bml3bus_device::bml3bus_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_space(*this, finder_base::DUMMY_TAG, -1, 8),
+ m_maincpu(*this, finder_base::DUMMY_TAG),
m_out_nmi_cb(*this),
m_out_irq_cb(*this),
- m_out_firq_cb(*this)
+ m_out_firq_cb(*this),
+ m_cputag(nullptr)
{
}
-
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
diff --git a/src/devices/bus/bml3/bml3bus.h b/src/devices/bus/bml3/bml3bus.h
index 2132d376041..918e7b449b1 100644
--- a/src/devices/bus/bml3/bml3bus.h
+++ b/src/devices/bus/bml3/bml3bus.h
@@ -16,6 +16,33 @@
#define BML3BUS_MAX_SLOTS 6
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_BML3BUS_CPU(_cputag) \
+ downcast<bml3bus_device &>(*device).set_cputag(_cputag);
+
+#define MCFG_BML3BUS_OUT_NMI_CB(_devcb) \
+ downcast<bml3bus_device &>(*device).set_out_nmi_callback(DEVCB_##_devcb);
+
+#define MCFG_BML3BUS_OUT_IRQ_CB(_devcb) \
+ downcast<bml3bus_device &>(*device).set_out_irq_callback(DEVCB_##_devcb);
+
+#define MCFG_BML3BUS_OUT_FIRQ_CB(_devcb) \
+ downcast<bml3bus_device &>(*device).set_out_firq_callback(DEVCB_##_devcb);
+
+#define MCFG_BML3BUS_SLOT_ADD(_nbtag, _tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, BML3BUS_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<bml3bus_slot_device &>(*device).set_bml3bus_slot(_nbtag, _tag);
+#define MCFG_BML3BUS_SLOT_REMOVE(_tag) \
+ MCFG_DEVICE_REMOVE(_tag)
+
+#define MCFG_BML3BUS_ONBOARD_ADD(_nbtag, _tag, _dev_type) \
+ MCFG_DEVICE_ADD(_tag, _dev_type, 0) \
+ downcast<device_bml3bus_card_interface &>(*device).set_bml3bus_tag(_nbtag, _tag);
+
//**************************************************************************
// TYPE DEFINITIONS
@@ -28,18 +55,7 @@ class bml3bus_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- bml3bus_slot_device(machine_config const &mconfig, const char *tag, device_t *owner, const char *nbtag, T &&opts, const char *dflt)
- : bml3bus_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- set_bml3bus_slot(nbtag, tag);
- }
-
- bml3bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ bml3bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
@@ -67,10 +83,10 @@ public:
bml3bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration
- template <class Object> void set_space(Object &&tag, int spacenum) { m_space.set_tag(std::forward<Object>(tag), spacenum); }
- auto nmi_callback() { return m_out_nmi_cb.bind(); }
- auto irq_callback() { return m_out_irq_cb.bind(); }
- auto firq_callback() { return m_out_firq_cb.bind(); }
+ void set_cputag(const char *tag) { m_maincpu.set_tag(tag); }
+ template <class Object> devcb_base &set_out_nmi_callback(Object &&cb) { return m_out_nmi_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_irq_callback(Object &&cb) { return m_out_irq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_firq_callback(Object &&cb) { return m_out_firq_cb.set_callback(std::forward<Object>(cb)); }
void add_bml3bus_card(int slot, device_bml3bus_card_interface *card);
device_bml3bus_card_interface *get_bml3bus_card(int slot);
@@ -83,7 +99,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( irq_w );
DECLARE_WRITE_LINE_MEMBER( firq_w );
- address_space &space() const { return *m_space; }
+ address_space &space() const { return m_maincpu->space(AS_PROGRAM); }
protected:
bml3bus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -93,13 +109,14 @@ protected:
virtual void device_reset() override;
// internal state
- required_address_space m_space;
+ required_device<cpu_device> m_maincpu;
devcb_write_line m_out_nmi_cb;
devcb_write_line m_out_irq_cb;
devcb_write_line m_out_firq_cb;
device_bml3bus_card_interface *m_device_list[BML3BUS_MAX_SLOTS];
+ const char *m_cputag;
};
diff --git a/src/devices/bus/bw2/exp.cpp b/src/devices/bus/bw2/exp.cpp
index 50f776b066e..ae02f1f10fa 100644
--- a/src/devices/bus/bw2/exp.cpp
+++ b/src/devices/bus/bw2/exp.cpp
@@ -95,11 +95,11 @@ void bw2_expansion_slot_device::device_reset()
// cd_r - cartridge data read
//-------------------------------------------------
-uint8_t bw2_expansion_slot_device::cd_r(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6)
+uint8_t bw2_expansion_slot_device::cd_r(address_space &space, offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6)
{
if (m_cart != nullptr)
{
- data = m_cart->bw2_cd_r(offset, data, ram2, ram3, ram4, ram5, ram6);
+ data = m_cart->bw2_cd_r(space, offset, data, ram2, ram3, ram4, ram5, ram6);
}
return data;
@@ -110,11 +110,11 @@ uint8_t bw2_expansion_slot_device::cd_r(offs_t offset, uint8_t data, int ram2, i
// cd_w - cartridge data write
//-------------------------------------------------
-void bw2_expansion_slot_device::cd_w(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6)
+void bw2_expansion_slot_device::cd_w(address_space &space, offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6)
{
if (m_cart != nullptr)
{
- m_cart->bw2_cd_w(offset, data, ram2, ram3, ram4, ram5, ram6);
+ m_cart->bw2_cd_w(space, offset, data, ram2, ram3, ram4, ram5, ram6);
}
}
@@ -123,13 +123,13 @@ void bw2_expansion_slot_device::cd_w(offs_t offset, uint8_t data, int ram2, int
// slot_r - slot read
//-------------------------------------------------
-uint8_t bw2_expansion_slot_device::slot_r(offs_t offset)
+READ8_MEMBER( bw2_expansion_slot_device::slot_r )
{
uint8_t data = 0xff;
if (m_cart != nullptr)
{
- data = m_cart->bw2_slot_r(offset);
+ data = m_cart->bw2_slot_r(space, offset);
}
return data;
@@ -140,11 +140,11 @@ uint8_t bw2_expansion_slot_device::slot_r(offs_t offset)
// slot_w - slot write
//-------------------------------------------------
-void bw2_expansion_slot_device::slot_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( bw2_expansion_slot_device::slot_w )
{
if (m_cart != nullptr)
{
- m_cart->bw2_slot_w(offset, data);
+ m_cart->bw2_slot_w(space, offset, data);
}
}
@@ -153,13 +153,13 @@ void bw2_expansion_slot_device::slot_w(offs_t offset, uint8_t data)
// modsel_r - modsel read
//-------------------------------------------------
-uint8_t bw2_expansion_slot_device::modsel_r(offs_t offset)
+READ8_MEMBER( bw2_expansion_slot_device::modsel_r )
{
uint8_t data = 0xff;
if (m_cart != nullptr)
{
- data = m_cart->bw2_modsel_r(offset);
+ data = m_cart->bw2_modsel_r(space, offset);
}
return data;
@@ -170,11 +170,11 @@ uint8_t bw2_expansion_slot_device::modsel_r(offs_t offset)
// modsel_w - modsel write
//-------------------------------------------------
-void bw2_expansion_slot_device::modsel_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( bw2_expansion_slot_device::modsel_w )
{
if (m_cart != nullptr)
{
- m_cart->bw2_modsel_w(offset, data);
+ m_cart->bw2_modsel_w(space, offset, data);
}
}
diff --git a/src/devices/bus/bw2/exp.h b/src/devices/bus/bw2/exp.h
index d37e5c66879..5bd353c5d35 100644
--- a/src/devices/bus/bw2/exp.h
+++ b/src/devices/bus/bw2/exp.h
@@ -49,6 +49,17 @@
#define BW2_EXPANSION_SLOT_TAG "exp"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_BW2_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, BW2_EXPANSION_SLOT, _clock) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -62,28 +73,18 @@ class bw2_expansion_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- bw2_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock, T &&opts, char const *dflt)
- : bw2_expansion_slot_device(mconfig, tag, owner, clock)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
bw2_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~bw2_expansion_slot_device();
// computer interface
- uint8_t cd_r(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6);
- void cd_w(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6);
+ uint8_t cd_r(address_space &space, offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6);
+ void cd_w(address_space &space, offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6);
- uint8_t slot_r(offs_t offset);
- void slot_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( slot_r );
+ DECLARE_WRITE8_MEMBER( slot_w );
- uint8_t modsel_r(offs_t offset);
- void modsel_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( modsel_r );
+ DECLARE_WRITE8_MEMBER( modsel_w );
protected:
// device-level overrides
@@ -103,14 +104,14 @@ public:
// construction/destruction
virtual ~device_bw2_expansion_slot_interface();
- virtual uint8_t bw2_cd_r(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6) { return data; }
- virtual void bw2_cd_w(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6) { }
+ virtual uint8_t bw2_cd_r(address_space &space, offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6) { return data; };
+ virtual void bw2_cd_w(address_space &space, offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6) { };
- virtual uint8_t bw2_slot_r(offs_t offset) { return 0xff; }
- virtual void bw2_slot_w(offs_t offset, uint8_t data) { }
+ virtual uint8_t bw2_slot_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void bw2_slot_w(address_space &space, offs_t offset, uint8_t data) { }
- virtual uint8_t bw2_modsel_r(offs_t offset) { return 0xff; }
- virtual void bw2_modsel_w(offs_t offset, uint8_t data) { }
+ virtual uint8_t bw2_modsel_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void bw2_modsel_w(address_space &space, offs_t offset, uint8_t data) { }
protected:
device_bw2_expansion_slot_interface(const machine_config &mconfig, device_t &device);
diff --git a/src/devices/bus/bw2/ramcard.cpp b/src/devices/bus/bw2/ramcard.cpp
index 48de6cffdec..b59159cd5b1 100644
--- a/src/devices/bus/bw2/ramcard.cpp
+++ b/src/devices/bus/bw2/ramcard.cpp
@@ -88,7 +88,7 @@ void bw2_ramcard_device::device_reset()
// bw2_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t bw2_ramcard_device::bw2_cd_r(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6)
+uint8_t bw2_ramcard_device::bw2_cd_r(address_space &space, offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6)
{
if (!ram2)
{
@@ -107,7 +107,7 @@ uint8_t bw2_ramcard_device::bw2_cd_r(offs_t offset, uint8_t data, int ram2, int
// bw2_cd_r - cartridge data write
//-------------------------------------------------
-void bw2_ramcard_device::bw2_cd_w(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6)
+void bw2_ramcard_device::bw2_cd_w(address_space &space, offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6)
{
if (m_en && !ram5)
{
@@ -120,7 +120,7 @@ void bw2_ramcard_device::bw2_cd_w(offs_t offset, uint8_t data, int ram2, int ram
// bw2_slot_w - slot write
//-------------------------------------------------
-void bw2_ramcard_device::bw2_slot_w(offs_t offset, uint8_t data)
+void bw2_ramcard_device::bw2_slot_w(address_space &space, offs_t offset, uint8_t data)
{
m_en = 1;
m_bank = data & 0x0f;
diff --git a/src/devices/bus/bw2/ramcard.h b/src/devices/bus/bw2/ramcard.h
index 029d9b91feb..9ac2b0433fa 100644
--- a/src/devices/bus/bw2/ramcard.h
+++ b/src/devices/bus/bw2/ramcard.h
@@ -37,9 +37,9 @@ protected:
virtual void device_reset() override;
// device_bw2_expansion_slot_interface overrides
- virtual uint8_t bw2_cd_r(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6) override;
- virtual void bw2_cd_w(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6) override;
- virtual void bw2_slot_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t bw2_cd_r(address_space &space, offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6) override;
+ virtual void bw2_cd_w(address_space &space, offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6) override;
+ virtual void bw2_slot_w(address_space &space, offs_t offset, uint8_t data) override;
private:
required_memory_region m_rom;
diff --git a/src/devices/bus/c64/16kb.cpp b/src/devices/bus/c64/16kb.cpp
index 4b497f88591..4b23cb663f7 100644
--- a/src/devices/bus/c64/16kb.cpp
+++ b/src/devices/bus/c64/16kb.cpp
@@ -22,12 +22,13 @@ DEFINE_DEVICE_TYPE(C64_16KB, c64_16kb_cartridge_device, "c64_16kb", "C64 16KB EP
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_16kb_cartridge_device::device_add_mconfig(machine_config &config)
-{
- GENERIC_CARTSLOT(config, m_low, generic_linear_slot, nullptr, "rom,bin,80");
+MACHINE_CONFIG_START(c64_16kb_cartridge_device::device_add_mconfig)
+ MCFG_GENERIC_CARTSLOT_ADD("roml", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("rom,bin,80")
- GENERIC_CARTSLOT(config, m_high, generic_linear_slot, nullptr, "rom,bin,a0,e0");
-}
+ MCFG_GENERIC_CARTSLOT_ADD("romh", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("rom,bin,a0,e0")
+MACHINE_CONFIG_END
//-------------------------------------------------
@@ -98,15 +99,15 @@ void c64_16kb_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_16kb_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_16kb_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
- data = m_low->read_rom(offset & 0x1fff);
+ data = m_low->read_rom(space, offset & 0x1fff);
}
else if (!romh)
{
- data = m_high->read_rom(offset & 0x1fff);
+ data = m_high->read_rom(space, offset & 0x1fff);
}
return data;
diff --git a/src/devices/bus/c64/16kb.h b/src/devices/bus/c64/16kb.h
index db7f294fda0..97afa77f5af 100644
--- a/src/devices/bus/c64/16kb.h
+++ b/src/devices/bus/c64/16kb.h
@@ -41,7 +41,7 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
required_ioport m_sw1;
diff --git a/src/devices/bus/c64/c128_comal80.cpp b/src/devices/bus/c64/c128_comal80.cpp
index f1ce8c5c87a..234a3499a19 100644
--- a/src/devices/bus/c64/c128_comal80.cpp
+++ b/src/devices/bus/c64/c128_comal80.cpp
@@ -60,7 +60,7 @@ void c128_comal80_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c128_comal80_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c128_comal80_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!romh)
{
@@ -80,7 +80,7 @@ uint8_t c128_comal80_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c128_comal80_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c128_comal80_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/c128_comal80.h b/src/devices/bus/c64/c128_comal80.h
index fe413f9bef6..c141cffb69e 100644
--- a/src/devices/bus/c64/c128_comal80.h
+++ b/src/devices/bus/c64/c128_comal80.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/c128_partner.cpp b/src/devices/bus/c64/c128_partner.cpp
index 91b7cf751ab..d5e74cc43cb 100644
--- a/src/devices/bus/c64/c128_partner.cpp
+++ b/src/devices/bus/c64/c128_partner.cpp
@@ -147,7 +147,7 @@ void c128_partner_cartridge_device::device_timer(emu_timer &timer, device_timer_
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c128_partner_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c128_partner_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -185,7 +185,7 @@ uint8_t c128_partner_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c128_partner_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c128_partner_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/c128_partner.h b/src/devices/bus/c64/c128_partner.h
index 1f4402d5b22..632e526b035 100644
--- a/src/devices/bus/c64/c128_partner.h
+++ b/src/devices/bus/c64/c128_partner.h
@@ -42,8 +42,8 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
// device_vcs_control_port_interface overrides
virtual void vcs_joy_w(uint8_t data);
diff --git a/src/devices/bus/c64/comal80.cpp b/src/devices/bus/c64/comal80.cpp
index 0ce6dcbfb5a..24c966eccc1 100644
--- a/src/devices/bus/c64/comal80.cpp
+++ b/src/devices/bus/c64/comal80.cpp
@@ -60,7 +60,7 @@ void c64_comal80_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_comal80_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_comal80_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml || !romh)
{
@@ -76,7 +76,7 @@ uint8_t c64_comal80_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_comal80_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_comal80_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/comal80.h b/src/devices/bus/c64/comal80.h
index af0958a8940..fb0ceaad303 100644
--- a/src/devices/bus/c64/comal80.h
+++ b/src/devices/bus/c64/comal80.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/cpm.cpp b/src/devices/bus/c64/cpm.cpp
index 7a909f6e920..81b6dd4eea2 100644
--- a/src/devices/bus/c64/cpm.cpp
+++ b/src/devices/bus/c64/cpm.cpp
@@ -161,7 +161,7 @@ void c64_cpm_cartridge_device::device_reset()
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_cpm_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_cpm_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
@@ -201,7 +201,7 @@ READ8_MEMBER( c64_cpm_cartridge_device::dma_r )
{
offs_t addr = (offset + 0x1000) & 0xffff;
- data = m_slot->dma_cd_r(addr);
+ data = m_slot->dma_cd_r(space, addr);
}
return data;
@@ -218,6 +218,6 @@ WRITE8_MEMBER( c64_cpm_cartridge_device::dma_w )
{
offs_t addr = (offset + 0x1000) & 0xffff;
- m_slot->dma_cd_w(addr, data);
+ m_slot->dma_cd_w(space, addr, data);
}
}
diff --git a/src/devices/bus/c64/cpm.h b/src/devices/bus/c64/cpm.h
index 63d3a7123cd..f0da4d6c0f7 100644
--- a/src/devices/bus/c64/cpm.h
+++ b/src/devices/bus/c64/cpm.h
@@ -38,7 +38,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
private:
diff --git a/src/devices/bus/c64/currah_speech.cpp b/src/devices/bus/c64/currah_speech.cpp
index 2ce77f2ea04..84d64f2ea2a 100644
--- a/src/devices/bus/c64/currah_speech.cpp
+++ b/src/devices/bus/c64/currah_speech.cpp
@@ -170,7 +170,7 @@ void c64_currah_speech_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_currah_speech_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_currah_speech_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!romh)
{
@@ -210,7 +210,7 @@ uint8_t c64_currah_speech_cartridge_device::c64_cd_r(offs_t offset, uint8_t data
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_currah_speech_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_currah_speech_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/currah_speech.h b/src/devices/bus/c64/currah_speech.h
index f856833f659..44d5adb083a 100644
--- a/src/devices/bus/c64/currah_speech.h
+++ b/src/devices/bus/c64/currah_speech.h
@@ -40,8 +40,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
inline void set_osc1(int voice, int intonation);
diff --git a/src/devices/bus/c64/dela_ep256.cpp b/src/devices/bus/c64/dela_ep256.cpp
index 107f2828d21..e11b3ae8f53 100644
--- a/src/devices/bus/c64/dela_ep256.cpp
+++ b/src/devices/bus/c64/dela_ep256.cpp
@@ -22,17 +22,24 @@ DEFINE_DEVICE_TYPE(C64_DELA_EP256, c64_dela_ep256_cartridge_device, "delep256",
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_dela_ep256_cartridge_device::device_add_mconfig(machine_config &config)
-{
- GENERIC_SOCKET(config, "rom1", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom2", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom3", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom4", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom5", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom6", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom7", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom8", generic_linear_slot, nullptr, "bin,rom");
-}
+MACHINE_CONFIG_START(c64_dela_ep256_cartridge_device::device_add_mconfig)
+ MCFG_GENERIC_SOCKET_ADD("rom1", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom2", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom3", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom4", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom5", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom6", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom7", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom8", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+MACHINE_CONFIG_END
@@ -87,7 +94,7 @@ void c64_dela_ep256_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_dela_ep256_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_dela_ep256_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -98,7 +105,7 @@ uint8_t c64_dela_ep256_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, i
else
{
offs_t addr = (m_bank << 13) | (offset & 0x1fff);
- data = m_eproms[m_socket]->read_rom(addr);
+ data = m_eproms[m_socket]->read_rom(space, addr);
}
}
@@ -110,7 +117,7 @@ uint8_t c64_dela_ep256_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, i
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_dela_ep256_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_dela_ep256_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io2 && ((offset & 0xf0) == 0xa0))
{
diff --git a/src/devices/bus/c64/dela_ep256.h b/src/devices/bus/c64/dela_ep256.h
index 61501df0790..bcc1992b969 100644
--- a/src/devices/bus/c64/dela_ep256.h
+++ b/src/devices/bus/c64/dela_ep256.h
@@ -40,8 +40,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
generic_slot_device *m_eproms[8];
diff --git a/src/devices/bus/c64/dela_ep64.cpp b/src/devices/bus/c64/dela_ep64.cpp
index 5798794f7eb..c9eee384a5a 100644
--- a/src/devices/bus/c64/dela_ep64.cpp
+++ b/src/devices/bus/c64/dela_ep64.cpp
@@ -22,11 +22,12 @@ DEFINE_DEVICE_TYPE(C64_DELA_EP64, c64_dela_ep64_cartridge_device, "c64_dela_ep64
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_dela_ep64_cartridge_device::device_add_mconfig(machine_config &config)
-{
- GENERIC_SOCKET(config, m_eprom1, generic_linear_slot, nullptr, "rom,bin");
- GENERIC_SOCKET(config, m_eprom2, generic_linear_slot, nullptr, "rom,bin");
-}
+MACHINE_CONFIG_START(c64_dela_ep64_cartridge_device::device_add_mconfig)
+ MCFG_GENERIC_SOCKET_ADD("eprom1", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("rom,bin")
+ MCFG_GENERIC_SOCKET_ADD("eprom2", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("rom,bin")
+MACHINE_CONFIG_END
//**************************************************************************
@@ -77,7 +78,7 @@ void c64_dela_ep64_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_dela_ep64_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_dela_ep64_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -90,8 +91,8 @@ uint8_t c64_dela_ep64_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, in
offs_t addr = (m_bank << 13) | (offset & 0x1fff);
if (!m_rom0_ce) data |= m_roml[offset & 0x1fff];
- if (!m_rom1_ce) data |= m_eprom1->read_rom(addr);
- if (!m_rom2_ce) data |= m_eprom2->read_rom(addr);
+ if (!m_rom1_ce) data |= m_eprom1->read_rom(space, addr);
+ if (!m_rom2_ce) data |= m_eprom2->read_rom(space, addr);
}
}
@@ -103,7 +104,7 @@ uint8_t c64_dela_ep64_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, in
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_dela_ep64_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_dela_ep64_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/dela_ep64.h b/src/devices/bus/c64/dela_ep64.h
index 95ac3440871..a3e2d77bd48 100644
--- a/src/devices/bus/c64/dela_ep64.h
+++ b/src/devices/bus/c64/dela_ep64.h
@@ -40,8 +40,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
required_device<generic_slot_device> m_eprom1;
diff --git a/src/devices/bus/c64/dela_ep7x8.cpp b/src/devices/bus/c64/dela_ep7x8.cpp
index 0c71555b880..564e7196449 100644
--- a/src/devices/bus/c64/dela_ep7x8.cpp
+++ b/src/devices/bus/c64/dela_ep7x8.cpp
@@ -22,16 +22,22 @@ DEFINE_DEVICE_TYPE(C64_DELA_EP7X8, c64_dela_ep7x8_cartridge_device, "c64_dela_ep
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_dela_ep7x8_cartridge_device::device_add_mconfig(machine_config &config)
-{
- GENERIC_SOCKET(config, m_eprom[0], generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, m_eprom[1], generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, m_eprom[2], generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, m_eprom[3], generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, m_eprom[4], generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, m_eprom[5], generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, m_eprom[6], generic_linear_slot, nullptr, "bin,rom");
-}
+MACHINE_CONFIG_START(c64_dela_ep7x8_cartridge_device::device_add_mconfig)
+ MCFG_GENERIC_SOCKET_ADD("rom1", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom2", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom3", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom4", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom5", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom6", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom7", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+MACHINE_CONFIG_END
//**************************************************************************
@@ -45,7 +51,13 @@ void c64_dela_ep7x8_cartridge_device::device_add_mconfig(machine_config &config)
c64_dela_ep7x8_cartridge_device::c64_dela_ep7x8_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, C64_DELA_EP7X8, tag, owner, clock),
device_c64_expansion_card_interface(mconfig, *this),
- m_eprom(*this, "rom%u", 1U)
+ m_eprom1(*this, "rom1"),
+ m_eprom2(*this, "rom2"),
+ m_eprom3(*this, "rom3"),
+ m_eprom4(*this, "rom4"),
+ m_eprom5(*this, "rom5"),
+ m_eprom6(*this, "rom6"),
+ m_eprom7(*this, "rom7"), m_bank(0)
{
}
@@ -76,20 +88,20 @@ void c64_dela_ep7x8_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_dela_ep7x8_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_dela_ep7x8_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
offs_t addr = offset & 0x1fff;
if (!BIT(m_bank, 0)) data |= m_roml[addr];
- if (!BIT(m_bank, 1)) data |= m_eprom[0]->read_rom(addr);
- if (!BIT(m_bank, 2)) data |= m_eprom[1]->read_rom(addr);
- if (!BIT(m_bank, 3)) data |= m_eprom[2]->read_rom(addr);
- if (!BIT(m_bank, 4)) data |= m_eprom[3]->read_rom(addr);
- if (!BIT(m_bank, 5)) data |= m_eprom[4]->read_rom(addr);
- if (!BIT(m_bank, 6)) data |= m_eprom[5]->read_rom(addr);
- if (!BIT(m_bank, 7)) data |= m_eprom[6]->read_rom(addr);
+ if (!BIT(m_bank, 1)) data |= m_eprom1->read_rom(space, addr);
+ if (!BIT(m_bank, 2)) data |= m_eprom2->read_rom(space, addr);
+ if (!BIT(m_bank, 3)) data |= m_eprom3->read_rom(space, addr);
+ if (!BIT(m_bank, 4)) data |= m_eprom4->read_rom(space, addr);
+ if (!BIT(m_bank, 5)) data |= m_eprom5->read_rom(space, addr);
+ if (!BIT(m_bank, 6)) data |= m_eprom6->read_rom(space, addr);
+ if (!BIT(m_bank, 7)) data |= m_eprom7->read_rom(space, addr);
}
return data;
@@ -100,7 +112,7 @@ uint8_t c64_dela_ep7x8_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, i
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_dela_ep7x8_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_dela_ep7x8_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/dela_ep7x8.h b/src/devices/bus/c64/dela_ep7x8.h
index 50e1b3af01e..48146d1c5e1 100644
--- a/src/devices/bus/c64/dela_ep7x8.h
+++ b/src/devices/bus/c64/dela_ep7x8.h
@@ -40,11 +40,17 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
- required_device_array<generic_slot_device, 7> m_eprom;
+ required_device<generic_slot_device> m_eprom1;
+ required_device<generic_slot_device> m_eprom2;
+ required_device<generic_slot_device> m_eprom3;
+ required_device<generic_slot_device> m_eprom4;
+ required_device<generic_slot_device> m_eprom5;
+ required_device<generic_slot_device> m_eprom6;
+ required_device<generic_slot_device> m_eprom7;
uint8_t m_bank;
};
diff --git a/src/devices/bus/c64/dinamic.cpp b/src/devices/bus/c64/dinamic.cpp
index 13d37749335..8ab60892263 100644
--- a/src/devices/bus/c64/dinamic.cpp
+++ b/src/devices/bus/c64/dinamic.cpp
@@ -60,7 +60,7 @@ void c64_dinamic_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_dinamic_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_dinamic_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
diff --git a/src/devices/bus/c64/dinamic.h b/src/devices/bus/c64/dinamic.h
index e204964e4a1..84bd1503503 100644
--- a/src/devices/bus/c64/dinamic.h
+++ b/src/devices/bus/c64/dinamic.h
@@ -35,7 +35,7 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/dqbb.cpp b/src/devices/bus/c64/dqbb.cpp
index 20adedd9057..b9cb32ce1cc 100644
--- a/src/devices/bus/c64/dqbb.cpp
+++ b/src/devices/bus/c64/dqbb.cpp
@@ -78,7 +78,7 @@ void c64_dqbb_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_dqbb_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_dqbb_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!m_cs && (!roml || !romh))
{
@@ -93,7 +93,7 @@ uint8_t c64_dqbb_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sph
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_dqbb_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_dqbb_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!m_cs && m_we && (offset >= 0x8000 && offset < 0xc000))
{
diff --git a/src/devices/bus/c64/dqbb.h b/src/devices/bus/c64/dqbb.h
index aaa8c0e1bf4..6c472eb6696 100644
--- a/src/devices/bus/c64/dqbb.h
+++ b/src/devices/bus/c64/dqbb.h
@@ -42,8 +42,8 @@ protected:
virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } }
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
int m_cs;
diff --git a/src/devices/bus/c64/easy_calc_result.cpp b/src/devices/bus/c64/easy_calc_result.cpp
index 123870d5d3e..4ddd4cbdac0 100644
--- a/src/devices/bus/c64/easy_calc_result.cpp
+++ b/src/devices/bus/c64/easy_calc_result.cpp
@@ -80,7 +80,7 @@ void c64_easy_calc_result_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_easy_calc_result_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_easy_calc_result_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -99,7 +99,7 @@ uint8_t c64_easy_calc_result_cartridge_device::c64_cd_r(offs_t offset, uint8_t d
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_easy_calc_result_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_easy_calc_result_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/easy_calc_result.h b/src/devices/bus/c64/easy_calc_result.h
index 2d945b7dea2..377bbd12b17 100644
--- a/src/devices/bus/c64/easy_calc_result.h
+++ b/src/devices/bus/c64/easy_calc_result.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
int m_bank;
diff --git a/src/devices/bus/c64/easyflash.cpp b/src/devices/bus/c64/easyflash.cpp
index 38cdf9739c6..abdd891572f 100644
--- a/src/devices/bus/c64/easyflash.cpp
+++ b/src/devices/bus/c64/easyflash.cpp
@@ -114,17 +114,17 @@ void c64_easyflash_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_easyflash_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_easyflash_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
offs_t addr = (m_bank << 13) | (offset & 0x1fff);
- data = m_flash_roml->read(addr);
+ data = m_flash_roml->read(space, addr);
}
else if (!romh)
{
offs_t addr = (m_bank << 13) | (offset & 0x1fff);
- data = m_flash_romh->read(addr);
+ data = m_flash_romh->read(space, addr);
}
else if (!io2)
{
@@ -139,17 +139,17 @@ uint8_t c64_easyflash_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, in
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_easyflash_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_easyflash_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
offs_t addr = (m_bank << 13) | (offset & 0x1fff);
- m_flash_roml->write(addr, data);
+ m_flash_roml->write(space, addr, data);
}
else if (!romh)
{
offs_t addr = (m_bank << 13) | (offset & 0x1fff);
- m_flash_romh->write(addr, data);
+ m_flash_romh->write(space, addr, data);
}
else if (!io1)
{
diff --git a/src/devices/bus/c64/easyflash.h b/src/devices/bus/c64/easyflash.h
index 377de25d50d..ef11fa5162d 100644
--- a/src/devices/bus/c64/easyflash.h
+++ b/src/devices/bus/c64/easyflash.h
@@ -40,8 +40,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
diff --git a/src/devices/bus/c64/epyx_fast_load.cpp b/src/devices/bus/c64/epyx_fast_load.cpp
index 4dced91c76a..d119091555b 100644
--- a/src/devices/bus/c64/epyx_fast_load.cpp
+++ b/src/devices/bus/c64/epyx_fast_load.cpp
@@ -80,7 +80,7 @@ void c64_epyx_fast_load_cartridge_device::device_timer(emu_timer &timer, device_
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_epyx_fast_load_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_epyx_fast_load_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -107,7 +107,7 @@ uint8_t c64_epyx_fast_load_cartridge_device::c64_cd_r(offs_t offset, uint8_t dat
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_epyx_fast_load_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_epyx_fast_load_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/epyx_fast_load.h b/src/devices/bus/c64/epyx_fast_load.h
index 64d23f6febb..42f04254703 100644
--- a/src/devices/bus/c64/epyx_fast_load.h
+++ b/src/devices/bus/c64/epyx_fast_load.h
@@ -36,8 +36,8 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
emu_timer *m_exrom_timer;
diff --git a/src/devices/bus/c64/exos.cpp b/src/devices/bus/c64/exos.cpp
index 13c5d972642..5c41cd7d6d3 100644
--- a/src/devices/bus/c64/exos.cpp
+++ b/src/devices/bus/c64/exos.cpp
@@ -47,7 +47,7 @@ void c64_exos_cartridge_device::device_start()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_exos_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_exos_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!romh)
{
diff --git a/src/devices/bus/c64/exos.h b/src/devices/bus/c64/exos.h
index 73b9b2699aa..93872e38e7a 100644
--- a/src/devices/bus/c64/exos.h
+++ b/src/devices/bus/c64/exos.h
@@ -34,7 +34,7 @@ protected:
virtual void device_start() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
};
diff --git a/src/devices/bus/c64/exp.cpp b/src/devices/bus/c64/exp.cpp
index 2d4743fe7c4..1dc007f95a0 100644
--- a/src/devices/bus/c64/exp.cpp
+++ b/src/devices/bus/c64/exp.cpp
@@ -225,11 +225,11 @@ std::string c64_expansion_slot_device::get_default_card_software(get_default_car
// cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_expansion_slot_device::cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_expansion_slot_device::cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (m_card != nullptr)
{
- data = m_card->c64_cd_r(offset, data, sphi2, ba, roml, romh, io1, io2);
+ data = m_card->c64_cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2);
}
return data;
@@ -240,11 +240,11 @@ uint8_t c64_expansion_slot_device::cd_r(offs_t offset, uint8_t data, int sphi2,
// cd_w - cartridge data write
//-------------------------------------------------
-void c64_expansion_slot_device::cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_expansion_slot_device::cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (m_card != nullptr)
{
- m_card->c64_cd_w(offset, data, sphi2, ba, roml, romh, io1, io2);
+ m_card->c64_cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2);
}
}
diff --git a/src/devices/bus/c64/exp.h b/src/devices/bus/c64/exp.h
index 7cba776f683..c188434d1b8 100644
--- a/src/devices/bus/c64/exp.h
+++ b/src/devices/bus/c64/exp.h
@@ -81,14 +81,14 @@ public:
auto dma_callback() { return m_write_dma.bind(); }
// computer interface
- uint8_t cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2);
- void cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ uint8_t cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ void cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2);
int game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
int exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
// cartridge interface
- uint8_t dma_cd_r(offs_t offset) { return m_read_dma_cd(offset); }
- void dma_cd_w(offs_t offset, uint8_t data) { m_write_dma_cd(offset, data); }
+ DECLARE_READ8_MEMBER( dma_cd_r ) { return m_read_dma_cd(offset); }
+ DECLARE_WRITE8_MEMBER( dma_cd_w ) { m_write_dma_cd(offset, data); }
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_write_irq(state); }
DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_write_nmi(state); }
DECLARE_WRITE_LINE_MEMBER( dma_w ) { m_write_dma(state); }
@@ -145,8 +145,8 @@ public:
// construction/destruction
virtual ~device_c64_expansion_card_interface();
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) { return data; };
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) { };
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) { return data; };
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) { };
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) { return m_game; }
virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) { return m_exrom; }
diff --git a/src/devices/bus/c64/fcc.cpp b/src/devices/bus/c64/fcc.cpp
index 24aaa6ec523..77d505e97a3 100644
--- a/src/devices/bus/c64/fcc.cpp
+++ b/src/devices/bus/c64/fcc.cpp
@@ -75,11 +75,10 @@ void c64_final_chesscard_device::c64_fcc_map(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_final_chesscard_device::device_add_mconfig(machine_config &config)
-{
- M65SC02(config, m_maincpu, XTAL(5'000'000));
- m_maincpu->set_addrmap(AS_PROGRAM, &c64_final_chesscard_device::c64_fcc_map);
-}
+MACHINE_CONFIG_START(c64_final_chesscard_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(G65SC02P4_TAG, M65SC02, XTAL(5'000'000))
+ MCFG_DEVICE_PROGRAM_MAP(c64_fcc_map)
+MACHINE_CONFIG_END
//-------------------------------------------------
@@ -148,7 +147,7 @@ void c64_final_chesscard_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_final_chesscard_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_final_chesscard_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -174,7 +173,7 @@ uint8_t c64_final_chesscard_device::c64_cd_r(offs_t offset, uint8_t data, int sp
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_final_chesscard_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_final_chesscard_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
diff --git a/src/devices/bus/c64/fcc.h b/src/devices/bus/c64/fcc.h
index 3988a597fd4..4d548f38528 100644
--- a/src/devices/bus/c64/fcc.h
+++ b/src/devices/bus/c64/fcc.h
@@ -46,8 +46,8 @@ protected:
virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } }
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
required_device<m65sc02_device> m_maincpu;
diff --git a/src/devices/bus/c64/final.cpp b/src/devices/bus/c64/final.cpp
index 36b8ee1bae6..90be1e6e588 100644
--- a/src/devices/bus/c64/final.cpp
+++ b/src/devices/bus/c64/final.cpp
@@ -94,7 +94,7 @@ void c64_final_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_final_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_final_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml || !romh || !io1 || !io2)
{
@@ -120,7 +120,7 @@ uint8_t c64_final_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sp
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_final_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_final_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/final.h b/src/devices/bus/c64/final.h
index 6d59e737c02..a8ed113f13b 100644
--- a/src/devices/bus/c64/final.h
+++ b/src/devices/bus/c64/final.h
@@ -40,8 +40,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
};
diff --git a/src/devices/bus/c64/final3.cpp b/src/devices/bus/c64/final3.cpp
index 23b54a829e0..9a64e7c4172 100644
--- a/src/devices/bus/c64/final3.cpp
+++ b/src/devices/bus/c64/final3.cpp
@@ -104,7 +104,7 @@ void c64_final3_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_final3_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_final3_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml || !romh || !io1 || !io2)
{
@@ -120,7 +120,7 @@ uint8_t c64_final3_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int s
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_final3_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_final3_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!m_hidden && !io2 && ((offset & 0xff) == 0xff))
{
diff --git a/src/devices/bus/c64/final3.h b/src/devices/bus/c64/final3.h
index 8b020482560..d424c76537a 100644
--- a/src/devices/bus/c64/final3.h
+++ b/src/devices/bus/c64/final3.h
@@ -40,8 +40,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/fun_play.cpp b/src/devices/bus/c64/fun_play.cpp
index 2a211b21ab5..b4b7a7285d2 100644
--- a/src/devices/bus/c64/fun_play.cpp
+++ b/src/devices/bus/c64/fun_play.cpp
@@ -60,7 +60,7 @@ void c64_fun_play_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_fun_play_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_fun_play_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -76,7 +76,7 @@ uint8_t c64_fun_play_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_fun_play_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_fun_play_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/fun_play.h b/src/devices/bus/c64/fun_play.h
index 6fc082164c6..ba62626651a 100644
--- a/src/devices/bus/c64/fun_play.h
+++ b/src/devices/bus/c64/fun_play.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/geocable.cpp b/src/devices/bus/c64/geocable.cpp
index e07734f987f..e740ec0da69 100644
--- a/src/devices/bus/c64/geocable.cpp
+++ b/src/devices/bus/c64/geocable.cpp
@@ -30,11 +30,10 @@ DEFINE_DEVICE_TYPE(C64_GEOCABLE, c64_geocable_device, "c64_geocable", "C64 geoCa
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_geocable_device::device_add_mconfig(machine_config &config)
-{
- CENTRONICS(config, m_centronics, centronics_devices, "printer");
- m_centronics->busy_handler().set(FUNC(c64_geocable_device::output_b));
-}
+MACHINE_CONFIG_START(c64_geocable_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer")
+ MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, c64_geocable_device, output_b))
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/c64/georam.cpp b/src/devices/bus/c64/georam.cpp
index 6bf8a16a1d8..e82061df80e 100644
--- a/src/devices/bus/c64/georam.cpp
+++ b/src/devices/bus/c64/georam.cpp
@@ -64,7 +64,7 @@ void c64_georam_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_georam_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_georam_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
@@ -80,7 +80,7 @@ uint8_t c64_georam_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int s
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_georam_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_georam_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/georam.h b/src/devices/bus/c64/georam.h
index 03967625c23..352ddff6d1b 100644
--- a/src/devices/bus/c64/georam.h
+++ b/src/devices/bus/c64/georam.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
optional_shared_ptr<uint8_t> m_ram;
diff --git a/src/devices/bus/c64/ide64.cpp b/src/devices/bus/c64/ide64.cpp
index 1942ce466b5..f70ca03c10a 100644
--- a/src/devices/bus/c64/ide64.cpp
+++ b/src/devices/bus/c64/ide64.cpp
@@ -134,7 +134,7 @@ void c64_ide64_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_ide64_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_ide64_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!m_enable) return data;
@@ -225,7 +225,7 @@ uint8_t c64_ide64_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sp
{
offs_t addr = (m_bank << 14) | (offset & 0x3fff);
- data = m_flash_rom->read(addr);
+ data = m_flash_rom->read(space, addr);
}
else if (!ram_oe)
{
@@ -240,7 +240,7 @@ uint8_t c64_ide64_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sp
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_ide64_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_ide64_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!m_enable) return;
@@ -259,7 +259,7 @@ void c64_ide64_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2
if ((offset >= 0x8000 && offset < 0xc000) && !m_wp)
{
offs_t addr = (m_bank << 14) | (offset & 0x3fff);
- m_flash_rom->write(addr, data);
+ m_flash_rom->write(space, addr, data);
}
if (!io1)
diff --git a/src/devices/bus/c64/ide64.h b/src/devices/bus/c64/ide64.h
index bfabad10c87..b43e7bdaf98 100644
--- a/src/devices/bus/c64/ide64.h
+++ b/src/devices/bus/c64/ide64.h
@@ -43,8 +43,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) override;
diff --git a/src/devices/bus/c64/ieee488.cpp b/src/devices/bus/c64/ieee488.cpp
index d77e5064dfc..db1558b9766 100644
--- a/src/devices/bus/c64/ieee488.cpp
+++ b/src/devices/bus/c64/ieee488.cpp
@@ -202,9 +202,9 @@ void c64_ieee488_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_ieee488_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_ieee488_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
- data = m_exp->cd_r(offset, data, sphi2, ba, roml, romh, io1, io2);
+ data = m_exp->cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2);
if (!roml && m_roml_sel)
{
@@ -212,7 +212,7 @@ uint8_t c64_ieee488_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int
}
else if (!io2)
{
- data = m_tpi->read(offset & 0x07);
+ data = m_tpi->read(space, offset & 0x07);
}
return data;
@@ -223,14 +223,14 @@ uint8_t c64_ieee488_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_ieee488_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_ieee488_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io2)
{
- m_tpi->write(offset & 0x07, data);
+ m_tpi->write(space, offset & 0x07, data);
}
- m_exp->cd_w(offset, data, sphi2, ba, roml, romh, io1, io2);
+ m_exp->cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2);
}
diff --git a/src/devices/bus/c64/ieee488.h b/src/devices/bus/c64/ieee488.h
index ab3c7748b8d..185a2623317 100644
--- a/src/devices/bus/c64/ieee488.h
+++ b/src/devices/bus/c64/ieee488.h
@@ -39,8 +39,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
private:
diff --git a/src/devices/bus/c64/kingsoft.cpp b/src/devices/bus/c64/kingsoft.cpp
index 510032fb720..84263b71da7 100644
--- a/src/devices/bus/c64/kingsoft.cpp
+++ b/src/devices/bus/c64/kingsoft.cpp
@@ -57,7 +57,7 @@ void c64_kingsoft_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_kingsoft_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_kingsoft_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -80,7 +80,7 @@ uint8_t c64_kingsoft_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_kingsoft_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_kingsoft_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/kingsoft.h b/src/devices/bus/c64/kingsoft.h
index 3a9fda45fef..89b2a4e0367 100644
--- a/src/devices/bus/c64/kingsoft.h
+++ b/src/devices/bus/c64/kingsoft.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
};
diff --git a/src/devices/bus/c64/mach5.cpp b/src/devices/bus/c64/mach5.cpp
index ddd44407d3e..f312a14e1d4 100644
--- a/src/devices/bus/c64/mach5.cpp
+++ b/src/devices/bus/c64/mach5.cpp
@@ -88,7 +88,7 @@ void c64_mach5_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_mach5_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_mach5_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml || !romh || !io1 || !io2)
{
@@ -103,7 +103,7 @@ uint8_t c64_mach5_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sp
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_mach5_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_mach5_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!m_c128)
{
diff --git a/src/devices/bus/c64/mach5.h b/src/devices/bus/c64/mach5.h
index a49e1bec347..affe03a52dc 100644
--- a/src/devices/bus/c64/mach5.h
+++ b/src/devices/bus/c64/mach5.h
@@ -37,8 +37,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
required_ioport m_s1;
diff --git a/src/devices/bus/c64/magic_desk.cpp b/src/devices/bus/c64/magic_desk.cpp
index 2fe55681966..9f72a1f416f 100644
--- a/src/devices/bus/c64/magic_desk.cpp
+++ b/src/devices/bus/c64/magic_desk.cpp
@@ -60,7 +60,7 @@ void c64_magic_desk_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_magic_desk_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_magic_desk_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -76,7 +76,7 @@ uint8_t c64_magic_desk_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, i
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_magic_desk_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_magic_desk_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/magic_desk.h b/src/devices/bus/c64/magic_desk.h
index 75f76dee732..4082fc5ff56 100644
--- a/src/devices/bus/c64/magic_desk.h
+++ b/src/devices/bus/c64/magic_desk.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/magic_formel.cpp b/src/devices/bus/c64/magic_formel.cpp
index 9ebadc5320b..7575320b765 100644
--- a/src/devices/bus/c64/magic_formel.cpp
+++ b/src/devices/bus/c64/magic_formel.cpp
@@ -206,7 +206,7 @@ void c64_magic_formel_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_magic_formel_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_magic_formel_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!romh)
{
@@ -227,7 +227,7 @@ uint8_t c64_magic_formel_cartridge_device::c64_cd_r(offs_t offset, uint8_t data,
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_magic_formel_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_magic_formel_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1 && !m_ram_oe)
{
@@ -239,7 +239,7 @@ void c64_magic_formel_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, in
offs_t addr = (offset >> 6) & 0x03;
uint8_t new_data = (BIT(data, 1) << 7) | (offset & 0x3f);
- m_pia->write(addr, new_data);
+ m_pia->write(space, addr, new_data);
}
else if (offset == 0x0001)
{
diff --git a/src/devices/bus/c64/magic_formel.h b/src/devices/bus/c64/magic_formel.h
index 818342d3c3f..b4427511f32 100644
--- a/src/devices/bus/c64/magic_formel.h
+++ b/src/devices/bus/c64/magic_formel.h
@@ -41,8 +41,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
private:
diff --git a/src/devices/bus/c64/magic_voice.cpp b/src/devices/bus/c64/magic_voice.cpp
index 72d4afe5cf3..8479f56a238 100644
--- a/src/devices/bus/c64/magic_voice.cpp
+++ b/src/devices/bus/c64/magic_voice.cpp
@@ -168,7 +168,7 @@ WRITE8_MEMBER( c64_magic_voice_cartridge_device::tpi_pb_w )
if (!BIT(m_tpi_pb, 4) && BIT(data, 4))
{
- m_vslsi->write(data & 0x0f);
+ m_vslsi->write(space, 0, data & 0x0f);
}
m_tpi_pb = data;
@@ -303,12 +303,12 @@ void c64_magic_voice_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_magic_voice_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_magic_voice_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io2 && sphi2)
{
m_ca = offset;
- data = m_tpi->read(offset & 0x07);
+ data = m_tpi->read(space, offset & 0x07);
}
if (PB6 && A13 && A15)
@@ -319,7 +319,7 @@ uint8_t c64_magic_voice_cartridge_device::c64_cd_r(offs_t offset, uint8_t data,
int roml2 = !(!roml || (roml && !PB5 && A12 && A13 && !A14 && A15));
int romh2 = !((!romh && !PB6) || (!PB5 && A12 && A13 && !A14 && !A15));
- data = m_exp->cd_r(get_offset(offset), data, sphi2, ba, roml2, romh2, io1, 1);
+ data = m_exp->cd_r(space, get_offset(offset), data, sphi2, ba, roml2, romh2, io1, 1);
return data;
}
@@ -329,17 +329,17 @@ uint8_t c64_magic_voice_cartridge_device::c64_cd_r(offs_t offset, uint8_t data,
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_magic_voice_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_magic_voice_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io2 && sphi2)
{
- m_tpi->write(offset & 0x07, data);
+ m_tpi->write(space, offset & 0x07, data);
}
int roml2 = !(!roml || (roml && !PB5 && A12 && A13 && !A14 && A15));
int romh2 = !((!romh && !PB6) || (!PB5 && A12 && A13 && !A14 && !A15));
- m_exp->cd_w(get_offset(offset), data, sphi2, ba, roml2, romh2, io1, 1);
+ m_exp->cd_w(space, get_offset(offset), data, sphi2, ba, roml2, romh2, io1, 1);
}
diff --git a/src/devices/bus/c64/magic_voice.h b/src/devices/bus/c64/magic_voice.h
index bf6f081fd67..264c2531197 100644
--- a/src/devices/bus/c64/magic_voice.h
+++ b/src/devices/bus/c64/magic_voice.h
@@ -40,8 +40,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
private:
diff --git a/src/devices/bus/c64/midi_maplin.cpp b/src/devices/bus/c64/midi_maplin.cpp
index adc8556a7bd..1845f167e33 100644
--- a/src/devices/bus/c64/midi_maplin.cpp
+++ b/src/devices/bus/c64/midi_maplin.cpp
@@ -44,19 +44,19 @@ WRITE_LINE_MEMBER( c64_maplin_midi_cartridge_device::write_acia_clock )
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_maplin_midi_cartridge_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(c64_maplin_midi_cartridge_device::device_add_mconfig)
ACIA6850(config, m_acia, 0);
m_acia->txd_handler().set("mdout", FUNC(midi_port_device::write_txd));
m_acia->irq_handler().set(FUNC(c64_maplin_midi_cartridge_device::acia_irq_w));
- MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(m_acia, FUNC(acia6850_device::write_rxd));
+ MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
+ MCFG_MIDI_RX_HANDLER(WRITELINE(MC6850_TAG, acia6850_device, write_rxd))
- MIDI_PORT(config, "mdout", midiout_slot, "midiout");
+ MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
- clock_device &acia_clock(CLOCK(config, "acia_clock", 31250*16));
- acia_clock.signal_handler().set(FUNC(c64_maplin_midi_cartridge_device::write_acia_clock));
-}
+ MCFG_DEVICE_ADD("acia_clock", CLOCK, 31250*16)
+ MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, c64_maplin_midi_cartridge_device, write_acia_clock))
+MACHINE_CONFIG_END
@@ -100,7 +100,7 @@ void c64_maplin_midi_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_maplin_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_maplin_midi_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io2)
{
@@ -108,7 +108,7 @@ uint8_t c64_maplin_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t data,
{
case 0:
case 1:
- data = m_acia->read(offset & 1);
+ data = m_acia->read(space, offset & 1);
break;
}
}
@@ -121,7 +121,7 @@ uint8_t c64_maplin_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t data,
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_maplin_midi_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_maplin_midi_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io2)
{
@@ -129,7 +129,7 @@ void c64_maplin_midi_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int
{
case 0:
case 1:
- m_acia->write(offset & 1, data);
+ m_acia->write(space, offset & 1, data);
break;
}
}
diff --git a/src/devices/bus/c64/midi_maplin.h b/src/devices/bus/c64/midi_maplin.h
index eff1129802d..d844d007b36 100644
--- a/src/devices/bus/c64/midi_maplin.h
+++ b/src/devices/bus/c64/midi_maplin.h
@@ -38,8 +38,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
diff --git a/src/devices/bus/c64/midi_namesoft.cpp b/src/devices/bus/c64/midi_namesoft.cpp
index d4e7c8b59ac..c572cf4ea55 100644
--- a/src/devices/bus/c64/midi_namesoft.cpp
+++ b/src/devices/bus/c64/midi_namesoft.cpp
@@ -44,19 +44,19 @@ WRITE_LINE_MEMBER( c64_namesoft_midi_cartridge_device::write_acia_clock )
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_namesoft_midi_cartridge_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(c64_namesoft_midi_cartridge_device::device_add_mconfig)
ACIA6850(config, m_acia, 0);
m_acia->txd_handler().set("mdout", FUNC(midi_port_device::write_txd));
m_acia->irq_handler().set(FUNC(c64_namesoft_midi_cartridge_device::acia_irq_w));
- MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(m_acia, FUNC(acia6850_device::write_rxd));
+ MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
+ MCFG_MIDI_RX_HANDLER(WRITELINE(MC6850_TAG, acia6850_device, write_rxd))
- MIDI_PORT(config, "mdout", midiout_slot, "midiout");
+ MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
- clock_device &acia_clock(CLOCK(config, "acia_clock", 31250*16));
- acia_clock.signal_handler().set(FUNC(c64_namesoft_midi_cartridge_device::write_acia_clock));
-}
+ MCFG_DEVICE_ADD("acia_clock", CLOCK, 31250*16)
+ MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, c64_namesoft_midi_cartridge_device, write_acia_clock))
+MACHINE_CONFIG_END
@@ -98,7 +98,7 @@ void c64_namesoft_midi_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_namesoft_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_namesoft_midi_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
@@ -106,7 +106,7 @@ uint8_t c64_namesoft_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t data
{
case 2:
case 3:
- data = m_acia->read(offset & 1);
+ data = m_acia->read(space, offset & 1);
break;
}
}
@@ -119,7 +119,7 @@ uint8_t c64_namesoft_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t data
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_namesoft_midi_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_namesoft_midi_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
@@ -127,7 +127,7 @@ void c64_namesoft_midi_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, i
{
case 0:
case 1:
- m_acia->write(offset & 1, data);
+ m_acia->write(space, offset & 1, data);
break;
}
}
diff --git a/src/devices/bus/c64/midi_namesoft.h b/src/devices/bus/c64/midi_namesoft.h
index ab5064486c0..fe583e9cac1 100644
--- a/src/devices/bus/c64/midi_namesoft.h
+++ b/src/devices/bus/c64/midi_namesoft.h
@@ -38,8 +38,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
diff --git a/src/devices/bus/c64/midi_passport.cpp b/src/devices/bus/c64/midi_passport.cpp
index 05a3fbb1a36..bedab8e52c1 100644
--- a/src/devices/bus/c64/midi_passport.cpp
+++ b/src/devices/bus/c64/midi_passport.cpp
@@ -58,8 +58,7 @@ WRITE_LINE_MEMBER( c64_passport_midi_cartridge_device::write_acia_clock )
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_passport_midi_cartridge_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(c64_passport_midi_cartridge_device::device_add_mconfig)
ACIA6850(config, m_acia, 0);
m_acia->txd_handler().set("mdout", FUNC(midi_port_device::write_txd));
m_acia->irq_handler().set(FUNC(c64_passport_midi_cartridge_device::acia_irq_w));
@@ -68,13 +67,14 @@ void c64_passport_midi_cartridge_device::device_add_mconfig(machine_config &conf
m_ptm->set_external_clocks(1021800.0f, 1021800.0f, 1021800.0f);
m_ptm->irq_callback().set(FUNC(c64_passport_midi_cartridge_device::ptm_irq_w));
- MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(m_acia, FUNC(acia6850_device::write_rxd));
+ MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
+ MCFG_MIDI_RX_HANDLER(WRITELINE(MC6850_TAG, acia6850_device, write_rxd))
- MIDI_PORT(config, "mdout", midiout_slot, "midiout");
+ MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
- clock_device &acia_clock(CLOCK(config, "acia_clock", 31250*16)); // TODO: work out if the clock should come from the 6840
- acia_clock.signal_handler().set(FUNC(c64_passport_midi_cartridge_device::write_acia_clock));
-}
+ MCFG_DEVICE_ADD("acia_clock", CLOCK, 31250*16) /// TODO: work out if the clock should come from the 6840
+ MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, c64_passport_midi_cartridge_device, write_acia_clock))
+MACHINE_CONFIG_END
@@ -124,7 +124,7 @@ void c64_passport_midi_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_passport_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_passport_midi_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
@@ -132,11 +132,11 @@ uint8_t c64_passport_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t data
{
case 0: case 1: case 2: case 3:
case 4: case 5: case 6: case 7:
- data = m_ptm->read(offset & 0x07);
+ data = m_ptm->read(space, offset & 0x07);
break;
case 8: case 9:
- data = m_acia->read(offset & 0x01);
+ data = m_acia->read(space, offset & 0x01);
break;
}
}
@@ -149,7 +149,7 @@ uint8_t c64_passport_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t data
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_passport_midi_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_passport_midi_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
@@ -157,11 +157,11 @@ void c64_passport_midi_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, i
{
case 0: case 1: case 2: case 3:
case 4: case 5: case 6: case 7:
- m_ptm->write(offset & 0x07, data);
+ m_ptm->write(space, offset & 0x07, data);
break;
case 8: case 9:
- m_acia->write(offset & 0x01, data);
+ m_acia->write(space, offset & 0x01, data);
break;
case 0x30:
diff --git a/src/devices/bus/c64/midi_passport.h b/src/devices/bus/c64/midi_passport.h
index a538d312912..5385e3fff91 100644
--- a/src/devices/bus/c64/midi_passport.h
+++ b/src/devices/bus/c64/midi_passport.h
@@ -39,8 +39,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
DECLARE_WRITE_LINE_MEMBER( ptm_irq_w );
diff --git a/src/devices/bus/c64/midi_sci.cpp b/src/devices/bus/c64/midi_sci.cpp
index 14309ee5e7c..9d58052b38a 100644
--- a/src/devices/bus/c64/midi_sci.cpp
+++ b/src/devices/bus/c64/midi_sci.cpp
@@ -44,19 +44,19 @@ WRITE_LINE_MEMBER( c64_sequential_midi_cartridge_device::write_acia_clock )
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_sequential_midi_cartridge_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(c64_sequential_midi_cartridge_device::device_add_mconfig)
ACIA6850(config, m_acia, 0);
m_acia->txd_handler().set("mdout", FUNC(midi_port_device::write_txd));
m_acia->irq_handler().set(FUNC(c64_sequential_midi_cartridge_device::acia_irq_w));
- MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(m_acia, FUNC(acia6850_device::write_rxd));
+ MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
+ MCFG_MIDI_RX_HANDLER(WRITELINE(MC6850_TAG, acia6850_device, write_rxd))
- MIDI_PORT(config, "mdout", midiout_slot, "midiout");
+ MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
- clock_device &acia_clock(CLOCK(config, "acia_clock", 31250*16));
- acia_clock.signal_handler().set(FUNC(c64_sequential_midi_cartridge_device::write_acia_clock));
-}
+ MCFG_DEVICE_ADD("acia_clock", CLOCK, 31250*16)
+ MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, c64_sequential_midi_cartridge_device, write_acia_clock))
+MACHINE_CONFIG_END
@@ -99,7 +99,7 @@ void c64_sequential_midi_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_sequential_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_sequential_midi_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
@@ -107,7 +107,7 @@ uint8_t c64_sequential_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t da
{
case 2:
case 3:
- data = m_acia->read(offset & 1);
+ data = m_acia->read(space, offset & 1);
break;
}
}
@@ -120,7 +120,7 @@ uint8_t c64_sequential_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t da
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_sequential_midi_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_sequential_midi_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
@@ -128,7 +128,7 @@ void c64_sequential_midi_cartridge_device::c64_cd_w(offs_t offset, uint8_t data,
{
case 0:
case 1:
- m_acia->write(offset & 1, data);
+ m_acia->write(space, offset & 1, data);
break;
}
}
diff --git a/src/devices/bus/c64/midi_sci.h b/src/devices/bus/c64/midi_sci.h
index b0d52a0f70d..2c3dfc7f8ff 100644
--- a/src/devices/bus/c64/midi_sci.h
+++ b/src/devices/bus/c64/midi_sci.h
@@ -38,8 +38,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
diff --git a/src/devices/bus/c64/midi_siel.cpp b/src/devices/bus/c64/midi_siel.cpp
index eea7a4b333d..f5338bc6995 100644
--- a/src/devices/bus/c64/midi_siel.cpp
+++ b/src/devices/bus/c64/midi_siel.cpp
@@ -44,19 +44,19 @@ WRITE_LINE_MEMBER( c64_siel_midi_cartridge_device::write_acia_clock )
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_siel_midi_cartridge_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(c64_siel_midi_cartridge_device::device_add_mconfig)
ACIA6850(config, m_acia, 0);
m_acia->txd_handler().set("mdout", FUNC(midi_port_device::write_txd));
m_acia->irq_handler().set(FUNC(c64_siel_midi_cartridge_device::acia_irq_w));
- MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(m_acia, FUNC(acia6850_device::write_rxd));
+ MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
+ MCFG_MIDI_RX_HANDLER(WRITELINE(MC6850_TAG, acia6850_device, write_rxd))
- MIDI_PORT(config, "mdout", midiout_slot, "midiout");
+ MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
- clock_device &acia_clock(CLOCK(config, "acia_clock", 31250*16));
- acia_clock.signal_handler().set(FUNC(c64_siel_midi_cartridge_device::write_acia_clock));
-}
+ MCFG_DEVICE_ADD("acia_clock", CLOCK, 31250*16)
+ MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, c64_siel_midi_cartridge_device, write_acia_clock))
+MACHINE_CONFIG_END
@@ -100,7 +100,7 @@ void c64_siel_midi_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_siel_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_siel_midi_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
@@ -108,7 +108,7 @@ uint8_t c64_siel_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, in
{
case 6:
case 7:
- data = m_acia->read(offset & 1);
+ data = m_acia->read(space, offset & 1);
break;
}
}
@@ -121,7 +121,7 @@ uint8_t c64_siel_midi_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, in
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_siel_midi_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_siel_midi_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
@@ -129,7 +129,7 @@ void c64_siel_midi_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int s
{
case 4:
case 5:
- m_acia->write(offset & 1, data);
+ m_acia->write(space, offset & 1, data);
break;
}
}
diff --git a/src/devices/bus/c64/midi_siel.h b/src/devices/bus/c64/midi_siel.h
index fe38834278e..9e84f5e1852 100644
--- a/src/devices/bus/c64/midi_siel.h
+++ b/src/devices/bus/c64/midi_siel.h
@@ -38,8 +38,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
diff --git a/src/devices/bus/c64/mikro_assembler.cpp b/src/devices/bus/c64/mikro_assembler.cpp
index d6c02be7681..fe97c9472d7 100644
--- a/src/devices/bus/c64/mikro_assembler.cpp
+++ b/src/devices/bus/c64/mikro_assembler.cpp
@@ -47,7 +47,7 @@ void c64_mikro_assembler_cartridge_device::device_start()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_mikro_assembler_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_mikro_assembler_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml || !romh || !io1 || !io2)
{
diff --git a/src/devices/bus/c64/mikro_assembler.h b/src/devices/bus/c64/mikro_assembler.h
index 754a91385d4..edeb220fd43 100644
--- a/src/devices/bus/c64/mikro_assembler.h
+++ b/src/devices/bus/c64/mikro_assembler.h
@@ -34,7 +34,7 @@ protected:
virtual void device_start() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
};
diff --git a/src/devices/bus/c64/multiscreen.cpp b/src/devices/bus/c64/multiscreen.cpp
index 890c1a35799..e243a335e50 100644
--- a/src/devices/bus/c64/multiscreen.cpp
+++ b/src/devices/bus/c64/multiscreen.cpp
@@ -112,14 +112,13 @@ void c64_multiscreen_cartridge_device::multiscreen_mem(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_multiscreen_cartridge_device::device_add_mconfig(machine_config &config)
-{
- m6802_cpu_device &cpu(M6802(config, MC6802P_TAG, XTAL(4'000'000)));
- cpu.set_addrmap(AS_PROGRAM, &c64_multiscreen_cartridge_device::multiscreen_mem);
+MACHINE_CONFIG_START(c64_multiscreen_cartridge_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(MC6802P_TAG, M6802, XTAL(4'000'000))
+ MCFG_DEVICE_PROGRAM_MAP(multiscreen_mem)
- PIA6821(config, MC6821P_0_TAG, 0);
- PIA6821(config, MC6821P_1_TAG, 0);
-}
+ MCFG_DEVICE_ADD(MC6821P_0_TAG, PIA6821, 0)
+ MCFG_DEVICE_ADD(MC6821P_1_TAG, PIA6821, 0)
+MACHINE_CONFIG_END
//**************************************************************************
@@ -162,7 +161,7 @@ void c64_multiscreen_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_multiscreen_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_multiscreen_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -199,7 +198,7 @@ uint8_t c64_multiscreen_cartridge_device::c64_cd_r(offs_t offset, uint8_t data,
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_multiscreen_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_multiscreen_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (offset >= 0x8000 && offset < 0xa000)
{
diff --git a/src/devices/bus/c64/multiscreen.h b/src/devices/bus/c64/multiscreen.h
index 619154d18c5..9d26edb723a 100644
--- a/src/devices/bus/c64/multiscreen.h
+++ b/src/devices/bus/c64/multiscreen.h
@@ -41,8 +41,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/music64.cpp b/src/devices/bus/c64/music64.cpp
index 9e31a26c62b..7042774ec5d 100644
--- a/src/devices/bus/c64/music64.cpp
+++ b/src/devices/bus/c64/music64.cpp
@@ -172,9 +172,9 @@ void c64_music64_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_music64_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_music64_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
- data = m_exp->cd_r(offset, data, sphi2, ba, roml, romh, io1, io2);
+ data = m_exp->cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2);
if (!io2)
{
@@ -194,9 +194,9 @@ uint8_t c64_music64_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_music64_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_music64_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
- m_exp->cd_w(offset, data, sphi2, ba, roml, romh, io1, io2);
+ m_exp->cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2);
}
diff --git a/src/devices/bus/c64/music64.h b/src/devices/bus/c64/music64.h
index cf494c481b8..c9ae5414ac9 100644
--- a/src/devices/bus/c64/music64.h
+++ b/src/devices/bus/c64/music64.h
@@ -38,8 +38,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) override;
diff --git a/src/devices/bus/c64/neoram.cpp b/src/devices/bus/c64/neoram.cpp
index 4cb34cbbb57..a2576cebeeb 100644
--- a/src/devices/bus/c64/neoram.cpp
+++ b/src/devices/bus/c64/neoram.cpp
@@ -64,7 +64,7 @@ void c64_neoram_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_neoram_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_neoram_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
@@ -80,7 +80,7 @@ uint8_t c64_neoram_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int s
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_neoram_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_neoram_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/neoram.h b/src/devices/bus/c64/neoram.h
index d5058b878b7..e75a76cd088 100644
--- a/src/devices/bus/c64/neoram.h
+++ b/src/devices/bus/c64/neoram.h
@@ -41,8 +41,8 @@ protected:
virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } }
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint16_t m_bank;
diff --git a/src/devices/bus/c64/ocean.cpp b/src/devices/bus/c64/ocean.cpp
index 92b18de6a51..6f4fecda52f 100644
--- a/src/devices/bus/c64/ocean.cpp
+++ b/src/devices/bus/c64/ocean.cpp
@@ -82,7 +82,7 @@ void c64_ocean_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_ocean_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_ocean_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml && m_roml.bytes())
{
@@ -107,7 +107,7 @@ uint8_t c64_ocean_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sp
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_ocean_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_ocean_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/ocean.h b/src/devices/bus/c64/ocean.h
index 9a78f5e21f9..1af2101b3fa 100644
--- a/src/devices/bus/c64/ocean.h
+++ b/src/devices/bus/c64/ocean.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/pagefox.cpp b/src/devices/bus/c64/pagefox.cpp
index 80264aab13b..975f64d5408 100644
--- a/src/devices/bus/c64/pagefox.cpp
+++ b/src/devices/bus/c64/pagefox.cpp
@@ -85,7 +85,7 @@ void c64_pagefox_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_pagefox_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_pagefox_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml || !romh)
{
@@ -110,7 +110,7 @@ uint8_t c64_pagefox_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_pagefox_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_pagefox_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (offset >= 0x8000 && offset < 0xc000)
{
diff --git a/src/devices/bus/c64/pagefox.h b/src/devices/bus/c64/pagefox.h
index 74ed5a4edf0..25eedac9eb0 100644
--- a/src/devices/bus/c64/pagefox.h
+++ b/src/devices/bus/c64/pagefox.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
optional_shared_ptr<uint8_t> m_ram;
diff --git a/src/devices/bus/c64/partner.cpp b/src/devices/bus/c64/partner.cpp
index 55e4d07f3e1..9f198bc1220 100644
--- a/src/devices/bus/c64/partner.cpp
+++ b/src/devices/bus/c64/partner.cpp
@@ -120,7 +120,7 @@ void c64_partner_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_partner_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_partner_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
@@ -154,7 +154,7 @@ uint8_t c64_partner_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_partner_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_partner_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/partner.h b/src/devices/bus/c64/partner.h
index 6ecf4503a91..cfd82208a8b 100644
--- a/src/devices/bus/c64/partner.h
+++ b/src/devices/bus/c64/partner.h
@@ -39,8 +39,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
private:
diff --git a/src/devices/bus/c64/prophet64.cpp b/src/devices/bus/c64/prophet64.cpp
index ea5e16a3000..3b84ea81a5d 100644
--- a/src/devices/bus/c64/prophet64.cpp
+++ b/src/devices/bus/c64/prophet64.cpp
@@ -61,7 +61,7 @@ void c64_prophet64_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_prophet64_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_prophet64_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -77,7 +77,7 @@ uint8_t c64_prophet64_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, in
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_prophet64_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_prophet64_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io2)
{
diff --git a/src/devices/bus/c64/prophet64.h b/src/devices/bus/c64/prophet64.h
index f58ba30b7b7..af7b1c32544 100644
--- a/src/devices/bus/c64/prophet64.h
+++ b/src/devices/bus/c64/prophet64.h
@@ -34,8 +34,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/ps64.cpp b/src/devices/bus/c64/ps64.cpp
index c14008b2c08..b70c8a61c0f 100644
--- a/src/devices/bus/c64/ps64.cpp
+++ b/src/devices/bus/c64/ps64.cpp
@@ -61,14 +61,25 @@ DEFINE_DEVICE_TYPE(C64_PS64, c64_ps64_cartridge_device, "c64_ps64", "C64 PS-64")
//-------------------------------------------------
+// votrax_sc02_interface votrax_intf
+//-------------------------------------------------
+/*
+static struct votrax_sc02_interface votrax_intf =
+{
+ DEVCB_NOOP
+};
+*/
+
+
+//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_ps64_cartridge_device::device_add_mconfig(machine_config &config)
-{
- //SPEAKER(config, "speaker").front_center();
- //VOTRAX_SC02(config, SSI263_TAG, 2000000).add_route(ALL_OUTPUTS, "mono", 1.00);
-}
+MACHINE_CONFIG_START(c64_ps64_cartridge_device::device_add_mconfig)
+ //MCFG_SPEAKER_STANDARD_MONO("mono")
+ //MCFG_VOTRAX_SC02_ADD(SSI263_TAG, 2000000, votrax_intf)
+ //MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
+MACHINE_CONFIG_END
@@ -109,7 +120,7 @@ void c64_ps64_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_ps64_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_ps64_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -128,7 +139,7 @@ uint8_t c64_ps64_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sph
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_ps64_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_ps64_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/ps64.h b/src/devices/bus/c64/ps64.h
index 69a9c5b0110..4d75432d51a 100644
--- a/src/devices/bus/c64/ps64.h
+++ b/src/devices/bus/c64/ps64.h
@@ -39,8 +39,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
};
diff --git a/src/devices/bus/c64/reu.cpp b/src/devices/bus/c64/reu.cpp
index 332ac53f8a8..b7ab238e47e 100644
--- a/src/devices/bus/c64/reu.cpp
+++ b/src/devices/bus/c64/reu.cpp
@@ -31,12 +31,12 @@ DEFINE_DEVICE_TYPE(C64_REU1764, c64_reu1764_cartridge_device, "c64_1764reu", "17
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_reu_cartridge_device::device_add_mconfig(machine_config &config)
-{
- MOS8726(config, m_dmac, 1000000); // dummy clock
+MACHINE_CONFIG_START(c64_reu_cartridge_device::device_add_mconfig)
+ MCFG_MOS8726_ADD(MOS8726R1_TAG)
- GENERIC_SOCKET(config, m_eprom, generic_linear_slot, nullptr, "bin,rom");
-}
+ MCFG_GENERIC_SOCKET_ADD("rom", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+MACHINE_CONFIG_END
@@ -99,15 +99,15 @@ void c64_reu_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_reu_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_reu_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!m_dmac->romsel_r(roml, romh))
{
- data = m_eprom->read_rom(offset & 0x7fff);
+ data = m_eprom->read_rom(space, offset & 0x7fff);
}
else if (!io2)
{
- data = m_dmac->read(offset);
+ data = m_dmac->read(space, offset);
}
return data;
@@ -118,10 +118,10 @@ uint8_t c64_reu_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_reu_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_reu_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io2)
{
- m_dmac->write(offset, data);
+ m_dmac->write(space, offset, data);
}
}
diff --git a/src/devices/bus/c64/reu.h b/src/devices/bus/c64/reu.h
index 0cbb67d9576..dd8b9e32d5f 100644
--- a/src/devices/bus/c64/reu.h
+++ b/src/devices/bus/c64/reu.h
@@ -47,8 +47,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
required_device<mos8726_device> m_dmac;
required_device<generic_slot_device> m_eprom;
diff --git a/src/devices/bus/c64/rex.cpp b/src/devices/bus/c64/rex.cpp
index 97fecd740af..73bcdaf453a 100644
--- a/src/devices/bus/c64/rex.cpp
+++ b/src/devices/bus/c64/rex.cpp
@@ -57,7 +57,7 @@ void c64_rex_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_rex_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_rex_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
diff --git a/src/devices/bus/c64/rex.h b/src/devices/bus/c64/rex.h
index cc0cccb52da..42d565971ed 100644
--- a/src/devices/bus/c64/rex.h
+++ b/src/devices/bus/c64/rex.h
@@ -35,7 +35,7 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
};
diff --git a/src/devices/bus/c64/rex_ep256.cpp b/src/devices/bus/c64/rex_ep256.cpp
index da1f7b601b7..67f1ce015b9 100644
--- a/src/devices/bus/c64/rex_ep256.cpp
+++ b/src/devices/bus/c64/rex_ep256.cpp
@@ -22,17 +22,24 @@ DEFINE_DEVICE_TYPE(C64_REX_EP256, c64_rex_ep256_cartridge_device, "rexexp256", "
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_rex_ep256_cartridge_device::device_add_mconfig(machine_config &config)
-{
- GENERIC_SOCKET(config, "rom1", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom2", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom3", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom4", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom5", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom6", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom7", generic_linear_slot, nullptr, "bin,rom");
- GENERIC_SOCKET(config, "rom8", generic_linear_slot, nullptr, "bin,rom");
-}
+MACHINE_CONFIG_START(c64_rex_ep256_cartridge_device::device_add_mconfig)
+ MCFG_GENERIC_SOCKET_ADD("rom1", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom2", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom3", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom4", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom5", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom6", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom7", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_SOCKET_ADD("rom8", generic_linear_slot, nullptr)
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+MACHINE_CONFIG_END
@@ -87,7 +94,7 @@ void c64_rex_ep256_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_rex_ep256_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_rex_ep256_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -98,7 +105,7 @@ uint8_t c64_rex_ep256_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, in
else
{
offs_t addr = (m_bank << 13) | (offset & 0x1fff);
- data = m_eproms[m_socket]->read_rom(addr);
+ data = m_eproms[m_socket]->read_rom(space, addr);
}
}
else if (!io2)
@@ -121,7 +128,7 @@ uint8_t c64_rex_ep256_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, in
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_rex_ep256_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_rex_ep256_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io2 && ((offset & 0xf0) == 0xa0))
{
diff --git a/src/devices/bus/c64/rex_ep256.h b/src/devices/bus/c64/rex_ep256.h
index 06f4a4325d5..536929d8cdb 100644
--- a/src/devices/bus/c64/rex_ep256.h
+++ b/src/devices/bus/c64/rex_ep256.h
@@ -40,8 +40,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
generic_slot_device *m_eproms[8];
diff --git a/src/devices/bus/c64/ross.cpp b/src/devices/bus/c64/ross.cpp
index 25c1a996df8..827f98f9401 100644
--- a/src/devices/bus/c64/ross.cpp
+++ b/src/devices/bus/c64/ross.cpp
@@ -62,7 +62,7 @@ void c64_ross_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_ross_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_ross_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml || !romh)
{
@@ -79,7 +79,7 @@ uint8_t c64_ross_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sph
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_ross_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_ross_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/ross.h b/src/devices/bus/c64/ross.h
index 97f2698fb6c..c36e616948d 100644
--- a/src/devices/bus/c64/ross.h
+++ b/src/devices/bus/c64/ross.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/sfx_sound_expander.cpp b/src/devices/bus/c64/sfx_sound_expander.cpp
index 71229014c46..bf55a2994df 100644
--- a/src/devices/bus/c64/sfx_sound_expander.cpp
+++ b/src/devices/bus/c64/sfx_sound_expander.cpp
@@ -206,9 +206,9 @@ void c64_sfx_sound_expander_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_sfx_sound_expander_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_sfx_sound_expander_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
- data = m_exp->cd_r(get_offset(offset, 1), data, sphi2, ba, roml, romh, io1, io2);
+ data = m_exp->cd_r(space, get_offset(offset, 1), data, sphi2, ba, roml, romh, io1, io2);
if (!io2 && sphi2)
{
@@ -219,7 +219,7 @@ uint8_t c64_sfx_sound_expander_cartridge_device::c64_cd_r(offs_t offset, uint8_t
if (BIT(offset, 5))
{
- data = m_opl->read(BIT(offset, 4));
+ data = m_opl->read(space, BIT(offset, 4));
}
}
@@ -231,14 +231,14 @@ uint8_t c64_sfx_sound_expander_cartridge_device::c64_cd_r(offs_t offset, uint8_t
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_sfx_sound_expander_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_sfx_sound_expander_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io2 && sphi2)
{
- m_opl->write(BIT(offset, 4), data);
+ m_opl->write(space, BIT(offset, 4), data);
}
- m_exp->cd_w(get_offset(offset, 0), data, sphi2, ba, roml, romh, io1, io2);
+ m_exp->cd_w(space, get_offset(offset, 0), data, sphi2, ba, roml, romh, io1, io2);
}
diff --git a/src/devices/bus/c64/sfx_sound_expander.h b/src/devices/bus/c64/sfx_sound_expander.h
index 9380e055c18..eb402bf1e54 100644
--- a/src/devices/bus/c64/sfx_sound_expander.h
+++ b/src/devices/bus/c64/sfx_sound_expander.h
@@ -39,8 +39,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) override;
diff --git a/src/devices/bus/c64/silverrock.cpp b/src/devices/bus/c64/silverrock.cpp
index f52efc569b6..a34f21d17a7 100644
--- a/src/devices/bus/c64/silverrock.cpp
+++ b/src/devices/bus/c64/silverrock.cpp
@@ -92,7 +92,7 @@ void c64_silverrock_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_silverrock_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_silverrock_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -109,7 +109,7 @@ uint8_t c64_silverrock_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, i
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_silverrock_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_silverrock_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/silverrock.h b/src/devices/bus/c64/silverrock.h
index 3d9c4e015f2..4bd33a4db71 100644
--- a/src/devices/bus/c64/silverrock.h
+++ b/src/devices/bus/c64/silverrock.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/simons_basic.cpp b/src/devices/bus/c64/simons_basic.cpp
index 246e67b8b56..043d43531c0 100644
--- a/src/devices/bus/c64/simons_basic.cpp
+++ b/src/devices/bus/c64/simons_basic.cpp
@@ -57,7 +57,7 @@ void c64_simons_basic_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_simons_basic_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_simons_basic_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -76,7 +76,7 @@ uint8_t c64_simons_basic_cartridge_device::c64_cd_r(offs_t offset, uint8_t data,
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_simons_basic_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_simons_basic_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/simons_basic.h b/src/devices/bus/c64/simons_basic.h
index 63d2dfb5cb9..9f9cd5a1636 100644
--- a/src/devices/bus/c64/simons_basic.h
+++ b/src/devices/bus/c64/simons_basic.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
};
diff --git a/src/devices/bus/c64/speakeasy.cpp b/src/devices/bus/c64/speakeasy.cpp
index 23caee3488f..09427458fe7 100644
--- a/src/devices/bus/c64/speakeasy.cpp
+++ b/src/devices/bus/c64/speakeasy.cpp
@@ -31,12 +31,12 @@ DEFINE_DEVICE_TYPE(C64_SPEAKEASY, c64_speakeasy_cartridge_device, "c64_speakeasy
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_speakeasy_cartridge_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(c64_speakeasy_cartridge_device::device_add_mconfig)
SPEAKER(config, "mono").front_center();
- VOTRAX_SC01(config, m_votrax, 720000).add_route(ALL_OUTPUTS, "mono", 0.85);
-}
+ MCFG_DEVICE_ADD(SC01A_TAG, VOTRAX_SC01, 720000)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.85)
+MACHINE_CONFIG_END
@@ -69,7 +69,7 @@ void c64_speakeasy_cartridge_device::device_start()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_speakeasy_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_speakeasy_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
@@ -84,11 +84,11 @@ uint8_t c64_speakeasy_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, in
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_speakeasy_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_speakeasy_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
- m_votrax->write(data & 0x3f);
- m_votrax->inflection_w(data >> 6);
+ m_votrax->write(space, 0, data & 0x3f);
+ m_votrax->inflection_w(space, 0, data >> 6);
}
}
diff --git a/src/devices/bus/c64/speakeasy.h b/src/devices/bus/c64/speakeasy.h
index 0816e4caa2e..8c8ecdc9403 100644
--- a/src/devices/bus/c64/speakeasy.h
+++ b/src/devices/bus/c64/speakeasy.h
@@ -36,8 +36,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
required_device<votrax_sc01_device> m_votrax;
diff --git a/src/devices/bus/c64/stardos.cpp b/src/devices/bus/c64/stardos.cpp
index 601ada2778c..c8e47d300e8 100644
--- a/src/devices/bus/c64/stardos.cpp
+++ b/src/devices/bus/c64/stardos.cpp
@@ -138,7 +138,7 @@ void c64_stardos_cartridge_device::device_start()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_stardos_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_stardos_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml || !romh)
{
@@ -162,7 +162,7 @@ uint8_t c64_stardos_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_stardos_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_stardos_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/stardos.h b/src/devices/bus/c64/stardos.h
index 9be9f599957..d9c8699a991 100644
--- a/src/devices/bus/c64/stardos.h
+++ b/src/devices/bus/c64/stardos.h
@@ -38,8 +38,8 @@ protected:
virtual void device_start() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) override;
diff --git a/src/devices/bus/c64/std.cpp b/src/devices/bus/c64/std.cpp
index 08f4c1d65e0..fac9d021696 100644
--- a/src/devices/bus/c64/std.cpp
+++ b/src/devices/bus/c64/std.cpp
@@ -47,7 +47,7 @@ void c64_standard_cartridge_device::device_start()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_standard_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_standard_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml && m_roml.bytes())
{
diff --git a/src/devices/bus/c64/std.h b/src/devices/bus/c64/std.h
index 391e9ac973f..8a2599fe7bd 100644
--- a/src/devices/bus/c64/std.h
+++ b/src/devices/bus/c64/std.h
@@ -34,7 +34,7 @@ protected:
virtual void device_start() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
};
diff --git a/src/devices/bus/c64/structured_basic.cpp b/src/devices/bus/c64/structured_basic.cpp
index e7773c772c0..2f968643b7d 100644
--- a/src/devices/bus/c64/structured_basic.cpp
+++ b/src/devices/bus/c64/structured_basic.cpp
@@ -62,7 +62,7 @@ void c64_structured_basic_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_structured_basic_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_structured_basic_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -79,7 +79,7 @@ uint8_t c64_structured_basic_cartridge_device::c64_cd_r(offs_t offset, uint8_t d
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_structured_basic_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_structured_basic_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/structured_basic.h b/src/devices/bus/c64/structured_basic.h
index 44d370cdb3f..7b36402dcf5 100644
--- a/src/devices/bus/c64/structured_basic.h
+++ b/src/devices/bus/c64/structured_basic.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/super_explode.cpp b/src/devices/bus/c64/super_explode.cpp
index 4ed2456bd2a..88e7a9b48ab 100644
--- a/src/devices/bus/c64/super_explode.cpp
+++ b/src/devices/bus/c64/super_explode.cpp
@@ -85,7 +85,7 @@ void c64_super_explode_cartridge_device::device_timer(emu_timer &timer, device_t
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_super_explode_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_super_explode_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -112,7 +112,7 @@ uint8_t c64_super_explode_cartridge_device::c64_cd_r(offs_t offset, uint8_t data
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_super_explode_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_super_explode_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/super_explode.h b/src/devices/bus/c64/super_explode.h
index ca3abdeebf5..74edade0e6e 100644
--- a/src/devices/bus/c64/super_explode.h
+++ b/src/devices/bus/c64/super_explode.h
@@ -36,8 +36,8 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/super_games.cpp b/src/devices/bus/c64/super_games.cpp
index 610861c360e..7a58d29cd57 100644
--- a/src/devices/bus/c64/super_games.cpp
+++ b/src/devices/bus/c64/super_games.cpp
@@ -60,7 +60,7 @@ void c64_super_games_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_super_games_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_super_games_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml || !romh)
{
@@ -76,7 +76,7 @@ uint8_t c64_super_games_cartridge_device::c64_cd_r(offs_t offset, uint8_t data,
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_super_games_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_super_games_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io2)
{
diff --git a/src/devices/bus/c64/super_games.h b/src/devices/bus/c64/super_games.h
index 11e4b44046a..64a50f9e240 100644
--- a/src/devices/bus/c64/super_games.h
+++ b/src/devices/bus/c64/super_games.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/supercpu.cpp b/src/devices/bus/c64/supercpu.cpp
index 4e48d77c35c..a517eecb016 100644
--- a/src/devices/bus/c64/supercpu.cpp
+++ b/src/devices/bus/c64/supercpu.cpp
@@ -144,9 +144,9 @@ void c64_supercpu_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_supercpu_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_supercpu_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
- data = m_exp->cd_r(offset, data, sphi2, ba, roml, romh, io1, io2);
+ data = m_exp->cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2);
switch (offset)
{
@@ -198,7 +198,7 @@ uint8_t c64_supercpu_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, in
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_supercpu_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_supercpu_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
switch (offset)
{
@@ -275,7 +275,7 @@ void c64_supercpu_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int b
break;
}
- m_exp->cd_w(offset, data, sphi2, ba, roml, romh, io1, io2);
+ m_exp->cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2);
}
diff --git a/src/devices/bus/c64/supercpu.h b/src/devices/bus/c64/supercpu.h
index 73982328c31..006449400c1 100644
--- a/src/devices/bus/c64/supercpu.h
+++ b/src/devices/bus/c64/supercpu.h
@@ -40,8 +40,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) override;
diff --git a/src/devices/bus/c64/sw8k.cpp b/src/devices/bus/c64/sw8k.cpp
index 2f55b223797..ff0e3310101 100644
--- a/src/devices/bus/c64/sw8k.cpp
+++ b/src/devices/bus/c64/sw8k.cpp
@@ -103,7 +103,7 @@ void c64_switchable_8k_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_switchable_8k_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_switchable_8k_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
diff --git a/src/devices/bus/c64/sw8k.h b/src/devices/bus/c64/sw8k.h
index 186e96792d6..94bcb17b5a3 100644
--- a/src/devices/bus/c64/sw8k.h
+++ b/src/devices/bus/c64/sw8k.h
@@ -38,7 +38,7 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
required_ioport m_sw;
diff --git a/src/devices/bus/c64/swiftlink.cpp b/src/devices/bus/c64/swiftlink.cpp
index 3855da85ca3..3f807fb13dc 100644
--- a/src/devices/bus/c64/swiftlink.cpp
+++ b/src/devices/bus/c64/swiftlink.cpp
@@ -126,12 +126,12 @@ void c64_swiftlink_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_swiftlink_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_swiftlink_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (((m_cs == DE00) && !io1) || ((m_cs == DF00) && !io2) ||
((m_cs == D700) && ((offset & 0xff00) == 0xd700)))
{
- data = m_acia->read(offset & 0x03);
+ data = m_acia->read(space, offset & 0x03);
}
return data;
@@ -142,12 +142,12 @@ uint8_t c64_swiftlink_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, in
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_swiftlink_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_swiftlink_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (((m_cs == DE00) && !io1) || ((m_cs == DF00) && !io2) ||
((m_cs == D700) && ((offset & 0xff00) == 0xd700)))
{
- m_acia->write(offset & 0x03, data);
+ m_acia->write(space, offset & 0x03, data);
}
}
diff --git a/src/devices/bus/c64/swiftlink.h b/src/devices/bus/c64/swiftlink.h
index 409cfafa33a..0c1f577bafe 100644
--- a/src/devices/bus/c64/swiftlink.h
+++ b/src/devices/bus/c64/swiftlink.h
@@ -41,8 +41,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
diff --git a/src/devices/bus/c64/system3.cpp b/src/devices/bus/c64/system3.cpp
index f02ef692b3b..7a1fd54ab3e 100644
--- a/src/devices/bus/c64/system3.cpp
+++ b/src/devices/bus/c64/system3.cpp
@@ -60,7 +60,7 @@ void c64_system3_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_system3_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_system3_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
@@ -82,7 +82,7 @@ uint8_t c64_system3_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_system3_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_system3_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/system3.h b/src/devices/bus/c64/system3.h
index 024798fc77e..ff5ed78b53d 100644
--- a/src/devices/bus/c64/system3.h
+++ b/src/devices/bus/c64/system3.h
@@ -35,8 +35,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/tdos.cpp b/src/devices/bus/c64/tdos.cpp
index b52b61f57a4..a814ccc26a8 100644
--- a/src/devices/bus/c64/tdos.cpp
+++ b/src/devices/bus/c64/tdos.cpp
@@ -230,9 +230,9 @@ void c64_tdos_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_tdos_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_tdos_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
- data = m_exp->cd_r(offset, data, sphi2, ba, roml, romh, io1, io2);
+ data = m_exp->cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2);
if (m_enabled && !roml)
{
@@ -244,7 +244,7 @@ uint8_t c64_tdos_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sph
switch ((offset >> 1) & 0x7f)
{
case 0:
- data = m_ssda->read(offset & 0x01);
+ data = m_ssda->read(space, offset & 0x01);
break;
case 1:
@@ -277,16 +277,16 @@ uint8_t c64_tdos_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sph
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_tdos_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_tdos_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
- m_exp->cd_w(offset, data, sphi2, ba, roml, romh, io1, io2);
+ m_exp->cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2);
if (m_enabled && !io2 && sphi2)
{
switch ((offset >> 1) & 0x7f)
{
case 0:
- m_ssda->write(offset & 0x01, data);
+ m_ssda->write(space, offset & 0x01, data);
break;
case 1:
diff --git a/src/devices/bus/c64/tdos.h b/src/devices/bus/c64/tdos.h
index 49c1b07651c..adf2bf874b5 100644
--- a/src/devices/bus/c64/tdos.h
+++ b/src/devices/bus/c64/tdos.h
@@ -39,8 +39,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) override;
diff --git a/src/devices/bus/c64/turbo232.cpp b/src/devices/bus/c64/turbo232.cpp
index f9113bed1c5..4c6e5f1ebdb 100644
--- a/src/devices/bus/c64/turbo232.cpp
+++ b/src/devices/bus/c64/turbo232.cpp
@@ -128,7 +128,7 @@ void c64_turbo232_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_turbo232_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_turbo232_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (((m_cs == DE00) && !io1) || ((m_cs == DF00) && !io2) ||
((m_cs == D700) && ((offset & 0xff00) == 0xd700)))
@@ -138,7 +138,7 @@ uint8_t c64_turbo232_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int
switch (offset & 0x07)
{
case 0: case 1: case 2: case 3:
- data = m_acia->read(offset & 0x03);
+ data = m_acia->read(space, offset & 0x03);
break;
case 7:
@@ -155,7 +155,7 @@ uint8_t c64_turbo232_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_turbo232_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_turbo232_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (((m_cs == DE00) && !io1) || ((m_cs == DF00) && !io2) ||
((m_cs == D700) && ((offset & 0xff00) == 0xd700)))
@@ -165,11 +165,11 @@ void c64_turbo232_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sp
switch (offset & 0x07)
{
case 0: case 1: case 2:
- m_acia->write(offset & 0x03, data);
+ m_acia->write(space, offset & 0x03, data);
break;
case 3:
- m_acia->write(offset & 0x03, data);
+ m_acia->write(space, offset & 0x03, data);
if (data & 0x0f)
m_es &= ~ES_M;
diff --git a/src/devices/bus/c64/turbo232.h b/src/devices/bus/c64/turbo232.h
index 4f5638f88fa..177e044307d 100644
--- a/src/devices/bus/c64/turbo232.h
+++ b/src/devices/bus/c64/turbo232.h
@@ -41,8 +41,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
diff --git a/src/devices/bus/c64/vizastar.cpp b/src/devices/bus/c64/vizastar.cpp
index 443c232bde7..444ff656b68 100644
--- a/src/devices/bus/c64/vizastar.cpp
+++ b/src/devices/bus/c64/vizastar.cpp
@@ -79,7 +79,7 @@ void c64_vizastar_cartridge_device::device_start()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_vizastar_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_vizastar_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
diff --git a/src/devices/bus/c64/vizastar.h b/src/devices/bus/c64/vizastar.h
index 26ec63cd46b..95453eb6e38 100644
--- a/src/devices/bus/c64/vizastar.h
+++ b/src/devices/bus/c64/vizastar.h
@@ -34,7 +34,7 @@ protected:
virtual void device_start() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
};
diff --git a/src/devices/bus/c64/vw64.cpp b/src/devices/bus/c64/vw64.cpp
index bf4d584d40d..ea0d3c3dac2 100644
--- a/src/devices/bus/c64/vw64.cpp
+++ b/src/devices/bus/c64/vw64.cpp
@@ -111,7 +111,7 @@ void c64_vizawrite_cartridge_device::device_timer(emu_timer &timer, device_timer
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_vizawrite_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_vizawrite_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
diff --git a/src/devices/bus/c64/vw64.h b/src/devices/bus/c64/vw64.h
index 64287c0c785..abff81acb4b 100644
--- a/src/devices/bus/c64/vw64.h
+++ b/src/devices/bus/c64/vw64.h
@@ -36,7 +36,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) override { return 0; }
private:
diff --git a/src/devices/bus/c64/warp_speed.cpp b/src/devices/bus/c64/warp_speed.cpp
index ff485c05277..3c266e3618d 100644
--- a/src/devices/bus/c64/warp_speed.cpp
+++ b/src/devices/bus/c64/warp_speed.cpp
@@ -117,7 +117,7 @@ void c64_warp_speed_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_warp_speed_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_warp_speed_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml || !romh || !io1 || !io2)
{
@@ -133,7 +133,7 @@ uint8_t c64_warp_speed_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, i
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_warp_speed_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_warp_speed_cartridge_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io1)
{
diff --git a/src/devices/bus/c64/warp_speed.h b/src/devices/bus/c64/warp_speed.h
index d5c61f50f49..7a3b25cecfc 100644
--- a/src/devices/bus/c64/warp_speed.h
+++ b/src/devices/bus/c64/warp_speed.h
@@ -38,8 +38,8 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
};
diff --git a/src/devices/bus/c64/westermann.cpp b/src/devices/bus/c64/westermann.cpp
index ac254733f01..8cb86b39a1c 100644
--- a/src/devices/bus/c64/westermann.cpp
+++ b/src/devices/bus/c64/westermann.cpp
@@ -57,7 +57,7 @@ void c64_westermann_cartridge_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_westermann_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_westermann_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
diff --git a/src/devices/bus/c64/westermann.h b/src/devices/bus/c64/westermann.h
index 4b7b2e4389f..b9392c52f72 100644
--- a/src/devices/bus/c64/westermann.h
+++ b/src/devices/bus/c64/westermann.h
@@ -35,7 +35,7 @@ protected:
virtual void device_reset() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
};
diff --git a/src/devices/bus/c64/xl80.cpp b/src/devices/bus/c64/xl80.cpp
index 8e09508e2a3..fbeacd759b3 100644
--- a/src/devices/bus/c64/xl80.cpp
+++ b/src/devices/bus/c64/xl80.cpp
@@ -123,15 +123,14 @@ GFXDECODE_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c64_xl80_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, MC6845_SCREEN_TAG, SCREEN_TYPE_RASTER, rgb_t::white()));
- screen.set_screen_update(HD46505SP_TAG, FUNC(h46505_device::screen_update));
- screen.set_size(80*8, 24*8);
- screen.set_visarea(0, 80*8-1, 0, 24*8-1);
- screen.set_refresh_hz(50);
-
- GFXDECODE(config, "gfxdecode", m_palette, gfx_c64_xl80);
+MACHINE_CONFIG_START(c64_xl80_device::device_add_mconfig)
+ MCFG_SCREEN_ADD_MONOCHROME(MC6845_SCREEN_TAG, RASTER, rgb_t::white())
+ MCFG_SCREEN_UPDATE_DEVICE(HD46505SP_TAG, h46505_device, screen_update)
+ MCFG_SCREEN_SIZE(80*8, 24*8)
+ MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*8-1)
+ MCFG_SCREEN_REFRESH_RATE(50)
+
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_c64_xl80)
PALETTE(config, m_palette, palette_device::MONOCHROME);
H46505(config, m_crtc, XTAL(14'318'181) / 8);
@@ -139,7 +138,7 @@ void c64_xl80_device::device_add_mconfig(machine_config &config)
m_crtc->set_show_border_area(true);
m_crtc->set_char_width(8);
m_crtc->set_update_row_callback(FUNC(c64_xl80_device::crtc_update_row), this);
-}
+MACHINE_CONFIG_END
@@ -186,13 +185,13 @@ void c64_xl80_device::device_reset()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_xl80_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_xl80_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!io2 && BIT(offset, 2))
{
if (offset & 0x01)
{
- data = m_crtc->register_r();
+ data = m_crtc->register_r(space, 0);
}
}
else if (offset >= 0x8000 && offset < 0x9000)
@@ -212,7 +211,7 @@ uint8_t c64_xl80_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba
// c64_cd_w - cartridge data write
//-------------------------------------------------
-void c64_xl80_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+void c64_xl80_device::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (offset >= 0x9800 && offset < 0xa000)
{
@@ -222,11 +221,11 @@ void c64_xl80_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, i
{
if (offset & 0x01)
{
- m_crtc->register_w(data);
+ m_crtc->register_w(space, 0, data);
}
else
{
- m_crtc->address_w(data);
+ m_crtc->address_w(space, 0, data);
}
}
}
diff --git a/src/devices/bus/c64/xl80.h b/src/devices/bus/c64/xl80.h
index 82ebdee51d0..fe406af174b 100644
--- a/src/devices/bus/c64/xl80.h
+++ b/src/devices/bus/c64/xl80.h
@@ -41,8 +41,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
- virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override { return 1; }
virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) override { return 0; }
diff --git a/src/devices/bus/c64/zaxxon.cpp b/src/devices/bus/c64/zaxxon.cpp
index d63b05da095..8de226cfb9d 100644
--- a/src/devices/bus/c64/zaxxon.cpp
+++ b/src/devices/bus/c64/zaxxon.cpp
@@ -50,7 +50,7 @@ void c64_zaxxon_cartridge_device::device_start()
// c64_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c64_zaxxon_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+uint8_t c64_zaxxon_cartridge_device::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
if (!roml)
{
diff --git a/src/devices/bus/c64/zaxxon.h b/src/devices/bus/c64/zaxxon.h
index 8e47d4caff7..dafd293081f 100644
--- a/src/devices/bus/c64/zaxxon.h
+++ b/src/devices/bus/c64/zaxxon.h
@@ -34,7 +34,7 @@ protected:
virtual void device_start() override;
// device_c64_expansion_card_interface overrides
- virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
private:
int m_bank;
diff --git a/src/devices/bus/cbm2/24k.cpp b/src/devices/bus/cbm2/24k.cpp
index c212b2fef83..9517337f8c1 100644
--- a/src/devices/bus/cbm2/24k.cpp
+++ b/src/devices/bus/cbm2/24k.cpp
@@ -49,7 +49,7 @@ void cbm2_24k_cartridge_device::device_start()
// cbm2_bd_r - cartridge data read
//-------------------------------------------------
-uint8_t cbm2_24k_cartridge_device::cbm2_bd_r(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
+uint8_t cbm2_24k_cartridge_device::cbm2_bd_r(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
{
if (!csbank1)
{
@@ -72,7 +72,7 @@ uint8_t cbm2_24k_cartridge_device::cbm2_bd_r(offs_t offset, uint8_t data, int cs
// cbm2_bd_w - cartridge data write
//-------------------------------------------------
-void cbm2_24k_cartridge_device::cbm2_bd_w(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
+void cbm2_24k_cartridge_device::cbm2_bd_w(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
{
if (!csbank1)
{
diff --git a/src/devices/bus/cbm2/24k.h b/src/devices/bus/cbm2/24k.h
index b1c029c5254..0e40e67d478 100644
--- a/src/devices/bus/cbm2/24k.h
+++ b/src/devices/bus/cbm2/24k.h
@@ -33,8 +33,8 @@ protected:
virtual void device_start() override;
// device_cbm2_expansion_card_interface overrides
- virtual uint8_t cbm2_bd_r(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override;
- virtual void cbm2_bd_w(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override;
+ virtual uint8_t cbm2_bd_r(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override;
+ virtual void cbm2_bd_w(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override;
optional_shared_ptr<uint8_t> m_ram;
};
diff --git a/src/devices/bus/cbm2/exp.cpp b/src/devices/bus/cbm2/exp.cpp
index bcc2a654060..e4246026a54 100644
--- a/src/devices/bus/cbm2/exp.cpp
+++ b/src/devices/bus/cbm2/exp.cpp
@@ -155,11 +155,11 @@ std::string cbm2_expansion_slot_device::get_default_card_software(get_default_ca
// read - cartridge data read
//-------------------------------------------------
-uint8_t cbm2_expansion_slot_device::read(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
+uint8_t cbm2_expansion_slot_device::read(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
{
if (m_card != nullptr)
{
- data = m_card->cbm2_bd_r(offset, data, csbank1, csbank2, csbank3);
+ data = m_card->cbm2_bd_r(space, offset, data, csbank1, csbank2, csbank3);
}
return data;
@@ -170,11 +170,11 @@ uint8_t cbm2_expansion_slot_device::read(offs_t offset, uint8_t data, int csbank
// write - cartridge data write
//-------------------------------------------------
-void cbm2_expansion_slot_device::write(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
+void cbm2_expansion_slot_device::write(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
{
if (m_card != nullptr)
{
- m_card->cbm2_bd_w(offset, data, csbank1, csbank2, csbank3);
+ m_card->cbm2_bd_w(space, offset, data, csbank1, csbank2, csbank3);
}
}
diff --git a/src/devices/bus/cbm2/exp.h b/src/devices/bus/cbm2/exp.h
index 4d905225299..51f2cb15119 100644
--- a/src/devices/bus/cbm2/exp.h
+++ b/src/devices/bus/cbm2/exp.h
@@ -40,6 +40,17 @@
#define CBM2_EXPANSION_SLOT_TAG "exp"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_CBM2_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, CBM2_EXPANSION_SLOT, _clock) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -66,8 +77,8 @@ public:
cbm2_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
// computer interface
- uint8_t read(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3);
- void write(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3);
+ uint8_t read(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3);
+ void write(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3);
// cartridge interface
int phi2() { return clock(); }
@@ -108,8 +119,8 @@ public:
// construction/destruction
virtual ~device_cbm2_expansion_card_interface();
- virtual uint8_t cbm2_bd_r(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) { return data; };
- virtual void cbm2_bd_w(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) { };
+ virtual uint8_t cbm2_bd_r(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) { return data; };
+ virtual void cbm2_bd_w(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) { };
protected:
device_cbm2_expansion_card_interface(const machine_config &mconfig, device_t &device);
diff --git a/src/devices/bus/cbm2/hrg.cpp b/src/devices/bus/cbm2/hrg.cpp
index 166e38e76b2..4956b0a708b 100644
--- a/src/devices/bus/cbm2/hrg.cpp
+++ b/src/devices/bus/cbm2/hrg.cpp
@@ -88,39 +88,37 @@ void cbm2_hrg_b_device::hrg_b_map(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void cbm2_hrg_a_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER, rgb_t::green()));
- screen.set_screen_update(EF9365_TAG, FUNC(ef9365_device::screen_update));
- screen.set_size(512, 512);
- screen.set_visarea(0, 512-1, 0, 512-1);
- screen.set_refresh_hz(25);
+MACHINE_CONFIG_START(cbm2_hrg_a_device::device_add_mconfig)
+ MCFG_SCREEN_ADD_MONOCHROME(SCREEN_TAG, RASTER, rgb_t::green())
+ MCFG_SCREEN_UPDATE_DEVICE(EF9365_TAG, ef9365_device, screen_update)
+ MCFG_SCREEN_SIZE(512, 512)
+ MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 512-1)
+ MCFG_SCREEN_REFRESH_RATE(25)
PALETTE(config, "palette", palette_device::MONOCHROME);
- EF9365(config, m_gdc, 1750000);
- m_gdc->set_screen(SCREEN_TAG);
- m_gdc->set_addrmap(0, &cbm2_hrg_a_device::hrg_a_map);
- m_gdc->set_palette_tag("palette");
- m_gdc->set_nb_bitplanes(1);
- m_gdc->set_display_mode(ef9365_device::DISPLAY_MODE_512x512);
-}
-
-void cbm2_hrg_b_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER, rgb_t::green()));
- screen.set_screen_update(EF9366_TAG, FUNC(ef9365_device::screen_update));
- screen.set_size(512, 256);
- screen.set_visarea(0, 512-1, 0, 256-1);
- screen.set_refresh_hz(50);
+ MCFG_DEVICE_ADD(EF9365_TAG, EF9365, 1750000)
+ MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
+ MCFG_DEVICE_ADDRESS_MAP(0, hrg_a_map)
+ MCFG_EF936X_PALETTE("palette")
+ MCFG_EF936X_BITPLANES_CNT(1);
+ MCFG_EF936X_DISPLAYMODE(DISPLAY_MODE_512x512);
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(cbm2_hrg_b_device::device_add_mconfig)
+ MCFG_SCREEN_ADD_MONOCHROME(SCREEN_TAG, RASTER, rgb_t::green())
+ MCFG_SCREEN_UPDATE_DEVICE(EF9366_TAG, ef9365_device, screen_update)
+ MCFG_SCREEN_SIZE(512, 256)
+ MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
+ MCFG_SCREEN_REFRESH_RATE(50)
PALETTE(config, "palette", palette_device::MONOCHROME);
- EF9365(config, m_gdc, 1750000); //EF9366
- m_gdc->set_screen(SCREEN_TAG);
- m_gdc->set_addrmap(0, &cbm2_hrg_b_device::hrg_b_map);
- m_gdc->set_palette_tag("palette");
- m_gdc->set_nb_bitplanes(1);
- m_gdc->set_display_mode(ef9365_device::DISPLAY_MODE_512x256);
-}
+ MCFG_DEVICE_ADD(EF9366_TAG, EF9365, 1750000)
+ MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
+ MCFG_DEVICE_ADDRESS_MAP(0, hrg_b_map)
+ MCFG_EF936X_PALETTE("palette")
+ MCFG_EF936X_BITPLANES_CNT(1);
+ MCFG_EF936X_DISPLAYMODE(DISPLAY_MODE_512x256);
+MACHINE_CONFIG_END
@@ -174,7 +172,7 @@ void cbm2_hrg_device::device_reset()
// cbm2_bd_r - cartridge data read
//-------------------------------------------------
-uint8_t cbm2_hrg_device::cbm2_bd_r(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
+uint8_t cbm2_hrg_device::cbm2_bd_r(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
{
if (!csbank3)
{
@@ -205,7 +203,7 @@ uint8_t cbm2_hrg_device::cbm2_bd_r(offs_t offset, uint8_t data, int csbank1, int
}
else if (offset >= 0x7ff0)
{
- data = m_gdc->data_r(offset & 0x0f);
+ data = m_gdc->data_r(space, offset & 0x0f);
}
}
@@ -217,7 +215,7 @@ uint8_t cbm2_hrg_device::cbm2_bd_r(offs_t offset, uint8_t data, int csbank1, int
// cbm2_bd_w - cartridge data write
//-------------------------------------------------
-void cbm2_hrg_device::cbm2_bd_w(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
+void cbm2_hrg_device::cbm2_bd_w(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
{
if (!csbank3)
{
@@ -240,7 +238,7 @@ void cbm2_hrg_device::cbm2_bd_w(offs_t offset, uint8_t data, int csbank1, int cs
}
else if (offset >= 0x7ff0)
{
- m_gdc->data_w(offset & 0x0f, data);
+ m_gdc->data_w(space, offset & 0x0f, data);
}
}
}
diff --git a/src/devices/bus/cbm2/hrg.h b/src/devices/bus/cbm2/hrg.h
index 3b6a20c94e8..ccd16dc1b05 100644
--- a/src/devices/bus/cbm2/hrg.h
+++ b/src/devices/bus/cbm2/hrg.h
@@ -38,12 +38,11 @@ protected:
virtual void device_reset() override;
// device_cbm2_expansion_card_interface overrides
- virtual uint8_t cbm2_bd_r(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override;
- virtual void cbm2_bd_w(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override;
-
- required_device<ef9365_device> m_gdc;
+ virtual uint8_t cbm2_bd_r(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override;
+ virtual void cbm2_bd_w(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override;
private:
+ required_device<ef9365_device> m_gdc;
required_memory_region m_bank3;
};
diff --git a/src/devices/bus/cbm2/std.cpp b/src/devices/bus/cbm2/std.cpp
index f56226028ee..5087e39cd93 100644
--- a/src/devices/bus/cbm2/std.cpp
+++ b/src/devices/bus/cbm2/std.cpp
@@ -47,7 +47,7 @@ void cbm2_standard_cartridge_device::device_start()
// cbm2_bd_r - cartridge data read
//-------------------------------------------------
-uint8_t cbm2_standard_cartridge_device::cbm2_bd_r(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
+uint8_t cbm2_standard_cartridge_device::cbm2_bd_r(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3)
{
if (!csbank1 && m_bank1.bytes())
{
diff --git a/src/devices/bus/cbm2/std.h b/src/devices/bus/cbm2/std.h
index ee941ca580a..beb54e1fb2e 100644
--- a/src/devices/bus/cbm2/std.h
+++ b/src/devices/bus/cbm2/std.h
@@ -33,7 +33,7 @@ protected:
virtual void device_start() override;
// device_cbm2_expansion_card_interface overrides
- virtual uint8_t cbm2_bd_r(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override;
+ virtual uint8_t cbm2_bd_r(address_space &space, offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override;
};
diff --git a/src/devices/bus/cbm2/user.h b/src/devices/bus/cbm2/user.h
index 6bb6bba33c6..aa963d0dccc 100644
--- a/src/devices/bus/cbm2/user.h
+++ b/src/devices/bus/cbm2/user.h
@@ -42,20 +42,20 @@ class cbm2_user_port_device;
class device_cbm2_user_port_interface : public device_slot_card_interface
{
public:
- virtual uint8_t cbm2_d1_r() { return 0xff; }
- virtual void cbm2_d1_w(uint8_t data) { }
+ virtual uint8_t cbm2_d1_r(address_space &space, offs_t offset) { return 0xff; };
+ virtual void cbm2_d1_w(address_space &space, offs_t offset, uint8_t data) { };
- virtual uint8_t cbm2_d2_r() { return 0xff; }
- virtual void cbm2_d2_w(uint8_t data) { }
+ virtual uint8_t cbm2_d2_r(address_space &space, offs_t offset) { return 0xff; };
+ virtual void cbm2_d2_w(address_space &space, offs_t offset, uint8_t data) { };
virtual int cbm2_pb2_r() { return 1; }
- virtual void cbm2_pb2_w(int state) { }
+ virtual void cbm2_pb2_w(int state) { };
virtual int cbm2_pb3_r() { return 1; }
- virtual void cbm2_pb3_w(int state) { }
+ virtual void cbm2_pb3_w(int state) { };
- virtual void cbm2_pc_w(int state) { }
- virtual void cbm2_cnt_w(int state) { }
- virtual void cbm2_sp_w(int state) { }
+ virtual void cbm2_pc_w(int state) { };
+ virtual void cbm2_cnt_w(int state) { };
+ virtual void cbm2_sp_w(int state) { };
protected:
// construction/destruction
@@ -89,10 +89,10 @@ public:
auto flag_callback() { return m_write_flag.bind(); }
// computer interface
- uint8_t d1_r() { uint8_t data = 0xff; if (m_card != nullptr) data = m_card->cbm2_d1_r(); return data; }
- void d1_w(uint8_t data) { if (m_card != nullptr) m_card->cbm2_d1_w(data); }
- uint8_t d2_r() { uint8_t data = 0xff; if (m_card != nullptr) data = m_card->cbm2_d2_r(); return data; }
- void d2_w(uint8_t data) { if (m_card != nullptr) m_card->cbm2_d2_w(data); }
+ DECLARE_READ8_MEMBER( d1_r ) { uint8_t data = 0xff; if (m_card != nullptr) data = m_card->cbm2_d1_r(space, offset); return data; }
+ DECLARE_WRITE8_MEMBER( d1_w ) { if (m_card != nullptr) m_card->cbm2_d1_w(space, offset, data); }
+ DECLARE_READ8_MEMBER( d2_r ) { uint8_t data = 0xff; if (m_card != nullptr) data = m_card->cbm2_d2_r(space, offset); return data; }
+ DECLARE_WRITE8_MEMBER( d2_w ) { if (m_card != nullptr) m_card->cbm2_d2_w(space, offset, data); }
DECLARE_READ_LINE_MEMBER( pb2_r ) { return m_card ? m_card->cbm2_pb2_r() : 1; }
DECLARE_WRITE_LINE_MEMBER( pb2_w ) { if (m_card != nullptr) m_card->cbm2_pb2_w(state); }
DECLARE_READ_LINE_MEMBER( pb3_r ) { return m_card ? m_card->cbm2_pb3_r() : 1; }
diff --git a/src/devices/bus/cbmiec/c1526.cpp b/src/devices/bus/cbmiec/c1526.cpp
index 7123782d42c..9a5fcc4dbb3 100644
--- a/src/devices/bus/cbmiec/c1526.cpp
+++ b/src/devices/bus/cbmiec/c1526.cpp
@@ -23,8 +23,8 @@
// DEVICE DEFINITIONS
//**************************************************************************
-DEFINE_DEVICE_TYPE(C1526, c1526_device, "c1526", "Commodore 1526/MPS802 Printer")
-DEFINE_DEVICE_TYPE(C4023, c4023_device, "c4023", "Commodore 4023 Printer")
+DEFINE_DEVICE_TYPE(C1526, c1526_device, "c1526", "MPS802/C1526 Printer")
+DEFINE_DEVICE_TYPE(C4023, c4023_device, "c4023", "C4023 Printer")
//-------------------------------------------------
@@ -88,22 +88,20 @@ void c1526_device_base::c1526_mem(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c1526_device::device_add_mconfig(machine_config &config)
-{
- m6504_device &cpu(M6504(config, M6504_TAG, XTAL(4'000'000)/4));
- cpu.set_addrmap(AS_PROGRAM, &c1526_device::c1526_mem);
-}
+MACHINE_CONFIG_START(c1526_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(M6504_TAG, M6504, XTAL(4'000'000)/4)
+ MCFG_DEVICE_PROGRAM_MAP(c1526_mem)
+MACHINE_CONFIG_END
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c4023_device::device_add_mconfig(machine_config &config)
-{
- m6504_device &cpu(M6504(config, M6504_TAG, XTAL(4'000'000)/4));
- cpu.set_addrmap(AS_PROGRAM, &c4023_device::c1526_mem);
-}
+MACHINE_CONFIG_START(c4023_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(M6504_TAG, M6504, XTAL(4'000'000)/4)
+ MCFG_DEVICE_PROGRAM_MAP(c1526_mem)
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/cbmiec/c1541.cpp b/src/devices/bus/cbmiec/c1541.cpp
index 30b5eb8f255..17f2ff59084 100644
--- a/src/devices/bus/cbmiec/c1541.cpp
+++ b/src/devices/bus/cbmiec/c1541.cpp
@@ -161,17 +161,17 @@
// DEVICE DEFINITIONS
//**************************************************************************
-DEFINE_DEVICE_TYPE(C1540, c1540_device, "c1540", "Commodore 1540 Disk Drive")
-DEFINE_DEVICE_TYPE(C1541, c1541_device, "c1541", "Commodore 1541 Disk Drive")
-DEFINE_DEVICE_TYPE(C1541C, c1541c_device, "c1541c", "Commodore 1541C Disk Drive")
-DEFINE_DEVICE_TYPE(C1541II, c1541ii_device, "c1541ii", "Commodore 1541-II Disk Drive")
+DEFINE_DEVICE_TYPE(C1540, c1540_device, "c1540", "C1540 Disk Drive")
+DEFINE_DEVICE_TYPE(C1541, c1541_device, "c1541", "C1541 Disk Drive")
+DEFINE_DEVICE_TYPE(C1541C, c1541c_device, "c1541c", "C1541C Disk Drive")
+DEFINE_DEVICE_TYPE(C1541II, c1541ii_device, "c1541ii", "C1541-II Disk Drive")
DEFINE_DEVICE_TYPE(SX1541, sx1541_device, "sx1541", "SX1541 Disk Drive")
DEFINE_DEVICE_TYPE(FSD1, fsd1_device, "fsd1", "FSD-1 Disk Drive")
DEFINE_DEVICE_TYPE(FSD2, fsd2_device, "fsd2", "FSD-2 Disk Drive")
DEFINE_DEVICE_TYPE(CSD1, csd1_device, "csd1", "CSD-1 Disk Drive")
-DEFINE_DEVICE_TYPE(C1541_DOLPHIN_DOS, c1541_dolphin_dos_device, "c1541dd", "Commodore 1541 Dolphin-DOS 2.0 Disk Drive")
-DEFINE_DEVICE_TYPE(C1541_PROFESSIONAL_DOS_V1, c1541_professional_dos_v1_device, "c1541pd", "Commodore 1541 Professional-DOS v1 Disk Drive")
-DEFINE_DEVICE_TYPE(C1541_PROLOGIC_DOS_CLASSIC, c1541_prologic_dos_classic_device, "c1541pdc", "Commodore 1541 ProLogic-DOS Classic Disk Drive")
+DEFINE_DEVICE_TYPE(C1541_DOLPHIN_DOS, c1541_dolphin_dos_device, "c1541dd", "C1541 Dolphin-DOS 2.0 Disk Drive")
+DEFINE_DEVICE_TYPE(C1541_PROFESSIONAL_DOS_V1, c1541_professional_dos_v1_device, "c1541pd", "C1541 Professional-DOS v1 Disk Drive")
+DEFINE_DEVICE_TYPE(C1541_PROLOGIC_DOS_CLASSIC, c1541_prologic_dos_classic_device, "c1541pdc", "C1541 ProLogic-DOS Classic Disk Drive")
DEFINE_DEVICE_TYPE(INDUS_GT, indus_gt_device, "indusgt", "Indus GT Disk Drive")
@@ -762,12 +762,12 @@ FLOPPY_FORMATS_END
READ8_MEMBER( c1541_prologic_dos_classic_device::pia_r )
{
- return m_pia->read((offset >> 2) & 0x03);
+ return m_pia->read(space, (offset >> 2) & 0x03);
}
WRITE8_MEMBER( c1541_prologic_dos_classic_device::pia_w )
{
- m_pia->write((offset >> 2) & 0x03, data);
+ m_pia->write(space, (offset >> 2) & 0x03, data);
}
WRITE8_MEMBER( c1541_prologic_dos_classic_device::pia_pa_w )
diff --git a/src/devices/bus/cbmiec/c1571.cpp b/src/devices/bus/cbmiec/c1571.cpp
index 568cd646fe7..91fe7d4bd96 100644
--- a/src/devices/bus/cbmiec/c1571.cpp
+++ b/src/devices/bus/cbmiec/c1571.cpp
@@ -44,9 +44,9 @@
// DEVICE DEFINITIONS
//**************************************************************************
-DEFINE_DEVICE_TYPE(C1570, c1570_device, "c1570", "Commodore 1570 Disk Drive")
-DEFINE_DEVICE_TYPE(C1571, c1571_device, "c1571", "Commodore 1571 Disk Drive")
-DEFINE_DEVICE_TYPE(C1571CR, c1571cr_device, "c1571cr", "Commodore 1571CR Disk Drive")
+DEFINE_DEVICE_TYPE(C1570, c1570_device, "c1570", "C1570 Disk Drive")
+DEFINE_DEVICE_TYPE(C1571, c1571_device, "c1571", "C1571 Disk Drive")
+DEFINE_DEVICE_TYPE(C1571CR, c1571cr_device, "c1571cr", "C1571CR Disk Drive")
DEFINE_DEVICE_TYPE(MINI_CHIEF, mini_chief_device, "minichif", "ICT Mini Chief Disk Drive")
@@ -660,7 +660,7 @@ void c1571cr_device::device_add_mconfig(machine_config &config)
m_via0->writepa_handler().set(FUNC(c1571cr_device::via0_pa_w));
m_via0->writepb_handler().set(FUNC(c1571cr_device::via0_pb_w));
- //MOS5710(config, M5710_TAG, 16_MHz_XTAL / 16);
+ //MCFG_MOS5710_ADD(M5710_TAG, 16_MHz_XTAL / 16, 0)
}
@@ -672,8 +672,7 @@ void mini_chief_device::device_add_mconfig(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &mini_chief_device::mini_chief_mem);
isa8_device &isa8(ISA8(config, ISA_BUS_TAG, 0));
- isa8.set_memspace(m_maincpu, AS_PROGRAM);
- isa8.set_iospace(m_maincpu, AS_PROGRAM);
+ isa8.set_cputag(m_maincpu);
ISA8_SLOT(config, "isa1", 0, ISA_BUS_TAG, mini_chief_isa8_cards, "wd1002a_wx1", false);
}
diff --git a/src/devices/bus/cbmiec/c1581.cpp b/src/devices/bus/cbmiec/c1581.cpp
index f589cb2f427..190cab5cd07 100644
--- a/src/devices/bus/cbmiec/c1581.cpp
+++ b/src/devices/bus/cbmiec/c1581.cpp
@@ -33,8 +33,8 @@
// DEVICE DEFINITIONS
//**************************************************************************
-DEFINE_DEVICE_TYPE(C1563, c1563_device, "c1563", "Commodore 1563 3.5 Disk Drive")
-DEFINE_DEVICE_TYPE(C1581, c1581_device, "c1581", "Commodore 1581 3.5 Disk Drive")
+DEFINE_DEVICE_TYPE(C1563, c1563_device, "c1563", "C1563 Disk Drive")
+DEFINE_DEVICE_TYPE(C1581, c1581_device, "c1581", "C1581 Disk Drive")
//-------------------------------------------------
@@ -267,23 +267,22 @@ FLOPPY_FORMATS_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c1581_device::device_add_mconfig(machine_config &config)
-{
- M6502(config, m_maincpu, 16_MHz_XTAL / 8);
- m_maincpu->set_addrmap(AS_PROGRAM, &c1581_device::c1581_mem);
-
- MOS8520(config, m_cia, 16_MHz_XTAL / 8);
- m_cia->irq_wr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
- m_cia->cnt_wr_callback().set(FUNC(c1581_device::cnt_w));
- m_cia->sp_wr_callback().set(FUNC(c1581_device::sp_w));
- m_cia->pa_rd_callback().set(FUNC(c1581_device::cia_pa_r));
- m_cia->pa_wr_callback().set(FUNC(c1581_device::cia_pa_w));
- m_cia->pb_rd_callback().set(FUNC(c1581_device::cia_pb_r));
- m_cia->pb_wr_callback().set(FUNC(c1581_device::cia_pb_w));
+MACHINE_CONFIG_START(c1581_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(M6502_TAG, M6502, 16_MHz_XTAL / 8)
+ MCFG_DEVICE_PROGRAM_MAP(c1581_mem)
+
+ MCFG_DEVICE_ADD(M8520_TAG, MOS8520, 16_MHz_XTAL / 8)
+ MCFG_MOS6526_IRQ_CALLBACK(INPUTLINE(M6502_TAG, INPUT_LINE_IRQ0))
+ MCFG_MOS6526_CNT_CALLBACK(WRITELINE(*this, c1581_device, cnt_w))
+ MCFG_MOS6526_SP_CALLBACK(WRITELINE(*this, c1581_device, sp_w))
+ MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(*this, c1581_device, cia_pa_r))
+ MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(*this, c1581_device, cia_pa_w))
+ MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(*this, c1581_device, cia_pb_r))
+ MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(*this, c1581_device, cia_pb_w))
WD1772(config, m_fdc, 16_MHz_XTAL / 2);
FLOPPY_CONNECTOR(config, WD1772_TAG":0", c1581_floppies, "35dd", c1581_device::floppy_formats, true);
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/cbmiec/cbmiec.h b/src/devices/bus/cbmiec/cbmiec.h
index ceb03d44948..4977bfc97be 100644
--- a/src/devices/bus/cbmiec/cbmiec.h
+++ b/src/devices/bus/cbmiec/cbmiec.h
@@ -21,6 +21,46 @@
#define CBM_IEC_TAG "iec_bus"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_CBM_IEC_BUS_ADD() \
+ MCFG_DEVICE_ADD(CBM_IEC_TAG, CBM_IEC, 0)
+
+
+#define MCFG_CBM_IEC_BUS_SRQ_CALLBACK(_write) \
+ downcast<cbm_iec_device *>(device)->set_srq_callback(DEVCB_##_write);
+
+#define MCFG_CBM_IEC_BUS_ATN_CALLBACK(_write) \
+ downcast<cbm_iec_device *>(device)->set_atn_callback(DEVCB_##_write);
+
+#define MCFG_CBM_IEC_BUS_CLK_CALLBACK(_write) \
+ downcast<cbm_iec_device *>(device)->set_clk_callback(DEVCB_##_write);
+
+#define MCFG_CBM_IEC_BUS_DATA_CALLBACK(_write) \
+ downcast<cbm_iec_device *>(device)->set_data_callback(DEVCB_##_write);
+
+#define MCFG_CBM_IEC_BUS_RESET_CALLBACK(_write) \
+ downcast<cbm_iec_device *>(device)->set_reset_callback(DEVCB_##_write);
+
+
+#define MCFG_CBM_IEC_SLOT_ADD(_tag, _address, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, CBM_IEC_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<cbm_iec_slot_device *>(device)->set_address(_address);
+
+
+#define MCFG_CBM_IEC_ADD(_default_drive) \
+ MCFG_CBM_IEC_SLOT_ADD("iec4", 4, cbm_iec_devices, nullptr) \
+ MCFG_CBM_IEC_SLOT_ADD("iec8", 8, cbm_iec_devices, _default_drive) \
+ MCFG_CBM_IEC_SLOT_ADD("iec9", 9, cbm_iec_devices, nullptr) \
+ MCFG_CBM_IEC_SLOT_ADD("iec10", 10, cbm_iec_devices, nullptr) \
+ MCFG_CBM_IEC_SLOT_ADD("iec11", 11, cbm_iec_devices, nullptr) \
+ MCFG_CBM_IEC_BUS_ADD()
+
+
void cbm_iec_devices(device_slot_interface &device);
//**************************************************************************
@@ -38,6 +78,11 @@ public:
// construction/destruction
cbm_iec_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <class Object> devcb_base &set_srq_callback(Object &&wr) { return m_write_srq.set_callback(std::forward<Object>(wr)); }
+ template <class Object> devcb_base &set_atn_callback(Object &&wr) { return m_write_atn.set_callback(std::forward<Object>(wr)); }
+ template <class Object> devcb_base &set_clk_callback(Object &&wr) { return m_write_clk.set_callback(std::forward<Object>(wr)); }
+ template <class Object> devcb_base &set_data_callback(Object &&wr) { return m_write_data.set_callback(std::forward<Object>(wr)); }
+ template <class Object> devcb_base &set_reset_callback(Object &&wr) { return m_write_reset.set_callback(std::forward<Object>(wr)); }
auto srq_callback() { return m_write_srq.bind(); }
auto atn_callback() { return m_write_atn.bind(); }
auto clk_callback() { return m_write_clk.bind(); }
diff --git a/src/devices/bus/cbmiec/interpod.cpp b/src/devices/bus/cbmiec/interpod.cpp
index ac87a55cf21..d6111dafe4d 100644
--- a/src/devices/bus/cbmiec/interpod.cpp
+++ b/src/devices/bus/cbmiec/interpod.cpp
@@ -123,17 +123,16 @@ void interpod_device::interpod_mem(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void interpod_device::device_add_mconfig(machine_config &config)
-{
- M6502(config, m_maincpu, 1000000);
- m_maincpu->set_addrmap(AS_PROGRAM, &interpod_device::interpod_mem);
+MACHINE_CONFIG_START(interpod_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(R6502_TAG, M6502, 1000000)
+ MCFG_DEVICE_PROGRAM_MAP(interpod_mem)
- VIA6522(config, m_via, 1000000);
- MOS6532_NEW(config, m_riot, 1000000);
- ACIA6850(config, m_acia, 0);
+ MCFG_DEVICE_ADD(R6522_TAG, VIA6522, 1000000)
+ MCFG_DEVICE_ADD(R6532_TAG, MOS6532_NEW, 1000000)
+ MCFG_DEVICE_ADD(MC6850_TAG, ACIA6850, 0)
- ieee488_device::add_cbm_devices(config, nullptr);
-}
+ MCFG_CBM_IEEE488_ADD(nullptr)
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/cbmiec/interpod.h b/src/devices/bus/cbmiec/interpod.h
index 58c193286cf..cc6e07f7c7a 100644
--- a/src/devices/bus/cbmiec/interpod.h
+++ b/src/devices/bus/cbmiec/interpod.h
@@ -27,6 +27,16 @@
#define INTERPOD_TAG "interpod"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_INTERPOD_ADD() \
+ MCFG_DEVICE_ADD(INTERPOD_TAG, INTERPOD, 0)
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/devices/bus/cbmiec/serialbox.cpp b/src/devices/bus/cbmiec/serialbox.cpp
index ab8326528d0..b14eca1f389 100644
--- a/src/devices/bus/cbmiec/serialbox.cpp
+++ b/src/devices/bus/cbmiec/serialbox.cpp
@@ -69,11 +69,10 @@ void serial_box_device::serial_box_mem(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void serial_box_device::device_add_mconfig(machine_config &config)
-{
- M65C02(config, m_maincpu, XTAL(4'000'000)/4);
- m_maincpu->set_addrmap(AS_PROGRAM, &serial_box_device::serial_box_mem);
-}
+MACHINE_CONFIG_START(serial_box_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(M6502_TAG, M65C02, XTAL(4'000'000)/4)
+ MCFG_DEVICE_PROGRAM_MAP(serial_box_mem)
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/cbmiec/vic1515.cpp b/src/devices/bus/cbmiec/vic1515.cpp
index 5accd8b6858..1afc47ce807 100644
--- a/src/devices/bus/cbmiec/vic1515.cpp
+++ b/src/devices/bus/cbmiec/vic1515.cpp
@@ -61,12 +61,11 @@ void vic1515_device::vic1515_io(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void vic1515_device::device_add_mconfig(machine_config &config)
-{
- i8039_device &maincpu(I8039(config, "maincpu", XTAL(6'000'000)));
- maincpu.set_addrmap(AS_PROGRAM, &vic1515_device::vic1515_mem);
- maincpu.set_addrmap(AS_IO, &vic1515_device::vic1515_io);
-}
+MACHINE_CONFIG_START(vic1515_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("maincpu", I8039, XTAL(6'000'000))
+ MCFG_DEVICE_PROGRAM_MAP(vic1515_mem)
+ MCFG_DEVICE_IO_MAP(vic1515_io)
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/cbmiec/vic1520.cpp b/src/devices/bus/cbmiec/vic1520.cpp
index 8e535c230e6..0f515f8638a 100644
--- a/src/devices/bus/cbmiec/vic1520.cpp
+++ b/src/devices/bus/cbmiec/vic1520.cpp
@@ -94,11 +94,10 @@ void vic1520_device::vic1520_mem(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void vic1520_device::device_add_mconfig(machine_config &config)
-{
- m6502_device &cpu(M6502(config, M6500_1_TAG, XTAL(2'000'000))); // M6500/1
- cpu.set_addrmap(AS_PROGRAM, &vic1520_device::vic1520_mem);
-}
+MACHINE_CONFIG_START(vic1520_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(M6500_1_TAG, M6502, XTAL(2'000'000)) // M6500/1
+ MCFG_DEVICE_PROGRAM_MAP(vic1520_mem)
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/cbus/pc9801_118.cpp b/src/devices/bus/cbus/pc9801_118.cpp
index a9271ecb0bf..96f0d0b4091 100644
--- a/src/devices/bus/cbus/pc9801_118.cpp
+++ b/src/devices/bus/cbus/pc9801_118.cpp
@@ -141,7 +141,7 @@ void pc9801_118_device::device_reset()
READ8_MEMBER(pc9801_118_device::opn3_r)
{
if(((offset & 5) == 0) || m_ext_reg)
- return m_opn3->read(offset >> 1);
+ return m_opn3->read(space, offset >> 1);
else // odd
{
//printf("PC9801-118: Read to undefined port [%02x]\n",offset+0x188);
@@ -153,7 +153,7 @@ READ8_MEMBER(pc9801_118_device::opn3_r)
WRITE8_MEMBER(pc9801_118_device::opn3_w)
{
if(((offset & 5) == 0) || m_ext_reg)
- m_opn3->write(offset >> 1,data);
+ m_opn3->write(space, offset >> 1,data);
//else // odd
// printf("PC9801-118: Write to undefined port [%02x] %02x\n",offset+0x188,data);
}
diff --git a/src/devices/bus/cbus/pc9801_26.cpp b/src/devices/bus/cbus/pc9801_26.cpp
index 603ea4a80b3..41141476483 100644
--- a/src/devices/bus/cbus/pc9801_26.cpp
+++ b/src/devices/bus/cbus/pc9801_26.cpp
@@ -146,7 +146,7 @@ READ8_MEMBER(pc9801_26_device::opn_r)
{
if((offset & 1) == 0)
{
- return offset & 4 ? 0xff : m_opn->read(offset >> 1);
+ return offset & 4 ? 0xff : m_opn->read(space, offset >> 1);
}
else // odd
{
@@ -159,7 +159,7 @@ READ8_MEMBER(pc9801_26_device::opn_r)
WRITE8_MEMBER(pc9801_26_device::opn_w)
{
if((offset & 5) == 0)
- m_opn->write(offset >> 1, data);
+ m_opn->write(space, offset >> 1, data);
else // odd
printf("PC9801-26: Write to undefined port [%02x] %02x\n",offset+0x188,data);
}
diff --git a/src/devices/bus/cbus/pc9801_86.cpp b/src/devices/bus/cbus/pc9801_86.cpp
index d9d6150a9fa..04c1feb4cf8 100644
--- a/src/devices/bus/cbus/pc9801_86.cpp
+++ b/src/devices/bus/cbus/pc9801_86.cpp
@@ -47,8 +47,7 @@ WRITE_LINE_MEMBER(pc9801_86_device::sound_irq)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void pc9801_86_device::pc9801_86_config(machine_config &config)
-{
+MACHINE_CONFIG_START(pc9801_86_device::pc9801_86_config)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
YM2608(config, m_opna, 7.987_MHz_XTAL);
@@ -63,19 +62,16 @@ void pc9801_86_device::pc9801_86_config(machine_config &config)
m_opna->add_route(1, "lspeaker", 1.00);
m_opna->add_route(2, "rspeaker", 1.00);
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // burr brown pcm61p
- DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // burr brown pcm61p
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "ldac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "ldac", -1.0, DAC_VREF_NEG_INPUT);
- vref.add_route(0, "rdac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "rdac", -1.0, DAC_VREF_NEG_INPUT);
-}
+ MCFG_DEVICE_ADD("ldac", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) // burr brown pcm61p
+ MCFG_DEVICE_ADD("rdac", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) // burr brown pcm61p
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "ldac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "ldac", -1.0, DAC_VREF_NEG_INPUT)
+ MCFG_SOUND_ROUTE(0, "rdac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "rdac", -1.0, DAC_VREF_NEG_INPUT)
+MACHINE_CONFIG_END
-void pc9801_86_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(pc9801_86_device::device_add_mconfig)
pc9801_86_config(config);
-}
+MACHINE_CONFIG_END
// to load a different bios for slots:
// -cbusX pc9801_86,bios=N
@@ -201,7 +197,7 @@ void pc9801_86_device::device_reset()
READ8_MEMBER(pc9801_86_device::opna_r)
{
if((offset & 1) == 0)
- return m_opna->read(offset >> 1);
+ return m_opna->read(space, offset >> 1);
else // odd
{
logerror("PC9801-86: Read to undefined port [%02x]\n",offset+0x188);
@@ -212,7 +208,7 @@ READ8_MEMBER(pc9801_86_device::opna_r)
WRITE8_MEMBER(pc9801_86_device::opna_w)
{
if((offset & 1) == 0)
- m_opna->write(offset >> 1,data);
+ m_opna->write(space, offset >> 1,data);
else // odd
logerror("PC9801-86: Write to undefined port [%02x] %02x\n",offset+0x188,data);
}
@@ -423,7 +419,7 @@ void pc9801_speakboard_device::device_reset()
READ8_MEMBER(pc9801_speakboard_device::opna_slave_r)
{
if((offset & 1) == 0)
- return m_opna_slave->read(offset >> 1);
+ return m_opna_slave->read(space, offset >> 1);
else // odd
{
logerror("PC9801-SPB: Read to undefined port [%02x]\n",offset+0x588);
@@ -434,7 +430,7 @@ READ8_MEMBER(pc9801_speakboard_device::opna_slave_r)
WRITE8_MEMBER(pc9801_speakboard_device::opna_slave_w)
{
if((offset & 1) == 0)
- m_opna_slave->write(offset >> 1,data);
+ m_opna_slave->write(space, offset >> 1,data);
else // odd
logerror("PC9801-SPB: Write to undefined port [%02x] %02x\n",offset+0x588,data);
}
diff --git a/src/devices/bus/cbus/pc9801_amd98.cpp b/src/devices/bus/cbus/pc9801_amd98.cpp
index ca7b32e7b4e..f7207aabd21 100644
--- a/src/devices/bus/cbus/pc9801_amd98.cpp
+++ b/src/devices/bus/cbus/pc9801_amd98.cpp
@@ -149,9 +149,9 @@ READ8_MEMBER(pc9801_amd98_device::read)
switch(offset)
{
case 2:
- return m_ay1->data_r();
+ return m_ay1->data_r(space,0);
case 3:
- return m_ay2->data_r();
+ return m_ay2->data_r(space,0);
}
printf("%02x\n",offset);
@@ -164,16 +164,16 @@ WRITE8_MEMBER(pc9801_amd98_device::write)
switch(offset)
{
case 0:
- m_ay1->address_w(data);
+ m_ay1->address_w(space,0,data);
break;
case 1:
- m_ay2->address_w(data);
+ m_ay2->address_w(space,0,data);
break;
case 2:
- m_ay1->data_w(data);
+ m_ay1->data_w(space,0,data);
break;
case 3:
- m_ay2->data_w(data);
+ m_ay2->data_w(space,0,data);
break;
default:
printf("%02x %02x\n",offset,data);
@@ -192,11 +192,11 @@ WRITE8_MEMBER(pc9801_amd98_device::ay3_data_latch_w)
{
case 0x47:
//printf("%02x addr\n",m_ay3_latch);
- m_ay3->address_w(m_ay3_latch);
+ m_ay3->address_w(space,0,m_ay3_latch);
break;
case 0x43:
//printf("%02x data\n",m_ay3_latch);
- m_ay3->data_w(m_ay3_latch);
+ m_ay3->data_w(space,0,m_ay3_latch);
break;
}
}
diff --git a/src/devices/bus/cbus/pc9801_cbus.cpp b/src/devices/bus/cbus/pc9801_cbus.cpp
index 5a53eddcce7..eb62af6daaa 100644
--- a/src/devices/bus/cbus/pc9801_cbus.cpp
+++ b/src/devices/bus/cbus/pc9801_cbus.cpp
@@ -55,8 +55,7 @@ device_pc9801cbus_card_interface::~device_pc9801cbus_card_interface()
pc9801_slot_device::pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, PC9801CBUS_SLOT, tag, owner, clock),
device_slot_interface(mconfig, *this),
- m_memspace(*this, finder_base::DUMMY_TAG, -1),
- m_iospace(*this, finder_base::DUMMY_TAG, -1),
+ m_cpu(*this, finder_base::DUMMY_TAG),
m_int_callback{{*this}, {*this}, {*this}, {*this}, {*this}, {*this}, {*this}}
{
}
@@ -98,17 +97,17 @@ void pc9801_slot_device::device_start()
void pc9801_slot_device::install_io(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler)
{
- int buswidth = m_iospace->data_width();
+ int buswidth = this->io_space().data_width();
switch(buswidth)
{
case 8:
- m_iospace->install_readwrite_handler(start, end, rhandler, whandler, 0);
+ this->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0);
break;
case 16:
- m_iospace->install_readwrite_handler(start, end, rhandler, whandler, 0xffff);
+ this->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffff);
break;
case 32:
- m_iospace->install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff);
+ this->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff);
break;
default:
fatalerror("PC-9801-26: Bus width %d not supported\n", buswidth);
diff --git a/src/devices/bus/cbus/pc9801_cbus.h b/src/devices/bus/cbus/pc9801_cbus.h
index e094693f06c..400cfa67d27 100644
--- a/src/devices/bus/cbus/pc9801_cbus.h
+++ b/src/devices/bus/cbus/pc9801_cbus.h
@@ -2,60 +2,6 @@
// copyright-holders:Angelo Salese
/**********************************************************************
- <B> <A>
- +------+
- GND |[ 01 ]| GND
- V1 |[ 02 ]| V1
- V2 |[ 03 ]| V2
- DB001 |[ 04 ]| AB001
- DB011 |[ 05 ]| AB011
- DB021 |[ 06 ]| AB021
- DB031 |[ 07 ]| AB031
- DB041 |[ 08 ]| AB041
- DB051 |[ 09 ]| AB051
- DB061 |[ 10 ]| AB061
- GND |[ 11 ]| GND
- DB071 |[ 12 ]| AB071
- DB081 |[ 13 ]| AB081
- DB091 |[ 14 ]| AB091
- DB101 |[ 15 ]| AB101
- DB111 |[ 16 ]| AB111
- DB121 |[ 17 ]| AB121
- DB131 |[ 18 ]| AB131
- DB141 |[ 19 ]| AB141
- DB151 |[ 20 ]| AB151
- GND |[ 21 ]| GND
- +12 V |[ 22 ]| AB161
- +12 V |[ 23 ]| AB171
- "INT0" IR31 |[ 24 ]| AB181
- "INT1" IR51 |[ 25 ]| AB191
- "INT2" IR61 |[ 26 ]| AB201
- "INT3" IR91 |[ 27 ]| AB211
- "INT4" IR101/IR111 |[ 28 ]| AB221
- "INT5" IR121 |[ 29 ]| AB231
- "INT6" IR131 |[ 30 ]| INT0
- GND |[ 31 ]| GND
- -12 V |[ 32 ]| IOCHK0
- -12 V |[ 33 ]| IOR0
- RESET0 |[ 34 ]| IOW0
- DACK00 |[ 35 ]| MRC0
- DACK30/DACK20 |[ 36 ]| MWC0
- DRQ00 |[ 37 ]| S00 (INTA0)
- DRQ30/DRQ20 |[ 38 ]| S10 (NOWAIT0)
- WORD0 |[ 39 ]| S20 (SALE1)
- (EXHRQ10) CPKILL0 |[ 40 ]| LOCK (MACS0)
- GND |[ 41 ]| GND
- (EXHLA10) RQGT0 |[ 42 ]| CPUENB10
- DMATC0 |[ 43 ]| RFSH0
- NMI0 |[ 44 ]| BHE0
- MWE0 |[ 45 ]| IORDY1
- (EXHLA20) HLDA00 |[ 46 ]| SCLK1
- (EXHRQ20) HRQ00 |[ 47 ]| S18CLK1 = 307.2 kHz
- (SUBSRQ1) DMAHLD0 |[ 48 ]| POWER0
- +5 V |[ 49 ]| +5 V
- +5 V |[ 50 ]| +5 V
- +------+
- <B> <A>
**********************************************************************/
#ifndef MAME_MACHINE_PC9801_CBUS_H
@@ -64,6 +10,43 @@
#pragma once
+
+
+//**************************************************************************
+// CONSTANTS
+//**************************************************************************
+
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_PC9801CBUS_CPU(_cputag) \
+ downcast<pc9801_slot_device &>(*device).set_cpu_tag(_cputag);
+
+#define MCFG_PC9801CBUS_INT0_CALLBACK(_devcb) \
+ downcast<pc9801_slot_device &>(*device).set_int_callback<0>(DEVCB_##_devcb);
+
+#define MCFG_PC9801CBUS_INT1_CALLBACK(_devcb) \
+ downcast<pc9801_slot_device &>(*device).set_int_callback<1>(DEVCB_##_devcb);
+
+#define MCFG_PC9801CBUS_INT2_CALLBACK(_devcb) \
+ downcast<pc9801_slot_device &>(*device).set_int_callback<2>(DEVCB_##_devcb);
+
+#define MCFG_PC9801CBUS_INT3_CALLBACK(_devcb) \
+ downcast<pc9801_slot_device &>(*device).set_int_callback<3>(DEVCB_##_devcb);
+
+#define MCFG_PC9801CBUS_INT4_CALLBACK(_devcb) \
+ downcast<pc9801_slot_device &>(*device).set_int_callback<4>(DEVCB_##_devcb);
+
+#define MCFG_PC9801CBUS_INT5_CALLBACK(_devcb) \
+ downcast<pc9801_slot_device &>(*device).set_int_callback<5>(DEVCB_##_devcb);
+
+#define MCFG_PC9801CBUS_INT6_CALLBACK(_devcb) \
+ downcast<pc9801_slot_device &>(*device).set_int_callback<6>(DEVCB_##_devcb);
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -91,10 +74,11 @@ class pc9801_slot_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- template <typename T>
- pc9801_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
+ template <typename T, typename U>
+ pc9801_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&cpu_tag, U &&opts, char const *dflt)
: pc9801_slot_device(mconfig, tag, owner, (uint32_t)0)
{
+ m_cpu.set_tag(std::forward<T>(cpu_tag));
option_reset();
opts(*this);
set_default_option(dflt);
@@ -102,14 +86,11 @@ public:
}
pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template <typename T> void set_memspace(T &&tag, int spacenum) { m_memspace.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_iospace(T &&tag, int spacenum) { m_iospace.set_tag(std::forward<T>(tag), spacenum); }
-
// configuration access
template<std::size_t Line> auto int_cb() { return m_int_callback[Line].bind(); }
- address_space &program_space() const { return *m_memspace; }
- address_space &io_space() const { return *m_iospace; }
+ address_space &program_space() const { return m_cpu->space(AS_PROGRAM); }
+ address_space &io_space() const { return m_cpu->space(AS_IO); }
template<int I> void int_w(bool state) { m_int_callback[I](state); }
void install_io(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler);
@@ -121,8 +102,7 @@ protected:
private:
// device_pc9801_slot_card_interface *m_card;
- required_address_space m_memspace;
- required_address_space m_iospace;
+ required_device<cpu_device> m_cpu;
devcb_write_line m_int_callback[7];
};
diff --git a/src/devices/bus/centronics/comxpl80.cpp b/src/devices/bus/centronics/comxpl80.cpp
index 17fd3165f8d..afdce31a8bf 100644
--- a/src/devices/bus/centronics/comxpl80.cpp
+++ b/src/devices/bus/centronics/comxpl80.cpp
@@ -86,12 +86,11 @@ void comx_pl80_device::comxpl80_mem(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void comx_pl80_device::device_add_mconfig(machine_config &config)
-{
- m6805_device &cx005(M6805(config, CX005_TAG, 4000000)); // CX005: some kind of MC6805/MC68HC05 clone
- cx005.set_addrmap(AS_PROGRAM, &comx_pl80_device::comxpl80_mem);
- cx005.set_disable();
-}
+MACHINE_CONFIG_START(comx_pl80_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(CX005_TAG, M6805, 4000000) // CX005: some kind of MC6805/MC68HC05 clone
+ MCFG_DEVICE_PROGRAM_MAP(comxpl80_mem)
+ MCFG_DEVICE_DISABLE()
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/centronics/covox.cpp b/src/devices/bus/centronics/covox.cpp
index 6cafe74cb42..e508578ffe6 100644
--- a/src/devices/bus/centronics/covox.cpp
+++ b/src/devices/bus/centronics/covox.cpp
@@ -38,15 +38,13 @@ centronics_covox_device::centronics_covox_device(const machine_config &mconfig,
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void centronics_covox_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(centronics_covox_device::device_add_mconfig)
/* sound hardware */
SPEAKER(config, "speaker").front_center();
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5); // unknown DAC
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
-}
+ MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.5) // unknown DAC
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT)
+MACHINE_CONFIG_END
void centronics_covox_device::device_start()
{
@@ -89,19 +87,16 @@ centronics_covox_stereo_device::centronics_covox_stereo_device(const machine_con
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void centronics_covox_stereo_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(centronics_covox_stereo_device::device_add_mconfig)
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
- DAC_8BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // unknown DAC
- DAC_8BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "ldac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "ldac", -1.0, DAC_VREF_NEG_INPUT);
- vref.add_route(0, "rdac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "rdac", -1.0, DAC_VREF_NEG_INPUT);
-}
+ MCFG_DEVICE_ADD("ldac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.5) // unknown DAC
+ MCFG_DEVICE_ADD("rdac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5) // unknown DAC
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "ldac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "ldac", -1.0, DAC_VREF_NEG_INPUT)
+ MCFG_SOUND_ROUTE(0, "rdac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "rdac", -1.0, DAC_VREF_NEG_INPUT)
+MACHINE_CONFIG_END
void centronics_covox_stereo_device::device_start()
{
diff --git a/src/devices/bus/centronics/ctronics.h b/src/devices/bus/centronics/ctronics.h
index 7189c465e98..c05d59a94c1 100644
--- a/src/devices/bus/centronics/ctronics.h
+++ b/src/devices/bus/centronics/ctronics.h
@@ -14,6 +14,68 @@
#include "machine/output_latch.h"
+#define MCFG_CENTRONICS_STROBE_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_strobe_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_DATA0_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_data0_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_DATA1_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_data1_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_DATA2_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_data2_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_DATA3_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_data3_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_DATA4_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_data4_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_DATA5_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_data5_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_DATA6_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_data6_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_DATA7_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_data7_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_ACK_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_ack_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_BUSY_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_busy_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_PERROR_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_perror_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_SELECT_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_select_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_AUTOFD_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_autofd_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_FAULT_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_fault_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_INIT_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_init_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_SELECT_IN_HANDLER(_devcb) \
+ downcast<centronics_device &>(*device).set_select_in_handler(DEVCB_##_devcb);
+
+#define MCFG_CENTRONICS_OUTPUT_LATCH_ADD(_tag, _centronics_tag) \
+ MCFG_DEVICE_ADD(_tag, OUTPUT_LATCH, 0) \
+ MCFG_OUTPUT_LATCH_BIT0_HANDLER(WRITELINE(_centronics_tag, centronics_device, write_data0)) \
+ MCFG_OUTPUT_LATCH_BIT1_HANDLER(WRITELINE(_centronics_tag, centronics_device, write_data1)) \
+ MCFG_OUTPUT_LATCH_BIT2_HANDLER(WRITELINE(_centronics_tag, centronics_device, write_data2)) \
+ MCFG_OUTPUT_LATCH_BIT3_HANDLER(WRITELINE(_centronics_tag, centronics_device, write_data3)) \
+ MCFG_OUTPUT_LATCH_BIT4_HANDLER(WRITELINE(_centronics_tag, centronics_device, write_data4)) \
+ MCFG_OUTPUT_LATCH_BIT5_HANDLER(WRITELINE(_centronics_tag, centronics_device, write_data5)) \
+ MCFG_OUTPUT_LATCH_BIT6_HANDLER(WRITELINE(_centronics_tag, centronics_device, write_data6)) \
+ MCFG_OUTPUT_LATCH_BIT7_HANDLER(WRITELINE(_centronics_tag, centronics_device, write_data7))
+
DECLARE_DEVICE_TYPE(CENTRONICS, centronics_device)
class device_centronics_peripheral_interface;
@@ -35,6 +97,24 @@ public:
}
centronics_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <class Object> devcb_base &set_strobe_handler(Object &&cb) { return m_strobe_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data0_handler(Object &&cb) { return m_data0_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data1_handler(Object &&cb) { return m_data1_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data2_handler(Object &&cb) { return m_data2_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data3_handler(Object &&cb) { return m_data3_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data4_handler(Object &&cb) { return m_data4_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data5_handler(Object &&cb) { return m_data5_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data6_handler(Object &&cb) { return m_data6_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data7_handler(Object &&cb) { return m_data7_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ack_handler(Object &&cb) { return m_ack_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_busy_handler(Object &&cb) { return m_busy_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_perror_handler(Object &&cb) { return m_perror_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_select_handler(Object &&cb) { return m_select_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_autofd_handler(Object &&cb) { return m_autofd_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_fault_handler(Object &&cb) { return m_fault_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_init_handler(Object &&cb) { return m_init_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_select_in_handler(Object &&cb) { return m_select_in_handler.set_callback(std::forward<Object>(cb)); }
+
auto strobe_handler() { return m_strobe_handler.bind(); }
auto ack_handler() { return m_ack_handler.bind(); }
diff --git a/src/devices/bus/centronics/digiblst.cpp b/src/devices/bus/centronics/digiblst.cpp
index 97a37054172..99a046f4d13 100644
--- a/src/devices/bus/centronics/digiblst.cpp
+++ b/src/devices/bus/centronics/digiblst.cpp
@@ -38,15 +38,13 @@ centronics_digiblaster_device::centronics_digiblaster_device(const machine_confi
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void centronics_digiblaster_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(centronics_digiblaster_device::device_add_mconfig)
/* sound hardware */
SPEAKER(config, "speaker").front_center();
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5); // unknown DAC
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
-}
+ MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.5) // unknown DAC
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT)
+MACHINE_CONFIG_END
void centronics_digiblaster_device::device_start()
{
diff --git a/src/devices/bus/centronics/epson_lx810l.cpp b/src/devices/bus/centronics/epson_lx810l.cpp
index 0a0d9668cfc..848f1246a90 100644
--- a/src/devices/bus/centronics/epson_lx810l.cpp
+++ b/src/devices/bus/centronics/epson_lx810l.cpp
@@ -142,6 +142,7 @@ void epson_lx810l_device::device_add_mconfig(machine_config &config)
SPEAKER(config, "speaker").front_center();
DAC_1BIT(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25);
voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
+ vref.set_output(5.0);
vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
/* gate array */
diff --git a/src/devices/bus/centronics/nec_p72.cpp b/src/devices/bus/centronics/nec_p72.cpp
index c3a9ddd2ab2..cd7914a0bde 100644
--- a/src/devices/bus/centronics/nec_p72.cpp
+++ b/src/devices/bus/centronics/nec_p72.cpp
@@ -49,12 +49,12 @@ void nec_p72_device::p72_mem(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nec_p72_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(nec_p72_device::device_add_mconfig)
/* basic machine hardware */
- V33(config, m_maincpu, XTAL(16'000'000)/2); /* TODO it's actually a V40 */
- m_maincpu->set_addrmap(AS_PROGRAM, &nec_p72_device::p72_mem);
-}
+ MCFG_DEVICE_ADD("maincpu", V33, XTAL(16'000'000)/2) /* TODO it's actually a V40 */
+ MCFG_DEVICE_PROGRAM_MAP(p72_mem)
+
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/centronics/printer.cpp b/src/devices/bus/centronics/printer.cpp
index 484e718d074..129e53426f4 100644
--- a/src/devices/bus/centronics/printer.cpp
+++ b/src/devices/bus/centronics/printer.cpp
@@ -32,11 +32,10 @@ centronics_printer_device::centronics_printer_device(const machine_config &mconf
//-------------------------------------------------
-void centronics_printer_device::device_add_mconfig(machine_config &config)
-{
- PRINTER(config, m_printer, 0);
- m_printer->online_callback().set(FUNC(centronics_printer_device::printer_online));
-}
+MACHINE_CONFIG_START(centronics_printer_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("printer", PRINTER, 0)
+ MCFG_PRINTER_ONLINE_CB(WRITELINE(*this, centronics_printer_device, printer_online))
+MACHINE_CONFIG_END
/*-------------------------------------------------
printer_online - callback that
diff --git a/src/devices/bus/cgenie/expansion/expansion.cpp b/src/devices/bus/cgenie/expansion/expansion.cpp
index 3a7665f7c2b..366b1513aca 100644
--- a/src/devices/bus/cgenie/expansion/expansion.cpp
+++ b/src/devices/bus/cgenie/expansion/expansion.cpp
@@ -30,8 +30,8 @@ DEFINE_DEVICE_TYPE(CG_EXP_SLOT, cg_exp_slot_device, "cg_exp_slot", "Colour Genie
cg_exp_slot_device::cg_exp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, CG_EXP_SLOT, tag, owner, clock),
device_slot_interface(mconfig, *this),
- m_program(*this, finder_base::DUMMY_TAG, -1),
- m_io(*this, finder_base::DUMMY_TAG, -1),
+ m_program(nullptr),
+ m_io(nullptr),
m_cart(nullptr),
m_int_handler(*this),
m_nmi_handler(*this),
@@ -67,6 +67,24 @@ void cg_exp_slot_device::device_reset()
{
}
+//-------------------------------------------------
+// set_program_space - set address space we are attached to
+//-------------------------------------------------
+
+void cg_exp_slot_device::set_program_space(address_space *program)
+{
+ m_program = program;
+}
+
+//-------------------------------------------------
+// set_io_space - set address space we are attached to
+//-------------------------------------------------
+
+void cg_exp_slot_device::set_io_space(address_space *io)
+{
+ m_io = io;
+}
+
//**************************************************************************
// CARTRIDGE INTERFACE
diff --git a/src/devices/bus/cgenie/expansion/expansion.h b/src/devices/bus/cgenie/expansion/expansion.h
index 3f61b275c19..2dd6f659f5e 100644
--- a/src/devices/bus/cgenie/expansion/expansion.h
+++ b/src/devices/bus/cgenie/expansion/expansion.h
@@ -39,8 +39,24 @@
#pragma once
-// include here so drivers don't need to
-#include "carts.h"
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_CG_EXP_SLOT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, CG_EXP_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(cg_exp_slot_carts, nullptr, false)
+
+#define MCFG_CG_EXP_SLOT_INT_HANDLER(_devcb) \
+ downcast<cg_exp_slot_device &>(*device).set_int_handler(DEVCB_##_devcb);
+
+#define MCFG_CG_EXP_SLOT_NMI_HANDLER(_devcb) \
+ downcast<cg_exp_slot_device &>(*device).set_nmi_handler(DEVCB_##_devcb);
+
+#define MCFG_CG_EXP_SLOT_RESET_HANDLER(_devcb) \
+ downcast<cg_exp_slot_device &>(*device).set_reset_handler(DEVCB_##_devcb);
//**************************************************************************
@@ -53,32 +69,24 @@ class cg_exp_slot_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- cg_exp_slot_device(machine_config const &mconfig, char const *tag, device_t *owner)
- : cg_exp_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- cg_exp_slot_carts(*this);
- set_default_option(nullptr);
- set_fixed(false);
- }
cg_exp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~cg_exp_slot_device();
- template <typename T> void set_program_space(T &&tag, int spacenum) { m_program.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_io_space(T &&tag, int spacenum) { m_io.set_tag(std::forward<T>(tag), spacenum); }
+ void set_program_space(address_space *program);
+ void set_io_space(address_space *io);
// callbacks
- auto int_handler() { return m_int_handler.bind(); }
- auto nmi_handler() { return m_nmi_handler.bind(); }
- auto reset_handler() { return m_reset_handler.bind(); }
+ template <class Object> devcb_base &set_int_handler(Object &&cb) { return m_int_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_nmi_handler(Object &&cb) { return m_nmi_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_reset_handler(Object &&cb) { return m_reset_handler.set_callback(std::forward<Object>(cb)); }
// called from cart device
DECLARE_WRITE_LINE_MEMBER( int_w ) { m_int_handler(state); }
DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); }
DECLARE_WRITE_LINE_MEMBER( reset_w ) { m_reset_handler(state); }
- required_address_space m_program;
- required_address_space m_io;
+ address_space *m_program;
+ address_space *m_io;
protected:
// device-level overrides
@@ -109,4 +117,7 @@ protected:
// device type definition
DECLARE_DEVICE_TYPE(CG_EXP_SLOT, cg_exp_slot_device)
+// include here so drivers don't need to
+#include "carts.h"
+
#endif // MAME_BUS_CGENIE_EXPANSION_EXPANSION_H
diff --git a/src/devices/bus/cgenie/expansion/floppy.cpp b/src/devices/bus/cgenie/expansion/floppy.cpp
index 331fdfd207e..021f00e9f8d 100644
--- a/src/devices/bus/cgenie/expansion/floppy.cpp
+++ b/src/devices/bus/cgenie/expansion/floppy.cpp
@@ -72,23 +72,23 @@ const tiny_rom_entry *cgenie_fdc_device::device_rom_region() const
//-------------------------------------------------
MACHINE_CONFIG_START(cgenie_fdc_device::device_add_mconfig)
- TIMER(config, "timer").configure_periodic(FUNC(cgenie_fdc_device::timer_callback), attotime::from_msec(25));
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("timer", cgenie_fdc_device, timer_callback, attotime::from_msec(25))
FD1793(config, m_fdc, 1_MHz_XTAL);
m_fdc->intrq_wr_callback().set(FUNC(cgenie_fdc_device::intrq_w));
- FLOPPY_CONNECTOR(config, "fd1793:0", cgenie_floppies, "ssdd", cgenie_fdc_device::floppy_formats);
- FLOPPY_CONNECTOR(config, "fd1793:1", cgenie_floppies, "ssdd", cgenie_fdc_device::floppy_formats);
- FLOPPY_CONNECTOR(config, "fd1793:2", cgenie_floppies, nullptr, cgenie_fdc_device::floppy_formats);
- FLOPPY_CONNECTOR(config, "fd1793:3", cgenie_floppies, nullptr, cgenie_fdc_device::floppy_formats);
+ MCFG_FLOPPY_DRIVE_ADD("fd1793:0", cgenie_floppies, "ssdd", cgenie_fdc_device::floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD("fd1793:1", cgenie_floppies, "ssdd", cgenie_fdc_device::floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD("fd1793:2", cgenie_floppies, nullptr, cgenie_fdc_device::floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD("fd1793:3", cgenie_floppies, nullptr, cgenie_fdc_device::floppy_formats)
-// SOFTWARE_LIST(config, "floppy_list").set_original("cgenie_flop");
+// MCFG_SOFTWARE_LIST_ADD("floppy_list", "cgenie_flop")
MCFG_GENERIC_SOCKET_ADD("socket", generic_plain_slot, "cgenie_flop_rom")
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(cgenie_fdc_device, socket_load)
- SOFTWARE_LIST(config, "rom_list").set_original("cgenie_flop_rom");
+ MCFG_SOFTWARE_LIST_ADD("rom_list", "cgenie_flop_rom")
MACHINE_CONFIG_END
@@ -137,7 +137,7 @@ void cgenie_fdc_device::device_reset()
// map extra socket
if (m_socket->exists())
{
- m_slot->m_program->install_read_handler(0xe000, 0xefff, read8sm_delegate(FUNC(generic_slot_device::read_rom), (generic_slot_device *) m_socket));
+ m_slot->m_program->install_read_handler(0xe000, 0xefff, read8_delegate(FUNC(generic_slot_device::read_rom), (generic_slot_device *) m_socket));
}
}
diff --git a/src/devices/bus/cgenie/parallel/parallel.h b/src/devices/bus/cgenie/parallel/parallel.h
index b31f8c749f4..9bc8d5665c4 100644
--- a/src/devices/bus/cgenie/parallel/parallel.h
+++ b/src/devices/bus/cgenie/parallel/parallel.h
@@ -24,8 +24,16 @@
#pragma once
-// include here so drivers don't need to
-#include "carts.h"
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_CG_PARALLEL_SLOT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, CG_PARALLEL_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(cg_parallel_slot_carts, nullptr, false)
+
//**************************************************************************
// TYPE DEFINITIONS
@@ -37,14 +45,6 @@ class cg_parallel_slot_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- cg_parallel_slot_device(machine_config const &mconfig, char const *tag, device_t *owner)
- : cg_parallel_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- cg_parallel_slot_carts(*this);
- set_default_option(nullptr);
- set_fixed(false);
- }
cg_parallel_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~cg_parallel_slot_device();
@@ -86,4 +86,7 @@ protected:
// device type definition
DECLARE_DEVICE_TYPE(CG_PARALLEL_SLOT, cg_parallel_slot_device)
+// include here so drivers don't need to
+#include "carts.h"
+
#endif // MAME_BUS_CGENIE_PARALLEL_PARALLEL_H
diff --git a/src/devices/bus/cgenie/parallel/printer.cpp b/src/devices/bus/cgenie/parallel/printer.cpp
index 9a3e9df5dc4..bce52a61c97 100644
--- a/src/devices/bus/cgenie/parallel/printer.cpp
+++ b/src/devices/bus/cgenie/parallel/printer.cpp
@@ -27,17 +27,14 @@ DEFINE_DEVICE_TYPE(CGENIE_PRINTER, cgenie_printer_device, "cgenie_printer", "Pri
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void cgenie_printer_device::device_add_mconfig(machine_config &config)
-{
- CENTRONICS(config, m_centronics, centronics_devices, "printer");
- m_centronics->busy_handler().set(FUNC(cgenie_printer_device::busy_w));
- m_centronics->perror_handler().set(FUNC(cgenie_printer_device::perror_w));
- m_centronics->select_handler().set(FUNC(cgenie_printer_device::select_w));
- m_centronics->fault_handler().set(FUNC(cgenie_printer_device::fault_w));
-
- OUTPUT_LATCH(config, m_latch);
- m_centronics->set_output_latch(*m_latch);
-}
+MACHINE_CONFIG_START(cgenie_printer_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer")
+ MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, cgenie_printer_device, busy_w))
+ MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(*this, cgenie_printer_device, perror_w))
+ MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(*this, cgenie_printer_device, select_w))
+ MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(*this, cgenie_printer_device, fault_w))
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("latch", "centronics")
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/chanf/slot.h b/src/devices/bus/chanf/slot.h
index d2f9654e8cd..289c1b3e600 100644
--- a/src/devices/bus/chanf/slot.h
+++ b/src/devices/bus/chanf/slot.h
@@ -64,17 +64,7 @@ class channelf_cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- channelf_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : channelf_cart_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- channelf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ channelf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~channelf_cart_slot_device();
// device-level overrides
@@ -125,4 +115,8 @@ DECLARE_DEVICE_TYPE(CHANF_CART_SLOT, channelf_cart_slot_device)
#define CHANFSLOT_ROM_REGION_TAG ":cart:rom"
+#define MCFG_CHANNELF_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, CHANF_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
#endif // MAME_BUS_CHANF_SLOT_H
diff --git a/src/devices/bus/coco/coco_dcmodem.cpp b/src/devices/bus/coco/coco_dcmodem.cpp
index bebd6c275d5..cad760775b7 100644
--- a/src/devices/bus/coco/coco_dcmodem.cpp
+++ b/src/devices/bus/coco/coco_dcmodem.cpp
@@ -58,8 +58,8 @@ namespace
virtual void device_start() override
{
install_readwrite_handler(0xFF6C, 0xFF6F,
- read8sm_delegate(FUNC(mos6551_device::read), (mos6551_device *)m_uart),
- write8sm_delegate(FUNC(mos6551_device::write), (mos6551_device *)m_uart));
+ read8_delegate(FUNC(mos6551_device::read), (mos6551_device *)m_uart),
+ write8_delegate(FUNC(mos6551_device::write), (mos6551_device *)m_uart));
}
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -70,11 +70,6 @@ namespace
return memregion("eprom")->base();
}
- virtual memory_region* get_cart_memregion() override
- {
- return memregion("eprom");
- }
-
private:
// internal state
required_device<mos6551_device> m_uart;
diff --git a/src/devices/bus/coco/coco_fdc.cpp b/src/devices/bus/coco/coco_fdc.cpp
index 79658d27d60..db8df415ee3 100644
--- a/src/devices/bus/coco/coco_fdc.cpp
+++ b/src/devices/bus/coco/coco_fdc.cpp
@@ -180,15 +180,6 @@ uint8_t* coco_family_fdc_device_base::get_cart_base()
return memregion("eprom")->base();
}
-//-------------------------------------------------
-// coco_family_fdc_device_base::get_cart_memregion
-//-------------------------------------------------
-
-memory_region* coco_family_fdc_device_base::get_cart_memregion()
-{
- return memregion("eprom");
-}
-
//***************************************************************************
// COCO FDCs
@@ -343,17 +334,17 @@ READ8_MEMBER(coco_fdc_device_base::scs_read)
case 0x38: /* FF78 */
if (real_time_clock() == rtc_type::CLOUD9)
- m_ds1315->read_0();
+ m_ds1315->read_0(space, offset);
break;
case 0x39: /* FF79 */
if (real_time_clock() == rtc_type::CLOUD9)
- m_ds1315->read_1();
+ m_ds1315->read_1(space, offset);
break;
case 0x3C: /* FF7C */
if (real_time_clock() == rtc_type::CLOUD9)
- result = m_ds1315->read_data();
+ result = m_ds1315->read_data(space, offset);
break;
}
return result;
diff --git a/src/devices/bus/coco/coco_fdc.h b/src/devices/bus/coco/coco_fdc.h
index 2568ed51bd0..a8df8313a7c 100644
--- a/src/devices/bus/coco/coco_fdc.h
+++ b/src/devices/bus/coco/coco_fdc.h
@@ -46,7 +46,6 @@ protected:
// FDC overrides
virtual void update_lines() = 0;
virtual uint8_t* get_cart_base() override;
- virtual memory_region* get_cart_memregion() override;
// accessors
uint8_t dskreg() const { return m_dskreg; }
diff --git a/src/devices/bus/coco/coco_gmc.cpp b/src/devices/bus/coco/coco_gmc.cpp
index 72c9edfdc80..706bdf3cb1b 100644
--- a/src/devices/bus/coco/coco_gmc.cpp
+++ b/src/devices/bus/coco/coco_gmc.cpp
@@ -51,11 +51,11 @@ namespace
};
-void coco_pak_gmc_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(coco_pak_gmc_device::device_add_mconfig)
SPEAKER(config, "gmc_speaker").front_center();
- SN76489A(config, m_psg, 4_MHz_XTAL).add_route(ALL_OUTPUTS, "gmc_speaker", 1.0);
-}
+ MCFG_DEVICE_ADD(SN76489AN_TAG, SN76489A, 4_MHz_XTAL)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "gmc_speaker", 1.0)
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/coco/coco_multi.cpp b/src/devices/bus/coco/coco_multi.cpp
index 628a550fe07..60a2b99286c 100644
--- a/src/devices/bus/coco/coco_multi.cpp
+++ b/src/devices/bus/coco/coco_multi.cpp
@@ -96,6 +96,29 @@ namespace
// construction/destruction
coco_multipak_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ // optional information overrides
+ virtual void device_add_mconfig(machine_config &config) override;
+
+ virtual uint8_t* get_cart_base() override;
+ virtual uint32_t get_cart_size() override;
+
+ // these are only public so they can be in a MACHINE_CONFIG_START
+ // declaration; don't think about them as publically accessable
+ DECLARE_WRITE_LINE_MEMBER(multi_slot1_cart_w);
+ DECLARE_WRITE_LINE_MEMBER(multi_slot1_nmi_w);
+ DECLARE_WRITE_LINE_MEMBER(multi_slot1_halt_w);
+ DECLARE_WRITE_LINE_MEMBER(multi_slot2_cart_w);
+ DECLARE_WRITE_LINE_MEMBER(multi_slot2_nmi_w);
+ DECLARE_WRITE_LINE_MEMBER(multi_slot2_halt_w);
+ DECLARE_WRITE_LINE_MEMBER(multi_slot3_cart_w);
+ DECLARE_WRITE_LINE_MEMBER(multi_slot3_nmi_w);
+ DECLARE_WRITE_LINE_MEMBER(multi_slot3_halt_w);
+ DECLARE_WRITE_LINE_MEMBER(multi_slot4_cart_w);
+ DECLARE_WRITE_LINE_MEMBER(multi_slot4_nmi_w);
+ DECLARE_WRITE_LINE_MEMBER(multi_slot4_halt_w);
+
+ virtual address_space &cartridge_space() override;
+ virtual ioport_constructor device_input_ports() const override;
INPUT_CHANGED_MEMBER( switch_changed );
protected:
@@ -106,15 +129,6 @@ namespace
virtual WRITE8_MEMBER(scs_write) override;
virtual void set_sound_enable(bool sound_enable) override;
- // optional information overrides
- virtual void device_add_mconfig(machine_config &config) override;
-
- virtual uint8_t* get_cart_base() override;
- virtual uint32_t get_cart_size() override;
-
- virtual address_space &cartridge_space() override;
- virtual ioport_constructor device_input_ports() const override;
-
private:
// device references
required_device_array<cococart_slot_device, 4> m_slots;
@@ -135,19 +149,6 @@ namespace
DECLARE_READ8_MEMBER(ff7f_read);
DECLARE_WRITE8_MEMBER(ff7f_write);
void update_line(int slot_number, line ln);
-
- DECLARE_WRITE_LINE_MEMBER(multi_slot1_cart_w);
- DECLARE_WRITE_LINE_MEMBER(multi_slot1_nmi_w);
- DECLARE_WRITE_LINE_MEMBER(multi_slot1_halt_w);
- DECLARE_WRITE_LINE_MEMBER(multi_slot2_cart_w);
- DECLARE_WRITE_LINE_MEMBER(multi_slot2_nmi_w);
- DECLARE_WRITE_LINE_MEMBER(multi_slot2_halt_w);
- DECLARE_WRITE_LINE_MEMBER(multi_slot3_cart_w);
- DECLARE_WRITE_LINE_MEMBER(multi_slot3_nmi_w);
- DECLARE_WRITE_LINE_MEMBER(multi_slot3_halt_w);
- DECLARE_WRITE_LINE_MEMBER(multi_slot4_cart_w);
- DECLARE_WRITE_LINE_MEMBER(multi_slot4_nmi_w);
- DECLARE_WRITE_LINE_MEMBER(multi_slot4_halt_w);
};
};
@@ -181,25 +182,24 @@ static void coco_cart_slot4(device_slot_interface &device)
}
-void coco_multipak_device::device_add_mconfig(machine_config &config)
-{
- COCOCART_SLOT(config, m_slots[0], DERIVED_CLOCK(1, 1), coco_cart_slot1_3, nullptr);
- m_slots[0]->cart_callback().set(FUNC(coco_multipak_device::multi_slot1_cart_w));
- m_slots[0]->nmi_callback().set(FUNC(coco_multipak_device::multi_slot1_nmi_w));
- m_slots[0]->halt_callback().set(FUNC(coco_multipak_device::multi_slot1_halt_w));
- COCOCART_SLOT(config, m_slots[1], DERIVED_CLOCK(1, 1), coco_cart_slot1_3, nullptr);
- m_slots[1]->cart_callback().set(FUNC(coco_multipak_device::multi_slot2_cart_w));
- m_slots[1]->nmi_callback().set(FUNC(coco_multipak_device::multi_slot2_nmi_w));
- m_slots[1]->halt_callback().set(FUNC(coco_multipak_device::multi_slot2_halt_w));
- COCOCART_SLOT(config, m_slots[2], DERIVED_CLOCK(1, 1), coco_cart_slot1_3, nullptr);
- m_slots[2]->cart_callback().set(FUNC(coco_multipak_device::multi_slot3_cart_w));
- m_slots[2]->nmi_callback().set(FUNC(coco_multipak_device::multi_slot3_nmi_w));
- m_slots[2]->halt_callback().set(FUNC(coco_multipak_device::multi_slot3_halt_w));
- COCOCART_SLOT(config, m_slots[3], DERIVED_CLOCK(1, 1), coco_cart_slot4, "fdcv11");
- m_slots[3]->cart_callback().set(FUNC(coco_multipak_device::multi_slot4_cart_w));
- m_slots[3]->nmi_callback().set(FUNC(coco_multipak_device::multi_slot4_nmi_w));
- m_slots[3]->halt_callback().set(FUNC(coco_multipak_device::multi_slot4_halt_w));
-}
+MACHINE_CONFIG_START(coco_multipak_device::device_add_mconfig)
+ MCFG_COCO_CARTRIDGE_ADD(SLOT1_TAG, coco_cart_slot1_3, nullptr)
+ MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot1_cart_w))
+ MCFG_COCO_CARTRIDGE_NMI_CB(WRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot1_nmi_w))
+ MCFG_COCO_CARTRIDGE_HALT_CB(WRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot1_halt_w))
+ MCFG_COCO_CARTRIDGE_ADD(SLOT2_TAG, coco_cart_slot1_3, nullptr)
+ MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot2_cart_w))
+ MCFG_COCO_CARTRIDGE_NMI_CB(WRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot2_nmi_w))
+ MCFG_COCO_CARTRIDGE_HALT_CB(WRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot2_halt_w))
+ MCFG_COCO_CARTRIDGE_ADD(SLOT3_TAG, coco_cart_slot1_3, nullptr)
+ MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot3_cart_w))
+ MCFG_COCO_CARTRIDGE_NMI_CB(WRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot3_nmi_w))
+ MCFG_COCO_CARTRIDGE_HALT_CB(WRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot3_halt_w))
+ MCFG_COCO_CARTRIDGE_ADD(SLOT4_TAG, coco_cart_slot4, "fdcv11")
+ MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot4_cart_w))
+ MCFG_COCO_CARTRIDGE_NMI_CB(WRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot4_nmi_w))
+ MCFG_COCO_CARTRIDGE_HALT_CB(WRITELINE(DEVICE_SELF, coco_multipak_device, multi_slot4_halt_w))
+MACHINE_CONFIG_END
INPUT_PORTS_START( coco_multipack )
PORT_START( SWITCH_CONFIG_TAG )
diff --git a/src/devices/bus/coco/coco_orch90.cpp b/src/devices/bus/coco/coco_orch90.cpp
index 2ad8afdaae1..979acd423a1 100644
--- a/src/devices/bus/coco/coco_orch90.cpp
+++ b/src/devices/bus/coco/coco_orch90.cpp
@@ -92,11 +92,6 @@ namespace
return memregion("eprom")->base();
}
- virtual memory_region* get_cart_memregion() override
- {
- return memregion("eprom");
- }
-
private:
WRITE8_MEMBER(write_left) { m_ldac->write(data); }
WRITE8_MEMBER(write_right) { m_rdac->write(data); }
@@ -112,16 +107,15 @@ namespace
// MACHINE AND ROM DECLARATIONS
//**************************************************************************
-void coco_orch90_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(coco_orch90_device::device_add_mconfig)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
- DAC_8BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // ls374.ic5 + r7 (8x20k) + r9 (8x10k)
- DAC_8BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // ls374.ic4 + r6 (8x20k) + r8 (8x10k)
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "ldac", 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, "ldac", -1.0, DAC_VREF_NEG_INPUT);
- vref.add_route(0, "rdac", 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, "rdac", -1.0, DAC_VREF_NEG_INPUT);
-}
+ MCFG_DEVICE_ADD("ldac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.5) // ls374.ic5 + r7 (8x20k) + r9 (8x10k)
+ MCFG_DEVICE_ADD("rdac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5) // ls374.ic4 + r6 (8x20k) + r8 (8x10k)
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "ldac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "ldac", -1.0, DAC_VREF_NEG_INPUT)
+ MCFG_SOUND_ROUTE(0, "rdac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "rdac", -1.0, DAC_VREF_NEG_INPUT)
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/coco/coco_rs232.cpp b/src/devices/bus/coco/coco_rs232.cpp
index 5a124986792..802d46251ad 100644
--- a/src/devices/bus/coco/coco_rs232.cpp
+++ b/src/devices/bus/coco/coco_rs232.cpp
@@ -56,8 +56,8 @@ namespace
virtual void device_start() override
{
install_readwrite_handler(0xFF68, 0xFF6B,
- read8sm_delegate(FUNC(mos6551_device::read), (mos6551_device *)m_uart),
- write8sm_delegate(FUNC(mos6551_device::write), (mos6551_device *)m_uart));
+ read8_delegate(FUNC(mos6551_device::read), (mos6551_device *)m_uart),
+ write8_delegate(FUNC(mos6551_device::write), (mos6551_device *)m_uart));
}
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -68,11 +68,6 @@ namespace
return memregion("eprom")->base();
}
- virtual memory_region* get_cart_memregion() override
- {
- return memregion("eprom");
- }
-
private:
// internal state
required_device<mos6551_device> m_uart;
diff --git a/src/devices/bus/coco/coco_ssc.cpp b/src/devices/bus/coco/coco_ssc.cpp
index 6dcd34a8f03..8840df18835 100644
--- a/src/devices/bus/coco/coco_ssc.cpp
+++ b/src/devices/bus/coco/coco_ssc.cpp
@@ -152,8 +152,7 @@ DEFINE_DEVICE_TYPE(COCOSSC_SAC, cocossc_sac_device, "cocossc_sac", "CoCo SSC Sou
// MACHINE FRAGMENTS AND ADDRESS MAPS
//**************************************************************************
-void coco_ssc_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(coco_ssc_device::device_add_mconfig)
TMS7040(config, m_tms7040, DERIVED_CLOCK(2, 1));
m_tms7040->in_porta().set(FUNC(coco_ssc_device::ssc_port_a_r));
m_tms7040->out_portb().set(FUNC(coco_ssc_device::ssc_port_b_w));
@@ -174,9 +173,9 @@ void coco_ssc_device::device_add_mconfig(machine_config &config)
m_ay->set_flags(AY8910_SINGLE_OUTPUT);
m_ay->add_route(ALL_OUTPUTS, "coco_sac_tag", AY8913_GAIN);
- COCOSSC_SAC(config, m_sac, DERIVED_CLOCK(2, 1));
- m_sac->add_route(ALL_OUTPUTS, "ssc_audio", 1.0);
-}
+ MCFG_DEVICE_ADD("coco_sac_tag", COCOSSC_SAC, DERIVED_CLOCK(2, 1))
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "ssc_audio", 1.0)
+MACHINE_CONFIG_END
ROM_START(coco_ssc)
ROM_REGION(0x1000, PIC_TAG, 0)
@@ -438,12 +437,12 @@ WRITE8_MEMBER(coco_ssc_device::ssc_port_c_w)
{
if( (data & (C_BDR|C_BC1)) == (C_BDR|C_BC1) ) /* BDIR = 1, BC1 = 1: latch address */
{
- m_ay->address_w(m_tms7000_portd);
+ m_ay->address_w(space, 0, m_tms7000_portd);
}
if( ((data & C_BDR) == C_BDR) && ((data & C_BC1) == 0) ) /* BDIR = 1, BC1 = 0: write data */
{
- m_ay->data_w(m_tms7000_portd);
+ m_ay->data_w(space, 0, m_tms7000_portd);
}
}
@@ -493,7 +492,7 @@ READ8_MEMBER(coco_ssc_device::ssc_port_d_r)
{
if( ((m_tms7000_portc & C_BDR) == 0) && ((m_tms7000_portc & C_BC1) == C_BC1) ) /* psg read data */
{
- m_tms7000_portd = m_ay->data_r();
+ m_tms7000_portd = m_ay->data_r(space, 0);
}
}
diff --git a/src/devices/bus/coco/coco_t4426.cpp b/src/devices/bus/coco/coco_t4426.cpp
index 11c4499990a..eaa6f651ef2 100644
--- a/src/devices/bus/coco/coco_t4426.cpp
+++ b/src/devices/bus/coco/coco_t4426.cpp
@@ -332,13 +332,16 @@ READ8_MEMBER(coco_t4426_device::scs_read)
if ((offset >= 0x00) && (offset <= 0x07))
{
LOGPIA("- PIA\n");
- result = m_pia->read(offset & 3);
+ result = m_pia->read(space, offset & 3);
LOGPIA("- Offs:%04x Data:%02x\n", offset - 0x04, result);
}
else if ((offset >= 0x08) && (offset <= 0x0f) && (offset & 2))
{
LOGACIA("- ACIA\n");
- result = m_uart->read(offset & 1);
+ if (offset & 1)
+ result = m_uart->status_r(space, offset & 1);
+ else
+ result = m_uart->data_r(space, offset & 1);
LOGACIA("- Offs:%04x Data:%02x\n", offset - 0x04, result);
}
else
@@ -363,12 +366,15 @@ WRITE8_MEMBER(coco_t4426_device::scs_write)
if ((offset >= 0x00) && (offset <= 0x07))
{
LOG("- PIA\n");
- m_pia->write(offset & 3, data);
+ m_pia->write(space, offset & 3, data);
}
else if ((offset >= 0x08) && (offset <= 0x0f) && (offset & 2))
{
LOGACIA("- ACIA");
- m_uart->write(offset & 1, data);
+ if (offset & 1)
+ m_uart->control_w(space, offset & 1, data);
+ else
+ m_uart->data_w(space, offset & 1, data);
LOGACIA(" - Offs:%04x Data:%02x\n", offset & 1, data);
}
else
diff --git a/src/devices/bus/coco/cococart.cpp b/src/devices/bus/coco/cococart.cpp
index 6bf6360d24b..2c009aa8724 100644
--- a/src/devices/bus/coco/cococart.cpp
+++ b/src/devices/bus/coco/cococart.cpp
@@ -412,11 +412,11 @@ image_init_result cococart_slot_device::call_load()
{
memory_region *cart_mem = m_cart->get_cart_memregion();
uint8_t *base = cart_mem->base();
- offs_t read_length, cart_length = cart_mem->bytes();;
+ offs_t read_length, cart_legnth = cart_mem->bytes();;
if (!loaded_through_softlist())
{
- read_length = fread(base, cart_length);
+ read_length = fread(base, cart_legnth);
}
else
{
@@ -424,7 +424,7 @@ image_init_result cococart_slot_device::call_load()
memcpy(base, get_software_region("rom"), read_length);
}
- while (read_length < cart_length)
+ while (read_length < cart_legnth)
{
offs_t len = std::min(read_length, m_cart->get_cart_size() - read_length);
memcpy(base + read_length, base, len);
@@ -597,6 +597,40 @@ address_space &device_cococart_interface::cartridge_space()
//-------------------------------------------------
+// install_read_handler
+//-------------------------------------------------
+
+void device_cococart_interface::install_read_handler(uint16_t addrstart, uint16_t addrend, read8_delegate rhandler)
+{
+ address_space &space(cartridge_space());
+ space.install_read_handler(addrstart, addrend, rhandler);
+}
+
+
+//-------------------------------------------------
+// install_write_handler
+//-------------------------------------------------
+
+void device_cococart_interface::install_write_handler(uint16_t addrstart, uint16_t addrend, write8_delegate whandler)
+{
+ address_space &space(cartridge_space());
+ space.install_write_handler(addrstart, addrend, whandler);
+}
+
+
+//-------------------------------------------------
+// install_readwrite_handler
+//-------------------------------------------------
+
+void device_cococart_interface::install_readwrite_handler(uint16_t addrstart, uint16_t addrend, read8_delegate rhandler, write8_delegate whandler)
+{
+ address_space &space(cartridge_space());
+ space.install_read_handler(addrstart, addrend, rhandler);
+ space.install_write_handler(addrstart, addrend, whandler);
+}
+
+
+//-------------------------------------------------
// set_line_value
//-------------------------------------------------
diff --git a/src/devices/bus/coco/cococart.h b/src/devices/bus/coco/cococart.h
index c559a2eea53..2d5d37fd443 100644
--- a/src/devices/bus/coco/cococart.h
+++ b/src/devices/bus/coco/cococart.h
@@ -25,6 +25,15 @@
// direct region update handler
typedef delegate<void (uint8_t *)> cococart_base_update_delegate;
+#define MCFG_COCO_CARTRIDGE_CART_CB(_devcb) \
+ downcast<cococart_slot_device &>(*device).set_cart_callback(DEVCB_##_devcb);
+
+#define MCFG_COCO_CARTRIDGE_NMI_CB(_devcb) \
+ downcast<cococart_slot_device &>(*device).set_nmi_callback(DEVCB_##_devcb);
+
+#define MCFG_COCO_CARTRIDGE_HALT_CB(_devcb) \
+ downcast<cococart_slot_device &>(*device).set_halt_callback(DEVCB_##_devcb);
+
// ======================> cococart_slot_device
class device_cococart_interface;
@@ -63,6 +72,9 @@ public:
}
cococart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <class Object> devcb_base &set_cart_callback(Object &&cb) { return m_cart_callback.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_nmi_callback(Object &&cb) { return m_nmi_callback.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_halt_callback(Object &&cb) { return m_halt_callback.set_callback(std::forward<Object>(cb)); }
auto cart_callback() { return m_cart_callback.bind(); }
auto nmi_callback() { return m_nmi_callback.bind(); }
auto halt_callback() { return m_halt_callback.bind(); }
@@ -187,25 +199,9 @@ protected:
// cartridges (e.g. - Orch-90, Multi-Pak interface) for their control registers, independently
// of the SCS or CTS lines
address_space &cartridge_space();
- template <typename R>
- void install_read_handler(u16 addrstart, u16 addrend, R &&rhandler)
- {
- address_space &space(cartridge_space());
- space.install_read_handler(addrstart, addrend, std::forward<R>(rhandler));
- }
- template <typename W>
- void install_write_handler(u16 addrstart, u16 addrend, W &&whandler)
- {
- address_space &space(cartridge_space());
- space.install_write_handler(addrstart, addrend, std::forward<W>(whandler));
- }
- template <typename R, typename W>
- void install_readwrite_handler(u16 addrstart, u16 addrend, R &&rhandler, W &&whandler)
- {
- address_space &space(cartridge_space());
- space.install_read_handler(addrstart, addrend, std::forward<R>(rhandler));
- space.install_write_handler(addrstart, addrend, std::forward<W>(whandler));
- }
+ void install_read_handler(uint16_t addrstart, uint16_t addrend, read8_delegate rhandler);
+ void install_write_handler(uint16_t addrstart, uint16_t addrend, write8_delegate whandler);
+ void install_readwrite_handler(uint16_t addrstart, uint16_t addrend, read8_delegate rhandler, write8_delegate whandler);
// setting line values
void set_line_value(cococart_slot_device::line line, cococart_slot_device::line_value value);
@@ -220,4 +216,16 @@ private:
device_cococart_host_interface * m_host;
};
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_COCO_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, COCOCART_SLOT, DERIVED_CLOCK(1, 1)) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+#define MCFG_COCO_CARTRIDGE_REMOVE(_tag) \
+ MCFG_DEVICE_REMOVE(_tag)
+
#endif // MAME_BUS_COCO_COCOCART_H
diff --git a/src/devices/bus/coco/dragon_jcbsnd.cpp b/src/devices/bus/coco/dragon_jcbsnd.cpp
index efb2bc42a62..8fae5eaf8df 100644
--- a/src/devices/bus/coco/dragon_jcbsnd.cpp
+++ b/src/devices/bus/coco/dragon_jcbsnd.cpp
@@ -22,7 +22,7 @@
ROM_START( dragon_jcbsnd )
- ROM_REGION(0x1000, "eprom", ROMREGION_ERASE00)
+ ROM_REGION(0x8000, "eprom", ROMREGION_ERASE00)
ROM_LOAD("d32sem.rom", 0x0000, 0x1000, CRC(4cd0f30b) SHA1(d07bb9272e3d3928059853730ff656905a80b68e))
ROM_END
@@ -53,8 +53,8 @@ dragon_jcbsnd_device::dragon_jcbsnd_device(const machine_config &mconfig, const
void dragon_jcbsnd_device::device_start()
{
- install_write_handler(0xfefe, 0xfefe, write8smo_delegate(FUNC(ay8910_device::address_w), (ay8910_device *)m_ay8910));
- install_readwrite_handler(0xfeff, 0xfeff, read8smo_delegate(FUNC(ay8910_device::data_r), (ay8910_device *)m_ay8910), write8smo_delegate(FUNC(ay8910_device::data_w), (ay8910_device *)m_ay8910));
+ install_write_handler(0xfefe, 0xfefe, write8_delegate(FUNC(ay8910_device::address_w), (ay8910_device *)m_ay8910));
+ install_readwrite_handler(0xfeff, 0xfeff, read8_delegate(FUNC(ay8910_device::data_r), (ay8910_device *)m_ay8910), write8_delegate(FUNC(ay8910_device::data_w), (ay8910_device *)m_ay8910));
set_line_value(line::CART, line_value::Q);
}
@@ -69,15 +69,6 @@ uint8_t* dragon_jcbsnd_device::get_cart_base()
}
//-------------------------------------------------
-// dragon_jcbsnd_device::get_cart_memregion
-//-------------------------------------------------
-
-memory_region* dragon_jcbsnd_device::get_cart_memregion()
-{
- return memregion("eprom");
-}
-
-//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
diff --git a/src/devices/bus/coco/dragon_jcbsnd.h b/src/devices/bus/coco/dragon_jcbsnd.h
index 2ed76628075..35167dd53f8 100644
--- a/src/devices/bus/coco/dragon_jcbsnd.h
+++ b/src/devices/bus/coco/dragon_jcbsnd.h
@@ -29,7 +29,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual uint8_t* get_cart_base() override;
- virtual memory_region* get_cart_memregion() override;
// internal state
device_image_interface *m_cart;
diff --git a/src/devices/bus/coleco/controller/ctrl.cpp b/src/devices/bus/coleco/ctrl.cpp
index 330c7c71551..330c7c71551 100644
--- a/src/devices/bus/coleco/controller/ctrl.cpp
+++ b/src/devices/bus/coleco/ctrl.cpp
diff --git a/src/devices/bus/coleco/controller/ctrl.h b/src/devices/bus/coleco/ctrl.h
index 3460dec0b7d..3460dec0b7d 100644
--- a/src/devices/bus/coleco/controller/ctrl.h
+++ b/src/devices/bus/coleco/ctrl.h
diff --git a/src/devices/bus/coleco/cartridge/exp.cpp b/src/devices/bus/coleco/exp.cpp
index eaf3f144322..c2878c4523a 100644
--- a/src/devices/bus/coleco/cartridge/exp.cpp
+++ b/src/devices/bus/coleco/exp.cpp
@@ -118,11 +118,11 @@ std::string colecovision_cartridge_slot_device::get_default_card_software(get_de
// bd_r - cartridge data read
//-------------------------------------------------
-uint8_t colecovision_cartridge_slot_device::bd_r(offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000)
+uint8_t colecovision_cartridge_slot_device::bd_r(address_space &space, offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000)
{
if (m_card != nullptr)
{
- data = m_card->bd_r(offset, data, _8000, _a000, _c000, _e000);
+ data = m_card->bd_r(space, offset, data, _8000, _a000, _c000, _e000);
}
return data;
diff --git a/src/devices/bus/coleco/cartridge/exp.h b/src/devices/bus/coleco/exp.h
index 4da9d2d1d00..a4bf724c6e7 100644
--- a/src/devices/bus/coleco/cartridge/exp.h
+++ b/src/devices/bus/coleco/exp.h
@@ -65,7 +65,7 @@ public:
colecovision_cartridge_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// computer interface
- uint8_t bd_r(offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000);
+ uint8_t bd_r(address_space &space, offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000);
protected:
// device-level overrides
@@ -99,7 +99,7 @@ class device_colecovision_cartridge_interface : public device_slot_card_interfac
friend class colecovision_cartridge_slot_device;
public:
- virtual uint8_t bd_r(offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000) { return 0xff; }
+ virtual uint8_t bd_r(address_space &space, offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000) { return 0xff; }
void rom_alloc(size_t size);
diff --git a/src/devices/bus/coleco/controller/hand.cpp b/src/devices/bus/coleco/hand.cpp
index b8410183b68..b8410183b68 100644
--- a/src/devices/bus/coleco/controller/hand.cpp
+++ b/src/devices/bus/coleco/hand.cpp
diff --git a/src/devices/bus/coleco/controller/hand.h b/src/devices/bus/coleco/hand.h
index f65ad709106..f65ad709106 100644
--- a/src/devices/bus/coleco/controller/hand.h
+++ b/src/devices/bus/coleco/hand.h
diff --git a/src/devices/bus/coleco/controller/sac.cpp b/src/devices/bus/coleco/sac.cpp
index 7b3cef9b114..7b3cef9b114 100644
--- a/src/devices/bus/coleco/controller/sac.cpp
+++ b/src/devices/bus/coleco/sac.cpp
diff --git a/src/devices/bus/coleco/controller/sac.h b/src/devices/bus/coleco/sac.h
index 20078e33ef7..20078e33ef7 100644
--- a/src/devices/bus/coleco/controller/sac.h
+++ b/src/devices/bus/coleco/sac.h
diff --git a/src/devices/bus/coleco/cartridge/std.cpp b/src/devices/bus/coleco/std.cpp
index 24bb815834e..ae490dea2e9 100644
--- a/src/devices/bus/coleco/cartridge/std.cpp
+++ b/src/devices/bus/coleco/std.cpp
@@ -47,7 +47,7 @@ void colecovision_standard_cartridge_device::device_start()
// read - cartridge data read
//-------------------------------------------------
-uint8_t colecovision_standard_cartridge_device::bd_r(offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000)
+uint8_t colecovision_standard_cartridge_device::bd_r(address_space &space, offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000)
{
if (!_8000 || !_a000 || !_c000 || !_e000)
{
diff --git a/src/devices/bus/coleco/cartridge/std.h b/src/devices/bus/coleco/std.h
index 6e0c5206ada..7ee221502a7 100644
--- a/src/devices/bus/coleco/cartridge/std.h
+++ b/src/devices/bus/coleco/std.h
@@ -33,7 +33,7 @@ protected:
virtual void device_start() override;
// device_colecovision_expansion_card_interface overrides
- virtual uint8_t bd_r(offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000) override;
+ virtual uint8_t bd_r(address_space &space, offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000) override;
};
diff --git a/src/devices/bus/coleco/cartridge/xin1.cpp b/src/devices/bus/coleco/xin1.cpp
index 140d2132ee4..3538f93bb90 100644
--- a/src/devices/bus/coleco/cartridge/xin1.cpp
+++ b/src/devices/bus/coleco/xin1.cpp
@@ -58,7 +58,7 @@ void colecovision_xin1_cartridge_device::device_reset()
// read - cartridge data read
//-------------------------------------------------
-uint8_t colecovision_xin1_cartridge_device::bd_r(offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000)
+uint8_t colecovision_xin1_cartridge_device::bd_r(address_space &space, offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000)
{
if (!_8000 || !_a000 || !_c000 || !_e000)
{
diff --git a/src/devices/bus/coleco/cartridge/xin1.h b/src/devices/bus/coleco/xin1.h
index 0e8a7813c9f..c5b0ae49b76 100644
--- a/src/devices/bus/coleco/cartridge/xin1.h
+++ b/src/devices/bus/coleco/xin1.h
@@ -34,7 +34,7 @@ protected:
virtual void device_reset() override;
// device_colecovision_expansion_card_interface overrides
- virtual uint8_t bd_r(offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000) override;
+ virtual uint8_t bd_r(address_space &space, offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000) override;
private:
uint32_t m_current_offset;
diff --git a/src/devices/bus/compis/graphics.h b/src/devices/bus/compis/graphics.h
index 0f3f2b104b1..c5b414d1fab 100644
--- a/src/devices/bus/compis/graphics.h
+++ b/src/devices/bus/compis/graphics.h
@@ -24,16 +24,16 @@ class compis_graphics_slot_device;
class device_compis_graphics_card_interface : public device_slot_card_interface
{
public:
- virtual uint8_t mcs0_r(offs_t offset) { return 0xff; }
- virtual void mcs0_w(offs_t offset, uint8_t data) { }
- virtual uint8_t mcs1_r(offs_t offset) { return 0xff; }
- virtual void mcs1_w(offs_t offset, uint8_t data) { }
- virtual uint16_t pcs3_r(offs_t offset) { return 0xff; }
- virtual void pcs3_w(offs_t offset, uint16_t data) { }
- virtual uint8_t pcs6_6_r(offs_t offset) { return 0xff; }
- virtual void pcs6_6_w(offs_t offset, uint8_t data) { }
- virtual uint8_t dma_ack_r(offs_t offset) { return 0xff; }
- virtual void dma_ack_w(offs_t offset, uint8_t data) { }
+ virtual uint8_t mcs0_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void mcs0_w(address_space &space, offs_t offset, uint8_t data) { }
+ virtual uint8_t mcs1_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void mcs1_w(address_space &space, offs_t offset, uint8_t data) { }
+ virtual uint16_t pcs3_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void pcs3_w(address_space &space, offs_t offset, uint16_t data) { }
+ virtual uint8_t pcs6_6_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void pcs6_6_w(address_space &space, offs_t offset, uint8_t data) { }
+ virtual uint8_t dma_ack_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void dma_ack_w(address_space &space, offs_t offset, uint8_t data) { }
protected:
// construction/destruction
@@ -64,16 +64,16 @@ public:
auto drq() { return m_write_dma_request.bind(); }
// computer interface
- uint8_t mcs0_r(offs_t offset) { return m_card ? m_card->mcs0_r(offset) : 0xff; }
- void mcs0_w(offs_t offset, uint8_t data) { if (m_card) m_card->mcs0_w(offset, data); }
- uint8_t mcs1_r(offs_t offset) { return m_card ? m_card->mcs1_r(offset) : 0xff; }
- void mcs1_w(offs_t offset, uint8_t data) { if (m_card) m_card->mcs1_w(offset, data); }
- uint8_t pcs3_r(offs_t offset) { return m_card ? m_card->pcs3_r(offset) : 0xff; }
- void pcs3_w(offs_t offset, uint8_t data) { if (m_card) m_card->pcs3_w(offset, data); }
- uint8_t pcs6_6_r(offs_t offset) { return m_card ? m_card->pcs6_6_r(offset) : 0xff; }
- void pcs6_6_w(offs_t offset, uint8_t data) { if (m_card) m_card->pcs6_6_w(offset, data); }
- uint8_t dma_ack_r(offs_t offset) { return m_card ? m_card->dma_ack_r(offset) : 0xff; }
- void dma_ack_w(offs_t offset, uint8_t data) { if (m_card) m_card->dma_ack_w(offset, data); }
+ DECLARE_READ8_MEMBER( mcs0_r ) { return m_card ? m_card->mcs0_r(space, offset) : 0xff; }
+ DECLARE_WRITE8_MEMBER( mcs0_w ) { if (m_card) m_card->mcs0_w(space, offset, data); }
+ DECLARE_READ8_MEMBER( mcs1_r ) { return m_card ? m_card->mcs1_r(space, offset) : 0xff; }
+ DECLARE_WRITE8_MEMBER( mcs1_w ) { if (m_card) m_card->mcs1_w(space, offset, data); }
+ DECLARE_READ16_MEMBER( pcs3_r ) { return m_card ? m_card->pcs3_r(space, offset) : 0xff; }
+ DECLARE_WRITE16_MEMBER( pcs3_w ) { if (m_card) m_card->pcs3_w(space, offset, data); }
+ DECLARE_READ8_MEMBER( pcs6_6_r ) { return m_card ? m_card->pcs6_6_r(space, offset) : 0xff; }
+ DECLARE_WRITE8_MEMBER( pcs6_6_w ) { if (m_card) m_card->pcs6_6_w(space, offset, data); }
+ DECLARE_READ8_MEMBER( dma_ack_r ) { return m_card ? m_card->dma_ack_r(space, offset) : 0xff; }
+ DECLARE_WRITE8_MEMBER( dma_ack_w ) { if (m_card) m_card->dma_ack_w(space, offset, data); }
// card interface
DECLARE_WRITE_LINE_MEMBER( dma_request_w ) { m_write_dma_request(state); }
diff --git a/src/devices/bus/compis/hrg.cpp b/src/devices/bus/compis/hrg.cpp
index 7aa8aa72f7e..fc1665107fa 100644
--- a/src/devices/bus/compis/hrg.cpp
+++ b/src/devices/bus/compis/hrg.cpp
@@ -77,42 +77,40 @@ UPD7220_DISPLAY_PIXELS_MEMBER( compis_uhrg_device::display_pixels )
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void compis_hrg_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER, rgb_t::green()));
- screen.set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
- screen.set_refresh_hz(50);
- screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate
- screen.set_size(640, 400);
- screen.set_visarea(0, 640-1, 0, 400-1);
- screen.set_screen_update(UPD7220_TAG, FUNC(upd7220_device::screen_update));
+MACHINE_CONFIG_START(compis_hrg_device::device_add_mconfig)
+ MCFG_SCREEN_ADD_MONOCHROME(SCREEN_TAG, RASTER, rgb_t::green())
+ MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
+ MCFG_SCREEN_REFRESH_RATE(50)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate
+ MCFG_SCREEN_SIZE(640, 400)
+ MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1)
+ MCFG_SCREEN_UPDATE_DEVICE(UPD7220_TAG, upd7220_device, screen_update)
UPD7220(config, m_crtc, 2252500); // unknown clock
m_crtc->set_addrmap(0, &compis_hrg_device::hrg_map);
- m_crtc->set_display_pixels(FUNC(compis_hrg_device::display_pixels));
+ m_crtc->set_display_pixels_callback(FUNC(compis_hrg_device::display_pixels), this);
m_crtc->set_screen(SCREEN_TAG);
PALETTE(config, m_palette, palette_device::MONOCHROME);
-}
+MACHINE_CONFIG_END
-void compis_uhrg_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER, rgb_t::green()));
- screen.set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
- screen.set_refresh_hz(50);
- screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate
- screen.set_size(1280, 800);
- screen.set_visarea(0, 1280-1, 0, 800-1);
- screen.set_screen_update(UPD7220_TAG, FUNC(upd7220_device::screen_update));
+MACHINE_CONFIG_START(compis_uhrg_device::device_add_mconfig)
+ MCFG_SCREEN_ADD_MONOCHROME(SCREEN_TAG, RASTER, rgb_t::green())
+ MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
+ MCFG_SCREEN_REFRESH_RATE(50)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate
+ MCFG_SCREEN_SIZE(1280, 800)
+ MCFG_SCREEN_VISIBLE_AREA(0, 1280-1, 0, 800-1)
+ MCFG_SCREEN_UPDATE_DEVICE(UPD7220_TAG, upd7220_device, screen_update)
UPD7220(config, m_crtc, 2252500*2); // unknown clock
m_crtc->set_addrmap(0, &compis_uhrg_device::uhrg_map);
- m_crtc->set_display_pixels(FUNC(compis_uhrg_device::display_pixels));
+ m_crtc->set_display_pixels_callback(FUNC(compis_uhrg_device::display_pixels), this);
m_crtc->set_screen(SCREEN_TAG);
PALETTE(config, m_palette, palette_device::MONOCHROME);
-}
+MACHINE_CONFIG_END
//**************************************************************************
@@ -165,12 +163,12 @@ void compis_hrg_device::device_reset()
// pcs6_6_r -
//-------------------------------------------------
-uint8_t compis_hrg_device::pcs6_6_r(offs_t offset)
+uint8_t compis_hrg_device::pcs6_6_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
if (offset < 2)
- data = m_crtc->read(offset & 0x01);
+ data = m_crtc->read(space, offset & 0x01);
else
// monochrome only, hblank? vblank?
if(offset == 2)
@@ -202,10 +200,10 @@ uint8_t compis_hrg_device::pcs6_6_r(offs_t offset)
// pcs6_6_w -
//-------------------------------------------------
-void compis_hrg_device::pcs6_6_w(offs_t offset, uint8_t data)
+void compis_hrg_device::pcs6_6_w(address_space &space, offs_t offset, uint8_t data)
{
//logerror("%s PCS 6:6 write %04x : %02x\n", machine().describe_context(), offset, data);
// 0x336 is likely the color plane register
- if (offset < 2) m_crtc->write(offset & 0x01, data);
+ if (offset < 2) m_crtc->write(space, offset & 0x01, data);
}
diff --git a/src/devices/bus/compis/hrg.h b/src/devices/bus/compis/hrg.h
index 98ef784df14..c48830be10c 100644
--- a/src/devices/bus/compis/hrg.h
+++ b/src/devices/bus/compis/hrg.h
@@ -41,8 +41,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_compis_graphics_card_interface overrides
- virtual uint8_t pcs6_6_r(offs_t offset) override;
- virtual void pcs6_6_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t pcs6_6_r(address_space &space, offs_t offset) override;
+ virtual void pcs6_6_w(address_space &space, offs_t offset, uint8_t data) override;
required_device<upd7220_device> m_crtc;
required_device<palette_device> m_palette;
diff --git a/src/devices/bus/compucolor/floppy.cpp b/src/devices/bus/compucolor/floppy.cpp
index fbe7912f6b6..f454a4f092a 100644
--- a/src/devices/bus/compucolor/floppy.cpp
+++ b/src/devices/bus/compucolor/floppy.cpp
@@ -52,10 +52,9 @@ static void compucolor_floppies(device_slot_interface &device)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void compucolor_floppy_device::device_add_mconfig(machine_config &config)
-{
- FLOPPY_CONNECTOR(config, m_floppy, compucolor_floppies, "525sssd", compucolor_floppy_device::floppy_formats);
-}
+MACHINE_CONFIG_START(compucolor_floppy_device::device_add_mconfig)
+ MCFG_FLOPPY_DRIVE_ADD_FIXED("floppy", compucolor_floppies, "525sssd", compucolor_floppy_device::floppy_formats)
+MACHINE_CONFIG_END
@@ -90,7 +89,7 @@ compucolor_floppy_port_device::compucolor_floppy_port_device(const machine_confi
compucolor_floppy_device::compucolor_floppy_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, COMPUCOLOR_FLOPPY, tag, owner, clock)
, device_compucolor_floppy_port_interface(mconfig, *this)
- , m_floppy(*this, "floppy")
+ , m_floppy(*this, "floppy:525sssd")
, m_rw(1)
, m_stp(0)
, m_sel(1)
@@ -184,23 +183,19 @@ void compucolor_floppy_device::stepper_w(uint8_t data)
{
if (!m_sel)
{
- floppy_image_device *floppy = m_floppy->get_device();
- if (floppy == nullptr)
- return;
-
if ((m_stp == 1 && data == 4) || (m_stp == 2 && data == 1) || (m_stp == 4 && data == 2))
{
// step in
- floppy->dir_w(1);
- floppy->stp_w(0);
- floppy->stp_w(1);
+ m_floppy->dir_w(1);
+ m_floppy->stp_w(0);
+ m_floppy->stp_w(1);
}
else if ((m_stp == 1 && data == 2) || (m_stp == 2 && data == 4) || (m_stp == 4 && data == 1))
{
// step out
- floppy->dir_w(0);
- floppy->stp_w(0);
- floppy->stp_w(1);
+ m_floppy->dir_w(0);
+ m_floppy->stp_w(0);
+ m_floppy->stp_w(1);
}
}
@@ -214,9 +209,7 @@ void compucolor_floppy_device::stepper_w(uint8_t data)
void compucolor_floppy_device::select_w(int state)
{
- floppy_image_device *floppy = m_floppy->get_device();
- if (floppy != nullptr)
- floppy->mon_w(state);
+ m_floppy->mon_w(state);
if (!m_sel && state)
{
@@ -233,10 +226,8 @@ void compucolor_floppy_device::select_w(int state)
bool compucolor_floppy_device::read_bit()
{
- floppy_image_device *floppy = m_floppy->get_device();
-
attotime when = machine().time();
- attotime edge = (floppy == nullptr) ? attotime::never : floppy->get_next_transition(when);
+ attotime edge = m_floppy->get_next_transition(when);
attotime next = when + m_period;
return (edge.is_never() || edge >= next) ? 0 : 1;
diff --git a/src/devices/bus/compucolor/floppy.h b/src/devices/bus/compucolor/floppy.h
index a4e476eb152..63e9c78782a 100644
--- a/src/devices/bus/compucolor/floppy.h
+++ b/src/devices/bus/compucolor/floppy.h
@@ -91,7 +91,7 @@ protected:
private:
DECLARE_FLOPPY_FORMATS( floppy_formats );
- required_device<floppy_connector> m_floppy;
+ required_device<floppy_image_device> m_floppy;
bool read_bit();
void write_bit(bool bit);
diff --git a/src/devices/bus/comx35/clm.cpp b/src/devices/bus/comx35/clm.cpp
index 745606875f0..333566eda1a 100644
--- a/src/devices/bus/comx35/clm.cpp
+++ b/src/devices/bus/comx35/clm.cpp
@@ -137,16 +137,15 @@ GFXDECODE_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void comx_clm_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, MC6845_SCREEN_TAG, SCREEN_TYPE_RASTER, rgb_t::white()));
- screen.set_screen_update(MC6845_TAG, FUNC(mc6845_device::screen_update));
- screen.set_size(80*8, 24*8);
- screen.set_visarea(0, 80*8-1, 0, 24*8-1);
- screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500));
- screen.set_refresh_hz(50);
-
- GFXDECODE(config, "gfxdecode", m_palette, gfx_comx_clm);
+MACHINE_CONFIG_START(comx_clm_device::device_add_mconfig)
+ MCFG_SCREEN_ADD_MONOCHROME(MC6845_SCREEN_TAG, RASTER, rgb_t::white())
+ MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update)
+ MCFG_SCREEN_SIZE(80*8, 24*8)
+ MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*8-1)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
+ MCFG_SCREEN_REFRESH_RATE(50)
+
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_comx_clm)
PALETTE(config, m_palette, palette_device::MONOCHROME);
MC6845(config, m_crtc, XTAL(14'318'181)/7);
@@ -154,7 +153,7 @@ void comx_clm_device::device_add_mconfig(machine_config &config)
m_crtc->set_show_border_area(true);
m_crtc->set_char_width(8);
m_crtc->set_update_row_callback(FUNC(comx_clm_device::crtc_update_row), this);
-}
+MACHINE_CONFIG_END
//**************************************************************************
@@ -215,7 +214,7 @@ int comx_clm_device::comx_ef4_r()
// comx_mrd_r - memory read
//-------------------------------------------------
-uint8_t comx_clm_device::comx_mrd_r(offs_t offset, int *extrom)
+uint8_t comx_clm_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
{
uint8_t data = 0xff;
@@ -229,7 +228,7 @@ uint8_t comx_clm_device::comx_mrd_r(offs_t offset, int *extrom)
}
else if (offset == 0xd801)
{
- data = m_crtc->register_r();
+ data = m_crtc->register_r(space, 0);
}
return data;
@@ -240,7 +239,7 @@ uint8_t comx_clm_device::comx_mrd_r(offs_t offset, int *extrom)
// comx_mwr_w - memory write
//-------------------------------------------------
-void comx_clm_device::comx_mwr_w(offs_t offset, uint8_t data)
+void comx_clm_device::comx_mwr_w(address_space &space, offs_t offset, uint8_t data)
{
if (offset >= 0xd000 && offset < 0xd800)
{
@@ -248,10 +247,10 @@ void comx_clm_device::comx_mwr_w(offs_t offset, uint8_t data)
}
else if (offset == 0xd800)
{
- m_crtc->address_w(data);
+ m_crtc->address_w(space, 0, data);
}
else if (offset == 0xd801)
{
- m_crtc->register_w(data);
+ m_crtc->register_w(space, 0, data);
}
}
diff --git a/src/devices/bus/comx35/clm.h b/src/devices/bus/comx35/clm.h
index 9c4845cbbe0..0784ae7bab2 100644
--- a/src/devices/bus/comx35/clm.h
+++ b/src/devices/bus/comx35/clm.h
@@ -42,8 +42,8 @@ protected:
// device_comx_expansion_card_interface overrides
virtual int comx_ef4_r() override;
- virtual uint8_t comx_mrd_r(offs_t offset, int *extrom) override;
- virtual void comx_mwr_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t comx_mrd_r(address_space &space, offs_t offset, int *extrom) override;
+ virtual void comx_mwr_w(address_space &space, offs_t offset, uint8_t data) override;
private:
MC6845_UPDATE_ROW( crtc_update_row );
diff --git a/src/devices/bus/comx35/eprom.cpp b/src/devices/bus/comx35/eprom.cpp
index 0267d7c5b62..5fda7492dd5 100644
--- a/src/devices/bus/comx35/eprom.cpp
+++ b/src/devices/bus/comx35/eprom.cpp
@@ -91,7 +91,7 @@ void comx_epr_device::device_reset()
// comx_mrd_r - memory read
//-------------------------------------------------
-uint8_t comx_epr_device::comx_mrd_r(offs_t offset, int *extrom)
+uint8_t comx_epr_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
{
uint8_t data = 0;
@@ -113,7 +113,7 @@ uint8_t comx_epr_device::comx_mrd_r(offs_t offset, int *extrom)
// comx_io_w - I/O write
//-------------------------------------------------
-void comx_epr_device::comx_io_w(offs_t offset, uint8_t data)
+void comx_epr_device::comx_io_w(address_space &space, offs_t offset, uint8_t data)
{
if (offset == 1)
{
diff --git a/src/devices/bus/comx35/eprom.h b/src/devices/bus/comx35/eprom.h
index 90f57e52d3d..c6489dfa774 100644
--- a/src/devices/bus/comx35/eprom.h
+++ b/src/devices/bus/comx35/eprom.h
@@ -37,8 +37,8 @@ protected:
virtual void device_reset() override;
// device_comx_expansion_card_interface overrides
- virtual uint8_t comx_mrd_r(offs_t offset, int *extrom) override;
- virtual void comx_io_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t comx_mrd_r(address_space &space, offs_t offset, int *extrom) override;
+ virtual void comx_io_w(address_space &space, offs_t offset, uint8_t data) override;
private:
required_memory_region m_rom;
diff --git a/src/devices/bus/comx35/exp.cpp b/src/devices/bus/comx35/exp.cpp
index 75036fb6ea8..eb5917dccbf 100644
--- a/src/devices/bus/comx35/exp.cpp
+++ b/src/devices/bus/comx35/exp.cpp
@@ -68,12 +68,12 @@ void comx_expansion_slot_device::device_start()
// mrd_r - memory read
//-------------------------------------------------
-uint8_t comx_expansion_slot_device::mrd_r(offs_t offset, int *extrom)
+uint8_t comx_expansion_slot_device::mrd_r(address_space &space, offs_t offset, int *extrom)
{
uint8_t data = 0;
if (m_card != nullptr)
- data = m_card->comx_mrd_r(offset, extrom);
+ data = m_card->comx_mrd_r(space, offset, extrom);
return data;
}
@@ -83,10 +83,10 @@ uint8_t comx_expansion_slot_device::mrd_r(offs_t offset, int *extrom)
// mwr_w - memory write
//-------------------------------------------------
-void comx_expansion_slot_device::mwr_w(offs_t offset, uint8_t data)
+void comx_expansion_slot_device::mwr_w(address_space &space, offs_t offset, uint8_t data)
{
if (m_card != nullptr)
- m_card->comx_mwr_w(offset, data);
+ m_card->comx_mwr_w(space, offset, data);
}
@@ -94,12 +94,12 @@ void comx_expansion_slot_device::mwr_w(offs_t offset, uint8_t data)
// io_r - I/O read
//-------------------------------------------------
-uint8_t comx_expansion_slot_device::io_r(offs_t offset)
+uint8_t comx_expansion_slot_device::io_r(address_space &space, offs_t offset)
{
uint8_t data = 0;
if (m_card != nullptr)
- data = m_card->comx_io_r(offset);
+ data = m_card->comx_io_r(space, offset);
return data;
}
@@ -109,10 +109,10 @@ uint8_t comx_expansion_slot_device::io_r(offs_t offset)
// sout_w - I/O write
//-------------------------------------------------
-void comx_expansion_slot_device::io_w(offs_t offset, uint8_t data)
+void comx_expansion_slot_device::io_w(address_space &space, offs_t offset, uint8_t data)
{
if (m_card != nullptr)
- m_card->comx_io_w(offset, data);
+ m_card->comx_io_w(space, offset, data);
}
diff --git a/src/devices/bus/comx35/exp.h b/src/devices/bus/comx35/exp.h
index dea67184e06..0629db0a1ac 100644
--- a/src/devices/bus/comx35/exp.h
+++ b/src/devices/bus/comx35/exp.h
@@ -62,11 +62,11 @@ public:
template <class Object> devcb_base &set_irq_wr_callback(Object &&cb) { return m_write_irq.set_callback(std::forward<Object>(cb)); }
auto irq_callback() { return m_write_irq.bind(); }
- uint8_t mrd_r(offs_t offset, int *extrom);
- void mwr_w(offs_t offset, uint8_t data);
+ uint8_t mrd_r(address_space &space, offs_t offset, int *extrom);
+ void mwr_w(address_space &space, offs_t offset, uint8_t data);
- uint8_t io_r(offs_t offset);
- void io_w(offs_t offset, uint8_t data);
+ uint8_t io_r(address_space &space, offs_t offset);
+ void io_w(address_space &space, offs_t offset, uint8_t data);
DECLARE_READ_LINE_MEMBER(ef4_r);
@@ -107,12 +107,12 @@ protected:
virtual void comx_tpb_w(int state) { }
// memory access
- virtual uint8_t comx_mrd_r(offs_t offset, int *extrom) { return 0; }
- virtual void comx_mwr_w(offs_t offset, uint8_t data) { }
+ virtual uint8_t comx_mrd_r(address_space &space, offs_t offset, int *extrom) { return 0; }
+ virtual void comx_mwr_w(address_space &space, offs_t offset, uint8_t data) { }
// I/O access
- virtual uint8_t comx_io_r(offs_t offset) { return 0; }
- virtual void comx_io_w(offs_t offset, uint8_t data) { }
+ virtual uint8_t comx_io_r(address_space &space, offs_t offset) { return 0; }
+ virtual void comx_io_w(address_space &space, offs_t offset, uint8_t data) { }
comx_expansion_slot_device *m_slot;
diff --git a/src/devices/bus/comx35/expbox.cpp b/src/devices/bus/comx35/expbox.cpp
index 65c945274f1..f7c693d4ecf 100644
--- a/src/devices/bus/comx35/expbox.cpp
+++ b/src/devices/bus/comx35/expbox.cpp
@@ -200,7 +200,7 @@ void comx_eb_device::comx_q_w(int state)
// comx_mrd_r - memory read
//-------------------------------------------------
-uint8_t comx_eb_device::comx_mrd_r(offs_t offset, int *extrom)
+uint8_t comx_eb_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
{
uint8_t data = 0;
@@ -219,7 +219,7 @@ uint8_t comx_eb_device::comx_mrd_r(offs_t offset, int *extrom)
{
if (BIT(m_select, slot) && m_expansion_slot[slot] != nullptr)
{
- data |= m_expansion_slot[slot]->mrd_r(offset, extrom);
+ data |= m_expansion_slot[slot]->mrd_r(space, offset, extrom);
}
}
}
@@ -232,13 +232,13 @@ uint8_t comx_eb_device::comx_mrd_r(offs_t offset, int *extrom)
// comx_mwr_w - memory write
//-------------------------------------------------
-void comx_eb_device::comx_mwr_w(offs_t offset, uint8_t data)
+void comx_eb_device::comx_mwr_w(address_space &space, offs_t offset, uint8_t data)
{
for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
{
if (BIT(m_select, slot) && m_expansion_slot[slot] != nullptr)
{
- m_expansion_slot[slot]->mwr_w(offset, data);
+ m_expansion_slot[slot]->mwr_w(space, offset, data);
}
}
}
@@ -248,7 +248,7 @@ void comx_eb_device::comx_mwr_w(offs_t offset, uint8_t data)
// comx_io_r - I/O read
//-------------------------------------------------
-uint8_t comx_eb_device::comx_io_r(offs_t offset)
+uint8_t comx_eb_device::comx_io_r(address_space &space, offs_t offset)
{
uint8_t data = 0;
@@ -256,7 +256,7 @@ uint8_t comx_eb_device::comx_io_r(offs_t offset)
{
if (BIT(m_select, slot) && m_expansion_slot[slot] != nullptr)
{
- data |= m_expansion_slot[slot]->io_r(offset);
+ data |= m_expansion_slot[slot]->io_r(space, offset);
}
}
@@ -268,7 +268,7 @@ uint8_t comx_eb_device::comx_io_r(offs_t offset)
// comx_io_w - I/O write
//-------------------------------------------------
-void comx_eb_device::comx_io_w(offs_t offset, uint8_t data)
+void comx_eb_device::comx_io_w(address_space &space, offs_t offset, uint8_t data)
{
if (offset == 1 && !(BIT(data, 0)))
{
@@ -287,7 +287,7 @@ void comx_eb_device::comx_io_w(offs_t offset, uint8_t data)
{
if (BIT(m_select, slot) && m_expansion_slot[slot] != nullptr)
{
- m_expansion_slot[slot]->io_w(offset, data);
+ m_expansion_slot[slot]->io_w(space, offset, data);
}
}
}
diff --git a/src/devices/bus/comx35/expbox.h b/src/devices/bus/comx35/expbox.h
index c4c89b4f2bc..4c806a79b92 100644
--- a/src/devices/bus/comx35/expbox.h
+++ b/src/devices/bus/comx35/expbox.h
@@ -48,10 +48,10 @@ protected:
// device_comx_expansion_card_interface overrides
virtual int comx_ef4_r() override;
virtual void comx_q_w(int state) override;
- virtual uint8_t comx_mrd_r(offs_t offset, int *extrom) override;
- virtual void comx_mwr_w(offs_t offset, uint8_t data) override;
- virtual uint8_t comx_io_r(offs_t offset) override;
- virtual void comx_io_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t comx_mrd_r(address_space &space, offs_t offset, int *extrom) override;
+ virtual void comx_mwr_w(address_space &space, offs_t offset, uint8_t data) override;
+ virtual uint8_t comx_io_r(address_space &space, offs_t offset) override;
+ virtual void comx_io_w(address_space &space, offs_t offset, uint8_t data) override;
void set_irq() { m_slot->irq_w(m_irq[0] || m_irq[1] || m_irq[2] || m_irq[3]); }
diff --git a/src/devices/bus/comx35/fdc.cpp b/src/devices/bus/comx35/fdc.cpp
index da1b6dcc028..27246c37333 100644
--- a/src/devices/bus/comx35/fdc.cpp
+++ b/src/devices/bus/comx35/fdc.cpp
@@ -188,7 +188,7 @@ void comx_fd_device::comx_q_w(int state)
// comx_mrd_r - memory read
//-------------------------------------------------
-uint8_t comx_fd_device::comx_mrd_r(offs_t offset, int *extrom)
+uint8_t comx_fd_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
{
uint8_t data = 0xff;
@@ -210,7 +210,7 @@ uint8_t comx_fd_device::comx_mrd_r(offs_t offset, int *extrom)
// comx_io_r - I/O read
//-------------------------------------------------
-uint8_t comx_fd_device::comx_io_r(offs_t offset)
+uint8_t comx_fd_device::comx_io_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
@@ -235,7 +235,7 @@ uint8_t comx_fd_device::comx_io_r(offs_t offset)
// comx_io_w - I/O write
//-------------------------------------------------
-void comx_fd_device::comx_io_w(offs_t offset, uint8_t data)
+void comx_fd_device::comx_io_w(address_space &space, offs_t offset, uint8_t data)
{
if (offset == 2)
{
diff --git a/src/devices/bus/comx35/fdc.h b/src/devices/bus/comx35/fdc.h
index 45617bb8580..ad682e97718 100644
--- a/src/devices/bus/comx35/fdc.h
+++ b/src/devices/bus/comx35/fdc.h
@@ -43,9 +43,9 @@ protected:
// device_comx_expansion_card_interface overrides
virtual int comx_ef4_r() override;
virtual void comx_q_w(int state) override;
- virtual uint8_t comx_mrd_r(offs_t offset, int *extrom) override;
- virtual uint8_t comx_io_r(offs_t offset) override;
- virtual void comx_io_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t comx_mrd_r(address_space &space, offs_t offset, int *extrom) override;
+ virtual uint8_t comx_io_r(address_space &space, offs_t offset) override;
+ virtual void comx_io_w(address_space &space, offs_t offset, uint8_t data) override;
private:
DECLARE_FLOPPY_FORMATS( floppy_formats );
diff --git a/src/devices/bus/comx35/joycard.cpp b/src/devices/bus/comx35/joycard.cpp
index e76f20a5be8..4c6e46ff06e 100644
--- a/src/devices/bus/comx35/joycard.cpp
+++ b/src/devices/bus/comx35/joycard.cpp
@@ -98,7 +98,7 @@ void comx_joy_device::device_reset()
// comx_mrd_r - I/O read
//-------------------------------------------------
-uint8_t comx_joy_device::comx_io_r(offs_t offset)
+uint8_t comx_joy_device::comx_io_r(address_space &space, offs_t offset)
{
uint8_t data = 0;
diff --git a/src/devices/bus/comx35/joycard.h b/src/devices/bus/comx35/joycard.h
index 92c41431961..e2d6bb40151 100644
--- a/src/devices/bus/comx35/joycard.h
+++ b/src/devices/bus/comx35/joycard.h
@@ -37,7 +37,7 @@ protected:
virtual void device_reset() override;
// device_comx_expansion_card_interface overrides
- virtual uint8_t comx_io_r(offs_t offset) override;
+ virtual uint8_t comx_io_r(address_space &space, offs_t offset) override;
private:
required_ioport m_joy1;
diff --git a/src/devices/bus/comx35/printer.cpp b/src/devices/bus/comx35/printer.cpp
index 6858d687c0b..24a50e7ed53 100644
--- a/src/devices/bus/comx35/printer.cpp
+++ b/src/devices/bus/comx35/printer.cpp
@@ -55,19 +55,16 @@ const tiny_rom_entry *comx_prn_device::device_rom_region() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void comx_prn_device::device_add_mconfig(machine_config &config)
-{
- CENTRONICS(config, m_centronics, centronics_devices, "printer");
- m_centronics->ack_handler().set(m_cent_status_in, FUNC(input_buffer_device::write_bit0));
- m_centronics->busy_handler().set(m_cent_status_in, FUNC(input_buffer_device::write_bit1));
- m_centronics->perror_handler().set(m_cent_status_in, FUNC(input_buffer_device::write_bit2));
- m_centronics->select_handler().set(m_cent_status_in, FUNC(input_buffer_device::write_bit3));
-
- OUTPUT_LATCH(config, m_cent_data_out);
- m_centronics->set_output_latch(*m_cent_data_out);
+MACHINE_CONFIG_START(comx_prn_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer")
+ MCFG_CENTRONICS_ACK_HANDLER(WRITELINE("cent_status_in", input_buffer_device, write_bit0))
+ MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE("cent_status_in", input_buffer_device, write_bit1))
+ MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE("cent_status_in", input_buffer_device, write_bit2))
+ MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE("cent_status_in", input_buffer_device, write_bit3))
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
- INPUT_BUFFER(config, m_cent_status_in);
-}
+ MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0)
+MACHINE_CONFIG_END
@@ -112,7 +109,7 @@ void comx_prn_device::device_reset()
// comx_mrd_r - memory read
//-------------------------------------------------
-uint8_t comx_prn_device::comx_mrd_r(offs_t offset, int *extrom)
+uint8_t comx_prn_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
{
uint8_t data = 0;
@@ -129,7 +126,7 @@ uint8_t comx_prn_device::comx_mrd_r(offs_t offset, int *extrom)
// comx_io_r - I/O read
//-------------------------------------------------
-uint8_t comx_prn_device::comx_io_r(offs_t offset)
+uint8_t comx_prn_device::comx_io_r(address_space &space, offs_t offset)
{
/*
Parallel:
@@ -168,7 +165,7 @@ uint8_t comx_prn_device::comx_io_r(offs_t offset)
// comx_io_w - I/O write
//-------------------------------------------------
-void comx_prn_device::comx_io_w(offs_t offset, uint8_t data)
+void comx_prn_device::comx_io_w(address_space &space, offs_t offset, uint8_t data)
{
/*
Parallel:
diff --git a/src/devices/bus/comx35/printer.h b/src/devices/bus/comx35/printer.h
index 1ffa3f66046..dcfd27a7cd1 100644
--- a/src/devices/bus/comx35/printer.h
+++ b/src/devices/bus/comx35/printer.h
@@ -39,9 +39,9 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_comx_expansion_card_interface overrides
- virtual uint8_t comx_mrd_r(offs_t offset, int *extrom) override;
- virtual uint8_t comx_io_r(offs_t offset) override;
- virtual void comx_io_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t comx_mrd_r(address_space &space, offs_t offset, int *extrom) override;
+ virtual uint8_t comx_io_r(address_space &space, offs_t offset) override;
+ virtual void comx_io_w(address_space &space, offs_t offset, uint8_t data) override;
private:
required_device<centronics_device> m_centronics;
diff --git a/src/devices/bus/comx35/ram.cpp b/src/devices/bus/comx35/ram.cpp
index b468b6366ff..c09ef729225 100644
--- a/src/devices/bus/comx35/ram.cpp
+++ b/src/devices/bus/comx35/ram.cpp
@@ -66,7 +66,7 @@ void comx_ram_device::device_reset()
// comx_mrd_r - memory read
//-------------------------------------------------
-uint8_t comx_ram_device::comx_mrd_r(offs_t offset, int *extrom)
+uint8_t comx_ram_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
{
uint8_t data = 0;
@@ -83,7 +83,7 @@ uint8_t comx_ram_device::comx_mrd_r(offs_t offset, int *extrom)
// comx_mwr_w - memory write
//-------------------------------------------------
-void comx_ram_device::comx_mwr_w(offs_t offset, uint8_t data)
+void comx_ram_device::comx_mwr_w(address_space &space, offs_t offset, uint8_t data)
{
if (offset >= 0xc000 && offset < 0xd000)
{
@@ -96,7 +96,7 @@ void comx_ram_device::comx_mwr_w(offs_t offset, uint8_t data)
// comx_io_w - I/O write
//-------------------------------------------------
-void comx_ram_device::comx_io_w(offs_t offset, uint8_t data)
+void comx_ram_device::comx_io_w(address_space &space, offs_t offset, uint8_t data)
{
if (offset == 1)
{
diff --git a/src/devices/bus/comx35/ram.h b/src/devices/bus/comx35/ram.h
index 3a75e208eb6..251e47e2097 100644
--- a/src/devices/bus/comx35/ram.h
+++ b/src/devices/bus/comx35/ram.h
@@ -34,9 +34,9 @@ protected:
virtual void device_reset() override;
// device_comx_expansion_card_interface overrides
- virtual uint8_t comx_mrd_r(offs_t offset, int *extrom) override;
- virtual void comx_mwr_w(offs_t offset, uint8_t data) override;
- virtual void comx_io_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t comx_mrd_r(address_space &space, offs_t offset, int *extrom) override;
+ virtual void comx_mwr_w(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void comx_io_w(address_space &space, offs_t offset, uint8_t data) override;
private:
optional_shared_ptr<uint8_t> m_ram;
diff --git a/src/devices/bus/comx35/thermal.cpp b/src/devices/bus/comx35/thermal.cpp
index badd1beb8c1..e1d4f0ed8d3 100644
--- a/src/devices/bus/comx35/thermal.cpp
+++ b/src/devices/bus/comx35/thermal.cpp
@@ -82,7 +82,7 @@ void comx_thm_device::device_reset()
// comx_mrd_r - memory read
//-------------------------------------------------
-uint8_t comx_thm_device::comx_mrd_r(offs_t offset, int *extrom)
+uint8_t comx_thm_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
{
uint8_t data = 0;
@@ -99,7 +99,7 @@ uint8_t comx_thm_device::comx_mrd_r(offs_t offset, int *extrom)
// comx_io_r - I/O read
//-------------------------------------------------
-uint8_t comx_thm_device::comx_io_r(offs_t offset)
+uint8_t comx_thm_device::comx_io_r(address_space &space, offs_t offset)
{
/*
INP 2 is used for the printer status, where:
@@ -116,7 +116,7 @@ uint8_t comx_thm_device::comx_io_r(offs_t offset)
// comx_io_w - I/O write
//-------------------------------------------------
-void comx_thm_device::comx_io_w(offs_t offset, uint8_t data)
+void comx_thm_device::comx_io_w(address_space &space, offs_t offset, uint8_t data)
{
/*
OUT 2 is used to control the thermal printer where:
diff --git a/src/devices/bus/comx35/thermal.h b/src/devices/bus/comx35/thermal.h
index 645f6bf0213..feb92f7bc45 100644
--- a/src/devices/bus/comx35/thermal.h
+++ b/src/devices/bus/comx35/thermal.h
@@ -37,9 +37,9 @@ protected:
virtual void device_reset() override;
// device_comx_expansion_card_interface overrides
- virtual uint8_t comx_mrd_r(offs_t offset, int *extrom) override;
- virtual uint8_t comx_io_r(offs_t offset) override;
- virtual void comx_io_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t comx_mrd_r(address_space &space, offs_t offset, int *extrom) override;
+ virtual uint8_t comx_io_r(address_space &space, offs_t offset) override;
+ virtual void comx_io_w(address_space &space, offs_t offset, uint8_t data) override;
private:
required_memory_region m_rom;
diff --git a/src/devices/bus/cpc/amdrum.cpp b/src/devices/bus/cpc/amdrum.cpp
index 587577edf52..b0c0610b607 100644
--- a/src/devices/bus/cpc/amdrum.cpp
+++ b/src/devices/bus/cpc/amdrum.cpp
@@ -20,15 +20,13 @@
DEFINE_DEVICE_TYPE(CPC_AMDRUM, cpc_amdrum_device, "cpc_amdrum", "Amdrum")
-void cpc_amdrum_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(cpc_amdrum_device::device_add_mconfig)
SPEAKER(config, "speaker").front_center();
- ZN428E(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5);
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
+ MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.5) // unknown DAC
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT)
// no pass-through
-}
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/cpc/cpc_rom.cpp b/src/devices/bus/cpc/cpc_rom.cpp
index 69bd7f80035..a3fedd575bc 100644
--- a/src/devices/bus/cpc/cpc_rom.cpp
+++ b/src/devices/bus/cpc/cpc_rom.cpp
@@ -18,23 +18,22 @@ void cpc_exp_cards(device_slot_interface &device);
//**************************************************************************
// device machine config
-void cpc_rom_device::device_add_mconfig(machine_config &config)
-{
- CPC_ROMSLOT(config, m_rom[0], 0);
- CPC_ROMSLOT(config, m_rom[1], 0);
- CPC_ROMSLOT(config, m_rom[2], 0);
- CPC_ROMSLOT(config, m_rom[3], 0);
- CPC_ROMSLOT(config, m_rom[4], 0);
- CPC_ROMSLOT(config, m_rom[5], 0);
- CPC_ROMSLOT(config, m_rom[6], 0);
- CPC_ROMSLOT(config, m_rom[7], 0);
+MACHINE_CONFIG_START(cpc_rom_device::device_add_mconfig)
+ MCFG_CPC_ROMSLOT_ADD("rom1")
+ MCFG_CPC_ROMSLOT_ADD("rom2")
+ MCFG_CPC_ROMSLOT_ADD("rom3")
+ MCFG_CPC_ROMSLOT_ADD("rom4")
+ MCFG_CPC_ROMSLOT_ADD("rom5")
+ MCFG_CPC_ROMSLOT_ADD("rom6")
+ MCFG_CPC_ROMSLOT_ADD("rom7")
+ MCFG_CPC_ROMSLOT_ADD("rom8")
// pass-through
cpc_expansion_slot_device &exp(CPC_EXPANSION_SLOT(config, "exp", DERIVED_CLOCK(1, 1), cpc_exp_cards, nullptr));
exp.irq_callback().set(DEVICE_SELF_OWNER, FUNC(cpc_expansion_slot_device::irq_w));
exp.nmi_callback().set(DEVICE_SELF_OWNER, FUNC(cpc_expansion_slot_device::nmi_w));
exp.romdis_callback().set(DEVICE_SELF_OWNER, FUNC(cpc_expansion_slot_device::romdis_w)); // ROMDIS
-}
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/cpc/cpc_rom.h b/src/devices/bus/cpc/cpc_rom.h
index 67e88cf6137..0128dc79337 100644
--- a/src/devices/bus/cpc/cpc_rom.h
+++ b/src/devices/bus/cpc/cpc_rom.h
@@ -53,6 +53,9 @@ private:
DECLARE_DEVICE_TYPE(CPC_ROMSLOT, cpc_rom_image_device)
+#define MCFG_CPC_ROMSLOT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, CPC_ROMSLOT, 0)
+
/*** ROM box device ***/
class cpc_rom_device : public device_t,
diff --git a/src/devices/bus/cpc/cpcexp.cpp b/src/devices/bus/cpc/cpcexp.cpp
index 3f9f04e89ea..ab92c31a4df 100644
--- a/src/devices/bus/cpc/cpcexp.cpp
+++ b/src/devices/bus/cpc/cpcexp.cpp
@@ -83,7 +83,7 @@ void cpc_expansion_slot_device::device_start()
void cpc_expansion_slot_device::device_config_complete()
{
// for passthrough connectors, use the parent slot's CPU tag
- if ((m_cpu.finder_tag() == finder_base::DUMMY_TAG) && (dynamic_cast<device_cpc_expansion_card_interface *>(owner()) != nullptr))
+ if (strcmp(m_cpu.finder_tag(), finder_base::DUMMY_TAG) == 0 && dynamic_cast<device_cpc_expansion_card_interface *>(owner()) != nullptr)
{
auto parent = dynamic_cast<cpc_expansion_slot_device *>(owner()->owner());
if (parent != nullptr)
diff --git a/src/devices/bus/cpc/ddi1.cpp b/src/devices/bus/cpc/ddi1.cpp
index 76e09d36f34..0202f9374ae 100644
--- a/src/devices/bus/cpc/ddi1.cpp
+++ b/src/devices/bus/cpc/ddi1.cpp
@@ -116,7 +116,7 @@ WRITE8_MEMBER(cpc_ddi1_device::fdc_w)
switch(offset)
{
case 0x01:
- m_fdc->fifo_w(data);
+ m_fdc->fifo_w(space, 0,data);
break;
}
}
@@ -128,10 +128,10 @@ READ8_MEMBER(cpc_ddi1_device::fdc_r)
switch(offset)
{
case 0x00:
- data = m_fdc->msr_r();
+ data = m_fdc->msr_r(space, 0);
break;
case 0x01:
- data = m_fdc->fifo_r();
+ data = m_fdc->fifo_r(space, 0);
break;
}
return data;
diff --git a/src/devices/bus/cpc/doubler.cpp b/src/devices/bus/cpc/doubler.cpp
index e9ed2e5b5f4..ce89c0819dd 100644
--- a/src/devices/bus/cpc/doubler.cpp
+++ b/src/devices/bus/cpc/doubler.cpp
@@ -16,15 +16,14 @@
DEFINE_DEVICE_TYPE(CPC_DOUBLER, cpc_doubler_device, "cpc_doubler", "Draysoft Doubler")
-void cpc_doubler_device::device_add_mconfig(machine_config &config)
-{
- CASSETTE(config, m_tape);
- m_tape->set_formats(cdt_cassette_formats);
- m_tape->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED);
- m_tape->set_interface("cpc_cass");
+MACHINE_CONFIG_START(cpc_doubler_device::device_add_mconfig)
+ MCFG_CASSETTE_ADD( "doubler_tape" )
+ MCFG_CASSETTE_FORMATS(cdt_cassette_formats)
+ MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED)
+ MCFG_CASSETTE_INTERFACE("cpc_cass")
// no pass-through seen on remake PCBs, unknown if actual hardware had a pass-through port or not
-}
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/cpc/hd20.cpp b/src/devices/bus/cpc/hd20.cpp
index c13ffca6b4b..3ad082ee90d 100644
--- a/src/devices/bus/cpc/hd20.cpp
+++ b/src/devices/bus/cpc/hd20.cpp
@@ -15,13 +15,12 @@
DEFINE_DEVICE_TYPE(CPC_HD20, cpc_hd20_device, "cpc_hd20", "Dobbertin HD20")
-void cpc_hd20_device::device_add_mconfig(machine_config &config)
-{
- ST11M_HDC(config, m_hdc,0);
- m_hdc->irq_handler().set(FUNC(cpc_hd20_device::irq_w));
- HARDDISK(config, "hdc:primary");
+MACHINE_CONFIG_START(cpc_hd20_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("hdc",ST11M_HDC,0)
+ MCFG_XTHDC_IRQ_HANDLER(WRITELINE(*this, cpc_hd20_device, irq_w))
+ MCFG_HARDDISK_ADD("hdc:primary")
// no pass-through (?)
-}
+MACHINE_CONFIG_END
ROM_START( cpc_hd20 )
diff --git a/src/devices/bus/cpc/magicsound.cpp b/src/devices/bus/cpc/magicsound.cpp
index 1a85915dca1..f1a940a72c3 100644
--- a/src/devices/bus/cpc/magicsound.cpp
+++ b/src/devices/bus/cpc/magicsound.cpp
@@ -20,8 +20,7 @@
DEFINE_DEVICE_TYPE(AL_MAGICSOUND, al_magicsound_device, "al_magicsound", "Aleste Magic Sound Board")
-void al_magicsound_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(al_magicsound_device::device_add_mconfig)
AM9517A(config, m_dmac, DERIVED_CLOCK(1, 1)); // CLK from expansion port
// According to the schematics, the TC pin (EOP on western chips) is connected to NMI on the expansion port.
// NMIs seem to occur too quickly when this is active, so either EOP is not triggered at the correct time, or
@@ -58,12 +57,11 @@ void al_magicsound_device::device_add_mconfig(machine_config &config)
m_timer2->set_clk<2>(4000000);
SPEAKER(config, "speaker").front_center();
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5); // unknown DAC
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
+ MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.5) // unknown DAC
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT)
// no pass-through(?)
-}
+MACHINE_CONFIG_END
//**************************************************************************
@@ -115,12 +113,12 @@ void al_magicsound_device::device_reset()
READ8_MEMBER(al_magicsound_device::dmac_r)
{
- return m_dmac->read(offset);
+ return m_dmac->read(space,offset);
}
WRITE8_MEMBER(al_magicsound_device::dmac_w)
{
- m_dmac->write(offset,data);
+ m_dmac->write(space,offset,data);
}
WRITE8_MEMBER(al_magicsound_device::timer_w)
diff --git a/src/devices/bus/cpc/playcity.cpp b/src/devices/bus/cpc/playcity.cpp
index 1e6f3b0cfa6..f9d225ef7b6 100644
--- a/src/devices/bus/cpc/playcity.cpp
+++ b/src/devices/bus/cpc/playcity.cpp
@@ -99,32 +99,32 @@ WRITE8_MEMBER(cpc_playcity_device::ctc_w)
WRITE8_MEMBER(cpc_playcity_device::ymz1_address_w)
{
- m_ymz1->address_w(data);
+ m_ymz1->address_w(space,offset,data);
}
WRITE8_MEMBER(cpc_playcity_device::ymz2_address_w)
{
- m_ymz2->address_w(data);
+ m_ymz2->address_w(space,offset,data);
}
WRITE8_MEMBER(cpc_playcity_device::ymz1_data_w)
{
- m_ymz1->data_w(data);
+ m_ymz1->data_w(space,offset,data);
}
WRITE8_MEMBER(cpc_playcity_device::ymz2_data_w)
{
- m_ymz2->data_w(data);
+ m_ymz2->data_w(space,offset,data);
}
READ8_MEMBER(cpc_playcity_device::ymz1_data_r)
{
- return m_ymz1->data_r();
+ return m_ymz1->data_r(space,offset);
}
READ8_MEMBER(cpc_playcity_device::ymz2_data_r)
{
- return m_ymz2->data_r();
+ return m_ymz2->data_r(space,offset);
}
void cpc_playcity_device::update_ymz_clock()
diff --git a/src/devices/bus/cpc/smartwatch.cpp b/src/devices/bus/cpc/smartwatch.cpp
index 272b7ca953e..bd039c40735 100644
--- a/src/devices/bus/cpc/smartwatch.cpp
+++ b/src/devices/bus/cpc/smartwatch.cpp
@@ -71,18 +71,15 @@ void cpc_smartwatch_device::device_reset()
READ8_MEMBER(cpc_smartwatch_device::rtc_w)
{
uint8_t* bank = (uint8_t*)m_bank->base();
- if (!machine().side_effects_disabled())
- {
- if(offset & 1)
- m_rtc->read_1();
- else
- m_rtc->read_0();
- }
+ if(offset & 1)
+ m_rtc->read_1(space,0);
+ else
+ m_rtc->read_0(space,0);
return bank[offset & 1];
}
READ8_MEMBER(cpc_smartwatch_device::rtc_r)
{
uint8_t* bank = (uint8_t*)m_bank->base();
- return ((bank[(offset & 1)+4]) & 0xfe) | (m_rtc->read_data() & 0x01);
+ return ((bank[(offset & 1)+4]) & 0xfe) | (m_rtc->read_data(space,0) & 0x01);
}
diff --git a/src/devices/bus/cpc/symbfac2.cpp b/src/devices/bus/cpc/symbfac2.cpp
index fbdb67f5085..a68ecdbd900 100644
--- a/src/devices/bus/cpc/symbfac2.cpp
+++ b/src/devices/bus/cpc/symbfac2.cpp
@@ -161,12 +161,27 @@ WRITE8_MEMBER(cpc_symbiface2_device::ide_cs1_w)
// #FD14 (read/write) read from or write into selected register
READ8_MEMBER(cpc_symbiface2_device::rtc_r)
{
- return m_rtc->read(~offset & 0x01);
+ switch(offset & 0x01)
+ {
+ case 0x00:
+ return m_rtc->read(space,1);
+ case 0x01:
+ return m_rtc->read(space,0);
+ }
+ return 0;
}
WRITE8_MEMBER(cpc_symbiface2_device::rtc_w)
{
- m_rtc->write(~offset & 0x01, data);
+ switch(offset & 0x01)
+ {
+ case 0x00:
+ m_rtc->write(space,1,data);
+ break;
+ case 0x01:
+ m_rtc->write(space,0,data);
+ break;
+ }
}
// PS/2 Mouse connector
diff --git a/src/devices/bus/dmv/dmvbus.cpp b/src/devices/bus/dmv/dmvbus.cpp
index 7ad4ae3a2bb..80cb8ae748c 100644
--- a/src/devices/bus/dmv/dmvbus.cpp
+++ b/src/devices/bus/dmv/dmvbus.cpp
@@ -201,10 +201,7 @@ dmvcart_slot_device::dmvcart_slot_device(const machine_config &mconfig, const ch
m_prog_write_cb(*this),
m_out_int_cb(*this),
m_out_irq_cb(*this),
- m_out_thold_cb(*this),
- m_memspace(*this, finder_base::DUMMY_TAG, -1),
- m_iospace(*this, finder_base::DUMMY_TAG, -1),
- m_cart(nullptr)
+ m_out_thold_cb(*this), m_cart(nullptr)
{
}
@@ -279,10 +276,10 @@ void dmvcart_slot_device::ram_write(uint8_t cas, offs_t offset, uint8_t data)
IO read
-------------------------------------------------*/
-void dmvcart_slot_device::io_read(int ifsel, offs_t offset, uint8_t &data)
+void dmvcart_slot_device::io_read(address_space &space, int ifsel, offs_t offset, uint8_t &data)
{
if (m_cart)
- m_cart->io_read(ifsel, offset, data);
+ m_cart->io_read(space, ifsel, offset, data);
}
@@ -290,10 +287,10 @@ void dmvcart_slot_device::io_read(int ifsel, offs_t offset, uint8_t &data)
IO write
-------------------------------------------------*/
-void dmvcart_slot_device::io_write(int ifsel, offs_t offset, uint8_t data)
+void dmvcart_slot_device::io_write(address_space &space, int ifsel, offs_t offset, uint8_t data)
{
if (m_cart)
- m_cart->io_write(ifsel, offset, data);
+ m_cart->io_write(space, ifsel, offset, data);
}
/*-------------------------------------------------
diff --git a/src/devices/bus/dmv/dmvbus.h b/src/devices/bus/dmv/dmvbus.h
index 22c81767151..a10eab52bc0 100644
--- a/src/devices/bus/dmv/dmvbus.h
+++ b/src/devices/bus/dmv/dmvbus.h
@@ -25,8 +25,8 @@ public:
virtual bool read(offs_t offset, uint8_t &data) { return false; }
virtual bool write(offs_t offset, uint8_t data) { return false; }
- virtual void io_read(int ifsel, offs_t offset, uint8_t &data) { }
- virtual void io_write(int ifsel, offs_t offset, uint8_t data) { }
+ virtual void io_read(address_space &space, int ifsel, offs_t offset, uint8_t &data) { }
+ virtual void io_write(address_space &space, int ifsel, offs_t offset, uint8_t data) { }
// slot 1
virtual void ram_read(uint8_t cas, offs_t offset, uint8_t &data) { }
@@ -59,25 +59,14 @@ class dmvcart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- dmvcart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : dmvcart_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
dmvcart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~dmvcart_slot_device();
- auto prog_read() { return m_prog_read_cb.bind(); }
- auto prog_write() { return m_prog_write_cb.bind(); }
- auto out_int() { return m_out_int_cb.bind(); }
- auto out_irq() { return m_out_irq_cb.bind(); }
- auto out_thold() { return m_out_thold_cb.bind(); }
- template <typename T> void set_memspace(T &&tag, int spacenum) { m_memspace.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_iospace(T &&tag, int spacenum) { m_iospace.set_tag(std::forward<T>(tag), spacenum); }
+ template <class Object> devcb_base &set_prog_read_callback(Object &&cb) { return m_prog_read_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_prog_write_callback(Object &&cb) { return m_prog_write_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_int_callback(Object &&cb) { return m_out_int_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_irq_callback(Object &&cb) { return m_out_irq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_thold_callback(Object &&cb) { return m_out_thold_cb.set_callback(std::forward<Object>(cb)); }
// device-level overrides
virtual void device_start() override;
@@ -87,8 +76,8 @@ public:
virtual bool write(offs_t offset, uint8_t data);
virtual void ram_read(uint8_t cas, offs_t offset, uint8_t &data);
virtual void ram_write(uint8_t cas, offs_t offset, uint8_t data);
- virtual void io_read(int ifsel, offs_t offset, uint8_t &data);
- virtual void io_write(int ifsel, offs_t offset, uint8_t data);
+ virtual void io_read(address_space &space, int ifsel, offs_t offset, uint8_t &data);
+ virtual void io_write(address_space &space, int ifsel, offs_t offset, uint8_t data);
virtual void hold_w(int state);
virtual void switch16_w(int state);
virtual void timint_w(int state);
@@ -109,10 +98,6 @@ public:
devcb_write_line m_out_int_cb;
devcb_write_line m_out_irq_cb;
devcb_write_line m_out_thold_cb;
-
- required_address_space m_memspace;
- required_address_space m_iospace;
-
device_dmvslot_interface* m_cart;
};
@@ -120,4 +105,22 @@ public:
// device type definition
DECLARE_DEVICE_TYPE(DMVCART_SLOT, dmvcart_slot_device)
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_DMVCART_SLOT_PROGRAM_READWRITE_CB(_read_devcb, _write_devcb) \
+ downcast<dmvcart_slot_device &>(*device).set_prog_read_callback(DEVCB_##_read_devcb); \
+ downcast<dmvcart_slot_device &>(*device).set_prog_write_callback(DEVCB_##_write_devcb);
+
+#define MCFG_DMVCART_SLOT_OUT_INT_CB(_devcb) \
+ downcast<dmvcart_slot_device &>(*device).set_out_int_callback(DEVCB_##_devcb);
+
+#define MCFG_DMVCART_SLOT_OUT_IRQ_CB(_devcb) \
+ downcast<dmvcart_slot_device &>(*device).set_out_irq_callback(DEVCB_##_devcb);
+
+#define MCFG_DMVCART_SLOT_OUT_THOLD_CB(_devcb) \
+ downcast<dmvcart_slot_device &>(*device).set_out_thold_callback(DEVCB_##_devcb);
+
#endif // MAME_BUS_DMV_DMVBUS_H
diff --git a/src/devices/bus/dmv/k210.cpp b/src/devices/bus/dmv/k210.cpp
index d73f2dfb9a9..df16006f19b 100644
--- a/src/devices/bus/dmv/k210.cpp
+++ b/src/devices/bus/dmv/k210.cpp
@@ -73,8 +73,7 @@ void dmv_k210_device::device_timer(emu_timer &timer, device_timer_id tid, int pa
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void dmv_k210_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(dmv_k210_device::device_add_mconfig)
I8255(config, m_ppi, 0);
m_ppi->in_pa_callback().set(FUNC(dmv_k210_device::porta_r));
m_ppi->in_pb_callback().set(FUNC(dmv_k210_device::portb_r));
@@ -94,18 +93,16 @@ void dmv_k210_device::device_add_mconfig(machine_config &config)
m_centronics->init_handler().set(FUNC(dmv_k210_device::cent_init_w));
INPUT_BUFFER(config, m_cent_data_in);
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
+MACHINE_CONFIG_END
- OUTPUT_LATCH(config, m_cent_data_out);
- m_centronics->set_output_latch(*m_cent_data_out);
-}
-
-void dmv_k210_device::io_read(int ifsel, offs_t offset, uint8_t &data)
+void dmv_k210_device::io_read(address_space &space, int ifsel, offs_t offset, uint8_t &data)
{
if (ifsel == 0)
data = m_ppi->read(offset & 0x03);
}
-void dmv_k210_device::io_write(int ifsel, offs_t offset, uint8_t data)
+void dmv_k210_device::io_write(address_space &space, int ifsel, offs_t offset, uint8_t data)
{
if (ifsel == 0)
m_ppi->write(offset & 0x03, data);
diff --git a/src/devices/bus/dmv/k210.h b/src/devices/bus/dmv/k210.h
index 501178f6fcf..dcc51a374ed 100644
--- a/src/devices/bus/dmv/k210.h
+++ b/src/devices/bus/dmv/k210.h
@@ -33,8 +33,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// dmvcart_interface overrides
- virtual void io_read(int ifsel, offs_t offset, uint8_t &data) override;
- virtual void io_write(int ifsel, offs_t offset, uint8_t data) override;
+ virtual void io_read(address_space &space, int ifsel, offs_t offset, uint8_t &data) override;
+ virtual void io_write(address_space &space, int ifsel, offs_t offset, uint8_t data) override;
private:
DECLARE_READ8_MEMBER(porta_r);
diff --git a/src/devices/bus/dmv/k220.cpp b/src/devices/bus/dmv/k220.cpp
index 4ad0667f689..4fff4f5b2bf 100644
--- a/src/devices/bus/dmv/k220.cpp
+++ b/src/devices/bus/dmv/k220.cpp
@@ -122,7 +122,6 @@ DEFINE_DEVICE_TYPE(DMV_K220, dmv_k220_device, "dmv_k220", "K220 diagnostic")
dmv_k220_device::dmv_k220_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, DMV_K220, tag, owner, clock)
, device_dmvslot_interface(mconfig, *this)
- , m_bus(*this, DEVICE_SELF_OWNER)
, m_pit(*this, "pit8253")
, m_ppi(*this, "ppi8255")
, m_ram(*this, "ram")
@@ -138,7 +137,7 @@ dmv_k220_device::dmv_k220_device(const machine_config &mconfig, const char *tag,
void dmv_k220_device::device_start()
{
- address_space &space = *m_bus->m_iospace;
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
space.install_readwrite_handler(0x08, 0x0b, read8sm_delegate(FUNC(pit8253_device::read), &(*m_pit)), write8sm_delegate(FUNC(pit8253_device::write), &(*m_pit)), 0);
space.install_readwrite_handler(0x0c, 0x0f, read8sm_delegate(FUNC(i8255_device::read), &(*m_ppi)), write8sm_delegate(FUNC(i8255_device::write), &(*m_ppi)), 0);
diff --git a/src/devices/bus/dmv/k220.h b/src/devices/bus/dmv/k220.h
index 60edad3b5f3..453b3e49f78 100644
--- a/src/devices/bus/dmv/k220.h
+++ b/src/devices/bus/dmv/k220.h
@@ -44,7 +44,6 @@ private:
DECLARE_WRITE_LINE_MEMBER(write_out1);
DECLARE_WRITE_LINE_MEMBER(write_out2);
- required_device<dmvcart_slot_device> m_bus;
required_device<pit8253_device> m_pit;
required_device<i8255_device> m_ppi;
required_memory_region m_ram;
diff --git a/src/devices/bus/dmv/k230.cpp b/src/devices/bus/dmv/k230.cpp
index b5454fa78db..9104abe2f7b 100644
--- a/src/devices/bus/dmv/k230.cpp
+++ b/src/devices/bus/dmv/k230.cpp
@@ -98,10 +98,7 @@ dmv_k230_device::dmv_k230_device(const machine_config &mconfig, device_type type
: device_t(mconfig, type, tag, owner, clock)
, device_dmvslot_interface(mconfig, *this)
, m_maincpu(*this, "maincpu")
- , m_rom(*this, "rom")
- , m_bus(*this, DEVICE_SELF_OWNER)
- , m_switch16(0)
- , m_hold(0)
+ , m_rom(*this, "rom"), m_bus(nullptr), m_io(nullptr), m_switch16(0), m_hold(0)
{
}
@@ -139,12 +136,14 @@ dmv_k235_device::dmv_k235_device(const machine_config &mconfig, const char *tag,
void dmv_k230_device::device_start()
{
+ m_bus = static_cast<dmvcart_slot_device*>(owner());
+ m_io = &machine().device<cpu_device>("maincpu")->space(AS_IO);
}
void dmv_k234_device::device_start()
{
dmv_k230_device::device_start();
- m_bus->m_iospace->install_readwrite_handler(0xd8, 0xdf, read8_delegate(FUNC(dmv_k234_device::snr_r), this), write8_delegate(FUNC(dmv_k234_device::snr_w), this), 0);
+ m_io->install_readwrite_handler(0xd8, 0xdf, read8_delegate(FUNC(dmv_k234_device::snr_r), this), write8_delegate(FUNC(dmv_k234_device::snr_w), this), 0);
}
//-------------------------------------------------
@@ -248,12 +247,12 @@ READ8_MEMBER(dmv_k230_device::rom_r)
READ8_MEMBER( dmv_k230_device::io_r )
{
- return m_bus->m_iospace->read_byte(offset);
+ return m_io->read_byte(offset);
}
WRITE8_MEMBER( dmv_k230_device::io_w )
{
- m_bus->m_iospace->write_byte(offset, data);
+ m_io->write_byte(offset, data);
}
READ8_MEMBER( dmv_k230_device::program_r )
diff --git a/src/devices/bus/dmv/k230.h b/src/devices/bus/dmv/k230.h
index e8e70fd878a..7021a4a8987 100644
--- a/src/devices/bus/dmv/k230.h
+++ b/src/devices/bus/dmv/k230.h
@@ -51,7 +51,8 @@ protected:
required_device<cpu_device> m_maincpu;
optional_memory_region m_rom;
- required_device<dmvcart_slot_device> m_bus;
+ dmvcart_slot_device * m_bus;
+ address_space * m_io;
int m_switch16;
int m_hold;
diff --git a/src/devices/bus/dmv/k233.cpp b/src/devices/bus/dmv/k233.cpp
index 2c8b13cff00..2ba68d3f53f 100644
--- a/src/devices/bus/dmv/k233.cpp
+++ b/src/devices/bus/dmv/k233.cpp
@@ -54,7 +54,7 @@ void dmv_k233_device::device_reset()
m_enabled = false;
}
-void dmv_k233_device::io_write(int ifsel, offs_t offset, uint8_t data)
+void dmv_k233_device::io_write(address_space &space, int ifsel, offs_t offset, uint8_t data)
{
if (ifsel == 1)
m_enabled = !m_enabled;
diff --git a/src/devices/bus/dmv/k233.h b/src/devices/bus/dmv/k233.h
index e73ae71a9df..8aa2f0d235b 100644
--- a/src/devices/bus/dmv/k233.h
+++ b/src/devices/bus/dmv/k233.h
@@ -27,7 +27,7 @@ protected:
virtual void device_reset() override;
// dmvcart_interface overrides
- virtual void io_write(int ifsel, offs_t offset, uint8_t data) override;
+ virtual void io_write(address_space &space, int ifsel, offs_t offset, uint8_t data) override;
virtual bool read(offs_t offset, uint8_t &data) override;
virtual bool write(offs_t offset, uint8_t data) override;
diff --git a/src/devices/bus/dmv/k801.cpp b/src/devices/bus/dmv/k801.cpp
index 7c4892f4fb0..64098400288 100644
--- a/src/devices/bus/dmv/k801.cpp
+++ b/src/devices/bus/dmv/k801.cpp
@@ -206,7 +206,7 @@ WRITE_LINE_MEMBER(dmv_k801_device::epci_irq_w)
m_bus->m_out_irq_cb(state);
}
-void dmv_k801_device::io_read(int ifsel, offs_t offset, uint8_t &data)
+void dmv_k801_device::io_read(address_space &space, int ifsel, offs_t offset, uint8_t &data)
{
uint8_t dsw = m_dsw->read() & 0x0f;
if ((dsw >> 1) == ifsel && BIT(offset, 3) == BIT(dsw, 0))
@@ -218,7 +218,7 @@ void dmv_k801_device::io_read(int ifsel, offs_t offset, uint8_t &data)
}
}
-void dmv_k801_device::io_write(int ifsel, offs_t offset, uint8_t data)
+void dmv_k801_device::io_write(address_space &space, int ifsel, offs_t offset, uint8_t data)
{
uint8_t dsw = m_dsw->read() & 0x0f;
if ((dsw >> 1) == ifsel && BIT(offset, 3) == BIT(dsw, 0))
@@ -230,7 +230,7 @@ void dmv_k801_device::io_write(int ifsel, offs_t offset, uint8_t data)
}
}
-void dmv_k211_device::io_read(int ifsel, offs_t offset, uint8_t &data)
+void dmv_k211_device::io_read(address_space &space, int ifsel, offs_t offset, uint8_t &data)
{
uint8_t jumpers = m_dsw->read() & 0x03;
if ((BIT(jumpers, 0) && ifsel == 0) || (BIT(jumpers, 1) && ifsel == 1))
@@ -242,7 +242,7 @@ void dmv_k211_device::io_read(int ifsel, offs_t offset, uint8_t &data)
}
}
-void dmv_k211_device::io_write(int ifsel, offs_t offset, uint8_t data)
+void dmv_k211_device::io_write(address_space &space, int ifsel, offs_t offset, uint8_t data)
{
uint8_t jumpers = m_dsw->read() & 0x03;
if ((BIT(jumpers, 0) && ifsel == 0) || (BIT(jumpers, 1) && ifsel == 1))
diff --git a/src/devices/bus/dmv/k801.h b/src/devices/bus/dmv/k801.h
index db4b557bbb1..26f314b2149 100644
--- a/src/devices/bus/dmv/k801.h
+++ b/src/devices/bus/dmv/k801.h
@@ -36,8 +36,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// dmvcart_interface overrides
- virtual void io_read(int ifsel, offs_t offset, uint8_t &data) override;
- virtual void io_write(int ifsel, offs_t offset, uint8_t data) override;
+ virtual void io_read(address_space &space, int ifsel, offs_t offset, uint8_t &data) override;
+ virtual void io_write(address_space &space, int ifsel, offs_t offset, uint8_t data) override;
required_device<mc2661_device> m_epci;
required_device<rs232_port_device> m_rs232;
@@ -67,8 +67,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// dmvcart_interface overrides
- virtual void io_read(int ifsel, offs_t offset, uint8_t &data) override;
- virtual void io_write(int ifsel, offs_t offset, uint8_t data) override;
+ virtual void io_read(address_space &space, int ifsel, offs_t offset, uint8_t &data) override;
+ virtual void io_write(address_space &space, int ifsel, offs_t offset, uint8_t data) override;
};
// ======================> dmv_k212_device
diff --git a/src/devices/bus/dmv/k803.cpp b/src/devices/bus/dmv/k803.cpp
index d0cf9cff336..04ed7445b0e 100644
--- a/src/devices/bus/dmv/k803.cpp
+++ b/src/devices/bus/dmv/k803.cpp
@@ -75,11 +75,10 @@ void dmv_k803_device::device_reset()
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void dmv_k803_device::device_add_mconfig(machine_config &config)
-{
- MM58167(config, m_rtc, XTAL(32'768));
- m_rtc->irq().set(FUNC(dmv_k803_device::rtc_irq_w));
-}
+MACHINE_CONFIG_START(dmv_k803_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("rtc", MM58167, XTAL(32'768))
+ MCFG_MM58167_IRQ_CALLBACK(WRITELINE(*this, dmv_k803_device, rtc_irq_w))
+MACHINE_CONFIG_END
//-------------------------------------------------
// input_ports - device-specific input ports
@@ -90,23 +89,23 @@ ioport_constructor dmv_k803_device::device_input_ports() const
return INPUT_PORTS_NAME( dmv_k803 );
}
-void dmv_k803_device::io_read(int ifsel, offs_t offset, uint8_t &data)
+void dmv_k803_device::io_read(address_space &space, int ifsel, offs_t offset, uint8_t &data)
{
uint8_t dsw = m_dsw->read() & 0x0f;
if ((dsw >> 1) == ifsel && BIT(offset, 3) == BIT(dsw, 0))
{
if (offset & 0x04)
- data = m_rtc->read(((m_latch & 0x07) << 2) | (offset & 0x03));
+ data = m_rtc->read(space, ((m_latch & 0x07) << 2) | (offset & 0x03));
}
}
-void dmv_k803_device::io_write(int ifsel, offs_t offset, uint8_t data)
+void dmv_k803_device::io_write(address_space &space, int ifsel, offs_t offset, uint8_t data)
{
uint8_t dsw = m_dsw->read() & 0x0f;
if ((dsw >> 1) == ifsel && BIT(offset, 3) == BIT(dsw, 0))
{
if (offset & 0x04)
- m_rtc->write(((m_latch & 0x07) << 2) | (offset & 0x03), data);
+ m_rtc->write(space, ((m_latch & 0x07) << 2) | (offset & 0x03), data);
else
{
m_latch = data;
diff --git a/src/devices/bus/dmv/k803.h b/src/devices/bus/dmv/k803.h
index e8455646d1e..0e1e190e89f 100644
--- a/src/devices/bus/dmv/k803.h
+++ b/src/devices/bus/dmv/k803.h
@@ -31,8 +31,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void io_read(int ifsel, offs_t offset, uint8_t &data) override;
- virtual void io_write(int ifsel, offs_t offset, uint8_t data) override;
+ virtual void io_read(address_space &space, int ifsel, offs_t offset, uint8_t &data) override;
+ virtual void io_write(address_space &space, int ifsel, offs_t offset, uint8_t data) override;
void update_int();
diff --git a/src/devices/bus/dmv/k806.cpp b/src/devices/bus/dmv/k806.cpp
index a747efa24f4..62cf3f97ea4 100644
--- a/src/devices/bus/dmv/k806.cpp
+++ b/src/devices/bus/dmv/k806.cpp
@@ -128,19 +128,19 @@ const tiny_rom_entry *dmv_k806_device::device_rom_region() const
return ROM_NAME( dmv_k806 );
}
-void dmv_k806_device::io_read(int ifsel, offs_t offset, uint8_t &data)
+void dmv_k806_device::io_read(address_space &space, int ifsel, offs_t offset, uint8_t &data)
{
uint8_t jumpers = m_jumpers->read();
if (BIT(jumpers, ifsel) && ((!BIT(offset, 3) && BIT(jumpers, 5)) || (BIT(offset, 3) && BIT(jumpers, 6))))
- data = m_mcu->upi41_master_r(machine().dummy_space(), offset & 1);
+ data = m_mcu->upi41_master_r(space, offset & 1);
}
-void dmv_k806_device::io_write(int ifsel, offs_t offset, uint8_t data)
+void dmv_k806_device::io_write(address_space &space, int ifsel, offs_t offset, uint8_t data)
{
uint8_t jumpers = m_jumpers->read();
if (BIT(jumpers, ifsel) && ((!BIT(offset, 3) && BIT(jumpers, 5)) || (BIT(offset, 3) && BIT(jumpers, 6))))
{
- m_mcu->upi41_master_w(machine().dummy_space(), offset & 1, data);
+ m_mcu->upi41_master_w(space, offset & 1, data);
m_bus->m_out_int_cb(CLEAR_LINE);
}
}
diff --git a/src/devices/bus/dmv/k806.h b/src/devices/bus/dmv/k806.h
index 082d56b11a6..da178a2945d 100644
--- a/src/devices/bus/dmv/k806.h
+++ b/src/devices/bus/dmv/k806.h
@@ -35,8 +35,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void io_read(int ifsel, offs_t offset, uint8_t &data) override;
- virtual void io_write(int ifsel, offs_t offset, uint8_t data) override;
+ virtual void io_read(address_space &space, int ifsel, offs_t offset, uint8_t &data) override;
+ virtual void io_write(address_space &space, int ifsel, offs_t offset, uint8_t data) override;
private:
DECLARE_READ_LINE_MEMBER(portt1_r);
diff --git a/src/devices/bus/ecbbus/ecbbus.h b/src/devices/bus/ecbbus/ecbbus.h
index c14f1c53de4..f4d53b5cc9a 100644
--- a/src/devices/bus/ecbbus/ecbbus.h
+++ b/src/devices/bus/ecbbus/ecbbus.h
@@ -56,6 +56,27 @@
#define ECBBUS_TAG "ecbbus"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_ECBBUS_ADD() \
+ MCFG_DEVICE_ADD(ECBBUS_TAG, ECBBUS, 0)
+#define MCFG_ECBBUS_SLOT_ADD(_num, _tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, ECBBUS_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<ecbbus_slot_device &>(*device).set_ecbbus_slot(ECBBUS_TAG, _num);
+
+
+#define MCFG_ECBBUS_IRQ_CALLBACK(_write) \
+ downcast<ecbbus_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
+
+#define MCFG_ECBBUS_NMI_CALLBACK(_write) \
+ downcast<ecbbus_device &>(*device).set_nmi_wr_callback(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -69,17 +90,6 @@ class ecbbus_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- ecbbus_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, int num, T &&opts, char const *dflt)
- : ecbbus_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- set_ecbbus_slot(ECBBUS_TAG, num);
- }
-
ecbbus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
@@ -111,10 +121,10 @@ class ecbbus_device : public device_t
{
public:
// construction/destruction
- ecbbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ ecbbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto irq_wr_callback() { return m_write_irq.bind(); }
- auto nmi_wr_callback() { return m_write_nmi.bind(); }
+ template <class Object> devcb_base &set_irq_wr_callback(Object &&cb) { return m_write_irq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_nmi_wr_callback(Object &&cb) { return m_write_nmi.set_callback(std::forward<Object>(cb)); }
void add_card(device_ecbbus_card_interface *card, int pos);
diff --git a/src/devices/bus/econet/e01.cpp b/src/devices/bus/econet/e01.cpp
index fca4c189033..cb1f385aa86 100644
--- a/src/devices/bus/econet/e01.cpp
+++ b/src/devices/bus/econet/e01.cpp
@@ -647,7 +647,7 @@ WRITE8_MEMBER( econet_e01_device::hdc_irq_enable_w )
READ8_MEMBER( econet_e01_device::rtc_address_r )
{
- return m_rtc->read(0);
+ return m_rtc->read(space, 0);
}
@@ -657,7 +657,7 @@ READ8_MEMBER( econet_e01_device::rtc_address_r )
WRITE8_MEMBER( econet_e01_device::rtc_address_w )
{
- m_rtc->write(0, data);
+ m_rtc->write(space, 0, data);
}
@@ -667,7 +667,7 @@ WRITE8_MEMBER( econet_e01_device::rtc_address_w )
READ8_MEMBER( econet_e01_device::rtc_data_r )
{
- return m_rtc->read(1);
+ return m_rtc->read(space, 1);
}
@@ -677,7 +677,7 @@ READ8_MEMBER( econet_e01_device::rtc_data_r )
WRITE8_MEMBER( econet_e01_device::rtc_data_w )
{
- m_rtc->write(1, data);
+ m_rtc->write(space, 1, data);
}
diff --git a/src/devices/bus/econet/econet.h b/src/devices/bus/econet/econet.h
index dd92811e28b..bbe4167cfa9 100644
--- a/src/devices/bus/econet/econet.h
+++ b/src/devices/bus/econet/econet.h
@@ -21,6 +21,28 @@
#define ECONET_TAG "econet"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_ECONET_ADD() \
+ MCFG_DEVICE_ADD(ECONET_TAG, ECONET, 0)
+
+#define MCFG_ECONET_SLOT_ADD(_tag, _num, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, ECONET_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<econet_slot_device &>(*device).set_slot(_num);
+
+
+#define MCFG_ECONET_CLK_CALLBACK(_write) \
+ downcast<econet_device &>(*device).set_clk_wr_callback(DEVCB_##_write);
+
+#define MCFG_ECONET_DATA_CALLBACK(_write) \
+ downcast<econet_device &>(*device).set_data_wr_callback(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -35,6 +57,8 @@ public:
// construction/destruction
econet_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <class Object> devcb_base &set_clk_wr_callback(Object &&cb) { return m_write_clk.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data_wr_callback(Object &&cb) { return m_write_data.set_callback(std::forward<Object>(cb)); }
auto clk_wr_callback() { return m_write_clk.bind(); }
auto data_wr_callback() { return m_write_data.bind(); }
diff --git a/src/devices/bus/einstein/pipe/pipe.cpp b/src/devices/bus/einstein/pipe/pipe.cpp
index d521d146325..b40038e650b 100644
--- a/src/devices/bus/einstein/pipe/pipe.cpp
+++ b/src/devices/bus/einstein/pipe/pipe.cpp
@@ -33,8 +33,8 @@ DEFINE_DEVICE_TYPE(TATUNG_PIPE, tatung_pipe_device, "tatung_pipe", "Tatung Pipe
tatung_pipe_device::tatung_pipe_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, TATUNG_PIPE, tag, owner, clock),
device_slot_interface(mconfig, *this),
- m_program(*this, finder_base::DUMMY_TAG, -1),
- m_io(*this, finder_base::DUMMY_TAG, -1),
+ m_program(nullptr),
+ m_io(nullptr),
m_card(nullptr),
m_int_handler(*this),
m_nmi_handler(*this),
@@ -51,28 +51,6 @@ tatung_pipe_device::~tatung_pipe_device()
}
//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void tatung_pipe_device::device_config_complete()
-{
- // for passthrough connectors, use the parent slot's spaces
- if (dynamic_cast<device_tatung_pipe_interface *>(owner()) != nullptr)
- {
- auto parent = dynamic_cast<tatung_pipe_device *>(owner()->owner());
- if (parent != nullptr)
- {
- if (m_program.finder_tag() == finder_base::DUMMY_TAG)
- m_program.set_tag(parent->m_program, parent->m_program.spacenum());
- if (m_io.finder_tag() == finder_base::DUMMY_TAG)
- m_io.set_tag(parent->m_io, parent->m_io.spacenum());
- }
- }
-}
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -105,6 +83,24 @@ WRITE_LINE_MEMBER( tatung_pipe_device::host_int_w )
m_card->int_w(state);
}
+//-------------------------------------------------
+// set_program_space - set address space we are attached to
+//-------------------------------------------------
+
+void tatung_pipe_device::set_program_space(address_space *program)
+{
+ m_program = program;
+}
+
+//-------------------------------------------------
+// set_io_space - set address space we are attached to
+//-------------------------------------------------
+
+void tatung_pipe_device::set_io_space(address_space *io)
+{
+ m_io = io;
+}
+
//**************************************************************************
// CARD INTERFACE
diff --git a/src/devices/bus/einstein/pipe/pipe.h b/src/devices/bus/einstein/pipe/pipe.h
index f0c32bd0043..e0ce7e9a6f7 100644
--- a/src/devices/bus/einstein/pipe/pipe.h
+++ b/src/devices/bus/einstein/pipe/pipe.h
@@ -68,8 +68,8 @@ public:
}
virtual ~tatung_pipe_device();
- template <typename T> void set_program_space(T &&tag, int spacenum) { m_program.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_io_space(T &&tag, int spacenum) { m_io.set_tag(std::forward<T>(tag), spacenum); }
+ void set_program_space(address_space *program);
+ void set_io_space(address_space *io);
// callbacks
auto int_handler() { return m_int_handler.bind(); }
@@ -86,12 +86,11 @@ public:
protected:
// device-level overrides
- virtual void device_config_complete() override;
virtual void device_start() override;
virtual void device_reset() override;
- required_address_space m_program;
- required_address_space m_io;
+ address_space *m_program;
+ address_space *m_io;
device_tatung_pipe_interface *m_card;
diff --git a/src/devices/bus/einstein/pipe/speculator.cpp b/src/devices/bus/einstein/pipe/speculator.cpp
index ed35973ab12..75519847e16 100644
--- a/src/devices/bus/einstein/pipe/speculator.cpp
+++ b/src/devices/bus/einstein/pipe/speculator.cpp
@@ -25,8 +25,7 @@ DEFINE_DEVICE_TYPE(EINSTEIN_SPECULATOR, einstein_speculator_device, "einstein_sp
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void einstein_speculator_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(einstein_speculator_device::device_add_mconfig)
TTL74123(config, m_ic5a, 0);
m_ic5a->set_connection_type(TTL74123_NOT_GROUNDED_NO_DIODE);
m_ic5a->set_resistor_value(RES_K(47));
@@ -49,11 +48,11 @@ void einstein_speculator_device::device_add_mconfig(machine_config &config)
WAVE(config, "wave", m_cassette).add_route(ALL_OUTPUTS, "mono", 0.25);
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50);
- CASSETTE(config, m_cassette);
- m_cassette->set_formats(tzx_cassette_formats);
- m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED);
- m_cassette->set_interface("spectrum_cass");
-}
+ MCFG_CASSETTE_ADD(m_cassette)
+ MCFG_CASSETTE_FORMATS(tzx_cassette_formats)
+ MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
+ MCFG_CASSETTE_INTERFACE("spectrum_cass")
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/einstein/pipe/tk02.cpp b/src/devices/bus/einstein/pipe/tk02.cpp
index 311c3099011..d0926f2e320 100644
--- a/src/devices/bus/einstein/pipe/tk02.cpp
+++ b/src/devices/bus/einstein/pipe/tk02.cpp
@@ -159,6 +159,9 @@ void tk02_device::device_start()
void tk02_device::device_reset()
{
+ m_pipe->set_io_space(&io_space());
+ m_pipe->set_program_space(&program_space());
+
io_space().install_device(0x40, 0x4f, *this, &tk02_device::map);
io_space().install_readwrite_handler(0x40, 0x47, 0, 0, 0xff00, read8_delegate(FUNC(tk02_device::ram_r), this), write8_delegate(FUNC(tk02_device::ram_w), this));
}
diff --git a/src/devices/bus/einstein/userport/userport.h b/src/devices/bus/einstein/userport/userport.h
index f5bd8dcfeb3..4bdbaed36d2 100644
--- a/src/devices/bus/einstein/userport/userport.h
+++ b/src/devices/bus/einstein/userport/userport.h
@@ -24,32 +24,32 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_EINSTEIN_USERPORT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, EINSTEIN_USERPORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(einstein_userport_cards, nullptr, false)
+
+#define MCFG_EINSTEIN_USERPORT_BSTB_HANDLER(_devcb) \
+ downcast<einstein_userport_device &>(*device).set_bstb_handler(DEVCB_##_devcb);
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class device_einstein_userport_interface;
-// supported devices
-void einstein_userport_cards(device_slot_interface &device);
-
class einstein_userport_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- einstein_userport_device(machine_config const &mconfig, char const *tag, device_t *owner)
- : einstein_userport_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- einstein_userport_cards(*this);
- set_default_option(nullptr);
- set_fixed(false);
- }
-
einstein_userport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~einstein_userport_device();
// callbacks
- auto bstb_handler() { return m_bstb_handler.bind(); }
+ template <class Object> devcb_base &set_bstb_handler(Object &&cb) { return m_bstb_handler.set_callback(std::forward<Object>(cb)); }
// called from card device
DECLARE_WRITE_LINE_MEMBER( bstb_w ) { m_bstb_handler(state); }
@@ -89,4 +89,7 @@ protected:
// device type definition
DECLARE_DEVICE_TYPE(EINSTEIN_USERPORT, einstein_userport_device)
+// supported devices
+void einstein_userport_cards(device_slot_interface &device);
+
#endif // MAME_BUS_EINSTEIN_USERPORT_USERPORT_H
diff --git a/src/devices/bus/ekara/rom.cpp b/src/devices/bus/ekara/rom.cpp
index f55fd325d2a..7ba557b0917 100644
--- a/src/devices/bus/ekara/rom.cpp
+++ b/src/devices/bus/ekara/rom.cpp
@@ -10,10 +10,8 @@
DEFINE_DEVICE_TYPE(EKARA_ROM_PLAIN, ekara_rom_plain_device, "ekara_rom_plain", "EKARA Cartridge")
DEFINE_DEVICE_TYPE(EKARA_ROM_I2C_BASE, ekara_rom_i2c_base_device, "ekara_rom_i2c_base", "EKARA Cartridge with I2C")
-DEFINE_DEVICE_TYPE(EKARA_ROM_I2C_24C08_EPITCH, ekara_rom_i2c_24c08_epitch_device, "ekara_rom_i2c_24c08", "EKARA Cartridge with I2C 24C08 (e-pitch)")
DEFINE_DEVICE_TYPE(EKARA_ROM_I2C_24LC04, ekara_rom_i2c_24lc04_device, "ekara_rom_i2c_24lc04", "EKARA Cartridge with I2C 24LC04")
DEFINE_DEVICE_TYPE(EKARA_ROM_I2C_24LC02, ekara_rom_i2c_24lc02_device, "ekara_rom_i2c_24lc02", "EKARA Cartridge with I2C 24LC02")
-DEFINE_DEVICE_TYPE(EKARA_ROM_I2C_24LC02_GC0010, ekara_rom_i2c_24lc02_gc0010_device, "ekara_rom_i2c_24lc02_gc0010", "EKARA Cartridge with I2C 24LC02 (GC0010 direct access)")
ekara_rom_plain_device::ekara_rom_plain_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
@@ -26,24 +24,18 @@ ekara_rom_plain_device::ekara_rom_plain_device(const machine_config &mconfig, co
{
}
-
+ekara_rom_i2c_base_device::ekara_rom_i2c_base_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ ekara_rom_plain_device(mconfig, EKARA_ROM_I2C_BASE, tag, owner, clock),
+ m_i2cmem(*this, "i2cmem")
+{
+}
ekara_rom_i2c_base_device::ekara_rom_i2c_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
ekara_rom_plain_device(mconfig, type, tag, owner, clock),
m_i2cmem(*this, "i2cmem")
{
- m_buscontrol[0] = m_buscontrol[1] = m_buscontrol[2] = 0x00;
}
-ekara_rom_i2c_base_device::ekara_rom_i2c_base_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- ekara_rom_i2c_base_device(mconfig, EKARA_ROM_I2C_BASE, tag, owner, clock)
-{
-}
-
-ekara_rom_i2c_24c08_epitch_device::ekara_rom_i2c_24c08_epitch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- ekara_rom_i2c_base_device(mconfig, EKARA_ROM_I2C_24C08_EPITCH, tag, owner, clock)
-{
-}
ekara_rom_i2c_24lc04_device::ekara_rom_i2c_24lc04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
ekara_rom_i2c_base_device(mconfig, EKARA_ROM_I2C_24LC04, tag, owner, clock)
@@ -55,11 +47,6 @@ ekara_rom_i2c_24lc02_device::ekara_rom_i2c_24lc02_device(const machine_config &m
{
}
-ekara_rom_i2c_24lc02_gc0010_device::ekara_rom_i2c_24lc02_gc0010_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- ekara_rom_i2c_base_device(mconfig, EKARA_ROM_I2C_24LC02_GC0010, tag, owner, clock)
-{
-}
-
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
@@ -88,22 +75,6 @@ WRITE8_MEMBER(ekara_rom_plain_device::write_rom)
// i2c base
-bool ekara_rom_i2c_base_device::is_read_access_not_rom(void)
-{
- return (m_buscontrol[1] & 0x08) ? true : false;
-}
-
-bool ekara_rom_i2c_base_device::is_write_access_not_rom(void)
-{
- return (m_buscontrol[0] & 0x08) ? true : false;
-}
-
-WRITE8_MEMBER(ekara_rom_i2c_base_device::write_bus_control)
-{
- logerror("ekara_rom_i2c_base_device::write_bus_control %08x %02x\n", offset, data);
- m_buscontrol[offset] = data;
-}
-
WRITE8_MEMBER(ekara_rom_i2c_base_device::write_rom)
{
logerror("ekara_rom_i2c_base_device::write_rom %08x %02x\n", offset, data);
@@ -129,85 +100,18 @@ WRITE8_MEMBER(ekara_rom_i2c_base_device::write_extra)
m_i2cmem->write_scl((data & 0x02) >> 1);
}
-// i2c 24c08 (for epitch carts)
-
-bool ekara_rom_i2c_24c08_epitch_device::is_read_access_not_rom(void)
-{
- // write 0x08 before reading from SEEPROM
- // reads from 005fffff, cart does no accress decoding
- return (m_buscontrol[1] & 0x08) ? true : false;
-}
-
-bool ekara_rom_i2c_24c08_epitch_device::is_write_access_not_rom(void)
-{
- // writes 0x05 before writing to SEEPROM
- // actually writes to address 3fffff which is where a mirror of the base ROM sits, but clearly all signals route through the cartridge too
- // cart does no accress decoding
- return (m_buscontrol[1] & 0x04) ? true : false;
-}
-
-void ekara_rom_i2c_24c08_epitch_device::device_add_mconfig(machine_config &config)
-{
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x400); // 24C08
-}
// i2c 24lc04
-void ekara_rom_i2c_24lc04_device::device_add_mconfig(machine_config &config)
-{
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x200); // 24LC04
-}
+MACHINE_CONFIG_START(ekara_rom_i2c_24lc04_device::device_add_mconfig)
+ I2CMEM(config, "i2cmem", 0)/*.set_page_size(16)*/.set_data_size(0x200); // 24LC04
+MACHINE_CONFIG_END
// i2c 24lc02
-void ekara_rom_i2c_24lc02_device::device_add_mconfig(machine_config &config)
-{
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x100); // 24LC02
-}
-
-// i2c 24lc02 with direct IO port access
-
-bool ekara_rom_i2c_24lc02_gc0010_device::is_read_access_not_rom(void)
-{
- return false;
-}
-
-bool ekara_rom_i2c_24lc02_gc0010_device::is_write_access_not_rom(void)
-{
- return false;
-}
-
-READ8_MEMBER(ekara_rom_i2c_24lc02_gc0010_device::read_extra)
-{
- return 0;
-}
-
-WRITE8_MEMBER(ekara_rom_i2c_24lc02_gc0010_device::write_extra)
-{
-}
-
-
-WRITE_LINE_MEMBER(ekara_rom_i2c_24lc02_gc0010_device::write_sda)
-{
- m_i2cmem->write_sda(state);
-}
-
-WRITE_LINE_MEMBER(ekara_rom_i2c_24lc02_gc0010_device::write_scl)
-{
- m_i2cmem->write_scl(state);
-}
-
-READ_LINE_MEMBER(ekara_rom_i2c_24lc02_gc0010_device::read_sda )
-{
- return m_i2cmem->read_sda();
-}
-
-
-
-void ekara_rom_i2c_24lc02_gc0010_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(ekara_rom_i2c_24lc02_device::device_add_mconfig)
I2CMEM(config, "i2cmem", 0)/*.set_page_size(16)*/.set_data_size(0x100); // 24LC02
-}
+MACHINE_CONFIG_END
/*-------------------------------------------------
@@ -217,9 +121,6 @@ void ekara_rom_i2c_24lc02_gc0010_device::device_add_mconfig(machine_config &conf
void ekara_cart(device_slot_interface &device)
{
device.option_add_internal("plain", EKARA_ROM_PLAIN);
- device.option_add_internal("rom_24c08_epitch", EKARA_ROM_I2C_24C08_EPITCH);
device.option_add_internal("rom_24lc04", EKARA_ROM_I2C_24LC04);
- device.option_add_internal("rom_24lc02", EKARA_ROM_I2C_24LC02);
- device.option_add_internal("rom_24lc02_gc0010", EKARA_ROM_I2C_24LC02_GC0010);
-
+ device.option_add_internal("rom_24lc02", EKARA_ROM_I2C_24LC02);
}
diff --git a/src/devices/bus/ekara/rom.h b/src/devices/bus/ekara/rom.h
index 76c5ed45e46..a765f28d6d3 100644
--- a/src/devices/bus/ekara/rom.h
+++ b/src/devices/bus/ekara/rom.h
@@ -54,32 +54,8 @@ protected:
virtual DECLARE_READ8_MEMBER(read_extra) override;
virtual DECLARE_WRITE8_MEMBER(write_extra) override;
-
- virtual DECLARE_WRITE8_MEMBER(write_bus_control) override;
-
- virtual bool is_read_access_not_rom(void) override;
- virtual bool is_write_access_not_rom(void) override;
-
- uint8_t m_buscontrol[3];
};
-
-// ======================> ekara_rom_i2c_24c08_epitch_device
-
-class ekara_rom_i2c_24c08_epitch_device : public ekara_rom_i2c_base_device
-{
-public:
- // construction/destruction
- ekara_rom_i2c_24c08_epitch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- virtual bool is_read_access_not_rom(void) override;
- virtual bool is_write_access_not_rom(void) override;
-
- virtual void device_add_mconfig(machine_config &config) override;
-};
-
-
// ======================> ekara_rom_i2c_24lc04_device
class ekara_rom_i2c_24lc04_device : public ekara_rom_i2c_base_device
@@ -105,32 +81,10 @@ protected:
};
-// ======================> ekara_rom_i2c_24lc02_gc0010_device
-
-class ekara_rom_i2c_24lc02_gc0010_device : public ekara_rom_i2c_base_device
-{
-public:
- // construction/destruction
- ekara_rom_i2c_24lc02_gc0010_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- virtual void device_add_mconfig(machine_config &config) override;
-
- bool is_read_access_not_rom(void) override;
- bool is_write_access_not_rom(void) override;
- DECLARE_READ8_MEMBER(read_extra) override;
- DECLARE_WRITE8_MEMBER(write_extra) override;
- DECLARE_WRITE_LINE_MEMBER(write_sda) override;
- DECLARE_WRITE_LINE_MEMBER(write_scl) override;
- DECLARE_READ_LINE_MEMBER(read_sda ) override;
-};
-
// device type definition
DECLARE_DEVICE_TYPE(EKARA_ROM_PLAIN, ekara_rom_plain_device)
DECLARE_DEVICE_TYPE(EKARA_ROM_I2C_BASE, ekara_rom_i2c_base_device)
-DECLARE_DEVICE_TYPE(EKARA_ROM_I2C_24C08_EPITCH, ekara_rom_i2c_24c08_epitch_device)
DECLARE_DEVICE_TYPE(EKARA_ROM_I2C_24LC04, ekara_rom_i2c_24lc04_device)
DECLARE_DEVICE_TYPE(EKARA_ROM_I2C_24LC02, ekara_rom_i2c_24lc02_device)
-DECLARE_DEVICE_TYPE(EKARA_ROM_I2C_24LC02_GC0010, ekara_rom_i2c_24lc02_gc0010_device)
#endif // MAME_BUS_EKARA_ROM_H
diff --git a/src/devices/bus/ekara/slot.cpp b/src/devices/bus/ekara/slot.cpp
index 5140e3f28ab..0569bb49a6c 100644
--- a/src/devices/bus/ekara/slot.cpp
+++ b/src/devices/bus/ekara/slot.cpp
@@ -95,7 +95,6 @@ static const ekara_slot slot_list[] =
{
{ EKARA_PLAIN, "plain" },
{ EKARA_I2C_BASE, "i2c_base" },
- { EKARA_I2C_24C08, "rom_24c08" },
{ EKARA_I2C_24LC04, "rom_24lc04" },
{ EKARA_I2C_24LC02, "rom_24lc02" },
};
@@ -238,40 +237,3 @@ WRITE8_MEMBER(ekara_cart_slot_device::write_extra)
m_cart->write_extra(space, offset, data);
}
-/*-------------------------------------------------
- write control
- -------------------------------------------------*/
-
-WRITE8_MEMBER(ekara_cart_slot_device::write_bus_control)
-{
- m_cart->write_bus_control(space, offset, data);
-}
-
-bool ekara_cart_slot_device::is_read_access_not_rom(void)
-{
- return m_cart->is_read_access_not_rom();
-}
-
-bool ekara_cart_slot_device::is_write_access_not_rom(void)
-{
- return m_cart->is_write_access_not_rom();
-}
-
-/*-------------------------------------------------
- direct seeprom access (popira2, gc0010)
- -------------------------------------------------*/
-
-WRITE_LINE_MEMBER(ekara_cart_slot_device::write_sda)
-{
- m_cart->write_sda(state);
-}
-
-WRITE_LINE_MEMBER(ekara_cart_slot_device::write_scl)
-{
- m_cart->write_scl(state);
-}
-
-READ_LINE_MEMBER(ekara_cart_slot_device::read_sda )
-{
- return m_cart->read_sda();
-}
diff --git a/src/devices/bus/ekara/slot.h b/src/devices/bus/ekara/slot.h
index 945a5175d4b..5f871aa1dfc 100644
--- a/src/devices/bus/ekara/slot.h
+++ b/src/devices/bus/ekara/slot.h
@@ -16,7 +16,6 @@ enum
{
EKARA_PLAIN = 0,
EKARA_I2C_BASE,
- EKARA_I2C_24C08,
EKARA_I2C_24LC04,
EKARA_I2C_24LC02,
};
@@ -36,16 +35,6 @@ public:
virtual DECLARE_READ8_MEMBER(read_extra) { return 0xff; }
virtual DECLARE_WRITE8_MEMBER(write_extra) { }
- virtual DECLARE_WRITE_LINE_MEMBER(write_sda) { }
- virtual DECLARE_WRITE_LINE_MEMBER(write_scl) { }
- //virtual DECLARE_WRITE_LINE_MEMBER( write_wc )
- virtual DECLARE_READ_LINE_MEMBER( read_sda ) { return 0; }
-
- virtual DECLARE_WRITE8_MEMBER(write_bus_control) { }
-
- virtual bool is_read_access_not_rom(void) { return false; }
- virtual bool is_write_access_not_rom(void) { return false; }
-
void rom_alloc(uint32_t size, const char *tag);
uint8_t* get_rom_base() { return m_rom; }
uint32_t get_rom_size() { return m_rom_size; }
@@ -107,16 +96,6 @@ public:
virtual DECLARE_READ8_MEMBER(read_extra);
virtual DECLARE_WRITE8_MEMBER(write_extra);
- virtual DECLARE_WRITE_LINE_MEMBER(write_sda);
- virtual DECLARE_WRITE_LINE_MEMBER(write_scl);
- //virtual DECLARE_WRITE_LINE_MEMBER( write_wc );
- virtual DECLARE_READ_LINE_MEMBER( read_sda );
-
- virtual DECLARE_WRITE8_MEMBER(write_bus_control);
-
- virtual bool is_read_access_not_rom(void);
- virtual bool is_write_access_not_rom(void);
-
bool has_cart() { return m_cart ? true : false; }
protected:
diff --git a/src/devices/bus/electron/cart/abr.cpp b/src/devices/bus/electron/cart/abr.cpp
index 1d2455e56c1..c894d5e9c71 100644
--- a/src/devices/bus/electron/cart/abr.cpp
+++ b/src/devices/bus/electron/cart/abr.cpp
@@ -46,13 +46,16 @@ void electron_abr_device::device_start()
// read - cartridge data read
//-------------------------------------------------
-uint8_t electron_abr_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
+uint8_t electron_abr_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
{
uint8_t data = 0xff;
- if (oe)
+ if (!infc && !infd)
{
- data = m_nvram[(offset & 0x3fff) | (romqa << 14)];
+ if (offset >= 0x0000 && offset < 0x4000)
+ {
+ data = m_nvram[(offset & 0x3fff) | (romqa << 14)];
+ }
}
return data;
@@ -62,7 +65,7 @@ uint8_t electron_abr_device::read(offs_t offset, int infc, int infd, int romqa,
// write - cartridge data write
//-------------------------------------------------
-void electron_abr_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
+void electron_abr_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
{
if (infc)
{
@@ -82,9 +85,10 @@ void electron_abr_device::write(offs_t offset, uint8_t data, int infc, int infd,
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
- if (!m_bank_locked[romqa])
+ if (offset >= 0x0000 && offset < 0x4000 && !m_bank_locked[romqa])
{
m_nvram[(offset & 0x3fff) | (romqa << 14)] = data;
}
diff --git a/src/devices/bus/electron/cart/abr.h b/src/devices/bus/electron/cart/abr.h
index 3ef92c95a8d..b985db0a44d 100644
--- a/src/devices/bus/electron/cart/abr.h
+++ b/src/devices/bus/electron/cart/abr.h
@@ -32,8 +32,8 @@ protected:
virtual void device_start() override;
// electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override;
private:
bool m_bank_locked[2];
diff --git a/src/devices/bus/electron/cart/ap34.cpp b/src/devices/bus/electron/cart/ap34.cpp
index 694df390266..30847c55aa4 100644
--- a/src/devices/bus/electron/cart/ap34.cpp
+++ b/src/devices/bus/electron/cart/ap34.cpp
@@ -47,7 +47,7 @@ void ap34_floppies(device_slot_interface &device)
void electron_ap34_device::device_add_mconfig(machine_config &config)
{
/* fdc */
- WD1770(config, m_fdc, DERIVED_CLOCK(1, 2));
+ WD1770(config, m_fdc, 16_MHz_XTAL / 2);
FLOPPY_CONNECTOR(config, m_floppy0, ap34_floppies, "525qd", electron_ap34_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_floppy1, ap34_floppies, nullptr, electron_ap34_device::floppy_formats).enable_sound(true);
}
@@ -81,9 +81,9 @@ void electron_ap34_device::device_start()
// read - cartridge data read
//-------------------------------------------------
-uint8_t electron_ap34_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
+uint8_t electron_ap34_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
{
- uint8_t data = 0xff;
+ uint8_t data = 0xfe;
if (infc)
{
@@ -97,15 +97,17 @@ uint8_t electron_ap34_device::read(offs_t offset, int infc, int infd, int romqa,
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
- if (m_ram.size() != 0 && romqa == 0 && offset >= 0x3000)
+ if (offset >= 0x0000 && offset < 0x4000)
{
- data = m_ram[offset & 0x0fff];
+ data = m_rom[(offset & 0x3fff) + (romqa * 0x4000)];
}
- else
+
+ if (m_ram.size() != 0 && romqa == 0 && offset >= 0x3000)
{
- data = m_rom[(offset & 0x3fff) | (romqa << 14)];
+ data = m_ram[offset & 0x0fff];
}
}
@@ -116,14 +118,14 @@ uint8_t electron_ap34_device::read(offs_t offset, int infc, int infd, int romqa,
// write - cartridge data write
//-------------------------------------------------
-void electron_ap34_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
+void electron_ap34_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
{
if (infc)
{
switch (offset & 0xff)
{
case 0xc0:
- wd1770_control_w(data);
+ wd1770_control_w(space, 0, data);
break;
case 0xc4:
case 0xc5:
@@ -133,7 +135,8 @@ void electron_ap34_device::write(offs_t offset, uint8_t data, int infc, int infd
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
if (m_ram.size() != 0 && romqa == 0 && offset >= 0x3000)
{
@@ -147,7 +150,7 @@ void electron_ap34_device::write(offs_t offset, uint8_t data, int infc, int infd
// IMPLEMENTATION
//**************************************************************************
-void electron_ap34_device::wd1770_control_w(uint8_t data)
+WRITE8_MEMBER(electron_ap34_device::wd1770_control_w)
{
floppy_image_device *floppy = nullptr;
@@ -164,7 +167,6 @@ void electron_ap34_device::wd1770_control_w(uint8_t data)
m_fdc->dden_w(BIT(data, 3));
// bit 4: NMI - not connected
- //m_slot->nmi_w(!BIT(data, 4));
// bit 5: reset
if (!BIT(data, 5)) m_fdc->soft_reset();
diff --git a/src/devices/bus/electron/cart/ap34.h b/src/devices/bus/electron/cart/ap34.h
index 69b47514487..b3fb911b8f6 100644
--- a/src/devices/bus/electron/cart/ap34.h
+++ b/src/devices/bus/electron/cart/ap34.h
@@ -36,11 +36,11 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override;
private:
- void wd1770_control_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER(wd1770_control_w);
DECLARE_FLOPPY_FORMATS(floppy_formats);
required_device<wd1770_device> m_fdc;
diff --git a/src/devices/bus/electron/cart/ap5.cpp b/src/devices/bus/electron/cart/ap5.cpp
deleted file mode 100644
index 660587c7642..00000000000
--- a/src/devices/bus/electron/cart/ap5.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- ACP Advanced Plus 5
-
-**********************************************************************/
-
-
-#include "emu.h"
-#include "ap5.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(ELECTRON_AP5, electron_ap5_device, "electron_ap5", "P.R.E.S. Advanced Plus 5")
-
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void electron_ap5_device::device_add_mconfig(machine_config &config)
-{
- /* rom sockets */
- GENERIC_SOCKET(config, m_romslot[0], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 14
- m_romslot[0]->set_device_load(device_image_load_delegate(&electron_ap5_device::device_image_load_rom1_load, this));
- GENERIC_SOCKET(config, m_romslot[1], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 15
- m_romslot[1]->set_device_load(device_image_load_delegate(&electron_ap5_device::device_image_load_rom2_load, this));
-
- /* via */
- VIA6522(config, m_via, DERIVED_CLOCK(1, 16));
- m_via->readpb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_r));
- m_via->writepb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_w));
- m_via->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
-
- /* user port */
- BBC_USERPORT_SLOT(config, m_userport, bbc_userport_devices, nullptr);
- m_userport->cb1_handler().set(m_via, FUNC(via6522_device::write_cb1));
- m_userport->cb2_handler().set(m_via, FUNC(via6522_device::write_cb2));
-
- /* 1mhz bus port */
- BBC_1MHZBUS_SLOT(config, m_1mhzbus, DERIVED_CLOCK(1, 16), bbc_1mhzbus_devices, nullptr);
- m_1mhzbus->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
- m_1mhzbus->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::nmi_w));
-
- /* tube port */
- BBC_TUBE_SLOT(config, m_tube, electron_tube_devices, nullptr);
- m_tube->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
-}
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// electron_ap5_device - constructor
-//-------------------------------------------------
-
-electron_ap5_device::electron_ap5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ELECTRON_AP5, tag, owner, clock)
- , device_electron_cart_interface(mconfig, *this)
- , m_via(*this, "via6522")
- , m_tube(*this, "tube")
- , m_1mhzbus(*this, "1mhzbus")
- , m_userport(*this, "userport")
- , m_romslot(*this, "rom%u", 1)
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void electron_ap5_device::device_start()
-{
-}
-
-//-------------------------------------------------
-// read - cartridge data read
-//-------------------------------------------------
-
-uint8_t electron_ap5_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
-{
- uint8_t data = 0xff;
-
- if (infc)
- {
- data = m_1mhzbus->fred_r(offset);
-
- switch (offset & 0xf0)
- {
- case 0xb0:
- data &= m_via->read(offset & 0x0f);
- break;
-
- case 0xe0:
- data &= m_tube->host_r(offset & 0x0f);
- break;
- }
- }
- else if (infd)
- {
- data = m_1mhzbus->jim_r(offset);
- }
- else if (oe)
- {
- data = m_romslot[romqa]->read_rom(offset & 0x3fff);
- }
- else if (oe2)
- {
- data = m_rom[offset & 0x1fff];
- }
-
- return data;
-}
-
-//-------------------------------------------------
-// write - cartridge data write
-//-------------------------------------------------
-
-void electron_ap5_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
-{
- if (infc)
- {
- m_1mhzbus->fred_w(offset, data);
-
- switch (offset & 0xf0)
- {
- case 0xb0:
- m_via->write(offset & 0x0f, data);
- break;
-
- case 0xe0:
- m_tube->host_w(offset & 0x0f, data);
- break;
- }
- }
- else if (infd)
- {
- m_1mhzbus->jim_w(offset, data);
- }
-}
-
-
-//**************************************************************************
-// IMPLEMENTATION
-//**************************************************************************
-
-image_init_result electron_ap5_device::load_rom(device_image_interface &image, generic_slot_device *slot)
-{
- uint32_t size = slot->common_get_size("rom");
-
- // socket accepts 8K and 16K ROM only
- if (size != 0x2000 && size != 0x4000)
- {
- image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size: Only 8K/16K is supported");
- return image_init_result::FAIL;
- }
-
- slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
- slot->common_load_rom(slot->get_rom_base(), size, "rom");
-
- // mirror 8K ROMs
- uint8_t *crt = slot->get_rom_base();
- if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000);
-
- return image_init_result::PASS;
-}
diff --git a/src/devices/bus/electron/cart/ap5.h b/src/devices/bus/electron/cart/ap5.h
deleted file mode 100644
index 846f3fbc649..00000000000
--- a/src/devices/bus/electron/cart/ap5.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- ACP Advanced Plus 5
-
-**********************************************************************/
-
-#ifndef MAME_BUS_ELECTRON_CART_AP5_H
-#define MAME_BUS_ELECTRON_CART_AP5_H
-
-#include "slot.h"
-#include "machine/6522via.h"
-#include "bus/bbc/1mhzbus/1mhzbus.h"
-#include "bus/bbc/tube/tube.h"
-#include "bus/bbc/userport/userport.h"
-#include "bus/generic/slot.h"
-#include "bus/generic/carts.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-class electron_ap5_device :
- public device_t,
- public device_electron_cart_interface
-{
-public:
- // construction/destruction
- electron_ap5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
-
- // optional information overrides
- virtual void device_add_mconfig(machine_config &config) override;
-
- // electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
-
-private:
- image_init_result load_rom(device_image_interface &image, generic_slot_device *slot);
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_romslot[0]); }
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_romslot[1]); }
-
- required_device<via6522_device> m_via;
- required_device<bbc_tube_slot_device> m_tube;
- required_device<bbc_1mhzbus_slot_device> m_1mhzbus;
- required_device<bbc_userport_slot_device> m_userport;
- required_device_array<generic_slot_device, 2> m_romslot;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(ELECTRON_AP5, electron_ap5_device)
-
-
-#endif // MAME_BUS_ELECTRON_CART_AP5_H
diff --git a/src/devices/bus/electron/cart/aqr.cpp b/src/devices/bus/electron/cart/aqr.cpp
index 8be0176efc4..8a3edebd194 100644
--- a/src/devices/bus/electron/cart/aqr.cpp
+++ b/src/devices/bus/electron/cart/aqr.cpp
@@ -48,13 +48,16 @@ void electron_aqr_device::device_start()
// read - cartridge data read
//-------------------------------------------------
-uint8_t electron_aqr_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
+uint8_t electron_aqr_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
{
uint8_t data = 0xff;
- if (oe)
+ if (!infc && !infd)
{
- data = m_ram[(offset & 0x3fff) | (m_page_register << 14)];
+ if (offset >= 0x0000 && offset < 0x4000)
+ {
+ data = m_ram[(offset & 0x3fff) | (m_page_register << 14)];
+ }
}
return data;
@@ -64,7 +67,7 @@ uint8_t electron_aqr_device::read(offs_t offset, int infc, int infd, int romqa,
// write - cartridge data write
//-------------------------------------------------
-void electron_aqr_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
+void electron_aqr_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
{
if (infc)
{
@@ -81,8 +84,12 @@ void electron_aqr_device::write(offs_t offset, uint8_t data, int infc, int infd,
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
- m_ram[(offset & 0x3fff) | (m_page_register << 14)] = data;
+ if (offset >= 0x0000 && offset < 0x4000 && !m_lock_register)
+ {
+ m_ram[(offset & 0x3fff) | (m_page_register << 14)] = data;
+ }
}
}
diff --git a/src/devices/bus/electron/cart/aqr.h b/src/devices/bus/electron/cart/aqr.h
index 820f967b5cf..6ede0b8144d 100644
--- a/src/devices/bus/electron/cart/aqr.h
+++ b/src/devices/bus/electron/cart/aqr.h
@@ -32,8 +32,8 @@ protected:
virtual void device_start() override;
// electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override;
private:
uint8_t m_page_register;
diff --git a/src/devices/bus/electron/cart/click.cpp b/src/devices/bus/electron/cart/click.cpp
index bdeebeba79b..a4a0bfd5af2 100644
--- a/src/devices/bus/electron/cart/click.cpp
+++ b/src/devices/bus/electron/cart/click.cpp
@@ -27,7 +27,7 @@ void electron_click_device::device_add_mconfig(machine_config &config)
{
/* rtc */
MC146818(config, m_rtc, 32.768_kHz_XTAL);
- m_rtc->irq().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
+ m_rtc->irq().set(FUNC(electron_click_device::irq_w));
}
//-------------------------------------------------
@@ -88,7 +88,7 @@ void electron_click_device::device_reset()
// read - cartridge data read
//-------------------------------------------------
-uint8_t electron_click_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
+uint8_t electron_click_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
{
uint8_t data = 0xff;
@@ -98,14 +98,15 @@ uint8_t electron_click_device::read(offs_t offset, int infc, int infd, int romqa
{
case 0xf8:
case 0xf9:
- data = m_rtc->read(offset & 0x01);
+ data = m_rtc->read(space, offset & 0x01);
break;
case 0xfc:
data = m_page_register;
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
offs_t rom_page_offset = (m_page_register & 0x03) * 0x2000;
offs_t ram_page_offset = ((m_page_register & 0x0c) >> 2) * 0x2000;
@@ -127,7 +128,7 @@ uint8_t electron_click_device::read(offs_t offset, int infc, int infd, int romqa
// write - cartridge data write
//-------------------------------------------------
-void electron_click_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
+void electron_click_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
{
if (infc)
{
@@ -135,14 +136,15 @@ void electron_click_device::write(offs_t offset, uint8_t data, int infc, int inf
{
case 0xf8:
case 0xf9:
- m_rtc->write(offset & 0x01, data);
+ m_rtc->write(space, offset & 0x01, data);
break;
case 0xfc:
m_page_register = data;
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
offs_t ram_page_offset = ((m_page_register & 0x0c) >> 2) * 0x2000;
@@ -164,3 +166,8 @@ INPUT_CHANGED_MEMBER(electron_click_device::click_button)
m_slot->irq_w(CLEAR_LINE);
}
}
+
+WRITE_LINE_MEMBER(electron_click_device::irq_w)
+{
+ m_slot->irq_w(state);
+}
diff --git a/src/devices/bus/electron/cart/click.h b/src/devices/bus/electron/cart/click.h
index cb7dd114687..5fbc18d4759 100644
--- a/src/devices/bus/electron/cart/click.h
+++ b/src/devices/bus/electron/cart/click.h
@@ -41,10 +41,12 @@ protected:
virtual void device_reset() override;
// electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override;
private:
+ DECLARE_WRITE_LINE_MEMBER(irq_w);
+
required_device<mc146818_device> m_rtc;
uint8_t m_page_register;
diff --git a/src/devices/bus/electron/cart/cumana.cpp b/src/devices/bus/electron/cart/cumana.cpp
index 8792395b503..80ebeab394b 100644
--- a/src/devices/bus/electron/cart/cumana.cpp
+++ b/src/devices/bus/electron/cart/cumana.cpp
@@ -48,13 +48,12 @@ void cumana_floppies(device_slot_interface &device)
void electron_cumana_device::device_add_mconfig(machine_config &config)
{
/* fdc */
- FD1793(config, m_fdc, DERIVED_CLOCK(1, 16)); // TODO: Not known whether DRQ and INTRQ are connected
+ FD1793(config, m_fdc, 16_MHz_XTAL / 16); // TODO: Not known whether DRQ and INTRQ are connected
FLOPPY_CONNECTOR(config, m_floppy0, cumana_floppies, "525qd", electron_cumana_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_floppy1, cumana_floppies, nullptr, electron_cumana_device::floppy_formats).enable_sound(true);
/* rtc */
MC146818(config, m_rtc, 32.768_kHz_XTAL);
- m_rtc->irq().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
}
//**************************************************************************
@@ -87,7 +86,7 @@ void electron_cumana_device::device_start()
// read - cartridge data read
//-------------------------------------------------
-uint8_t electron_cumana_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
+uint8_t electron_cumana_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
{
uint8_t data = 0xff;
@@ -103,11 +102,12 @@ uint8_t electron_cumana_device::read(offs_t offset, int infc, int infd, int romq
break;
case 0x98:
case 0x9c:
- data = m_rtc->read(BIT(offset, 2));
+ data = m_rtc->read(space, BIT(offset, 2));
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
switch (romqa)
{
@@ -134,7 +134,7 @@ uint8_t electron_cumana_device::read(offs_t offset, int infc, int infd, int romq
// write - cartridge data write
//-------------------------------------------------
-void electron_cumana_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
+void electron_cumana_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
{
if (infc)
{
@@ -147,15 +147,17 @@ void electron_cumana_device::write(offs_t offset, uint8_t data, int infc, int in
m_fdc->write(offset & 0x03, data);
break;
case 0x94:
- wd1793_control_w(data);
+ wd1793_control_w(space, 0, data);
break;
case 0x98:
case 0x9c:
- m_rtc->write(BIT(offset, 2), data);
+ m_rtc->write(space, BIT(offset, 2), data);
+ break;
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
if (romqa == 0 && offset >= 0x3800)
{
@@ -169,7 +171,7 @@ void electron_cumana_device::write(offs_t offset, uint8_t data, int infc, int in
// IMPLEMENTATION
//**************************************************************************
-void electron_cumana_device::wd1793_control_w(uint8_t data)
+WRITE8_MEMBER(electron_cumana_device::wd1793_control_w)
{
floppy_image_device *floppy = nullptr;
diff --git a/src/devices/bus/electron/cart/cumana.h b/src/devices/bus/electron/cart/cumana.h
index 9a3bc2ab834..9092f82bd65 100644
--- a/src/devices/bus/electron/cart/cumana.h
+++ b/src/devices/bus/electron/cart/cumana.h
@@ -37,11 +37,11 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override;
private:
- void wd1793_control_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER(wd1793_control_w);
DECLARE_FLOPPY_FORMATS(floppy_formats);
required_device<fd1793_device> m_fdc;
diff --git a/src/devices/bus/electron/cart/mgc.cpp b/src/devices/bus/electron/cart/mgc.cpp
index 5f80559c47a..41cc29dfbfb 100644
--- a/src/devices/bus/electron/cart/mgc.cpp
+++ b/src/devices/bus/electron/cart/mgc.cpp
@@ -65,14 +65,17 @@ void electron_mgc_device::device_reset()
// read - cartridge data read
//-------------------------------------------------
-uint8_t electron_mgc_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
+uint8_t electron_mgc_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
{
uint8_t data = 0xff;
- if (oe)
+ if (!infc && !infd)
{
- int m_page_mode = BIT(m_control_latch, 2) ? BIT(m_control_latch, 1) : !romqa;
- data = m_nvram[(offset & 0x3fff) | (m_page_latch << 14) | (m_page_mode << 21)];
+ if (offset >= 0x0000 && offset < 0x4000)
+ {
+ int m_page_mode = BIT(m_control_latch, 2) ? BIT(m_control_latch, 1) : !romqa;
+ data = m_nvram[(offset & 0x3fff) | (m_page_latch << 14) | (m_page_mode << 21)];
+ }
}
return data;
@@ -82,7 +85,7 @@ uint8_t electron_mgc_device::read(offs_t offset, int infc, int infd, int romqa,
// write - cartridge data write
//-------------------------------------------------
-void electron_mgc_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
+void electron_mgc_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
{
if (infc)
{
@@ -97,9 +100,13 @@ void electron_mgc_device::write(offs_t offset, uint8_t data, int infc, int infd,
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
- int m_page_mode = BIT(m_control_latch, 2) ? BIT(m_control_latch, 1) : !romqa;
- m_nvram[(offset & 0x3fff) | (m_page_latch << 14) | (m_page_mode << 21)] = data;
+ if (offset >= 0x0000 && offset < 0x4000 && BIT(m_control_latch, 0))
+ {
+ int m_page_mode = BIT(m_control_latch, 2) ? BIT(m_control_latch, 1) : !romqa;
+ m_nvram[(offset & 0x3fff) | (m_page_latch << 14) | (m_page_mode << 21)] = data;
+ }
}
}
diff --git a/src/devices/bus/electron/cart/mgc.h b/src/devices/bus/electron/cart/mgc.h
index bf23aa34391..8835a703107 100644
--- a/src/devices/bus/electron/cart/mgc.h
+++ b/src/devices/bus/electron/cart/mgc.h
@@ -33,8 +33,8 @@ protected:
virtual void device_reset() override;
// electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override;
private:
uint8_t m_page_latch;
diff --git a/src/devices/bus/electron/cart/peg400.cpp b/src/devices/bus/electron/cart/peg400.cpp
index abca703474a..8d92131aa04 100644
--- a/src/devices/bus/electron/cart/peg400.cpp
+++ b/src/devices/bus/electron/cart/peg400.cpp
@@ -44,7 +44,7 @@ void peg400_floppies(device_slot_interface &device)
void electron_peg400_device::device_add_mconfig(machine_config &config)
{
/* fdc */
- WD1770(config, m_fdc, DERIVED_CLOCK(1, 2));
+ WD1770(config, m_fdc, 16_MHz_XTAL / 2);
m_fdc->drq_wr_callback().set(FUNC(electron_peg400_device::fdc_drq_w));
FLOPPY_CONNECTOR(config, m_floppy0, peg400_floppies, "525qd", electron_peg400_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_floppy1, peg400_floppies, nullptr, electron_peg400_device::floppy_formats).enable_sound(true);
@@ -79,7 +79,7 @@ void electron_peg400_device::device_start()
// read - cartridge data read
//-------------------------------------------------
-uint8_t electron_peg400_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
+uint8_t electron_peg400_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
{
uint8_t data = 0xff;
@@ -95,14 +95,15 @@ uint8_t electron_peg400_device::read(offs_t offset, int infc, int infd, int romq
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
switch (romqa)
{
case 0:
if (offset < 0x3800)
{
- data = m_rom[(offset & 0x3fff) | (romqa << 14)];
+ data = m_rom[(offset & 0x3fff) + (romqa * 0x4000)];
}
else
{
@@ -110,7 +111,7 @@ uint8_t electron_peg400_device::read(offs_t offset, int infc, int infd, int romq
}
break;
case 1:
- data = m_rom[(offset & 0x3fff) | (romqa << 14)];
+ data = m_rom[(offset & 0x3fff) + (romqa * 0x4000)];
break;
}
}
@@ -122,14 +123,14 @@ uint8_t electron_peg400_device::read(offs_t offset, int infc, int infd, int romq
// write - cartridge data write
//-------------------------------------------------
-void electron_peg400_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
+void electron_peg400_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
{
if (infc)
{
switch (offset & 0xff)
{
case 0xc0:
- wd1770_control_w(data);
+ wd1770_control_w(space, 0, data);
break;
case 0xc4:
case 0xc5:
@@ -139,7 +140,8 @@ void electron_peg400_device::write(offs_t offset, uint8_t data, int infc, int in
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
if (romqa == 0 && offset >= 0x3800)
{
@@ -153,7 +155,7 @@ void electron_peg400_device::write(offs_t offset, uint8_t data, int infc, int in
// IMPLEMENTATION
//**************************************************************************
-void electron_peg400_device::wd1770_control_w(uint8_t data)
+WRITE8_MEMBER(electron_peg400_device::wd1770_control_w)
{
floppy_image_device *floppy = nullptr;
diff --git a/src/devices/bus/electron/cart/peg400.h b/src/devices/bus/electron/cart/peg400.h
index 035947a1e59..8b7a7af9b44 100644
--- a/src/devices/bus/electron/cart/peg400.h
+++ b/src/devices/bus/electron/cart/peg400.h
@@ -34,11 +34,11 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override;
private:
- void wd1770_control_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER(wd1770_control_w);
DECLARE_FLOPPY_FORMATS(floppy_formats);
DECLARE_WRITE_LINE_MEMBER(fdc_drq_w);
diff --git a/src/devices/bus/electron/cart/romp144.cpp b/src/devices/bus/electron/cart/romp144.cpp
deleted file mode 100644
index 6e4eb96bd84..00000000000
--- a/src/devices/bus/electron/cart/romp144.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- JAFA Systems ROMPlus-144
-
-**********************************************************************/
-
-
-#include "emu.h"
-#include "romp144.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(ELECTRON_ROMP144, electron_romp144_device, "electron_romp144", "JAFA Systems ROMPlus-144")
-
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void electron_romp144_device::device_add_mconfig(machine_config &config)
-{
- /* rom sockets */
- GENERIC_SOCKET(config, m_romslot[0], generic_plain_slot, "electron_rom", "bin,rom");
- m_romslot[0]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom0, this));
- GENERIC_SOCKET(config, m_romslot[1], generic_plain_slot, "electron_rom", "bin,rom");
- m_romslot[1]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom1, this));
- GENERIC_SOCKET(config, m_romslot[2], generic_plain_slot, "electron_rom", "bin,rom");
- m_romslot[2]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom2, this));
- GENERIC_SOCKET(config, m_romslot[3], generic_plain_slot, "electron_rom", "bin,rom");
- m_romslot[3]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom3, this));
- GENERIC_SOCKET(config, m_romslot[4], generic_plain_slot, "electron_rom", "bin,rom");
- m_romslot[4]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom4, this));
- GENERIC_SOCKET(config, m_romslot[5], generic_plain_slot, "electron_rom", "bin,rom");
- m_romslot[5]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom5, this));
- GENERIC_SOCKET(config, m_romslot[6], generic_plain_slot, "electron_rom", "bin,rom");
- m_romslot[6]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom6, this));
-}
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// electron_romp144_device - constructor
-//-------------------------------------------------
-
-electron_romp144_device::electron_romp144_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ELECTRON_ROMP144, tag, owner, clock)
- , device_electron_cart_interface(mconfig, *this)
- , m_romslot(*this, "rom%u", 7)
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void electron_romp144_device::device_start()
-{
- m_rom_select = 0xff;
- m_rom_latch = 0xff;
-
- save_item(NAME(m_rom_select));
- save_item(NAME(m_rom_latch));
-}
-
-//-------------------------------------------------
-// read - cartridge data read
-//-------------------------------------------------
-
-uint8_t electron_romp144_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
-{
- uint8_t data = 0xff;
-
- if (oe)
- {
- if (romqa)
- {
- if ((m_rom_select & 0x07) == 0x00)
- data = m_ram[offset & 0x3fff];
- else
- data = m_romslot[(m_rom_select & 0x07) - 1]->read_rom(offset & 0x3fff);
- }
- else
- {
- if ((m_rom_select & 0x0f) == 0x08)
- data = m_ram[(offset & 0x3fff) | 0x4000];
- else
- data = m_rom[offset & 0x1fff];
-
- /* roms selected with a read to latch */
- if ((offset & 0x3f00) == 0x3f00)
- {
- m_rom_latch = offset & 0x0f;
- }
- }
- }
-
- return data;
-}
-
-//-------------------------------------------------
-// write - cartridge data write
-//-------------------------------------------------
-
-void electron_romp144_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
-{
- if (oe)
- {
- if (romqa)
- {
- if ((m_rom_select & 0x07) == 0x00)
- m_ram[offset & 0x3fff] = data;
- }
- else
- {
- if ((m_rom_select & 0x0f) == 0x08)
- m_ram[(offset & 0x3fff) | 0x4000] = data;
-
- /* roms selected with a write to select */
- if ((offset & 0x3f00) == 0x3f00)
- {
- /* does the write match the read (upper RAM cannot be de-selected to protect *RSUBSTITUTE) */
- if (m_rom_latch == (offset & 0x0f) && m_rom_select != 0x08)
- {
- m_rom_select = m_rom_latch;
- }
- }
- }
- }
-}
-
-
-//**************************************************************************
-// IMPLEMENTATION
-//**************************************************************************
-
-image_init_result electron_romp144_device::load_rom(device_image_interface &image, generic_slot_device *slot)
-{
- uint32_t size = slot->common_get_size("rom");
-
- // socket accepts 8K and 16K ROM only
- if (size != 0x2000 && size != 0x4000)
- {
- image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size: Only 8K/16K is supported");
- return image_init_result::FAIL;
- }
-
- slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
- slot->common_load_rom(slot->get_rom_base(), size, "rom");
-
- // mirror 8K ROMs
- uint8_t *crt = slot->get_rom_base();
- if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000);
-
- return image_init_result::PASS;
-}
diff --git a/src/devices/bus/electron/cart/romp144.h b/src/devices/bus/electron/cart/romp144.h
deleted file mode 100644
index 45916a3ab38..00000000000
--- a/src/devices/bus/electron/cart/romp144.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- JAFA Systems ROMPlus-144
-
-**********************************************************************/
-
-#ifndef MAME_BUS_ELECTRON_CART_ROMP144_H
-#define MAME_BUS_ELECTRON_CART_ROMP144_H
-
-#include "slot.h"
-#include "bus/generic/slot.h"
-#include "bus/generic/carts.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-class electron_romp144_device :
- public device_t,
- public device_electron_cart_interface
-{
-public:
- // construction/destruction
- electron_romp144_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
-
- // optional information overrides
- virtual void device_add_mconfig(machine_config &config) override;
-
- // electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
-
-private:
- image_init_result load_rom(device_image_interface &image, generic_slot_device *slot);
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom0) { return load_rom(image, m_romslot[0]); }
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1) { return load_rom(image, m_romslot[1]); }
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2) { return load_rom(image, m_romslot[2]); }
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3) { return load_rom(image, m_romslot[3]); }
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom4) { return load_rom(image, m_romslot[4]); }
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom5) { return load_rom(image, m_romslot[5]); }
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom6) { return load_rom(image, m_romslot[6]); }
-
- required_device_array<generic_slot_device, 7> m_romslot;
-
- uint8_t m_rom_select;
- uint8_t m_rom_latch;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(ELECTRON_ROMP144, electron_romp144_device)
-
-
-#endif // MAME_BUS_ELECTRON_CART_ROMP144_H
diff --git a/src/devices/bus/electron/cart/slot.cpp b/src/devices/bus/electron/cart/slot.cpp
index f8682b9c654..aae2f65594d 100644
--- a/src/devices/bus/electron/cart/slot.cpp
+++ b/src/devices/bus/electron/cart/slot.cpp
@@ -100,6 +100,14 @@ electron_cartslot_device::electron_cartslot_device(const machine_config &mconfig
}
//-------------------------------------------------
+// electron_cartslot_device - destructor
+//-------------------------------------------------
+
+electron_cartslot_device::~electron_cartslot_device()
+{
+}
+
+//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -229,13 +237,13 @@ std::string electron_cartslot_device::get_default_card_software(get_default_card
// read - cartridge read
//-------------------------------------------------
-uint8_t electron_cartslot_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
+uint8_t electron_cartslot_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
{
uint8_t data = 0xff;
if (m_cart != nullptr)
{
- data = m_cart->read(offset, infc, infd, romqa, oe, oe2);
+ data = m_cart->read(space, offset, infc, infd, romqa);
}
return data;
@@ -245,11 +253,11 @@ uint8_t electron_cartslot_device::read(offs_t offset, int infc, int infd, int ro
// write - cartridge write
//-------------------------------------------------
-void electron_cartslot_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
+void electron_cartslot_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
{
if (m_cart != nullptr)
{
- m_cart->write(offset, data, infc, infd, romqa, oe, oe2);
+ m_cart->write(space, offset, data, infc, infd, romqa);
}
}
@@ -260,20 +268,15 @@ void electron_cartslot_device::write(offs_t offset, uint8_t data, int infc, int
#include "abr.h"
#include "ap34.h"
-#include "ap5.h"
#include "aqr.h"
#include "click.h"
#include "cumana.h"
#include "mgc.h"
#include "peg400.h"
-//#include "pmse2p.h"
-#include "romp144.h"
-//#include "rs423.h"
#include "sndexp.h"
#include "sndexp3.h"
#include "sp64.h"
#include "stlefs.h"
-#include "tube.h"
#include "std.h"
@@ -282,18 +285,13 @@ void electron_cart(device_slot_interface &device)
device.option_add_internal("std", ELECTRON_STDCART);
device.option_add_internal("abr", ELECTRON_ABR);
device.option_add_internal("ap34", ELECTRON_AP34);
- device.option_add_internal("ap5", ELECTRON_AP5);
device.option_add_internal("aqr", ELECTRON_AQR);
device.option_add_internal("click", ELECTRON_CLICK);
device.option_add_internal("cumana", ELECTRON_CUMANA);
device.option_add_internal("mgc", ELECTRON_MGC);
device.option_add_internal("peg400", ELECTRON_PEG400);
- //device.option_add_internal("pmse2p", ELECTRON_PMSE2P);
- device.option_add_internal("romp144", ELECTRON_ROMP144);
- //device.option_add_internal("rs423", ELECTRON_RS423);
device.option_add_internal("sndexp", ELECTRON_SNDEXP);
device.option_add_internal("sndexp3", ELECTRON_SNDEXP3);
device.option_add_internal("sp64", ELECTRON_SP64);
device.option_add_internal("stlefs", ELECTRON_STLEFS);
- device.option_add_internal("tube", ELECTRON_TUBE);
}
diff --git a/src/devices/bus/electron/cart/slot.h b/src/devices/bus/electron/cart/slot.h
index d31bc16258c..9e4b66182f1 100644
--- a/src/devices/bus/electron/cart/slot.h
+++ b/src/devices/bus/electron/cart/slot.h
@@ -105,6 +105,16 @@
#define ELECTRON_CART_ROM_REGION_TAG ":cart:rom"
+#define MCFG_ELECTRON_CARTSLOT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, ELECTRON_CARTSLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+#define MCFG_ELECTRON_CARTSLOT_IRQ_HANDLER(_devcb) \
+ downcast<electron_cartslot_device &>(*device).set_irq_handler(DEVCB_##_devcb);
+
+#define MCFG_ELECTRON_CARTSLOT_NMI_HANDLER(_devcb) \
+ downcast<electron_cartslot_device &>(*device).set_nmi_handler(DEVCB_##_devcb);
+
//**************************************************************************
// TYPE DEFINITIONS
@@ -120,21 +130,12 @@ class electron_cartslot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- electron_cartslot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock, T &&slot_options, const char *default_option)
- : electron_cartslot_device(mconfig, tag, owner, clock)
- {
- option_reset();
- slot_options(*this);
- set_default_option(default_option);
- set_fixed(false);
- }
-
electron_cartslot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ virtual ~electron_cartslot_device();
// callbacks
- auto irq_handler() { return m_irq_handler.bind(); }
- auto nmi_handler() { return m_nmi_handler.bind(); }
+ template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_nmi_handler(Object &&cb) { return m_nmi_handler.set_callback(std::forward<Object>(cb)); }
// device-level overrides
virtual void device_start() override;
@@ -158,8 +159,8 @@ public:
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
// reading and writing
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2);
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2);
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa);
+ virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa);
DECLARE_WRITE_LINE_MEMBER(irq_w) { m_irq_handler(state); }
DECLARE_WRITE_LINE_MEMBER(nmi_w) { m_nmi_handler(state); }
@@ -182,8 +183,8 @@ public:
virtual ~device_electron_cart_interface();
// reading and writing
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) { return 0xff; }
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) { }
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) { return 0xff; }
+ virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) { }
void rom_alloc(uint32_t size, const char *tag);
void ram_alloc(uint32_t size);
diff --git a/src/devices/bus/electron/cart/sndexp.cpp b/src/devices/bus/electron/cart/sndexp.cpp
index 4ba27cb4825..de0c7704020 100644
--- a/src/devices/bus/electron/cart/sndexp.cpp
+++ b/src/devices/bus/electron/cart/sndexp.cpp
@@ -27,13 +27,11 @@ DEFINE_DEVICE_TYPE(ELECTRON_SNDEXP, electron_sndexp_device, "electron_sndexp", "
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void electron_sndexp_device::device_add_mconfig(machine_config &config)
-{
- /* sound hardware */
+MACHINE_CONFIG_START(electron_sndexp_device::device_add_mconfig)
SPEAKER(config, "mono").front_center();
- SN76489(config, m_sn, DERIVED_CLOCK(1, 4));
- m_sn->add_route(ALL_OUTPUTS, "mono", 1.0);
-}
+ MCFG_DEVICE_ADD("sn76489", SN76489, 16_MHz_XTAL / 4)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+MACHINE_CONFIG_END
//-------------------------------------------------
// INPUT_PORTS( sndexp )
@@ -89,11 +87,11 @@ void electron_sndexp_device::device_start()
// read - cartridge data read
//-------------------------------------------------
-uint8_t electron_sndexp_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
+uint8_t electron_sndexp_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
{
uint8_t data = 0xff;
- if (oe)
+ if (!infc && !infd)
{
if (m_jumper->read())
{
@@ -126,7 +124,7 @@ uint8_t electron_sndexp_device::read(offs_t offset, int infc, int infd, int romq
// write - cartridge data write
//-------------------------------------------------
-void electron_sndexp_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
+void electron_sndexp_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
{
if (infc)
{
@@ -144,7 +142,8 @@ void electron_sndexp_device::write(offs_t offset, uint8_t data, int infc, int in
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
if (m_jumper->read())
{
diff --git a/src/devices/bus/electron/cart/sndexp.h b/src/devices/bus/electron/cart/sndexp.h
index 5627c2ff734..87d94ba84a2 100644
--- a/src/devices/bus/electron/cart/sndexp.h
+++ b/src/devices/bus/electron/cart/sndexp.h
@@ -33,8 +33,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override;
private:
required_device<sn76489_device> m_sn;
diff --git a/src/devices/bus/electron/cart/sndexp3.cpp b/src/devices/bus/electron/cart/sndexp3.cpp
index afaf927e443..1bf32aa2fb4 100644
--- a/src/devices/bus/electron/cart/sndexp3.cpp
+++ b/src/devices/bus/electron/cart/sndexp3.cpp
@@ -23,13 +23,12 @@ DEFINE_DEVICE_TYPE(ELECTRON_SNDEXP3, electron_sndexp3_device, "electron_sndexp3"
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void electron_sndexp3_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(electron_sndexp3_device::device_add_mconfig)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- SN76489(config, m_sn, DERIVED_CLOCK(1, 4));
- m_sn->add_route(ALL_OUTPUTS, "mono", 1.0);
-}
+ MCFG_DEVICE_ADD("sn76489", SN76489, 16_MHz_XTAL / 4)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
@@ -62,11 +61,11 @@ void electron_sndexp3_device::device_start()
// read - cartridge data read
//-------------------------------------------------
-uint8_t electron_sndexp3_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
+uint8_t electron_sndexp3_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
{
uint8_t data = 0xff;
- if (oe && romqa)
+ if (!infc && !infd && romqa)
{
if (offset < 0x2000)
{
@@ -85,7 +84,7 @@ uint8_t electron_sndexp3_device::read(offs_t offset, int infc, int infd, int rom
// write - cartridge data write
//-------------------------------------------------
-void electron_sndexp3_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
+void electron_sndexp3_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
{
if (infc)
{
@@ -103,7 +102,8 @@ void electron_sndexp3_device::write(offs_t offset, uint8_t data, int infc, int i
break;
}
}
- else if (oe && romqa)
+
+ if (!infc && !infd && romqa)
{
if (offset >= 0x2000)
{
diff --git a/src/devices/bus/electron/cart/sndexp3.h b/src/devices/bus/electron/cart/sndexp3.h
index 95d437b63e2..2ad0869ca65 100644
--- a/src/devices/bus/electron/cart/sndexp3.h
+++ b/src/devices/bus/electron/cart/sndexp3.h
@@ -32,8 +32,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override;
private:
required_device<sn76489_device> m_sn;
diff --git a/src/devices/bus/electron/cart/sp64.cpp b/src/devices/bus/electron/cart/sp64.cpp
index 9b5d497999e..11db24fbba6 100644
--- a/src/devices/bus/electron/cart/sp64.cpp
+++ b/src/devices/bus/electron/cart/sp64.cpp
@@ -55,7 +55,7 @@ void electron_sp64_device::device_reset()
// read - cartridge data read
//-------------------------------------------------
-uint8_t electron_sp64_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
+uint8_t electron_sp64_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
{
uint8_t data = 0xff;
@@ -68,14 +68,15 @@ uint8_t electron_sp64_device::read(offs_t offset, int infc, int infd, int romqa,
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
- offs_t rom_page_offset = m_page_register << 14;
+ offs_t rom_page_offset = m_page_register * 0x4000;
switch (romqa)
{
case 0:
- data = m_rom[rom_page_offset | (offset & 0x3fff)];
+ data = m_rom[rom_page_offset + (offset & 0x3fff)];
break;
case 1:
data = m_ram[offset & 0x1fff];
@@ -90,7 +91,7 @@ uint8_t electron_sp64_device::read(offs_t offset, int infc, int infd, int romqa,
// write - cartridge data write
//-------------------------------------------------
-void electron_sp64_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
+void electron_sp64_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
{
if (infc)
{
@@ -101,7 +102,8 @@ void electron_sp64_device::write(offs_t offset, uint8_t data, int infc, int infd
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
if (romqa == 1)
{
diff --git a/src/devices/bus/electron/cart/sp64.h b/src/devices/bus/electron/cart/sp64.h
index 68954fc9d30..7e5de9f18f6 100644
--- a/src/devices/bus/electron/cart/sp64.h
+++ b/src/devices/bus/electron/cart/sp64.h
@@ -33,8 +33,8 @@ protected:
virtual void device_reset() override;
// electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override;
private:
uint8_t m_page_register;
diff --git a/src/devices/bus/electron/cart/std.cpp b/src/devices/bus/electron/cart/std.cpp
index f2b7333f347..b66e3b2ce0d 100644
--- a/src/devices/bus/electron/cart/std.cpp
+++ b/src/devices/bus/electron/cart/std.cpp
@@ -43,13 +43,13 @@ void electron_stdcart_device::device_start()
// read - cartridge data read
//-------------------------------------------------
-uint8_t electron_stdcart_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
+uint8_t electron_stdcart_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
{
uint8_t data = 0xff;
- if (oe)
+ if (!infc && !infd)
{
- data = m_rom[(offset & 0x3fff) | (romqa << 14)];
+ data = m_rom[(offset & 0x3fff) + (romqa * 0x4000)];
}
return data;
diff --git a/src/devices/bus/electron/cart/std.h b/src/devices/bus/electron/cart/std.h
index 3fc9cefbcd9..e81e5684ee2 100644
--- a/src/devices/bus/electron/cart/std.h
+++ b/src/devices/bus/electron/cart/std.h
@@ -31,7 +31,7 @@ protected:
virtual void device_start() override;
// electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override;
};
// device type definition
diff --git a/src/devices/bus/electron/cart/stlefs.cpp b/src/devices/bus/electron/cart/stlefs.cpp
index 47566871a9d..83dbf998f2a 100644
--- a/src/devices/bus/electron/cart/stlefs.cpp
+++ b/src/devices/bus/electron/cart/stlefs.cpp
@@ -47,9 +47,9 @@ void stlefs_floppies(device_slot_interface &device)
void electron_stlefs_device::device_add_mconfig(machine_config &config)
{
/* fdc */
- WD1770(config, m_fdc, DERIVED_CLOCK(1, 2));
- m_fdc->intrq_wr_callback().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
- m_fdc->drq_wr_callback().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::nmi_w));
+ WD1770(config, m_fdc, 16_MHz_XTAL / 2);
+ m_fdc->intrq_wr_callback().set(FUNC(electron_stlefs_device::fdc_intrq_w));
+ m_fdc->drq_wr_callback().set(FUNC(electron_stlefs_device::fdc_drq_w));
FLOPPY_CONNECTOR(config, m_floppy0, stlefs_floppies, "525qd", electron_stlefs_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_floppy1, stlefs_floppies, nullptr, electron_stlefs_device::floppy_formats).enable_sound(true);
}
@@ -83,7 +83,7 @@ void electron_stlefs_device::device_start()
// read - cartridge data read
//-------------------------------------------------
-uint8_t electron_stlefs_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
+uint8_t electron_stlefs_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
{
uint8_t data = 0xff;
@@ -99,9 +99,13 @@ uint8_t electron_stlefs_device::read(offs_t offset, int infc, int infd, int romq
break;
}
}
- else if (oe)
+
+ if (!infc && !infd)
{
- data = m_rom[(offset & 0x3fff) | (romqa << 14)];
+ if (offset >= 0x0000 && offset < 0x4000)
+ {
+ data = m_rom[(offset & 0x3fff) + (romqa * 0x4000)];
+ }
}
return data;
@@ -111,14 +115,14 @@ uint8_t electron_stlefs_device::read(offs_t offset, int infc, int infd, int romq
// write - cartridge data write
//-------------------------------------------------
-void electron_stlefs_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
+void electron_stlefs_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
{
if (infc)
{
switch (offset & 0xff)
{
case 0xc0:
- wd1770_control_w(data);
+ wd1770_control_w(space, 0, data);
break;
case 0xc4:
case 0xc5:
@@ -137,7 +141,7 @@ void electron_stlefs_device::write(offs_t offset, uint8_t data, int infc, int in
// IMPLEMENTATION
//**************************************************************************
-void electron_stlefs_device::wd1770_control_w(uint8_t data)
+WRITE8_MEMBER(electron_stlefs_device::wd1770_control_w)
{
floppy_image_device *floppy = nullptr;
@@ -156,3 +160,13 @@ void electron_stlefs_device::wd1770_control_w(uint8_t data)
// bit 5: reset
if (!BIT(data, 5)) m_fdc->soft_reset();
}
+
+void electron_stlefs_device::fdc_intrq_w(int state)
+{
+ m_slot->irq_w(state);
+}
+
+void electron_stlefs_device::fdc_drq_w(int state)
+{
+ m_slot->nmi_w(state);
+}
diff --git a/src/devices/bus/electron/cart/stlefs.h b/src/devices/bus/electron/cart/stlefs.h
index 421850943e2..2123261907a 100644
--- a/src/devices/bus/electron/cart/stlefs.h
+++ b/src/devices/bus/electron/cart/stlefs.h
@@ -36,11 +36,13 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
+ virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override;
private:
- void wd1770_control_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER(wd1770_control_w);
+ DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w);
+ DECLARE_WRITE_LINE_MEMBER(fdc_drq_w);
DECLARE_FLOPPY_FORMATS(floppy_formats);
required_device<wd1770_device> m_fdc;
diff --git a/src/devices/bus/electron/cart/tube.cpp b/src/devices/bus/electron/cart/tube.cpp
deleted file mode 100644
index 02dcd00275d..00000000000
--- a/src/devices/bus/electron/cart/tube.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- Acorn Electron Tube Interface
-
-**********************************************************************/
-
-
-#include "emu.h"
-#include "tube.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(ELECTRON_TUBE, electron_tube_device, "electron_tube", "Acorn Electron Tube Interface")
-
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void electron_tube_device::device_add_mconfig(machine_config &config)
-{
- /* tube port */
- BBC_TUBE_SLOT(config, m_tube, electron_tube_devices, nullptr);
- m_tube->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
-}
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// electron_tube_device - constructor
-//-------------------------------------------------
-
-electron_tube_device::electron_tube_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ELECTRON_TUBE, tag, owner, clock)
- , device_electron_cart_interface(mconfig, *this)
- , m_tube(*this, "tube")
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void electron_tube_device::device_start()
-{
-}
-
-//-------------------------------------------------
-// read - cartridge data read
-//-------------------------------------------------
-
-uint8_t electron_tube_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
-{
- uint8_t data = 0xff;
-
- if (infc)
- {
- if (offset >= 0xe0 && offset < 0xf0)
- {
- data = m_tube->host_r(offset & 0x0f);
- }
- }
- else if (oe2)
- {
- data = m_rom[offset & 0x1fff];
- }
-
- return data;
-}
-
-//-------------------------------------------------
-// write - cartridge data write
-//-------------------------------------------------
-
-void electron_tube_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
-{
- if (infc)
- {
- if (offset >= 0xe0 && offset < 0xf0)
- {
- m_tube->host_w(offset & 0x0f, data);
- }
- }
-}
diff --git a/src/devices/bus/electron/cart/tube.h b/src/devices/bus/electron/cart/tube.h
deleted file mode 100644
index 1d239ef5215..00000000000
--- a/src/devices/bus/electron/cart/tube.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- Acorn Electron Tube Interface
-
-**********************************************************************/
-
-#ifndef MAME_BUS_ELECTRON_CART_TUBE_H
-#define MAME_BUS_ELECTRON_CART_TUBE_H
-
-#include "slot.h"
-#include "bus/bbc/tube/tube.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-class electron_tube_device :
- public device_t,
- public device_electron_cart_interface
-{
-public:
- // construction/destruction
- electron_tube_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
-
- // optional information overrides
- virtual void device_add_mconfig(machine_config &config) override;
-
- // electron_cart_interface overrides
- virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
- virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
-
-private:
- required_device<bbc_tube_slot_device> m_tube;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(ELECTRON_TUBE, electron_tube_device)
-
-
-#endif // MAME_BUS_ELECTRON_CART_TUBE_H
diff --git a/src/devices/bus/electron/exp.cpp b/src/devices/bus/electron/exp.cpp
index d2cd0abc824..9d78af460a9 100644
--- a/src/devices/bus/electron/exp.cpp
+++ b/src/devices/bus/electron/exp.cpp
@@ -32,6 +32,15 @@ device_electron_expansion_interface::device_electron_expansion_interface(const m
}
+//-------------------------------------------------
+// ~device_electron_expansion_interface - destructor
+//-------------------------------------------------
+
+device_electron_expansion_interface::~device_electron_expansion_interface()
+{
+}
+
+
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
@@ -51,6 +60,15 @@ electron_expansion_slot_device::electron_expansion_slot_device(const machine_con
//-------------------------------------------------
+// expansion_slot_device - destructor
+//-------------------------------------------------
+
+electron_expansion_slot_device::~electron_expansion_slot_device()
+{
+}
+
+
+//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -75,13 +93,11 @@ void electron_expansion_slot_device::device_reset()
// expbus_r - expansion data read
//-------------------------------------------------
-uint8_t electron_expansion_slot_device::expbus_r(offs_t offset)
+uint8_t electron_expansion_slot_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
{
- uint8_t data = 0xff;
-
if (m_card != nullptr)
{
- data = m_card->expbus_r(offset);
+ data = m_card->expbus_r(space, offset, data);
}
return data;
@@ -91,11 +107,11 @@ uint8_t electron_expansion_slot_device::expbus_r(offs_t offset)
// expbus_w - expansion data write
//-------------------------------------------------
-void electron_expansion_slot_device::expbus_w(offs_t offset, uint8_t data)
+void electron_expansion_slot_device::expbus_w(address_space &space, offs_t offset, uint8_t data)
{
if (m_card != nullptr)
{
- m_card->expbus_w(offset, data);
+ m_card->expbus_w(space, offset, data);
}
}
@@ -110,7 +126,6 @@ void electron_expansion_slot_device::expbus_w(offs_t offset, uint8_t data)
//#include "fbprint.h"
//#include "jafamode7.h"
#include "plus1.h"
-#include "plus2.h"
#include "plus3.h"
#include "pwrjoy.h"
#include "rombox.h"
@@ -125,7 +140,6 @@ void electron_expansion_devices(device_slot_interface &device)
//device.option_add("fbprint", ELECTRON_FBPRINT);
//device.option_add("jafamode7", ELECTRON_JAFAMODE7);
device.option_add("plus1", ELECTRON_PLUS1);
- device.option_add("plus2", ELECTRON_PLUS2);
device.option_add("plus3", ELECTRON_PLUS3);
device.option_add("pwrjoy", ELECTRON_PWRJOY);
device.option_add("rombox", ELECTRON_ROMBOX);
diff --git a/src/devices/bus/electron/exp.h b/src/devices/bus/electron/exp.h
index a3bfc045b3a..ddac72c4d2b 100644
--- a/src/devices/bus/electron/exp.h
+++ b/src/devices/bus/electron/exp.h
@@ -91,6 +91,33 @@ AC RETURNS (pins 3,4) - adaptor. A total of 6W may be drawn from these lines as
//**************************************************************************
+// CONSTANTS
+//**************************************************************************
+
+#define ELECTRON_EXPANSION_SLOT_TAG "exp"
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_ELECTRON_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot, _fixed) \
+ MCFG_DEVICE_ADD(_tag, ELECTRON_EXPANSION_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed)
+
+#define MCFG_ELECTRON_PASSTHRU_EXPANSION_SLOT_ADD(_def_slot) \
+ MCFG_ELECTRON_EXPANSION_SLOT_ADD(ELECTRON_EXPANSION_SLOT_TAG, electron_expansion_devices, _def_slot, false) \
+ MCFG_ELECTRON_EXPANSION_SLOT_IRQ_HANDLER(WRITELINE(DEVICE_SELF_OWNER, electron_expansion_slot_device, irq_w)) \
+ MCFG_ELECTRON_EXPANSION_SLOT_NMI_HANDLER(WRITELINE(DEVICE_SELF_OWNER, electron_expansion_slot_device, nmi_w))
+
+#define MCFG_ELECTRON_EXPANSION_SLOT_IRQ_HANDLER(_devcb) \
+ downcast<electron_expansion_slot_device &>(*device).set_irq_handler(DEVCB_##_devcb);
+
+#define MCFG_ELECTRON_EXPANSION_SLOT_NMI_HANDLER(_devcb) \
+ downcast<electron_expansion_slot_device &>(*device).set_nmi_handler(DEVCB_##_devcb);
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -102,23 +129,15 @@ class electron_expansion_slot_device : public device_t, public device_slot_inter
{
public:
// construction/destruction
- template <typename T>
- electron_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&opts, const char *dflt)
- : electron_expansion_slot_device(mconfig, tag, owner, clock)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
electron_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ virtual ~electron_expansion_slot_device();
// callbacks
- auto irq_handler() { return m_irq_handler.bind(); }
- auto nmi_handler() { return m_nmi_handler.bind(); }
+ template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_nmi_handler(Object &&cb) { return m_nmi_handler.set_callback(std::forward<Object>(cb)); }
- uint8_t expbus_r(offs_t offset);
- void expbus_w(offs_t offset, uint8_t data);
+ uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data);
+ void expbus_w(address_space &space, offs_t offset, uint8_t data);
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_handler(state); }
DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); }
@@ -141,8 +160,11 @@ private:
class device_electron_expansion_interface : public device_slot_card_interface
{
public:
- virtual uint8_t expbus_r(offs_t offset) { return 0xff; }
- virtual void expbus_w(offs_t offset, uint8_t data) { }
+ // construction/destruction
+ virtual ~device_electron_expansion_interface();
+
+ virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) { return data; }
+ virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) { }
protected:
device_electron_expansion_interface(const machine_config &mconfig, device_t &device);
diff --git a/src/devices/bus/electron/fbjoy.cpp b/src/devices/bus/electron/fbjoy.cpp
index e5a4042cfeb..6c4939edbf5 100644
--- a/src/devices/bus/electron/fbjoy.cpp
+++ b/src/devices/bus/electron/fbjoy.cpp
@@ -67,10 +67,8 @@ void electron_fbjoy_device::device_start()
// expbus_r - expansion data read
//-------------------------------------------------
-uint8_t electron_fbjoy_device::expbus_r(offs_t offset)
+uint8_t electron_fbjoy_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
{
- uint8_t data = 0xff;
-
if (offset == 0xfcc0)
{
data = m_joy->read() | 0xe0;
diff --git a/src/devices/bus/electron/fbjoy.h b/src/devices/bus/electron/fbjoy.h
index d9faaa6cd15..b45c242d907 100644
--- a/src/devices/bus/electron/fbjoy.h
+++ b/src/devices/bus/electron/fbjoy.h
@@ -33,7 +33,7 @@ public:
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t expbus_r(offs_t offset) override;
+ virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
protected:
// device-level overrides
diff --git a/src/devices/bus/electron/m2105.cpp b/src/devices/bus/electron/m2105.cpp
index a5edb8e3232..abc652d6fdf 100644
--- a/src/devices/bus/electron/m2105.cpp
+++ b/src/devices/bus/electron/m2105.cpp
@@ -59,27 +59,27 @@ void electron_m2105_device::device_add_mconfig(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
-
- /* nvram */
- RAM(config, m_ram).set_default_size("64K");
+ INPUT_MERGER_ANY_HIGH(config, m_irqs);
+ m_irqs->output_handler().set(FUNC(electron_m2105_device::intrq_w));
/* system via */
- VIA6522(config, m_via6522_0, DERIVED_CLOCK(1, 16));
- //m_via6522_0->readpa_handler().set(FUNC(electron_m2105_device::m2105_via_system_read_porta));
- m_via6522_0->readpb_handler().set(m_tms, FUNC(tms5220_device::status_r));
- //m_via6522_0->writepa_handler().set(FUNC(electron_m2105_device::m2105_via_system_write_porta));
- m_via6522_0->writepb_handler().set(m_tms, FUNC(tms5220_device::data_w));
+ VIA6522(config, m_via6522_0, 1000000);
+ /*m_via6522_0->readpa_handler().set(FUNC(electron_m2105_device::m2105_via_system_read_porta));
+ m_via6522_0->readpb_handler().set(FUNC(electron_m2105_device::m2105_via_system_read_portb));
+ m_via6522_0->writepa_handler().set(FUNC(electron_m2105_device::m2105_via_system_write_porta));
+ m_via6522_0->writepb_handler().set(FUNC(electron_m2105_device::m2105_via_system_write_portb));*/
m_via6522_0->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>));
/* user via */
- VIA6522(config, m_via6522_1, DERIVED_CLOCK(1, 16));
- m_via6522_1->writepb_handler().set("cent_data_out", FUNC(output_latch_device::bus_w));
+ VIA6522(config, m_via6522_1, 1000000);
+ //m_via6522_1->readpb_handler().set(FUNC(electron_m2105_device::m2105_via_user_read_portb));
+ m_via6522_1->writepa_handler().set("cent_data_out", FUNC(output_latch_device::bus_w));
+ //m_via6522_1->writepb_handler().set(FUNC(electron_m2105_device::m2105_via_user_write_portb));
m_via6522_1->ca2_handler().set(m_centronics, FUNC(centronics_device::write_strobe));
m_via6522_1->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>));
- /* duart */
- SCN2681(config, m_duart, XTAL(3'686'400)); // TODO: confirm clock
+ /* duart */
+ SCN2681(config, m_duart, XTAL(3'686'400));
m_duart->irq_cb().set(m_irqs, FUNC(input_merger_device::in_w<2>));
m_duart->a_tx_cb().set("rs232", FUNC(rs232_port_device::write_txd));
//m_duart->outport_cb().set(FUNC(electron_m2105_device::sio_out_w));
@@ -93,14 +93,10 @@ void electron_m2105_device::device_add_mconfig(machine_config &config)
output_latch_device &latch(OUTPUT_LATCH(config, "cent_data_out"));
m_centronics->set_output_latch(latch);
- /* AM7910 modem */
-
/* speech hardware */
SPEECHROM(config, "vsm", 0);
TMS5220(config, m_tms, 640000);
m_tms->set_speechrom_tag("vsm");
- //m_tms->irq_handler().set(m_via6522_0, FUNC(via6522_device::write_cb1));
- //m_tms->readyq_handler().set(m_via6522_0, FUNC(via6522_device::write_cb2));
m_tms->add_route(ALL_OUTPUTS, "mono", 1.0);
}
@@ -121,14 +117,12 @@ electron_m2105_device::electron_m2105_device(const machine_config &mconfig, cons
: device_t(mconfig, ELECTRON_M2105, tag, owner, clock)
, device_electron_expansion_interface(mconfig, *this)
, m_exp_rom(*this, "exp_rom")
- , m_ram(*this, RAM_TAG)
, m_via6522_0(*this, "via6522_0")
, m_via6522_1(*this, "via6522_1")
, m_duart(*this, "duart")
, m_tms(*this, "tms5220")
, m_centronics(*this, "centronics")
, m_irqs(*this, "irqs")
- , m_ram_page(0)
, m_romsel(0)
{
}
@@ -139,7 +133,7 @@ electron_m2105_device::electron_m2105_device(const machine_config &mconfig, cons
void electron_m2105_device::device_start()
{
- save_item(NAME(m_ram_page));
+ m_slot = dynamic_cast<electron_expansion_slot_device *>(owner());
}
//-------------------------------------------------
@@ -154,58 +148,38 @@ void electron_m2105_device::device_reset()
// expbus_r - expansion data read
//-------------------------------------------------
-uint8_t electron_m2105_device::expbus_r(offs_t offset)
+uint8_t electron_m2105_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
{
- uint8_t data = 0xff;
-
- switch (offset >> 12)
+ if (offset >= 0x8000 && offset < 0xc000)
{
- case 0x8:
- case 0x9:
- case 0xa:
- case 0xb:
switch (m_romsel)
{
case 0:
- data = m_exp_rom->base()[0x8000 | (offset & 0x3fff)];
+ data = m_exp_rom->base()[0x8000 + (offset & 0x3fff)];
break;
case 2:
- data = m_exp_rom->base()[0xc000 | (offset & 0x3fff)];
+ data = m_exp_rom->base()[0xc000 + (offset & 0x3fff)];
break;
case 12:
- data = m_exp_rom->base()[0x0000 | (offset & 0x3fff)];
+ data = m_exp_rom->base()[0x0000 + (offset & 0x3fff)];
break;
case 13:
- data = m_exp_rom->base()[0x4000 | (offset & 0x3fff)];
- break;
- }
- break;
-
- case 0xf:
- switch (offset >> 8)
- {
- case 0xfc:
- logerror("read %04x\n", offset);
- if (offset >= 0xfc50 && offset < 0xfc60)
- {
- data = m_duart->read(offset & 0x0f);
- }
- else if (offset >= 0xfc60 && offset < 0xfc70)
- {
- data = m_via6522_1->read(offset & 0x0f);
- }
- else if (offset >= 0xfc70 && offset < 0xfc80)
- {
- data = m_via6522_0->read(offset & 0x0f);
- }
- break;
-
- case 0xfd:
- //if (m_ram_page < 0x80)
- data = m_ram->pointer()[(m_ram_page << 8) | (offset & 0xff)];
+ data = m_exp_rom->base()[0x4000 + (offset & 0x3fff)];
break;
}
}
+ else if (offset >= 0xfc40 && offset < 0xfc60)
+ {
+ data = m_via6522_1->read(offset);
+ }
+ else if (offset >= 0xfc60 && offset < 0xfc70)
+ {
+ data = m_duart->read(offset & 0x0f);
+ }
+ else if (offset >= 0xfc70 && offset < 0xfc90)
+ {
+ data = m_via6522_0->read(offset);
+ }
return data;
}
@@ -214,44 +188,36 @@ uint8_t electron_m2105_device::expbus_r(offs_t offset)
// expbus_w - expansion data write
//-------------------------------------------------
-void electron_m2105_device::expbus_w(offs_t offset, uint8_t data)
+void electron_m2105_device::expbus_w(address_space &space, offs_t offset, uint8_t data)
{
- switch (offset >> 12)
+ if (offset >= 0x8000 && offset < 0xc000)
{
- case 0xf:
- switch (offset >> 8)
- {
- case 0xfc:
- logerror("write %04x %02x\n", offset, data);
- if (offset >= 0xfc50 && offset < 0xfc60)
- {
- m_duart->write(offset & 0x0f, data);
- }
- else if (offset >= 0xfc60 && offset < 0xfc70)
- {
- m_via6522_1->write(offset & 0x0f, data);
- }
- else if (offset >= 0xfc70 && offset < 0xfc80)
- {
- m_via6522_0->write(offset & 0x0f, data);
- }
- else if (offset == 0xfcff)
- {
- m_ram_page = data;
- }
- break;
+ logerror("write ram bank %d\n", m_romsel);
+ }
+ else if (offset >= 0xfc40 && offset < 0xfc60)
+ {
+ m_via6522_1->write(offset, data);
+ }
+ else if (offset >= 0xfc60 && offset < 0xfc70)
+ {
+ m_duart->write(offset & 0x0f, data);
+ }
+ else if (offset >= 0xfc70 && offset < 0xfc90)
+ {
+ m_via6522_0->write(offset, data);
+ }
+ else if (offset == 0xfe05)
+ {
+ m_romsel = data & 0x0f;
+ }
+}
- case 0xfd:
- //if (m_ram_page < 0x80)
- m_ram->pointer()[(m_ram_page << 8) | (offset & 0xff)] = data;
- break;
- case 0xfe:
- if (offset == 0xfe05)
- {
- m_romsel = data & 0x0f;
- }
- break;
- }
- }
+//**************************************************************************
+// IMPLEMENTATION
+//**************************************************************************
+
+WRITE_LINE_MEMBER(electron_m2105_device::intrq_w)
+{
+ m_slot->irq_w(state);
}
diff --git a/src/devices/bus/electron/m2105.h b/src/devices/bus/electron/m2105.h
index c09f4722eab..3fab3b52128 100644
--- a/src/devices/bus/electron/m2105.h
+++ b/src/devices/bus/electron/m2105.h
@@ -12,7 +12,6 @@
#pragma once
#include "exp.h"
-#include "machine/ram.h"
#include "machine/6522via.h"
#include "machine/mc68681.h"
#include "machine/input_merger.h"
@@ -41,12 +40,13 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t expbus_r(offs_t offset) override;
- virtual void expbus_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) override;
private:
+ DECLARE_WRITE_LINE_MEMBER(intrq_w);
+
required_memory_region m_exp_rom;
- required_device<ram_device> m_ram;
required_device<via6522_device> m_via6522_0;
required_device<via6522_device> m_via6522_1;
required_device<scn2681_device> m_duart;
@@ -54,7 +54,6 @@ private:
required_device<centronics_device> m_centronics;
required_device<input_merger_device> m_irqs;
- uint8_t m_ram_page;
uint8_t m_romsel;
};
diff --git a/src/devices/bus/electron/plus1.cpp b/src/devices/bus/electron/plus1.cpp
index a96ad20c656..9bb500b586d 100644
--- a/src/devices/bus/electron/plus1.cpp
+++ b/src/devices/bus/electron/plus1.cpp
@@ -90,13 +90,11 @@ ioport_constructor electron_plus1_device::device_input_ports() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void electron_plus1_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(electron_plus1_device::device_add_mconfig)
/* printer */
- CENTRONICS(config, m_centronics, centronics_devices, "printer");
- m_centronics->busy_handler().set(FUNC(electron_plus1_device::busy_w));
- output_latch_device &latch(OUTPUT_LATCH(config, "cent_data_out"));
- m_centronics->set_output_latch(latch);
+ MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer")
+ MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, electron_plus1_device, busy_w))
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
/* adc */
ADC0844(config, m_adc);
@@ -107,13 +105,13 @@ void electron_plus1_device::device_add_mconfig(machine_config &config)
m_adc->ch4_callback().set_ioport("JOY4");
/* cartridges */
- ELECTRON_CARTSLOT(config, m_cart_sk1, DERIVED_CLOCK(1, 1), electron_cart, nullptr);
- m_cart_sk1->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
- m_cart_sk1->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
- ELECTRON_CARTSLOT(config, m_cart_sk2, DERIVED_CLOCK(1, 1), electron_cart, nullptr);
- m_cart_sk2->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
- m_cart_sk2->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
-}
+ MCFG_ELECTRON_CARTSLOT_ADD("cart_sk1", electron_cart, nullptr)
+ MCFG_ELECTRON_CARTSLOT_IRQ_HANDLER(WRITELINE(*this, electron_plus1_device, irq_w))
+ MCFG_ELECTRON_CARTSLOT_NMI_HANDLER(WRITELINE(*this, electron_plus1_device, nmi_w))
+ MCFG_ELECTRON_CARTSLOT_ADD("cart_sk2", electron_cart, nullptr)
+ MCFG_ELECTRON_CARTSLOT_IRQ_HANDLER(WRITELINE(*this, electron_plus1_device, irq_w))
+ MCFG_ELECTRON_CARTSLOT_NMI_HANDLER(WRITELINE(*this, electron_plus1_device, nmi_w))
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -156,6 +154,7 @@ electron_plus1_device::electron_plus1_device(const machine_config &mconfig, cons
void electron_plus1_device::device_start()
{
+ m_slot = dynamic_cast<electron_expansion_slot_device *>(owner());
}
@@ -163,10 +162,8 @@ void electron_plus1_device::device_start()
// expbus_r - expansion data read
//-------------------------------------------------
-uint8_t electron_plus1_device::expbus_r(offs_t offset)
+uint8_t electron_plus1_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
{
- uint8_t data = 0xff;
-
switch (offset >> 12)
{
case 0x8:
@@ -177,19 +174,15 @@ uint8_t electron_plus1_device::expbus_r(offs_t offset)
{
case 0:
case 1:
- data = m_cart_sk2->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 1, 0);
+ data = m_cart_sk2->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01);
break;
case 2:
case 3:
- data = m_cart_sk1->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 1, 0);
+ data = m_cart_sk1->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01);
break;
case 12:
data = m_exp_rom->base()[offset & 0x1fff];
break;
- case 13:
- data &= m_cart_sk1->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1);
- data &= m_cart_sk2->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1);
- break;
}
break;
@@ -197,22 +190,22 @@ uint8_t electron_plus1_device::expbus_r(offs_t offset)
switch (offset >> 8)
{
case 0xfc:
- data &= m_cart_sk1->read(offset & 0xff, 1, 0, m_romsel & 0x01, 0, 0);
- data &= m_cart_sk2->read(offset & 0xff, 1, 0, m_romsel & 0x01, 0, 0);
+ data &= m_cart_sk1->read(space, offset & 0xff, 1, 0, m_romsel & 0x01);
+ data &= m_cart_sk2->read(space, offset & 0xff, 1, 0, m_romsel & 0x01);
if (offset == 0xfc70)
{
- data &= m_adc->read();
+ data &= m_adc->read(space, offset);
}
else if (offset == 0xfc72)
{
- data &= status_r();
+ data &= status_r(space, offset);
}
break;
case 0xfd:
- data &= m_cart_sk1->read(offset & 0xff, 0, 1, m_romsel & 0x01, 0, 0);
- data &= m_cart_sk2->read(offset & 0xff, 0, 1, m_romsel & 0x01, 0, 0);
+ data &= m_cart_sk1->read(space, offset & 0xff, 0, 1, m_romsel & 0x01);
+ data &= m_cart_sk2->read(space, offset & 0xff, 0, 1, m_romsel & 0x01);
break;
}
}
@@ -225,7 +218,7 @@ uint8_t electron_plus1_device::expbus_r(offs_t offset)
// expbus_w - expansion data write
//-------------------------------------------------
-void electron_plus1_device::expbus_w(offs_t offset, uint8_t data)
+void electron_plus1_device::expbus_w(address_space &space, offs_t offset, uint8_t data)
{
switch (offset >> 12)
{
@@ -237,11 +230,11 @@ void electron_plus1_device::expbus_w(offs_t offset, uint8_t data)
{
case 0:
case 1:
- m_cart_sk2->write(offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 1, 0);
+ m_cart_sk2->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01);
break;
case 2:
case 3:
- m_cart_sk1->write(offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 1, 0);
+ m_cart_sk1->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01);
break;
}
break;
@@ -250,12 +243,12 @@ void electron_plus1_device::expbus_w(offs_t offset, uint8_t data)
switch (offset >> 8)
{
case 0xfc:
- m_cart_sk1->write(offset & 0xff, data, 1, 0, m_romsel & 0x01, 0, 0);
- m_cart_sk2->write(offset & 0xff, data, 1, 0, m_romsel & 0x01, 0, 0);
+ m_cart_sk1->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01);
+ m_cart_sk2->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01);
if (offset == 0xfc70)
{
- m_adc->write(data);
+ m_adc->write(space, offset, data);
}
else if (offset == 0xfc71)
{
@@ -264,8 +257,8 @@ void electron_plus1_device::expbus_w(offs_t offset, uint8_t data)
break;
case 0xfd:
- m_cart_sk1->write(offset & 0xff, data, 0, 1, m_romsel & 0x01, 0, 0);
- m_cart_sk2->write(offset & 0xff, data, 0, 1, m_romsel & 0x01, 0, 0);
+ m_cart_sk1->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01);
+ m_cart_sk2->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01);
break;
case 0xfe:
@@ -283,9 +276,9 @@ void electron_plus1_device::expbus_w(offs_t offset, uint8_t data)
// IMPLEMENTATION
//**************************************************************************
-u8 electron_plus1_device::status_r()
+READ8_MEMBER(electron_plus1_device::status_r)
{
- u8 data = 0x0f;
+ uint8_t data = 0x0f;
// Status: b7: printer Busy
// b6: ADC conversion end
// b5: Fire Button 1
@@ -306,3 +299,13 @@ WRITE_LINE_MEMBER(electron_plus1_device::ready_w)
{
m_adc_ready = !state;
}
+
+WRITE_LINE_MEMBER(electron_plus1_device::irq_w)
+{
+ m_slot->irq_w(state);
+}
+
+WRITE_LINE_MEMBER(electron_plus1_device::nmi_w)
+{
+ m_slot->nmi_w(state);
+}
diff --git a/src/devices/bus/electron/plus1.h b/src/devices/bus/electron/plus1.h
index e211594a2c6..415797905fd 100644
--- a/src/devices/bus/electron/plus1.h
+++ b/src/devices/bus/electron/plus1.h
@@ -37,13 +37,15 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t expbus_r(offs_t offset) override;
- virtual void expbus_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) override;
private:
- u8 status_r();
+ DECLARE_READ8_MEMBER(status_r);
DECLARE_WRITE_LINE_MEMBER(busy_w);
DECLARE_WRITE_LINE_MEMBER(ready_w);
+ DECLARE_WRITE_LINE_MEMBER(irq_w);
+ DECLARE_WRITE_LINE_MEMBER(nmi_w);
required_memory_region m_exp_rom;
required_device<electron_cartslot_device> m_cart_sk1;
diff --git a/src/devices/bus/electron/plus2.cpp b/src/devices/bus/electron/plus2.cpp
deleted file mode 100644
index 040ec58eb35..00000000000
--- a/src/devices/bus/electron/plus2.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- Slogger Plus 2
-
- The Plus 2 interface from Slogger has been designed to compliment
- the Slogger Rombox Plus and Acorn Plus 1 by offering further
- expansion capabilities. This has been achieved by providing two
- extra cartridge slots, three ROM sockets and connections for a
- Usr Port and even further expansion via two expansion points.
-
-**********************************************************************/
-
-
-#include "emu.h"
-#include "plus2.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(ELECTRON_PLUS2, electron_plus2_device, "electron_plus2", "Slogger Plus 2 Expansion")
-
-
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void electron_plus2_device::device_add_mconfig(machine_config &config)
-{
- /* rom sockets */
- GENERIC_SOCKET(config, m_rom[0], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 13
- m_rom[0]->set_device_load(device_image_load_delegate(&electron_plus2_device::device_image_load_rom1_load, this));
- GENERIC_SOCKET(config, m_rom[1], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 14
- m_rom[1]->set_device_load(device_image_load_delegate(&electron_plus2_device::device_image_load_rom2_load, this));
- GENERIC_SOCKET(config, m_rom[2], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 15
- m_rom[2]->set_device_load(device_image_load_delegate(&electron_plus2_device::device_image_load_rom3_load, this));
-
- /* cartridges */
- ELECTRON_CARTSLOT(config, m_cart[0], DERIVED_CLOCK(1, 1), electron_cart, nullptr);
- m_cart[0]->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
- m_cart[0]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
- ELECTRON_CARTSLOT(config, m_cart[1], DERIVED_CLOCK(1, 1), electron_cart, nullptr);
- m_cart[1]->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
- m_cart[1]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
-
- /* via */
- VIA6522(config, m_via, DERIVED_CLOCK(1, 16));
- m_via->readpb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_r));
- m_via->writepb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_w));
- m_via->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
-
- /* user port */
- BBC_USERPORT_SLOT(config, m_userport, bbc_userport_devices, nullptr);
- m_userport->cb1_handler().set(m_via, FUNC(via6522_device::write_cb1));
- m_userport->cb2_handler().set(m_via, FUNC(via6522_device::write_cb2));
-
- /* pass-through */
- ELECTRON_EXPANSION_SLOT(config, m_exp, DERIVED_CLOCK(1, 1), electron_expansion_devices, nullptr);
- m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
- m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
-}
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// electron_plus2_device - constructor
-//-------------------------------------------------
-
-electron_plus2_device::electron_plus2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ELECTRON_PLUS2, tag, owner, clock)
- , device_electron_expansion_interface(mconfig, *this)
- , m_exp(*this, "exp")
- , m_via(*this, "via6522")
- , m_rom(*this, "rom%u", 1)
- , m_cart(*this, "cart%u", 1)
- , m_userport(*this, "userport")
- , m_romsel(0)
-{
-}
-
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void electron_plus2_device::device_start()
-{
-}
-
-
-//-------------------------------------------------
-// expbus_r - expansion data read
-//-------------------------------------------------
-
-uint8_t electron_plus2_device::expbus_r(offs_t offset)
-{
- uint8_t data = 0xff;
-
- switch (offset >> 12)
- {
- case 0x8:
- case 0x9:
- case 0xa:
- case 0xb:
- switch (m_romsel)
- {
- case 4:
- case 5:
- data = m_cart[1]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 1, 0);
- break;
- case 6:
- case 7:
- data = m_cart[0]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 1, 0);
- break;
- case 13:
- data &= m_cart[0]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1);
- data &= m_cart[1]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1);
- case 14:
- case 15:
- data &= m_rom[m_romsel - 13]->read_rom(offset & 0x3fff);
- break;
- }
- break;
-
- case 0xf:
- switch (offset >> 8)
- {
- case 0xfc:
- data &= m_cart[0]->read(offset & 0xff, 1, 0, m_romsel & 0x01, 0, 0);
- data &= m_cart[1]->read(offset & 0xff, 1, 0, m_romsel & 0x01, 0, 0);
-
- if (offset >= 0xfcb0 && offset < 0xfcc0)
- {
- data &= m_via->read(offset & 0x0f);
- }
- break;
-
- case 0xfd:
- data &= m_cart[0]->read(offset & 0xff, 0, 1, m_romsel & 0x01, 0, 0);
- data &= m_cart[1]->read(offset & 0xff, 0, 1, m_romsel & 0x01, 0, 0);
- break;
- }
- }
-
- data &= m_exp->expbus_r(offset);
-
- return data;
-}
-
-
-//-------------------------------------------------
-// expbus_w - expansion data write
-//-------------------------------------------------
-
-void electron_plus2_device::expbus_w(offs_t offset, uint8_t data)
-{
- switch (offset >> 12)
- {
- case 0x8:
- case 0x9:
- case 0xa:
- case 0xb:
- switch (m_romsel)
- {
- case 4:
- case 5:
- m_cart[1]->write(offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 1, 0);
- break;
- case 6:
- case 7:
- m_cart[0]->write(offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 1, 0);
- break;
- }
- break;
-
- case 0xf:
- switch (offset >> 8)
- {
- case 0xfc:
- m_cart[0]->write(offset & 0xff, data, 1, 0, m_romsel & 0x01, 0, 0);
- m_cart[1]->write(offset & 0xff, data, 1, 0, m_romsel & 0x01, 0, 0);
-
- if (offset >= 0xfcb0 && offset < 0xfcc0)
- {
- m_via->write(offset & 0x0f, data);
- }
- break;
-
- case 0xfd:
- m_cart[0]->write(offset & 0xff, data, 0, 1, m_romsel & 0x01, 0, 0);
- m_cart[1]->write(offset & 0xff, data, 0, 1, m_romsel & 0x01, 0, 0);
- break;
-
- case 0xfe:
- if (offset == 0xfe05)
- {
- m_romsel = data & 0x0f;
- }
- break;
- }
- }
-
- m_exp->expbus_w(offset, data);
-}
-
-
-//**************************************************************************
-// IMPLEMENTATION
-//**************************************************************************
-
-image_init_result electron_plus2_device::load_rom(device_image_interface &image, generic_slot_device *slot)
-{
- uint32_t size = slot->common_get_size("rom");
-
- // socket accepts 8K and 16K ROM only
- if (size != 0x2000 && size != 0x4000)
- {
- image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size: Only 8K/16K is supported");
- return image_init_result::FAIL;
- }
-
- slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
- slot->common_load_rom(slot->get_rom_base(), size, "rom");
-
- // mirror 8K ROMs
- uint8_t *crt = slot->get_rom_base();
- if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000);
-
- return image_init_result::PASS;
-}
diff --git a/src/devices/bus/electron/plus2.h b/src/devices/bus/electron/plus2.h
deleted file mode 100644
index 235ecd4f218..00000000000
--- a/src/devices/bus/electron/plus2.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- Slogger Plus 2
-
-**********************************************************************/
-
-
-#ifndef MAME_BUS_ELECTRON_PLUS2_H
-#define MAME_BUS_ELECTRON_PLUS2_H
-
-#include "exp.h"
-#include "machine/6522via.h"
-#include "bus/electron/cart/slot.h"
-#include "bus/bbc/userport/userport.h"
-#include "bus/generic/slot.h"
-#include "bus/generic/carts.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-class electron_plus2_device:
- public device_t,
- public device_electron_expansion_interface
-{
-public:
- // construction/destruction
- electron_plus2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
-
- // optional information overrides
- virtual void device_add_mconfig(machine_config &config) override;
-
- virtual uint8_t expbus_r(offs_t offset) override;
- virtual void expbus_w(offs_t offset, uint8_t data) override;
-
-private:
- image_init_result load_rom(device_image_interface &image, generic_slot_device *slot);
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_rom[1]); }
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); }
-
- required_device<electron_expansion_slot_device> m_exp;
- required_device<via6522_device> m_via;
- required_device_array<generic_slot_device, 3> m_rom;
- required_device_array<electron_cartslot_device, 2> m_cart;
- required_device<bbc_userport_slot_device> m_userport;
-
- uint8_t m_romsel;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(ELECTRON_PLUS2, electron_plus2_device)
-
-
-#endif /* MAME_BUS_ELECTRON_PLUS2_H */
diff --git a/src/devices/bus/electron/plus3.cpp b/src/devices/bus/electron/plus3.cpp
index 5996e357389..532594eb5cf 100644
--- a/src/devices/bus/electron/plus3.cpp
+++ b/src/devices/bus/electron/plus3.cpp
@@ -65,20 +65,15 @@ ROM_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void electron_plus3_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(electron_plus3_device::device_add_mconfig)
/* fdc */
- WD1770(config, m_fdc, DERIVED_CLOCK(1, 2));
- FLOPPY_CONNECTOR(config, m_floppy0, electron_floppies, "35dd", floppy_formats).set_fixed(true);
- m_floppy0->enable_sound(true);
- FLOPPY_CONNECTOR(config, m_floppy1, electron_floppies, nullptr, floppy_formats);
- m_floppy1->enable_sound(true);
+ WD1770(config, m_fdc, 16_MHz_XTAL / 2);
+ FLOPPY_CONNECTOR(config, m_floppy0, electron_floppies, "35dd", floppy_formats, true).enable_sound(true);
+ FLOPPY_CONNECTOR(config, m_floppy1, electron_floppies, nullptr, floppy_formats).enable_sound(true);
/* pass-through */
- ELECTRON_EXPANSION_SLOT(config, m_exp, DERIVED_CLOCK(1, 1), electron_expansion_devices, nullptr);
- m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
- m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
-}
+ MCFG_ELECTRON_PASSTHRU_EXPANSION_SLOT_ADD(nullptr)
+MACHINE_CONFIG_END
const tiny_rom_entry *electron_plus3_device::device_rom_region() const
{
@@ -117,10 +112,8 @@ void electron_plus3_device::device_start()
// expbus_r - expansion data read
//-------------------------------------------------
-uint8_t electron_plus3_device::expbus_r(offs_t offset)
+uint8_t electron_plus3_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
{
- uint8_t data = 0xff;
-
if (offset >= 0x8000 && offset < 0xc000)
{
if (m_romsel == 4)
@@ -137,7 +130,7 @@ uint8_t electron_plus3_device::expbus_r(offs_t offset)
data = m_fdc->read(offset & 0x03);
}
- data &= m_exp->expbus_r(offset);
+ data &= m_exp->expbus_r(space, offset, data);
return data;
}
@@ -146,13 +139,13 @@ uint8_t electron_plus3_device::expbus_r(offs_t offset)
// expbus_w - expansion data write
//-------------------------------------------------
-void electron_plus3_device::expbus_w(offs_t offset, uint8_t data)
+void electron_plus3_device::expbus_w(address_space &space, offs_t offset, uint8_t data)
{
- m_exp->expbus_w(offset, data);
+ m_exp->expbus_w(space, offset, data);
if (offset == 0xfcc0)
{
- wd1770_status_w(data);
+ wd1770_status_w(space, offset, data);
}
else if (offset >= 0xfcc4 && offset < 0xfcc8)
{
@@ -169,7 +162,7 @@ void electron_plus3_device::expbus_w(offs_t offset, uint8_t data)
// IMPLEMENTATION
//**************************************************************************
-void electron_plus3_device::wd1770_status_w(uint8_t data)
+WRITE8_MEMBER(electron_plus3_device::wd1770_status_w)
{
floppy_image_device *floppy = nullptr;
diff --git a/src/devices/bus/electron/plus3.h b/src/devices/bus/electron/plus3.h
index 44de595a3db..c6a53805783 100644
--- a/src/devices/bus/electron/plus3.h
+++ b/src/devices/bus/electron/plus3.h
@@ -34,11 +34,11 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual uint8_t expbus_r(offs_t offset) override;
- virtual void expbus_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) override;
private:
- void wd1770_status_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER(wd1770_status_w);
DECLARE_FLOPPY_FORMATS(floppy_formats);
required_device<electron_expansion_slot_device> m_exp;
diff --git a/src/devices/bus/electron/pwrjoy.cpp b/src/devices/bus/electron/pwrjoy.cpp
index 1ff7ab79566..2791f700372 100644
--- a/src/devices/bus/electron/pwrjoy.cpp
+++ b/src/devices/bus/electron/pwrjoy.cpp
@@ -78,10 +78,8 @@ void electron_pwrjoy_device::device_start()
// expbus_r - expansion data read
//-------------------------------------------------
-uint8_t electron_pwrjoy_device::expbus_r(offs_t offset)
+uint8_t electron_pwrjoy_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
{
- uint8_t data = 0xff;
-
if (offset >= 0x8000 && offset < 0xc000)
{
if (m_romsel == 15)
@@ -102,7 +100,7 @@ uint8_t electron_pwrjoy_device::expbus_r(offs_t offset)
// expbus_w - expansion data write
//-------------------------------------------------
-void electron_pwrjoy_device::expbus_w(offs_t offset, uint8_t data)
+void electron_pwrjoy_device::expbus_w(address_space &space, offs_t offset, uint8_t data)
{
if (offset == 0xfe05)
{
diff --git a/src/devices/bus/electron/pwrjoy.h b/src/devices/bus/electron/pwrjoy.h
index abc91cf3e2b..be392a1c622 100644
--- a/src/devices/bus/electron/pwrjoy.h
+++ b/src/devices/bus/electron/pwrjoy.h
@@ -32,8 +32,8 @@ public:
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t expbus_r(offs_t offset) override;
- virtual void expbus_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) override;
protected:
// device-level overrides
diff --git a/src/devices/bus/electron/rombox.cpp b/src/devices/bus/electron/rombox.cpp
index 35f94b08d13..2ae1967c743 100644
--- a/src/devices/bus/electron/rombox.cpp
+++ b/src/devices/bus/electron/rombox.cpp
@@ -51,31 +51,36 @@ ioport_constructor electron_rombox_device::device_input_ports() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void electron_rombox_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(electron_rombox_device::device_add_mconfig)
/* rom sockets */
- GENERIC_SOCKET(config, m_rom[0], generic_plain_slot, "electron_rom", "bin,rom");
- m_rom[0]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom1_load, this));
- GENERIC_SOCKET(config, m_rom[1], generic_plain_slot, "electron_rom", "bin,rom");
- m_rom[1]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom2_load, this));
- GENERIC_SOCKET(config, m_rom[2], generic_plain_slot, "electron_rom", "bin,rom");
- m_rom[2]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom3_load, this));
- GENERIC_SOCKET(config, m_rom[3], generic_plain_slot, "electron_rom", "bin,rom");
- m_rom[3]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom4_load, this));
- GENERIC_SOCKET(config, m_rom[4], generic_plain_slot, "electron_rom", "bin,rom");
- m_rom[4]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom5_load, this));
- GENERIC_SOCKET(config, m_rom[5], generic_plain_slot, "electron_rom", "bin,rom");
- m_rom[5]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom6_load, this));
- GENERIC_SOCKET(config, m_rom[6], generic_plain_slot, "electron_rom", "bin,rom");
- m_rom[6]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom7_load, this));
- GENERIC_SOCKET(config, m_rom[7], generic_plain_slot, "electron_rom", "bin,rom");
- m_rom[7]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom8_load, this));
+ MCFG_GENERIC_SOCKET_ADD("rom1", generic_plain_slot, "electron_rom")
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_LOAD(electron_rombox_device, rom1_load)
+ MCFG_GENERIC_SOCKET_ADD("rom2", generic_plain_slot, "electron_rom")
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_LOAD(electron_rombox_device, rom2_load)
+ MCFG_GENERIC_SOCKET_ADD("rom3", generic_plain_slot, "electron_rom")
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_LOAD(electron_rombox_device, rom3_load)
+ MCFG_GENERIC_SOCKET_ADD("rom4", generic_plain_slot, "electron_rom")
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_LOAD(electron_rombox_device, rom4_load)
+ MCFG_GENERIC_SOCKET_ADD("rom5", generic_plain_slot, "electron_rom")
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_LOAD(electron_rombox_device, rom5_load)
+ MCFG_GENERIC_SOCKET_ADD("rom6", generic_plain_slot, "electron_rom")
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_LOAD(electron_rombox_device, rom6_load)
+ MCFG_GENERIC_SOCKET_ADD("rom7", generic_plain_slot, "electron_rom")
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_LOAD(electron_rombox_device, rom7_load)
+ MCFG_GENERIC_SOCKET_ADD("rom8", generic_plain_slot, "electron_rom")
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_LOAD(electron_rombox_device, rom8_load)
/* pass-through */
- ELECTRON_EXPANSION_SLOT(config, m_exp, DERIVED_CLOCK(1, 1), electron_expansion_devices, nullptr);
- m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
- m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
-}
+ MCFG_ELECTRON_PASSTHRU_EXPANSION_SLOT_ADD(nullptr)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
@@ -117,10 +122,8 @@ void electron_rombox_device::device_reset()
// expbus_r - expansion data read
//-------------------------------------------------
-uint8_t electron_rombox_device::expbus_r(offs_t offset)
+uint8_t electron_rombox_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
{
- uint8_t data = 0xff;
-
if (offset >= 0x8000 && offset < 0xc000)
{
switch (m_romsel)
@@ -131,7 +134,7 @@ uint8_t electron_rombox_device::expbus_r(offs_t offset)
case 3:
if (m_rom_base == 0 && m_rom[m_romsel + 4]->exists())
{
- data = m_rom[m_romsel + 4]->read_rom(offset & 0x3fff);
+ data = m_rom[m_romsel + 4]->read_rom(space, offset & 0x3fff);
}
break;
case 4:
@@ -140,7 +143,7 @@ uint8_t electron_rombox_device::expbus_r(offs_t offset)
case 7:
if (m_rom[m_romsel - 4]->exists())
{
- data = m_rom[m_romsel - 4]->read_rom(offset & 0x3fff);
+ data = m_rom[m_romsel - 4]->read_rom(space, offset & 0x3fff);
}
break;
case 12:
@@ -149,13 +152,13 @@ uint8_t electron_rombox_device::expbus_r(offs_t offset)
case 15:
if (m_rom_base == 12 && m_rom[m_romsel - 8]->exists())
{
- data = m_rom[m_romsel - 8]->read_rom(offset & 0x3fff);
+ data = m_rom[m_romsel - 8]->read_rom(space, offset & 0x3fff);
}
break;
}
}
- data &= m_exp->expbus_r(offset);
+ data &= m_exp->expbus_r(space, offset, data);
return data;
}
@@ -164,9 +167,9 @@ uint8_t electron_rombox_device::expbus_r(offs_t offset)
// expbus_w - expansion data write
//-------------------------------------------------
-void electron_rombox_device::expbus_w(offs_t offset, uint8_t data)
+void electron_rombox_device::expbus_w(address_space &space, offs_t offset, uint8_t data)
{
- m_exp->expbus_w(offset, data);
+ m_exp->expbus_w(space, offset, data);
if (offset == 0xfe05)
{
diff --git a/src/devices/bus/electron/rombox.h b/src/devices/bus/electron/rombox.h
index 65ed2fa80d8..045db388838 100644
--- a/src/devices/bus/electron/rombox.h
+++ b/src/devices/bus/electron/rombox.h
@@ -35,8 +35,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t expbus_r(offs_t offset) override;
- virtual void expbus_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) override;
private:
image_init_result load_rom(device_image_interface &image, generic_slot_device *slot);
diff --git a/src/devices/bus/electron/romboxp.cpp b/src/devices/bus/electron/romboxp.cpp
index 7917ae3d539..d3ca80d43f4 100644
--- a/src/devices/bus/electron/romboxp.cpp
+++ b/src/devices/bus/electron/romboxp.cpp
@@ -84,32 +84,34 @@ ioport_constructor electron_romboxp_device::device_input_ports() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void electron_romboxp_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(electron_romboxp_device::device_add_mconfig)
/* printer */
- CENTRONICS(config, m_centronics, centronics_devices, "printer");
- m_centronics->busy_handler().set(FUNC(electron_romboxp_device::busy_w));
- output_latch_device &latch(OUTPUT_LATCH(config, "cent_data_out"));
- m_centronics->set_output_latch(latch);
+ MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer")
+ MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, electron_romboxp_device, busy_w))
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
/* rom sockets */
- GENERIC_SOCKET(config, m_rom[0], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 4/12
- m_rom[0]->set_device_load(device_image_load_delegate(&electron_romboxp_device::device_image_load_rom1_load, this));
- GENERIC_SOCKET(config, m_rom[1], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 5/13
- m_rom[1]->set_device_load(device_image_load_delegate(&electron_romboxp_device::device_image_load_rom2_load, this));
- GENERIC_SOCKET(config, m_rom[2], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 6/14 also ROM/RAM
- m_rom[2]->set_device_load(device_image_load_delegate(&electron_romboxp_device::device_image_load_rom3_load, this));
- GENERIC_SOCKET(config, m_rom[3], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 7/15
- m_rom[3]->set_device_load(device_image_load_delegate(&electron_romboxp_device::device_image_load_rom4_load, this));
+ MCFG_GENERIC_SOCKET_ADD("rom1", generic_plain_slot, "electron_rom") // ROM SLOT 4/12
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_LOAD(electron_romboxp_device, rom1_load)
+ MCFG_GENERIC_SOCKET_ADD("rom2", generic_plain_slot, "electron_rom") // ROM SLOT 5/13
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_LOAD(electron_romboxp_device, rom2_load)
+ MCFG_GENERIC_SOCKET_ADD("rom3", generic_plain_slot, "electron_rom") // ROM SLOT 6/14 also ROM/RAM
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_LOAD(electron_romboxp_device, rom3_load)
+ MCFG_GENERIC_SOCKET_ADD("rom4", generic_plain_slot, "electron_rom") // ROM SLOT 7/15
+ MCFG_GENERIC_EXTENSIONS("bin,rom")
+ MCFG_GENERIC_LOAD(electron_romboxp_device, rom4_load)
/* cartridges */
- ELECTRON_CARTSLOT(config, m_cart[0], DERIVED_CLOCK(1, 1), electron_cart, nullptr); // ROM SLOT 0/1
- m_cart[0]->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
- m_cart[0]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
- ELECTRON_CARTSLOT(config, m_cart[1], DERIVED_CLOCK(1, 1), electron_cart, nullptr); // ROM SLOT 2/3
- m_cart[1]->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
- m_cart[1]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
-}
+ MCFG_ELECTRON_CARTSLOT_ADD("cart1", electron_cart, nullptr) // ROM SLOT 0/1
+ MCFG_ELECTRON_CARTSLOT_IRQ_HANDLER(WRITELINE(*this, electron_romboxp_device, irq_w))
+ MCFG_ELECTRON_CARTSLOT_NMI_HANDLER(WRITELINE(*this, electron_romboxp_device, nmi_w))
+ MCFG_ELECTRON_CARTSLOT_ADD("cart2", electron_cart, nullptr) // ROM SLOT 2/3
+ MCFG_ELECTRON_CARTSLOT_IRQ_HANDLER(WRITELINE(*this, electron_romboxp_device, irq_w))
+ MCFG_ELECTRON_CARTSLOT_NMI_HANDLER(WRITELINE(*this, electron_romboxp_device, nmi_w))
+MACHINE_CONFIG_END
const tiny_rom_entry *electron_romboxp_device::device_rom_region() const
{
@@ -145,6 +147,7 @@ electron_romboxp_device::electron_romboxp_device(const machine_config &mconfig,
void electron_romboxp_device::device_start()
{
+ m_slot = dynamic_cast<electron_expansion_slot_device *>(owner());
}
//-------------------------------------------------
@@ -160,10 +163,8 @@ void electron_romboxp_device::device_reset()
// expbus_r - expansion data read
//-------------------------------------------------
-uint8_t electron_romboxp_device::expbus_r(offs_t offset)
+uint8_t electron_romboxp_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
{
- uint8_t data = 0xff;
-
switch (offset >> 12)
{
case 0x8:
@@ -174,11 +175,11 @@ uint8_t electron_romboxp_device::expbus_r(offs_t offset)
{
case 0:
case 1:
- data = m_cart[1]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 1, 0);
+ data = m_cart[1]->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01);
break;
case 2:
case 3:
- data = m_cart[0]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 1, 0);
+ data = m_cart[0]->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01);
break;
case 4:
case 5:
@@ -186,20 +187,18 @@ uint8_t electron_romboxp_device::expbus_r(offs_t offset)
case 7:
if (m_rom_base == 4)
{
- data = m_rom[m_romsel - 4]->read_rom(offset & 0x3fff);
+ data = m_rom[m_romsel - 4]->read_rom(space, offset & 0x3fff);
}
break;
case 12:
data = m_exp_rom->base()[offset & 0x1fff];
break;
case 13:
- data &= m_cart[0]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1);
- data &= m_cart[1]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1);
case 14:
case 15:
if (m_rom_base == 12)
{
- data = m_rom[m_romsel - 12]->read_rom(offset & 0x3fff);
+ data = m_rom[m_romsel - 12]->read_rom(space, offset & 0x3fff);
}
break;
}
@@ -209,18 +208,18 @@ uint8_t electron_romboxp_device::expbus_r(offs_t offset)
switch (offset >> 8)
{
case 0xfc:
- data &= m_cart[0]->read(offset & 0xff, 1, 0, m_romsel & 0x01, 0, 0);
- data &= m_cart[1]->read(offset & 0xff, 1, 0, m_romsel & 0x01, 0, 0);
+ data &= m_cart[0]->read(space, offset & 0xff, 1, 0, m_romsel & 0x01);
+ data &= m_cart[1]->read(space, offset & 0xff, 1, 0, m_romsel & 0x01);
if (offset == 0xfc72)
{
- data &= status_r();
+ data &= status_r(space, offset);
}
break;
case 0xfd:
- data &= m_cart[0]->read(offset & 0xff, 0, 1, m_romsel & 0x01, 0, 0);
- data &= m_cart[1]->read(offset & 0xff, 0, 1, m_romsel & 0x01, 0, 0);
+ data &= m_cart[0]->read(space, offset & 0xff, 0, 1, m_romsel & 0x01);
+ data &= m_cart[1]->read(space, offset & 0xff, 0, 1, m_romsel & 0x01);
break;
}
}
@@ -232,7 +231,7 @@ uint8_t electron_romboxp_device::expbus_r(offs_t offset)
// expbus_w - expansion data write
//-------------------------------------------------
-void electron_romboxp_device::expbus_w(offs_t offset, uint8_t data)
+void electron_romboxp_device::expbus_w(address_space &space, offs_t offset, uint8_t data)
{
switch (offset >> 12)
{
@@ -244,11 +243,11 @@ void electron_romboxp_device::expbus_w(offs_t offset, uint8_t data)
{
case 0:
case 1:
- m_cart[1]->write(offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 1, 0);
+ m_cart[1]->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01);
break;
case 2:
case 3:
- m_cart[0]->write(offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 1, 0);
+ m_cart[0]->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01);
break;
}
break;
@@ -257,8 +256,8 @@ void electron_romboxp_device::expbus_w(offs_t offset, uint8_t data)
switch (offset >> 8)
{
case 0xfc:
- m_cart[0]->write(offset & 0xff, data, 1, 0, m_romsel & 0x01, 0, 0);
- m_cart[1]->write(offset & 0xff, data, 1, 0, m_romsel & 0x01, 0, 0);
+ m_cart[0]->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01);
+ m_cart[1]->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01);
if (offset == 0xfc71)
{
@@ -267,8 +266,8 @@ void electron_romboxp_device::expbus_w(offs_t offset, uint8_t data)
break;
case 0xfd:
- m_cart[0]->write(offset & 0xff, data, 0, 1, m_romsel & 0x01, 0, 0);
- m_cart[1]->write(offset & 0xff, data, 0, 1, m_romsel & 0x01, 0, 0);
+ m_cart[0]->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01);
+ m_cart[1]->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01);
break;
case 0xfe:
@@ -285,7 +284,7 @@ void electron_romboxp_device::expbus_w(offs_t offset, uint8_t data)
// IMPLEMENTATION
//**************************************************************************
-uint8_t electron_romboxp_device::status_r()
+READ8_MEMBER(electron_romboxp_device::status_r)
{
// Status: b7: printer Busy
return (m_centronics_busy << 7) | 0x7f;
@@ -318,3 +317,13 @@ image_init_result electron_romboxp_device::load_rom(device_image_interface &imag
return image_init_result::PASS;
}
+
+WRITE_LINE_MEMBER(electron_romboxp_device::irq_w)
+{
+ m_slot->irq_w(state);
+}
+
+WRITE_LINE_MEMBER(electron_romboxp_device::nmi_w)
+{
+ m_slot->nmi_w(state);
+}
diff --git a/src/devices/bus/electron/romboxp.h b/src/devices/bus/electron/romboxp.h
index f5905bc47bf..e350954eb18 100644
--- a/src/devices/bus/electron/romboxp.h
+++ b/src/devices/bus/electron/romboxp.h
@@ -40,12 +40,14 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t expbus_r(offs_t offset) override;
- virtual void expbus_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) override;
private:
- uint8_t status_r();
+ DECLARE_READ8_MEMBER(status_r);
DECLARE_WRITE_LINE_MEMBER(busy_w);
+ DECLARE_WRITE_LINE_MEMBER(irq_w);
+ DECLARE_WRITE_LINE_MEMBER(nmi_w);
image_init_result load_rom(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }
diff --git a/src/devices/bus/ep64/exp.cpp b/src/devices/bus/ep64/exp.cpp
index c241fb68c08..32ef220519d 100644
--- a/src/devices/bus/ep64/exp.cpp
+++ b/src/devices/bus/ep64/exp.cpp
@@ -49,8 +49,7 @@ ep64_expansion_bus_slot_device::ep64_expansion_bus_slot_device(const machine_con
, m_write_irq(*this)
, m_write_nmi(*this)
, m_write_wait(*this)
- , m_program_space(*this, finder_base::DUMMY_TAG, -1)
- , m_io_space(*this, finder_base::DUMMY_TAG, -1)
+ , m_dave(*this, finder_base::DUMMY_TAG)
, m_card(nullptr)
{
}
diff --git a/src/devices/bus/ep64/exp.h b/src/devices/bus/ep64/exp.h
index 88d3b4e61b9..cb29bab5049 100644
--- a/src/devices/bus/ep64/exp.h
+++ b/src/devices/bus/ep64/exp.h
@@ -47,10 +47,40 @@
#pragma once
+#include "sound/dave.h"
+
void ep64_expansion_bus_cards(device_slot_interface &device);
//**************************************************************************
+// MACROS / CONSTANTS
+//**************************************************************************
+
+#define EP64_EXPANSION_BUS_TAG "exp"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_EP64_EXPANSION_BUS_SLOT_ADD(_tag, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, EP64_EXPANSION_BUS_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(ep64_expansion_bus_cards, _def_slot, false)
+
+#define MCFG_EP64_EXPANSION_BUS_SLOT_DAVE(_tag) \
+ downcast<ep64_expansion_bus_slot_device &>(*device).set_dave_tag(_tag);
+
+#define MCFG_EP64_EXPANSION_BUS_SLOT_IRQ_CALLBACK(_write) \
+ downcast<ep64_expansion_bus_slot_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
+
+#define MCFG_EP64_EXPANSION_BUS_SLOT_NMI_CALLBACK(_write) \
+ downcast<ep64_expansion_bus_slot_device &>(*device).set_nmi_wr_callback(DEVCB_##_write);
+
+#define MCFG_EP64_EXPANSION_BUS_SLOT_WAIT_CALLBACK(_write) \
+ downcast<ep64_expansion_bus_slot_device &>(*device).set_wait_wr_callback(DEVCB_##_write);
+
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -75,8 +105,7 @@ public:
}
ep64_expansion_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template <typename T> void set_program_space(T &&tag, int spacenum) { m_program_space.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_io_space(T &&tag, int spacenum) { m_io_space.set_tag(std::forward<T>(tag), spacenum); }
+ template <typename T> void set_dave_tag(T &&dave_tag) { m_dave.set_tag(std::forward<T>(dave_tag)); }
auto irq_wr() { return m_write_irq.bind(); }
auto nmi_wr() { return m_write_nmi.bind(); }
auto wait_wr() { return m_write_wait.bind(); }
@@ -85,8 +114,8 @@ public:
DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_write_nmi(state); }
DECLARE_WRITE_LINE_MEMBER( wait_w ) { m_write_wait(state); }
- address_space &program() { return *m_program_space; }
- address_space &io() { return *m_io_space; }
+ address_space& program() { return m_dave->space(AS_PROGRAM); }
+ address_space& io() { return m_dave->space(AS_IO); }
protected:
// device-level overrides
@@ -99,8 +128,7 @@ private:
devcb_write_line m_write_nmi;
devcb_write_line m_write_wait;
- required_address_space m_program_space;
- required_address_space m_io_space;
+ required_device<dave_device> m_dave;
device_ep64_expansion_bus_card_interface *m_card;
};
diff --git a/src/devices/bus/epson_sio/epson_sio.h b/src/devices/bus/epson_sio/epson_sio.h
index 5d93c42ba74..189e36c5bdf 100644
--- a/src/devices/bus/epson_sio/epson_sio.h
+++ b/src/devices/bus/epson_sio/epson_sio.h
@@ -12,35 +12,40 @@
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_EPSON_SIO_ADD(_tag, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, EPSON_SIO, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(epson_sio_devices, _def_slot, false)
+
+#define MCFG_EPSON_SIO_RX(_rx) \
+ downcast<epson_sio_device *>(device)->set_rx_callback(DEVCB_##_rx);
+
+#define MCFG_EPSON_SIO_PIN(_pin) \
+ downcast<epson_sio_device *>(device)->set_pin_callback(DEVCB_##_pin);
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class device_epson_sio_interface;
-// supported devices
-void epson_sio_devices(device_slot_interface &device);
class epson_sio_device : public device_t,
public device_slot_interface
{
public:
// construction/destruction
- epson_sio_device(machine_config const &mconfig, char const *tag, device_t *owner, char const *dflt)
- : epson_sio_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- epson_sio_devices(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- epson_sio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ epson_sio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~epson_sio_device();
// callbacks
- auto rx_callback() { return m_write_rx.bind(); }
- auto pin_callback() { return m_write_pin.bind(); }
+ template <class Object> devcb_base &set_rx_callback(Object &&rx) { return m_write_rx.set_callback(std::forward<Object>(rx)); }
+ template <class Object> devcb_base &set_pin_callback(Object &&pin) { return m_write_pin.set_callback(std::forward<Object>(pin)); }
// called from owner
DECLARE_WRITE_LINE_MEMBER( tx_w );
@@ -83,4 +88,9 @@ protected:
// device type definition
DECLARE_DEVICE_TYPE(EPSON_SIO, epson_sio_device)
+
+// supported devices
+void epson_sio_devices(device_slot_interface &device);
+
+
#endif // MAME_BUS_EPSON_SIO_EPSON_SIO_H
diff --git a/src/devices/bus/epson_sio/pf10.cpp b/src/devices/bus/epson_sio/pf10.cpp
index f986bb5d4c2..462de5ecaa3 100644
--- a/src/devices/bus/epson_sio/pf10.cpp
+++ b/src/devices/bus/epson_sio/pf10.cpp
@@ -12,6 +12,7 @@
#include "emu.h"
#include "pf10.h"
+#include "imagedev/floppy.h"
//**************************************************************************
@@ -60,8 +61,7 @@ static void pf10_floppies(device_slot_interface &device)
device.option_add("smd165", EPSON_SMD_165);
}
-void epson_pf10_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(epson_pf10_device::device_add_mconfig)
HD6303Y(config, m_cpu, XTAL(4'915'200)); // HD63A03XF
m_cpu->set_addrmap(AS_PROGRAM, &epson_pf10_device::cpu_mem);
m_cpu->in_p1_cb().set(FUNC(epson_pf10_device::port1_r));
@@ -71,12 +71,12 @@ void epson_pf10_device::device_add_mconfig(machine_config &config)
m_cpu->out_ser_tx_cb().set(FUNC(epson_pf10_device::hd6303_tx_w));
UPD765A(config, m_fdc, 4'000'000, false, true);
- FLOPPY_CONNECTOR(config, m_floppy, pf10_floppies, "smd165", floppy_image_device::default_floppy_formats);
+ MCFG_FLOPPY_DRIVE_ADD("upd765a:0", pf10_floppies, "smd165", floppy_image_device::default_floppy_formats)
- EPSON_SIO(config, m_sio_output, nullptr);
- m_sio_output->rx_callback().set(DEVICE_SELF, FUNC(epson_pf10_device::rxc_w));
- m_sio_output->pin_callback().set(DEVICE_SELF, FUNC(epson_pf10_device::pinc_w));
-}
+ MCFG_EPSON_SIO_ADD("sio", nullptr)
+ MCFG_EPSON_SIO_RX(WRITELINE(DEVICE_SELF, epson_pf10_device, rxc_w))
+ MCFG_EPSON_SIO_PIN(WRITELINE(DEVICE_SELF, epson_pf10_device, pinc_w))
+MACHINE_CONFIG_END
//**************************************************************************
@@ -92,9 +92,7 @@ epson_pf10_device::epson_pf10_device(const machine_config &mconfig, const char *
device_epson_sio_interface(mconfig, *this),
m_cpu(*this, "maincpu"),
m_fdc(*this, "upd765a"),
- m_sio_output(*this, "sio"),
- m_floppy(*this, "upd765a:0"),
- m_timer(nullptr),
+ m_sio_output(*this, "sio"), m_floppy(nullptr), m_timer(nullptr),
m_port1(0xff),
m_port2(0xff),
m_rxc(1), m_hd6303_tx(0), m_pinc(0)
@@ -110,6 +108,7 @@ epson_pf10_device::epson_pf10_device(const machine_config &mconfig, const char *
void epson_pf10_device::device_start()
{
m_timer = timer_alloc(0, nullptr);
+ m_floppy = subdevice<floppy_connector>("upd765a:0")->get_device();
}
//-------------------------------------------------
@@ -159,8 +158,7 @@ READ8_MEMBER( epson_pf10_device::port2_r )
WRITE8_MEMBER( epson_pf10_device::port2_w )
{
- if (m_floppy->get_device() != nullptr)
- m_floppy->get_device()->mon_w(data & PORT2_MON);
+ m_floppy->mon_w(data & PORT2_MON);
logerror("%s: port2_w(%02x)\n", tag(), data);
}
diff --git a/src/devices/bus/epson_sio/pf10.h b/src/devices/bus/epson_sio/pf10.h
index 7f305bed8c9..b75f596b615 100644
--- a/src/devices/bus/epson_sio/pf10.h
+++ b/src/devices/bus/epson_sio/pf10.h
@@ -15,7 +15,6 @@
#include "epson_sio.h"
#include "cpu/m6800/m6801.h"
-#include "imagedev/floppy.h"
#include "machine/upd765.h"
@@ -68,9 +67,9 @@ private:
required_device<hd6303y_cpu_device> m_cpu;
required_device<upd765a_device> m_fdc;
required_device<epson_sio_device> m_sio_output;
- required_device<floppy_connector> m_floppy;
epson_sio_device *m_sio_input;
+ floppy_image_device *m_floppy;
emu_timer *m_timer;
diff --git a/src/devices/bus/epson_sio/tf20.cpp b/src/devices/bus/epson_sio/tf20.cpp
index 1fb12a66c0e..22959af2730 100644
--- a/src/devices/bus/epson_sio/tf20.cpp
+++ b/src/devices/bus/epson_sio/tf20.cpp
@@ -14,6 +14,7 @@
#include "emu.h"
#include "tf20.h"
+#include "imagedev/floppy.h"
#define XTAL_CR1 XTAL(8'000'000)
#define XTAL_CR2 XTAL(4'915'200)
@@ -86,12 +87,11 @@ static void tf20_floppies(device_slot_interface &device)
device.option_add("sd320", EPSON_SD_320);
}
-void epson_tf20_device::device_add_mconfig(machine_config &config)
-{
- Z80(config, m_cpu, XTAL_CR1 / 2); /* uPD780C */
- m_cpu->set_addrmap(AS_PROGRAM, &epson_tf20_device::cpu_mem);
- m_cpu->set_addrmap(AS_IO, &epson_tf20_device::cpu_io);
- m_cpu->set_irq_acknowledge_callback(FUNC(epson_tf20_device::irq_callback));
+MACHINE_CONFIG_START(epson_tf20_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("19b", Z80, XTAL_CR1 / 2) /* uPD780C */
+ MCFG_DEVICE_PROGRAM_MAP(cpu_mem)
+ MCFG_DEVICE_IO_MAP(cpu_io)
+ MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE(DEVICE_SELF, epson_tf20_device, irq_callback)
// 64k internal ram
RAM(config, "ram").set_default_size("64K");
@@ -106,14 +106,14 @@ void epson_tf20_device::device_add_mconfig(machine_config &config)
m_fdc->intrq_wr_callback().set_inputline(m_cpu, INPUT_LINE_IRQ0);
// floppy drives
- for (auto &fd : m_fd)
- FLOPPY_CONNECTOR(config, fd, tf20_floppies, "sd320", floppy_image_device::default_floppy_formats);
+ MCFG_FLOPPY_DRIVE_ADD("5a:0", tf20_floppies, "sd320", floppy_image_device::default_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD("5a:1", tf20_floppies, "sd320", floppy_image_device::default_floppy_formats)
// serial interface to another device
- EPSON_SIO(config, m_sio_output, nullptr);
- m_sio_output->rx_callback().set(DEVICE_SELF, FUNC(epson_tf20_device::rxc_w));
- m_sio_output->pin_callback().set(DEVICE_SELF, FUNC(epson_tf20_device::pinc_w));
-}
+ MCFG_EPSON_SIO_ADD("sio", nullptr)
+ MCFG_EPSON_SIO_RX(WRITELINE(DEVICE_SELF, epson_tf20_device, rxc_w))
+ MCFG_EPSON_SIO_PIN(WRITELINE(DEVICE_SELF, epson_tf20_device, pinc_w))
+MACHINE_CONFIG_END
//**************************************************************************
@@ -131,9 +131,7 @@ epson_tf20_device::epson_tf20_device(const machine_config &mconfig, const char *
m_ram(*this, "ram"),
m_fdc(*this, "5a"),
m_mpsc(*this, "3a"),
- m_sio_output(*this, "sio"),
- m_fd(*this, "5a:%u", 0U),
- m_timer_serial(nullptr), m_timer_tc(nullptr),
+ m_sio_output(*this, "sio"), m_fd0(nullptr), m_fd1(nullptr), m_timer_serial(nullptr), m_timer_tc(nullptr),
m_rxc(1), m_txda(0), m_dtra(0), m_pinc(0)
{
m_sio_input = dynamic_cast<epson_sio_device *>(owner);
@@ -152,6 +150,9 @@ void epson_tf20_device::device_start()
m_timer_serial = timer_alloc(0, nullptr);
m_timer_tc = timer_alloc(1, nullptr);
+ m_fd0 = subdevice<floppy_connector>("5a:0")->get_device();
+ m_fd1 = subdevice<floppy_connector>("5a:1")->get_device();
+
// enable second half of ram
m_cpu->space(AS_PROGRAM).install_ram(0x8000, 0xffff, m_ram->pointer() + 0x8000);
@@ -247,9 +248,8 @@ WRITE8_MEMBER( epson_tf20_device::fdc_control_w )
logerror("%s: tf20_fdc_control_w(%02x)\n", machine().describe_context(), data);
// bit 0, motor on signal
- for (auto &fd : m_fd)
- if (fd->get_device() != nullptr)
- fd->get_device()->mon_w(!BIT(data, 0));
+ m_fd0->mon_w(!BIT(data, 0));
+ m_fd1->mon_w(!BIT(data, 0));
}
diff --git a/src/devices/bus/epson_sio/tf20.h b/src/devices/bus/epson_sio/tf20.h
index 236cd2e9059..0a9023f51d5 100644
--- a/src/devices/bus/epson_sio/tf20.h
+++ b/src/devices/bus/epson_sio/tf20.h
@@ -15,7 +15,6 @@
#include "epson_sio.h"
#include "cpu/z80/z80.h"
-#include "imagedev/floppy.h"
#include "machine/ram.h"
#include "machine/upd765.h"
#include "machine/z80dart.h"
@@ -68,7 +67,9 @@ private:
required_device<upd765a_device> m_fdc;
required_device<upd7201_device> m_mpsc;
required_device<epson_sio_device> m_sio_output;
- required_device_array<floppy_connector, 2> m_fd;
+
+ floppy_image_device *m_fd0;
+ floppy_image_device *m_fd1;
emu_timer *m_timer_serial;
emu_timer *m_timer_tc;
diff --git a/src/devices/bus/gamate/rom.cpp b/src/devices/bus/gamate/rom.cpp
index 74af9e76160..cda37716b5f 100644
--- a/src/devices/bus/gamate/rom.cpp
+++ b/src/devices/bus/gamate/rom.cpp
@@ -168,10 +168,9 @@ WRITE8_MEMBER(gamate_rom_4in1_device::write_rom)
}
}
-void gamate_rom_plain_device::device_add_mconfig(machine_config &config)
-{
- GAMATE_PROT(config, m_protection, 0);
-}
+MACHINE_CONFIG_START(gamate_rom_plain_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("protection", GAMATE_PROT, 0)
+MACHINE_CONFIG_END
/*-------------------------------------------------
diff --git a/src/devices/bus/gamate/slot.h b/src/devices/bus/gamate/slot.h
index 3606ac32c69..0f48c490478 100644
--- a/src/devices/bus/gamate/slot.h
+++ b/src/devices/bus/gamate/slot.h
@@ -51,17 +51,7 @@ class gamate_cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- gamate_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : gamate_cart_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- gamate_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ gamate_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~gamate_cart_slot_device();
// image-level overrides
@@ -105,6 +95,10 @@ DECLARE_DEVICE_TYPE(GAMATE_CART_SLOT, gamate_cart_slot_device)
#define GAMATESLOT_ROM_REGION_TAG ":cart:rom"
+#define MCFG_GAMATE_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, GAMATE_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
void gamate_cart(device_slot_interface &device);
#endif // MAME_BUS_GAMATE_SLOT_H
diff --git a/src/devices/bus/gameboy/gb_slot.cpp b/src/devices/bus/gameboy/gb_slot.cpp
index a72eedc24d5..7ce626e67c7 100644
--- a/src/devices/bus/gameboy/gb_slot.cpp
+++ b/src/devices/bus/gameboy/gb_slot.cpp
@@ -624,18 +624,18 @@ std::string megaduck_cart_slot_device::get_default_card_software(get_default_car
read
-------------------------------------------------*/
-uint8_t gb_cart_slot_device_base::read_rom(offs_t offset)
+READ8_MEMBER(gb_cart_slot_device_base::read_rom)
{
if (m_cart)
- return m_cart->read_rom(offset);
+ return m_cart->read_rom(space, offset);
else
return 0xff;
}
-uint8_t gb_cart_slot_device_base::read_ram(offs_t offset)
+READ8_MEMBER(gb_cart_slot_device_base::read_ram)
{
if (m_cart)
- return m_cart->read_ram(offset);
+ return m_cart->read_ram(space, offset);
else
return 0xff;
}
@@ -645,16 +645,16 @@ uint8_t gb_cart_slot_device_base::read_ram(offs_t offset)
write
-------------------------------------------------*/
-void gb_cart_slot_device_base::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_cart_slot_device_base::write_bank)
{
if (m_cart)
- m_cart->write_bank(offset, data);
+ m_cart->write_bank(space, offset, data);
}
-void gb_cart_slot_device_base::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_cart_slot_device_base::write_ram)
{
if (m_cart)
- m_cart->write_ram(offset, data);
+ m_cart->write_ram(space, offset, data);
}
diff --git a/src/devices/bus/gameboy/gb_slot.h b/src/devices/bus/gameboy/gb_slot.h
index 5f420c60823..ef734e6f99e 100644
--- a/src/devices/bus/gameboy/gb_slot.h
+++ b/src/devices/bus/gameboy/gb_slot.h
@@ -58,10 +58,10 @@ public:
virtual ~device_gb_cart_interface();
// reading and writing
- virtual uint8_t read_rom(offs_t offset) { return 0xff; }
- virtual void write_bank(offs_t offset, uint8_t data) {}
- virtual uint8_t read_ram(offs_t offset) { return 0xff; }
- virtual void write_ram(offs_t offset, uint8_t data) {}
+ virtual DECLARE_READ8_MEMBER(read_rom) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_bank) {}
+ virtual DECLARE_READ8_MEMBER(read_ram) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_ram) {}
void rom_alloc(uint32_t size, const char *tag);
void ram_alloc(uint32_t size);
@@ -145,10 +145,10 @@ public:
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
// reading and writing
- virtual uint8_t read_rom(offs_t offset);
- virtual void write_bank(offs_t offset, uint8_t data);
- virtual uint8_t read_ram(offs_t offset);
- virtual void write_ram(offs_t offset, uint8_t data);
+ virtual DECLARE_READ8_MEMBER(read_rom);
+ virtual DECLARE_WRITE8_MEMBER(write_bank);
+ virtual DECLARE_READ8_MEMBER(read_ram);
+ virtual DECLARE_WRITE8_MEMBER(write_ram);
protected:
diff --git a/src/devices/bus/gameboy/mbc.cpp b/src/devices/bus/gameboy/mbc.cpp
index bd57a4da23b..286c2d90a1e 100644
--- a/src/devices/bus/gameboy/mbc.cpp
+++ b/src/devices/bus/gameboy/mbc.cpp
@@ -347,12 +347,12 @@ void gb_rom_camera_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-uint8_t gb_rom_mbc_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_mbc_device::read_rom)
{
return m_rom[rom_bank_map[m_latch_bank] + offset];
}
-uint8_t gb_rom_mbc_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_mbc_device::read_ram)
{
if (!m_ram.empty())
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + offset];
@@ -360,7 +360,7 @@ uint8_t gb_rom_mbc_device::read_ram(offs_t offset)
return 0xff;
}
-void gb_rom_mbc_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mbc_device::write_ram)
{
if (!m_ram.empty())
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + offset] = data;
@@ -369,7 +369,7 @@ void gb_rom_mbc_device::write_ram(offs_t offset, uint8_t data)
// MBC1
-uint8_t gb_rom_mbc1_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_mbc1_device::read_rom)
{
if (offset & 0x4000) /* RB1 */
return m_rom[rom_bank_map[(m_ram_bank << (5 + m_shift)) | m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
@@ -380,7 +380,7 @@ uint8_t gb_rom_mbc1_device::read_rom(offs_t offset)
}
}
-void gb_rom_mbc1_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mbc1_device::write_bank)
{
// the mapper only uses inputs A15..A13
switch (offset & 0xe000)
@@ -402,7 +402,7 @@ void gb_rom_mbc1_device::write_bank(offs_t offset, uint8_t data)
}
}
-uint8_t gb_rom_mbc1_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_mbc1_device::read_ram)
{
if (!m_ram.empty() && m_ram_enable)
{
@@ -413,7 +413,7 @@ uint8_t gb_rom_mbc1_device::read_ram(offs_t offset)
return 0xff;
}
-void gb_rom_mbc1_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mbc1_device::write_ram)
{
if (!m_ram.empty() && m_ram_enable)
{
@@ -425,7 +425,7 @@ void gb_rom_mbc1_device::write_ram(offs_t offset, uint8_t data)
// MBC2
-uint8_t gb_rom_mbc2_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_mbc2_device::read_rom)
{
if (offset & 0x4000) /* RB1 */
return m_rom[rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
@@ -433,7 +433,7 @@ uint8_t gb_rom_mbc2_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
}
-void gb_rom_mbc2_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mbc2_device::write_bank)
{
// the mapper only has data lines D3..D0
data &= 0x0f;
@@ -450,7 +450,7 @@ void gb_rom_mbc2_device::write_bank(offs_t offset, uint8_t data)
}
}
-uint8_t gb_rom_mbc2_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_mbc2_device::read_ram)
{
if (!m_ram.empty() && m_ram_enable)
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x01ff)] | 0xf0;
@@ -458,7 +458,7 @@ uint8_t gb_rom_mbc2_device::read_ram(offs_t offset)
return 0xff;
}
-void gb_rom_mbc2_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mbc2_device::write_ram)
{
if (!m_ram.empty() && m_ram_enable)
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x01ff)] = data & 0x0f;
@@ -479,7 +479,7 @@ void gb_rom_mbc3_device::update_rtc()
m_rtc_regs[4] = (m_rtc_regs[4] & 0xf0) | (curtime.local_time.day >> 8);
}
-uint8_t gb_rom_mbc3_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_mbc3_device::read_rom)
{
if (offset < 0x4000)
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
@@ -487,7 +487,7 @@ uint8_t gb_rom_mbc3_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
}
-void gb_rom_mbc3_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mbc3_device::write_bank)
{
if (offset < 0x2000)
m_ram_enable = ((data & 0x0f) == 0x0a) ? 1 : 0;
@@ -517,7 +517,7 @@ void gb_rom_mbc3_device::write_bank(offs_t offset, uint8_t data)
}
}
-uint8_t gb_rom_mbc3_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_mbc3_device::read_ram)
{
if (m_ram_bank < 4 && m_ram_enable)
{
@@ -534,7 +534,7 @@ uint8_t gb_rom_mbc3_device::read_ram(offs_t offset)
return 0xff;
}
-void gb_rom_mbc3_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mbc3_device::write_ram)
{
if (m_ram_bank < 4 && m_ram_enable)
{
@@ -552,7 +552,7 @@ void gb_rom_mbc3_device::write_ram(offs_t offset, uint8_t data)
// MBC5
-uint8_t gb_rom_mbc5_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_mbc5_device::read_rom)
{
if (offset < 0x4000)
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
@@ -560,7 +560,7 @@ uint8_t gb_rom_mbc5_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
}
-void gb_rom_mbc5_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mbc5_device::write_bank)
{
if (offset < 0x2000)
m_ram_enable = ((data & 0x0f) == 0x0a) ? 1 : 0;
@@ -588,7 +588,7 @@ void gb_rom_mbc5_device::write_bank(offs_t offset, uint8_t data)
}
}
-uint8_t gb_rom_mbc5_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_mbc5_device::read_ram)
{
if (!m_ram.empty() && m_ram_enable)
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)];
@@ -596,7 +596,7 @@ uint8_t gb_rom_mbc5_device::read_ram(offs_t offset)
return 0xff;
}
-void gb_rom_mbc5_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mbc5_device::write_ram)
{
if (!m_ram.empty() && m_ram_enable)
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
@@ -604,7 +604,7 @@ void gb_rom_mbc5_device::write_ram(offs_t offset, uint8_t data)
// MBC6
-uint8_t gb_rom_mbc6_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_mbc6_device::read_rom)
{
if (offset < 0x4000)
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
@@ -614,7 +614,7 @@ uint8_t gb_rom_mbc6_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[m_bank_6000 >> 1] * 0x4000 + (m_bank_6000 & 0x01) * 0x2000 + (offset & 0x1fff)];
}
-void gb_rom_mbc6_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mbc6_device::write_bank)
{
if (offset < 0x2000)
{
@@ -636,7 +636,7 @@ void gb_rom_mbc6_device::write_bank(offs_t offset, uint8_t data)
}
}
-uint8_t gb_rom_mbc6_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_mbc6_device::read_ram)
{
if (!m_ram.empty())
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)];
@@ -644,7 +644,7 @@ uint8_t gb_rom_mbc6_device::read_ram(offs_t offset)
return 0xff;
}
-void gb_rom_mbc6_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mbc6_device::write_ram)
{
if (!m_ram.empty())
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
@@ -652,7 +652,7 @@ void gb_rom_mbc6_device::write_ram(offs_t offset, uint8_t data)
// MBC7
-uint8_t gb_rom_mbc7_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_mbc7_device::read_rom)
{
if (offset < 0x4000)
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
@@ -660,7 +660,7 @@ uint8_t gb_rom_mbc7_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
}
-void gb_rom_mbc7_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mbc7_device::write_bank)
{
if (offset < 0x2000)
{
@@ -693,7 +693,7 @@ void gb_rom_mbc7_device::write_bank(offs_t offset, uint8_t data)
}
}
-uint8_t gb_rom_mbc7_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_mbc7_device::read_ram)
{
if (!m_ram.empty())
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)];
@@ -701,7 +701,7 @@ uint8_t gb_rom_mbc7_device::read_ram(offs_t offset)
return 0xff;
}
-void gb_rom_mbc7_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mbc7_device::write_ram)
{
if (!m_ram.empty())
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
@@ -710,12 +710,12 @@ void gb_rom_mbc7_device::write_ram(offs_t offset, uint8_t data)
// M161
-uint8_t gb_rom_m161_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_m161_device::read_rom)
{
return m_rom[rom_bank_map[m_base_bank] * 0x4000 + (offset & 0x7fff)];
}
-void gb_rom_m161_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_m161_device::write_bank)
{
// the mapper (74HC161A) only has data lines D2..D0
data &= 0x07;
@@ -736,7 +736,7 @@ void gb_rom_m161_device::write_bank(offs_t offset, uint8_t data)
// MMM01
-uint8_t gb_rom_mmm01_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_mmm01_device::read_rom)
{
uint16_t romb = m_romb & ~(0x1e0 | m_romb_nwe);
uint16_t romb_base = m_romb & (0x1e0 | m_romb_nwe);
@@ -765,7 +765,7 @@ uint8_t gb_rom_mmm01_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[romb] * 0x4000 + (offset & 0x3fff)];
}
-void gb_rom_mmm01_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mmm01_device::write_bank)
{
// the mapper only has data lines D6..D0
data &= 0x7f;
@@ -810,7 +810,7 @@ void gb_rom_mmm01_device::write_bank(offs_t offset, uint8_t data)
}
}
-uint8_t gb_rom_mmm01_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_mmm01_device::read_ram)
{
uint8_t ramb_masked = ((offset & 0x4000) | m_mode ? m_ramb : m_ramb & ~0x03);
uint8_t ramb = ramb_masked;
@@ -827,7 +827,7 @@ uint8_t gb_rom_mmm01_device::read_ram(offs_t offset)
return 0xff;
}
-void gb_rom_mmm01_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_mmm01_device::write_ram)
{
uint8_t ramb_masked = ((offset & 0x4000) | m_mode ? m_ramb : m_ramb & ~0x03);
uint8_t ramb = ramb_masked;
@@ -844,7 +844,7 @@ void gb_rom_mmm01_device::write_ram(offs_t offset, uint8_t data)
// Sachen MMC1
-uint8_t gb_rom_sachen_mmc1_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_sachen_mmc1_device::read_rom)
{
uint16_t off_edit = offset;
@@ -875,7 +875,7 @@ uint8_t gb_rom_sachen_mmc1_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[(m_base_bank & m_mask) | (m_latch_bank & ~m_mask)] * 0x4000 + (off_edit & 0x3fff)];
}
-void gb_rom_sachen_mmc1_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_sachen_mmc1_device::write_bank)
{
/* Only A15..A6, A4, A1..A0 are connected */
/* We only decode upper three bits */
@@ -916,7 +916,7 @@ void gb_rom_sachen_mmc1_device::write_bank(offs_t offset, uint8_t data)
// Sachen MMC2
-uint8_t gb_rom_sachen_mmc2_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_sachen_mmc2_device::read_rom)
{
uint16_t off_edit = offset;
@@ -954,7 +954,7 @@ uint8_t gb_rom_sachen_mmc2_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[(m_base_bank & m_mask) | (m_latch_bank & ~m_mask)] * 0x4000 + (off_edit & 0x3fff)];
}
-uint8_t gb_rom_sachen_mmc2_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_sachen_mmc2_device::read_ram)
{
if (m_mode == MODE_LOCKED_DMG) {
m_unlock_cnt = 0x00;
@@ -964,7 +964,7 @@ uint8_t gb_rom_sachen_mmc2_device::read_ram(offs_t offset)
}
-void gb_rom_sachen_mmc2_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_sachen_mmc2_device::write_ram)
{
if (m_mode == MODE_LOCKED_DMG) {
m_unlock_cnt = 0x00;
@@ -976,7 +976,7 @@ void gb_rom_sachen_mmc2_device::write_ram(offs_t offset, uint8_t data)
// 188 in 1 pirate (only preliminary)
-uint8_t gb_rom_188in1_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_188in1_device::read_rom)
{
if (offset < 0x4000)
return m_rom[m_game_base + rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
@@ -984,7 +984,7 @@ uint8_t gb_rom_188in1_device::read_rom(offs_t offset)
return m_rom[m_game_base + rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
}
-void gb_rom_188in1_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_188in1_device::write_bank)
{
if (offset == 0x7b00)
{
@@ -1003,24 +1003,24 @@ void gb_rom_188in1_device::write_bank(offs_t offset, uint8_t data)
printf("write to 0x%X data 0x%X\n", offset, data);
}
else
- gb_rom_mbc1_device::write_bank(offset, data);
+ gb_rom_mbc1_device::write_bank(space, offset, data);
}
// MBC5 variant used by Li Cheng / Niutoude games
-void gb_rom_licheng_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_licheng_device::write_bank)
{
if (offset > 0x2100 && offset < 0x3000)
return;
- gb_rom_mbc5_device::write_bank(offset, data);
+ gb_rom_mbc5_device::write_bank(space, offset, data);
}
// MBC5 variant used by Chong Wu Xiao Jing Ling (this appears to be a re-release of a Li Cheng / Niutoude game,
// given that it contains the Niutoude logo, with most protection checks patched out)
-uint8_t gb_rom_chongwu_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_chongwu_device::read_rom)
{
// protection check at the first read here...
if (offset == 0x41c3 && !m_protection_checked)
@@ -1056,7 +1056,7 @@ void gb_rom_sintax_device::set_xor_for_bank(uint8_t bank)
}
}
-uint8_t gb_rom_sintax_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_sintax_device::read_rom)
{
if (offset < 0x4000)
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
@@ -1064,7 +1064,7 @@ uint8_t gb_rom_sintax_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)] ^ m_currentxor;
}
-void gb_rom_sintax_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_sintax_device::write_bank)
{
if (offset < 0x2000)
m_ram_enable = ((data & 0x0f) == 0x0a) ? 1 : 0;
@@ -1113,7 +1113,7 @@ void gb_rom_sintax_device::write_bank(offs_t offset, uint8_t data)
if (!m_sintax_mode)
{
m_sintax_mode = data;
- write_bank(0x2000, 1); //force a fake bank switch
+ write_bank(space, 0x2000, 1); //force a fake bank switch
}
// printf("sintax mode %x\n", m_sintax_mode & 0xf);
}
@@ -1141,7 +1141,7 @@ void gb_rom_sintax_device::write_bank(offs_t offset, uint8_t data)
}
-uint8_t gb_rom_sintax_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_sintax_device::read_ram)
{
if (!m_ram.empty() && m_ram_enable)
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)];
@@ -1149,7 +1149,7 @@ uint8_t gb_rom_sintax_device::read_ram(offs_t offset)
return 0xff;
}
-void gb_rom_sintax_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_sintax_device::write_ram)
{
if (!m_ram.empty() && m_ram_enable)
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
@@ -1169,7 +1169,7 @@ void gb_rom_sintax_device::write_ram(offs_t offset, uint8_t data)
// MBC5 variant used by Digimon 2 (and maybe 4?)
-uint8_t gb_rom_digimon_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_digimon_device::read_rom)
{
if (offset < 0x4000)
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
@@ -1177,7 +1177,7 @@ uint8_t gb_rom_digimon_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
}
-void gb_rom_digimon_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_digimon_device::write_bank)
{
if (offset < 0x2000)
m_ram_enable = ((data & 0x0f) == 0x0a) ? 1 : 0;
@@ -1206,7 +1206,7 @@ void gb_rom_digimon_device::write_bank(offs_t offset, uint8_t data)
// printf("written $07 %X at %X\n", data, offset);
}
-uint8_t gb_rom_digimon_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_digimon_device::read_ram)
{
if (!m_ram.empty() && m_ram_enable)
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)];
@@ -1214,7 +1214,7 @@ uint8_t gb_rom_digimon_device::read_ram(offs_t offset)
return 0xff;
}
-void gb_rom_digimon_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_digimon_device::write_ram)
{
if (!m_ram.empty() && m_ram_enable)
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
@@ -1223,7 +1223,7 @@ void gb_rom_digimon_device::write_ram(offs_t offset, uint8_t data)
// MBC1 variant used by Yong Yong for Rockman 8
-uint8_t gb_rom_rockman8_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_rockman8_device::read_rom)
{
if (offset < 0x4000)
return m_rom[m_latch_bank * 0x4000 + (offset & 0x3fff)];
@@ -1231,7 +1231,7 @@ uint8_t gb_rom_rockman8_device::read_rom(offs_t offset)
return m_rom[m_latch_bank2 * 0x4000 + (offset & 0x3fff)];
}
-void gb_rom_rockman8_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_rockman8_device::write_bank)
{
if (offset < 0x2000)
return;
@@ -1248,7 +1248,7 @@ void gb_rom_rockman8_device::write_bank(offs_t offset, uint8_t data)
}
}
-uint8_t gb_rom_rockman8_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_rockman8_device::read_ram)
{
if (!m_ram.empty())
return m_ram[offset];
@@ -1256,7 +1256,7 @@ uint8_t gb_rom_rockman8_device::read_ram(offs_t offset)
return 0xff;
}
-void gb_rom_rockman8_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_rockman8_device::write_ram)
{
if (!m_ram.empty())
m_ram[offset] = data;
@@ -1291,7 +1291,7 @@ static uint8_t smb3_table1[0x20] =
// however, no such a write ever happen (only bit4 is written, but changing mode with
// bit4 breaks the gfx...)
-uint8_t gb_rom_sm3sp_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_sm3sp_device::read_rom)
{
if (offset < 0x4000)
return m_rom[rom_bank_map[0] * 0x4000 + (offset & 0x3fff)];
@@ -1299,7 +1299,7 @@ uint8_t gb_rom_sm3sp_device::read_rom(offs_t offset)
return m_rom[m_latch_bank2 * 0x4000 + (offset & 0x3fff)];
}
-void gb_rom_sm3sp_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_sm3sp_device::write_bank)
{
// printf("write 0x%x at %x\n", data, offset);
if (offset < 0x2000)
@@ -1352,11 +1352,11 @@ void gb_rom_sm3sp_device::write_bank(offs_t offset, uint8_t data)
{
// printf("write mode %x\n", data);
m_mode = BIT(data, 5);
-// write_bank(0x2000, 1);
+// write_bank(space, 0x2000, 1);
}
}
-uint8_t gb_rom_sm3sp_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_sm3sp_device::read_ram)
{
if (!m_ram.empty())
return m_ram[offset];
@@ -1364,7 +1364,7 @@ uint8_t gb_rom_sm3sp_device::read_ram(offs_t offset)
return 0xff;
}
-void gb_rom_sm3sp_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_sm3sp_device::write_ram)
{
if (!m_ram.empty())
m_ram[offset] = data;
@@ -1375,7 +1375,7 @@ void gb_rom_camera_device::update_camera()
m_camera_regs[0] &= ~0x1;
}
-uint8_t gb_rom_camera_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_camera_device::read_rom)
{
if (offset < 0x4000)
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
@@ -1383,7 +1383,7 @@ uint8_t gb_rom_camera_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
}
-void gb_rom_camera_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_camera_device::write_bank)
{
if (offset < 0x2000)
m_ram_enable = ((data & 0x0f) == 0x0a) ? 1 : 0;
@@ -1403,7 +1403,7 @@ void gb_rom_camera_device::write_bank(offs_t offset, uint8_t data)
}
}
-uint8_t gb_rom_camera_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_camera_device::read_ram)
{
if ((m_ram_bank & 0x10) != 0)
return (offset == 0) ? (m_camera_regs[0] & 0x7) : 0;
@@ -1417,7 +1417,7 @@ uint8_t gb_rom_camera_device::read_ram(offs_t offset)
return 0;
}
-void gb_rom_camera_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_camera_device::write_ram)
{
if ((m_ram_bank & 0x10) != 0)
{
diff --git a/src/devices/bus/gameboy/mbc.h b/src/devices/bus/gameboy/mbc.h
index 9658369d6fb..4bc169488bf 100644
--- a/src/devices/bus/gameboy/mbc.h
+++ b/src/devices/bus/gameboy/mbc.h
@@ -13,9 +13,9 @@ class gb_rom_mbc_device : public device_t,
{
public:
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
// construction/destruction
@@ -40,10 +40,10 @@ public:
// construction/destruction
gb_rom_mbc1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
enum {
@@ -70,10 +70,10 @@ public:
// construction/destruction
gb_rom_mbc2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
// device-level overrides
@@ -89,10 +89,10 @@ public:
// construction/destruction
gb_rom_mbc3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
// device-level overrides
@@ -113,10 +113,10 @@ public:
// construction/destruction
gb_rom_mbc5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
gb_rom_mbc5_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -134,10 +134,10 @@ public:
// construction/destruction
gb_rom_mbc6_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
// device-level overrides
@@ -156,10 +156,10 @@ public:
// construction/destruction
gb_rom_mbc7_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
// device-level overrides
@@ -175,10 +175,10 @@ public:
// construction/destruction
gb_rom_m161_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override { return 0xff; }
- virtual void write_ram(offs_t offset, uint8_t data) override { }
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override { }
protected:
// device-level overrides
@@ -197,10 +197,10 @@ public:
gb_rom_mmm01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
// device-level overrides
@@ -225,10 +225,10 @@ public:
// construction/destruction
gb_rom_sachen_mmc1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override { return 0xff; }
- virtual void write_ram(offs_t offset, uint8_t data) override { }
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override { }
protected:
enum {
@@ -253,9 +253,9 @@ public:
// construction/destruction
gb_rom_sachen_mmc2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_rom(offs_t offset) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
enum {
@@ -277,8 +277,8 @@ public:
gb_rom_188in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
protected:
// device-level overrides
@@ -297,10 +297,10 @@ public:
gb_rom_sintax_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
// device-level overrides
@@ -321,7 +321,7 @@ public:
// construction/destruction
gb_rom_chongwu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_rom(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
protected:
// device-level overrides
@@ -339,7 +339,7 @@ public:
// construction/destruction
gb_rom_licheng_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_bank(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
};
// ======================> gb_rom_digimon_device
@@ -350,15 +350,15 @@ public:
// construction/destruction
gb_rom_digimon_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
protected:
// device-level overrides
virtual void device_start() override { shared_start(); }
virtual void device_reset() override { shared_reset(); }
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
};
// ======================> gb_rom_rockman8_device
@@ -369,10 +369,10 @@ public:
gb_rom_rockman8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
// device-level overrides
@@ -390,10 +390,10 @@ public:
gb_rom_sm3sp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
// device-level overrides
@@ -410,10 +410,10 @@ public:
// construction/destruction
gb_rom_camera_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
// device-level overrides
diff --git a/src/devices/bus/gameboy/rom.cpp b/src/devices/bus/gameboy/rom.cpp
index d3e90d73f51..47049bcd836 100644
--- a/src/devices/bus/gameboy/rom.cpp
+++ b/src/devices/bus/gameboy/rom.cpp
@@ -145,13 +145,13 @@ void megaduck_rom_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-uint8_t gb_rom_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_device::read_rom)
{
m_latch_bank = offset / 0x4000;
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
}
-uint8_t gb_rom_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_device::read_ram)
{
if (!m_ram.empty())
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + offset];
@@ -159,7 +159,7 @@ uint8_t gb_rom_device::read_ram(offs_t offset)
return 0xff;
}
-void gb_rom_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_device::write_ram)
{
if (!m_ram.empty())
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + offset] = data;
@@ -168,7 +168,7 @@ void gb_rom_device::write_ram(offs_t offset, uint8_t data)
// Tamagotchi
-uint8_t gb_rom_tama5_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_tama5_device::read_rom)
{
if (offset < 0x4000)
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
@@ -176,12 +176,12 @@ uint8_t gb_rom_tama5_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
}
-uint8_t gb_rom_tama5_device::read_ram(offs_t offset)
+READ8_MEMBER(gb_rom_tama5_device::read_ram)
{
return m_rtc_reg;
}
-void gb_rom_tama5_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_tama5_device::write_ram)
{
switch (offset & 0x0001)
{
@@ -259,12 +259,12 @@ void gb_rom_tama5_device::write_ram(offs_t offset, uint8_t data)
// Wisdom Tree
-uint8_t gb_rom_wisdom_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_wisdom_device::read_rom)
{
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + offset];
}
-void gb_rom_wisdom_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_wisdom_device::write_bank)
{
if (offset < 0x4000)
m_latch_bank = (offset << 1) & 0x1ff;
@@ -273,7 +273,7 @@ void gb_rom_wisdom_device::write_bank(offs_t offset, uint8_t data)
// Yong Yong pirate
-uint8_t gb_rom_yong_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_yong_device::read_rom)
{
if (offset < 0x4000)
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
@@ -281,7 +281,7 @@ uint8_t gb_rom_yong_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
}
-void gb_rom_yong_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_yong_device::write_bank)
{
if (offset == 0x2000)
m_latch_bank2 = data;
@@ -290,7 +290,7 @@ void gb_rom_yong_device::write_bank(offs_t offset, uint8_t data)
// ATV Racin pirate (incomplete)
-uint8_t gb_rom_atvrac_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_atvrac_device::read_rom)
{
if (offset < 0x4000)
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
@@ -298,7 +298,7 @@ uint8_t gb_rom_atvrac_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
}
-void gb_rom_atvrac_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_atvrac_device::write_bank)
{
if (offset == 0x3f00)
{
@@ -312,7 +312,7 @@ void gb_rom_atvrac_device::write_bank(offs_t offset, uint8_t data)
// La Sa Ma pirate (incomplete)
-uint8_t gb_rom_lasama_device::read_rom(offs_t offset)
+READ8_MEMBER(gb_rom_lasama_device::read_rom)
{
if (offset < 0x4000)
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
@@ -320,7 +320,7 @@ uint8_t gb_rom_lasama_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
}
-void gb_rom_lasama_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gb_rom_lasama_device::write_bank)
{
if (offset == 0x2080)
{
@@ -341,7 +341,7 @@ void gb_rom_lasama_device::write_bank(offs_t offset, uint8_t data)
// MegaDuck carts
-uint8_t megaduck_rom_device::read_rom(offs_t offset)
+READ8_MEMBER(megaduck_rom_device::read_rom)
{
if (offset < 0x4000)
return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
@@ -349,13 +349,13 @@ uint8_t megaduck_rom_device::read_rom(offs_t offset)
return m_rom[rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
}
-void megaduck_rom_device::write_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(megaduck_rom_device::write_bank)
{
if (offset == 0x0001)
m_latch_bank2 = data;
}
-void megaduck_rom_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(megaduck_rom_device::write_ram)
{
m_latch_bank = data * 2;
m_latch_bank2 = data * 2 + 1;
diff --git a/src/devices/bus/gameboy/rom.h b/src/devices/bus/gameboy/rom.h
index f2388446863..a5439fba598 100644
--- a/src/devices/bus/gameboy/rom.h
+++ b/src/devices/bus/gameboy/rom.h
@@ -16,9 +16,9 @@ public:
gb_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
gb_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -39,9 +39,9 @@ public:
gb_rom_tama5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
// device-level overrides
@@ -61,8 +61,8 @@ public:
gb_rom_wisdom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
protected:
// device-level overrides
@@ -78,8 +78,8 @@ public:
gb_rom_yong_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
protected:
// device-level overrides
@@ -95,8 +95,8 @@ public:
gb_rom_atvrac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
protected:
// device-level overrides
@@ -112,8 +112,8 @@ public:
gb_rom_lasama_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
protected:
// device-level overrides
@@ -131,9 +131,9 @@ public:
megaduck_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual void write_bank(offs_t offset, uint8_t data) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_WRITE8_MEMBER(write_bank) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
megaduck_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/bus/gamegear/ggext.h b/src/devices/bus/gamegear/ggext.h
index 1eed1545bed..71d6ecfcf72 100644
--- a/src/devices/bus/gamegear/ggext.h
+++ b/src/devices/bus/gamegear/ggext.h
@@ -16,6 +16,28 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_GG_EXT_PORT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, GG_EXT_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+#define MCFG_GG_EXT_PORT_MODIFY(_tag) \
+ MCFG_DEVICE_MODIFY(_tag)
+
+
+#define MCFG_GG_EXT_PORT_TH_INPUT_HANDLER(_devcb) \
+ downcast<gg_ext_port_device &>(*device).set_th_input_handler(DEVCB_##_devcb);
+
+
+#define MCFG_GG_EXT_PORT_PIXEL_HANDLER(_devcb) \
+ downcast<gg_ext_port_device &>(*device).set_pixel_handler(DEVCB_##_devcb);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -28,23 +50,13 @@ class gg_ext_port_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- template <typename T>
- gg_ext_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : gg_ext_port_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- gg_ext_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ gg_ext_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~gg_ext_port_device();
// static configuration helpers
- auto th_input_handler() { return m_th_pin_handler.bind(); }
+ template <class Object> devcb_base &set_th_input_handler(Object &&cb) { return m_th_pin_handler.set_callback(std::forward<Object>(cb)); }
- auto pixel_handler() { return m_pixel_handler.bind(); }
+ template <class Object> devcb_base &set_pixel_handler(Object &&cb) { return m_pixel_handler.set_callback(std::forward<Object>(cb)); }
// Currently, only the support for SMS Controller Adaptor is emulated,
// for when SMS Compatibility mode is enabled. In that mode, the 10 pins
diff --git a/src/devices/bus/gamegear/smsctrladp.cpp b/src/devices/bus/gamegear/smsctrladp.cpp
index 0b380cba8a0..7a5eee4ba4b 100644
--- a/src/devices/bus/gamegear/smsctrladp.cpp
+++ b/src/devices/bus/gamegear/smsctrladp.cpp
@@ -80,10 +80,9 @@ READ32_MEMBER( sms_ctrl_adaptor_device::pixel_r )
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void sms_ctrl_adaptor_device::device_add_mconfig(machine_config &config)
-{
- SMS_CONTROL_PORT(config, m_subctrl_port, sms_control_port_devices, "joypad");
- m_subctrl_port->th_input_handler().set(FUNC(sms_ctrl_adaptor_device::th_pin_w));
- m_subctrl_port->pixel_handler().set(FUNC(sms_ctrl_adaptor_device::pixel_r));
-}
+MACHINE_CONFIG_START(sms_ctrl_adaptor_device::device_add_mconfig)
+ MCFG_SMS_CONTROL_PORT_ADD("ctrl", sms_control_port_devices, "joypad")
+ MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(*this, sms_ctrl_adaptor_device, th_pin_w))
+ MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_ctrl_adaptor_device, pixel_r))
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/gba/gba_slot.h b/src/devices/bus/gba/gba_slot.h
index b26891c6589..c946fd71c57 100644
--- a/src/devices/bus/gba/gba_slot.h
+++ b/src/devices/bus/gba/gba_slot.h
@@ -84,17 +84,7 @@ class gba_cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- gba_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : gba_cart_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- gba_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ gba_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~gba_cart_slot_device();
// device-level overrides
@@ -153,6 +143,11 @@ DECLARE_DEVICE_TYPE(GBA_CART_SLOT, gba_cart_slot_device)
#define GBASLOT_ROM_REGION_TAG ":cart:rom"
#define GBAHELP_ROM_REGION_TAG ":cart:romhlp"
+#define MCFG_GBA_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, GBA_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
//------------------------------------------------------------------------
//
diff --git a/src/devices/bus/gba/rom.cpp b/src/devices/bus/gba/rom.cpp
index e1c61ec0f49..1471d43a430 100644
--- a/src/devices/bus/gba/rom.cpp
+++ b/src/devices/bus/gba/rom.cpp
@@ -417,13 +417,13 @@ READ32_MEMBER(gba_rom_flash_device::read_ram)
offset &= m_flash_mask;
if (mem_mask & 0xff)
- rv |= m_flash->read(offset * 4);
+ rv |= m_flash->read(space, offset * 4);
if (mem_mask & 0xff00)
- rv |= m_flash->read((offset * 4) + 1) << 8;
+ rv |= m_flash->read(space, (offset * 4) + 1) << 8;
if (mem_mask & 0xff0000)
- rv |= m_flash->read((offset * 4) + 2) << 16;
+ rv |= m_flash->read(space, (offset * 4) + 2) << 16;
if (mem_mask & 0xff000000)
- rv |= m_flash->read((offset * 4) + 3) << 24;
+ rv |= m_flash->read(space, (offset * 4) + 3) << 24;
return rv;
}
@@ -435,16 +435,16 @@ WRITE32_MEMBER(gba_rom_flash_device::write_ram)
switch (mem_mask)
{
case 0xff:
- m_flash->write(offset * 4, data & 0xff);
+ m_flash->write(space, offset * 4, data & 0xff);
break;
case 0xff00:
- m_flash->write((offset * 4) + 1, (data >> 8) & 0xff);
+ m_flash->write(space, (offset * 4) + 1, (data >> 8) & 0xff);
break;
case 0xff0000:
- m_flash->write((offset * 4) + 2, (data >> 16) & 0xff);
+ m_flash->write(space, (offset * 4) + 2, (data >> 16) & 0xff);
break;
case 0xff000000:
- m_flash->write((offset * 4) + 3, (data >> 24) & 0xff);
+ m_flash->write(space, (offset * 4) + 3, (data >> 24) & 0xff);
break;
default:
fatalerror("Unknown mem_mask for GBA flash write %x\n", mem_mask);
@@ -464,13 +464,13 @@ READ32_MEMBER(gba_rom_flash1m_device::read_ram)
offset &= m_flash_mask;
if (mem_mask & 0xff)
- rv |= m_flash->read(offset * 4);
+ rv |= m_flash->read(space, offset * 4);
if (mem_mask & 0xff00)
- rv |= m_flash->read((offset * 4) + 1) << 8;
+ rv |= m_flash->read(space, (offset * 4) + 1) << 8;
if (mem_mask & 0xff0000)
- rv |= m_flash->read((offset * 4) + 2) << 16;
+ rv |= m_flash->read(space, (offset * 4) + 2) << 16;
if (mem_mask & 0xff000000)
- rv |= m_flash->read((offset * 4) + 3) << 24;
+ rv |= m_flash->read(space, (offset * 4) + 3) << 24;
return rv;
}
@@ -482,16 +482,16 @@ WRITE32_MEMBER(gba_rom_flash1m_device::write_ram)
switch (mem_mask)
{
case 0xff:
- m_flash->write(offset * 4, data & 0xff);
+ m_flash->write(space, offset * 4, data & 0xff);
break;
case 0xff00:
- m_flash->write((offset * 4) + 1, (data >> 8) & 0xff);
+ m_flash->write(space, (offset * 4) + 1, (data >> 8) & 0xff);
break;
case 0xff0000:
- m_flash->write((offset * 4) + 2, (data >> 16) & 0xff);
+ m_flash->write(space, (offset * 4) + 2, (data >> 16) & 0xff);
break;
case 0xff000000:
- m_flash->write((offset * 4) + 3, (data >> 24) & 0xff);
+ m_flash->write(space, (offset * 4) + 3, (data >> 24) & 0xff);
break;
default:
fatalerror("Unknown mem_mask for GBA flash write %x\n", mem_mask);
diff --git a/src/devices/bus/generic/ram.cpp b/src/devices/bus/generic/ram.cpp
index 1c9a63d7306..601db4d0470 100644
--- a/src/devices/bus/generic/ram.cpp
+++ b/src/devices/bus/generic/ram.cpp
@@ -97,7 +97,7 @@ void generic_ram_linear_device::device_start()
mapper specific handlers
-------------------------------------------------*/
-uint8_t generic_ram_plain_device::read_ram(offs_t offset)
+READ8_MEMBER(generic_ram_plain_device::read_ram)
{
if (offset < m_ram.size())
return m_ram[offset];
@@ -105,19 +105,19 @@ uint8_t generic_ram_plain_device::read_ram(offs_t offset)
return 0xff;
}
-void generic_ram_plain_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(generic_ram_plain_device::write_ram)
{
if (offset < m_ram.size())
m_ram[offset] = data;
}
-uint8_t generic_ram_linear_device::read_ram(offs_t offset)
+READ8_MEMBER(generic_ram_linear_device::read_ram)
{
return m_ram[offset % m_ram.size()];
}
-void generic_ram_linear_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(generic_ram_linear_device::write_ram)
{
m_ram[offset % m_ram.size()] = data;
}
diff --git a/src/devices/bus/generic/ram.h b/src/devices/bus/generic/ram.h
index 5cd8c8092b0..aa8323ba8af 100644
--- a/src/devices/bus/generic/ram.h
+++ b/src/devices/bus/generic/ram.h
@@ -14,8 +14,8 @@ class generic_ram_plain_device : public device_t, public device_generic_cart_int
{
public:
// reading and writing
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
// construction/destruction
@@ -35,8 +35,8 @@ class generic_ram_linear_device : public device_t, public device_generic_cart_in
{
public:
// reading and writing
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
protected:
// construction/destruction
diff --git a/src/devices/bus/generic/rom.cpp b/src/devices/bus/generic/rom.cpp
index e52854d5b64..3a63b1f90dc 100644
--- a/src/devices/bus/generic/rom.cpp
+++ b/src/devices/bus/generic/rom.cpp
@@ -61,7 +61,7 @@ generic_romram_plain_device::generic_romram_plain_device(const machine_config &m
mapper specific handlers
-------------------------------------------------*/
-uint8_t generic_rom_plain_device::read_rom(offs_t offset)
+READ8_MEMBER(generic_rom_plain_device::read_rom)
{
if (offset < m_rom_size)
return m_rom[offset];
@@ -69,7 +69,7 @@ uint8_t generic_rom_plain_device::read_rom(offs_t offset)
return 0xff;
}
-uint16_t generic_rom_plain_device::read16_rom(offs_t offset, uint16_t mem_mask)
+READ16_MEMBER(generic_rom_plain_device::read16_rom)
{
uint16_t *ROM = (uint16_t *)m_rom;
if (offset < m_rom_size/2)
@@ -78,7 +78,7 @@ uint16_t generic_rom_plain_device::read16_rom(offs_t offset, uint16_t mem_mask)
return 0xffff;
}
-uint32_t generic_rom_plain_device::read32_rom(offs_t offset, uint32_t mem_mask)
+READ32_MEMBER(generic_rom_plain_device::read32_rom)
{
uint32_t *ROM = (uint32_t *)m_rom;
if (offset < m_rom_size/4)
@@ -88,25 +88,25 @@ uint32_t generic_rom_plain_device::read32_rom(offs_t offset, uint32_t mem_mask)
}
-uint8_t generic_rom_linear_device::read_rom(offs_t offset)
+READ8_MEMBER(generic_rom_linear_device::read_rom)
{
return m_rom[offset % m_rom_size];
}
-uint16_t generic_rom_linear_device::read16_rom(offs_t offset, uint16_t mem_mask)
+READ16_MEMBER(generic_rom_linear_device::read16_rom)
{
uint16_t *ROM = (uint16_t *)m_rom;
return ROM[offset % (m_rom_size/2)];
}
-uint32_t generic_rom_linear_device::read32_rom(offs_t offset, uint32_t mem_mask)
+READ32_MEMBER(generic_rom_linear_device::read32_rom)
{
uint32_t *ROM = (uint32_t *)m_rom;
return ROM[offset % (m_rom_size/4)];
}
-uint8_t generic_romram_plain_device::read_ram(offs_t offset)
+READ8_MEMBER(generic_romram_plain_device::read_ram)
{
if (offset < m_ram.size())
return m_ram[offset];
@@ -114,7 +114,7 @@ uint8_t generic_romram_plain_device::read_ram(offs_t offset)
return 0xff;
}
-void generic_romram_plain_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(generic_romram_plain_device::write_ram)
{
if (offset < m_ram.size())
m_ram[offset] = data;
diff --git a/src/devices/bus/generic/rom.h b/src/devices/bus/generic/rom.h
index 6c5df5d4bf4..2fc1011c25b 100644
--- a/src/devices/bus/generic/rom.h
+++ b/src/devices/bus/generic/rom.h
@@ -30,9 +30,9 @@ public:
generic_rom_plain_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual uint16_t read16_rom(offs_t offset, uint16_t mem_mask) override;
- virtual uint32_t read32_rom(offs_t offset, uint32_t mem_mask) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_READ16_MEMBER(read16_rom) override;
+ virtual DECLARE_READ32_MEMBER(read32_rom) override;
protected:
generic_rom_plain_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -48,8 +48,8 @@ public:
generic_romram_plain_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
};
@@ -62,9 +62,9 @@ public:
generic_rom_linear_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
- virtual uint16_t read16_rom(offs_t offset, uint16_t mem_mask) override;
- virtual uint32_t read32_rom(offs_t offset, uint32_t mem_mask) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
+ virtual DECLARE_READ16_MEMBER(read16_rom) override;
+ virtual DECLARE_READ32_MEMBER(read32_rom) override;
};
diff --git a/src/devices/bus/generic/slot.cpp b/src/devices/bus/generic/slot.cpp
index 557e1d8dcef..8e7e3a4cdab 100644
--- a/src/devices/bus/generic/slot.cpp
+++ b/src/devices/bus/generic/slot.cpp
@@ -216,10 +216,10 @@ void generic_slot_device::common_load_rom(uint8_t *ROM, uint32_t len, const char
read_rom
-------------------------------------------------*/
-uint8_t generic_slot_device::read_rom(offs_t offset)
+READ8_MEMBER(generic_slot_device::read_rom)
{
if (m_cart)
- return m_cart->read_rom(offset);
+ return m_cart->read_rom(space, offset);
else
return 0xff;
}
@@ -228,10 +228,10 @@ uint8_t generic_slot_device::read_rom(offs_t offset)
read16_rom
-------------------------------------------------*/
-uint16_t generic_slot_device::read16_rom(offs_t offset, uint16_t mem_mask)
+READ16_MEMBER(generic_slot_device::read16_rom)
{
if (m_cart)
- return m_cart->read16_rom(offset, mem_mask);
+ return m_cart->read16_rom(space, offset, mem_mask);
else
return 0xffff;
}
@@ -240,10 +240,10 @@ uint16_t generic_slot_device::read16_rom(offs_t offset, uint16_t mem_mask)
read32_rom
-------------------------------------------------*/
-uint32_t generic_slot_device::read32_rom(offs_t offset, uint32_t mem_mask)
+READ32_MEMBER(generic_slot_device::read32_rom)
{
if (m_cart)
- return m_cart->read32_rom(offset, mem_mask);
+ return m_cart->read32_rom(space, offset, mem_mask);
else
return 0xffffffff;
}
@@ -252,10 +252,10 @@ uint32_t generic_slot_device::read32_rom(offs_t offset, uint32_t mem_mask)
read_ram
-------------------------------------------------*/
-uint8_t generic_slot_device::read_ram(offs_t offset)
+READ8_MEMBER(generic_slot_device::read_ram)
{
if (m_cart)
- return m_cart->read_ram(offset);
+ return m_cart->read_ram(space, offset);
else
return 0xff;
}
@@ -264,8 +264,8 @@ uint8_t generic_slot_device::read_ram(offs_t offset)
write_ram
-------------------------------------------------*/
-void generic_slot_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(generic_slot_device::write_ram)
{
if (m_cart)
- m_cart->write_ram(offset, data);
+ m_cart->write_ram(space, offset, data);
}
diff --git a/src/devices/bus/generic/slot.h b/src/devices/bus/generic/slot.h
index 3fac098afb7..d0c0d84a053 100644
--- a/src/devices/bus/generic/slot.h
+++ b/src/devices/bus/generic/slot.h
@@ -22,12 +22,12 @@ public:
virtual ~device_generic_cart_interface();
// reading and writing
- virtual uint8_t read_rom(offs_t offset) { return 0xff; }
- virtual uint16_t read16_rom(offs_t offset, uint16_t mem_mask) { return 0xffff; }
- virtual uint32_t read32_rom(offs_t offset, uint32_t mem_mask) { return 0xffffffff; }
+ virtual DECLARE_READ8_MEMBER(read_rom) { return 0xff; }
+ virtual DECLARE_READ16_MEMBER(read16_rom) { return 0xffff; }
+ virtual DECLARE_READ32_MEMBER(read32_rom) { return 0xffffffff; }
- virtual uint8_t read_ram(offs_t offset) { return 0xff; }
- virtual void write_ram(offs_t offset, uint8_t data) {}
+ virtual DECLARE_READ8_MEMBER(read_ram) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_ram) {};
virtual void rom_alloc(size_t size, int width, endianness_t end, const char *tag);
virtual void ram_alloc(uint32_t size);
@@ -138,12 +138,12 @@ public:
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
// reading and writing
- virtual uint8_t read_rom(offs_t offset);
- virtual uint16_t read16_rom(offs_t offset, uint16_t mem_mask = 0xffff);
- virtual uint32_t read32_rom(offs_t offset, uint32_t mem_mask = 0xffffffff);
+ virtual DECLARE_READ8_MEMBER(read_rom);
+ virtual DECLARE_READ16_MEMBER(read16_rom);
+ virtual DECLARE_READ32_MEMBER(read32_rom);
- virtual uint8_t read_ram(offs_t offset);
- virtual void write_ram(offs_t offset, uint8_t data);
+ virtual DECLARE_READ8_MEMBER(read_ram);
+ virtual DECLARE_WRITE8_MEMBER(write_ram);
virtual void rom_alloc(size_t size, int width, endianness_t end) { if (m_cart) m_cart->rom_alloc(size, width, end, tag()); }
virtual void ram_alloc(uint32_t size) { if (m_cart) m_cart->ram_alloc(size); }
diff --git a/src/devices/bus/hexbus/hx5102.cpp b/src/devices/bus/hexbus/hx5102.cpp
index 0cfd70c7dac..bf0f9d541cb 100644
--- a/src/devices/bus/hexbus/hx5102.cpp
+++ b/src/devices/bus/hexbus/hx5102.cpp
@@ -121,7 +121,8 @@ void hx5102_device::memmap(address_map &map)
*/
void hx5102_device::crumap(address_map &map)
{
- map(0x17e0, 0x17ff).rw(FUNC(hx5102_device::cruread), FUNC(hx5102_device::cruwrite));
+ map(0x17e0>>4, 0x17fe>>4).r(FUNC(hx5102_device::cruread));
+ map(0x17e0>>1, 0x17fe>>1).w(FUNC(hx5102_device::cruwrite));
}
hx5102_device::hx5102_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock):
@@ -373,12 +374,12 @@ READ8_MEMBER(hx5102_device::fdc_read)
{
case 0:
// Main status register
- val = m_floppy_ctrl->msr_r();
+ val = m_floppy_ctrl->read_msr();
LOGMASKED(LOG_STATUS, "i8272A.msr -> %02x\n", val);
break;
case 4:
// FIFO read
- val = m_floppy_ctrl->fifo_r();
+ val = m_floppy_ctrl->read_fifo();
LOGMASKED(LOG_FIFO, "i8272A.fifo -> %02x\n", val);
break;
}
@@ -397,7 +398,7 @@ WRITE8_MEMBER(hx5102_device::fdc_write)
case 0x08:
// Command register (FIFO write)
LOGMASKED(LOG_STATUS, "i8272A.fifo <- %02x\n", data);
- m_floppy_ctrl->fifo_w(data);
+ m_floppy_ctrl->write_fifo(data);
break;
case 0x0c:
// DMA lock
@@ -474,7 +475,7 @@ READ8_MEMBER(hx5102_device::cruread)
crubits |= ((ioport("HXDIP")->read())<<4);
- return BIT(crubits, offset);
+ return crubits;
}
/*
diff --git a/src/devices/bus/hp80_io/hp80_io.h b/src/devices/bus/hp80_io/hp80_io.h
index 886e7ce414a..11025d30d03 100644
--- a/src/devices/bus/hp80_io/hp80_io.h
+++ b/src/devices/bus/hp80_io/hp80_io.h
@@ -13,6 +13,16 @@
#pragma once
+#define MCFG_HP80_IO_SLOT_ADD(_tag , _idx) \
+ MCFG_DEVICE_ADD(_tag, HP80_IO_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(hp80_io_slot_devices, nullptr, false) \
+ downcast<hp80_io_slot_device &>(*device).set_slot_no(_idx);
+
+#define MCFG_HP80_IO_IRL_CB(_devcb) \
+ downcast<hp80_io_slot_device &>(*device).set_irl_cb_func(DEVCB_##_devcb);
+
+#define MCFG_HP80_IO_HALT_CB(_devcb) \
+ downcast<hp80_io_slot_device &>(*device).set_halt_cb_func(DEVCB_##_devcb);
#define HP80_IO_FIRST_SC 3 // Lowest SC used by I/O cards
@@ -28,22 +38,11 @@
PORT_CONFSETTING(6 , "9")\
PORT_CONFSETTING(7 , "10")
-void hp80_io_slot_devices(device_slot_interface &device);
-
class hp80_io_slot_device : public device_t,
public device_slot_interface
{
public:
// construction/destruction
- hp80_io_slot_device(machine_config const &mconfig, char const *tag, device_t *owner)
- : hp80_io_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- hp80_io_slot_devices(*this);
- set_default_option(nullptr);
- set_fixed(false);
- }
-
hp80_io_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~hp80_io_slot_device();
@@ -54,8 +53,8 @@ public:
virtual void device_start() override;
// Callback setups
- auto irl_cb() { return m_irl_cb_func.bind(); }
- auto halt_cb() { return m_halt_cb_func.bind(); }
+ template <class Object> devcb_base &set_irl_cb_func(Object &&cb) { return m_irl_cb_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_halt_cb_func(Object &&cb) { return m_halt_cb_func.set_callback(std::forward<Object>(cb)); }
// SC getter
uint8_t get_sc() const;
@@ -103,4 +102,6 @@ protected:
// device type definition
DECLARE_DEVICE_TYPE(HP80_IO_SLOT, hp80_io_slot_device)
+void hp80_io_slot_devices(device_slot_interface &device);
+
#endif // MAME_BUS_HP80_IO_HP80_IO_H
diff --git a/src/devices/bus/hp80_optroms/hp80_optrom.h b/src/devices/bus/hp80_optroms/hp80_optrom.h
index 33bd800027c..cb8dbd4903b 100644
--- a/src/devices/bus/hp80_optroms/hp80_optrom.h
+++ b/src/devices/bus/hp80_optroms/hp80_optrom.h
@@ -18,8 +18,6 @@
// Size of optional ROMs (8k)
static constexpr offs_t HP80_OPTROM_SIZE = 0x2000;
-void hp80_optrom_slot_devices(device_slot_interface &device);
-
class hp80_optrom_cart_device : public device_t,
public device_slot_card_interface
{
@@ -40,15 +38,6 @@ class hp80_optrom_slot_device : public device_t,
{
public:
// construction/destruction
- hp80_optrom_slot_device(machine_config const &mconfig, char const *tag, device_t *owner)
- : hp80_optrom_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- hp80_optrom_slot_devices(*this);
- set_default_option(nullptr);
- set_fixed(false);
- }
-
hp80_optrom_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~hp80_optrom_slot_device();
@@ -83,4 +72,6 @@ protected:
DECLARE_DEVICE_TYPE(HP80_OPTROM_SLOT, hp80_optrom_slot_device)
DECLARE_DEVICE_TYPE(HP80_OPTROM_CART, hp80_optrom_cart_device)
+void hp80_optrom_slot_devices(device_slot_interface &device);
+
#endif // MAME_BUS_HP80_OPTROMS_HP80_OPTROM_H
diff --git a/src/devices/bus/hp9845_io/98032.cpp b/src/devices/bus/hp9845_io/98032.cpp
index fc55a786fe2..c4838331b87 100644
--- a/src/devices/bus/hp9845_io/98032.cpp
+++ b/src/devices/bus/hp9845_io/98032.cpp
@@ -13,7 +13,6 @@
#include "emu.h"
#include "98032.h"
-#include "hp9885.h"
// Debugging
#define VERBOSE 0
@@ -56,13 +55,12 @@ hp98032_io_card_device::~hp98032_io_card_device()
{
}
-void hp98032_io_card_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(hp98032_io_card_device::device_add_mconfig)
HP98032_GPIO_SLOT(config , m_gpio , 0);
m_gpio->pflg_cb().set(FUNC(hp98032_io_card_device::pflg_w));
m_gpio->psts_cb().set(FUNC(hp98032_io_card_device::psts_w));
m_gpio->eir_cb().set(FUNC(hp98032_io_card_device::eir_w));
-}
+MACHINE_CONFIG_END
static INPUT_PORTS_START(hp98032_port)
MCFG_HP9845_IO_SC(2)
@@ -355,7 +353,6 @@ hp98032_gpio_slot_device::hp98032_gpio_slot_device(const machine_config &mconfig
{
option_reset();
option_add("loopback" , HP98032_GPIO_LOOPBACK);
- option_add("hp9885" , HP9885);
set_default_option(nullptr);
set_fixed(false);
}
diff --git a/src/devices/bus/hp9845_io/98034.cpp b/src/devices/bus/hp9845_io/98034.cpp
index ab2985db6e2..b82935a9762 100644
--- a/src/devices/bus/hp9845_io/98034.cpp
+++ b/src/devices/bus/hp9845_io/98034.cpp
@@ -363,10 +363,9 @@ const tiny_rom_entry *hp98034_io_card_device::device_rom_region() const
return ROM_NAME(hp98034);
}
-void hp98034_io_card_device::device_add_mconfig(machine_config &config)
-{
- // Clock for NP is generated by a RC oscillator. Manual says its typical frequency
- // is around 2 MHz.
+MACHINE_CONFIG_START(hp98034_io_card_device::device_add_mconfig)
+// Clock for NP is generated by a RC oscillator. Manual says its typical frequency
+// is around 2 MHz.
HP_NANOPROCESSOR(config, m_cpu, 2000000);
m_cpu->set_addrmap(AS_PROGRAM, &hp98034_io_card_device::np_program_map);
m_cpu->set_addrmap(AS_IO, &hp98034_io_card_device::np_io_map);
@@ -374,12 +373,12 @@ void hp98034_io_card_device::device_add_mconfig(machine_config &config)
m_cpu->read_dc().set(FUNC(hp98034_io_card_device::dc_r));
m_cpu->set_irq_acknowledge_callback(FUNC(hp98034_io_card_device::irq_callback));
- IEEE488_SLOT(config , "ieee_dev" , 0 , hp_ieee488_devices , nullptr);
- IEEE488_SLOT(config , "ieee_rem" , 0 , remote488_devices , nullptr);
- IEEE488(config, m_ieee488);
- m_ieee488->ifc_callback().set(FUNC(hp98034_io_card_device::ieee488_ctrl_w));
- m_ieee488->atn_callback().set(FUNC(hp98034_io_card_device::ieee488_ctrl_w));
-}
+ MCFG_IEEE488_SLOT_ADD("ieee_dev" , 0 , hp_ieee488_devices , nullptr)
+ MCFG_IEEE488_SLOT_ADD("ieee_rem" , 0 , remote488_devices , nullptr)
+ MCFG_IEEE488_BUS_ADD()
+ MCFG_IEEE488_IFC_CALLBACK(WRITELINE(*this, hp98034_io_card_device , ieee488_ctrl_w))
+ MCFG_IEEE488_ATN_CALLBACK(WRITELINE(*this, hp98034_io_card_device , ieee488_ctrl_w))
+MACHINE_CONFIG_END
// device type definition
DEFINE_DEVICE_TYPE(HP98034_IO_CARD, hp98034_io_card_device, "hp98034", "HP98034 card")
diff --git a/src/devices/bus/hp9845_io/hp9885.cpp b/src/devices/bus/hp9845_io/hp9885.cpp
deleted file mode 100644
index e4a2fc9f33c..00000000000
--- a/src/devices/bus/hp9845_io/hp9885.cpp
+++ /dev/null
@@ -1,974 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders: F. Ulivi
-/*********************************************************************
-
- hp9885.cpp
-
- HP9885M 8" floppy drive
- =======================
-
- This driver implements HLE of HP9885 floppy drive.
- The HP9885M is a single-disk 8" floppy drive. It connects to
- main system through a HP98032 GPIO module. The controller in a
- HP9885M can drive 3 more external HP9885S drives. The "M" or "S"
- in the name stand for master and slave, respectively.
- The enclosure of HP9885M contains the floppy drive, the controller
- electronics and the power supply whereas the HP9885S only has the
- drive and the power supply. A master unit interfaces to slave units
- through a standard daisy-chained Shugart bus.
- The controller is based on a HP Nanoprocessor with a 2 kB FW ROM.
- Unfortunately no dumps are available of the ROM, AFAIK, so the HLE
- is needed.
- The HP9885 supports a single disk format having these characteristics:
- - Single side
- - HP MMFM modulation
- - 30 256-byte sectors per track
- - 77 tracks (only 67 are actually used)
- - 360 RPM
- - A total capacity of 514560 bytes per disk.
-
- Summary of the command words I identified
- =========================================
-
- *READ*
-
- +-----------------------------------------------+
- |15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0|
- +-----+-----+-----------------------------------+
- | 0 X|Unit#| Sector count |
- +-----+-----+-----------------------------------+
-
- Bit 14 selects tighter margin for data reading (not emulated here)
-
- *WRITE*
-
- +-----------------------------------------------+
- |15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0|
- +-----+-----+-----------------------------------+
- | 1 0|Unit#| Sector count |
- +-----+-----+-----------------------------------+
-
- *SEEK*
-
- +-----------------------------------------------+
- |15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0|
- +-----+-----+--------------------+--------------+
- | 1 1|Unit#| Track # [0..76] |Sector#[0..29]|
- +-----+-----+--------------------+--------------+
-
- *FORMAT TRACK* (not implemented yet)
-
- +-----------------------------------------------+
- |15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0|
- +-----+-----+--------------------+--------------+
- | 1 1|Unit#| Track # [0..76] | 0x1e |
- +-----+-----+--------------------+--------------+
-
- *STEP IN*
-
- +-----------------------------------------------+
- |15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0|
- +-----+-----+--------------------+--------------+
- | 1 1|Unit#| 0x7c | 0x1f |
- +-----+-----+--------------------+--------------+
-
- *ERASE TRACK* (not implemented yet)
-
- +-----------------------------------------------+
- |15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0|
- +-----+-----+--------------------+--------------+
- | 1 1|Unit#| 0x7d | 0x1f |
- +-----+-----+--------------------+--------------+
-
- *READ STATUS*
-
- +-----------------------------------------------+
- |15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0|
- +-----+-----+--------------------+--------------+
- | 1 1|Unit#| 0x7f | 0x1f |
- +-----+-----+--------------------+--------------+
-
- This is the structure of the status word:
-
- +-----------------------------------------------+
- |15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0|
- +-----------------------+--+--+--+--+--+--+-----+
- | Error code (0=OK) |--|XC|SC|NR|WP|DC|Unit#|
- +-----------------------+--+--+--+--+--+--+-----+
-
- DC: Disk changed
- WP: Write protection
- NR: Not ready
- SC: Seek completed
- XC: Transfer completed
-
- Usage on HP9825
- ===============
-
- -slot0 98032_gpio -slot0:98032_gpio:gpio hp9885 -flop <floppy image>
-
- Usage on HP9845
- ===============
-
- -slot0 98032_gpio -slot0:98032_gpio:gpio hp9885 -rom1 massd -flop <floppy image>
-
- Note on floppy images
- =====================
-
- Images can be in two formats: MFI & HPI.
- A pre-formatted image must be used as formatting is not supported.
- It's not possible to format images for two reasons: the format
- command is not implemented yet and no dump of the disk system tape
- cartridge (HP part no. 09885-90035) is available.
- The latter is needed during format operation to create the so-called
- bootstraps on disk, which in turn are needed by 9825 systems.
- A pre-formatted image (9825_empty.hpi) is available here:
- http://www.hpmuseum.net/software/9825_discs.zip
-
- TODO
- ====
-
- + Implement missing commands
- + PRESET
-
- Acknowledgments
- ===============
-
- Thanks to Dyke Shaffer for publishing a lot of HP internal docs
- and source files regarding the HP9885.
-
- Fun fact: data I/O between disk and 98032 module is not buffered
- as there is no RAM in the controller. DMA must be used to keep
- data flow at disk speed and avoid underruns. The nominal disk
- data rate is one word every 32 µs.
-
-*********************************************************************/
-
-#include "emu.h"
-#include "hp9885.h"
-#include "formats/hpi_dsk.h"
-
-// Debugging
-#include "logmacro.h"
-#define LOG_TIMER_MASK (LOG_GENERAL << 1)
-#define LOG_TIMER(...) LOGMASKED(LOG_TIMER_MASK, __VA_ARGS__)
-#define LOG_HS_MASK (LOG_TIMER_MASK << 1)
-#define LOG_HS(...) LOGMASKED(LOG_HS_MASK, __VA_ARGS__)
-#define LOG_HEAD_MASK (LOG_HS_MASK << 1)
-#define LOG_HEAD(...) LOGMASKED(LOG_HEAD_MASK, __VA_ARGS__)
-#define LOG_DISK_MASK (LOG_HEAD_MASK << 1)
-#define LOG_DISK(...) LOGMASKED(LOG_DISK_MASK, __VA_ARGS__)
-
-#undef VERBOSE
-//#define VERBOSE (LOG_GENERAL | LOG_HS_MASK | LOG_HEAD_MASK)
-#define VERBOSE 0
-
-// Bit manipulation
-namespace {
- template<typename T> constexpr T BIT_MASK(unsigned n)
- {
- return (T)1U << n;
- }
-
- template<typename T> void BIT_CLR(T& w , unsigned n)
- {
- w &= ~BIT_MASK<T>(n);
- }
-
- template<typename T> void BIT_SET(T& w , unsigned n)
- {
- w |= BIT_MASK<T>(n);
- }
-}
-
-// device type definition
-DEFINE_DEVICE_TYPE(HP9885, hp9885_device, "hp9885" , "HP9885 floppy drive")
-
-// Timers
-enum {
- FSM_TMR_ID,
- HEAD_TMR_ID,
- BIT_BYTE_TMR_ID
-};
-
-// Constants
-constexpr unsigned MAX_TRACK = 76; // Maximum valid track
-constexpr unsigned MAX_SECTOR = 29; // Maximum valid sector
-constexpr unsigned UNKNOWN_TRACK= 0xff; // Current track unknown
-constexpr unsigned STEP_MS = 8; // Step time (ms)
-constexpr unsigned SETTLING_MS = 8; // Settling time (ms)
-constexpr unsigned HEAD_TO_MS = 415; // Head unload timeout (ms)
-constexpr unsigned HD_SETTLE_MS = 50; // Head settling time (ms)
-constexpr uint16_t PASSWORD = 0xae87; // "Password" to enable commands
-constexpr unsigned HALF_CELL_US = 1; // Half bit cell duration (µs)
-constexpr unsigned STATUS_DELAY_US = 100; // Status delay (µs)
-constexpr unsigned MISSED_ID_REVS = 2; // Disk rotations to stop ID search
-
-// Bits in status word
-constexpr unsigned STS_DISK_CHANGED = 2; // Disk changed
-constexpr unsigned STS_WRITE_PROTECT= 3; // Write protection
-constexpr unsigned STS_NOT_RDY = 4; // Drive not ready
-constexpr unsigned STS_SEEK_COMPLETE= 5; // Seek completed
-constexpr unsigned STS_XFER_COMPLETE= 6; // Data transfer completed
-
-// Error codes
-enum : unsigned {
- ERR_NONE = 0,
- ERR_NOT_POWERED = 1,
- ERR_DOOR_OPEN = 2,
- ERR_NO_DISK = 3,
- ERR_WR_DISABLED = 4,
- ERR_ID_ERROR = 5,
- ERR_TRACK_ERROR = 6,
- ERR_CRC_ERROR = 7,
- ERR_HW_FAILURE = 8
-};
-
-hp9885_device::hp9885_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : hp98032_gpio_card_device(mconfig , HP9885 , tag , owner , clock)
- , m_drive_connector{*this , "floppy"}
-{
-}
-
-hp9885_device::~hp9885_device()
-{
-}
-
-uint16_t hp9885_device::get_jumpers() const
-{
- return hp98032_gpio_slot_device::JUMPER_2 |
- hp98032_gpio_slot_device::JUMPER_7 |
- hp98032_gpio_slot_device::JUMPER_8 |
- hp98032_gpio_slot_device::JUMPER_B |
- hp98032_gpio_slot_device::JUMPER_E |
- hp98032_gpio_slot_device::JUMPER_F;
-}
-
-uint16_t hp9885_device::input_r() const
-{
- uint16_t tmp = m_input;
- if (m_obf) {
- tmp |= m_output;
- LOG_HS("DATA OUT %04x\n" , tmp);
- }
- return tmp;
-}
-
-uint8_t hp9885_device::ext_status_r() const
-{
- return 0;
-}
-
-void hp9885_device::output_w(uint16_t data)
-{
- m_input = data;
-}
-
-void hp9885_device::ext_control_w(uint8_t data)
-{
- LOG_HS("EXT CTRL %u\n" , data);
- if (BIT(data , 0) &&
- !BIT(m_status , STS_XFER_COMPLETE) &&
- (m_op == OP_READ || m_op == OP_WRITE)) {
- // CTL0 terminates current data transfer
- LOG("xfer terminated\n");
- BIT_SET(m_status , STS_XFER_COMPLETE);
- // Prepare to output status
- set_output();
- }
-}
-
-WRITE_LINE_MEMBER(hp9885_device::pctl_w)
-{
- m_pctl = state;
- if (m_pctl) {
- if (!m_outputting) {
- set_ibf(true);
- }
- } else {
- LOG_HS("DATA IN %04x\n" , m_input);
- new_word();
- }
- update_busy();
-}
-
-WRITE_LINE_MEMBER(hp9885_device::io_w)
-{
- LOG_HS("I/O = %d\n" , state);
-}
-
-WRITE_LINE_MEMBER(hp9885_device::preset_w)
-{
- LOG("PRESET = %d\n" , state);
-}
-
-static const floppy_format_type hp9885_floppy_formats[] = {
- FLOPPY_MFI_FORMAT,
- FLOPPY_HPI_FORMAT,
- nullptr
-};
-
-void hp9885_device::device_add_mconfig(machine_config &config)
-{
- FLOPPY_CONNECTOR(config , "floppy" , "8ssdd" , FLOPPY_8_SSDD , true , hp9885_floppy_formats).set_fixed(true);
-}
-
-void hp9885_device::device_start()
-{
- save_item(NAME(m_input));
- save_item(NAME(m_output));
- save_item(NAME(m_status));
- save_item(NAME(m_fsm_state));
- save_item(NAME(m_head_state));
- save_item(NAME(m_op));
- save_item(NAME(m_pctl));
- save_item(NAME(m_ibf));
- save_item(NAME(m_obf));
- save_item(NAME(m_outputting));
- save_item(NAME(m_had_transition));
- save_item(NAME(m_dskchg));
- save_item(NAME(m_track));
- save_item(NAME(m_seek_track));
- save_item(NAME(m_seek_sector));
- save_item(NAME(m_sector_cnt));
- save_item(NAME(m_word_cnt));
- save_item(NAME(m_rev_cnt));
- save_item(NAME(m_am_detector));
- save_item(NAME(m_crc));
-
- m_fsm_timer = timer_alloc(FSM_TMR_ID);
- m_head_timer = timer_alloc(HEAD_TMR_ID);
- m_bit_byte_timer = timer_alloc(BIT_BYTE_TMR_ID);
-
- m_drive = m_drive_connector->get_device();
-
- m_drive->setup_ready_cb(floppy_image_device::ready_cb(&hp9885_device::floppy_ready_cb , this));
- m_drive->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(&hp9885_device::floppy_index_cb , this));
-}
-
-void hp9885_device::device_reset()
-{
- eir_w(0);
- psts_w(1);
- m_dskchg = true;
- m_obf = false;
- recalibrate();
- m_seek_track = 0;
- m_seek_sector = 0;
- m_fsm_state = FSM_RECALIBRATING;
- set_state(FSM_IDLE);
-}
-
-void hp9885_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- LOG_TIMER("Tmr %.06f ID %d FSM %d HD %d\n" , machine().time().as_double() , id , m_fsm_state , m_head_state);
-
- switch (id) {
- case FSM_TMR_ID:
- do_FSM();
- break;
-
- case HEAD_TMR_ID:
- if (m_head_state == HEAD_SETTLING) {
- LOG_HEAD("%.06f Head loaded\n" , machine().time().as_double());
- m_head_state = HEAD_LOADED;
- // Trigger actions to be done on head loading
- do_FSM();
- m_head_timer->adjust(attotime::from_msec(HEAD_TO_MS - HD_SETTLE_MS));
- } else {
- LOG_HEAD("%.06f Head unloaded\n" , machine().time().as_double());
- m_head_state = HEAD_UNLOADED;
- }
- break;
-
- case BIT_BYTE_TMR_ID:
- {
- switch (m_fsm_state) {
- case FSM_WAIT_ID_AM:
- case FSM_WAIT_DATA_AM:
- {
- attotime edge;
- attotime tm;
- edge = m_drive->get_next_transition(m_pll.ctime);
- bool half_bit = m_pll.feed_read_data(tm , edge , attotime::never);
- m_am_detector <<= 1;
- m_am_detector |= half_bit;
- if (m_am_detector == 0x55552a54) {
- // ID AM
- // CDCDCDCDCDCDCDCD
- // 0 0 0 0 1 1 1 0
- // 0 1 1 1 0 0 0 0
- LOG_DISK("Got ID AM\n");
- preset_crc();
- m_word_cnt = 2;
- set_state(FSM_RD_ID);
- } else if (m_am_detector == 0x55552a44) {
- // DATA AM
- // CDCDCDCDCDCDCDCD
- // 0 0 0 0 1 0 1 0
- // 0 1 1 1 0 0 0 0
- LOG_DISK("Got Data AM\n");
- if (m_fsm_state == FSM_WAIT_DATA_AM) {
- m_rev_cnt = 0;
- if (BIT(m_status , STS_XFER_COMPLETE)) {
- output_status();
- return;
- } else {
- preset_crc();
- m_word_cnt = 129;
- if (m_op == OP_READ) {
- set_state(FSM_RD_DATA);
- } else {
- set_state(FSM_WR_DATA);
- m_pll.start_writing(m_pll.ctime);
- m_had_transition = false;
- wr_word(m_input);
- set_ibf(false);
- }
- }
- }
- }
- }
- break;
-
- case FSM_RD_ID:
- {
- // This is needed when state is switched to one of the AM waiting states
- m_am_detector = 0;
- auto word = rd_word();
- m_word_cnt--;
- LOG_DISK("W %04x C %u\n" , word , m_word_cnt);
- if (m_word_cnt && word != ((m_seek_sector << 8) | m_track)) {
- set_state(FSM_WAIT_ID_AM);
- } else if (m_word_cnt == 0) {
- if (m_crc) {
- LOG_DISK("Wrong CRC in ID\n");
- set_state(FSM_WAIT_ID_AM);
- } else {
- LOG_DISK("Sector found\n");
- set_state(FSM_WAIT_DATA_AM);
- }
- }
- }
- break;
-
- case FSM_RD_DATA:
- {
- auto word = rd_word();
- m_word_cnt--;
- LOG_DISK("W %04x C %u\n" , word , m_word_cnt);
- if (m_word_cnt >= 1) {
- if (!BIT(m_status , STS_XFER_COMPLETE)) {
- m_output = word;
- m_obf = true;
- update_busy();
- }
- } else if (m_word_cnt == 0) {
- if (m_crc) {
- LOG_DISK("Wrong CRC in data\n");
- }
- // Move to next sector
- adv_sector();
- if (BIT(m_status , STS_XFER_COMPLETE) || m_sector_cnt == 0) {
- BIT_SET(m_status , STS_XFER_COMPLETE);
- output_status();
- } else {
- set_state(FSM_POSITIONING);
- do_FSM();
- }
- return;
- }
- }
- break;
-
- case FSM_WR_DATA:
- {
- m_word_cnt--;
- if (m_word_cnt > 1) {
- if (BIT(m_status , STS_XFER_COMPLETE)) {
- wr_word(0);
- } else {
- wr_word(m_input);
- if (m_word_cnt > 2) {
- set_ibf(false);
- }
- }
- } else if (m_word_cnt == 1) {
- wr_word(m_crc);
- } else {
- m_pll.stop_writing(m_drive , m_pll.ctime);
- // Move to next sector
- adv_sector();
- if (BIT(m_status , STS_XFER_COMPLETE) || m_sector_cnt == 0) {
- BIT_SET(m_status , STS_XFER_COMPLETE);
- output_status();
- } else {
- set_ibf(false);
- set_state(FSM_POSITIONING);
- do_FSM();
- }
- return;
- }
- }
- break;
-
- default:
- LOG("Invalid FSM state %d\n" , m_fsm_state);
- set_state(FSM_IDLE);
- return;
- }
- timer.adjust(m_pll.ctime - machine().time());
- }
- break;
- }
-}
-
-void hp9885_device::floppy_ready_cb(floppy_image_device *floppy , int state)
-{
- LOG("ready %d\n" , state);
- if (state) {
- // drive not ready
- m_dskchg = true;
- }
-}
-
-void hp9885_device::floppy_index_cb(floppy_image_device *floppy , int state)
-{
- if (state && m_rev_cnt && --m_rev_cnt == 0) {
- // Sector not found
- LOG("Sector not found\n");
- stop_rdwr();
- set_error(ERR_ID_ERROR);
- output_status(true);
- }
-}
-
-void hp9885_device::set_state(int new_state)
-{
- if (m_fsm_state != new_state) {
- LOG("%.06f FSM %d->%d\n" , machine().time().as_double() , m_fsm_state , new_state);
- m_fsm_state = new_state;
- if (m_fsm_state == FSM_IDLE) {
- m_op = OP_NONE;
- m_outputting = false;
- set_ibf(false);
- m_fsm_timer->reset();
- stop_rdwr();
- m_rev_cnt = 0;
- }
- }
-}
-
-void hp9885_device::init_status(unsigned unit_no)
-{
- m_status = unit_no & 3;
- if (unit_no == 0) {
- if (m_drive->ready_r()) {
- BIT_SET(m_status , STS_NOT_RDY);
- }
- if (m_dskchg) {
- BIT_SET(m_status , STS_DISK_CHANGED);
- }
- if (m_drive->wpt_r()) {
- BIT_SET(m_status , STS_WRITE_PROTECT);
- }
- } else {
- // Units 1,2,3 are not present
- BIT_SET(m_status , STS_NOT_RDY);
- }
-}
-
-void hp9885_device::encode_error(bool writing)
-{
- if (m_status & 3) {
- set_error(ERR_NOT_POWERED);
- } else if (writing && BIT(m_status , STS_WRITE_PROTECT)) {
- set_error(ERR_WR_DISABLED);
- } else if (BIT(m_status , STS_NOT_RDY)) {
- set_error(ERR_NO_DISK);
- }
-}
-
-void hp9885_device::set_error(unsigned error_code)
-{
- m_status = (m_status & 0xff) | (error_code << 8);
- if (error_code != ERR_NONE) {
- LOG_HS("EIR 1\n");
- eir_w(1);
- psts_w(0);
- } else {
- LOG_HS("EIR 0\n");
- eir_w(0);
- psts_w(1);
- }
-}
-
-void hp9885_device::new_word()
-{
- unsigned unit_no = (m_input >> 12) & 3;
-
- switch (m_fsm_state) {
- case FSM_IDLE:
- if (m_input == PASSWORD) {
- LOG("Got PW\n");
- set_state(FSM_GOT_PW);
- } else {
- LOG("Wrong sequence\n");
- // TODO:
- // It probably does nothing IRL
- }
- set_ibf(false);
- break;
-
- case FSM_GOT_PW:
- // Decode new command
- switch (m_input & 0xc000) {
- case 0x0000:
- case 0x4000:
- // Read
- init_status(unit_no);
- if (!BIT(m_status , STS_NOT_RDY)) {
- m_sector_cnt = m_input & 0x0fff;
- LOG("Read %u sectors @%u:%u\n" , m_sector_cnt , m_seek_track , m_seek_sector);
- m_op = OP_READ;
- set_state(FSM_POSITIONING);
- if (load_head()) {
- m_fsm_timer->adjust(attotime::zero);
- }
- set_output();
- } else {
- encode_error(false);
- output_status();
- }
- break;
-
- case 0x8000:
- // Write
- init_status(unit_no);
- if (!BIT(m_status , STS_NOT_RDY) && !BIT(m_status , STS_WRITE_PROTECT)) {
- m_sector_cnt = m_input & 0x0fff;
- LOG("Write %u sectors @%u:%u\n" , m_sector_cnt , m_seek_track , m_seek_sector);
- m_op = OP_WRITE;
- set_state(FSM_POSITIONING);
- if (load_head()) {
- m_fsm_timer->adjust(attotime::zero);
- }
- set_ibf(false);
- } else {
- encode_error(true);
- output_status(true);
- }
- break;
-
- case 0xc000:
- {
- // Seek & other commands
- uint8_t track_no = (m_input >> 5) & 0x7f;
- uint8_t sect_no = m_input & 0x1f;
- if (sect_no == 0x1e) {
- // Format
- LOG("Format\n");
- // TODO:
- } else if (sect_no == 0x1f) {
- switch (track_no) {
- case 0x7c:
- // Step in
- init_status(unit_no);
- if (!BIT(m_status , STS_NOT_RDY)) {
- LOG("Step in\n");
- m_seek_track = m_track + 1;
- m_op = OP_STEP_IN;
- set_state(FSM_SEEKING);
- if (load_head()) {
- m_fsm_timer->adjust(attotime::zero);
- }
- } else {
- encode_error(false);
- output_status();
- }
- break;
-
- case 0x7d:
- // Write all track
- LOG("Write all track\n");
- // TODO:
- break;
-
- case 0x7f:
- // Read status
- init_status(unit_no);
- if (!BIT(m_status , STS_NOT_RDY) && BIT(m_status , STS_DISK_CHANGED)) {
- LOG("Get status DSKCHG\n");
- m_op = OP_GET_STATUS;
- set_state(FSM_POSITIONING);
- if (load_head()) {
- m_fsm_timer->adjust(attotime::zero);
- }
- } else {
- LOG("Get status !DSKCHG\n");
- encode_error(false);
- output_status();
- }
- break;
-
- default:
- LOG("Unknown command %02x\n" , track_no);
- }
- } else {
- // Plain seek
- LOG("Seek to %u:%u\n" , track_no , sect_no);
- m_seek_track = track_no;
- m_seek_sector = sect_no;
- set_state(FSM_IDLE);
- }
- }
- break;
- }
- break;
-
- case FSM_RD_STATUS1:
- set_error(ERR_NONE);
- set_state(FSM_RD_STATUS2);
- m_outputting = false;
- m_obf = false;
- break;
-
- case FSM_RD_STATUS2:
- set_state(FSM_IDLE);
- break;
-
- case FSM_RD_DATA:
- m_obf = false;
- break;
-
- default:
- if (m_op != OP_WRITE) {
- LOG("Got data in state %d!\n" , m_fsm_state);
- }
- }
-}
-
-void hp9885_device::do_FSM()
-{
- switch (m_fsm_state) {
- case FSM_RECALIBRATING:
- // Keep head loaded
- load_head();
- if (m_drive->trk00_r()) {
- one_step(true);
- } else {
- set_state(FSM_POSITIONING);
- m_fsm_timer->adjust(attotime::from_msec(SETTLING_MS));
- m_track = 0;
- }
- break;
-
- case FSM_SETTLING:
- if (m_op == OP_READ || m_op == OP_WRITE) {
- // Set seek complete
- BIT_SET(m_status , STS_SEEK_COMPLETE);
- if (m_sector_cnt--) {
- m_rev_cnt = MISSED_ID_REVS;
- set_state(FSM_WAIT_ID_AM);
- start_rd();
- } else {
- output_status();
- }
- } else if (m_op == OP_STEP_IN) {
- // Step IN
- // Set seek complete
- BIT_SET(m_status , STS_SEEK_COMPLETE);
- output_status();
- } else {
- // Get status
- output_status();
- }
- break;
-
- case FSM_POSITIONING:
- case FSM_SEEKING:
- // Keep head loaded
- load_head();
- // Need recalibration?
- if (m_track == UNKNOWN_TRACK) {
- set_state(FSM_RECALIBRATING);
- m_fsm_timer->adjust(attotime::zero);
- } else if (m_seek_track != m_track) {
- set_state(FSM_SEEKING);
- one_step(m_seek_track < m_track);
- } else {
- if (m_fsm_state == FSM_SEEKING) {
- m_fsm_timer->adjust(attotime::from_msec(SETTLING_MS));
- } else {
- m_fsm_timer->adjust(attotime::zero);
- }
- set_state(FSM_SETTLING);
- }
- break;
-
- case FSM_STATUS_DELAY:
- output_status();
- break;
-
- default:
- LOG("Invalid state=%d\n" , m_fsm_state);
- set_state(FSM_IDLE);
- }
- update_busy();
-}
-
-bool hp9885_device::load_head()
-{
- m_dskchg = false;
-
- switch (m_head_state) {
- case HEAD_UNLOADED:
- case HEAD_SETTLING:
- LOG_HEAD("%.06f Loading head..\n" , machine().time().as_double());
- m_head_state = HEAD_SETTLING;
- m_head_timer->adjust(attotime::from_msec(HD_SETTLE_MS));
- return false;
-
- case HEAD_LOADED:
- LOG_HEAD("%.06f Keep head loaded\n" , machine().time().as_double());
- m_head_timer->adjust(attotime::from_msec(HEAD_TO_MS));
- return true;
-
- default:
- LOG("Invalid head state %d\n" , m_head_state);
- m_head_state = HEAD_UNLOADED;
- return false;
- }
-}
-
-void hp9885_device::recalibrate()
-{
- m_track = UNKNOWN_TRACK;
-}
-
-void hp9885_device::one_step(bool outward)
-{
- if (outward) {
- if (m_track > 0) {
- m_track--;
- }
- } else {
- if (m_track < MAX_TRACK) {
- m_track++;
- }
- }
- LOG_HEAD("%.06f Step to trk %u\n" , machine().time().as_double() , m_track);
- m_drive->dir_w(outward);
- m_drive->stp_w(0);
- m_drive->stp_w(1);
- m_fsm_timer->adjust(attotime::from_msec(STEP_MS));
-}
-
-void hp9885_device::adv_sector()
-{
- if (++m_seek_sector > MAX_SECTOR) {
- m_seek_sector = 0;
- if (m_seek_track < MAX_TRACK) {
- m_seek_track++;
- }
- }
-}
-
-void hp9885_device::start_rd()
-{
- m_pll.set_clock(attotime::from_usec(HALF_CELL_US));
- m_pll.read_reset(machine().time());
- m_bit_byte_timer->adjust(attotime::zero);
- m_am_detector = 0;
-}
-
-void hp9885_device::stop_rdwr()
-{
- m_bit_byte_timer->reset();
-}
-
-uint16_t hp9885_device::rd_word()
-{
- uint16_t word = 0;
- for (unsigned i = 0; i < 16; ++i) {
- attotime edge;
- attotime tm;
- edge = m_drive->get_next_transition(m_pll.ctime);
- // Read & discard clock bit
- m_pll.feed_read_data(tm , edge , attotime::never);
- edge = m_drive->get_next_transition(m_pll.ctime);
- bool data_bit = m_pll.feed_read_data(tm , edge , attotime::never);
- word >>= 1;
- if (data_bit) {
- BIT_SET(word , 15);
- }
- update_crc(data_bit);
- }
- return word;
-}
-
-void hp9885_device::wr_word(uint16_t word)
-{
- for (unsigned i = 0; i < 16; ++i) {
- bool data_bit = BIT(word , i);
- bool clock_bit = !data_bit && !m_had_transition;
- m_had_transition = data_bit || clock_bit;
- attotime dummy;
-
- m_pll.write_next_bit(clock_bit , dummy , nullptr , attotime::never);
- m_pll.write_next_bit(data_bit , dummy , nullptr , attotime::never);
- update_crc(data_bit);
- }
- m_pll.commit(m_drive , m_pll.ctime);
-}
-
-void hp9885_device::preset_crc()
-{
- m_crc = ~0;
-}
-
-void hp9885_device::update_crc(bool bit)
-{
- bool crc_x15 = BIT(m_crc , 0);
- m_crc >>= 1;
- if (bit ^ crc_x15) {
- m_crc ^= 0x8408;
- }
-}
-
-void hp9885_device::set_ibf(bool state)
-{
- m_ibf = state;
- update_busy();
-}
-
-void hp9885_device::set_output()
-{
- m_outputting = true;
- m_obf = false;
- set_ibf(false);
-}
-
-void hp9885_device::output_status(bool delayed)
-{
- stop_rdwr();
- if (delayed) {
- set_output();
- set_state(FSM_STATUS_DELAY);
- m_fsm_timer->adjust(attotime::from_usec(STATUS_DELAY_US));
- } else {
- set_state(FSM_RD_STATUS1);
- m_outputting = true;
- m_obf = true;
- // Set status in output buffer
- m_output = m_status;
- set_ibf(false);
- }
-}
-
-void hp9885_device::update_busy()
-{
- bool busy = (!m_outputting && m_ibf) || (m_outputting && m_pctl && m_obf);
- LOG_HS("PCTL %d BUSY %d OUT %d IBF %d OBF %d\n" , m_pctl , busy , m_outputting , m_ibf , m_obf);
- pflg_w(!busy);
-}
diff --git a/src/devices/bus/hp9845_io/hp9885.h b/src/devices/bus/hp9845_io/hp9885.h
deleted file mode 100644
index edb705c2504..00000000000
--- a/src/devices/bus/hp9845_io/hp9885.h
+++ /dev/null
@@ -1,136 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders: F. Ulivi
-/*********************************************************************
-
- hp9885.h
-
- HP9885M 8" floppy drive
-
-*********************************************************************/
-
-#ifndef MAME_BUS_HP9845_IO_HP9885_H
-#define MAME_BUS_HP9845_IO_HP9885_H
-
-#pragma once
-
-#include "98032.h"
-#include "imagedev/floppy.h"
-#include "machine/fdc_pll.h"
-
-class hp9885_device : public hp98032_gpio_card_device
-{
-public:
- hp9885_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual ~hp9885_device();
-
- // hp98032_gpio_card_device overrides
- virtual uint16_t get_jumpers() const override;
- virtual uint16_t input_r() const override;
- virtual uint8_t ext_status_r() const override;
- virtual void output_w(uint16_t data) override;
- virtual void ext_control_w(uint8_t data) override;
- virtual DECLARE_WRITE_LINE_MEMBER(pctl_w) override;
- virtual DECLARE_WRITE_LINE_MEMBER(io_w) override;
- virtual DECLARE_WRITE_LINE_MEMBER(preset_w) override;
-
-protected:
- // device-level overrides
- virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
-
-private:
- // FSM states
- enum {
- FSM_IDLE,
- FSM_RECALIBRATING,
- FSM_SETTLING,
- FSM_GOT_PW,
- FSM_POSITIONING,
- FSM_SEEKING,
- FSM_STATUS_DELAY,
- FSM_RD_STATUS1,
- FSM_RD_STATUS2,
- FSM_WAIT_ID_AM,
- FSM_RD_ID,
- FSM_WAIT_DATA_AM,
- FSM_RD_DATA,
- FSM_WR_DATA
- };
-
- // Head states
- enum {
- HEAD_UNLOADED,
- HEAD_SETTLING,
- HEAD_LOADED
- };
-
- // Operations
- enum {
- OP_NONE,
- OP_READ,
- OP_WRITE,
- OP_STEP_IN,
- OP_GET_STATUS
- };
-
- required_device<floppy_connector> m_drive_connector;
- floppy_image_device *m_drive;
- uint16_t m_input;
- uint16_t m_output;
- uint16_t m_status;
- int m_fsm_state;
- int m_head_state;
- int m_op;
- bool m_pctl;
- bool m_ibf;
- bool m_obf;
- bool m_outputting;
- bool m_had_transition;
- bool m_dskchg;
- unsigned m_track;
- unsigned m_seek_track;
- unsigned m_seek_sector;
- unsigned m_sector_cnt;
- unsigned m_word_cnt;
- unsigned m_rev_cnt;
- uint32_t m_am_detector;
- uint16_t m_crc; // x^15 is stored in LSB
-
- // Timers
- emu_timer *m_fsm_timer;
- emu_timer *m_head_timer;
- emu_timer *m_bit_byte_timer;
-
- // PLL
- fdc_pll_t m_pll;
-
- void floppy_ready_cb(floppy_image_device *floppy , int state);
- void floppy_index_cb(floppy_image_device *floppy , int state);
-
- void set_state(int new_state);
- void init_status(unsigned unit_no);
- void encode_error(bool writing);
- void set_error(unsigned error_code);
- void new_word();
- void do_FSM();
- bool load_head();
- void recalibrate();
- void one_step(bool outward);
- void adv_sector();
- void start_rd();
- void stop_rdwr();
- uint16_t rd_word();
- void wr_word(uint16_t word);
- void preset_crc();
- void update_crc(bool bit);
- void set_ibf(bool state);
- void set_output();
- void output_status(bool delayed = false);
- void update_busy();
-};
-
-DECLARE_DEVICE_TYPE(HP9885 , hp9885_device)
-
-#endif /* MAME_BUS_HP9845_IO_HP9885_H */
diff --git a/src/devices/bus/hp_dio/hp98265a.cpp b/src/devices/bus/hp_dio/hp98265a.cpp
index c5c28eeda6b..baafc4e14eb 100644
--- a/src/devices/bus/hp_dio/hp98265a.cpp
+++ b/src/devices/bus/hp_dio/hp98265a.cpp
@@ -168,12 +168,12 @@ void dio16_98265a_device::device_reset()
code &= REG_SW1_SELECT_CODE_MASK;
if (!m_installed_io) {
- program_space().install_readwrite_handler(
+ program_space()->install_readwrite_handler(
0x600000 + (code * 0x10000),
0x6007ff + (code * 0x10000),
read16_delegate(FUNC(dio16_98265a_device::io_r), this),
write16_delegate(FUNC(dio16_98265a_device::io_w), this));
- program_space().install_device(0x6e0020, 0x6e003f, *m_spc, &mb87030_device::map, 0x00ff00ff);
+ program_space()->install_device(0x6e0020, 0x6e003f, *m_spc, &mb87030_device::map, 0x00ff00ff);
m_installed_io = true;
}
m_control = 0;
diff --git a/src/devices/bus/hp_dio/hp98603a.cpp b/src/devices/bus/hp_dio/hp98603a.cpp
index ac04f7479bd..bcd5fe3536c 100644
--- a/src/devices/bus/hp_dio/hp98603a.cpp
+++ b/src/devices/bus/hp_dio/hp98603a.cpp
@@ -39,9 +39,8 @@ ROM_START(hp98603a)
ROM_LOAD16_BYTE("98603_80016.bin", 0x70000, 32768, CRC(d887acab) SHA1(a9cbbaa5f053f374d6cbda614b727df35a61ace1))
ROM_END
-void dio16_98603a_device::device_add_mconfig(machine_config &config)
-{
-}
+MACHINE_CONFIG_START(dio16_98603a_device::device_add_mconfig)
+MACHINE_CONFIG_END
const tiny_rom_entry *dio16_98603a_device::device_rom_region() const
{
diff --git a/src/devices/bus/hp_dio/hp98603b.cpp b/src/devices/bus/hp_dio/hp98603b.cpp
index 6c8cff6b95a..4da45470d0e 100644
--- a/src/devices/bus/hp_dio/hp98603b.cpp
+++ b/src/devices/bus/hp_dio/hp98603b.cpp
@@ -34,9 +34,8 @@ ROM_START(hp98603b)
ROM_LOAD16_BYTE("u14.bin", 0xa0001, 65536, CRC(96527d4e) SHA1(6706ab97eab4465ea4fa2d6b07e8107468e83818))
ROM_END
-void dio16_98603b_device::device_add_mconfig(machine_config &config)
-{
-}
+MACHINE_CONFIG_START(dio16_98603b_device::device_add_mconfig)
+MACHINE_CONFIG_END
const tiny_rom_entry *dio16_98603b_device::device_rom_region() const
{
diff --git a/src/devices/bus/hp_dio/hp98620.cpp b/src/devices/bus/hp_dio/hp98620.cpp
index fcd0e9d95aa..2fdc8e0f932 100644
--- a/src/devices/bus/hp_dio/hp98620.cpp
+++ b/src/devices/bus/hp_dio/hp98620.cpp
@@ -74,7 +74,7 @@ void dio16_98620_device::device_reset()
{
if (!m_installed_io)
{
- program_space().install_readwrite_handler(0x500000, 0x50020f,
+ program_space()->install_readwrite_handler(0x500000, 0x50020f,
read16_delegate(FUNC(dio16_98620_device::dma_r), this),
write16_delegate(FUNC(dio16_98620_device::dma_w), this));
m_installed_io = true;
@@ -343,9 +343,9 @@ void dio16_98620_device::dma_transfer(int channel)
if (m_regs[channel].dma_out) {
- dmack_w_out(channel, program_space().read_byte(m_regs[channel].address++));
+ dmack_w_out(channel, program_space()->read_byte(m_regs[channel].address++));
} else {
- program_space().write_byte(m_regs[channel].address++, dmack_r_out(channel));
+ program_space()->write_byte(m_regs[channel].address++, dmack_r_out(channel));
}
diff --git a/src/devices/bus/hp_dio/hp98643.cpp b/src/devices/bus/hp_dio/hp98643.cpp
index 57bc4d1a283..5a439144d6d 100644
--- a/src/devices/bus/hp_dio/hp98643.cpp
+++ b/src/devices/bus/hp_dio/hp98643.cpp
@@ -105,7 +105,7 @@ void dio16_98643_device::device_reset()
uint32_t baseaddr = 0x600000 + (code << 16);
- program_space().install_device(baseaddr, baseaddr + 0xffff,
+ program_space()->install_device(baseaddr, baseaddr + 0xffff,
*this, &dio16_98643_device::addrmap);
m_installed_io = true;
}
diff --git a/src/devices/bus/hp_dio/hp_dio.cpp b/src/devices/bus/hp_dio/hp_dio.cpp
index c2cbfa8e941..dfa228dc8af 100644
--- a/src/devices/bus/hp_dio/hp_dio.cpp
+++ b/src/devices/bus/hp_dio/hp_dio.cpp
@@ -104,7 +104,8 @@ dio16_device::dio16_device(const machine_config &mconfig, const char *tag, devic
dio16_device::dio16_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_prgspace(*this, finder_base::DUMMY_TAG, -1),
+ m_maincpu(*this, finder_base::DUMMY_TAG),
+ m_prgspace(nullptr),
m_irq1_out_cb(*this),
m_irq2_out_cb(*this),
m_irq3_out_cb(*this),
@@ -135,7 +136,8 @@ void dio16_device::device_start()
m_dmar0_out_cb.resolve_safe();
m_dmar1_out_cb.resolve_safe();
- m_prgwidth = m_prgspace->data_width();
+ m_prgspace = &m_maincpu->space(AS_PROGRAM);
+ m_prgwidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
save_item(NAME(m_irq));
save_item(NAME(m_dmar));
diff --git a/src/devices/bus/hp_dio/hp_dio.h b/src/devices/bus/hp_dio/hp_dio.h
index ee680b08d4b..ddf95e9570c 100644
--- a/src/devices/bus/hp_dio/hp_dio.h
+++ b/src/devices/bus/hp_dio/hp_dio.h
@@ -65,7 +65,7 @@ public:
// construction/destruction
dio16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration
- template <typename T> void set_program_space(T &&tag, int spacenum) { m_prgspace.set_tag(std::forward<T>(tag), spacenum); }
+ template <typename T> void set_cputag(T &&tag) { m_maincpu.set_tag(std::forward<T>(tag)); }
// callback configuration
auto dmar0_out_cb() { return m_dmar0_out_cb.bind(); }
@@ -89,7 +89,7 @@ public:
void unmap_bank(offs_t start, offs_t end);
void unmap_rom(offs_t start, offs_t end);
- address_space &program_space() { return *m_prgspace; }
+ address_space *program_space() { return m_prgspace; }
// IRQs 1, 2, and 7 are reserved for non-bus usage.
@@ -137,10 +137,11 @@ protected:
virtual void device_reset() override;
// internal state
+ required_device<cpu_device> m_maincpu;
std::list<device_dio16_card_interface *> m_cards;
// address spaces
- required_address_space m_prgspace;
+ address_space *m_prgspace;
int m_bus_index;
// packed line states
@@ -186,7 +187,7 @@ protected:
virtual void interface_pre_start() override;
int get_index() { return m_index; };
- address_space &program_space() { return m_dio_dev->program_space(); }
+ address_space *program_space() { return m_dio_dev->program_space(); }
DECLARE_WRITE_LINE_MEMBER(irq1_out) { m_dio_dev->set_irq(m_index, 0, state); }
DECLARE_WRITE_LINE_MEMBER(irq2_out) { m_dio_dev->set_irq(m_index, 1, state); }
diff --git a/src/devices/bus/hp_dio/human_interface.cpp b/src/devices/bus/hp_dio/human_interface.cpp
index d7cfad37d50..9c58672e11d 100644
--- a/src/devices/bus/hp_dio/human_interface.cpp
+++ b/src/devices/bus/hp_dio/human_interface.cpp
@@ -114,11 +114,11 @@ human_interface_device::human_interface_device(const machine_config &mconfig, de
void human_interface_device::device_start()
{
- program_space().install_readwrite_handler(0x420000, 0x420003, 0x0003, 0xfffc, 0,
+ program_space()->install_readwrite_handler(0x420000, 0x420003, 0x0003, 0xfffc, 0,
read8_delegate(FUNC(upi41_cpu_device::upi41_master_r), &(*m_iocpu)),
write8_delegate(FUNC(upi41_cpu_device::upi41_master_w), &(*m_iocpu)), 0x00ff00ff);
- program_space().install_readwrite_handler(0x470000, 0x47001f, 0x1f, 0xffe0, 0,
+ program_space()->install_readwrite_handler(0x470000, 0x47001f, 0x1f, 0xffe0, 0,
read8_delegate(FUNC(human_interface_device::gpib_r), this),
write8_delegate(FUNC(human_interface_device::gpib_w), this), 0x00ff00ff);
@@ -194,7 +194,7 @@ WRITE8_MEMBER(human_interface_device::ieee488_dio_w)
WRITE8_MEMBER(human_interface_device::gpib_w)
{
if (offset & 0x08) {
- m_tms9914->write(offset & 0x07, data);
+ m_tms9914->reg8_w(space, offset & 0x07, data);
return;
}
@@ -234,7 +234,7 @@ READ8_MEMBER(human_interface_device::gpib_r)
uint8_t data = 0xff;
if (offset & 0x8) {
- data = m_tms9914->read(offset & 0x07);
+ data = m_tms9914->reg8_r(space, offset & 0x07);
return data;
}
@@ -360,14 +360,14 @@ void human_interface_device::dmack_w_in(int channel, uint8_t data)
{
if (channel)
return;
- m_tms9914->write(7, data);
+ m_tms9914->reg8_w(*program_space(), 7, data);
}
uint8_t human_interface_device::dmack_r_in(int channel)
{
if (channel || !m_gpib_dma_enable)
return 0xff;
- return m_tms9914->read(7);
+ return m_tms9914->reg8_r(machine().dummy_space(), 7);
}
} // namespace bus::hp_dio
diff --git a/src/devices/bus/ieee488/c2040fdc.h b/src/devices/bus/ieee488/c2040fdc.h
index 64239991222..c73e9826fbf 100644
--- a/src/devices/bus/ieee488/c2040fdc.h
+++ b/src/devices/bus/ieee488/c2040fdc.h
@@ -18,6 +18,22 @@
#include "imagedev/floppy.h"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_C2040_SYNC_CALLBACK(_write) \
+ downcast<c2040_fdc_device &>(*device).set_sync_wr_callback(DEVCB_##_write);
+
+#define MCFG_C2040_READY_CALLBACK(_write) \
+ downcast<c2040_fdc_device &>(*device).set_ready_wr_callback(DEVCB_##_write);
+
+#define MCFG_C2040_ERROR_CALLBACK(_write) \
+ downcast<c2040_fdc_device &>(*device).set_error_wr_callback(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -30,6 +46,9 @@ public:
// construction/destruction
c2040_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <class Object> devcb_base &set_sync_wr_callback(Object &&cb) { return m_write_sync.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ready_wr_callback(Object &&cb) { return m_write_ready.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_error_wr_callback(Object &&cb) { return m_write_error.set_callback(std::forward<Object>(cb)); }
auto sync_wr_callback() { return m_write_sync.bind(); }
auto ready_wr_callback() { return m_write_ready.bind(); }
auto error_wr_callback() { return m_write_error.bind(); }
diff --git a/src/devices/bus/ieee488/c8280.cpp b/src/devices/bus/ieee488/c8280.cpp
index 63b5cbe2506..51293bda1d7 100644
--- a/src/devices/bus/ieee488/c8280.cpp
+++ b/src/devices/bus/ieee488/c8280.cpp
@@ -293,31 +293,30 @@ FLOPPY_FORMATS_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c8280_device::device_add_mconfig(machine_config &config)
-{
- M6502(config, m_maincpu, XTAL(12'000'000)/8);
- m_maincpu->set_addrmap(AS_PROGRAM, &c8280_device::c8280_main_mem);
+MACHINE_CONFIG_START(c8280_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(M6502_DOS_TAG, M6502, XTAL(12'000'000)/8)
+ MCFG_DEVICE_PROGRAM_MAP(c8280_main_mem)
- MOS6532_NEW(config, m_riot0, XTAL(12'000'000)/8);
- m_riot0->pa_rd_callback().set(FUNC(c8280_device::dio_r));
- m_riot0->pb_wr_callback().set(FUNC(c8280_device::dio_w));
+ MCFG_DEVICE_ADD(M6532_0_TAG, MOS6532_NEW, XTAL(12'000'000)/8)
+ MCFG_MOS6530n_IN_PA_CB(READ8(*this, c8280_device, dio_r))
+ MCFG_MOS6530n_OUT_PB_CB(WRITE8(*this, c8280_device, dio_w))
- MOS6532_NEW(config, m_riot1, XTAL(12'000'000)/8);
- m_riot1->pa_rd_callback().set(FUNC(c8280_device::riot1_pa_r));
- m_riot1->pa_wr_callback().set(FUNC(c8280_device::riot1_pa_w));
- m_riot1->pb_rd_callback().set(FUNC(c8280_device::riot1_pb_r));
- m_riot1->pb_wr_callback().set(FUNC(c8280_device::riot1_pb_w));
- m_riot1->irq_wr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
+ MCFG_DEVICE_ADD(M6532_1_TAG, MOS6532_NEW, XTAL(12'000'000)/8)
+ MCFG_MOS6530n_IN_PA_CB(READ8(*this, c8280_device, riot1_pa_r))
+ MCFG_MOS6530n_OUT_PA_CB(WRITE8(*this, c8280_device, riot1_pa_w))
+ MCFG_MOS6530n_IN_PB_CB(READ8(*this, c8280_device, riot1_pb_r))
+ MCFG_MOS6530n_OUT_PB_CB(WRITE8(*this, c8280_device, riot1_pb_w))
+ MCFG_MOS6530n_IRQ_CB(INPUTLINE(M6502_DOS_TAG, INPUT_LINE_IRQ0))
- M6502(config, m_fdccpu, XTAL(12'000'000)/8);
- m_fdccpu->set_addrmap(AS_PROGRAM, &c8280_device::c8280_fdc_mem);
+ MCFG_DEVICE_ADD(M6502_FDC_TAG, M6502, XTAL(12'000'000)/8)
+ MCFG_DEVICE_PROGRAM_MAP(c8280_fdc_mem)
FD1797(config, m_fdc, XTAL(12'000'000)/6);
m_fdc->intrq_wr_callback().set_inputline(m_fdccpu, M6502_IRQ_LINE);
m_fdc->drq_wr_callback().set_inputline(m_fdccpu, M6502_SET_OVERFLOW);
FLOPPY_CONNECTOR(config, m_floppy0, c8280_floppies, "8dsdd", c8280_device::floppy_formats);
FLOPPY_CONNECTOR(config, m_floppy1, c8280_floppies, "8dsdd", c8280_device::floppy_formats);
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/ieee488/hardbox.cpp b/src/devices/bus/ieee488/hardbox.cpp
index 0b982ee772d..677037c5ba7 100644
--- a/src/devices/bus/ieee488/hardbox.cpp
+++ b/src/devices/bus/ieee488/hardbox.cpp
@@ -267,12 +267,11 @@ WRITE8_MEMBER( hardbox_device::ppi1_pc_w )
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void hardbox_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(hardbox_device::device_add_mconfig)
// basic machine hardware
- Z80(config, m_maincpu, XTAL(8'000'000)/2);
- m_maincpu->set_addrmap(AS_PROGRAM, &hardbox_device::hardbox_mem);
- m_maincpu->set_addrmap(AS_IO, &hardbox_device::hardbox_io);
+ MCFG_DEVICE_ADD(Z80_TAG, Z80, XTAL(8'000'000)/2)
+ MCFG_DEVICE_PROGRAM_MAP(hardbox_mem)
+ MCFG_DEVICE_IO_MAP(hardbox_io)
// devices
i8255_device &ppi0(I8255A(config, I8255_0_TAG));
@@ -286,12 +285,16 @@ void hardbox_device::device_add_mconfig(machine_config &config)
ppi1.in_pc_callback().set(FUNC(hardbox_device::ppi1_pc_r));
ppi1.out_pc_callback().set(FUNC(hardbox_device::ppi1_pc_w));
- CORVUS_HDC(config, m_hdc, 0);
- HARDDISK(config, "harddisk1", "corvus_hdd");
- HARDDISK(config, "harddisk2", "corvus_hdd");
- HARDDISK(config, "harddisk3", "corvus_hdd");
- HARDDISK(config, "harddisk4", "corvus_hdd");
-}
+ MCFG_DEVICE_ADD(CORVUS_HDC_TAG, CORVUS_HDC, 0)
+ MCFG_HARDDISK_ADD("harddisk1")
+ MCFG_HARDDISK_INTERFACE("corvus_hdd")
+ MCFG_HARDDISK_ADD("harddisk2")
+ MCFG_HARDDISK_INTERFACE("corvus_hdd")
+ MCFG_HARDDISK_ADD("harddisk3")
+ MCFG_HARDDISK_INTERFACE("corvus_hdd")
+ MCFG_HARDDISK_ADD("harddisk4")
+ MCFG_HARDDISK_INTERFACE("corvus_hdd")
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/ieee488/hp9122c.cpp b/src/devices/bus/ieee488/hp9122c.cpp
index 808deae2069..9d7f77fed51 100644
--- a/src/devices/bus/ieee488/hp9122c.cpp
+++ b/src/devices/bus/ieee488/hp9122c.cpp
@@ -376,14 +376,13 @@ void hp9122c_device::cpu_map(address_map &map)
map(0xc000, 0xffff).rom().region("cpu", 0);
}
-void hp9122c_device::device_add_mconfig(machine_config &config)
-{
- MC6809(config, m_cpu, XTAL(8'000'000));
- m_cpu->set_addrmap(AS_PROGRAM, &hp9122c_device::cpu_map);
+MACHINE_CONFIG_START(hp9122c_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("cpu" , MC6809 , XTAL(8'000'000))
+ MCFG_DEVICE_PROGRAM_MAP(cpu_map)
// without this flag, 'DMA' transfer via SYNC instruction
// will not work
- config.m_perfect_cpu_quantum = subtag("cpu");
+ MCFG_QUANTUM_PERFECT_CPU("cpu")
MB8876(config, m_fdc, 8_MHz_XTAL / 4);
m_fdc->intrq_wr_callback().set(FUNC(hp9122c_device::fdc_intrq_w));
@@ -400,7 +399,11 @@ void hp9122c_device::device_add_mconfig(machine_config &config)
m_i8291a->int_write().set(FUNC(hp9122c_device::i8291a_int_w));
m_i8291a->dreq_write().set(FUNC(hp9122c_device::i8291a_dreq_w));
- FLOPPY_CONNECTOR(config, "floppy0" , hp9122c_floppies , "35hd" , hp9122c_floppy_formats, true).enable_sound(true);
- FLOPPY_CONNECTOR(config, "floppy1" , hp9122c_floppies , "35hd" , hp9122c_floppy_formats, true).enable_sound(true);
+ MCFG_FLOPPY_DRIVE_ADD("floppy0" , hp9122c_floppies , "35hd" , hp9122c_floppy_formats)
+ MCFG_FLOPPY_DRIVE_SOUND(true)
+ MCFG_SLOT_FIXED(true)
+ MCFG_FLOPPY_DRIVE_ADD("floppy1" , hp9122c_floppies , "35hd" , hp9122c_floppy_formats)
+ MCFG_FLOPPY_DRIVE_SOUND(true)
+ MCFG_SLOT_FIXED(true)
config.set_default_layout(layout_hp9122c);
-}
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/ieee488/ieee488.h b/src/devices/bus/ieee488/ieee488.h
index cb29783d294..e734b356d5b 100644
--- a/src/devices/bus/ieee488/ieee488.h
+++ b/src/devices/bus/ieee488/ieee488.h
@@ -12,12 +12,8 @@
#pragma once
-void cbm_ieee488_devices(device_slot_interface &device);
-void hp_ieee488_devices(device_slot_interface &device);
-void remote488_devices(device_slot_interface &device);
-DECLARE_DEVICE_TYPE(IEEE488, ieee488_device)
-DECLARE_DEVICE_TYPE(IEEE488_SLOT, ieee488_slot_device)
+
//**************************************************************************
// MACROS / CONSTANTS
@@ -28,6 +24,65 @@ DECLARE_DEVICE_TYPE(IEEE488_SLOT, ieee488_slot_device)
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_IEEE488_BUS_ADD() \
+ MCFG_DEVICE_ADD(IEEE488_TAG, IEEE488, 0)
+
+
+#define MCFG_IEEE488_EOI_CALLBACK(_write) \
+ downcast<ieee488_device *>(device)->set_eoi_callback(DEVCB_##_write);
+
+#define MCFG_IEEE488_DAV_CALLBACK(_write) \
+ downcast<ieee488_device *>(device)->set_dav_callback(DEVCB_##_write);
+
+#define MCFG_IEEE488_NRFD_CALLBACK(_write) \
+ downcast<ieee488_device *>(device)->set_nrfd_callback(DEVCB_##_write);
+
+#define MCFG_IEEE488_NDAC_CALLBACK(_write) \
+ downcast<ieee488_device *>(device)->set_ndac_callback(DEVCB_##_write);
+
+#define MCFG_IEEE488_IFC_CALLBACK(_write) \
+ downcast<ieee488_device *>(device)->set_ifc_callback(DEVCB_##_write);
+
+#define MCFG_IEEE488_SRQ_CALLBACK(_write) \
+ downcast<ieee488_device *>(device)->set_srq_callback(DEVCB_##_write);
+
+#define MCFG_IEEE488_ATN_CALLBACK(_write) \
+ downcast<ieee488_device *>(device)->set_atn_callback(DEVCB_##_write);
+
+#define MCFG_IEEE488_REN_CALLBACK(_write) \
+ downcast<ieee488_device *>(device)->set_ren_callback(DEVCB_##_write);
+
+// This CB reports changes to the DIO lines on the bus (whose value comes from
+// ANDing the DIO lines of each device on the bus)
+// This CB is needed by those controllers that start a parallel poll and wait
+// for some condition to be set by devices on the DIO lines (e.g. PHI controller).
+#define MCFG_IEEE488_DIO_CALLBACK(_write) \
+ downcast<ieee488_device *>(device)->set_dio_callback(DEVCB_##_write);
+
+#define MCFG_IEEE488_SLOT_ADD(_tag, _address, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, IEEE488_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<ieee488_slot_device *>(device)->set_address(_address);
+
+
+#define MCFG_CBM_IEEE488_ADD(_default_drive) \
+ MCFG_IEEE488_SLOT_ADD("ieee4", 4, cbm_ieee488_devices, nullptr) \
+ MCFG_IEEE488_SLOT_ADD("ieee8", 8, cbm_ieee488_devices, _default_drive) \
+ MCFG_IEEE488_SLOT_ADD("ieee9", 9, cbm_ieee488_devices, nullptr) \
+ MCFG_IEEE488_SLOT_ADD("ieee10", 10, cbm_ieee488_devices, nullptr) \
+ MCFG_IEEE488_SLOT_ADD("ieee11", 11, cbm_ieee488_devices, nullptr) \
+ MCFG_IEEE488_SLOT_ADD("ieee12", 12, cbm_ieee488_devices, nullptr) \
+ MCFG_IEEE488_SLOT_ADD("ieee13", 13, cbm_ieee488_devices, nullptr) \
+ MCFG_IEEE488_SLOT_ADD("ieee14", 14, cbm_ieee488_devices, nullptr) \
+ MCFG_IEEE488_SLOT_ADD("ieee15", 15, cbm_ieee488_devices, nullptr) \
+ MCFG_IEEE488_BUS_ADD()
+
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -40,7 +95,17 @@ class ieee488_device : public device_t
{
public:
// construction/destruction
- ieee488_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ ieee488_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ template <class Object> devcb_base &set_eoi_callback(Object &&cb) { return m_write_eoi.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_dav_callback(Object &&cb) { return m_write_dav.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_nrfd_callback(Object &&cb) { return m_write_nrfd.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ndac_callback(Object &&cb) { return m_write_ndac.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ifc_callback(Object &&cb) { return m_write_ifc.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_srq_callback(Object &&cb) { return m_write_srq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_atn_callback(Object &&cb) { return m_write_atn.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ren_callback(Object &&cb) { return m_write_ren.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_dio_callback(Object &&cb) { return m_write_dio.set_callback(std::forward<Object>(cb)); }
auto eoi_callback() { return m_write_eoi.bind(); }
auto dav_callback() { return m_write_dav.bind(); }
@@ -50,11 +115,6 @@ public:
auto srq_callback() { return m_write_srq.bind(); }
auto atn_callback() { return m_write_atn.bind(); }
auto ren_callback() { return m_write_ren.bind(); }
-
- // This CB reports changes to the DIO lines on the bus (whose value comes from
- // ANDing the DIO lines of each device on the bus)
- // This CB is needed by those controllers that start a parallel poll and wait
- // for some condition to be set by devices on the DIO lines (e.g. PHI controller).
auto dio_callback() { return m_write_dio.bind(); }
void add_device(ieee488_slot_device *slot, device_t *target);
@@ -94,20 +154,6 @@ public:
void atn_w(device_t *device, int state) { set_signal(device, ATN, state); }
void ren_w(device_t *device, int state) { set_signal(device, REN, state); }
- // helper functions
- static void add_cbm_devices(machine_config &config, const char *_default_drive)
- {
- IEEE488_SLOT(config, "ieee4", 4, cbm_ieee488_devices, nullptr);
- IEEE488_SLOT(config, "ieee8", 8, cbm_ieee488_devices, _default_drive);
- IEEE488_SLOT(config, "ieee9", 9, cbm_ieee488_devices, nullptr);
- IEEE488_SLOT(config, "ieee10", 10, cbm_ieee488_devices, nullptr);
- IEEE488_SLOT(config, "ieee11", 11, cbm_ieee488_devices, nullptr);
- IEEE488_SLOT(config, "ieee12", 12, cbm_ieee488_devices, nullptr);
- IEEE488_SLOT(config, "ieee13", 13, cbm_ieee488_devices, nullptr);
- IEEE488_SLOT(config, "ieee14", 14, cbm_ieee488_devices, nullptr);
- IEEE488_SLOT(config, "ieee15", 15, cbm_ieee488_devices, nullptr);
- IEEE488(config, IEEE488_TAG);
- }
protected:
enum
{
@@ -162,6 +208,8 @@ private:
uint8_t m_dio;
};
+DECLARE_DEVICE_TYPE(IEEE488, ieee488_device)
+
// ======================> ieee488_slot_device
@@ -170,16 +218,6 @@ class ieee488_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- ieee488_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, int address, T &&opts, char const *dflt)
- : ieee488_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- set_address(address);
- }
ieee488_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
static void add_cbm_slot(machine_config &config, const char *_tag, int _address, const char *_def_slot);
@@ -206,6 +244,8 @@ protected:
int m_address;
};
+DECLARE_DEVICE_TYPE(IEEE488_SLOT, ieee488_slot_device)
+
// ======================> device_ieee488_interface
@@ -240,4 +280,10 @@ private:
device_ieee488_interface *m_next;
};
+
+void cbm_ieee488_devices(device_slot_interface &device);
+void hp_ieee488_devices(device_slot_interface &device);
+void remote488_devices(device_slot_interface &device);
+
+
#endif // MAME_BUS_IEEE488_IEEE488_H
diff --git a/src/devices/bus/ieee488/remote488.cpp b/src/devices/bus/ieee488/remote488.cpp
index b5eb0041632..a9baafc9320 100644
--- a/src/devices/bus/ieee488/remote488.cpp
+++ b/src/devices/bus/ieee488/remote488.cpp
@@ -249,10 +249,9 @@ remote488_device::remote488_device(const machine_config &mconfig, const char *ta
{
}
-void remote488_device::device_add_mconfig(machine_config &config)
-{
- BITBANGER(config, m_stream, 0);
-}
+MACHINE_CONFIG_START(remote488_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("stream", BITBANGER, 0)
+MACHINE_CONFIG_END
void remote488_device::ieee488_eoi(int state)
{
diff --git a/src/devices/bus/ieee488/softbox.cpp b/src/devices/bus/ieee488/softbox.cpp
index e2041d3e4e2..63208f7ce9e 100644
--- a/src/devices/bus/ieee488/softbox.cpp
+++ b/src/devices/bus/ieee488/softbox.cpp
@@ -232,12 +232,11 @@ DEVICE_INPUT_DEFAULTS_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void softbox_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(softbox_device::device_add_mconfig)
// basic machine hardware
- Z80(config, m_maincpu, XTAL(8'000'000)/2);
- m_maincpu->set_addrmap(AS_PROGRAM, &softbox_device::softbox_mem);
- m_maincpu->set_addrmap(AS_IO, &softbox_device::softbox_io);
+ MCFG_DEVICE_ADD(Z80_TAG, Z80, XTAL(8'000'000)/2)
+ MCFG_DEVICE_PROGRAM_MAP(softbox_mem)
+ MCFG_DEVICE_IO_MAP(softbox_io)
// devices
i8251_device &i8251(I8251(config, I8251_TAG, 0));
@@ -265,13 +264,17 @@ void softbox_device::device_add_mconfig(machine_config &config)
m_dbrg->fr_handler().set(I8251_TAG, FUNC(i8251_device::write_rxc));
m_dbrg->ft_handler().set(I8251_TAG, FUNC(i8251_device::write_txc));
- CORVUS_HDC(config, m_hdc, 0);
- HARDDISK(config, "harddisk1", "corvus_hdd");
- HARDDISK(config, "harddisk2", "corvus_hdd");
- HARDDISK(config, "harddisk3", "corvus_hdd");
- HARDDISK(config, "harddisk4", "corvus_hdd");
- //imi7000_bus_device::add_config(config, "imi5000h", nullptr, nullptr, nullptr);
-}
+ MCFG_DEVICE_ADD(m_hdc, CORVUS_HDC, 0)
+ MCFG_HARDDISK_ADD("harddisk1")
+ MCFG_HARDDISK_INTERFACE("corvus_hdd")
+ MCFG_HARDDISK_ADD("harddisk2")
+ MCFG_HARDDISK_INTERFACE("corvus_hdd")
+ MCFG_HARDDISK_ADD("harddisk3")
+ MCFG_HARDDISK_INTERFACE("corvus_hdd")
+ MCFG_HARDDISK_ADD("harddisk4")
+ MCFG_HARDDISK_INTERFACE("corvus_hdd")
+ //MCFG_IMI7000_BUS_ADD("imi5000h", nullptr, nullptr, nullptr)
+MACHINE_CONFIG_END
//-------------------------------------------------
@@ -378,6 +381,6 @@ void softbox_device::ieee488_ifc(int state)
WRITE8_MEMBER( softbox_device::dbrg_w )
{
- m_dbrg->str_w(data & 0x0f);
- m_dbrg->stt_w(data >> 4);
+ m_dbrg->write_str(data & 0x0f);
+ m_dbrg->write_stt(data >> 4);
}
diff --git a/src/devices/bus/imi7000/imi7000.h b/src/devices/bus/imi7000/imi7000.h
index 38de3341ae5..0559a565285 100644
--- a/src/devices/bus/imi7000/imi7000.h
+++ b/src/devices/bus/imi7000/imi7000.h
@@ -31,10 +31,8 @@
#pragma once
-void imi7000_devices(device_slot_interface &device);
-DECLARE_DEVICE_TYPE(IMI7000_BUS, imi7000_bus_device)
-DECLARE_DEVICE_TYPE(IMI7000_SLOT, imi7000_slot_device)
+
//**************************************************************************
// CONSTANTS
@@ -45,6 +43,23 @@ DECLARE_DEVICE_TYPE(IMI7000_SLOT, imi7000_slot_device)
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_IMI7000_BUS_ADD(_def_slot1, _def_slot2, _def_slot3, _def_slot4) \
+ MCFG_DEVICE_ADD(IMI7000_BUS_TAG, IMI7000_BUS, 0) \
+ MCFG_DEVICE_ADD(IMI7000_BUS_TAG":0", IMI7000_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(imi7000_devices, _def_slot1, false) \
+ MCFG_DEVICE_ADD(IMI7000_BUS_TAG":1", IMI7000_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(imi7000_devices, _def_slot2, false) \
+ MCFG_DEVICE_ADD(IMI7000_BUS_TAG":2", IMI7000_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(imi7000_devices, _def_slot3, false) \
+ MCFG_DEVICE_ADD(IMI7000_BUS_TAG":3", IMI7000_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(imi7000_devices, _def_slot4, false)
+
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -58,17 +73,7 @@ class imi7000_bus_device : public device_t
{
public:
// construction/destruction
- imi7000_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
-
- template <typename T, typename U, typename V, typename W>
- static void add_config(machine_config &config, T &&_def_slot1, U &&_def_slot2, V &&_def_slot3, W &&_def_slot4)
- {
- IMI7000_BUS(config, IMI7000_BUS_TAG);
- IMI7000_SLOT(config, IMI7000_BUS_TAG":0", imi7000_devices, std::forward<T>(_def_slot1));
- IMI7000_SLOT(config, IMI7000_BUS_TAG":1", imi7000_devices, std::forward<U>(_def_slot2));
- IMI7000_SLOT(config, IMI7000_BUS_TAG":2", imi7000_devices, std::forward<V>(_def_slot3));
- IMI7000_SLOT(config, IMI7000_BUS_TAG":3", imi7000_devices, std::forward<W>(_def_slot4));
- }
+ imi7000_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// device-level overrides
@@ -85,15 +90,6 @@ class imi7000_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- imi7000_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : imi7000_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
imi7000_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
@@ -117,4 +113,13 @@ protected:
imi7000_slot_device *m_slot;
};
+
+// device type definition
+DECLARE_DEVICE_TYPE(IMI7000_BUS, imi7000_bus_device)
+DECLARE_DEVICE_TYPE(IMI7000_SLOT, imi7000_slot_device)
+
+
+// slot interface
+void imi7000_devices(device_slot_interface &device);
+
#endif // MAME_BUS_IMI7000_IMI7000_H
diff --git a/src/devices/bus/intellec4/intellec4.cpp b/src/devices/bus/intellec4/intellec4.cpp
index c3742062454..82cf6702144 100644
--- a/src/devices/bus/intellec4/intellec4.cpp
+++ b/src/devices/bus/intellec4/intellec4.cpp
@@ -58,11 +58,16 @@ void univ_slot_device::device_start()
univ_bus_device::univ_bus_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, INTELLEC4_UNIV_BUS, tag, owner, clock)
- , m_rom_space(*this, finder_base::DUMMY_TAG, -1)
- , m_rom_ports_space(*this, finder_base::DUMMY_TAG, -1)
- , m_memory_space(*this, finder_base::DUMMY_TAG, -1)
- , m_status_space(*this, finder_base::DUMMY_TAG, -1)
- , m_ram_ports_space(*this, finder_base::DUMMY_TAG, -1)
+ , m_rom_device(*this, finder_base::DUMMY_TAG)
+ , m_rom_ports_device(*this, finder_base::DUMMY_TAG)
+ , m_memory_device(*this, finder_base::DUMMY_TAG)
+ , m_status_device(*this, finder_base::DUMMY_TAG)
+ , m_ram_ports_device(*this, finder_base::DUMMY_TAG)
+ , m_rom_space(-1)
+ , m_rom_ports_space(-1)
+ , m_memory_space(-1)
+ , m_status_space(-1)
+ , m_ram_ports_space(-1)
, m_test_out_cb(*this)
, m_stop_out_cb(*this)
, m_reset_4002_out_cb(*this)
@@ -118,6 +123,20 @@ WRITE_LINE_MEMBER(univ_bus_device::cpu_reset_in)
device_t implementation
----------------------------------*/
+void univ_bus_device::device_validity_check(validity_checker &valid) const
+{
+ if (m_rom_device && !m_rom_device->space_config(m_rom_space))
+ osd_printf_error("ROM space device %s (%s) lacks address space %d config\n", m_rom_device->device().tag(), m_rom_device->device().name(), m_rom_space);
+ if (m_rom_ports_device && !m_rom_ports_device->space_config(m_rom_ports_space))
+ osd_printf_error("ROM ports space device %s (%s) lacks address space %d config\n", m_rom_ports_device->device().tag(), m_rom_ports_device->device().name(), m_rom_ports_space);
+ if (m_memory_device && !m_memory_device->space_config(m_memory_space))
+ osd_printf_error("Memory space device %s (%s) lacks address space %d config\n", m_memory_device->device().tag(), m_memory_device->device().name(), m_memory_space);
+ if (m_status_device && !m_status_device->space_config(m_status_space))
+ osd_printf_error("Status space device %s (%s) lacks address space %d config\n", m_status_device->device().tag(), m_status_device->device().name(), m_status_space);
+ if (m_ram_ports_device && !m_ram_ports_device->space_config(m_ram_ports_space))
+ osd_printf_error("RAM ports space device %s (%s) lacks address space %d config\n", m_ram_ports_device->device().tag(), m_ram_ports_device->device().name(), m_ram_ports_space);
+}
+
void univ_bus_device::device_start()
{
m_test_out_cb.resolve_safe();
diff --git a/src/devices/bus/intellec4/intellec4.h b/src/devices/bus/intellec4/intellec4.h
index 68fa8a8080a..55cc06a263a 100644
--- a/src/devices/bus/intellec4/intellec4.h
+++ b/src/devices/bus/intellec4/intellec4.h
@@ -153,11 +153,11 @@ public:
friend class device_univ_card_interface;
// address space configuration
- template <typename T> void set_rom_space(T &&tag, int space) { m_rom_space.set_tag(std::forward<T>(tag), space); }
- template <typename T> void set_rom_ports_space(T &&tag, int space) { m_rom_ports_space.set_tag(std::forward<T>(tag), space); }
- template <typename T> void set_memory_space(T &&tag, int space) { m_memory_space.set_tag(std::forward<T>(tag), space); }
- template <typename T> void set_status_space(T &&tag, int space) { m_status_space.set_tag(std::forward<T>(tag), space); }
- template <typename T> void set_ram_ports_space(T &&tag, int space) { m_ram_ports_space.set_tag(std::forward<T>(tag), space); }
+ template <typename T> void set_rom_space(T &&tag, int space) { m_rom_device.set_tag(std::forward<T>(tag)); m_rom_space = space; }
+ template <typename T> void set_rom_ports_space(T &&tag, int space) { m_rom_ports_device.set_tag(std::forward<T>(tag)); m_rom_ports_space = space; }
+ template <typename T> void set_memory_space(T &&tag, int space) { m_memory_device.set_tag(std::forward<T>(tag)); m_memory_space = space; }
+ template <typename T> void set_status_space(T &&tag, int space) { m_status_device.set_tag(std::forward<T>(tag)); m_status_space = space; }
+ template <typename T> void set_ram_ports_space(T &&tag, int space) { m_ram_ports_device.set_tag(std::forward<T>(tag)); m_ram_ports_space = space; }
// callback configuration
auto stop_out_cb() { return m_stop_out_cb.bind(); }
@@ -183,6 +183,7 @@ public:
protected:
// device_t implementation
+ virtual void device_validity_check(validity_checker &valid) const override ATTR_COLD;
virtual void device_start() override;
private:
@@ -194,8 +195,10 @@ private:
void set_user_reset(unsigned index, int state);
// finding address spaces
- required_address_space m_rom_space, m_rom_ports_space;
- required_address_space m_memory_space, m_status_space, m_ram_ports_space;
+ required_device<device_memory_interface> m_rom_device, m_rom_ports_device;
+ required_device<device_memory_interface> m_memory_device, m_status_device, m_ram_ports_device;
+ int m_rom_space, m_rom_ports_space;
+ int m_memory_space, m_status_space, m_ram_ports_space;
// output line callbacks
devcb_write_line m_test_out_cb;
@@ -222,11 +225,11 @@ protected:
// device_interface implementation
void interface_pre_start() override;
- address_space &rom_space() { return *m_bus->m_rom_space; }
- address_space &rom_ports_space() { return *m_bus->m_rom_ports_space; }
- address_space &memory_space() { return *m_bus->m_memory_space; }
- address_space &status_space() { return *m_bus->m_status_space; }
- address_space &ram_ports_space() { return *m_bus->m_ram_ports_space; }
+ address_space &rom_space() { return m_bus->m_rom_device->space(m_bus->m_rom_space); }
+ address_space &rom_ports_space() { return m_bus->m_rom_ports_device->space(m_bus->m_rom_ports_space); }
+ address_space &memory_space() { return m_bus->m_memory_device->space(m_bus->m_memory_space); }
+ address_space &status_space() { return m_bus->m_status_device->space(m_bus->m_status_space); }
+ address_space &ram_ports_space() { return m_bus->m_ram_ports_device->space(m_bus->m_ram_ports_space); }
DECLARE_WRITE_LINE_MEMBER(test_out) { m_bus->set_test(m_index, state); }
DECLARE_WRITE_LINE_MEMBER(stop_out) { m_bus->set_stop(m_index, state); }
diff --git a/src/devices/bus/interpro/keyboard/hle.cpp b/src/devices/bus/interpro/keyboard/hle.cpp
index 15dd262eddf..670e5bd975c 100644
--- a/src/devices/bus/interpro/keyboard/hle.cpp
+++ b/src/devices/bus/interpro/keyboard/hle.cpp
@@ -277,11 +277,11 @@ WRITE_LINE_MEMBER(hle_device_base::input_txd)
device_buffered_serial_interface::rx_w(state);
}
-void hle_device_base::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(hle_device_base::device_add_mconfig)
SPEAKER(config, "bell").front_center();
- BEEP(config, m_beeper, ATTOSECONDS_TO_HZ(480 * ATTOSECONDS_PER_MICROSECOND)).add_route(ALL_OUTPUTS, "bell", 1.0);
-}
+ MCFG_DEVICE_ADD("beeper", BEEP, ATTOSECONDS_TO_HZ(480 * ATTOSECONDS_PER_MICROSECOND))
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "bell", 1.0)
+MACHINE_CONFIG_END
void hle_device_base::device_start()
{
diff --git a/src/devices/bus/interpro/sr/edge.cpp b/src/devices/bus/interpro/sr/edge.cpp
index 390b3459079..eb680532d3b 100644
--- a/src/devices/bus/interpro/sr/edge.cpp
+++ b/src/devices/bus/interpro/sr/edge.cpp
@@ -475,7 +475,7 @@ void mpcb828_device::device_add_mconfig(machine_config &config)
TMS32030(config, m_dsp, 30_MHz_XTAL);
m_dsp->holda().set(FUNC(mpcb828_device::holda));
m_dsp->set_disable();
- //m_dsp->set_addrmap(0, map_dynamic<2>);
+ //MCFG_DEVICE_ADDRESS_MAP(0, map_dynamic<2>)
BT458(config, "ramdac", 83'020'800);
@@ -484,7 +484,7 @@ void mpcb828_device::device_add_mconfig(machine_config &config)
m_scc->out_txda_callback().set("kbd", FUNC(interpro_keyboard_port_device::write_txd));
INTERPRO_KEYBOARD_PORT(config, "kbd", interpro_keyboard_devices, "hle_en_us").rxd_handler_cb().set(m_scc, FUNC(z80scc_device::rxa_w));
-}
+MACHINE_CONFIG_END
/*
* MPCB849: EDGE-1 graphics, 2 megapixels, single screen, 60Hz refresh.
diff --git a/src/devices/bus/interpro/sr/sr.cpp b/src/devices/bus/interpro/sr/sr.cpp
index 82071af86d2..6d6d76bee42 100644
--- a/src/devices/bus/interpro/sr/sr.cpp
+++ b/src/devices/bus/interpro/sr/sr.cpp
@@ -267,6 +267,9 @@ DEFINE_DEVICE_TYPE(SRX_SLOT, srx_slot_device, "srx_slot", "InterPro SRX slot")
void interpro_bus_device::device_resolve_objects()
{
+ m_main_space = &m_maincpu->space(0);
+ m_io_space = &m_maincpu->space(1);
+
// resolve callbacks
m_out_irq0_cb.resolve_safe();
m_out_irq1_cb.resolve_safe();
diff --git a/src/devices/bus/interpro/sr/sr.h b/src/devices/bus/interpro/sr/sr.h
index 858590f5075..0fcecc086f8 100644
--- a/src/devices/bus/interpro/sr/sr.h
+++ b/src/devices/bus/interpro/sr/sr.h
@@ -9,10 +9,6 @@
class interpro_bus_device : public device_t
{
public:
- // space configuration
- template <typename T> void set_main_space(T &&tag, int spacenum) { m_main_space.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_io_space(T &&tag, int spacenum) { m_io_space.set_tag(std::forward<T>(tag), spacenum); }
-
// callback configuration
auto out_irq0_cb() { return m_out_irq0_cb.bind(); }
auto out_irq1_cb() { return m_out_irq1_cb.bind(); }
@@ -28,8 +24,9 @@ protected:
// construction/destruction
interpro_bus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, type, tag, owner, clock)
- , m_main_space(*this, finder_base::DUMMY_TAG, -1)
- , m_io_space(*this, finder_base::DUMMY_TAG, -1)
+ , m_maincpu(*this, finder_base::DUMMY_TAG)
+ , m_main_space(nullptr)
+ , m_io_space(nullptr)
, m_out_irq0_cb(*this)
, m_out_irq1_cb(*this)
, m_out_irq2_cb(*this)
@@ -41,8 +38,9 @@ protected:
virtual void device_resolve_objects() override;
// internal state
- required_address_space m_main_space;
- required_address_space m_io_space;
+ required_device<cpu_device> m_maincpu;
+ address_space *m_main_space;
+ address_space *m_io_space;
private:
devcb_write_line m_out_irq0_cb;
@@ -57,6 +55,12 @@ class cbus_bus_device : public interpro_bus_device
{
public:
// construction/destruction
+ template <typename T>
+ cbus_bus_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock, T &&cpu_device)
+ : cbus_bus_device(mconfig, tag, owner, clock)
+ {
+ m_maincpu.set_tag(std::forward<T>(cpu_device));
+ }
cbus_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
static const u32 CBUS_BASE = 0x87000000;
@@ -154,6 +158,12 @@ class srx_bus_device : public interpro_bus_device
{
public:
// construction/destruction
+ template <typename T>
+ srx_bus_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock, T &&cpu_device)
+ : srx_bus_device(mconfig, tag, owner, clock)
+ {
+ m_maincpu.set_tag(std::forward<T>(cpu_device));
+ }
srx_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
static const u32 SRX_BASE = 0x8f000000;
diff --git a/src/devices/bus/intv/ecs.cpp b/src/devices/bus/intv/ecs.cpp
index 6fd321af36b..e1d7f9b0b98 100644
--- a/src/devices/bus/intv/ecs.cpp
+++ b/src/devices/bus/intv/ecs.cpp
@@ -94,8 +94,7 @@ void intv_ecs_device::late_subslot_setup()
//-------------------------------------------------
-void intv_ecs_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(intv_ecs_device::device_add_mconfig)
SPEAKER(config, "mono_ecs").front_center();
AY8914(config, m_snd, XTAL(3'579'545)/2);
@@ -104,9 +103,9 @@ void intv_ecs_device::device_add_mconfig(machine_config &config)
m_snd->port_a_write_callback().set("ctrl_port", FUNC(intvecs_control_port_device::portA_w));
m_snd->add_route(ALL_OUTPUTS, "mono_ecs", 0.33);
- INTVECS_CONTROL_PORT(config, "ctrl_port", intvecs_control_port_devices, "keybd");
- INTV_CART_SLOT(config, m_subslot, intv_cart, nullptr);
-}
+ MCFG_INTVECS_CONTROL_PORT_ADD("ctrl_port", intvecs_control_port_devices, "keybd")
+ MCFG_INTV_CARTRIDGE_ADD("subslot", intv_cart, nullptr)
+MACHINE_CONFIG_END
ROM_START( ecs )
@@ -126,7 +125,7 @@ const tiny_rom_entry *intv_ecs_device::device_rom_region() const
Paged ROM handling
-------------------------------------------------*/
-uint16_t intv_ecs_device::read_rom20(offs_t offset)
+READ16_MEMBER(intv_ecs_device::read_rom20)
{
if (m_bank_base[2])
return INTV_ROM16_READ(offset + 0x2000);
@@ -134,7 +133,7 @@ uint16_t intv_ecs_device::read_rom20(offs_t offset)
return 0xffff;
}
-uint16_t intv_ecs_device::read_rom70(offs_t offset)
+READ16_MEMBER(intv_ecs_device::read_rom70)
{
if (m_bank_base[7])
return 0xffff;
@@ -142,21 +141,21 @@ uint16_t intv_ecs_device::read_rom70(offs_t offset)
return INTV_ROM16_READ(offset + 0x7000);
}
-uint16_t intv_ecs_device::read_rome0(offs_t offset)
+READ16_MEMBER(intv_ecs_device::read_rome0)
{
if (m_bank_base[14])
return INTV_ROM16_READ(offset + 0xe000);
else // if WSMLB is loaded, it shall go here, otherwise 0xffff
- return m_subslot->read_rome0(offset);
+ return m_subslot->read_rome0(space, offset, mem_mask);
}
-uint16_t intv_ecs_device::read_romf0(offs_t offset)
+READ16_MEMBER(intv_ecs_device::read_romf0)
{
// only WSMLB should come here with bank_base = 1
if (m_bank_base[15])
- return m_subslot->read_romf0(offset + 0x1000);
+ return m_subslot->read_romf0(space, offset + 0x1000, mem_mask);
else
- return m_subslot->read_romf0(offset);
+ return m_subslot->read_romf0(space, offset, mem_mask);
}
@@ -164,40 +163,44 @@ uint16_t intv_ecs_device::read_romf0(offs_t offset)
read_audio
-------------------------------------------------*/
-uint16_t intv_ecs_device::read_ay(offs_t offset)
+READ16_MEMBER(intv_ecs_device::read_ay)
{
- return 0xff00 | m_snd->read(offset);
+ if (ACCESSING_BITS_0_7)
+ return m_snd->read(space, offset, mem_mask);
+ else
+ return 0xffff;
}
/*-------------------------------------------------
write_audio
-------------------------------------------------*/
-void intv_ecs_device::write_ay(offs_t offset, uint16_t data)
+WRITE16_MEMBER(intv_ecs_device::write_ay)
{
- return m_snd->write(offset, data & 0x00ff);
+ if (ACCESSING_BITS_0_7)
+ return m_snd->write(space, offset, data, mem_mask);
}
-uint16_t intv_ecs_device::read_rom80(offs_t offset)
+READ16_MEMBER(intv_ecs_device::read_rom80)
{
if (m_ram88_enabled && offset >= 0x800)
- return m_subslot->read_ram(offset & 0x7ff);
+ return m_subslot->read_ram(space, offset & 0x7ff, mem_mask);
else
- return m_subslot->read_rom80(offset);
+ return m_subslot->read_rom80(space, offset, mem_mask);
}
-uint16_t intv_ecs_device::read_romd0(offs_t offset)
+READ16_MEMBER(intv_ecs_device::read_romd0)
{
if (m_ramd0_enabled && offset < 0x800)
- return m_subslot->read_ram(offset);
+ return m_subslot->read_ram(space, offset, mem_mask);
else
- return m_subslot->read_romd0(offset);
+ return m_subslot->read_romd0(space, offset, mem_mask);
}
-void intv_ecs_device::write_rom20(offs_t offset, uint16_t data)
+WRITE16_MEMBER(intv_ecs_device::write_rom20)
{
if (offset == 0xfff)
{
@@ -208,7 +211,7 @@ void intv_ecs_device::write_rom20(offs_t offset, uint16_t data)
}
}
-void intv_ecs_device::write_rom70(offs_t offset, uint16_t data)
+WRITE16_MEMBER(intv_ecs_device::write_rom70)
{
if (offset == 0xfff)
{
@@ -219,7 +222,7 @@ void intv_ecs_device::write_rom70(offs_t offset, uint16_t data)
}
}
-void intv_ecs_device::write_rome0(offs_t offset, uint16_t data)
+WRITE16_MEMBER(intv_ecs_device::write_rome0)
{
if (offset == 0xfff)
{
@@ -230,7 +233,7 @@ void intv_ecs_device::write_rome0(offs_t offset, uint16_t data)
}
}
-void intv_ecs_device::write_romf0(offs_t offset, uint16_t data)
+WRITE16_MEMBER(intv_ecs_device::write_romf0)
{
if (offset == 0xfff)
{
diff --git a/src/devices/bus/intv/ecs.h b/src/devices/bus/intv/ecs.h
index 68911831c0a..943a768fe03 100644
--- a/src/devices/bus/intv/ecs.h
+++ b/src/devices/bus/intv/ecs.h
@@ -23,41 +23,41 @@ public:
// actual ECS accesses
// paged ROMs
- virtual uint16_t read_rom20(offs_t offset) override;
- virtual uint16_t read_rom70(offs_t offset) override;
- virtual uint16_t read_rome0(offs_t offset) override;
- virtual uint16_t read_romf0(offs_t offset) override;
+ virtual DECLARE_READ16_MEMBER(read_rom20) override;
+ virtual DECLARE_READ16_MEMBER(read_rom70) override;
+ virtual DECLARE_READ16_MEMBER(read_rome0) override;
+ virtual DECLARE_READ16_MEMBER(read_romf0) override;
// RAM
- virtual uint16_t read_ram(offs_t offset) override { return (int)m_ram[offset & (m_ram.size() - 1)]; }
- virtual void write_ram(offs_t offset, uint16_t data) override { m_ram[offset & (m_ram.size() - 1)] = data & 0xff; }
+ virtual DECLARE_READ16_MEMBER(read_ram) override { return (int)m_ram[offset & (m_ram.size() - 1)]; }
+ virtual DECLARE_WRITE16_MEMBER(write_ram) override { m_ram[offset & (m_ram.size() - 1)] = data & 0xff; }
// AY8914
- virtual uint16_t read_ay(offs_t offset) override;
- virtual void write_ay(offs_t offset, uint16_t data) override;
+ virtual DECLARE_READ16_MEMBER(read_ay) override;
+ virtual DECLARE_WRITE16_MEMBER(write_ay) override;
// passthru accesses
- virtual uint16_t read_rom04(offs_t offset) override { return m_subslot->read_rom04(offset); }
- virtual uint16_t read_rom40(offs_t offset) override { return m_subslot->read_rom40(offset); }
- virtual uint16_t read_rom48(offs_t offset) override { return m_subslot->read_rom48(offset); }
- virtual uint16_t read_rom50(offs_t offset) override { return m_subslot->read_rom50(offset); }
- virtual uint16_t read_rom60(offs_t offset) override { return m_subslot->read_rom60(offset); }
- virtual uint16_t read_rom80(offs_t offset) override;
- virtual uint16_t read_rom90(offs_t offset) override { return m_subslot->read_rom90(offset); }
- virtual uint16_t read_roma0(offs_t offset) override { return m_subslot->read_roma0(offset); }
- virtual uint16_t read_romb0(offs_t offset) override { return m_subslot->read_romb0(offset); }
- virtual uint16_t read_romc0(offs_t offset) override { return m_subslot->read_romc0(offset); }
- virtual uint16_t read_romd0(offs_t offset) override;
+ virtual DECLARE_READ16_MEMBER(read_rom04) override { return m_subslot->read_rom04(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_rom40) override { return m_subslot->read_rom40(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_rom48) override { return m_subslot->read_rom48(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_rom50) override { return m_subslot->read_rom50(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_rom60) override { return m_subslot->read_rom60(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_rom80) override;
+ virtual DECLARE_READ16_MEMBER(read_rom90) override { return m_subslot->read_rom90(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_roma0) override { return m_subslot->read_roma0(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_romb0) override { return m_subslot->read_romb0(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_romc0) override { return m_subslot->read_romc0(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_romd0) override;
// paged ROM banking
- virtual void write_rom20(offs_t offset, uint16_t data) override;
- virtual void write_rom70(offs_t offset, uint16_t data) override;
- virtual void write_rome0(offs_t offset, uint16_t data) override;
- virtual void write_romf0(offs_t offset, uint16_t data) override;
+ virtual DECLARE_WRITE16_MEMBER(write_rom20) override;
+ virtual DECLARE_WRITE16_MEMBER(write_rom70) override;
+ virtual DECLARE_WRITE16_MEMBER(write_rome0) override;
+ virtual DECLARE_WRITE16_MEMBER(write_romf0) override;
// RAM passthru write
- virtual void write_88(offs_t offset, uint16_t data) override { if (m_ram88_enabled) m_subslot->write_ram(offset, data); }
- virtual void write_d0(offs_t offset, uint16_t data) override { if (m_ramd0_enabled) m_subslot->write_ram(offset, data); }
+ virtual DECLARE_WRITE16_MEMBER(write_88) override { if (m_ram88_enabled) m_subslot->write_ram(space, offset, data, mem_mask); }
+ virtual DECLARE_WRITE16_MEMBER(write_d0) override { if (m_ramd0_enabled) m_subslot->write_ram(space, offset, data, mem_mask); }
// IntelliVoice passthru
- virtual uint16_t read_speech(offs_t offset) override { if (m_voice_enabled) return m_subslot->read_speech(offset); else return 0xffff; }
- virtual void write_speech(offs_t offset, uint16_t data) override { if (m_voice_enabled) m_subslot->write_speech(offset, data); }
+ virtual DECLARE_READ16_MEMBER(read_speech) override { if (m_voice_enabled) return m_subslot->read_speech(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_WRITE16_MEMBER(write_speech) override { if (m_voice_enabled) m_subslot->write_speech(space, offset, data, mem_mask); }
virtual void late_subslot_setup() override;
diff --git a/src/devices/bus/intv/rom.h b/src/devices/bus/intv/rom.h
index 5266220e1ec..7b83b2709fe 100644
--- a/src/devices/bus/intv/rom.h
+++ b/src/devices/bus/intv/rom.h
@@ -16,21 +16,21 @@ public:
intv_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint16_t read_rom04(offs_t offset) override { return INTV_ROM16_READ(offset + 0x0400); }
- virtual uint16_t read_rom20(offs_t offset) override { return INTV_ROM16_READ(offset + 0x2000); }
- virtual uint16_t read_rom40(offs_t offset) override { return INTV_ROM16_READ(offset + 0x4000); }
- virtual uint16_t read_rom48(offs_t offset) override { return INTV_ROM16_READ(offset + 0x4800); }
- virtual uint16_t read_rom50(offs_t offset) override { return INTV_ROM16_READ(offset + 0x5000); }
- virtual uint16_t read_rom60(offs_t offset) override { return INTV_ROM16_READ(offset + 0x6000); }
- virtual uint16_t read_rom70(offs_t offset) override { return INTV_ROM16_READ(offset + 0x7000); }
- virtual uint16_t read_rom80(offs_t offset) override { return INTV_ROM16_READ(offset + 0x8000); }
- virtual uint16_t read_rom90(offs_t offset) override { return INTV_ROM16_READ(offset + 0x9000); }
- virtual uint16_t read_roma0(offs_t offset) override { return INTV_ROM16_READ(offset + 0xa000); }
- virtual uint16_t read_romb0(offs_t offset) override { return INTV_ROM16_READ(offset + 0xb000); }
- virtual uint16_t read_romc0(offs_t offset) override { return INTV_ROM16_READ(offset + 0xc000); }
- virtual uint16_t read_romd0(offs_t offset) override { return INTV_ROM16_READ(offset + 0xd000); }
- virtual uint16_t read_rome0(offs_t offset) override { return INTV_ROM16_READ(offset + 0xe000); }
- virtual uint16_t read_romf0(offs_t offset) override { return INTV_ROM16_READ(offset + 0xf000); }
+ virtual DECLARE_READ16_MEMBER(read_rom04) override { return INTV_ROM16_READ(offset + 0x0400); }
+ virtual DECLARE_READ16_MEMBER(read_rom20) override { return INTV_ROM16_READ(offset + 0x2000); }
+ virtual DECLARE_READ16_MEMBER(read_rom40) override { return INTV_ROM16_READ(offset + 0x4000); }
+ virtual DECLARE_READ16_MEMBER(read_rom48) override { return INTV_ROM16_READ(offset + 0x4800); }
+ virtual DECLARE_READ16_MEMBER(read_rom50) override { return INTV_ROM16_READ(offset + 0x5000); }
+ virtual DECLARE_READ16_MEMBER(read_rom60) override { return INTV_ROM16_READ(offset + 0x6000); }
+ virtual DECLARE_READ16_MEMBER(read_rom70) override { return INTV_ROM16_READ(offset + 0x7000); }
+ virtual DECLARE_READ16_MEMBER(read_rom80) override { return INTV_ROM16_READ(offset + 0x8000); }
+ virtual DECLARE_READ16_MEMBER(read_rom90) override { return INTV_ROM16_READ(offset + 0x9000); }
+ virtual DECLARE_READ16_MEMBER(read_roma0) override { return INTV_ROM16_READ(offset + 0xa000); }
+ virtual DECLARE_READ16_MEMBER(read_romb0) override { return INTV_ROM16_READ(offset + 0xb000); }
+ virtual DECLARE_READ16_MEMBER(read_romc0) override { return INTV_ROM16_READ(offset + 0xc000); }
+ virtual DECLARE_READ16_MEMBER(read_romd0) override { return INTV_ROM16_READ(offset + 0xd000); }
+ virtual DECLARE_READ16_MEMBER(read_rome0) override { return INTV_ROM16_READ(offset + 0xe000); }
+ virtual DECLARE_READ16_MEMBER(read_romf0) override { return INTV_ROM16_READ(offset + 0xf000); }
protected:
intv_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -49,8 +49,8 @@ public:
intv_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint16_t read_ram(offs_t offset) override { return (int)m_ram[offset & (m_ram.size() - 1)]; }
- virtual void write_ram(offs_t offset, uint16_t data) override { m_ram[offset & (m_ram.size() - 1)] = data & 0xff; }
+ virtual DECLARE_READ16_MEMBER(read_ram) override { return (int)m_ram[offset & (m_ram.size() - 1)]; }
+ virtual DECLARE_WRITE16_MEMBER(write_ram) override { m_ram[offset & (m_ram.size() - 1)] = data & 0xff; }
};
// ======================> intv_gfact_device
@@ -62,8 +62,8 @@ public:
intv_gfact_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint16_t read_ram(offs_t offset) override { return (int)m_ram[offset & (m_ram.size() - 1)]; }
- virtual void write_ram(offs_t offset, uint16_t data) override { m_ram[offset & (m_ram.size() - 1)] = data & 0xff; }
+ virtual DECLARE_READ16_MEMBER(read_ram) override { return (int)m_ram[offset & (m_ram.size() - 1)]; }
+ virtual DECLARE_WRITE16_MEMBER(write_ram) override { m_ram[offset & (m_ram.size() - 1)] = data & 0xff; }
};
// ======================> intv_wsmlb_device
diff --git a/src/devices/bus/intv/slot.cpp b/src/devices/bus/intv/slot.cpp
index 0c4ddae593a..0161c90b258 100644
--- a/src/devices/bus/intv/slot.cpp
+++ b/src/devices/bus/intv/slot.cpp
@@ -488,10 +488,10 @@ std::string intv_cart_slot_device::get_default_card_software(get_default_card_so
read_ay
-------------------------------------------------*/
-uint16_t intv_cart_slot_device::read_ay(offs_t offset)
+READ16_MEMBER(intv_cart_slot_device::read_ay)
{
if (m_cart)
- return m_cart->read_ay(offset);
+ return m_cart->read_ay(space, offset, mem_mask);
else
return 0xffff;
}
@@ -500,20 +500,20 @@ uint16_t intv_cart_slot_device::read_ay(offs_t offset)
write_ay
-------------------------------------------------*/
-void intv_cart_slot_device::write_ay(offs_t offset, uint16_t data)
+WRITE16_MEMBER(intv_cart_slot_device::write_ay)
{
if (m_cart)
- m_cart->write_ay(offset, data);
+ m_cart->write_ay(space, offset, data, mem_mask);
}
/*-------------------------------------------------
read_speech
-------------------------------------------------*/
-uint16_t intv_cart_slot_device::read_speech(offs_t offset)
+READ16_MEMBER(intv_cart_slot_device::read_speech)
{
if (m_cart)
- return m_cart->read_speech(offset);
+ return m_cart->read_speech(space, offset, mem_mask);
else
return 0xffff;
}
@@ -522,10 +522,10 @@ uint16_t intv_cart_slot_device::read_speech(offs_t offset)
write_speech
-------------------------------------------------*/
-void intv_cart_slot_device::write_speech(offs_t offset, uint16_t data)
+WRITE16_MEMBER(intv_cart_slot_device::write_speech)
{
if (m_cart)
- m_cart->write_speech(offset, data);
+ m_cart->write_speech(space, offset, data, mem_mask);
}
diff --git a/src/devices/bus/intv/slot.h b/src/devices/bus/intv/slot.h
index ec79b148375..bdec54dab76 100644
--- a/src/devices/bus/intv/slot.h
+++ b/src/devices/bus/intv/slot.h
@@ -39,36 +39,36 @@ public:
virtual ~device_intv_cart_interface();
// reading and writing
- virtual uint16_t read_rom04(offs_t offset) { return 0xffff; }
- virtual uint16_t read_rom20(offs_t offset) { return 0xffff; }
- virtual uint16_t read_rom40(offs_t offset) { return 0xffff; }
- virtual uint16_t read_rom48(offs_t offset) { return 0xffff; }
- virtual uint16_t read_rom50(offs_t offset) { return 0xffff; }
- virtual uint16_t read_rom60(offs_t offset) { return 0xffff; }
- virtual uint16_t read_rom70(offs_t offset) { return 0xffff; }
- virtual uint16_t read_rom80(offs_t offset) { return 0xffff; }
- virtual uint16_t read_rom90(offs_t offset) { return 0xffff; }
- virtual uint16_t read_roma0(offs_t offset) { return 0xffff; }
- virtual uint16_t read_romb0(offs_t offset) { return 0xffff; }
- virtual uint16_t read_romc0(offs_t offset) { return 0xffff; }
- virtual uint16_t read_romd0(offs_t offset) { return 0xffff; }
- virtual uint16_t read_rome0(offs_t offset) { return 0xffff; }
- virtual uint16_t read_romf0(offs_t offset) { return 0xffff; }
-
- virtual uint16_t read_ram(offs_t offset) { return 0xffff; }
- virtual void write_ram(offs_t offset, uint16_t data) {}
+ virtual DECLARE_READ16_MEMBER(read_rom04) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom20) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom40) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom48) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom50) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom60) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom70) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom80) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom90) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_roma0) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_romb0) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_romc0) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_romd0) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rome0) { return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_romf0) { return 0xffff; }
+
+ virtual DECLARE_READ16_MEMBER(read_ram) { return 0xffff; }
+ virtual DECLARE_WRITE16_MEMBER(write_ram) {}
// Used by IntelliVoice & ECS
- virtual uint16_t read_ay(offs_t offset) { return 0xffff; }
- virtual void write_ay(offs_t offset, uint16_t data) {}
- virtual uint16_t read_speech(offs_t offset) { return 0xffff; }
- virtual void write_speech(offs_t offset, uint16_t data) {}
- virtual void write_d0(offs_t offset, uint16_t data) {}
- virtual void write_88(offs_t offset, uint16_t data) {}
- virtual void write_rom20(offs_t offset, uint16_t data) {}
- virtual void write_rom70(offs_t offset, uint16_t data) {}
- virtual void write_rome0(offs_t offset, uint16_t data) {}
- virtual void write_romf0(offs_t offset, uint16_t data) {}
+ virtual DECLARE_READ16_MEMBER(read_ay) { return 0xffff; }
+ virtual DECLARE_WRITE16_MEMBER(write_ay) {}
+ virtual DECLARE_READ16_MEMBER(read_speech) { return 0xffff; }
+ virtual DECLARE_WRITE16_MEMBER(write_speech) {}
+ virtual DECLARE_WRITE16_MEMBER(write_d0) {}
+ virtual DECLARE_WRITE16_MEMBER(write_88) {}
+ virtual DECLARE_WRITE16_MEMBER(write_rom20) {}
+ virtual DECLARE_WRITE16_MEMBER(write_rom70) {}
+ virtual DECLARE_WRITE16_MEMBER(write_rome0) {}
+ virtual DECLARE_WRITE16_MEMBER(write_romf0) {}
void rom_alloc(uint32_t size, const char *tag);
void ram_alloc(uint32_t size);
@@ -98,17 +98,7 @@ class intv_cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- intv_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : intv_cart_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- intv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ intv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~intv_cart_slot_device();
// image-level overrides
@@ -134,40 +124,40 @@ public:
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
// reading and writing
- uint16_t read_rom04(offs_t offset) { if (m_cart) return m_cart->read_rom04(offset); else return 0xffff; }
- uint16_t read_rom20(offs_t offset) { if (m_cart) return m_cart->read_rom20(offset); else return 0xffff; }
- uint16_t read_rom40(offs_t offset) { if (m_cart) return m_cart->read_rom40(offset); else return 0xffff; }
- uint16_t read_rom48(offs_t offset) { if (m_cart) return m_cart->read_rom48(offset); else return 0xffff; }
- uint16_t read_rom50(offs_t offset) { if (m_cart) return m_cart->read_rom50(offset); else return 0xffff; }
- uint16_t read_rom60(offs_t offset) { if (m_cart) return m_cart->read_rom60(offset); else return 0xffff; }
- uint16_t read_rom70(offs_t offset) { if (m_cart) return m_cart->read_rom70(offset); else return 0xffff; }
- uint16_t read_rom80(offs_t offset) { if (m_cart) return m_cart->read_rom80(offset); else return 0xffff; }
- uint16_t read_rom90(offs_t offset) { if (m_cart) return m_cart->read_rom90(offset); else return 0xffff; }
- uint16_t read_roma0(offs_t offset) { if (m_cart) return m_cart->read_roma0(offset); else return 0xffff; }
- uint16_t read_romb0(offs_t offset) { if (m_cart) return m_cart->read_romb0(offset); else return 0xffff; }
- uint16_t read_romc0(offs_t offset) { if (m_cart) return m_cart->read_romc0(offset); else return 0xffff; }
- uint16_t read_romd0(offs_t offset) { if (m_cart) return m_cart->read_romd0(offset); else return 0xffff; }
- uint16_t read_rome0(offs_t offset) { if (m_cart) return m_cart->read_rome0(offset); else return 0xffff; }
- uint16_t read_romf0(offs_t offset) { if (m_cart) return m_cart->read_romf0(offset); else return 0xffff; }
-
- uint16_t read_ay(offs_t offset);
- void write_ay(offs_t offset, uint16_t data);
- uint16_t read_speech(offs_t offset);
- void write_speech(offs_t offset, uint16_t data);
- uint16_t read_ram(offs_t offset) { if (m_cart) return m_cart->read_ram(offset); else return 0xffff; }
- void write_ram(offs_t offset, uint16_t data) { if (m_cart) m_cart->write_ram(offset, data); }
+ virtual DECLARE_READ16_MEMBER(read_rom04) { if (m_cart) return m_cart->read_rom04(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom20) { if (m_cart) return m_cart->read_rom20(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom40) { if (m_cart) return m_cart->read_rom40(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom48) { if (m_cart) return m_cart->read_rom48(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom50) { if (m_cart) return m_cart->read_rom50(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom60) { if (m_cart) return m_cart->read_rom60(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom70) { if (m_cart) return m_cart->read_rom70(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom80) { if (m_cart) return m_cart->read_rom80(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rom90) { if (m_cart) return m_cart->read_rom90(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_roma0) { if (m_cart) return m_cart->read_roma0(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_romb0) { if (m_cart) return m_cart->read_romb0(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_romc0) { if (m_cart) return m_cart->read_romc0(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_romd0) { if (m_cart) return m_cart->read_romd0(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_rome0) { if (m_cart) return m_cart->read_rome0(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_READ16_MEMBER(read_romf0) { if (m_cart) return m_cart->read_romf0(space, offset, mem_mask); else return 0xffff; }
+
+ virtual DECLARE_READ16_MEMBER(read_ay);
+ virtual DECLARE_WRITE16_MEMBER(write_ay);
+ virtual DECLARE_READ16_MEMBER(read_speech);
+ virtual DECLARE_WRITE16_MEMBER(write_speech);
+ virtual DECLARE_READ16_MEMBER(read_ram) { if (m_cart) return m_cart->read_ram(space, offset, mem_mask); else return 0xffff; }
+ virtual DECLARE_WRITE16_MEMBER(write_ram) { if (m_cart) m_cart->write_ram(space, offset, data, mem_mask); }
virtual void late_subslot_setup() { if (m_cart) return m_cart->late_subslot_setup(); }
// these RAM accessors are needed to deal with IntelliVoice and ECS mounting RAM-equipped carts
- void write_d0(offs_t offset, uint16_t data) { if (m_cart) m_cart->write_d0(offset, data); }
- void write_88(offs_t offset, uint16_t data) { if (m_cart) m_cart->write_88(offset, data); }
+ virtual DECLARE_WRITE16_MEMBER(write_d0) { if (m_cart) m_cart->write_d0(space, offset, data, mem_mask); }
+ virtual DECLARE_WRITE16_MEMBER(write_88) { if (m_cart) m_cart->write_88(space, offset, data, mem_mask); }
// ECS paged roms need these
- void write_rom20(offs_t offset, uint16_t data) { if (m_cart) m_cart->write_rom20(offset, data); }
- void write_rom70(offs_t offset, uint16_t data) { if (m_cart) m_cart->write_rom70(offset, data); }
- void write_rome0(offs_t offset, uint16_t data) { if (m_cart) m_cart->write_rome0(offset, data); }
- void write_romf0(offs_t offset, uint16_t data) { if (m_cart) m_cart->write_romf0(offset, data); }
+ virtual DECLARE_WRITE16_MEMBER(write_rom20) { if (m_cart) m_cart->write_rom20(space, offset, data, mem_mask); }
+ virtual DECLARE_WRITE16_MEMBER(write_rom70) { if (m_cart) m_cart->write_rom70(space, offset, data, mem_mask); }
+ virtual DECLARE_WRITE16_MEMBER(write_rome0) { if (m_cart) m_cart->write_rome0(space, offset, data, mem_mask); }
+ virtual DECLARE_WRITE16_MEMBER(write_romf0) { if (m_cart) m_cart->write_romf0(space, offset, data, mem_mask); }
protected:
// device-level overrides
@@ -189,6 +179,10 @@ DECLARE_DEVICE_TYPE(INTV_CART_SLOT, intv_cart_slot_device)
#define INTVSLOT_ROM_REGION_TAG ":cart:rom"
+#define MCFG_INTV_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, INTV_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
void intv_cart(device_slot_interface &device);
#endif // MAME_BUS_INTV_SLOT_H
diff --git a/src/devices/bus/intv/voice.cpp b/src/devices/bus/intv/voice.cpp
index b8b07d84d34..7cc62da7856 100644
--- a/src/devices/bus/intv/voice.cpp
+++ b/src/devices/bus/intv/voice.cpp
@@ -69,16 +69,15 @@ void intv_voice_device::late_subslot_setup()
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void intv_voice_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(intv_voice_device::device_add_mconfig)
SPEAKER(config, "mono_voice").front_center();
SP0256(config, m_speech, 3120000);
/* The Intellivoice uses a speaker with its own volume control so the relative volumes to use are subjective */
m_speech->add_route(ALL_OUTPUTS, "mono_voice", 1.00);
- INTV_CART_SLOT(config, m_subslot, intv_cart, nullptr);
-}
+ MCFG_INTV_CARTRIDGE_ADD("subslot", intv_cart, nullptr)
+MACHINE_CONFIG_END
ROM_START( intellivoice )
@@ -96,33 +95,37 @@ const tiny_rom_entry *intv_voice_device::device_rom_region() const
read_audio
-------------------------------------------------*/
-uint16_t intv_voice_device::read_speech(offs_t offset)
+READ16_MEMBER(intv_voice_device::read_speech)
{
- return 0xff00 | m_speech->spb640_r(offset);
+ if (ACCESSING_BITS_0_7)
+ return m_speech->spb640_r(offset);
+ else
+ return 0xff;
}
/*-------------------------------------------------
write_audio
-------------------------------------------------*/
-void intv_voice_device::write_speech(offs_t offset, uint16_t data)
+WRITE16_MEMBER(intv_voice_device::write_speech)
{
- m_speech->spb640_w(offset, data & 0x00ff);
+ if (ACCESSING_BITS_0_7)
+ return m_speech->spb640_w(offset, data);
}
-uint16_t intv_voice_device::read_rom80(offs_t offset)
+READ16_MEMBER(intv_voice_device::read_rom80)
{
if (m_ram88_enabled && offset >= 0x800)
- return m_subslot->read_ram(offset & 0x7ff);
+ return m_subslot->read_ram(space, offset & 0x7ff, mem_mask);
else
- return m_subslot->read_rom80(offset);
+ return m_subslot->read_rom80(space, offset, mem_mask);
}
-uint16_t intv_voice_device::read_romd0(offs_t offset)
+READ16_MEMBER(intv_voice_device::read_romd0)
{
if (m_ramd0_enabled && offset < 0x800)
- return m_subslot->read_ram(offset);
+ return m_subslot->read_ram(space, offset, mem_mask);
else
- return m_subslot->read_romd0(offset);
+ return m_subslot->read_romd0(space, offset, mem_mask);
}
diff --git a/src/devices/bus/intv/voice.h b/src/devices/bus/intv/voice.h
index 7369058c435..d99b31573a3 100644
--- a/src/devices/bus/intv/voice.h
+++ b/src/devices/bus/intv/voice.h
@@ -18,31 +18,31 @@ public:
// reading and writing
// actual IntelliVoice access
- virtual uint16_t read_speech(offs_t offset) override;
- virtual void write_speech(offs_t offset, uint16_t data) override;
+ virtual DECLARE_READ16_MEMBER(read_speech) override;
+ virtual DECLARE_WRITE16_MEMBER(write_speech) override;
// passthru access
- virtual uint16_t read_rom04(offs_t offset) override { return m_subslot->read_rom04(offset); }
- virtual uint16_t read_rom20(offs_t offset) override { return m_subslot->read_rom20(offset); }
- virtual uint16_t read_rom40(offs_t offset) override { return m_subslot->read_rom40(offset); }
- virtual uint16_t read_rom48(offs_t offset) override { return m_subslot->read_rom48(offset); }
- virtual uint16_t read_rom50(offs_t offset) override { return m_subslot->read_rom50(offset); }
- virtual uint16_t read_rom60(offs_t offset) override { return m_subslot->read_rom60(offset); }
- virtual uint16_t read_rom70(offs_t offset) override { return m_subslot->read_rom70(offset); }
- virtual uint16_t read_rom80(offs_t offset) override;
- virtual uint16_t read_rom90(offs_t offset) override { return m_subslot->read_rom90(offset); }
- virtual uint16_t read_roma0(offs_t offset) override { return m_subslot->read_roma0(offset); }
- virtual uint16_t read_romb0(offs_t offset) override { return m_subslot->read_romb0(offset); }
- virtual uint16_t read_romc0(offs_t offset) override { return m_subslot->read_romc0(offset); }
- virtual uint16_t read_romd0(offs_t offset) override;
- virtual uint16_t read_rome0(offs_t offset) override { return m_subslot->read_rome0(offset); }
- virtual uint16_t read_romf0(offs_t offset) override { return m_subslot->read_romf0(offset); }
+ virtual DECLARE_READ16_MEMBER(read_rom04) override { return m_subslot->read_rom04(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_rom20) override { return m_subslot->read_rom20(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_rom40) override { return m_subslot->read_rom40(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_rom48) override { return m_subslot->read_rom48(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_rom50) override { return m_subslot->read_rom50(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_rom60) override { return m_subslot->read_rom60(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_rom70) override { return m_subslot->read_rom70(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_rom80) override;
+ virtual DECLARE_READ16_MEMBER(read_rom90) override { return m_subslot->read_rom90(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_roma0) override { return m_subslot->read_roma0(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_romb0) override { return m_subslot->read_romb0(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_romc0) override { return m_subslot->read_romc0(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_romd0) override;
+ virtual DECLARE_READ16_MEMBER(read_rome0) override { return m_subslot->read_rome0(space, offset, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_romf0) override { return m_subslot->read_romf0(space, offset, mem_mask); }
// RAM passthru write
- virtual void write_88(offs_t offset, uint16_t data) override { if (m_ram88_enabled) m_subslot->write_ram(offset, data); }
- virtual void write_d0(offs_t offset, uint16_t data) override { if (m_ramd0_enabled) m_subslot->write_ram(offset, data); }
- virtual uint16_t read_ram(offs_t offset) override { return m_subslot->read_ram(offset); }
- virtual void write_ram(offs_t offset, uint16_t data) override { m_subslot->write_ram(offset, data); }
+ virtual DECLARE_WRITE16_MEMBER(write_88) override { if (m_ram88_enabled) m_subslot->write_ram(space, offset, data, mem_mask); }
+ virtual DECLARE_WRITE16_MEMBER(write_d0) override { if (m_ramd0_enabled) m_subslot->write_ram(space, offset, data, mem_mask); }
+ virtual DECLARE_READ16_MEMBER(read_ram) override { return m_subslot->read_ram(space, offset, mem_mask); }
+ virtual DECLARE_WRITE16_MEMBER(write_ram) override { m_subslot->write_ram(space, offset, data, mem_mask); }
virtual void late_subslot_setup() override;
diff --git a/src/devices/bus/intv_ctrl/ctrl.h b/src/devices/bus/intv_ctrl/ctrl.h
index 1cf3968f933..4a3ce67a688 100644
--- a/src/devices/bus/intv_ctrl/ctrl.h
+++ b/src/devices/bus/intv_ctrl/ctrl.h
@@ -41,17 +41,7 @@ class intv_control_port_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- intv_control_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : intv_control_port_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- intv_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ intv_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~intv_control_port_device();
DECLARE_READ8_MEMBER( ctrl_r ) { return read_ctrl(); }
@@ -68,6 +58,17 @@ protected:
// device type definition
DECLARE_DEVICE_TYPE(INTV_CONTROL_PORT, intv_control_port_device)
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_INTV_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, INTV_CONTROL_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+
void intv_control_port_devices(device_slot_interface &device);
diff --git a/src/devices/bus/intv_ctrl/ecs_ctrl.cpp b/src/devices/bus/intv_ctrl/ecs_ctrl.cpp
index 3f6afda5f4b..e90292de645 100644
--- a/src/devices/bus/intv_ctrl/ecs_ctrl.cpp
+++ b/src/devices/bus/intv_ctrl/ecs_ctrl.cpp
@@ -145,11 +145,10 @@ static void intvecs_controller(device_slot_interface &device)
device.option_add("handctrl", INTV_HANDCTRL);
}
-void intvecs_ctrls_device::device_add_mconfig(machine_config &config)
-{
- INTV_CONTROL_PORT(config, m_hand1, intvecs_controller, "handctrl");
- INTV_CONTROL_PORT(config, m_hand2, intvecs_controller, "handctrl");
-}
+MACHINE_CONFIG_START(intvecs_ctrls_device::device_add_mconfig)
+ MCFG_INTV_CONTROL_PORT_ADD("port1", intvecs_controller, "handctrl")
+ MCFG_INTV_CONTROL_PORT_ADD("port2", intvecs_controller, "handctrl")
+MACHINE_CONFIG_END
intvecs_ctrls_device::intvecs_ctrls_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
diff --git a/src/devices/bus/intv_ctrl/ecs_ctrl.h b/src/devices/bus/intv_ctrl/ecs_ctrl.h
index 8a723c64949..923b5785358 100644
--- a/src/devices/bus/intv_ctrl/ecs_ctrl.h
+++ b/src/devices/bus/intv_ctrl/ecs_ctrl.h
@@ -46,17 +46,7 @@ class intvecs_control_port_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- intvecs_control_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : intvecs_control_port_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- intvecs_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ intvecs_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~intvecs_control_port_device();
DECLARE_READ8_MEMBER( portA_r ) { return read_portA(); }
@@ -78,6 +68,16 @@ protected:
DECLARE_DEVICE_TYPE(INTVECS_CONTROL_PORT, intvecs_control_port_device)
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_INTVECS_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, INTVECS_CONTROL_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+
void intvecs_control_port_devices(device_slot_interface &device);
diff --git a/src/devices/bus/iq151/disc2.cpp b/src/devices/bus/iq151/disc2.cpp
index 0fde6792d40..db9919ef516 100644
--- a/src/devices/bus/iq151/disc2.cpp
+++ b/src/devices/bus/iq151/disc2.cpp
@@ -95,7 +95,7 @@ const tiny_rom_entry *iq151_disc2_device::device_rom_region() const
void iq151_disc2_device::read(offs_t offset, uint8_t &data)
{
- // internal ROM is mapped at 0xe000-0xe7ff
+ // interal ROM is mapped at 0xe000-0xe7ff
if (offset >= 0xe000 && offset < 0xe800 && m_rom_enabled)
data = m_rom[offset & 0x7ff];
}
@@ -107,10 +107,12 @@ void iq151_disc2_device::read(offs_t offset, uint8_t &data)
void iq151_disc2_device::io_read(offs_t offset, uint8_t &data)
{
+ /* This is gross */
+ address_space *space = nullptr;
if (offset == 0xaa)
- data = m_fdc->msr_r();
+ data = m_fdc->msr_r(*space, 0, 0xff);
else if (offset == 0xab)
- data = m_fdc->fifo_r();
+ data = m_fdc->fifo_r(*space, 0, 0xff);
}
//-------------------------------------------------
@@ -119,8 +121,9 @@ void iq151_disc2_device::io_read(offs_t offset, uint8_t &data)
void iq151_disc2_device::io_write(offs_t offset, uint8_t data)
{
+ address_space *space = nullptr;
if (offset == 0xab)
- m_fdc->fifo_w(data);
+ m_fdc->fifo_w(*space, 0, data, 0xff);
else if (offset == 0xac)
m_rom_enabled = (data == 0x01);
}
diff --git a/src/devices/bus/iq151/iq151.h b/src/devices/bus/iq151/iq151.h
index 306fef47ee6..e68d27a007d 100644
--- a/src/devices/bus/iq151/iq151.h
+++ b/src/devices/bus/iq151/iq151.h
@@ -87,26 +87,16 @@ class iq151cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- iq151cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : iq151cart_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- iq151cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ iq151cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~iq151cart_slot_device();
- template <typename T> void set_screen_tag(T &&tag) { m_screen.set_tag(std::forward<T>(tag)); }
- auto out_irq0_callback() { return m_out_irq0_cb.bind(); }
- auto out_irq1_callback() { return m_out_irq1_cb.bind(); }
- auto out_irq2_callback() { return m_out_irq2_cb.bind(); }
- auto out_irq3_callback() { return m_out_irq3_cb.bind(); }
- auto out_irq4_callback() { return m_out_irq4_cb.bind(); }
- auto out_drq_callback() { return m_out_drq_cb.bind(); }
+ void set_screen_tag(const char *tag) { m_screen.set_tag(tag); }
+ template <class Object> devcb_base &set_out_irq0_callback(Object &&cb) { return m_out_irq0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_irq1_callback(Object &&cb) { return m_out_irq1_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_irq2_callback(Object &&cb) { return m_out_irq2_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_irq3_callback(Object &&cb) { return m_out_irq3_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_irq4_callback(Object &&cb) { return m_out_irq4_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_drq_callback(Object &&cb) { return m_out_drq_cb.set_callback(std::forward<Object>(cb)); }
// device-level overrides
virtual void device_start() override;
@@ -149,4 +139,30 @@ public:
// device type definition
DECLARE_DEVICE_TYPE(IQ151CART_SLOT, iq151cart_slot_device)
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_IQ151CART_SLOT_OUT_IRQ0_CB(_devcb) \
+ downcast<iq151cart_slot_device &>(*device).set_out_irq0_callback(DEVCB_##_devcb);
+
+#define MCFG_IQ151CART_SLOT_OUT_IRQ1_CB(_devcb) \
+ downcast<iq151cart_slot_device &>(*device).set_out_irq1_callback(DEVCB_##_devcb);
+
+#define MCFG_IQ151CART_SLOT_OUT_IRQ2_CB(_devcb) \
+ downcast<iq151cart_slot_device &>(*device).set_out_irq2_callback(DEVCB_##_devcb);
+
+#define MCFG_IQ151CART_SLOT_OUT_IRQ3_CB(_devcb) \
+ downcast<iq151cart_slot_device &>(*device).set_out_irq3_callback(DEVCB_##_devcb);
+
+#define MCFG_IQ151CART_SLOT_OUT_IRQ4_CB(_devcb) \
+ downcast<iq151cart_slot_device &>(*device).set_out_irq4_callback(DEVCB_##_devcb);
+
+#define MCFG_IQ151CART_SLOT_OUT_DRQ_CB(_devcb) \
+ downcast<iq151cart_slot_device &>(*device).set_out_drq_callback(DEVCB_##_devcb);
+
+#define MCFG_IQ151CART_SLOT_SCREEN_TAG(screen_tag) \
+ downcast<iq151cart_slot_device &>(*device).set_screen_tag(screen_tag);
+
#endif // MAME_BUS_IQ151_IQ151_H
diff --git a/src/devices/bus/isa/3c503.cpp b/src/devices/bus/isa/3c503.cpp
index 34202e2246d..424ce8bb082 100644
--- a/src/devices/bus/isa/3c503.cpp
+++ b/src/devices/bus/isa/3c503.cpp
@@ -5,13 +5,12 @@
#define SADDR 0xcc000
-void el2_3c503_device::device_add_mconfig(machine_config &config)
-{
- DP8390D(config, m_dp8390, 0);
- m_dp8390->irq_callback().set(FUNC(el2_3c503_device::el2_3c503_irq_w));
- m_dp8390->mem_read_callback().set(FUNC(el2_3c503_device::el2_3c503_mem_r));
- m_dp8390->mem_write_callback().set(FUNC(el2_3c503_device::el2_3c503_mem_w));
-}
+MACHINE_CONFIG_START(el2_3c503_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dp8390d", DP8390D, 0)
+ MCFG_DP8390D_IRQ_CB(WRITELINE(*this, el2_3c503_device, el2_3c503_irq_w))
+ MCFG_DP8390D_MEM_READ_CB(READ8(*this, el2_3c503_device, el2_3c503_mem_r))
+ MCFG_DP8390D_MEM_WRITE_CB(WRITE8(*this, el2_3c503_device, el2_3c503_mem_w))
+MACHINE_CONFIG_END
DEFINE_DEVICE_TYPE(EL2_3C503, el2_3c503_device, "el2_3c503", "3C503 Network Adapter")
diff --git a/src/devices/bus/isa/3c505.cpp b/src/devices/bus/isa/3c505.cpp
index 37cd5ef346a..71548dcbdaa 100644
--- a/src/devices/bus/isa/3c505.cpp
+++ b/src/devices/bus/isa/3c505.cpp
@@ -1644,9 +1644,7 @@ READ16_MEMBER(threecom3c505_device::read)
// omit excessive logging
if (data == last_data)
{
- // FIXME: space.device().state().pcbase() will crash mame with SIGSEGV (since mame0197)
- uint32_t pc = 0; // space.device().state().pcbase();
-
+ uint32_t pc = space.device().state().pcbase();
if (pc == last_pc)
{
return data;
diff --git a/src/devices/bus/isa/adlib.cpp b/src/devices/bus/isa/adlib.cpp
index 6a900b0e09d..814fdeaaf58 100644
--- a/src/devices/bus/isa/adlib.cpp
+++ b/src/devices/bus/isa/adlib.cpp
@@ -20,7 +20,7 @@ READ8_MEMBER( isa8_adlib_device::ym3812_16_r )
uint8_t retVal = 0xff;
switch(offset)
{
- case 0 : retVal = m_ym3812->status_port_r(); break;
+ case 0 : retVal = m_ym3812->status_port_r( space, offset ); break;
}
return retVal;
}
@@ -29,8 +29,8 @@ WRITE8_MEMBER( isa8_adlib_device::ym3812_16_w )
{
switch(offset)
{
- case 0 : m_ym3812->control_port_w(data); break;
- case 1 : m_ym3812->write_port_w(data); break;
+ case 0 : m_ym3812->control_port_w( space, offset, data ); break;
+ case 1 : m_ym3812->write_port_w( space, offset, data ); break;
}
}
@@ -44,11 +44,11 @@ DEFINE_DEVICE_TYPE(ISA8_ADLIB, isa8_adlib_device, "isa_adlib", "Ad Lib Sound Car
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa8_adlib_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(isa8_adlib_device::device_add_mconfig)
SPEAKER(config, "mono").front_center();
- YM3812(config, m_ym3812, ym3812_StdClock).add_route(ALL_OUTPUTS, "mono", 3.00);
-}
+ MCFG_DEVICE_ADD("ym3812", YM3812, ym3812_StdClock)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 3.00)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/bus/isa/aga.cpp b/src/devices/bus/isa/aga.cpp
index e1c26328c44..9aa2810431b 100644
--- a/src/devices/bus/isa/aga.cpp
+++ b/src/devices/bus/isa/aga.cpp
@@ -273,13 +273,12 @@ MC6845_UPDATE_ROW( isa8_aga_device::aga_update_row )
}
-void isa8_aga_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, AGA_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(14'318'181), 912, 0, 640, 262, 0, 200);
- screen.set_screen_update(AGA_MC6845_NAME, FUNC(mc6845_device::screen_update));
+MACHINE_CONFIG_START(isa8_aga_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( AGA_SCREEN_NAME, RASTER )
+ MCFG_SCREEN_RAW_PARAMS( XTAL(14'318'181),912,0,640,262,0,200 )
+ MCFG_SCREEN_UPDATE_DEVICE( AGA_MC6845_NAME, mc6845_device, screen_update )
- PALETTE(config, m_palette).set_entries(/* CGA_PALETTE_SETS * 16*/ 65536);
+ MCFG_PALETTE_ADD( "palette", /* CGA_PALETTE_SETS * 16*/ 65536 )
MC6845(config, m_mc6845, XTAL(14'318'181)/8);
m_mc6845->set_screen(AGA_SCREEN_NAME);
@@ -288,7 +287,7 @@ void isa8_aga_device::device_add_mconfig(machine_config &config)
m_mc6845->set_update_row_callback(FUNC(isa8_aga_device::aga_update_row), this);
m_mc6845->out_hsync_callback().set(FUNC(isa8_aga_device::hsync_changed));
m_mc6845->out_vsync_callback().set(FUNC(isa8_aga_device::vsync_changed));
-}
+MACHINE_CONFIG_END
/*************************************
@@ -690,7 +689,7 @@ READ8_MEMBER ( isa8_aga_device::pc_aga_mda_r )
/* return last written mc6845 address value here? */
break;
case 1: case 3: case 5: case 7:
- data = m_mc6845->register_r();
+ data = m_mc6845->register_r(space, offset);
break;
case 10:
data = m_vsync | 0x08 | m_hsync;
@@ -707,10 +706,10 @@ WRITE8_MEMBER ( isa8_aga_device::pc_aga_mda_w )
switch( offset )
{
case 0: case 2: case 4: case 6:
- m_mc6845->address_w(data);
+ m_mc6845->address_w( space, offset, data );
break;
case 1: case 3: case 5: case 7:
- m_mc6845->register_w(data);
+ m_mc6845->register_w( space, offset, data );
break;
case 8:
m_mda_mode_control = data;
@@ -741,7 +740,7 @@ READ8_MEMBER ( isa8_aga_device::pc_aga_cga_r )
/* return last written mc6845 address value here? */
break;
case 1: case 3: case 5: case 7:
- data = m_mc6845->register_r();
+ data = m_mc6845->register_r( space, offset);
break;
case 10:
data = m_vsync | ( ( data & 0x40 ) >> 4 ) | m_hsync;
@@ -792,10 +791,10 @@ WRITE8_MEMBER (isa8_aga_device:: pc_aga_cga_w )
if ( m_mode == AGA_COLOR ) {
switch(offset) {
case 0: case 2: case 4: case 6:
- m_mc6845->address_w(data);
+ m_mc6845->address_w( space, offset, data );
break;
case 1: case 3: case 5: case 7:
- m_mc6845->register_w(data);
+ m_mc6845->register_w( space, offset, data );
break;
case 8:
m_cga_mode_control = data;
diff --git a/src/devices/bus/isa/aha1542.cpp b/src/devices/bus/isa/aha1542.cpp
new file mode 100644
index 00000000000..8e260347eee
--- /dev/null
+++ b/src/devices/bus/isa/aha1542.cpp
@@ -0,0 +1,200 @@
+// license:BSD-3-Clause
+// copyright-holders:Darkstar
+/**********************************************************************
+ *
+ * Adaptec AHA-1542{,C,CF} SCSI Controller
+ *
+ **********************************************************************/
+
+/*
+ PCB layout
+ ----------
+ Floppy SCSI
+ +-----------+ +------------------+ +-
+ +-----+-----------+-+------------------+--+
+ | |
+ | DIPSW DS1 |\
+ | +-----+ | |
+ | | | Y1 +---+ TRM TRM | |
+ | | U3 | |U5 | |S|
+ | U8 +-----+ +---+ |C|
+ | +---+ +------+ +-------+ |S|
+ | |U13| |U15 | Y2 | | |I|
+ | +---+ +------+ | | | |
+ | |U16 | |U17 | | |
+ | +------+ +-------+ |/
+ +-----------------------------------------+
+ ||||||||| ||||||||||||||||||||||||| |
+
+
+ DIPSW sw1 - sw8
+ U3 Intel chip labelled "AHA-1542CF/552800-01 D/9346", probably FDC (82077)
+ U5 Z84C0010VEC
+ U8 EEPROM(?) labelled 545120A
+ U13 CXK5864CM-10LL (64kbit SRAM)
+ U15 M27C256B labelled "ADAPTEC INC/553801-00 C/MCODE 563D/(C) 1993"
+ U16 M27C256B labelled "ADAPTEC INC/553601-00 C/BIOS C38D/(C) 1993"
+ U17 AIC-7970Q
+ Y1 XTAL SRX4054 93-38
+ Y2 XTAL SRX4053 93-40
+ TRM Dallas DS2107AS (SCSI termination)
+ DS1 LED
+
+*/
+
+/*
+ * The PCB has a couple of DIP switches:
+ *
+ * sw1 on enable termination
+ * off software-controlled termination
+ *
+ * sw2 sw3 sw4 I/O Port
+ * off off off 0x330 - 0x333 (default)
+ * on off off 0x334 - 0x337
+ * off on off 0x230 - 0x233
+ * on on off 0x234 - 0x237
+ * off off on 0x130 - 0x133
+ * on off on 0x134 - 0x137
+ * off on on reserved
+ * on on on reserved
+ *
+ * sw5 on disable floppy interface
+ * off enable floppy interface
+ *
+ * sw6 sw7 sw8 BIOS base address
+ * off off off 0xdc000 (default)
+ * on off off 0xd8000
+ * off on off 0xd4000
+ * on on off 0xd0000
+ * off off on 0xcc000
+ * on off on 0xc8000
+ * off on on reserved
+ * on on on BIOS disabled
+ *
+ * source: http://download.adaptec.com/pdfs/installation_guides/1540cfig.pdf
+ */
+
+#include "emu.h"
+#include "aha1542.h"
+#include "cpu/z80/z80.h"
+
+// I/O Port interface
+// READ Port x+0: STATUS
+// WRITE Port x+0: CONTROL
+//
+// READ Port x+1: DATA
+// WRITE Port x+1: COMMAND
+//
+// READ Port x+2: INTERRUPT STATUS
+// WRITE Port x+2: (undefined?)
+//
+// R/W Port x+3: (undefined)
+
+// READ STATUS flags
+#define STAT_STST 0x80 // self-test in progress
+#define STAT_DIAGF 0x40 // internal diagnostic failure
+#define STAT_INIT 0x20 // mailbox initialization required
+#define STAT_IDLE 0x10 // HBA is idle
+#define STAT_CDFULL 0x08 // Command/Data output port is full
+#define STAT_DFULL 0x04 // Data input port is full
+#define STAT_INVCMD 0x01 // Invalid command
+
+// READ INTERRUPT STATUS flags
+#define INTR_ANY 0x80 // any interrupt
+#define INTR_SRCD 0x08 // SCSI reset detected
+#define INTR_HACC 0x04 // HA command complete
+#define INTR_MBOA 0x02 // MBO empty
+#define INTR_MBIF 0x01 // MBI full
+
+// WRITE CONTROL commands
+#define CTRL_HRST 0x80 // Hard reset
+#define CTRL_SRST 0x40 // Soft reset
+#define CTRL_IRST 0x20 // interrupt reset
+#define CTRL_SCRST 0x10 // SCSI bus reset
+
+// READ/WRITE DATA commands
+#define CMD_NOP 0x00 // No operation
+#define CMD_MBINIT 0x01 // mailbox initialization
+#define CMD_START_SCSI 0x02 // Start SCSI command
+#define CMD_BIOSCMD 0x03 // undocumented BIOS conmmand (shadow RAM etc.)
+#define CMD_INQUIRY 0x04 // Adapter inquiry
+#define CMD_EMBOI 0x05 // enable Mailbox Out Interrupt
+#define CMD_SELTIMEOUT 0x06 // Set SEL timeout
+#define CMD_BUSON_TIME 0x07 // set bus-On time
+#define CMD_BUSOFF_TIME 0x08 // set bus-off time
+#define CMD_DMASPEED 0x09 // set ISA DMA speed
+#define CMD_RETDEVS 0x0a // return installed devices
+#define CMD_RETCONF 0x0b // return configuration data
+#define CMD_TARGET 0x0c // set HBA to target mode
+#define CMD_RETSETUP 0x0d // return setup data
+#define CMD_ECHO 0x1f // ECHO command data (NetBSD says it is 0x1e)
+
+// these are for 1541C only:
+#define CMD_RETDEVSHI 0x23 // return devices 8-15 (from NetBSD)
+#define CMD_EXTBIOS 0x28 // return extended BIOS information
+#define CMD_MBENABLE 0x29 // set mailbox interface enable
+
+DEFINE_DEVICE_TYPE(AHA1542, aha1542_device, "aha1542", "AHA1542 SCSI Controller")
+
+#define Z84C0010_TAG "u5"
+
+READ8_MEMBER( aha1542_device::aha1542_r )
+{
+ logerror("%s aha1542_r(): offset=%d\n", machine().describe_context(), offset);
+ return 0xff;
+}
+
+WRITE8_MEMBER( aha1542_device::aha1542_w )
+{
+ logerror("%s aha1542_w(): offset=%d data=0x%02x\n", machine().describe_context(), offset, data);
+}
+
+//-------------------------------------------------
+// ROM( aha1542 )
+//-------------------------------------------------
+
+ROM_START( aha1542 )
+ ROM_REGION( 0x8000, "aha1542", 0 )
+ ROM_LOAD( "553601-00.u16", 0x0000, 0x8000, CRC(ab22fc02) SHA1(f9f783e0272fc14ba3de32316997f1f6cadc67d0) ) /* Adaptec 1540CF/1542CF BIOS v2.01 */
+
+ ROM_REGION( 0x8000, Z84C0010_TAG, 0 )
+ ROM_LOAD( "553801-00.u15", 0x0000, 0x8000, CRC(7824397e) SHA1(35bc2c8fab31aad3190a478f2dc8f3a72958cf04) ) /* ADAPTEC, INC MCODE */
+ROM_END
+
+void aha1542_device::z84c0010_mem(address_map &map)
+{
+ map(0x0000, 0x7fff).rom().region(Z84C0010_TAG, 0);
+ map(0x8000, 0x800f).noprw(); // something is mapped there
+ map(0x9000, 0xafff).ram(); // 2kb RAM chip
+ map(0xe000, 0xe0ff).ram(); // probably PC<->Z80 communication area
+ map(0xb000, 0xb000).noprw(); // something?
+}
+
+const tiny_rom_entry *aha1542_device::device_rom_region() const
+{
+ return ROM_NAME( aha1542 );
+}
+
+MACHINE_CONFIG_START(aha1542_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(Z84C0010_TAG, Z80, XTAL(12'000'000))
+ MCFG_DEVICE_PROGRAM_MAP( z84c0010_mem )
+MACHINE_CONFIG_END
+
+aha1542_device::aha1542_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, AHA1542, tag, owner, clock),
+ device_isa16_card_interface(mconfig, *this)
+{
+}
+
+void aha1542_device::device_start()
+{
+ set_isa_device();
+ m_isa->install_rom(this, 0xdc000, 0xdffff, "aha1542", "aha1542");
+ m_isa->install_device(0x330, 0x333, read8_delegate(FUNC( aha1542_device::aha1542_r ), this),
+ write8_delegate(FUNC( aha1542_device::aha1542_w ), this) );
+}
+
+
+void aha1542_device::device_reset()
+{
+}
diff --git a/src/devices/bus/isa/aha1542.h b/src/devices/bus/isa/aha1542.h
new file mode 100644
index 00000000000..cc84c2ea55b
--- /dev/null
+++ b/src/devices/bus/isa/aha1542.h
@@ -0,0 +1,54 @@
+// license:BSD-3-Clause
+// copyright-holders:Darkstar
+/**********************************************************************
+ *
+ * Adaptec AHA-1542{,C,CF} SCSI Controller
+ *
+ **********************************************************************
+
+
+
+ **********************************************************************/
+
+#ifndef MAME_BUS_AHA1542_H
+#define MAME_BUS_AHA1542_H
+
+#pragma once
+
+
+#include "isa.h"
+
+//*********************************************************************
+// TYPE DEFINITIONS
+//*********************************************************************
+
+// ====================> aha1542_device
+
+class aha1542_device : public device_t,
+ public device_isa16_card_interface
+{
+public:
+ static constexpr feature_type unemulated_features() { return feature::DISK; }
+ // construction/destruction
+ aha1542_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ DECLARE_READ8_MEMBER( aha1542_r );
+ DECLARE_WRITE8_MEMBER( aha1542_w );
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ // optional information overrides
+ virtual const tiny_rom_entry *device_rom_region() const override;
+ virtual void device_add_mconfig(machine_config &config) override;
+
+private:
+ void z84c0010_mem(address_map &map);
+};
+
+// device type definition
+DECLARE_DEVICE_TYPE(AHA1542, aha1542_device)
+
+#endif // MAME_BUS_AHA1542_H
diff --git a/src/devices/bus/isa/aha1542b.cpp b/src/devices/bus/isa/aha1542b.cpp
deleted file mode 100644
index e0073cbbd68..00000000000
--- a/src/devices/bus/isa/aha1542b.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- Adaptec AHA-1540/42A and AHA-1540/42B SCSI controllers
-
- The alternate BIOSes using port 334h instead of 330h are provided due
- to certain MIDI cards requiring the 330h port.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "aha1542b.h"
-
-#include "cpu/i8085/i8085.h"
-#include "machine/aic6250.h"
-#include "machine/nscsi_bus.h"
-#include "machine/nscsi_hd.h"
-
-
-DEFINE_DEVICE_TYPE(AHA1542A, aha1542a_device, "aha1542a", "AHA-1542A SCSI Controller")
-DEFINE_DEVICE_TYPE(AHA1542B, aha1542b_device, "aha1542b", "AHA-1542B SCSI Controller")
-
-
-aha154x_device::aha154x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, type, tag, owner, clock)
- , device_isa16_card_interface(mconfig, *this)
- , m_fdc(*this, "fdc")
- , m_bios(*this, "bios")
-{
-}
-
-aha1542a_device::aha1542a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : aha154x_device(mconfig, AHA1542A, tag, owner, clock)
-{
-}
-
-aha1542b_device::aha1542b_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : aha154x_device(mconfig, AHA1542B, tag, owner, clock)
-{
-}
-
-void aha154x_device::device_start()
-{
-}
-
-void aha154x_device::i8085_map(address_map &map)
-{
- map(0x0000, 0x3fff).rom().region("mcode", 0);
- map(0x8000, 0x800f).m("scsi:7:scsic", FUNC(aic6250_device::map));
- map(0xe000, 0xe7ff).ram();
-}
-
-static void aha154x_scsi_devices(device_slot_interface &device)
-{
- device.option_add("harddisk", NSCSI_HARDDISK);
- device.option_add_internal("scsic", AIC6250);
-}
-
-void aha154x_device::scsic_config(device_t *device)
-{
- device->set_clock(20'000'000);
- downcast<aic6250_device &>(*device).int_cb().set_inputline("^^localcpu", I8085_RST65_LINE);
-}
-
-void aha154x_device::device_add_mconfig(machine_config &config)
-{
- i8085a_cpu_device &localcpu(I8085A(config, "localcpu", 10'000'000));
- localcpu.set_addrmap(AS_PROGRAM, &aha154x_device::i8085_map);
-
- NSCSI_BUS(config, "scsi");
- NSCSI_CONNECTOR(config, "scsi:0", aha154x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:1", aha154x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:2", aha154x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:3", aha154x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:4", aha154x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:5", aha154x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:6", aha154x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:7", aha154x_scsi_devices, "scsic", true)
- .set_option_machine_config("scsic", [this] (device_t *device) { scsic_config(device); });
-
- DP8473(config, m_fdc, 24_MHz_XTAL);
-}
-
-
-ROM_START(aha1542a)
- ROM_REGION(0x4000, "bios", 0)
- ROM_LOAD("b_9700.bin", 0x0000, 0x4000, CRC(35f546e9) SHA1(f559b08f52044f53836021a83f56f628e32216bd))
-
- ROM_REGION(0x4000, "mcode", 0)
- ROM_LOAD("m_e7bc.bin", 0x0000, 0x4000, CRC(985b7a31) SHA1(bba0d84fa1b67ea71905953c25201fa2020cf465))
-ROM_END
-
-ROM_START(aha1542b)
- ROM_REGION(0x4000, "bios", 0)
- ROM_SYSTEM_BIOS(0, "v310", "AT/SCSI BIOS Version 3.10")
- ROMX_LOAD("adaptec_inc_420412-00_b_bios_bc00_1990.bin", 0x0000, 0x4000, CRC(bd3f74e7) SHA1(c38d82fd50e5439812fa093e0d4f5fd136c63844), ROM_BIOS(0))
- ROM_SYSTEM_BIOS(1, "v310a", "AT/SCSI BIOS Version 3.10A (port 334h)")
- ROMX_LOAD("154xp334.bin", 0x0000, 0x4000, CRC(4911f232) SHA1(2e24ce380c6f7694c45484019857cb919e2a9965), ROM_BIOS(1))
- ROM_SYSTEM_BIOS(2, "v311", "AT/SCSI BIOS Version 3.11")
- ROMX_LOAD("bios_c900.u13", 0x0000, 0x4000, CRC(4660d0c1) SHA1(a581291de96836b6f6cc0b6244b8fa1ee333346a), ROM_BIOS(2))
- ROM_SYSTEM_BIOS(3, "v320g", "AT/SCSI BIOS Version 3.20 (> 1 GB support)")
- ROMX_LOAD("b_bd00.bin", 0x0000, 0x4000, CRC(2387197b) SHA1(703e1fe1ba924c02d617ac37ec7a20e12bef1cc7), ROM_BIOS(3))
- ROM_SYSTEM_BIOS(4, "v320gt", "AT/SCSI BIOS Version 3.20 (extended timeout)")
- ROMX_LOAD("b_b300.bin", 0x0000, 0x4000, CRC(4c5b07d8) SHA1(692e824f916f55519c9905839f5f6609f5e8c0a5), ROM_BIOS(4))
- ROM_SYSTEM_BIOS(5, "v320a", "AT/SCSI BIOS Version 3.20Alt (port 334h)")
- ROMX_LOAD("b_ac00.bin", 0x0000, 0x4000, CRC(becd6d08) SHA1(b5e7cbdeb241c1ff57602291e87c58ac0ee72d54), ROM_BIOS(5))
-
- ROM_REGION(0x4000, "mcode", 0)
- ROMX_LOAD("adaptec_inc_434108-00_a_mcode_fc8a_1990.bin", 0x0000, 0x4000, CRC(6801f89e) SHA1(33d36bc93734105b950414e7c433a283032838e9), ROM_BIOS(0))
- ROMX_LOAD("adaptec_inc_434108-00_a_mcode_fc8a_1990.bin", 0x0000, 0x4000, CRC(6801f89e) SHA1(33d36bc93734105b950414e7c433a283032838e9), ROM_BIOS(1)) // assumed compatible with v310a BIOS
- ROMX_LOAD("firmware_62d3.u12", 0x0000, 0x4000, CRC(6056ca33) SHA1(8dd4aaffcb107dbcc85ac87d878fa6093b904a20), ROM_BIOS(2))
- ROMX_LOAD("m_3054.bin", 0x0000, 0x4000, CRC(461b1885) SHA1(50dc49b0fd88b116b83e3c71f58c758b618d1ddf), ROM_BIOS(3))
- ROMX_LOAD("m_5d98.bin", 0x0000, 0x4000, CRC(f7d51536) SHA1(5ad1bb4bde3e8c30380b05d32ac273c781ab12a8), ROM_BIOS(4)) // also provided with v320g BIOS
- ROMX_LOAD("m_3054.bin", 0x0000, 0x4000, CRC(461b1885) SHA1(50dc49b0fd88b116b83e3c71f58c758b618d1ddf), ROM_BIOS(5))
-ROM_END
-
-const tiny_rom_entry *aha1542a_device::device_rom_region() const
-{
- return ROM_NAME(aha1542a);
-}
-
-const tiny_rom_entry *aha1542b_device::device_rom_region() const
-{
- return ROM_NAME(aha1542b);
-}
diff --git a/src/devices/bus/isa/aha1542b.h b/src/devices/bus/isa/aha1542b.h
deleted file mode 100644
index 95e379cb137..00000000000
--- a/src/devices/bus/isa/aha1542b.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- Adaptec AHA-1540/42A and AHA-1540/42B SCSI controllers
-
-***************************************************************************/
-
-#ifndef MAME_BUS_ISA_AHA1542B_H
-#define MAME_BUS_ISA_AHA1542B_H
-
-#pragma once
-
-#include "isa.h"
-#include "machine/upd765.h"
-
-class aha154x_device : public device_t, public device_isa16_card_interface
-{
-protected:
- aha154x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
-
- virtual void device_start() override;
- virtual void device_add_mconfig(machine_config &config) override;
-
- void i8085_map(address_map &map);
- void scsic_config(device_t *device);
-
- required_device<upd765_family_device> m_fdc;
- required_region_ptr<u8> m_bios;
-};
-
-class aha1542a_device : public aha154x_device
-{
-public:
- aha1542a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
- static constexpr feature_type unemulated_features() { return feature::DISK; }
-
-protected:
- virtual const tiny_rom_entry *device_rom_region() const override;
-};
-
-class aha1542b_device : public aha154x_device
-{
-public:
- aha1542b_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
- static constexpr feature_type unemulated_features() { return feature::DISK; }
-
-protected:
- virtual const tiny_rom_entry *device_rom_region() const override;
-};
-
-DECLARE_DEVICE_TYPE(AHA1542A, aha1542a_device)
-DECLARE_DEVICE_TYPE(AHA1542B, aha1542b_device)
-
-#endif // MAME_BUS_ISA_AHA1542B_H
diff --git a/src/devices/bus/isa/aha1542c.cpp b/src/devices/bus/isa/aha1542c.cpp
deleted file mode 100644
index efb8181061c..00000000000
--- a/src/devices/bus/isa/aha1542c.cpp
+++ /dev/null
@@ -1,323 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Darkstar
-/**********************************************************************
- *
- * Adaptec AHA-1542{C,CF,CP} SCSI Controller
- *
- **********************************************************************/
-
-/*
-Hardware info by Guru
-
-Adaptec 1993
-
-PCB Layout
-----------
-
-Adaptec AHA-1542CF/1542CF
-FCC ID: FGT1542CF
-FAB 545107-00 REV C
-ASSY 545106-00
-
-|-------|---------------|---|-------------------|--|
-| J1 | FLOPPY34 | | SCSI50 | |
-| |---------------| |-------------------| |
-| S1 DS1 |
-| |
-| |------| DS2107AS DS2107AS |--|
-| |PC8477| 24MHz Z84C0010 | |
-| PAL |BV-1 | |S |
-| | | |----------| | |
-| |------| | | |C |
-| 93C46.U11 20MHz | | | |
-| UM6264 MCODE.U15 |ADAPTEC | |S |
-| |AIC-7970Q | | |
-| BIOS.U16 | | |I |
-| | | | |
-| |----------| |--|
-| |
-|-| |--| |----|
- |--------------| |-------------------------|
-
-Notes:
- J1 - 4-position header for drive activity external LED connection
- S1 - 8-position DIP Switch (See Table A)
- PC8477BV-1 - National Semiconductor PC8477BV-1 'SuperFDC' Advanced Floppy Disk Controller (PLCC68)
- This is software compatible with NEC uPD765 and pin compatible with Intel 82077AA
- Labelled "AHA-1542CF/552800-01 F/9513"
- Clock input 24.000MHz
- SCSI - 50-pin Centronics style external SCSI connector (DDK 57AE-40500-21D)
- Z84C0010 - Zilog Z84C0010VEC Z80 CPU. Clock input 20/2 [10.000MHz] sourced from AIC-7970Q (PLCC44)
- 93C46.U11 - Atmel 93C46 128b x8-bit / 64b x16-bit (1kB) EEPROM labelled '545120A' (SOIC8)
- 6264 - Unicorn Microelectronics UM6264BM-10L 8k x8-bit Static RAM (SOJ28)
- MCODE.U15 - ST Microelectronics M27C256B 32k x8-bit EPROM labelled 'ADAPTEC INC 553801-00 E MCODE 4B81' (DIP28)
- BIOS.U16 - ST Microelectronics M27C256B 32k x8-bit EPROM labelled 'ADAPTEC INC 553601-00 E BIOS 7600' (DIP28)
- BIOS 0x7600h is revision 2.10
- PAL - AMD PALCE16V8H-15JC/4 PAL (SOJ20)
- AIC-7970Q - Adaptec AIC-7970Q Fast SCSI Controller IC. Clock input 20.000MHz (QFP144)
- DS2107AS - Dallas DS2107AS SCSI Active Terminator (SOIC16)
- DS1 - Internal Drive Activity LED
- SCSI50 - 50-pin Right Angled Flat Cable Connector With Support For Up To 7 SCSI Drives
- FLOPPY34 - 34-pin Right Angled Flat Cable Connector With Support For Up To 2 Floppy Drives (360kb,720kb,1.2MB,1.44MB)
-
-
-Table A - S1 DIP Switch Description
------------------------------------
-
-Default: All DIP Switches OFF (i.e. Settings changed via BIOS and saved in EEPROM)
-Software Defaults = *
-----------------------+-----+-----+-----+-----+-----+-----+-----+-----+
- | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | SW7 | SW8 |
-----------------------|-----+-----+-----+-----+-----+-----+-----+-----+
-Termination Enabled | ON | | | | | | | |
- Set In BIOS*| OFF | | | | | | | |
-----------------------+-----+-----+-----+-----+ | | | |
-I/O Port 330H*| | OFF | OFF | OFF | | | | |
- 334H | | ON | OFF | OFF | | | | |
- 230H | | OFF | ON | OFF | | | | |
- 234H | | ON | ON | OFF | | | | |
- 130H | | OFF | OFF | ON | | | | |
- 134H | | ON | OFF | ON | | | | |
- Reserved | | OFF | ON | ON | | | | |
- Reserved | | ON | ON | ON | | | | |
-----------------------+-----+-----+-----+-----+-----+ | | |
-Enable Floppy Yes*| | OFF | | | |
- No | | ON | | | |
-----------------------+-----------------------+-----+-----+-----+-----+
-BIOS Address DC000H*| | OFF | OFF | OFF |
- D8000H | | ON | OFF | OFF |
- D4000H | | OFF | ON | OFF |
- D0000H | | ON | ON | OFF |
- CC000H | | OFF | OFF | ON |
- C8000H | | ON | OFF | ON |
- Reserved | | OFF | ON | ON |
- BIOS Disabled | | ON | ON | ON |
-----------------------+-----------------------------+-----+-----+-----+
-
-Documentation:
-Adaptec AHA-1540CF/1542CF Installation Guide
-http://download.adaptec.com/pdfs/installation_guides/aha1540cf_ig.pdf
- */
-
-#include "emu.h"
-#include "aha1542c.h"
-#include "cpu/z80/z80.h"
-
-// I/O Port interface
-// READ Port x+0: STATUS
-// WRITE Port x+0: CONTROL
-//
-// READ Port x+1: DATA
-// WRITE Port x+1: COMMAND
-//
-// READ Port x+2: INTERRUPT STATUS
-// WRITE Port x+2: (undefined?)
-//
-// R/W Port x+3: (undefined)
-
-// READ STATUS flags
-#define STAT_STST 0x80 // self-test in progress
-#define STAT_DIAGF 0x40 // internal diagnostic failure
-#define STAT_INIT 0x20 // mailbox initialization required
-#define STAT_IDLE 0x10 // HBA is idle
-#define STAT_CDFULL 0x08 // Command/Data output port is full
-#define STAT_DFULL 0x04 // Data input port is full
-#define STAT_INVCMD 0x01 // Invalid command
-
-// READ INTERRUPT STATUS flags
-#define INTR_ANY 0x80 // any interrupt
-#define INTR_SRCD 0x08 // SCSI reset detected
-#define INTR_HACC 0x04 // HA command complete
-#define INTR_MBOA 0x02 // MBO empty
-#define INTR_MBIF 0x01 // MBI full
-
-// WRITE CONTROL commands
-#define CTRL_HRST 0x80 // Hard reset
-#define CTRL_SRST 0x40 // Soft reset
-#define CTRL_IRST 0x20 // interrupt reset
-#define CTRL_SCRST 0x10 // SCSI bus reset
-
-// READ/WRITE DATA commands
-#define CMD_NOP 0x00 // No operation
-#define CMD_MBINIT 0x01 // mailbox initialization
-#define CMD_START_SCSI 0x02 // Start SCSI command
-#define CMD_BIOSCMD 0x03 // undocumented BIOS conmmand (shadow RAM etc.)
-#define CMD_INQUIRY 0x04 // Adapter inquiry
-#define CMD_EMBOI 0x05 // enable Mailbox Out Interrupt
-#define CMD_SELTIMEOUT 0x06 // Set SEL timeout
-#define CMD_BUSON_TIME 0x07 // set bus-On time
-#define CMD_BUSOFF_TIME 0x08 // set bus-off time
-#define CMD_DMASPEED 0x09 // set ISA DMA speed
-#define CMD_RETDEVS 0x0a // return installed devices
-#define CMD_RETCONF 0x0b // return configuration data
-#define CMD_TARGET 0x0c // set HBA to target mode
-#define CMD_RETSETUP 0x0d // return setup data
-#define CMD_ECHO 0x1f // ECHO command data (NetBSD says it is 0x1e)
-
-// these are for 1541C only:
-#define CMD_RETDEVSHI 0x23 // return devices 8-15 (from NetBSD)
-#define CMD_EXTBIOS 0x28 // return extended BIOS information
-#define CMD_MBENABLE 0x29 // set mailbox interface enable
-
-DEFINE_DEVICE_TYPE(AHA1542C, aha1542c_device, "aha1542c", "AHA-1542C SCSI Controller")
-DEFINE_DEVICE_TYPE(AHA1542CF, aha1542cf_device, "aha1542cf", "AHA-1542CF SCSI Controller")
-DEFINE_DEVICE_TYPE(AHA1542CP, aha1542cp_device, "aha1542cp", "AHA-1542CP SCSI Controller")
-
-#define Z84C0010_TAG "z84c0010"
-
-READ8_MEMBER( aha1542c_device::aha1542_r )
-{
- logerror("%s aha1542_r(): offset=%d\n", machine().describe_context(), offset);
- return 0xff;
-}
-
-WRITE8_MEMBER( aha1542c_device::aha1542_w )
-{
- logerror("%s aha1542_w(): offset=%d data=0x%02x\n", machine().describe_context(), offset, data);
-}
-
-
-ROM_START( aha1542c )
- ROM_REGION( 0x8000, "aha1542", 0 )
- ROM_SYSTEM_BIOS( 0, "v101", "AHA-1540C/1542C BIOS v1.01" )
- ROMX_LOAD( "adaptec_inc_534201-00_d_bios_144c_1993.u15", 0x0000, 0x8000, CRC(35178004) SHA1(2b38f2e40cd02a1b32966ead7b202b0fca130cb8), ROM_BIOS(0) )
- ROM_SYSTEM_BIOS( 1, "v102", "AHA-1540C/1542C BIOS v1.02" )
- ROMX_LOAD( "b_91c5.bin", 0x0000, 0x8000, CRC(076ac252) SHA1(d640b980e85d07029d8ce11a52fa26ba0f93c5de), ROM_BIOS(1) )
-
- ROM_REGION( 0x8000, Z84C0010_TAG, 0 )
- ROMX_LOAD( "adaptec_inc_534001-00_d_mcode_a3c2_1993.u5", 0x0000, 0x8000, CRC(220dd5a2) SHA1(4fc51c9dd63b45a50edcd56baa706d61decbef38), ROM_BIOS(0) )
- ROMX_LOAD( "m_866a.bin", 0x0000, 0x8000, CRC(ef09053a) SHA1(ae7900653357d5f32a2734bc13d9ec63bd805597), ROM_BIOS(1) )
-ROM_END
-
-ROM_START( aha1542cf )
- ROM_REGION( 0x8000, "aha1542", 0 )
- ROM_SYSTEM_BIOS( 0, "v201", "Adaptec 1540CF/1542CF BIOS v2.01" )
- ROMX_LOAD( "adaptec_inc_553601-00_c_bios_c38d_1993.u16", 0x0000, 0x8000, CRC(ab22fc02) SHA1(f9f783e0272fc14ba3de32316997f1f6cadc67d0), ROM_BIOS(0) )
- ROM_SYSTEM_BIOS( 1, "v210", "Adaptec 1540CF/1542CF BIOS v2.10" )
- ROMX_LOAD( "adaptec_inc_553601-00_e_bios_7600_1994.u16", 0x0000, 0x8000, CRC(8f3a2692) SHA1(b9dbd49baeec55098195131d0ed1a9bfe8463640), ROM_BIOS(1) )
- ROM_SYSTEM_BIOS( 2, "v211", "Adaptec 1540CF/1542CF BIOS v2.11" )
- ROMX_LOAD( "adaptec_inc_553601-00_g_bios_b402_1995.u16", 0x0000, 0x8000, CRC(fddd0b83) SHA1(aabd227cb338d8812e0bb5c17c08ea06c5aedd36), ROM_BIOS(2) )
-
- ROM_REGION( 0x8000, Z84C0010_TAG, 0 )
- ROMX_LOAD( "adaptec_inc_553801-00_c_mcode_563d_1993.u15", 0x0000, 0x8000, CRC(7824397e) SHA1(35bc2c8fab31aad3190a478f2dc8f3a72958cf04), ROM_BIOS(0) )
- ROMX_LOAD( "adaptec_inc_553801-00_e_mcode_4b81_1994.u15", 0x0000, 0x8000, CRC(dd651476) SHA1(cda508281302be53ebdcf8daa61754c89ad12111), ROM_BIOS(1) )
- ROMX_LOAD( "adaptec_inc_553801-00_g_mcode_2cde_1995.u15", 0x0000, 0x8000, CRC(896873cd) SHA1(6edbdd9b0b15ef31ca0741cac31556d2d5266b6e), ROM_BIOS(2) )
-ROM_END
-
-ROM_START( aha1542cp )
- ROM_REGION( 0x8000, "aha1542", 0 )
- ROM_LOAD( "adaptec_inc_908501-00_d_bios_a91e_1995.u7", 0x0000, 0x8000, CRC(0646c35e) SHA1(3a7c2731abd8295438cfa1f2a525be53e9512b1a) )
-
- ROM_REGION( 0x8000, Z84C0010_TAG, 0 )
- ROM_LOAD( "908301-00_f_mcode_17c9.u12", 0x0000, 0x8000, CRC(04494022) SHA1(431dfc26312556ddd24fccc429b2b3e93bac5c2f) )
-ROM_END
-
-
-u8 aha1542c_device::local_status_r()
-{
- return m_eeprom->do_read() << 7;
-}
-
-void aha1542c_device::local_latch_w(u8 data)
-{
- m_eeprom->cs_write(BIT(data, 2));
- m_eeprom->clk_write(BIT(data, 1));
- m_eeprom->di_write(BIT(data, 0));
- // TODO: several other bits are used
-}
-
-void aha1542c_device::z84c0010_mem(address_map &map)
-{
- map(0x0000, 0x7fff).rom().region(Z84C0010_TAG, 0);
- map(0x8000, 0x9fff).ram(); // 2kb RAM chip
- map(0xa000, 0xa000).r(FUNC(aha1542c_device::local_status_r));
- map(0xb000, 0xb000).w(FUNC(aha1542c_device::local_latch_w));
- map(0xe000, 0xe0ff).ram(); // probably PC<->Z80 communication area
- map(0xe003, 0xe003).lr8("e003_r", []() { return 0x20; });
-}
-
-u8 aha1542cp_device::eeprom_r()
-{
- return m_eeprom->do_read();
-}
-
-void aha1542cp_device::eeprom_w(u8 data)
-{
- m_eeprom->cs_write(BIT(data, 2));
- m_eeprom->clk_write(BIT(data, 1));
- m_eeprom->di_write(BIT(data, 0));
-}
-
-void aha1542cp_device::local_mem(address_map &map)
-{
- map(0x0000, 0x7fff).rom().region(Z84C0010_TAG, 0);
- map(0x8000, 0x9fff).ram();
- map(0xc001, 0xc001).rw(FUNC(aha1542cp_device::eeprom_r), FUNC(aha1542cp_device::eeprom_w));
- map(0xe003, 0xe003).nopr();
-}
-
-const tiny_rom_entry *aha1542c_device::device_rom_region() const
-{
- return ROM_NAME( aha1542c );
-}
-
-const tiny_rom_entry *aha1542cf_device::device_rom_region() const
-{
- return ROM_NAME( aha1542cf );
-}
-
-const tiny_rom_entry *aha1542cp_device::device_rom_region() const
-{
- return ROM_NAME( aha1542cp );
-}
-
-void aha1542c_device::device_add_mconfig(machine_config &config)
-{
- z80_device &cpu(Z80(config, Z84C0010_TAG, 10'000'000));
- cpu.set_addrmap(AS_PROGRAM, &aha1542c_device::z84c0010_mem);
-
- EEPROM_93C46_16BIT(config, m_eeprom);
-}
-
-void aha1542cp_device::device_add_mconfig(machine_config &config)
-{
- z80_device &cpu(Z80(config, Z84C0010_TAG, 10'000'000));
- cpu.set_addrmap(AS_PROGRAM, &aha1542cp_device::local_mem);
-
- EEPROM_93C46_16BIT(config, m_eeprom);
-}
-
-aha1542c_device::aha1542c_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, type, tag, owner, clock)
- , device_isa16_card_interface(mconfig, *this)
- , m_eeprom(*this, "eeprom")
-{
-}
-
-aha1542c_device::aha1542c_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : aha1542c_device(mconfig, AHA1542C, tag, owner, clock)
-{
-}
-
-aha1542cf_device::aha1542cf_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : aha1542c_device(mconfig, AHA1542CF, tag, owner, clock)
-{
-}
-
-aha1542cp_device::aha1542cp_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : aha1542c_device(mconfig, AHA1542CP, tag, owner, clock)
-{
-}
-
-void aha1542c_device::device_start()
-{
- set_isa_device();
- m_isa->install_rom(this, 0xdc000, 0xdffff, "aha1542", "aha1542");
- m_isa->install_device(0x330, 0x333, read8_delegate(FUNC( aha1542cf_device::aha1542_r ), this),
- write8_delegate(FUNC( aha1542cf_device::aha1542_w ), this) );
-}
-
-
-void aha1542c_device::device_reset()
-{
-}
diff --git a/src/devices/bus/isa/aha1542c.h b/src/devices/bus/isa/aha1542c.h
deleted file mode 100644
index 2294096bde7..00000000000
--- a/src/devices/bus/isa/aha1542c.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Darkstar
-/**********************************************************************
- *
- * Adaptec AHA-1542{C,CF,CP} SCSI Controller
- *
- **********************************************************************
-
-
-
- **********************************************************************/
-
-#ifndef MAME_BUS_AHA1542C_H
-#define MAME_BUS_AHA1542C_H
-
-#pragma once
-
-
-#include "isa.h"
-#include "machine/eepromser.h"
-
-//*********************************************************************
-// TYPE DEFINITIONS
-//*********************************************************************
-
-// ====================> aha1542cf_device
-
-class aha1542c_device : public device_t,
- public device_isa16_card_interface
-{
-public:
- static constexpr feature_type unemulated_features() { return feature::DISK; }
- // construction/destruction
- aha1542c_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
- DECLARE_READ8_MEMBER( aha1542_r );
- DECLARE_WRITE8_MEMBER( aha1542_w );
-
-protected:
- aha1542c_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
- u8 local_status_r();
- void local_latch_w(u8 data);
-
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
- // optional information overrides
- virtual const tiny_rom_entry *device_rom_region() const override;
- virtual void device_add_mconfig(machine_config &config) override;
-
- required_device<eeprom_serial_93cxx_device> m_eeprom;
-
-private:
- void z84c0010_mem(address_map &map);
-};
-
-// ====================> aha1542cf_device
-
-class aha1542cf_device : public aha1542c_device
-{
-public:
- // construction/destruction
- aha1542cf_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
-protected:
- virtual const tiny_rom_entry *device_rom_region() const override;
-};
-
-// ====================> aha1542cp_device
-
-class aha1542cp_device : public aha1542c_device
-{
-public:
- // construction/destruction
- aha1542cp_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
-protected:
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-
-private:
- u8 eeprom_r();
- void eeprom_w(u8 data);
-
- void local_mem(address_map &map);
-};
-
-// device type definitions
-DECLARE_DEVICE_TYPE(AHA1542C, aha1542c_device)
-DECLARE_DEVICE_TYPE(AHA1542CF, aha1542cf_device)
-DECLARE_DEVICE_TYPE(AHA1542CP, aha1542cp_device)
-
-#endif // MAME_BUS_AHA1542C_H
diff --git a/src/devices/bus/isa/aha174x.cpp b/src/devices/bus/isa/aha174x.cpp
deleted file mode 100644
index 06b6ddf5f62..00000000000
--- a/src/devices/bus/isa/aha174x.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- Adaptec AHA-1740/44 and AHA-1740A/42A Fast SCSI host adapters
-
- These are actually EISA cards, though they also have a compatibility
- mode that provides an interface like the older ISA AHA-154X series.
-
- On the AHA-1740 and AHA-1744, the HPC microcode is stored in an EEPROM
- (of unknown type), allowing it to be reprogrammed by the host. This is
- not possible on the AHA-1740A and AHA-1744A, which use a conventional
- 27C256 EPROM for the microcode. In both cases the HPC copies the code
- to and then executes it out of RAM.
-
- Though the AHA-1740 and AHA-1740A have different board layouts, they
- share the following ICs:
-
- AIC-565 Bus Auxiliary Interface Chip
- AIC-575 EISA Configuration Chip
- AIC-4600 HPC (HPC46003V20)
- AIC-6251A SCSI Interface and Protocol Chip
- IDT7201 512x9 FIFO (2 on board)
- Intel 82355 Bus Master Interface Controller
-
- AHA-1742A is the same as AHA-1740A, only with the FDC populated.
-
- AHA-1744 uses the same layout as AHA-1740, but populates the area
- around the SCSI port with DS36F95J differential drivers.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "aha174x.h"
-
-#include "machine/aic6250.h"
-//#include "machine/i82355.h"
-#include "machine/nscsi_bus.h"
-#include "machine/nscsi_hd.h"
-
-DEFINE_DEVICE_TYPE(AHA1740, aha1740_device, "aha1740", "AHA-1740 Fast SCSI Host Adapter")
-DEFINE_DEVICE_TYPE(AHA1742A, aha1742a_device, "aha1742a", "AHA-1742A Fast SCSI Host Adapter")
-
-
-aha174x_device::aha174x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, type, tag, owner, clock)
- , device_isa16_card_interface(mconfig, *this)
- , m_hpc(*this, "hpc")
- , m_bios(*this, "bios")
-{
-}
-
-aha1740_device::aha1740_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : aha174x_device(mconfig, AHA1740, tag, owner, clock)
-{
-}
-
-aha1742a_device::aha1742a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : aha174x_device(mconfig, AHA1742A, tag, owner, clock)
- , m_fdc(*this, "fdc")
-{
-}
-
-void aha174x_device::device_start()
-{
-}
-
-
-void aha174x_device::hpc_map(address_map &map)
-{
- map(0x5000, 0x500f).m("scsi:7:scsic", FUNC(aic6251a_device::map));
- map(0x8000, 0xffff).rom().region("mcode", 0);
-}
-
-static void aha174x_scsi_devices(device_slot_interface &device)
-{
- device.option_add("harddisk", NSCSI_HARDDISK);
- device.option_add_internal("scsic", AIC6251A);
-}
-
-void aha174x_device::scsic_config(device_t *device)
-{
- device->set_clock(40_MHz_XTAL / 2); // divider not verified
-}
-
-void aha1740_device::device_add_mconfig(machine_config &config)
-{
- HPC46003(config, m_hpc, 40_MHz_XTAL / 2);
- m_hpc->set_addrmap(AS_PROGRAM, &aha1740_device::hpc_map);
-
- NSCSI_BUS(config, "scsi");
- NSCSI_CONNECTOR(config, "scsi:0", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:1", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:2", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:3", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:4", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:5", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:6", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:7", aha174x_scsi_devices, "scsic", true)
- .set_option_machine_config("scsic", [this] (device_t *device) { scsic_config(device); });
-}
-
-void aha1742a_device::device_add_mconfig(machine_config &config)
-{
- HPC46003(config, m_hpc, 40_MHz_XTAL / 2);
- m_hpc->set_addrmap(AS_PROGRAM, &aha1742a_device::hpc_map);
-
- NSCSI_BUS(config, "scsi");
- NSCSI_CONNECTOR(config, "scsi:0", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:1", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:2", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:3", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:4", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:5", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:6", aha174x_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:7", aha174x_scsi_devices, "scsic", true)
- .set_option_machine_config("scsic", [this] (device_t *device) { scsic_config(device); });
-
- N82077AA(config, m_fdc, 24_MHz_XTAL);
-}
-
-
-ROM_START(aha1740)
- ROM_REGION(0x4000, "bios", 0)
- ROM_LOAD("b_dc00.bin", 0x0000, 0x4000, CRC(056d75ec) SHA1(8ca143adfc7d20ad5d49f14dedabc8276454bf9e))
-
- ROM_REGION16_LE(0x8000, "mcode", 0)
- ROM_SYSTEM_BIOS(0, "v140st", "BIOS v1.40 (Standard Mode)")
- ROMX_LOAD("standard.bin", 0x0000, 0x8000, CRC(8c15c6a2) SHA1(77e15b0244e3a814f53f957270e6474a8a839955), ROM_BIOS(0))
- ROM_SYSTEM_BIOS(1, "v140en", "BIOS v1.40 (Enhanced Mode)")
- ROMX_LOAD("enhanced.bin", 0x0000, 0x8000, CRC(84b3df89) SHA1(a718c3ea5443a609b4b20bfe48be18193737ad25), ROM_BIOS(1))
- // Adaptec's help file claims that "the EEPROM on the board can hold firmware for both modes simultaneously."
- // The AHA-174XA firmware images obviously have this, but the files provided here do not agree.
-ROM_END
-
-ROM_START(aha1742a)
- ROM_REGION(0x4000, "bios", 0)
- ROM_DEFAULT_BIOS("v140")
- ROM_SYSTEM_BIOS(0, "v134", "BIOS v1.34")
- ROMX_LOAD("adaptec_inc_450214-00_a_bios_8800_1991.u47", 0x0000, 0x4000, CRC(6cf06151) SHA1(0da45634b12b33fc886920d065cc8ffb2cf376b8), ROM_BIOS(0))
- ROM_SYSTEM_BIOS(1, "v140", "BIOS v1.40")
- ROMX_LOAD("adaptec_inc_450216-00_a_bios_dc00_1992.u47", 0x0000, 0x4000, CRC(056d75ec) SHA1(8ca143adfc7d20ad5d49f14dedabc8276454bf9e), ROM_BIOS(1))
- ROM_SYSTEM_BIOS(2, "v140s", "BIOS v1.40 (Extended Timeout)")
- ROMX_LOAD("b_f100.bin", 0x0000, 0x4000, CRC(b695acc0) SHA1(683112fafdf83d5eb89237d9215f7d6eacc6eeaf), ROM_BIOS(2))
-
- ROM_REGION16_LE(0x8000, "mcode", 0)
- ROMX_LOAD("adaptec_inc_450117-00_c_mcode_23a8_1991.u10", 0x0000, 0x8000, NO_DUMP, ROM_BIOS(0))
- ROMX_LOAD("adaptec_inc_450113-00_d_mcode_b7d6_1992.u10", 0x0000, 0x8000, CRC(0a55a555) SHA1(ff400f56b33f0ad94e34564d7715a0773b335844), ROM_BIOS(1))
- ROMX_LOAD("m_c7b8.bin", 0x0000, 0x8000, CRC(21282e86) SHA1(18cb3960dc47f2c14beb88f9680c1f66c4652b04), ROM_BIOS(2))
-ROM_END
-
-const tiny_rom_entry *aha1740_device::device_rom_region() const
-{
- return ROM_NAME(aha1740);
-}
-
-const tiny_rom_entry *aha1742a_device::device_rom_region() const
-{
- return ROM_NAME(aha1742a);
-}
diff --git a/src/devices/bus/isa/aha174x.h b/src/devices/bus/isa/aha174x.h
deleted file mode 100644
index f65ee7de93a..00000000000
--- a/src/devices/bus/isa/aha174x.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- Adaptec AHA-1540/42A and AHA-1540/42B SCSI controllers
-
-***************************************************************************/
-
-#ifndef MAME_BUS_ISA_AHA174X_H
-#define MAME_BUS_ISA_AHA174X_H
-
-#pragma once
-
-#include "isa.h"
-#include "cpu/hpc/hpc.h"
-#include "machine/upd765.h"
-
-class aha174x_device : public device_t, public device_isa16_card_interface
-{
-protected:
- aha174x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
-
- virtual void device_start() override;
-
- void hpc_map(address_map &map);
- void scsic_config(device_t *device);
-
- required_device<hpc46003_device> m_hpc;
- required_region_ptr<u8> m_bios;
-};
-
-class aha1740_device : public aha174x_device
-{
-public:
- aha1740_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
- static constexpr feature_type unemulated_features() { return feature::DISK; }
-
-protected:
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-};
-
-class aha1742a_device : public aha174x_device
-{
-public:
- aha1742a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
- static constexpr feature_type unemulated_features() { return feature::DISK; }
-
-protected:
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-
- required_device<upd765_family_device> m_fdc;
-};
-
-DECLARE_DEVICE_TYPE(AHA1740, aha1740_device)
-DECLARE_DEVICE_TYPE(AHA1742A, aha1742a_device)
-
-#endif // MAME_BUS_ISA_AHA174X_H
diff --git a/src/devices/bus/isa/bt54x.cpp b/src/devices/bus/isa/bt54x.cpp
deleted file mode 100644
index d8ef31a848f..00000000000
--- a/src/devices/bus/isa/bt54x.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- BusTek/BusLogic BT-54x series PC/AT SCSI host adapters
-
- The earlier version of the BT-542B, with BusTek labels, has a NCR 86C05
- bus controller where a later version has the 80C20 ASIC instead. It is
- believed that these chips are largely compatible with each other, as
- are the NCR 53CF94 and Emulex FAS216 SCSI controllers.
-
- 2.41/2.21 is the last BIOS version compatible with revisions A-G of
- the BT-542B.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "bt54x.h"
-
-#include "machine/ncr5390.h"
-//#include "machine/ncr86c05.h"
-#include "machine/nscsi_cd.h"
-#include "machine/nscsi_hd.h"
-
-DEFINE_DEVICE_TYPE(BT542B, bt542b_device, "bt542b", "BusTek BT-542B SCSI Host Adapter") // Rev. G or earlier
-DEFINE_DEVICE_TYPE(BT542BH, bt542bh_device, "bt542bh", "BusLogic BT-542B SCSI Host Adapter (Rev. H)")
-DEFINE_DEVICE_TYPE(BT545S, bt545s_device, "bt545s", "BusLogic BT-545S Fast SCSI Host Adapter")
-
-bt54x_device::bt54x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, type, tag, owner, clock)
- , device_isa16_card_interface(mconfig, *this)
- , m_mpu(*this, "mpu")
- , m_fdc(*this, "fdc")
- , m_bios(*this, "bios")
-{
-}
-
-bt542b_device::bt542b_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : bt54x_device(mconfig, BT542B, tag, owner, clock)
-{
-}
-
-bt542bh_device::bt542bh_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : bt54x_device(mconfig, BT542BH, tag, owner, clock)
-{
-}
-
-bt545s_device::bt545s_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : bt54x_device(mconfig, BT545S, tag, owner, clock)
-{
-}
-
-void bt54x_device::device_start()
-{
-}
-
-u8 bt54x_device::local_status_r()
-{
- return 0;
-}
-
-void bt54x_device::local_map(address_map &map)
-{
- map(0x00000, 0x01fff).ram();
- //map(0x02000, 0x0201f).rw("busintf", FUNC(ncr86c05_device::local_read), FUNC(ncr86c05_device::local_write));
- map(0x02080, 0x0208f).m("scsi:7:scsic", FUNC(ncr53cf94_device::map));
- map(0x02180, 0x02180).r(FUNC(bt54x_device::local_status_r));
- map(0xf8000, 0xfffff).rom().region("mpu", 0);
-}
-
-static void scsi_devices(device_slot_interface &device)
-{
- device.option_add("cdrom", NSCSI_CDROM);
- device.option_add("harddisk", NSCSI_HARDDISK);
- device.option_add_internal("scsic", NCR53C94);
-}
-
-static void fast_scsi_devices(device_slot_interface &device)
-{
- device.option_add("cdrom", NSCSI_CDROM);
- device.option_add("harddisk", NSCSI_HARDDISK);
- device.option_add_internal("scsic", NCR53CF94); // FAS216
-}
-
-void bt54x_device::asc_config(device_t *device)
-{
- ncr53c94_device &asc = downcast<ncr53c94_device &>(*device);
-
- asc.set_clock(25_MHz_XTAL); // not verified; perhaps selectable? (40 MHz XTAL also on board)
-
- asc.irq_handler_cb().set(m_mpu, FUNC(i80188_cpu_device::int0_w));
- //asc.drq_handler_cb().set("busintf", FUNC(ncr86c05_device::dma_req_w));
-}
-
-void bt54x_device::fsc_config(device_t *device)
-{
- ncr53cf94_device &fsc = downcast<ncr53cf94_device &>(*device);
-
- fsc.set_clock(40_MHz_XTAL);
-
- fsc.irq_handler_cb().set(m_mpu, FUNC(i80188_cpu_device::int0_w)); // mostly polled on BT-545S
- //fsc.drq_handler_cb().set("busintf", FUNC(ncr86c05_device::dma_req_w));
-}
-
-void bt54x_device::fsc_base(machine_config &config)
-{
- //ncr86c05_device &busintf(NCR86C05(config, "busintf", 0));
- //busintf.mint_callback().set(m_mpu, FUNC(i80188_cpu_device::int1_w));
- //busintf.dma_ack_callback().set("scsi:7:scsic", FUNC(ncr53cf94_device::dma_w));
-
- NSCSI_BUS(config, "scsi");
- NSCSI_CONNECTOR(config, "scsi:0", fast_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:1", fast_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:2", fast_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:3", fast_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:4", fast_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:5", fast_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:6", fast_scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:7", fast_scsi_devices, "scsic", true).set_option_machine_config("scsic", [this] (device_t *device) { fsc_config(device); });
-}
-
-void bt542b_device::device_add_mconfig(machine_config &config)
-{
- I80188(config, m_mpu, 16_MHz_XTAL);
- m_mpu->set_addrmap(AS_PROGRAM, &bt542b_device::local_map);
-
- //ncr86c05_device &busintf(NCR86C05(config, "busintf", 0));
- //busintf.mint_callback().set(m_mpu, FUNC(i80188_cpu_device::int1_w));
- //busintf.dma_ack_callback().set("scsi:7:scsic", FUNC(ncr53c94_device::dma_w));
-
- NSCSI_BUS(config, "scsi");
- NSCSI_CONNECTOR(config, "scsi:0", scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:1", scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:2", scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:3", scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:4", scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:5", scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:6", scsi_devices, nullptr);
- NSCSI_CONNECTOR(config, "scsi:7", scsi_devices, "scsic", true).set_option_machine_config("scsic", [this] (device_t *device) { asc_config(device); });
-
- DP8473(config, m_fdc, 24_MHz_XTAL);
-}
-
-void bt542bh_device::device_add_mconfig(machine_config &config)
-{
- I80188(config, m_mpu, 40_MHz_XTAL / 2); // clock guessed
- m_mpu->set_addrmap(AS_PROGRAM, &bt542bh_device::local_map);
-
- fsc_base(config);
-
- DP8473(config, m_fdc, 24_MHz_XTAL);
-}
-
-void bt545s_device::device_add_mconfig(machine_config &config)
-{
- I80188(config, m_mpu, 40_MHz_XTAL / 2); // SAB80188-1-N; clock guessed
- m_mpu->set_addrmap(AS_PROGRAM, &bt545s_device::local_map);
-
- fsc_base(config);
-
- PC8477A(config, m_fdc, 24_MHz_XTAL); // actually PC8477BV
-}
-
-ROM_START(bt542b)
- ROM_REGION(0x4000, "bios", 0) // "(C) Copyright 1991 BIOS Version 2.41"
- ROM_LOAD("1000006-2.41_bustek.u15", 0x0000, 0x4000, CRC(5eb00d0f) SHA1(74a8bbae1c2b42f0c605b0ac98660f1e16ac5c4e))
-
- ROM_REGION(0x8000, "mpu", 0) // "(C) Copyright 1991 BusTek Corporation 542B 91/12/14"
- ROM_LOAD("1000005-2.21_bustek.u2", 0x0000, 0x8000, CRC(c2c66653) SHA1(054ba1ea71b2aaab31ab9dd5aca955d861f5333b))
-ROM_END
-
-ROM_START(bt542bh)
- ROM_REGION(0x8000, "bios", 0) // "(C) Copyright 1992 BIOS Version 4.70M"
- ROM_LOAD("5000006-4.70_buslogic.u15", 0x0000, 0x8000, CRC(f5a5e116) SHA1(d7b73015532838dc694edf24308ebbab6f4dd5bb))
-
- ROM_REGION(0x8000, "mpu", 0) // "(C) Copyright 1992 BusLogic Inc. 542BH93/05/23"
- ROM_LOAD("5000005-3.35_buslogic.u2", 0x0000, 0x8000, CRC(181966c3) SHA1(b9b327d50cd13f3e5b5b53892b18f233aff065b7))
-ROM_END
-
-ROM_START(bt545s)
- ROM_REGION(0x4000, "bios", 0) // "(C) Copyright 1992 BIOS Version 4.50"
- ROM_LOAD("u15_27128_5002026-4.50.bin", 0x0000, 0x4000, CRC(1bd3247b) SHA1(9d46a99f4b3057e94ef422f387218de2c4553c1a))
-
- ROM_REGION(0x8000, "mpu", 0) // "(C) Copyright 1992 BusLogic Inc. 542BH92/10/05"
- ROM_LOAD("u2_27256_5002005-3.31.bin", 0x0000, 0x8000, CRC(20473714) SHA1(797a8dba182049949f7a5c14d8bef4b4e908305b))
-ROM_END
-
-const tiny_rom_entry *bt542b_device::device_rom_region() const
-{
- return ROM_NAME(bt542b);
-}
-
-const tiny_rom_entry *bt542bh_device::device_rom_region() const
-{
- return ROM_NAME(bt542bh);
-}
-
-const tiny_rom_entry *bt545s_device::device_rom_region() const
-{
- return ROM_NAME(bt545s);
-}
diff --git a/src/devices/bus/isa/bt54x.h b/src/devices/bus/isa/bt54x.h
deleted file mode 100644
index dfdd0009416..00000000000
--- a/src/devices/bus/isa/bt54x.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- BusTek/BusLogic BT-54x series PC/AT SCSI host adapters
-
-***************************************************************************/
-
-#ifndef MAME_BUS_ISA_BT54X_H
-#define MAME_BUS_ISA_BT54X_H
-
-#pragma once
-
-#include "isa.h"
-#include "cpu/i86/i186.h"
-#include "machine/upd765.h"
-
-class bt54x_device : public device_t, public device_isa16_card_interface
-{
-public:
- static constexpr feature_type unemulated_features() { return feature::DISK; }
-
-protected:
- bt54x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
-
- virtual void device_start() override;
-
- u8 local_status_r();
-
- void local_map(address_map &map);
- void asc_config(device_t *device);
- void fsc_config(device_t *device);
- void fsc_base(machine_config &config);
-
- required_device<i80188_cpu_device> m_mpu;
- required_device<upd765_family_device> m_fdc;
- required_region_ptr<u8> m_bios;
-};
-
-class bt542b_device : public bt54x_device
-{
-public:
- bt542b_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
-protected:
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-};
-
-class bt542bh_device : public bt54x_device
-{
-public:
- bt542bh_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
-protected:
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-};
-
-class bt545s_device : public bt54x_device
-{
-public:
- bt545s_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
-protected:
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-};
-
-DECLARE_DEVICE_TYPE(BT542B, bt542b_device)
-DECLARE_DEVICE_TYPE(BT542BH, bt542bh_device)
-DECLARE_DEVICE_TYPE(BT545S, bt545s_device)
-
-#endif // MAME_BUS_ISA_BT54X_H
diff --git a/src/devices/bus/isa/cga.cpp b/src/devices/bus/isa/cga.cpp
index eac981b4100..f5fb8f185d7 100644
--- a/src/devices/bus/isa/cga.cpp
+++ b/src/devices/bus/isa/cga.cpp
@@ -261,13 +261,12 @@ DEFINE_DEVICE_TYPE(ISA8_CGA, isa8_cga_device, "cga", "IBM Color/Graphics Monitor
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa8_cga_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, CGA_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(14'318'181), 912, 0, 640, 262, 0, 200);
- screen.set_screen_update(FUNC(isa8_cga_device::screen_update));
+MACHINE_CONFIG_START(isa8_cga_device::device_add_mconfig)
+ MCFG_SCREEN_ADD(CGA_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(14'318'181),912,0,640,262,0,200)
+ MCFG_SCREEN_UPDATE_DEVICE( DEVICE_SELF, isa8_cga_device, screen_update )
- PALETTE(config, m_palette).set_entries(/* CGA_PALETTE_SETS * 16*/ 65536);
+ MCFG_PALETTE_ADD("palette", /* CGA_PALETTE_SETS * 16*/ 65536 )
MC6845(config, m_crtc, XTAL(14'318'181)/16);
m_crtc->set_screen(nullptr);
@@ -277,7 +276,7 @@ void isa8_cga_device::device_add_mconfig(machine_config &config)
m_crtc->out_hsync_callback().set(FUNC(isa8_cga_device::hsync_changed));
m_crtc->out_vsync_callback().set(FUNC(isa8_cga_device::vsync_changed));
m_crtc->set_reconfigure_callback(FUNC(isa8_cga_device::reconfigure), this);
-}
+MACHINE_CONFIG_END
ioport_constructor isa8_cga_device::device_input_ports() const
{
@@ -913,7 +912,7 @@ READ8_MEMBER( isa8_cga_device::io_read )
/* return last written mc6845 address value here? */
break;
case 1: case 3: case 5: case 7:
- data = m_crtc->register_r();
+ data = m_crtc->register_r( space, offset );
break;
case 10:
data = m_vsync | ( ( data & 0x40 ) >> 4 ) | m_hsync;
@@ -928,10 +927,10 @@ WRITE8_MEMBER( isa8_cga_device::io_write )
{
switch(offset) {
case 0: case 2: case 4: case 6:
- m_crtc->address_w(data);
+ m_crtc->address_w( space, offset, data );
break;
case 1: case 3: case 5: case 7:
- m_crtc->register_w(data);
+ m_crtc->register_w( space, offset, data );
break;
case 8:
mode_control_w(data);
@@ -1170,14 +1169,14 @@ WRITE8_MEMBER( isa8_cga_pc1512_device::io_write )
{
case 0: case 2: case 4: case 6:
data &= 0x1F;
- m_crtc->address_w(data);
+ m_crtc->address_w( space, offset, data );
m_mc6845_address = data;
break;
case 1: case 3: case 5: case 7:
if ( ! m_mc6845_locked_register[m_mc6845_address] )
{
- m_crtc->register_w(data);
+ m_crtc->register_w( space, offset, data );
if ( isa8_cga_pc1512_device::mc6845_writeonce_register[m_mc6845_address] )
{
m_mc6845_locked_register[m_mc6845_address] = 1;
@@ -1694,13 +1693,13 @@ const tiny_rom_entry *isa8_cga_mc1502_device::device_rom_region() const
DEFINE_DEVICE_TYPE(ISA8_CGA_M24, isa8_cga_m24_device, "cga_m24", "Olivetti M24 CGA")
-void isa8_cga_m24_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(isa8_cga_m24_device::device_add_mconfig)
isa8_cga_device::device_add_mconfig(config);
- subdevice<screen_device>(CGA_SCREEN_NAME)->set_raw(XTAL(14'318'181), 912, 0, 640, 462, 0, 400);
+ MCFG_DEVICE_MODIFY(CGA_SCREEN_NAME)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(14'318'181),912,0,640,462,0,400)
m_crtc->set_reconfigure_callback(FUNC(isa8_cga_m24_device::reconfigure), this);
-}
+MACHINE_CONFIG_END
isa8_cga_m24_device::isa8_cga_m24_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
isa8_cga_m24_device(mconfig, ISA8_CGA_M24, tag, owner, clock)
@@ -1747,7 +1746,7 @@ WRITE8_MEMBER( isa8_cga_m24_device::io_write )
{
case 0: case 2: case 4: case 6:
m_index = data;
- m_crtc->address_w(data);
+ m_crtc->address_w( space, offset, data );
break;
case 1: case 3: case 5: case 7:
switch(m_index & 0x1f) // TODO: this is handled by a pal and prom
@@ -1766,7 +1765,7 @@ WRITE8_MEMBER( isa8_cga_m24_device::io_write )
data <<= 1;
break;
}
- m_crtc->register_w(data);
+ m_crtc->register_w( space, offset, data );
break;
case 0x0e:
m_mode2 = data;
@@ -1887,12 +1886,12 @@ MC6845_UPDATE_ROW( isa8_cga_m24_device::m24_gfx_1bpp_m24_update_row )
DEFINE_DEVICE_TYPE(ISA8_CGA_CPORTIII, isa8_cga_cportiii_device, "cga_cportiii", "Compaq Portable III CGA")
-void isa8_cga_cportiii_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(isa8_cga_cportiii_device::device_add_mconfig)
isa8_cga_m24_device::device_add_mconfig(config);
- subdevice<screen_device>(CGA_SCREEN_NAME)->set_color(rgb_t(255, 125, 0));
-}
+ MCFG_DEVICE_MODIFY(CGA_SCREEN_NAME)
+ MCFG_SCREEN_COLOR(rgb_t(255, 125, 0))
+MACHINE_CONFIG_END
isa8_cga_cportiii_device::isa8_cga_cportiii_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
isa8_cga_m24_device(mconfig, ISA8_CGA_CPORTIII, tag, owner, clock)
diff --git a/src/devices/bus/isa/cl_sh260.cpp b/src/devices/bus/isa/cl_sh260.cpp
deleted file mode 100644
index f8fb39249f5..00000000000
--- a/src/devices/bus/isa/cl_sh260.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- ISA 16-bit disk controllers based on the Cirrus Logic CL-SH260-15PC-D
- * Everex EV-346
- * Joincom Electronic JC-1310
-
-***************************************************************************/
-
-#include "emu.h"
-#include "cl_sh260.h"
-
-#include "cpu/mcs51/mcs51.h"
-
-DEFINE_DEVICE_TYPE(EV346, isa16_ev346_device, "ev346", "Everex EV-346 disk controller")
-DEFINE_DEVICE_TYPE(JC1310, isa16_jc1310_device, "jc1310", "Joincom JC-1310 disk controller")
-
-isa16_cl_sh260_device::isa16_cl_sh260_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, type, tag, owner, clock)
- , device_isa16_card_interface(mconfig, *this)
- , m_fdc(*this, "fdc")
-{
-}
-
-isa16_ev346_device::isa16_ev346_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : isa16_cl_sh260_device(mconfig, EV346, tag, owner, clock)
-{
-}
-
-isa16_jc1310_device::isa16_jc1310_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : isa16_cl_sh260_device(mconfig, JC1310, tag, owner, clock)
-{
-}
-
-void isa16_cl_sh260_device::device_start()
-{
-}
-
-void isa16_cl_sh260_device::i8031_map(address_map &map)
-{
- map(0x0000, 0x1fff).rom().region("mcu", 0);
-}
-
-void isa16_ev346_device::ext_map(address_map &map)
-{
- map.global_mask(0xff);
- map(0x00, 0xff).noprw(); // CL-SH260 interface
-}
-
-void isa16_jc1310_device::ext_map(address_map &map)
-{
- map(0xc000, 0xc0ff).noprw(); // CL-SH260 interface
-}
-
-void isa16_ev346_device::device_add_mconfig(machine_config &config)
-{
- i8031_device &mcu(I8031(config, "mcu", 12_MHz_XTAL)); // SCN8031HCCN40
- mcu.set_addrmap(AS_PROGRAM, &isa16_ev346_device::i8031_map);
- mcu.set_addrmap(AS_IO, &isa16_ev346_device::ext_map);
-
- DP8473(config, m_fdc, 24_MHz_XTAL);
-}
-
-void isa16_jc1310_device::device_add_mconfig(machine_config &config)
-{
- i8031_device &mcu(I8031(config, "mcu", 10_MHz_XTAL)); // P8031AH
- mcu.set_addrmap(AS_PROGRAM, &isa16_jc1310_device::i8031_map);
- mcu.set_addrmap(AS_IO, &isa16_jc1310_device::ext_map);
-
- WD37C65C(config, m_fdc, 16_MHz_XTAL); // WD37C65B-PL
- //m_fdc->set_clock2(9.6_MHz_XTAL);
-}
-
-ROM_START(ev346)
- ROM_REGION(0x2000, "mcu", 0)
- ROM_LOAD("everex_ev346_vers_3.2.bin", 0x0000, 0x2000, CRC(49b10ca7) SHA1(ef31b62f5ac38db7cacfc4d30e203a4cc1414913))
-ROM_END
-
-ROM_START(jc1310)
- ROM_REGION(0x2000, "mcu", 0) // "(C) COPYRIGHT JOINCOM ELECTRONIC CORP. 9/16/1988 JC1310"
- ROM_LOAD("jc-1310 - apr-c 89.u3", 0x0000, 0x2000, CRC(e044f5e1) SHA1(5a32d2001bb1a489657f9488136b5d621f803703)) // TMS 2764-20JL
-ROM_END
-
-const tiny_rom_entry *isa16_ev346_device::device_rom_region() const
-{
- return ROM_NAME(ev346);
-}
-
-const tiny_rom_entry *isa16_jc1310_device::device_rom_region() const
-{
- return ROM_NAME(jc1310);
-}
diff --git a/src/devices/bus/isa/cl_sh260.h b/src/devices/bus/isa/cl_sh260.h
deleted file mode 100644
index 18612ab6456..00000000000
--- a/src/devices/bus/isa/cl_sh260.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- ISA 16-bit disk controllers based on the Cirrus Logic CL-SH260-15PC-D
- * Everex EV-346
- * Joincom Electronic JC-1310
-
-***************************************************************************/
-
-#ifndef MAME_BUS_ISA_CL_SH260_H
-#define MAME_BUS_ISA_CL_SH260_H
-
-#pragma once
-
-#include "isa.h"
-#include "machine/upd765.h"
-
-class isa16_cl_sh260_device : public device_t, public device_isa16_card_interface
-{
-protected:
- isa16_cl_sh260_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
-
- virtual void device_start() override;
-
- void i8031_map(address_map &map);
-
- required_device<upd765_family_device> m_fdc;
-};
-
-class isa16_ev346_device : public isa16_cl_sh260_device
-{
-public:
- isa16_ev346_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
- static constexpr feature_type unemulated_features() { return feature::DISK; }
-
-protected:
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-
-private:
- void ext_map(address_map &map);
-};
-
-class isa16_jc1310_device : public isa16_cl_sh260_device
-{
-public:
- isa16_jc1310_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
- static constexpr feature_type unemulated_features() { return feature::DISK; }
-
-protected:
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-
-private:
- void ext_map(address_map &map);
-};
-
-DECLARE_DEVICE_TYPE(EV346, isa16_ev346_device)
-DECLARE_DEVICE_TYPE(JC1310, isa16_jc1310_device)
-
-#endif // MAME_BUS_ISA_CL_SH260_H
diff --git a/src/devices/bus/isa/dcb.cpp b/src/devices/bus/isa/dcb.cpp
deleted file mode 100644
index db5768d6758..00000000000
--- a/src/devices/bus/isa/dcb.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- Novell Disk Coprocessor Board (DCB)
-
- This special SCSI host adapter, later acquired by ADIC, was designed
- for use with Novell NetWare.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "dcb.h"
-
-DEFINE_DEVICE_TYPE(NOVELL_DCB, novell_dcb_device, "novell_dcb", "Novell Disk Coprocessor Board (#738-133-001)")
-
-novell_dcb_device::novell_dcb_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, NOVELL_DCB, tag, owner, clock)
- , device_isa16_card_interface(mconfig, *this)
- , m_localcpu(*this, "localcpu")
- , m_eeprom(*this, "eeprom")
-{
-}
-
-void novell_dcb_device::device_start()
-{
-}
-
-void novell_dcb_device::eeprom_w(u8 data)
-{
- m_eeprom->cs_write(BIT(data, 5));
- m_eeprom->clk_write(BIT(data, 6));
- m_eeprom->di_write(BIT(data, 7));
-}
-
-u8 novell_dcb_device::misc_r()
-{
- return m_eeprom->do_read() << 7;
-}
-
-void novell_dcb_device::mem_map(address_map &map)
-{
- map(0x00000, 0x03fff).ram();
- map(0xfe000, 0xfffff).rom().region("localcpu", 0);
-}
-
-void novell_dcb_device::io_map(address_map &map)
-{
- map(0x0100, 0x0100).w(FUNC(novell_dcb_device::eeprom_w));
- map(0x0180, 0x0180).r(FUNC(novell_dcb_device::misc_r));
-}
-
-void novell_dcb_device::device_add_mconfig(machine_config &config)
-{
- I80188(config, m_localcpu, 16_MHz_XTAL);
- m_localcpu->set_addrmap(AS_PROGRAM, &novell_dcb_device::mem_map);
- m_localcpu->set_addrmap(AS_IO, &novell_dcb_device::io_map);
-
- EEPROM_93C06_16BIT(config, m_eeprom); // NMC9306
-}
-
-ROM_START(novell_dcb)
- ROM_REGION(0x2000, "localcpu", 0)
- ROM_LOAD("817-186-001_rev_e_5800_11-04-86.bin", 0x0000, 0x2000, CRC(2e2037f4) SHA1(a13c0aab46084a0805256f1d2b8b8beaccc9e253))
-ROM_END
-
-const tiny_rom_entry *novell_dcb_device::device_rom_region() const
-{
- return ROM_NAME(novell_dcb);
-}
diff --git a/src/devices/bus/isa/dcb.h b/src/devices/bus/isa/dcb.h
deleted file mode 100644
index fbca0303978..00000000000
--- a/src/devices/bus/isa/dcb.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- Novell Disk Coprocessor Board (DCB)
-
-***************************************************************************/
-
-#ifndef MAME_BUS_ISA_DCB_H
-#define MAME_BUS_ISA_DCB_H
-
-#pragma once
-
-#include "isa.h"
-#include "cpu/i86/i186.h"
-#include "machine/eepromser.h"
-
-class novell_dcb_device : public device_t, public device_isa16_card_interface
-{
-public:
- novell_dcb_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
- static constexpr feature_type unemulated_features() { return feature::DISK; }
-
-protected:
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
- virtual void device_start() override;
-
-private:
- void eeprom_w(u8 data);
- u8 misc_r();
-
- void mem_map(address_map &map);
- void io_map(address_map &map);
-
- required_device<i80188_cpu_device> m_localcpu;
- required_device<eeprom_serial_93cxx_device> m_eeprom;
-};
-
-DECLARE_DEVICE_TYPE(NOVELL_DCB, novell_dcb_device)
-
-#endif // MAME_BUS_ISA_DCB_H
diff --git a/src/devices/bus/isa/dectalk.cpp b/src/devices/bus/isa/dectalk.cpp
index da45a2ec18b..d8ad57d57d3 100644
--- a/src/devices/bus/isa/dectalk.cpp
+++ b/src/devices/bus/isa/dectalk.cpp
@@ -172,6 +172,7 @@ void dectalk_isa_device::device_add_mconfig(machine_config &config)
SPEAKER(config, "speaker").front_center();
DAC_12BIT_R2R(config, m_dac, 0).add_route(0, "speaker", 1.0); // unknown DAC
voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref", 0));
+ vref.set_output(5.0);
vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
}
diff --git a/src/devices/bus/isa/ega.cpp b/src/devices/bus/isa/ega.cpp
index 5da3c263384..01c73066088 100644
--- a/src/devices/bus/isa/ega.cpp
+++ b/src/devices/bus/isa/ega.cpp
@@ -528,24 +528,23 @@ DEFINE_DEVICE_TYPE(ISA8_EGA, isa8_ega_device, "ega", "IBM Enhanced Graphics Adap
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa8_ega_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, EGA_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_raw(16.257_MHz_XTAL, 912, 0, 640, 262, 0, 200);
- screen.set_screen_update(EGA_CRTC_NAME, FUNC(crtc_ega_device::screen_update));
- screen.set_palette(m_palette);
-
- PALETTE(config, m_palette).set_entries(64);
-
- CRTC_EGA(config, m_crtc_ega, 16.257_MHz_XTAL/8);
- m_crtc_ega->set_screen(EGA_SCREEN_NAME);
- m_crtc_ega->config_set_hpixels_per_column(8);
- m_crtc_ega->set_row_update_callback(FUNC(isa8_ega_device::ega_update_row), this);
- m_crtc_ega->res_out_de_callback().set(FUNC(isa8_ega_device::de_changed));
- m_crtc_ega->res_out_hsync_callback().set(FUNC(isa8_ega_device::hsync_changed));
- m_crtc_ega->res_out_vsync_callback().set(FUNC(isa8_ega_device::vsync_changed));
- m_crtc_ega->res_out_vblank_callback().set(FUNC(isa8_ega_device::vblank_changed));
-}
+MACHINE_CONFIG_START(isa8_ega_device::device_add_mconfig)
+ MCFG_SCREEN_ADD(EGA_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_RAW_PARAMS(16257000,912,0,640,262,0,200)
+ MCFG_SCREEN_UPDATE_DEVICE(EGA_CRTC_NAME, crtc_ega_device, screen_update)
+ MCFG_SCREEN_PALETTE("palette")
+
+ MCFG_PALETTE_ADD( "palette", 64 )
+
+ MCFG_DEVICE_ADD(EGA_CRTC_NAME, CRTC_EGA, 16257000/8)
+ MCFG_CRTC_EGA_SET_SCREEN(EGA_SCREEN_NAME)
+ MCFG_CRTC_EGA_HPIXELS_PER_COLUMN(8)
+ MCFG_CRTC_EGA_ROW_UPDATE_CB(isa8_ega_device, ega_update_row)
+ MCFG_CRTC_EGA_RES_OUT_DE_CB(WRITELINE(*this, isa8_ega_device, de_changed))
+ MCFG_CRTC_EGA_RES_OUT_HSYNC_CB(WRITELINE(*this, isa8_ega_device, hsync_changed))
+ MCFG_CRTC_EGA_RES_OUT_VSYNC_CB(WRITELINE(*this, isa8_ega_device, vsync_changed))
+ MCFG_CRTC_EGA_RES_OUT_VBLANK_CB(WRITELINE(*this, isa8_ega_device, vblank_changed))
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -577,7 +576,7 @@ isa8_ega_device::isa8_ega_device(const machine_config &mconfig, const char *tag,
isa8_ega_device::isa8_ega_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_isa8_card_interface(mconfig, *this),
- m_crtc_ega(*this, EGA_CRTC_NAME), m_videoram(nullptr), m_charA(nullptr), m_charB(nullptr),
+ m_crtc_ega(nullptr), m_videoram(nullptr), m_charA(nullptr), m_charB(nullptr),
m_misc_output(0), m_feature_control(0), m_frame_cnt(0), m_hsync(0), m_vsync(0), m_vblank(0), m_display_enable(0), m_video_mode(0),
m_palette(*this, "palette")
{
@@ -627,6 +626,8 @@ void isa8_ega_device::device_start()
m_plane[2] = m_videoram + 0x20000;
m_plane[3] = m_videoram + 0x30000;
+ m_crtc_ega = subdevice<crtc_ega_device>(EGA_CRTC_NAME);
+
m_isa->install_rom(this, 0xc0000, 0xc3fff, "ega", "user2");
m_isa->install_device(0x3b0, 0x3bf, read8_delegate(FUNC(isa8_ega_device::pc_ega8_3b0_r), this), write8_delegate(FUNC(isa8_ega_device::pc_ega8_3b0_w), this));
m_isa->install_device(0x3c0, 0x3cf, read8_delegate(FUNC(isa8_ega_device::pc_ega8_3c0_r), this), write8_delegate(FUNC(isa8_ega_device::pc_ega8_3c0_w), this));
@@ -1169,7 +1170,7 @@ READ8_MEMBER( isa8_ega_device::pc_ega8_3X0_r )
/* CRT Controller - data register */
case 1: case 3: case 5: case 7:
- data = m_crtc_ega->register_r();
+ data = m_crtc_ega->register_r( space, offset );
break;
/* Input Status Register 1 */
@@ -1204,12 +1205,12 @@ WRITE8_MEMBER( isa8_ega_device::pc_ega8_3X0_w )
{
/* CRT Controller - address register */
case 0: case 2: case 4: case 6:
- m_crtc_ega->address_w(data);
+ m_crtc_ega->address_w( space, offset, data );
break;
/* CRT Controller - data register */
case 1: case 3: case 5: case 7:
- m_crtc_ega->register_w(data);
+ m_crtc_ega->register_w( space, offset, data );
break;
/* Set Light Pen Flip Flop */
diff --git a/src/devices/bus/isa/ega.h b/src/devices/bus/isa/ega.h
index 4334604b9a8..4e7bc4394a3 100644
--- a/src/devices/bus/isa/ega.h
+++ b/src/devices/bus/isa/ega.h
@@ -58,7 +58,7 @@ private:
CRTC_EGA_ROW_UPDATE(ega_update_row);
public:
- required_device<crtc_ega_device> m_crtc_ega;
+ crtc_ega_device *m_crtc_ega;
void install_banks();
void change_mode();
diff --git a/src/devices/bus/isa/eis_sad8852.cpp b/src/devices/bus/isa/eis_sad8852.cpp
index f4d634d1033..4f2b5a0c856 100644
--- a/src/devices/bus/isa/eis_sad8852.cpp
+++ b/src/devices/bus/isa/eis_sad8852.cpp
@@ -199,14 +199,13 @@ ioport_constructor isa16_sad8852_device::device_input_ports() const
//-------------------------------------------------
// Board configuration
//-------------------------------------------------
-void isa16_sad8852_device::device_add_mconfig(machine_config &config)
-{
- i80188_cpu_device &cpu(I80188(config, I80188_TAG, XTAL(12'000'000) / 2)); // Chip revision is 6 MHz
- cpu.set_addrmap(AS_PROGRAM, &isa16_sad8852_device::sad8852_mem);
- cpu.set_addrmap(AS_IO, &isa16_sad8852_device::sad8852_io);
+MACHINE_CONFIG_START(isa16_sad8852_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(I80188_TAG, I80188, XTAL(12'000'000) / 2) // Chip revision is 6 MHz
+ MCFG_DEVICE_PROGRAM_MAP( sad8852_mem )
+ MCFG_DEVICE_IO_MAP(sad8852_io)
I8274_NEW(config, "terminal", XTAL(12'000'000) / 3); // Needs verification
-}
+MACHINE_CONFIG_END
isa16_sad8852_device::isa16_sad8852_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, ISA16_SAD8852, tag, owner, clock)
diff --git a/src/devices/bus/isa/fdc.cpp b/src/devices/bus/isa/fdc.cpp
index 9c9f52d7a1d..f31b0f5f9dd 100644
--- a/src/devices/bus/isa/fdc.cpp
+++ b/src/devices/bus/isa/fdc.cpp
@@ -72,11 +72,6 @@ void isa8_fdc_device::dack_w(int line, uint8_t data)
return m_fdc->dma_w(data);
}
-void isa8_fdc_device::dack_line_w(int line, int state)
-{
- //m_fdc->dack_w(state);
-}
-
void isa8_fdc_device::eop_w(int state)
{
m_fdc->tc_w(state == ASSERT_LINE);
diff --git a/src/devices/bus/isa/fdc.h b/src/devices/bus/isa/fdc.h
index cec5f7dd06e..7a1781cdc69 100644
--- a/src/devices/bus/isa/fdc.h
+++ b/src/devices/bus/isa/fdc.h
@@ -40,7 +40,6 @@ protected:
virtual uint8_t dack_r(int line) override;
virtual void dack_w(int line, uint8_t data) override;
- virtual void dack_line_w(int line, int state) override;
virtual void eop_w(int state) override;
required_device<pc_fdc_interface> m_fdc;
diff --git a/src/devices/bus/isa/finalchs.cpp b/src/devices/bus/isa/finalchs.cpp
index f9e6f37dc8f..e79dee39686 100644
--- a/src/devices/bus/isa/finalchs.cpp
+++ b/src/devices/bus/isa/finalchs.cpp
@@ -71,11 +71,10 @@ DEFINE_DEVICE_TYPE(ISA8_FINALCHS, isa8_finalchs_device, "isa_finalchs", "Final C
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa8_finalchs_device::device_add_mconfig(machine_config &config)
-{
- m65c02_device &cpu(M65C02(config, "maincpu", 5000000));
- cpu.set_addrmap(AS_PROGRAM, &isa8_finalchs_device::finalchs_mem);
-}
+MACHINE_CONFIG_START(isa8_finalchs_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("maincpu",M65C02,5000000)
+ MCFG_DEVICE_PROGRAM_MAP(finalchs_mem)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/bus/isa/gus.cpp b/src/devices/bus/isa/gus.cpp
index 423c1e3629f..99404470140 100644
--- a/src/devices/bus/isa/gus.cpp
+++ b/src/devices/bus/isa/gus.cpp
@@ -1250,8 +1250,7 @@ INPUT_PORTS_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa16_gus_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(isa16_gus_device::device_add_mconfig)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
GGF1(config, m_gf1, GF1_CLOCK);
@@ -1271,13 +1270,14 @@ void isa16_gus_device::device_add_mconfig(machine_config &config)
m_gf1->drq2_handler().set(FUNC(isa16_gus_device::drq2_w));
m_gf1->nmi_handler().set(FUNC(isa16_gus_device::nmi_w));
- MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(m_gf1, FUNC(acia6850_device::write_rxd));
+ MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
+ MCFG_MIDI_RX_HANDLER(WRITELINE("gf1", acia6850_device, write_rxd))
- MIDI_PORT(config, "mdout", midiout_slot, "midiout");
+ MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
- clock_device &acia_clock(CLOCK(config, "acia_clock", 31250*16));
- acia_clock.signal_handler().set(FUNC(isa16_gus_device::write_acia_clock));
-}
+ MCFG_DEVICE_ADD("acia_clock", CLOCK, 31250*16)
+ MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, isa16_gus_device, write_acia_clock))
+MACHINE_CONFIG_END
ioport_constructor isa16_gus_device::device_input_ports() const
{
@@ -1384,9 +1384,9 @@ READ8_MEMBER(isa16_gus_device::synth_r)
switch(offset)
{
case 0x00:
- return m_gf1->status_r();
+ return m_gf1->status_r(space,0);
case 0x01:
- return m_gf1->data_r();
+ return m_gf1->data_r(space,0);
case 0x02:
case 0x03:
return m_gf1->global_reg_select_r(space,offset-2);
@@ -1407,10 +1407,10 @@ WRITE8_MEMBER(isa16_gus_device::synth_w)
switch(offset)
{
case 0x00:
- m_gf1->control_w(data);
+ m_gf1->control_w(space,0,data);
break;
case 0x01:
- m_gf1->data_w(data);
+ m_gf1->data_w(space,0,data);
break;
case 0x02:
case 0x03:
diff --git a/src/devices/bus/isa/gus.h b/src/devices/bus/isa/gus.h
index 0009510b81f..493893a62e0 100644
--- a/src/devices/bus/isa/gus.h
+++ b/src/devices/bus/isa/gus.h
@@ -45,6 +45,38 @@
#include "isa.h"
#include "machine/6850acia.h"
+#define MCFG_GF1_TXIRQ_HANDLER(_devcb) \
+ downcast<gf1_device &>(*device).set_txirq_handler(DEVCB_##_devcb);
+
+#define MCFG_GF1_RXIRQ_HANDLER(_devcb) \
+ downcast<gf1_device &>(*device).set_rxirq_handler(DEVCB_##_devcb);
+
+#define MCFG_GF1_WAVE_IRQ_HANDLER(_devcb) \
+ downcast<gf1_device &>(*device).set_wave_irq_handler(DEVCB_##_devcb);
+
+#define MCFG_GF1_RAMP_IRQ_HANDLER(_devcb) \
+ downcast<gf1_device &>(*device).set_ramp_irq_handler(DEVCB_##_devcb);
+
+#define MCFG_GF1_TIMER1_IRQ_HANDLER(_devcb) \
+ downcast<gf1_device &>(*device).set_timer1_irq_handler(DEVCB_##_devcb);
+
+#define MCFG_GF1_TIMER2_IRQ_HANDLER(_devcb) \
+ downcast<gf1_device &>(*device).set_timer2_irq_handler(DEVCB_##_devcb);
+
+#define MCFG_GF1_SB_IRQ_HANDLER(_devcb) \
+ downcast<gf1_device &>(*device).set_sb_irq_handler(DEVCB_##_devcb);
+
+#define MCFG_GF1_DMA_IRQ_HANDLER(_devcb) \
+ downcast<gf1_device &>(*device).set_dma_irq_handler(DEVCB_##_devcb);
+
+#define MCFG_GF1_DRQ1_HANDLER(_devcb) \
+ downcast<gf1_device &>(*device).set_drq1_handler(DEVCB_##_devcb);
+
+#define MCFG_GF1_DRQ2_HANDLER(_devcb) \
+ downcast<gf1_device &>(*device).set_drq2_handler(DEVCB_##_devcb);
+
+#define MCFG_GF1_NMI_HANDLER(_devcb) \
+ downcast<gf1_device &>(*device).set_nmi_handler(DEVCB_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
@@ -80,6 +112,17 @@ public:
// construction/destruction
gf1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <class Object> devcb_base &set_txirq_handler(Object &&cb) { return m_txirq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_rxirq_handler(Object &&cb) { return m_rxirq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_wave_irq_handler(Object &&cb) { return m_wave_irq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ramp_irq_handler(Object &&cb) { return m_ramp_irq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_timer1_irq_handler(Object &&cb) { return m_timer1_irq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_timer2_irq_handler(Object &&cb) { return m_timer2_irq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_sb_irq_handler(Object &&cb) { return m_sb_irq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_dma_irq_handler(Object &&cb) { return m_dma_irq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_drq1_handler(Object &&cb) { return m_drq1_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_drq2_handler(Object &&cb) { return m_drq2_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_nmi_handler(Object &&cb) { return m_nmi_handler.set_callback(std::forward<Object>(cb)); }
auto txirq_handler() { return m_txirq_handler.bind(); }
auto rxirq_handler() { return m_rxirq_handler.bind(); }
auto wave_irq_handler() { return m_wave_irq_handler.bind(); }
diff --git a/src/devices/bus/isa/hdc.cpp b/src/devices/bus/isa/hdc.cpp
index 2492d0eaa89..040f72f98c3 100644
--- a/src/devices/bus/isa/hdc.cpp
+++ b/src/devices/bus/isa/hdc.cpp
@@ -918,23 +918,21 @@ DEFINE_DEVICE_TYPE(ISA8_HDC_EC1841, isa8_hdc_ec1841_device, "isa_hdc_ec1841", "E
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa8_hdc_device::device_add_mconfig(machine_config &config)
-{
- XT_HDC(config, m_hdc,0);
- m_hdc->irq_handler().set(FUNC(isa8_hdc_device::irq_w));
- m_hdc->drq_handler().set(FUNC(isa8_hdc_device::drq_w));
- HARDDISK(config, "hdc:primary");
- HARDDISK(config, "hdc:slave");
-}
-
-void isa8_hdc_ec1841_device::device_add_mconfig(machine_config &config)
-{
- EC1841_HDC(config, m_hdc,0);
- m_hdc->irq_handler().set(FUNC(isa8_hdc_ec1841_device::irq_w));
- m_hdc->drq_handler().set(FUNC(isa8_hdc_ec1841_device::drq_w));
- HARDDISK(config, "hdc:primary");
- HARDDISK(config, "hdc:slave");
-}
+MACHINE_CONFIG_START(isa8_hdc_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("hdc",XT_HDC,0)
+ MCFG_XTHDC_IRQ_HANDLER(WRITELINE(*this, isa8_hdc_device,irq_w))
+ MCFG_XTHDC_DRQ_HANDLER(WRITELINE(*this, isa8_hdc_device,drq_w))
+ MCFG_HARDDISK_ADD("hdc:primary")
+ MCFG_HARDDISK_ADD("hdc:slave")
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(isa8_hdc_ec1841_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("hdc",EC1841_HDC,0)
+ MCFG_XTHDC_IRQ_HANDLER(WRITELINE(*this, isa8_hdc_ec1841_device,irq_w))
+ MCFG_XTHDC_DRQ_HANDLER(WRITELINE(*this, isa8_hdc_ec1841_device,drq_w))
+ MCFG_HARDDISK_ADD("hdc:primary")
+ MCFG_HARDDISK_ADD("hdc:slave")
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/isa/hdc.h b/src/devices/bus/isa/hdc.h
index 7d60d40b7a5..3e91c57d063 100644
--- a/src/devices/bus/isa/hdc.h
+++ b/src/devices/bus/isa/hdc.h
@@ -19,6 +19,11 @@
// XT HD controller device
+#define MCFG_XTHDC_IRQ_HANDLER(_devcb) \
+ downcast<xt_hdc_device &>(*device).set_irq_handler(DEVCB_##_devcb);
+
+#define MCFG_XTHDC_DRQ_HANDLER(_devcb) \
+ downcast<xt_hdc_device &>(*device).set_drq_handler(DEVCB_##_devcb);
class xt_hdc_device :
public device_t
@@ -27,8 +32,8 @@ public:
// construction/destruction
xt_hdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto irq_handler() { return m_irq_handler.bind(); }
- auto drq_handler() { return m_drq_handler.bind(); }
+ template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_drq_handler(Object &&cb) { return m_drq_handler.set_callback(std::forward<Object>(cb)); }
int dack_r();
int dack_rs();
diff --git a/src/devices/bus/isa/ibm_mfc.cpp b/src/devices/bus/isa/ibm_mfc.cpp
index 40ce54ff6fc..30a638d1c27 100644
--- a/src/devices/bus/isa/ibm_mfc.cpp
+++ b/src/devices/bus/isa/ibm_mfc.cpp
@@ -374,11 +374,10 @@ ROM_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa8_ibm_mfc_device::device_add_mconfig(machine_config &config)
-{
- Z80(config, m_cpu, XTAL(11'800'000) / 2);
- m_cpu->set_addrmap(AS_PROGRAM, &isa8_ibm_mfc_device::prg_map);
- m_cpu->set_addrmap(AS_IO, &isa8_ibm_mfc_device::io_map);
+MACHINE_CONFIG_START(isa8_ibm_mfc_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("ibm_mfc", Z80, XTAL(11'800'000) / 2)
+ MCFG_DEVICE_PROGRAM_MAP(prg_map)
+ MCFG_DEVICE_IO_MAP(io_map)
I8255(config, m_d71055c_0);
m_d71055c_0->in_pa_callback().set(FUNC(isa8_ibm_mfc_device::ppi0_i_a));
@@ -391,10 +390,10 @@ void isa8_ibm_mfc_device::device_add_mconfig(machine_config &config)
m_d71055c_1->in_pb_callback().set(FUNC(isa8_ibm_mfc_device::ppi1_i_b));
m_d71055c_1->out_pc_callback().set(FUNC(isa8_ibm_mfc_device::ppi1_o_c));
- I8251(config, m_d71051, 0);
+ I8251(config, "d71051", 0);
- clock_device &usart_clock(CLOCK(config, "usart_clock", XTAL(4'000'000) / 8)); // 500KHz
- usart_clock.signal_handler().set(FUNC(isa8_ibm_mfc_device::write_usart_clock));
+ MCFG_DEVICE_ADD("usart_clock", CLOCK, XTAL(4'000'000) / 8) // 500KHz
+ MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, isa8_ibm_mfc_device, write_usart_clock))
PIT8253(config, m_d8253, 0);
m_d8253->set_clk<0>(XTAL(4'000'000) / 8);
@@ -410,7 +409,7 @@ void isa8_ibm_mfc_device::device_add_mconfig(machine_config &config)
m_ym2151->irq_handler().set(FUNC(isa8_ibm_mfc_device::ibm_mfc_ym_irq));
m_ym2151->add_route(0, "ymleft", 1.00);
m_ym2151->add_route(1, "ymright", 1.00);
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/isa/isa.cpp b/src/devices/bus/isa/isa.cpp
index 92ead5df95b..417e354180c 100644
--- a/src/devices/bus/isa/isa.cpp
+++ b/src/devices/bus/isa/isa.cpp
@@ -111,10 +111,11 @@ isa8_device::isa8_device(const machine_config &mconfig, device_type type, const
m_io_config("ISA 8-bit I/O", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor()),
m_mem16_config("ISA 16-bit mem", ENDIANNESS_LITTLE, 16, 24, 0, address_map_constructor()),
m_io16_config("ISA 16-bit I/O", ENDIANNESS_LITTLE, 16, 16, 0, address_map_constructor()),
- m_memspace(*this, finder_base::DUMMY_TAG, -1),
- m_iospace(*this, finder_base::DUMMY_TAG, -1),
- m_memwidth(0),
+ m_maincpu(*this, finder_base::DUMMY_TAG),
+ m_iospace(nullptr),
+ m_memspace(nullptr),
m_iowidth(0),
+ m_memwidth(0),
m_allocspaces(false),
m_out_irq2_cb(*this),
m_out_irq3_cb(*this),
@@ -125,6 +126,7 @@ isa8_device::isa8_device(const machine_config &mconfig, device_type type, const
m_out_drq1_cb(*this),
m_out_drq2_cb(*this),
m_out_drq3_cb(*this),
+ m_nmi_enabled(false),
m_write_iochck(*this)
{
std::fill(std::begin(m_dma_device), std::end(m_dma_device), nullptr);
@@ -200,27 +202,10 @@ void isa8_device::remap(int space_id, offs_t start, offs_t end)
}
//-------------------------------------------------
-// device_config_complete - - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void isa8_device::device_config_complete()
-{
- if (m_allocspaces)
- {
- m_memspace.set_tag(*this, DEVICE_SELF, AS_ISA_MEM);
- m_iospace.set_tag(*this, DEVICE_SELF, AS_ISA_IO);
- }
-}
-
-//-------------------------------------------------
-// device_resolve_objects - resolve objects that
-// may be needed for other devices to set
-// initial conditions at start time
+// device_start - device-specific startup
//-------------------------------------------------
-void isa8_device::device_resolve_objects()
+void isa8_device::device_start()
{
// resolve callbacks
m_write_iochck.resolve_safe();
@@ -235,16 +220,20 @@ void isa8_device::device_resolve_objects()
m_out_drq2_cb.resolve_safe();
m_out_drq3_cb.resolve_safe();
- m_iowidth = m_iospace->data_width();
- m_memwidth = m_memspace->data_width();
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void isa8_device::device_start()
-{
+ if (m_allocspaces)
+ {
+ m_iospace = &space(AS_ISA_IO);
+ m_memspace = &space(AS_ISA_MEM);
+ m_iowidth = m_iospace->data_width();
+ m_memwidth = m_memspace->data_width();
+ }
+ else // use host CPU's program and I/O spaces directly
+ {
+ m_iospace = &m_maincpu->space(AS_IO);
+ m_iowidth = m_maincpu->space_config(AS_IO)->data_width();
+ m_memspace = &m_maincpu->space(AS_PROGRAM);
+ m_memwidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
+ }
}
//-------------------------------------------------
@@ -263,12 +252,12 @@ template<typename R, typename W> void isa8_device::install_space(int spacenum, o
if (spacenum == AS_ISA_IO)
{
- space = m_iospace.target();
+ space = m_iospace;
buswidth = m_iowidth;
}
else if (spacenum == AS_ISA_MEM)
{
- space = m_memspace.target();
+ space = m_memspace;
buswidth = m_memwidth;
}
else
@@ -389,18 +378,12 @@ uint8_t isa8_device::dack_r(int line)
return 0xff;
}
-void isa8_device::dack_w(int line, uint8_t data)
+void isa8_device::dack_w(int line,uint8_t data)
{
if (m_dma_device[line])
return m_dma_device[line]->dack_w(line,data);
}
-void isa8_device::dack_line_w(int line, int state)
-{
- if (m_dma_device[line])
- m_dma_device[line]->dack_line_w(line, state);
-}
-
void isa8_device::eop_w(int channel, int state)
{
if (m_dma_eop[channel] && m_dma_device[channel])
@@ -409,9 +392,18 @@ void isa8_device::eop_w(int channel, int state)
void isa8_device::nmi()
{
- // active low pulse
- m_write_iochck(0);
- m_write_iochck(1);
+ if (m_write_iochck.isnull())
+ {
+ if (m_nmi_enabled)
+ {
+ m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
+ }
+ }
+ else
+ {
+ m_write_iochck(0);
+ m_write_iochck(1);
+ }
}
//**************************************************************************
@@ -446,15 +438,9 @@ uint8_t device_isa8_card_interface::dack_r(int line)
{
return 0;
}
-
-void device_isa8_card_interface::dack_w(int line, uint8_t data)
+void device_isa8_card_interface::dack_w(int line,uint8_t data)
{
}
-
-void device_isa8_card_interface::dack_line_w(int line, int state)
-{
-}
-
void device_isa8_card_interface::eop_w(int state)
{
}
@@ -607,7 +593,7 @@ uint16_t isa16_device::dack16_r(int line)
return 0xffff;
}
-void isa16_device::dack16_w(int line, uint16_t data)
+void isa16_device::dack16_w(int line,uint16_t data)
{
if (m_dma_device[line])
return dynamic_cast<device_isa16_card_interface *>(m_dma_device[line])->dack16_w(line,data);
@@ -661,6 +647,6 @@ uint16_t device_isa16_card_interface::dack16_r(int line)
return 0;
}
-void device_isa16_card_interface::dack16_w(int line, uint16_t data)
+void device_isa16_card_interface::dack16_w(int line,uint16_t data)
{
}
diff --git a/src/devices/bus/isa/isa.h b/src/devices/bus/isa/isa.h
index fff65de82f6..3dc15c9df59 100644
--- a/src/devices/bus/isa/isa.h
+++ b/src/devices/bus/isa/isa.h
@@ -123,8 +123,7 @@ public:
isa8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration
- template <typename T> void set_memspace(T &&tag, int spacenum) { m_memspace.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_iospace(T &&tag, int spacenum) { m_iospace.set_tag(std::forward<T>(tag), spacenum); }
+ template <typename T> void set_cputag(T &&tag) { m_maincpu.set_tag(std::forward<T>(tag)); }
auto iochck_callback() { return m_write_iochck.bind(); }
auto irq2_callback() { return m_out_irq2_cb.bind(); }
auto irq3_callback() { return m_out_irq3_cb.bind(); }
@@ -157,7 +156,7 @@ public:
bool is_option_rom_space_available(offs_t start, int size);
// FIXME: shouldn't need to expose this
- address_space &memspace() const { return *m_memspace; }
+ address_space &memspace() const { return m_maincpu->space(AS_PROGRAM); }
DECLARE_WRITE_LINE_MEMBER( irq2_w );
DECLARE_WRITE_LINE_MEMBER( irq3_w );
@@ -177,11 +176,11 @@ public:
DECLARE_WRITE8_MEMBER(io_w);
uint8_t dack_r(int line);
- void dack_w(int line, uint8_t data);
- void dack_line_w(int line, int state);
+ void dack_w(int line,uint8_t data);
void eop_w(int channels, int state);
void nmi();
+ void set_nmi_state(bool enabled) { m_nmi_enabled = enabled; }
virtual void set_dma_channel(uint8_t channel, device_isa8_card_interface *dev, bool do_eop);
@@ -197,14 +196,15 @@ protected:
template<typename R, typename W> void install_space(int spacenum, offs_t start, offs_t end, R rhandler, W whandler);
// device-level overrides
- virtual void device_config_complete() override;
- virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
+ // internal state
+ required_device<cpu_device> m_maincpu;
+
// address spaces
- required_address_space m_memspace, m_iospace;
- int m_memwidth, m_iowidth;
+ address_space *m_iospace, *m_memspace;
+ int m_iowidth, m_memwidth;
bool m_allocspaces;
devcb_write_line m_out_irq2_cb;
@@ -219,6 +219,7 @@ protected:
device_isa8_card_interface *m_dma_device[8];
bool m_dma_eop[8];
+ bool m_nmi_enabled;
std::forward_list<device_slot_interface *> m_slot_list;
private:
@@ -245,8 +246,7 @@ public:
void set_isa_device();
// configuration access
virtual uint8_t dack_r(int line);
- virtual void dack_w(int line, uint8_t data);
- virtual void dack_line_w(int line, int state);
+ virtual void dack_w(int line,uint8_t data);
virtual void eop_w(int state);
virtual void remap(int space_id, offs_t start, offs_t end) {}
@@ -325,7 +325,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( drq7_w );
uint16_t dack16_r(int line);
- void dack16_w(int line, uint16_t data);
+ void dack16_w(int line,uint16_t data);
virtual void remap(int space_id, offs_t start, offs_t end) override;
// 16 bit accessors for ISA-defined address spaces
@@ -370,7 +370,7 @@ public:
// construction/destruction
virtual ~device_isa16_card_interface();
virtual uint16_t dack16_r(int line);
- virtual void dack16_w(int line, uint16_t data);
+ virtual void dack16_w(int line,uint16_t data);
void set_isa_device();
diff --git a/src/devices/bus/isa/isa_cards.cpp b/src/devices/bus/isa/isa_cards.cpp
index 8ab0832c03d..fbbafc0bc69 100644
--- a/src/devices/bus/isa/isa_cards.cpp
+++ b/src/devices/bus/isa/isa_cards.cpp
@@ -31,16 +31,11 @@
#include "ide.h"
#include "xtide.h"
#include "side116.h"
-#include "aha1542b.h"
-#include "aha1542c.h"
-#include "aha174x.h"
+#include "aha1542.h"
#include "wd1002a_wx1.h"
#include "wd1007a.h"
#include "mcd.h"
#include "lbaenhancer.h"
-#include "cl_sh260.h"
-#include "bt54x.h"
-#include "dcb.h"
// sound
#include "adlib.h"
@@ -60,7 +55,6 @@
#include "ne2000.h"
#include "3c505.h"
#include "eis_sad8852.h"
-#include "np600.h"
// communication ports
#include "lpt.h"
@@ -156,13 +150,7 @@ void pc_isa16_cards(device_slot_interface &device)
// 16-bit
device.option_add("ide", ISA16_IDE);
device.option_add("ne2000", NE2000);
- device.option_add("aha1542a", AHA1542A);
- device.option_add("aha1542b", AHA1542B);
- device.option_add("aha1542c", AHA1542C);
- device.option_add("aha1542cf", AHA1542CF);
- device.option_add("aha1542cp", AHA1542CP);
- device.option_add("aha1740", AHA1740); // actually an EISA card
- device.option_add("aha1742a", AHA1742A); // actually an EISA card
+ device.option_add("aha1542", AHA1542);
device.option_add("gus",ISA16_GUS);
device.option_add("sblaster_16", ISA16_SOUND_BLASTER_16);
device.option_add("svga_s3", ISA16_SVGA_S3);
@@ -179,12 +167,5 @@ void pc_isa16_cards(device_slot_interface &device)
device.option_add("sb16_lle", ISA16_SB16);
device.option_add("mcd", ISA16_MCD);
device.option_add("sad8852", ISA16_SAD8852);
- device.option_add("np600a3", NP600A3);
device.option_add("wd1007a", WD1007A);
- device.option_add("ev346", EV346);
- device.option_add("jc1310", JC1310);
- device.option_add("bt542b", BT542B);
- device.option_add("bt542bh", BT542BH);
- device.option_add("bt545s", BT545S);
- device.option_add("dcb", NOVELL_DCB);
}
diff --git a/src/devices/bus/isa/lbaenhancer.cpp b/src/devices/bus/isa/lbaenhancer.cpp
index f8ebedb130c..14bd28826ef 100644
--- a/src/devices/bus/isa/lbaenhancer.cpp
+++ b/src/devices/bus/isa/lbaenhancer.cpp
@@ -84,10 +84,9 @@ const tiny_rom_entry *lba_enhancer_device::device_rom_region() const
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void lba_enhancer_device::device_add_mconfig(machine_config &config)
-{
-// lba_enhancer(config, "lba_enhancer", 0);
-}
+MACHINE_CONFIG_START( lba_enhancer_device::device_add_mconfig )
+// MCFG_DEVICE_ADD("lba_enhancer", lba_enhancer, 0)
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/isa/mc1502_fdc.cpp b/src/devices/bus/isa/mc1502_fdc.cpp
index 3f85534a72b..1b04c6be91e 100644
--- a/src/devices/bus/isa/mc1502_fdc.cpp
+++ b/src/devices/bus/isa/mc1502_fdc.cpp
@@ -12,6 +12,18 @@
#include "cpu/i86/i86.h"
#include "formats/pc_dsk.h"
+#define VERBOSE_DBG 0
+
+#define DBG_LOG(N,M,A) \
+ do { \
+ if(VERBOSE_DBG>=N) \
+ { \
+ if( M ) \
+ logerror("%11.6f: %-24s",machine().time().as_double(),(char*)M ); \
+ logerror A; \
+ } \
+ } while (0)
+
//**************************************************************************
// DEVICE DEFINITIONS
diff --git a/src/devices/bus/isa/mda.cpp b/src/devices/bus/isa/mda.cpp
index f1f6cae6257..35e382cc981 100644
--- a/src/devices/bus/isa/mda.cpp
+++ b/src/devices/bus/isa/mda.cpp
@@ -22,7 +22,7 @@
#define VERBOSE_MDA 0 /* MDA (Monochrome Display Adapter) */
-#define MDA_CLOCK 16.257_MHz_XTAL
+#define MDA_CLOCK 16257000
#define MDA_LOG(N,M,A) \
do { \
@@ -107,13 +107,12 @@ DEFINE_DEVICE_TYPE(ISA8_MDA, isa8_mda_device, "isa_ibm_mda", "IBM Monochrome Dis
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa8_mda_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, MDA_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_raw(MDA_CLOCK, 882, 0, 720, 370, 0, 350);
- screen.set_screen_update(MC6845_NAME, FUNC(mc6845_device::screen_update));
+MACHINE_CONFIG_START(isa8_mda_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( MDA_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_RAW_PARAMS(MDA_CLOCK, 882, 0, 720, 370, 0, 350 )
+ MCFG_SCREEN_UPDATE_DEVICE( MC6845_NAME, mc6845_device, screen_update )
- PALETTE(config, m_palette).set_entries(4);
+ MCFG_PALETTE_ADD( "palette", 4 )
MC6845(config, m_crtc, MDA_CLOCK/9);
m_crtc->set_screen(MDA_SCREEN_NAME);
@@ -123,11 +122,11 @@ void isa8_mda_device::device_add_mconfig(machine_config &config)
m_crtc->out_hsync_callback().set(FUNC(isa8_mda_device::hsync_changed));
m_crtc->out_vsync_callback().set(FUNC(isa8_mda_device::vsync_changed));
- GFXDECODE(config, "gfxdecode", m_palette, gfx_pcmda);
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pcmda)
PC_LPT(config, m_lpt);
m_lpt->irq_handler().set(FUNC(isa8_mda_device::pc_cpu_line));
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -463,10 +462,10 @@ WRITE8_MEMBER( isa8_mda_device::io_write)
switch( offset )
{
case 0: case 2: case 4: case 6:
- m_crtc->address_w(data);
+ m_crtc->address_w( space, offset, data );
break;
case 1: case 3: case 5: case 7:
- m_crtc->register_w(data);
+ m_crtc->register_w( space, offset, data );
break;
case 8:
mode_control_w(space, offset, data);
@@ -486,7 +485,7 @@ READ8_MEMBER( isa8_mda_device::io_read)
/* return last written mc6845 address value here? */
break;
case 1: case 3: case 5: case 7:
- data = m_crtc->register_r();
+ data = m_crtc->register_r( space, offset );
break;
case 10:
data = status_r(space, offset);
@@ -533,13 +532,12 @@ DEFINE_DEVICE_TYPE(ISA8_HERCULES, isa8_hercules_device, "isa_hercules", "Hercule
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa8_hercules_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, HERCULES_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_raw(MDA_CLOCK, 882, 0, 720, 370, 0, 350);
- screen.set_screen_update(MC6845_NAME, FUNC(mc6845_device::screen_update));
+MACHINE_CONFIG_START(isa8_hercules_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( HERCULES_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_RAW_PARAMS(MDA_CLOCK, 882, 0, 720, 370, 0, 350 )
+ MCFG_SCREEN_UPDATE_DEVICE( MC6845_NAME, mc6845_device, screen_update )
- PALETTE(config, m_palette).set_entries(4);
+ MCFG_PALETTE_ADD( "palette", 4 )
MC6845(config, m_crtc, MDA_CLOCK/9);
m_crtc->set_screen(HERCULES_SCREEN_NAME);
@@ -549,11 +547,11 @@ void isa8_hercules_device::device_add_mconfig(machine_config &config)
m_crtc->out_hsync_callback().set(FUNC(isa8_mda_device::hsync_changed));
m_crtc->out_vsync_callback().set(FUNC(isa8_mda_device::vsync_changed));
- GFXDECODE(config, "gfxdecode", m_palette, gfx_pcherc);
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pcherc)
PC_LPT(config, m_lpt);
m_lpt->irq_handler().set(FUNC(isa8_mda_device::pc_cpu_line));
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -679,10 +677,10 @@ WRITE8_MEMBER( isa8_hercules_device::io_write )
switch( offset )
{
case 0: case 2: case 4: case 6:
- m_crtc->address_w(data);
+ m_crtc->address_w( space, offset, data );
break;
case 1: case 3: case 5: case 7:
- m_crtc->register_w(data);
+ m_crtc->register_w( space, offset, data );
break;
case 8:
mode_control_w(space, offset, data);
@@ -726,7 +724,7 @@ READ8_MEMBER( isa8_hercules_device::io_read )
/* return last written mc6845 address value here? */
break;
case 1: case 3: case 5: case 7:
- data = m_crtc->register_r();
+ data = m_crtc->register_r( space, offset );
break;
case 10:
data = status_r(space, offset);
@@ -747,13 +745,12 @@ DEFINE_DEVICE_TYPE(ISA8_EC1840_0002, isa8_ec1840_0002_device, "ec1840_0002", "EC
//-------------------------------------------------
// XXX
-void isa8_ec1840_0002_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, MDA_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_raw(MDA_CLOCK, 792, 0, 640, 370, 0, 350);
- screen.set_screen_update(MC6845_NAME, FUNC(mc6845_device::screen_update));
+MACHINE_CONFIG_START(isa8_ec1840_0002_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( MDA_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_RAW_PARAMS(MDA_CLOCK, 792, 0, 640, 370, 0, 350 )
+ MCFG_SCREEN_UPDATE_DEVICE( MC6845_NAME, mc6845_device, screen_update )
- PALETTE(config, m_palette).set_entries(4);
+ MCFG_PALETTE_ADD( "palette", 4 )
MC6845(config, m_crtc, MDA_CLOCK/8);
m_crtc->set_screen(MDA_SCREEN_NAME);
@@ -762,7 +759,7 @@ void isa8_ec1840_0002_device::device_add_mconfig(machine_config &config)
m_crtc->set_update_row_callback(FUNC(isa8_mda_device::crtc_update_row), this);
m_crtc->out_hsync_callback().set(FUNC(isa8_mda_device::hsync_changed));
m_crtc->out_vsync_callback().set(FUNC(isa8_mda_device::vsync_changed));
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
// isa8_ec1840_0002_device - constructor
diff --git a/src/devices/bus/isa/mufdc.cpp b/src/devices/bus/isa/mufdc.cpp
index 3e40653e175..8930a080d8f 100644
--- a/src/devices/bus/isa/mufdc.cpp
+++ b/src/devices/bus/isa/mufdc.cpp
@@ -195,11 +195,6 @@ void mufdc_device::dack_w(int line, uint8_t data)
return m_fdc->dma_w(data);
}
-void mufdc_device::dack_line_w(int line, int state)
-{
- //m_fdc->dack_w(state);
-}
-
void mufdc_device::eop_w(int state)
{
m_fdc->tc_w(state == ASSERT_LINE);
diff --git a/src/devices/bus/isa/mufdc.h b/src/devices/bus/isa/mufdc.h
index 2fa000757e4..4d042a58834 100644
--- a/src/devices/bus/isa/mufdc.h
+++ b/src/devices/bus/isa/mufdc.h
@@ -47,7 +47,6 @@ protected:
// device_isa8_card_interface
virtual uint8_t dack_r(int line) override;
virtual void dack_w(int line, uint8_t data) override;
- virtual void dack_line_w(int line, int state) override;
virtual void eop_w(int state) override;
private:
diff --git a/src/devices/bus/isa/ne1000.cpp b/src/devices/bus/isa/ne1000.cpp
index 1eaef942105..7723ad75a88 100644
--- a/src/devices/bus/isa/ne1000.cpp
+++ b/src/devices/bus/isa/ne1000.cpp
@@ -6,13 +6,12 @@
DEFINE_DEVICE_TYPE(NE1000, ne1000_device, "ne1000", "NE1000 Network Adapter")
-void ne1000_device::device_add_mconfig(machine_config &config)
-{
- DP8390D(config, m_dp8390, 0);
- m_dp8390->irq_callback().set(FUNC(ne1000_device::ne1000_irq_w));
- m_dp8390->mem_read_callback().set(FUNC(ne1000_device::ne1000_mem_read));
- m_dp8390->mem_write_callback().set(FUNC(ne1000_device::ne1000_mem_write));
-}
+MACHINE_CONFIG_START(ne1000_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dp8390d", DP8390D, 0)
+ MCFG_DP8390D_IRQ_CB(WRITELINE(*this, ne1000_device, ne1000_irq_w))
+ MCFG_DP8390D_MEM_READ_CB(READ8(*this, ne1000_device, ne1000_mem_read))
+ MCFG_DP8390D_MEM_WRITE_CB(WRITE8(*this, ne1000_device, ne1000_mem_write))
+MACHINE_CONFIG_END
ne1000_device::ne1000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, NE1000, tag, owner, clock),
diff --git a/src/devices/bus/isa/ne2000.cpp b/src/devices/bus/isa/ne2000.cpp
index 3ad2cc592ef..5de941accc2 100644
--- a/src/devices/bus/isa/ne2000.cpp
+++ b/src/devices/bus/isa/ne2000.cpp
@@ -6,13 +6,12 @@
DEFINE_DEVICE_TYPE(NE2000, ne2000_device, "ne2000", "NE2000 Network Adapter")
-void ne2000_device::device_add_mconfig(machine_config &config)
-{
- DP8390D(config, m_dp8390, 0);
- m_dp8390->irq_callback().set(FUNC(ne2000_device::ne2000_irq_w));
- m_dp8390->mem_read_callback().set(FUNC(ne2000_device::ne2000_mem_read));
- m_dp8390->mem_write_callback().set(FUNC(ne2000_device::ne2000_mem_write));
-}
+MACHINE_CONFIG_START(ne2000_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dp8390d", DP8390D, 0)
+ MCFG_DP8390D_IRQ_CB(WRITELINE(*this, ne2000_device, ne2000_irq_w))
+ MCFG_DP8390D_MEM_READ_CB(READ8(*this, ne2000_device, ne2000_mem_read))
+ MCFG_DP8390D_MEM_WRITE_CB(WRITE8(*this, ne2000_device, ne2000_mem_write))
+MACHINE_CONFIG_END
ne2000_device::ne2000_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock)
: device_t(mconfig, NE2000, tag, owner, clock),
diff --git a/src/devices/bus/isa/np600.cpp b/src/devices/bus/isa/np600.cpp
deleted file mode 100644
index 064c1d40191..00000000000
--- a/src/devices/bus/isa/np600.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/*********************************************************************
-
- InterLan NP600 Intelligent Protocol Processor
-
-*********************************************************************/
-
-#include "emu.h"
-#include "np600.h"
-
-#include "cpu/i86/i186.h"
-#include "machine/74259.h"
-//#include "machine/i82586.h"
-
-DEFINE_DEVICE_TYPE(NP600A3, np600a3_device, "np600a3", "InterLan NP600A-3 Intelligent Protocol Processor")
-
-np600a3_device::np600a3_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, NP600A3, tag, owner, clock)
- , device_isa16_card_interface(mconfig, *this)
- , m_npcpu(*this, "npcpu")
-{
-}
-
-void np600a3_device::device_start()
-{
-}
-
-u16 np600a3_device::status_r()
-{
- return 0;
-}
-
-void np600a3_device::mem_map(address_map &map)
-{
- map(0x00000, 0x7ffff).ram(); // GM71256-12 x16
- map(0xfc000, 0xfffff).rom().region("npcpu", 0);
-}
-
-void np600a3_device::io_map(address_map &map)
-{
- map(0x0070, 0x007f).w("latch70", FUNC(ls259_device::write_a0));
- map(0x0080, 0x0081).r(FUNC(np600a3_device::status_r));
-}
-
-void np600a3_device::device_add_mconfig(machine_config &config)
-{
- I80186(config, m_npcpu, 16_MHz_XTAL);
- m_npcpu->set_addrmap(AS_PROGRAM, &np600a3_device::mem_map);
- m_npcpu->set_addrmap(AS_IO, &np600a3_device::io_map);
-
- LS259(config, "latch70"); // U28
-
- //I82586(config, "enet", 20_MHz_XTAL);
-}
-
-ROM_START(np600a3)
- ROM_REGION(0x4000, "npcpu", 0)
- ROM_LOAD16_BYTE("258-0032-00_rev_ba.u38", 0x0000, 0x2000, CRC(84ccb317) SHA1(3ecc8e265336f5d3b0f276f18dd1b7001778f2c3))
- ROM_LOAD16_BYTE("258-0033-00_rev_ba.u39", 0x0001, 0x2000, CRC(0e0f726c) SHA1(520773e235a826438b025381cd3861df86d4965d))
-
- // Undumped small devices (mostly or all PLDs):
- // 258-0037-00 REV AA (U17, 20 pins)
- // 258-0027-01 REV AB (U20, 20 pins)
- // 020701079BFA (U29, 16 pins)
- // 258-0031-00 REV AC (U34, PAL20xx, 24 pins)
- // 258-0030-00 REV AA (U36, 20 pins)
- // 258-0028-01 REV AA (U44, 20 pins)
- // 258-0029-01 REV AA (U46, 20 pins)
- // 258-0089-00 REV AA (U48, 20 pins)
-ROM_END
-
-const tiny_rom_entry *np600a3_device::device_rom_region() const
-{
- return ROM_NAME(np600a3);
-}
diff --git a/src/devices/bus/isa/np600.h b/src/devices/bus/isa/np600.h
deleted file mode 100644
index 7831d804922..00000000000
--- a/src/devices/bus/isa/np600.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/*********************************************************************
-
- InterLan NP600 Intelligent Protocol Processor
-
-*********************************************************************/
-
-#ifndef MAME_BUS_ISA_NP600_H
-#define MAME_BUS_ISA_NP600_H
-
-#pragma once
-
-#include "isa.h"
-
-class np600a3_device : public device_t, public device_isa16_card_interface
-{
-public:
- np600a3_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
- static constexpr feature_type unemulated_features() { return feature::LAN; }
-
-protected:
- virtual void device_start() override;
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-
-private:
- u16 status_r();
-
- void mem_map(address_map &map);
- void io_map(address_map &map);
-
- required_device<cpu_device> m_npcpu;
-};
-
-DECLARE_DEVICE_TYPE(NP600A3, np600a3_device)
-
-#endif // MAME_BUS_ISA_NP600_H
diff --git a/src/devices/bus/isa/num9rev.cpp b/src/devices/bus/isa/num9rev.cpp
index ebe44a379f4..baf30cca586 100644
--- a/src/devices/bus/isa/num9rev.cpp
+++ b/src/devices/bus/isa/num9rev.cpp
@@ -53,20 +53,19 @@ UPD7220_DISPLAY_PIXELS_MEMBER( isa8_number_9_rev_device::hgdc_display_pixels )
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa8_number_9_rev_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_size(512, 448);
- screen.set_visarea(0, 512-1, 0, 448-1);
- screen.set_refresh_hz(60);
- screen.set_screen_update(FUNC(isa8_number_9_rev_device::screen_update));
- PALETTE(config, m_palette).set_entries(4096);
+MACHINE_CONFIG_START(isa8_number_9_rev_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_SIZE(512, 448)
+ MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 448-1)
+ MCFG_SCREEN_REFRESH_RATE(60)
+ MCFG_SCREEN_UPDATE_DRIVER(isa8_number_9_rev_device, screen_update)
+ MCFG_PALETTE_ADD("palette", 4096)
UPD7220(config, m_upd7220, XTAL(4'433'619)/2); // unknown clock
m_upd7220->set_addrmap(0, &isa8_number_9_rev_device::upd7220_map);
- m_upd7220->set_display_pixels(FUNC(isa8_number_9_rev_device::hgdc_display_pixels));
+ m_upd7220->set_display_pixels_callback(FUNC(isa8_number_9_rev_device::hgdc_display_pixels), this);
m_upd7220->set_screen("screen");
-}
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
@@ -94,7 +93,7 @@ void isa8_number_9_rev_device::device_start()
{
set_isa_device();
- m_isa->install_memory(0xc0000, 0xc0001, read8sm_delegate(FUNC(upd7220_device::read), (upd7220_device *)m_upd7220), write8sm_delegate(FUNC(upd7220_device::write), (upd7220_device *)m_upd7220));
+ m_isa->install_memory(0xc0000, 0xc0001, read8_delegate(FUNC(upd7220_device::read), (upd7220_device *)m_upd7220), write8_delegate(FUNC(upd7220_device::write), (upd7220_device *)m_upd7220));
m_isa->install_memory(0xc0100, 0xc03ff, read8_delegate(FUNC(isa8_number_9_rev_device::pal8_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::pal8_w), this));
m_isa->install_memory(0xc0400, 0xc0401, read8_delegate(FUNC(isa8_number_9_rev_device::bank_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::bank_w), this));
m_isa->install_memory(0xc0500, 0xc06ff, read8_delegate(FUNC(isa8_number_9_rev_device::overlay_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::overlay_w), this));
diff --git a/src/devices/bus/isa/omti8621.cpp b/src/devices/bus/isa/omti8621.cpp
index bea87f420ee..9eebabb188f 100644
--- a/src/devices/bus/isa/omti8621.cpp
+++ b/src/devices/bus/isa/omti8621.cpp
@@ -1285,11 +1285,6 @@ void omti8621_device::dack_w(int line, uint8_t data)
return m_fdc->dma_w(data);
}
-void omti8621_device::dack_line_w(int line, int state)
-{
- //m_fdc->dack_w(state);
-}
-
void omti8621_device::eop_w(int state)
{
m_fdc->tc_w(state == ASSERT_LINE);
diff --git a/src/devices/bus/isa/omti8621.h b/src/devices/bus/isa/omti8621.h
index 1258af71854..070ae2dbe70 100644
--- a/src/devices/bus/isa/omti8621.h
+++ b/src/devices/bus/isa/omti8621.h
@@ -56,7 +56,6 @@ protected:
virtual uint8_t dack_r(int line) override;
virtual void dack_w(int line, uint8_t data) override;
- virtual void dack_line_w(int line, int state) override;
virtual void eop_w(int state) override;
void set_interrupt(enum line_state line_state);
diff --git a/src/devices/bus/isa/p1_fdc.cpp b/src/devices/bus/isa/p1_fdc.cpp
index 9b62451e65a..df53cdb7629 100644
--- a/src/devices/bus/isa/p1_fdc.cpp
+++ b/src/devices/bus/isa/p1_fdc.cpp
@@ -12,6 +12,18 @@
#include "cpu/i86/i86.h"
#include "formats/pc_dsk.h"
+#define VERBOSE_DBG 0
+
+#define DBG_LOG(N,M,A) \
+ do { \
+ if(VERBOSE_DBG>=N) \
+ { \
+ if( M ) \
+ logerror("%11.6f: %-24s",machine().time().as_double(),(char*)M ); \
+ logerror A; \
+ } \
+ } while (0)
+
//**************************************************************************
// DEVICE DEFINITIONS
@@ -75,6 +87,7 @@ const tiny_rom_entry *p1_fdc_device::device_rom_region() const
uint8_t p1_fdc_device::p1_wd17xx_motor_r()
{
+ DBG_LOG(1, "p1_fdc_motor_r", ("R = $%02x\n", 0));
// XXX always on for now
return 0;
}
@@ -105,6 +118,8 @@ uint8_t p1_fdc_device::p1_wd17xx_aux_r()
*/
void p1_fdc_device::p1_wd17xx_aux_w(int data)
{
+ DBG_LOG(1, "p1_fdc_aux_w", ("W $%02x\n", data));
+
floppy_image_device *floppy0 = m_fdc->subdevice<floppy_connector>("0")->get_device();
floppy_image_device *floppy1 = m_fdc->subdevice<floppy_connector>("1")->get_device();
floppy_image_device *floppy = ((data & 2) ? floppy1 : floppy0);
diff --git a/src/devices/bus/isa/p1_hdc.cpp b/src/devices/bus/isa/p1_hdc.cpp
index 129c7a6ce37..d0971e6c3c6 100644
--- a/src/devices/bus/isa/p1_hdc.cpp
+++ b/src/devices/bus/isa/p1_hdc.cpp
@@ -14,14 +14,17 @@
// MACROS / CONSTANTS
//**************************************************************************
-//#define LOG_GENERAL (1U << 0) //defined in logmacro.h already
-#define LOG_DEBUG (1U << 1)
+#define VERBOSE_DBG 1
-//#define VERBOSE (LOG_DEBUG)
-//#define LOG_OUTPUT_FUNC printf
-#include "logmacro.h"
-
-#define LOGDBG(...) LOGMASKED(LOG_DEBUG, __VA_ARGS__)
+#define DBG_LOG(N,M,A) \
+ do { \
+ if(VERBOSE_DBG>=N) \
+ { \
+ if( M ) \
+ logerror("%11.6f: %-24s",machine().time().as_double(),(char*)M ); \
+ logerror A; \
+ } \
+ } while (0)
//**************************************************************************
@@ -89,21 +92,20 @@ READ8_MEMBER(p1_hdc_device::p1_HDC_r)
switch (offset >> 8)
{
case 8:
- data = m_hdc->read(offset & 255);
+ data = m_hdc->read(space, offset & 255);
}
- LOG("hdc R $%04x == $%02x\n", offset, data);
+ DBG_LOG(1, "hdc", ("R $%04x == $%02x\n", offset, data));
return data;
}
WRITE8_MEMBER(p1_hdc_device::p1_HDC_w)
{
- LOG("hdc W $%04x <- $%02x\n", offset, data);
-
+ DBG_LOG(1, "hdc", ("W $%04x <- $%02x\n", offset, data));
switch (offset >> 8)
{
case 8:
- m_hdc->write(offset & 255, data);
+ m_hdc->write(space, offset & 255, data, 0);
}
}
diff --git a/src/devices/bus/isa/p1_sound.cpp b/src/devices/bus/isa/p1_sound.cpp
index b8e37a57368..485dca5205e 100644
--- a/src/devices/bus/isa/p1_sound.cpp
+++ b/src/devices/bus/isa/p1_sound.cpp
@@ -29,15 +29,15 @@ DEFINE_DEVICE_TYPE(P1_SOUND, p1_sound_device, "p1_sound", "Poisk-1 sound card (B
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void p1_sound_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(p1_sound_device::device_add_mconfig)
I8251(config, m_midi, 0);
m_midi->txd_handler().set("mdout", FUNC(midi_port_device::write_txd));
m_midi->rxrdy_handler().set(":isa", FUNC(isa8_device::irq3_w));
- MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(m_midi, FUNC(i8251_device::write_rxd));
+ MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
+ MCFG_MIDI_RX_HANDLER(WRITELINE("midi", i8251_device, write_rxd))
- MIDI_PORT(config, "mdout", midiout_slot, "midiout");
+ MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
PIT8253(config, m_d14, 0);
m_d14->set_clk<0>(XTAL(12'500'000)/10);
@@ -65,12 +65,12 @@ void p1_sound_device::device_add_mconfig(machine_config &config)
// m_d17->out_handler<2>().set(FUNC(XXX));
SPEAKER(config, "speaker").front_center();
- FILTER_RC(config, m_filter).add_route(ALL_OUTPUTS, "speaker", 1.0);
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "filter", 0.5); // unknown DAC
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
-}
+ MCFG_DEVICE_ADD("filter", FILTER_RC)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
+ MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "filter", 0.5) // unknown DAC
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT)
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/isa/pc1640_iga.cpp b/src/devices/bus/isa/pc1640_iga.cpp
index dfab59f2e76..04ef54c2d42 100644
--- a/src/devices/bus/isa/pc1640_iga.cpp
+++ b/src/devices/bus/isa/pc1640_iga.cpp
@@ -28,6 +28,8 @@
//**************************************************************************
#define PEGA1A_TAG "ic910"
+#define EGA_CRTC_NAME "crtc_ega_ega"
+
//**************************************************************************
@@ -101,6 +103,8 @@ void isa8_pc1640_iga_device::device_start()
m_plane[2] = m_videoram + 0x20000;
m_plane[3] = m_videoram + 0x30000;
+ m_crtc_ega = subdevice<crtc_ega_device>(EGA_CRTC_NAME);
+
m_isa->install_rom(this, 0xc0000, 0xc7fff, "ega", "iga");
m_isa->install_device(0x3b0, 0x3bf, read8_delegate(FUNC(isa8_ega_device::pc_ega8_3b0_r), this), write8_delegate(FUNC(isa8_ega_device::pc_ega8_3b0_w), this));
m_isa->install_device(0x3c0, 0x3cf, read8_delegate(FUNC(isa8_ega_device::pc_ega8_3c0_r), this), write8_delegate(FUNC(isa8_ega_device::pc_ega8_3c0_w), this));
diff --git a/src/devices/bus/isa/pds.cpp b/src/devices/bus/isa/pds.cpp
index 65a35db2b14..45dffd9904e 100644
--- a/src/devices/bus/isa/pds.cpp
+++ b/src/devices/bus/isa/pds.cpp
@@ -56,7 +56,6 @@ void isa8_pds_device::device_stop()
{
}
-void isa8_pds_device::device_add_mconfig(machine_config &config)
-{
- I8255(config, m_ppi);
-}
+MACHINE_CONFIG_START(isa8_pds_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("pds_ppi", I8255, 0)
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/isa/pgc.cpp b/src/devices/bus/isa/pgc.cpp
index d90badaeae7..ab242877e01 100644
--- a/src/devices/bus/isa/pgc.cpp
+++ b/src/devices/bus/isa/pgc.cpp
@@ -151,31 +151,30 @@ DEFINE_DEVICE_TYPE(ISA8_PGC, isa8_pgc_device, "isa_ibm_pgc", "IBM Professional G
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa8_pgc_device::device_add_mconfig(machine_config &config)
-{
- I8088(config, m_cpu, XTAL(24'000'000)/3);
- m_cpu->set_addrmap(AS_PROGRAM, &isa8_pgc_device::pgc_map);
+MACHINE_CONFIG_START(isa8_pgc_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("maincpu", I8088, XTAL(24'000'000)/3)
+ MCFG_DEVICE_PROGRAM_MAP(pgc_map)
#if 0
- m_cpu->set_irq_acknowledge_callback(FUNC(isa8_pgc_device::irq_callback));
+ MCFG_DEVICE_IRQ_ACKNOWLEDGE_DRIVER(isa8_pgc_device, irq_callback)
#endif
- timer_device &scantimer(TIMER(config, "scantimer"));
- scantimer.configure_periodic(FUNC(isa8_pgc_device::scanline_callback), attotime::from_hz(60*PGC_TOTAL_VERT));
- scantimer.set_start_delay(attotime::from_hz(XTAL(50'000'000)/(2*PGC_HORZ_START)));
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("scantimer", isa8_pgc_device, scanline_callback,
+ attotime::from_hz(60*PGC_TOTAL_VERT))
+ MCFG_TIMER_START_DELAY(attotime::from_hz(XTAL(50'000'000)/(2*PGC_HORZ_START)))
- SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
- m_screen->set_raw(XTAL(50'000'000)/2,
+ MCFG_SCREEN_ADD(PGC_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(50'000'000)/2,
PGC_TOTAL_HORZ, PGC_HORZ_START, PGC_HORZ_START+PGC_DISP_HORZ,
- PGC_TOTAL_VERT, PGC_VERT_START, PGC_VERT_START+PGC_DISP_VERT);
- m_screen->set_screen_update(FUNC(isa8_pgc_device::screen_update));
- m_screen->set_palette(m_palette);
+ PGC_TOTAL_VERT, PGC_VERT_START, PGC_VERT_START+PGC_DISP_VERT)
+ MCFG_SCREEN_UPDATE_DRIVER(isa8_pgc_device, screen_update)
+ MCFG_SCREEN_PALETTE("palette")
#if 0
- m_screen->screen_vblank().set(FUNC(isa8_pgc_device::vblank_irq));
+ MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, isa8_pgc_device, vblank_irq))
#endif
- GFXDECODE(config, "gfxdecode", m_palette, gfx_pgc);
- PALETTE(config, m_palette).set_entries(256);
-}
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pgc)
+ MCFG_PALETTE_ADD( "palette", 256 )
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/isa/sb16.cpp b/src/devices/bus/isa/sb16.cpp
index 6bce4b4198c..be8cce9c644 100644
--- a/src/devices/bus/isa/sb16.cpp
+++ b/src/devices/bus/isa/sb16.cpp
@@ -711,9 +711,9 @@ void sb16_lle_device::device_start()
m_isa->install_device(0x022c, 0x022d, read8_delegate(FUNC(sb16_lle_device::dsp_wbuf_status_r), this), write8_delegate(FUNC(sb16_lle_device::host_cmd_w), this) );
m_isa->install_device(0x022e, 0x022f, read8_delegate(FUNC(sb16_lle_device::dsp_rbuf_status_r), this), write8_delegate(FUNC(sb16_lle_device::invalid_w), this) );
m_isa->install_device(0x0330, 0x0331, read8_delegate(FUNC(sb16_lle_device::mpu401_r), this), write8_delegate(FUNC(sb16_lle_device::mpu401_w), this));
- m_isa->install_device(0x0388, 0x0389, read8sm_delegate(FUNC(ymf262_device::read), ymf262), write8sm_delegate(FUNC(ymf262_device::write), ymf262));
- m_isa->install_device(0x0220, 0x0223, read8sm_delegate(FUNC(ymf262_device::read), ymf262), write8sm_delegate(FUNC(ymf262_device::write), ymf262));
- m_isa->install_device(0x0228, 0x0229, read8sm_delegate(FUNC(ymf262_device::read), ymf262), write8sm_delegate(FUNC(ymf262_device::write), ymf262));
+ m_isa->install_device(0x0388, 0x0389, read8_delegate(FUNC(ymf262_device::read), ymf262), write8_delegate(FUNC(ymf262_device::write), ymf262));
+ m_isa->install_device(0x0220, 0x0223, read8_delegate(FUNC(ymf262_device::read), ymf262), write8_delegate(FUNC(ymf262_device::write), ymf262));
+ m_isa->install_device(0x0228, 0x0229, read8_delegate(FUNC(ymf262_device::read), ymf262), write8_delegate(FUNC(ymf262_device::write), ymf262));
m_isa->set_dma_channel(1, this, false);
m_isa->set_dma_channel(5, this, false);
m_timer = timer_alloc();
diff --git a/src/devices/bus/isa/sblaster.cpp b/src/devices/bus/isa/sblaster.cpp
index d8a47349918..74f1e0f8dd4 100644
--- a/src/devices/bus/isa/sblaster.cpp
+++ b/src/devices/bus/isa/sblaster.cpp
@@ -66,7 +66,7 @@ static const int m_cmd_fifo_length[256] =
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 6x */
-1, -1, -1, -1, 3, 3, 3, 3, -1, -1, -1, -1, -1, 1, -1, 1, /* 7x */
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 8x */
- 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 9x */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 9x */
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* Ax */
4, -1, -1, -1, -1, -1, 4, -1, 4, -1, -1, -1, -1, -1, 4, -1, /* Bx */
4, -1, -1, -1, -1, -1, 4, -1, 4, -1, -1, -1, -1, -1, 4, -1, /* Cx */
@@ -82,7 +82,7 @@ READ8_MEMBER( sb8_device::ym3812_16_r )
uint8_t retVal = 0xff;
switch(offset)
{
- case 0 : retVal = m_ym3812->status_port_r(); break;
+ case 0 : retVal = m_ym3812->status_port_r( space, offset ); break;
}
return retVal;
}
@@ -91,8 +91,8 @@ WRITE8_MEMBER( sb8_device::ym3812_16_w )
{
switch(offset)
{
- case 0 : m_ym3812->control_port_w(data); break;
- case 1 : m_ym3812->write_port_w(data); break;
+ case 0 : m_ym3812->control_port_w( space, offset, data ); break;
+ case 1 : m_ym3812->write_port_w( space, offset, data ); break;
}
}
@@ -356,7 +356,6 @@ void sb_device::process_fifo(uint8_t cmd)
break;
case 0x1c: // 8-bit DMA with autoinit
- case 0x90: // 8-bit DMA with autoinit, high speed. XXX only on DSP 3.xx
// printf("Start DMA (autoinit, size = %x)\n", m_dsp.dma_length);
m_dsp.dma_transferred = 0;
m_dsp.dma_autoinit = 1;
@@ -584,12 +583,6 @@ void sb_device::process_fifo(uint8_t cmd)
mode = m_dsp.fifo[1];
m_dsp.flags = 0;
m_dsp.dma_length = (m_dsp.fifo[2] + (m_dsp.fifo[3]<<8)) + 1;
- if(cmd & 0x04)
- m_dsp.dma_autoinit = 1;
- if(mode & 0x10)
- m_dsp.flags |= SIGNED;
- if(mode & 0x20)
- m_dsp.flags |= STEREO;
if((cmd & 0xf0) == 0xb0)
{
m_dsp.flags |= SIXTEENBIT;
@@ -598,6 +591,15 @@ void sb_device::process_fifo(uint8_t cmd)
}
else
drq_w(1);
+ if(cmd & 0x04)
+ m_dsp.dma_autoinit = 1;
+ if(mode & 0x10)
+ m_dsp.flags |= SIGNED;
+ if(mode & 0x20)
+ {
+ m_dsp.flags |= STEREO;
+ m_dsp.dma_length <<= 1;
+ }
m_dsp.dma_transferred = 0;
m_dsp.dma_timer_started = false;
m_dsp.dma_throttled = false;
@@ -1147,6 +1149,7 @@ void sb_device::common(machine_config &config)
DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // unknown DAC
DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref", 0));
+ vref.set_output(5.0);
vref.add_route(0, "ldac", 1.0, DAC_VREF_POS_INPUT);
vref.add_route(0, "ldac", -1.0, DAC_VREF_NEG_INPUT);
vref.add_route(0, "rdac", 1.0, DAC_VREF_POS_INPUT);
@@ -1260,9 +1263,9 @@ void sb8_device::device_start()
{
ymf262_device *ymf262 = subdevice<ymf262_device>("ymf262");
- m_isa->install_device(0x0388, 0x038b, read8sm_delegate(FUNC(ymf262_device::read), ymf262), write8sm_delegate(FUNC(ymf262_device::write), ymf262));
- m_isa->install_device(0x0220, 0x0223, read8sm_delegate(FUNC(ymf262_device::read), ymf262), write8sm_delegate(FUNC(ymf262_device::write), ymf262));
- m_isa->install_device(0x0228, 0x0229, read8sm_delegate(FUNC(ymf262_device::read), ymf262), write8sm_delegate(FUNC(ymf262_device::write), ymf262));
+ m_isa->install_device(0x0388, 0x038b, read8_delegate(FUNC(ymf262_device::read), ymf262), write8_delegate(FUNC(ymf262_device::write), ymf262));
+ m_isa->install_device(0x0220, 0x0223, read8_delegate(FUNC(ymf262_device::read), ymf262), write8_delegate(FUNC(ymf262_device::write), ymf262));
+ m_isa->install_device(0x0228, 0x0229, read8_delegate(FUNC(ymf262_device::read), ymf262), write8_delegate(FUNC(ymf262_device::write), ymf262));
}
else
{
@@ -1303,9 +1306,9 @@ void sb16_device::device_start()
m_isa->install_device(0x022e, 0x022f, read8_delegate(FUNC(sb_device::dsp_rbuf_status_r), this), write8_delegate(FUNC(sb_device::dsp_rbuf_status_w), this) );
m_isa->install_device(0x0224, 0x0225, read8_delegate(FUNC(sb16_device::mixer_r), this), write8_delegate(FUNC(sb16_device::mixer_w), this));
m_isa->install_device(0x0330, 0x0331, read8_delegate(FUNC(sb16_device::mpu401_r), this), write8_delegate(FUNC(sb16_device::mpu401_w), this));
- m_isa->install_device(0x0388, 0x038b, read8sm_delegate(FUNC(ymf262_device::read), ymf262), write8sm_delegate(FUNC(ymf262_device::write), ymf262));
- m_isa->install_device(0x0220, 0x0223, read8sm_delegate(FUNC(ymf262_device::read), ymf262), write8sm_delegate(FUNC(ymf262_device::write), ymf262));
- m_isa->install_device(0x0228, 0x0229, read8sm_delegate(FUNC(ymf262_device::read), ymf262), write8sm_delegate(FUNC(ymf262_device::write), ymf262));
+ m_isa->install_device(0x0388, 0x038b, read8_delegate(FUNC(ymf262_device::read), ymf262), write8_delegate(FUNC(ymf262_device::write), ymf262));
+ m_isa->install_device(0x0220, 0x0223, read8_delegate(FUNC(ymf262_device::read), ymf262), write8_delegate(FUNC(ymf262_device::write), ymf262));
+ m_isa->install_device(0x0228, 0x0229, read8_delegate(FUNC(ymf262_device::read), ymf262), write8_delegate(FUNC(ymf262_device::write), ymf262));
save_item(NAME(m_mixer.data));
save_item(NAME(m_mixer.status));
diff --git a/src/devices/bus/isa/sc499.cpp b/src/devices/bus/isa/sc499.cpp
index 92f049f0402..e9ace1ddb83 100644
--- a/src/devices/bus/isa/sc499.cpp
+++ b/src/devices/bus/isa/sc499.cpp
@@ -177,10 +177,9 @@ static INPUT_PORTS_START( sc499_port )
INPUT_PORTS_END
-void sc499_device::device_add_mconfig(machine_config &config)
-{
- SC499_CTAPE(config, m_image, 0);
-}
+MACHINE_CONFIG_START(sc499_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(SC499_CTAPE_TAG, SC499_CTAPE, 0)
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/isa/ssi2001.cpp b/src/devices/bus/isa/ssi2001.cpp
index 2c433321847..55adf04b0a2 100644
--- a/src/devices/bus/isa/ssi2001.cpp
+++ b/src/devices/bus/isa/ssi2001.cpp
@@ -30,7 +30,7 @@ void ssi2001_device::device_start()
{
set_isa_device();
m_isa->install_device(0x0200, 0x0207, read8_delegate(FUNC(pc_joy_device::joy_port_r), subdevice<pc_joy_device>("pc_joy")), write8_delegate(FUNC(pc_joy_device::joy_port_w), subdevice<pc_joy_device>("pc_joy")));
- m_isa->install_device(0x0280, 0x029F, read8sm_delegate(FUNC(mos6581_device::read), subdevice<mos6581_device>("sid6581")), write8sm_delegate(FUNC(mos6581_device::write), subdevice<mos6581_device>("sid6581")));
+ m_isa->install_device(0x0280, 0x029F, read8_delegate(FUNC(mos6581_device::read), subdevice<mos6581_device>("sid6581")), write8_delegate(FUNC(mos6581_device::write), subdevice<mos6581_device>("sid6581")));
}
diff --git a/src/devices/bus/isa/stereo_fx.cpp b/src/devices/bus/isa/stereo_fx.cpp
index b23a0dbe454..c38d3aace80 100644
--- a/src/devices/bus/isa/stereo_fx.cpp
+++ b/src/devices/bus/isa/stereo_fx.cpp
@@ -134,6 +134,7 @@ void stereo_fx_device::device_add_mconfig(machine_config &config)
DAC_8BIT_R2R(config, "ldac", 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // unknown DAC
DAC_8BIT_R2R(config, "rdac", 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref", 0));
+ vref.set_output(5.0);
vref.add_route(0, "ldac", 1.0, DAC_VREF_POS_INPUT);
vref.add_route(0, "ldac", -1.0, DAC_VREF_NEG_INPUT);
vref.add_route(0, "rdac", 1.0, DAC_VREF_POS_INPUT);
@@ -215,8 +216,8 @@ void stereo_fx_device::device_start()
m_isa->install_device(0x022a, 0x022b, read8_delegate(FUNC(stereo_fx_device::dsp_data_r), this), write8_delegate(FUNC(stereo_fx_device::invalid_w), this) );
m_isa->install_device(0x022c, 0x022d, read8_delegate(FUNC(stereo_fx_device::dsp_wbuf_status_r), this), write8_delegate(FUNC(stereo_fx_device::dsp_cmd_w), this) );
m_isa->install_device(0x022e, 0x022f, read8_delegate(FUNC(stereo_fx_device::dsp_rbuf_status_r), this), write8_delegate(FUNC(stereo_fx_device::invalid_w), this) );
- m_isa->install_device(0x0388, 0x0389, read8sm_delegate(FUNC(ym3812_device::read), ym3812), write8sm_delegate(FUNC(ym3812_device::write), ym3812));
- m_isa->install_device(0x0228, 0x0229, read8sm_delegate(FUNC(ym3812_device::read), ym3812), write8sm_delegate(FUNC(ym3812_device::write), ym3812));
+ m_isa->install_device(0x0388, 0x0389, read8_delegate(FUNC(ym3812_device::read), ym3812), write8_delegate(FUNC(ym3812_device::write), ym3812));
+ m_isa->install_device(0x0228, 0x0229, read8_delegate(FUNC(ym3812_device::read), ym3812), write8_delegate(FUNC(ym3812_device::write), ym3812));
m_timer = timer_alloc();
m_timer->adjust(attotime::from_hz(2000000), 0, attotime::from_hz(2000000));
m_isa->set_dma_channel(1, this, false);
diff --git a/src/devices/bus/isa/svga_cirrus.cpp b/src/devices/bus/isa/svga_cirrus.cpp
index bcb6b4995a1..444acac7c1a 100644
--- a/src/devices/bus/isa/svga_cirrus.cpp
+++ b/src/devices/bus/isa/svga_cirrus.cpp
@@ -30,14 +30,14 @@ DEFINE_DEVICE_TYPE(ISA16_SVGA_CIRRUS_GD542X, isa16_svga_cirrus_gd542x_device, "c
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa16_svga_cirrus_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480);
- screen.set_screen_update("vga", FUNC(cirrus_gd5430_device::screen_update));
+MACHINE_CONFIG_START(isa16_svga_cirrus_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(25'174'800),900,0,640,526,0,480)
+ MCFG_SCREEN_UPDATE_DEVICE("vga", cirrus_gd5430_device, screen_update)
- CIRRUS_GD5430(config, "vga", 0).set_screen("screen");
-}
+ MCFG_DEVICE_ADD("vga", CIRRUS_GD5430, 0)
+ MCFG_VIDEO_SET_SCREEN("screen")
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -110,14 +110,14 @@ ROM_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa16_svga_cirrus_gd542x_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480);
- screen.set_screen_update("vga", FUNC(cirrus_gd5428_device::screen_update));
+MACHINE_CONFIG_START(isa16_svga_cirrus_gd542x_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(25'174'800),900,0,640,526,0,480)
+ MCFG_SCREEN_UPDATE_DEVICE("vga", cirrus_gd5428_device, screen_update)
- CIRRUS_GD5428(config, "vga", 0).set_screen("screen");
-}
+ MCFG_DEVICE_ADD("vga", CIRRUS_GD5428, 0)
+ MCFG_VIDEO_SET_SCREEN("screen")
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/isa/svga_s3.cpp b/src/devices/bus/isa/svga_s3.cpp
index d5a2cde30bf..1c97abc3b62 100644
--- a/src/devices/bus/isa/svga_s3.cpp
+++ b/src/devices/bus/isa/svga_s3.cpp
@@ -40,14 +40,14 @@ DEFINE_DEVICE_TYPE(ISA16_SVGA_S3, isa16_svga_s3_device, "s3_764", "Number Nine 9
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa16_svga_s3_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480);
- screen.set_screen_update("vga", FUNC(s3_vga_device::screen_update));
+MACHINE_CONFIG_START(isa16_svga_s3_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(25'174'800),900,0,640,526,0,480)
+ MCFG_SCREEN_UPDATE_DEVICE("vga", s3_vga_device, screen_update)
- S3_VGA(config, "vga", 0).set_screen("screen");
-}
+ MCFG_DEVICE_ADD("vga", S3_VGA, 0)
+ MCFG_VIDEO_SET_SCREEN("screen")
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -146,14 +146,14 @@ DEFINE_DEVICE_TYPE(ISA16_S3VIRGE, isa16_s3virge_device, "s3virge", "S3 ViRGE Gra
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa16_s3virge_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480);
- screen.set_screen_update("vga", FUNC(s3virge_vga_device::screen_update));
+MACHINE_CONFIG_START(isa16_s3virge_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(25'174'800),900,0,640,526,0,480)
+ MCFG_SCREEN_UPDATE_DEVICE("vga", s3virge_vga_device, screen_update)
- S3VIRGE(config, "vga", 0).set_screen("screen");
-}
+ MCFG_DEVICE_ADD("vga", S3VIRGE, 0)
+ MCFG_VIDEO_SET_SCREEN("screen")
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -227,14 +227,14 @@ DEFINE_DEVICE_TYPE(ISA16_S3VIRGEDX, isa16_s3virgedx_device, "s3virgedx", "S3 ViR
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa16_s3virgedx_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480);
- screen.set_screen_update("vga", FUNC(s3virgedx_vga_device::screen_update));
+MACHINE_CONFIG_START(isa16_s3virgedx_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(25'174'800),900,0,640,526,0,480)
+ MCFG_SCREEN_UPDATE_DEVICE("vga", s3virgedx_vga_device, screen_update)
- S3VIRGEDX(config, "vga", 0).set_screen("screen");
-}
+ MCFG_DEVICE_ADD("vga", S3VIRGEDX, 0)
+ MCFG_VIDEO_SET_SCREEN("screen")
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -309,14 +309,14 @@ DEFINE_DEVICE_TYPE(ISA16_DMS3D2KPRO, isa16_stealth3d2kpro_device, "dms3d2kp", "D
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa16_stealth3d2kpro_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480);
- screen.set_screen_update("vga", FUNC(s3virgedx_rev1_vga_device::screen_update));
+MACHINE_CONFIG_START(isa16_stealth3d2kpro_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(25'174'800),900,0,640,526,0,480)
+ MCFG_SCREEN_UPDATE_DEVICE("vga", s3virgedx_rev1_vga_device, screen_update)
- S3VIRGEDX1(config, "vga", 0).set_screen("screen");
-}
+ MCFG_DEVICE_ADD("vga", S3VIRGEDX1, 0)
+ MCFG_VIDEO_SET_SCREEN("screen")
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/isa/svga_trident.cpp b/src/devices/bus/isa/svga_trident.cpp
index aa7fc90b489..79aa1dfd55f 100644
--- a/src/devices/bus/isa/svga_trident.cpp
+++ b/src/devices/bus/isa/svga_trident.cpp
@@ -30,14 +30,14 @@ DEFINE_DEVICE_TYPE(ISA16_SVGA_TGUI9680, isa16_svga_tgui9680_device, "tgui9680",
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa16_svga_tgui9680_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480);
- screen.set_screen_update("vga", FUNC(trident_vga_device::screen_update));
-
- TRIDENT_VGA(config, "vga", 0).set_screen("screen");
-}
+MACHINE_CONFIG_START(isa16_svga_tgui9680_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(25'174'800),900,0,640,526,0,480)
+ MCFG_SCREEN_UPDATE_DEVICE("vga", trident_vga_device, screen_update)
+
+ MCFG_DEVICE_ADD("vga", TRIDENT_VGA, 0)
+ MCFG_VIDEO_SET_SCREEN("screen")
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/isa/svga_tseng.cpp b/src/devices/bus/isa/svga_tseng.cpp
index dfe39a39d8e..fd232b01d8d 100644
--- a/src/devices/bus/isa/svga_tseng.cpp
+++ b/src/devices/bus/isa/svga_tseng.cpp
@@ -29,14 +29,14 @@ DEFINE_DEVICE_TYPE(ISA8_SVGA_ET4K, isa8_svga_et4k_device, "et4000", "SVGA Tseng
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa8_svga_et4k_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480);
- screen.set_screen_update("vga", FUNC(tseng_vga_device::screen_update));
-
- TSENG_VGA(config, "vga", 0).set_screen("screen");
-}
+MACHINE_CONFIG_START(isa8_svga_et4k_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(25'174'800),900,0,640,526,0,480)
+ MCFG_SCREEN_UPDATE_DEVICE("vga", tseng_vga_device, screen_update)
+
+ MCFG_DEVICE_ADD("vga", TSENG_VGA, 0)
+ MCFG_VIDEO_SET_SCREEN("screen")
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/isa/vga.cpp b/src/devices/bus/isa/vga.cpp
index 0419ecdd255..b8a86adbfe3 100644
--- a/src/devices/bus/isa/vga.cpp
+++ b/src/devices/bus/isa/vga.cpp
@@ -27,14 +27,14 @@ DEFINE_DEVICE_TYPE(ISA8_VGA, isa8_vga_device, "ibm_vga", "IBM VGA Graphics Card"
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa8_vga_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480);
- screen.set_screen_update("vga", FUNC(vga_device::screen_update));
-
- VGA(config, "vga", 0).set_screen("screen");
-}
+MACHINE_CONFIG_START(isa8_vga_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(25'174'800),900,0,640,526,0,480)
+ MCFG_SCREEN_UPDATE_DEVICE("vga", vga_device, screen_update)
+
+ MCFG_DEVICE_ADD("vga", VGA, 0)
+ MCFG_VIDEO_SET_SCREEN("screen")
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/isa/vga_ati.cpp b/src/devices/bus/isa/vga_ati.cpp
index bad1a47a479..650a686d4fc 100644
--- a/src/devices/bus/isa/vga_ati.cpp
+++ b/src/devices/bus/isa/vga_ati.cpp
@@ -76,33 +76,32 @@ DEFINE_DEVICE_TYPE(ISA16_SVGA_MACH64, isa16_vga_mach64_device, "mach64
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void isa16_vga_gfxultra_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480);
- screen.set_screen_update("vga", FUNC(ati_vga_device::screen_update));
-
- ATI_VGA(config, "vga", 0).set_screen("screen");
-}
-
-void isa16_vga_gfxultrapro_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480);
- screen.set_screen_update("vga", FUNC(mach32_device::screen_update));
-
- ATIMACH32(config, "vga", 0).set_screen("screen");
-}
-
-void isa16_vga_mach64_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480);
- screen.set_screen_update("vga", FUNC(mach64_device::screen_update));
-
- ATIMACH64(config, "vga", 0).set_screen("screen");
-}
-
+MACHINE_CONFIG_START(isa16_vga_gfxultra_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(25'174'800),900,0,640,526,0,480)
+ MCFG_SCREEN_UPDATE_DEVICE("vga", ati_vga_device, screen_update)
+
+ MCFG_DEVICE_ADD("vga", ATI_VGA, 0)
+ MCFG_VIDEO_SET_SCREEN("screen")
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(isa16_vga_gfxultrapro_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(25'174'800),900,0,640,526,0,480)
+ MCFG_SCREEN_UPDATE_DEVICE("vga", mach32_device, screen_update)
+
+ MCFG_DEVICE_ADD("vga", ATIMACH32, 0)
+ MCFG_VIDEO_SET_SCREEN("screen")
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(isa16_vga_mach64_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(25'174'800),900,0,640,526,0,480)
+ MCFG_SCREEN_UPDATE_DEVICE("vga", mach64_device, screen_update)
+
+ MCFG_DEVICE_ADD("vga", ATIMACH64, 0)
+ MCFG_VIDEO_SET_SCREEN("screen")
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/isa/wd1007a.cpp b/src/devices/bus/isa/wd1007a.cpp
index 22d9863e392..3db2db1d776 100644
--- a/src/devices/bus/isa/wd1007a.cpp
+++ b/src/devices/bus/isa/wd1007a.cpp
@@ -45,10 +45,9 @@ wd1007a_device::wd1007a_device(const machine_config &mconfig, const char *tag, d
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void wd1007a_device::device_add_mconfig(machine_config &config)
-{
- AM8753(config, "mcu", 10_MHz_XTAL);
-}
+MACHINE_CONFIG_START(wd1007a_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("mcu", AM8753, 10_MHz_XTAL)
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/isa/wdxt_gen.cpp b/src/devices/bus/isa/wdxt_gen.cpp
index 57dec00af89..690bc161f7f 100644
--- a/src/devices/bus/isa/wdxt_gen.cpp
+++ b/src/devices/bus/isa/wdxt_gen.cpp
@@ -237,16 +237,6 @@ void wdxt_gen_device::dack_w(int line, uint8_t data)
//-------------------------------------------------
-// dack_line_w -
-//-------------------------------------------------
-
-void wdxt_gen_device::dack_line_w(int line, int state)
-{
- m_host->dack3_w(state);
-}
-
-
-//-------------------------------------------------
// wd1015_t1_r -
//-------------------------------------------------
diff --git a/src/devices/bus/isa/wdxt_gen.h b/src/devices/bus/isa/wdxt_gen.h
index d909b7bd155..89d3aa5774f 100644
--- a/src/devices/bus/isa/wdxt_gen.h
+++ b/src/devices/bus/isa/wdxt_gen.h
@@ -52,7 +52,6 @@ protected:
// device_isa8_card_interface
virtual uint8_t dack_r(int line) override;
virtual void dack_w(int line, uint8_t data) override;
- virtual void dack_line_w(int line, int state) override;
private:
DECLARE_WRITE_LINE_MEMBER( irq5_w );
diff --git a/src/devices/bus/isbx/compis_fdc.cpp b/src/devices/bus/isbx/compis_fdc.cpp
index fea0e7f59b5..e1d464a37c2 100644
--- a/src/devices/bus/isbx/compis_fdc.cpp
+++ b/src/devices/bus/isbx/compis_fdc.cpp
@@ -106,14 +106,14 @@ void compis_fdc_device::device_reset()
// mcs0_r - chip select 0 read
//-------------------------------------------------
-uint8_t compis_fdc_device::mcs0_r(offs_t offset)
+uint8_t compis_fdc_device::mcs0_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
switch (BIT(offset, 0))
{
- case 0: data = m_fdc->msr_r(); break;
- case 1: data = m_fdc->fifo_r(); break;
+ case 0: data = m_fdc->msr_r(space, 0); break;
+ case 1: data = m_fdc->fifo_r(space, 0); break;
}
return data;
@@ -124,11 +124,11 @@ uint8_t compis_fdc_device::mcs0_r(offs_t offset)
// mcs0_w - chip select 0 write
//-------------------------------------------------
-void compis_fdc_device::mcs0_w(offs_t offset, uint8_t data)
+void compis_fdc_device::mcs0_w(address_space &space, offs_t offset, uint8_t data)
{
switch (BIT(offset, 0))
{
- case 1: m_fdc->fifo_w(data); break;
+ case 1: m_fdc->fifo_w(space, 0, data); break;
}
}
@@ -137,7 +137,7 @@ void compis_fdc_device::mcs0_w(offs_t offset, uint8_t data)
// mdack_r - DMA acknowledge read
//-------------------------------------------------
-uint8_t compis_fdc_device::mdack_r(offs_t offset)
+uint8_t compis_fdc_device::mdack_r(address_space &space, offs_t offset)
{
return m_fdc->dma_r();
}
@@ -147,7 +147,7 @@ uint8_t compis_fdc_device::mdack_r(offs_t offset)
// mdack_w - DMA acknowledge write
//-------------------------------------------------
-void compis_fdc_device::mdack_w(offs_t offset, uint8_t data)
+void compis_fdc_device::mdack_w(address_space &space, offs_t offset, uint8_t data)
{
m_fdc->dma_w(data);
}
diff --git a/src/devices/bus/isbx/compis_fdc.h b/src/devices/bus/isbx/compis_fdc.h
index af1d71a3af2..7f33cdd1160 100644
--- a/src/devices/bus/isbx/compis_fdc.h
+++ b/src/devices/bus/isbx/compis_fdc.h
@@ -40,10 +40,10 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_isbx_card_interface overrides
- virtual uint8_t mcs0_r(offs_t offset) override;
- virtual void mcs0_w(offs_t offset, uint8_t data) override;
- virtual uint8_t mdack_r(offs_t offset) override;
- virtual void mdack_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t mcs0_r(address_space &space, offs_t offset) override;
+ virtual void mcs0_w(address_space &space, offs_t offset, uint8_t data) override;
+ virtual uint8_t mdack_r(address_space &space, offs_t offset) override;
+ virtual void mdack_w(address_space &space, offs_t offset, uint8_t data) override;
virtual void opt0_w(int state) override;
virtual void opt1_w(int state) override;
diff --git a/src/devices/bus/isbx/isbc_218a.cpp b/src/devices/bus/isbx/isbc_218a.cpp
index 0a1cff5f235..9b142fa95ae 100644
--- a/src/devices/bus/isbx/isbc_218a.cpp
+++ b/src/devices/bus/isbx/isbc_218a.cpp
@@ -111,14 +111,14 @@ void isbc_218a_device::device_reset()
// mcs0_r - chip select 0 read
//-------------------------------------------------
-uint8_t isbc_218a_device::mcs0_r(offs_t offset)
+uint8_t isbc_218a_device::mcs0_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
switch (BIT(offset, 0))
{
- case 0: data = m_fdc->msr_r(); break;
- case 1: data = m_fdc->fifo_r(); break;
+ case 0: data = m_fdc->msr_r(space, 0); break;
+ case 1: data = m_fdc->fifo_r(space, 0); break;
}
return data;
@@ -129,11 +129,11 @@ uint8_t isbc_218a_device::mcs0_r(offs_t offset)
// mcs0_w - chip select 0 write
//-------------------------------------------------
-void isbc_218a_device::mcs0_w(offs_t offset, uint8_t data)
+void isbc_218a_device::mcs0_w(address_space &space, offs_t offset, uint8_t data)
{
switch (BIT(offset, 0))
{
- case 1: m_fdc->fifo_w(data); break;
+ case 1: m_fdc->fifo_w(space, 0, data); break;
}
}
@@ -142,7 +142,7 @@ void isbc_218a_device::mcs0_w(offs_t offset, uint8_t data)
// mcs1_r - chip select 1 read
//-------------------------------------------------
-uint8_t isbc_218a_device::mcs1_r(offs_t offset)
+uint8_t isbc_218a_device::mcs1_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
@@ -159,7 +159,7 @@ uint8_t isbc_218a_device::mcs1_r(offs_t offset)
// mcs1_w - chip select 1 write
//-------------------------------------------------
-void isbc_218a_device::mcs1_w(offs_t offset, uint8_t data)
+void isbc_218a_device::mcs1_w(address_space &space, offs_t offset, uint8_t data)
{
switch (offset)
{
@@ -182,7 +182,7 @@ void isbc_218a_device::mcs1_w(offs_t offset, uint8_t data)
// mdack_r - DMA acknowledge read
//-------------------------------------------------
-uint8_t isbc_218a_device::mdack_r(offs_t offset)
+uint8_t isbc_218a_device::mdack_r(address_space &space, offs_t offset)
{
return m_fdc->dma_r();
}
@@ -192,7 +192,7 @@ uint8_t isbc_218a_device::mdack_r(offs_t offset)
// mdack_w - DMA acknowledge write
//-------------------------------------------------
-void isbc_218a_device::mdack_w(offs_t offset, uint8_t data)
+void isbc_218a_device::mdack_w(address_space &space, offs_t offset, uint8_t data)
{
m_fdc->dma_w(data);
}
diff --git a/src/devices/bus/isbx/isbc_218a.h b/src/devices/bus/isbx/isbc_218a.h
index bdf37c52806..5d0a617e989 100644
--- a/src/devices/bus/isbx/isbc_218a.h
+++ b/src/devices/bus/isbx/isbc_218a.h
@@ -40,12 +40,12 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_isbx_card_interface overrides
- virtual uint8_t mcs0_r(offs_t offset) override;
- virtual void mcs0_w(offs_t offset, uint8_t data) override;
- virtual uint8_t mcs1_r(offs_t offset) override;
- virtual void mcs1_w(offs_t offset, uint8_t data) override;
- virtual uint8_t mdack_r(offs_t offset) override;
- virtual void mdack_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t mcs0_r(address_space &space, offs_t offset) override;
+ virtual void mcs0_w(address_space &space, offs_t offset, uint8_t data) override;
+ virtual uint8_t mcs1_r(address_space &space, offs_t offset) override;
+ virtual void mcs1_w(address_space &space, offs_t offset, uint8_t data) override;
+ virtual uint8_t mdack_r(address_space &space, offs_t offset) override;
+ virtual void mdack_w(address_space &space, offs_t offset, uint8_t data) override;
virtual void opt0_w(int state) override;
private:
diff --git a/src/devices/bus/isbx/isbx.h b/src/devices/bus/isbx/isbx.h
index 0535e461cd7..d62d9515fe1 100644
--- a/src/devices/bus/isbx/isbx.h
+++ b/src/devices/bus/isbx/isbx.h
@@ -47,12 +47,12 @@ class isbx_slot_device;
class device_isbx_card_interface : public device_slot_card_interface
{
public:
- virtual uint8_t mcs0_r(offs_t offset) { return 0xff; }
- virtual void mcs0_w(offs_t offset, uint8_t data) { }
- virtual uint8_t mcs1_r(offs_t offset) { return 0xff; }
- virtual void mcs1_w(offs_t offset, uint8_t data) { }
- virtual uint8_t mdack_r(offs_t offset) { return 0xff; }
- virtual void mdack_w(offs_t offset, uint8_t data) { }
+ virtual uint8_t mcs0_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void mcs0_w(address_space &space, offs_t offset, uint8_t data) { }
+ virtual uint8_t mcs1_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void mcs1_w(address_space &space, offs_t offset, uint8_t data) { }
+ virtual uint8_t mdack_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void mdack_w(address_space &space, offs_t offset, uint8_t data) { }
virtual int opt0_r() { return 1; }
virtual void opt0_w(int state) { }
virtual int opt1_r() { return 1; }
@@ -92,12 +92,12 @@ public:
auto mwait() { return m_write_mwait.bind(); }
// computer interface
- uint8_t mcs0_r(offs_t offset) { return m_card ? m_card->mcs0_r(offset) : 0xff; }
- void mcs0_w(offs_t offset, uint8_t data) { if (m_card) m_card->mcs0_w(offset, data); }
- uint8_t mcs1_r(offs_t offset) { return m_card ? m_card->mcs1_r(offset) : 0xff; }
- void mcs1_w(offs_t offset, uint8_t data) { if (m_card) m_card->mcs1_w(offset, data); }
- uint8_t mdack_r(offs_t offset) { return m_card ? m_card->mdack_r(offset) : 0xff; }
- void mdack_w(offs_t offset, uint8_t data) { if (m_card) m_card->mdack_w(offset, data); }
+ DECLARE_READ8_MEMBER( mcs0_r ) { return m_card ? m_card->mcs0_r(space, offset) : 0xff; }
+ DECLARE_WRITE8_MEMBER( mcs0_w ) { if (m_card) m_card->mcs0_w(space, offset, data); }
+ DECLARE_READ8_MEMBER( mcs1_r ) { return m_card ? m_card->mcs1_r(space, offset) : 0xff; }
+ DECLARE_WRITE8_MEMBER( mcs1_w ) { if (m_card) m_card->mcs1_w(space, offset, data); }
+ DECLARE_READ8_MEMBER( mdack_r ) { return m_card ? m_card->mdack_r(space, offset) : 0xff; }
+ DECLARE_WRITE8_MEMBER( mdack_w ) { if (m_card) m_card->mdack_w(space, offset, data); }
DECLARE_READ_LINE_MEMBER( mpst_r ) { return m_card == nullptr; }
DECLARE_READ_LINE_MEMBER( opt0_r ) { return m_card ? m_card->opt0_r() : 1; }
DECLARE_WRITE_LINE_MEMBER( opt0_w ) { if (m_card) m_card->opt0_w(state); }
diff --git a/src/devices/bus/jakks_gamekey/rom.cpp b/src/devices/bus/jakks_gamekey/rom.cpp
deleted file mode 100644
index 0ca9b7024d9..00000000000
--- a/src/devices/bus/jakks_gamekey/rom.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Haywood
-
-#include "emu.h"
-#include "rom.h"
-
-//-------------------------------------------------
-// jakks_gamekey_rom_device - constructor
-//-------------------------------------------------
-
-DEFINE_DEVICE_TYPE(JAKKS_GAMEKEY_ROM_PLAIN, jakks_gamekey_rom_plain_device, "jakks_gamekey_rom_plain", "JAKKS Pacific GameKey")
-DEFINE_DEVICE_TYPE(JAKKS_GAMEKEY_ROM_I2C_BASE, jakks_gamekey_rom_i2c_base_device, "jakks_gamekey_rom_i2c_base", "JAKKS Pacific GameKey with I2C")
-DEFINE_DEVICE_TYPE(JAKKS_GAMEKEY_ROM_I2C_24LC04, jakks_gamekey_rom_i2c_24lc04_device, "jakks_gamekey_rom_i2c_24lc04", "JAKKS Pacific GameKey with I2C 24LC04")
-
-
-jakks_gamekey_rom_plain_device::jakks_gamekey_rom_plain_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_jakks_gamekey_interface(mconfig, *this)
-{
-}
-
-jakks_gamekey_rom_plain_device::jakks_gamekey_rom_plain_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- jakks_gamekey_rom_plain_device(mconfig, JAKKS_GAMEKEY_ROM_PLAIN, tag, owner, clock)
-{
-}
-
-jakks_gamekey_rom_i2c_base_device::jakks_gamekey_rom_i2c_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
- jakks_gamekey_rom_plain_device(mconfig, type, tag, owner, clock),
- m_i2cmem(*this, "i2cmem")
-{
-}
-
-jakks_gamekey_rom_i2c_base_device::jakks_gamekey_rom_i2c_base_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- jakks_gamekey_rom_i2c_base_device(mconfig, JAKKS_GAMEKEY_ROM_I2C_BASE, tag, owner, clock)
-{
-}
-
-jakks_gamekey_rom_i2c_24lc04_device::jakks_gamekey_rom_i2c_24lc04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- jakks_gamekey_rom_i2c_base_device(mconfig, JAKKS_GAMEKEY_ROM_I2C_24LC04, tag, owner, clock)
-{
-}
-
-/*-------------------------------------------------
- mapper specific handlers
- -------------------------------------------------*/
-
-// plain
-
-READ16_MEMBER(jakks_gamekey_rom_plain_device::read_cart)
-{
- return read_rom(space, offset, mem_mask);
-}
-
-READ16_MEMBER(jakks_gamekey_rom_plain_device::read_rom)
-{
- return m_rom[offset & (m_rom_size-1)];
-}
-
-WRITE16_MEMBER(jakks_gamekey_rom_plain_device::write_cart)
-{
- write_rom(space, offset, data, mem_mask);
-}
-
-WRITE16_MEMBER(jakks_gamekey_rom_plain_device::write_rom)
-{
- logerror("jakks_gamekey_rom_plain_device::write_rom %08x %02x\n", offset, data);
-}
-
-// i2c base
-
-WRITE16_MEMBER(jakks_gamekey_rom_i2c_base_device::write_rom)
-{
- logerror("jakks_gamekey_rom_i2c_base_device::write_rom %08x %02x\n", offset, data);
-}
-
-READ16_MEMBER(jakks_gamekey_rom_i2c_base_device::read_rom)
-{
- return m_rom[offset & (m_rom_size - 1)];
-}
-
-uint8_t jakks_gamekey_rom_i2c_base_device::read_cart_seeprom(void)
-{
- logerror("jakks_gamekey_rom_i2c_base_device::read_cart_seeprom\n");
-
- return m_i2cmem->read_sda();
-}
-
-WRITE16_MEMBER(jakks_gamekey_rom_i2c_base_device::write_cart_seeprom)
-{
- if (BIT(mem_mask, 1))
- m_i2cmem->write_scl(BIT(data, 1));
- if (BIT(mem_mask, 0))
- m_i2cmem->write_sda(BIT(data, 0));
-}
-
-// i2c 24lc04
-
-void jakks_gamekey_rom_i2c_24lc04_device::device_add_mconfig(machine_config &config)
-{
- I2CMEM(config, "i2cmem", 0)/*.set_page_size(16)*/.set_data_size(0x200); // 24LC04
-}
-
-
-/*-------------------------------------------------
- slot interface
- -------------------------------------------------*/
-
-void jakks_gamekey(device_slot_interface &device)
-{
- device.option_add_internal("plain", JAKKS_GAMEKEY_ROM_PLAIN);
- device.option_add_internal("rom_24lc04", JAKKS_GAMEKEY_ROM_I2C_24LC04);
-}
diff --git a/src/devices/bus/jakks_gamekey/rom.h b/src/devices/bus/jakks_gamekey/rom.h
deleted file mode 100644
index 7f85e9f21fb..00000000000
--- a/src/devices/bus/jakks_gamekey/rom.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Haywood
-#ifndef MAME_BUS_JAKKS_GAMEKEY_ROM_H
-#define MAME_BUS_JAKKS_GAMEKEY_ROM_H
-
-#pragma once
-
-#include "slot.h"
-#include "machine/i2cmem.h"
-
-// ======================> jakks_gamekey_rom_plain_device
-
-class jakks_gamekey_rom_plain_device : public device_t,
- public device_jakks_gamekey_interface
-{
-public:
- // construction/destruction
- jakks_gamekey_rom_plain_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- // reading and writing
- virtual DECLARE_READ16_MEMBER(read_cart) override;
- virtual DECLARE_WRITE16_MEMBER(write_cart) override;
-
- virtual uint8_t read_cart_seeprom(void) override { return 1; };
- virtual DECLARE_WRITE16_MEMBER(write_cart_seeprom) override { };
-
- virtual READ16_MEMBER(read_rom);
- virtual WRITE16_MEMBER(write_rom);
-
-protected:
- jakks_gamekey_rom_plain_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
- // device-level overrides
- virtual void device_start() override { }
- virtual void device_reset() override { }
-};
-
-// ======================> jakks_gamekey_rom_i2c_base_device
-
-class jakks_gamekey_rom_i2c_base_device : public jakks_gamekey_rom_plain_device
-{
-public:
- // construction/destruction
- jakks_gamekey_rom_i2c_base_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- jakks_gamekey_rom_i2c_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
- // reading and writing
- virtual READ16_MEMBER(read_rom) override;
- virtual WRITE16_MEMBER(write_rom) override;
-
- optional_device<i2cmem_device> m_i2cmem;
-
- virtual uint8_t read_cart_seeprom(void) override;
- virtual DECLARE_WRITE16_MEMBER(write_cart_seeprom) override;
-};
-
-
-// ======================> jakks_gamekey_rom_i2c_24lc04_device
-
-class jakks_gamekey_rom_i2c_24lc04_device : public jakks_gamekey_rom_i2c_base_device
-{
-public:
- // construction/destruction
- jakks_gamekey_rom_i2c_24lc04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- virtual void device_add_mconfig(machine_config &config) override;
-};
-
-// device type definition
-DECLARE_DEVICE_TYPE(JAKKS_GAMEKEY_ROM_PLAIN, jakks_gamekey_rom_plain_device)
-DECLARE_DEVICE_TYPE(JAKKS_GAMEKEY_ROM_I2C_BASE, jakks_gamekey_rom_i2c_base_device)
-DECLARE_DEVICE_TYPE(JAKKS_GAMEKEY_ROM_I2C_24LC04, jakks_gamekey_rom_i2c_24lc04_device)
-
-#endif // MAME_BUS_JAKKS_GAMEKEY_ROM_H
diff --git a/src/devices/bus/jakks_gamekey/slot.cpp b/src/devices/bus/jakks_gamekey/slot.cpp
deleted file mode 100644
index 6a5196875b1..00000000000
--- a/src/devices/bus/jakks_gamekey/slot.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Haywood
-
-#include "emu.h"
-#include "slot.h"
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(JAKKS_GAMEKEY_SLOT, jakks_gamekey_slot_device, "jakks_gamekey_slot", "JAKKS Pacific Gamekey Slot")
-
-//**************************************************************************
-// JAKKS GAMEKEY cartridges Interface
-//**************************************************************************
-
-//-------------------------------------------------
-// device_jakks_gamekey_interface - constructor
-//-------------------------------------------------
-
-device_jakks_gamekey_interface::device_jakks_gamekey_interface(const machine_config &mconfig, device_t &device)
- : device_slot_card_interface(mconfig, device),
- m_rom(nullptr),
- m_rom_size(0)
-{
-}
-
-
-//-------------------------------------------------
-// ~device_jakks_gamekey_interface - destructor
-//-------------------------------------------------
-
-device_jakks_gamekey_interface::~device_jakks_gamekey_interface()
-{
-}
-
-//-------------------------------------------------
-// rom_alloc - alloc the space for the cart
-//-------------------------------------------------
-
-void device_jakks_gamekey_interface::rom_alloc(uint32_t size, const char *tag)
-{
- if (m_rom == nullptr)
- {
- m_rom = device().machine().memory().region_alloc(std::string(tag).append(JAKKSSLOT_ROM_REGION_TAG).c_str(), size, 1, ENDIANNESS_BIG)->base();
- m_rom_size = size;
- }
-}
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// jakks_gamekey_slot_device - constructor
-//-------------------------------------------------
-jakks_gamekey_slot_device::jakks_gamekey_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, JAKKS_GAMEKEY_SLOT, tag, owner, clock),
- device_image_interface(mconfig, *this),
- device_slot_interface(mconfig, *this),
- m_type(JAKKS_GAMEKEY_PLAIN),
- m_cart(nullptr)
-{
-}
-
-//-------------------------------------------------
-// jakks_gamekey_slot_device - destructor
-//-------------------------------------------------
-
-jakks_gamekey_slot_device::~jakks_gamekey_slot_device()
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void jakks_gamekey_slot_device::device_start()
-{
- m_cart = dynamic_cast<device_jakks_gamekey_interface *>(get_card_device());
-}
-
-//-------------------------------------------------
-// JAKKS GAMEKEY PCB
-//-------------------------------------------------
-
-struct jakks_gamekey_slot
-{
- int pcb_id;
- const char *slot_option;
-};
-
-// Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it
-static const jakks_gamekey_slot slot_list[] =
-{
- { JAKKS_GAMEKEY_PLAIN, "plain" },
- { JAKKS_GAMEKEY_I2C_BASE, "i2c_base" },
- { JAKKS_GAMEKEY_I2C_24LC04, "rom_24lc04" },
-};
-
-static int jakks_gamekey_get_pcb_id(const char *slot)
-{
- for (auto & elem : slot_list)
- {
- if (!core_stricmp(elem.slot_option, slot))
- return elem.pcb_id;
- }
-
- return 0;
-}
-
-static const char *jakks_gamekey_get_slot(int type)
-{
- for (auto & elem : slot_list)
- {
- if (elem.pcb_id == type)
- return elem.slot_option;
- }
-
- return "plain";
-}
-
-
-/*-------------------------------------------------
- call load
- -------------------------------------------------*/
-
-image_init_result jakks_gamekey_slot_device::call_load()
-{
- if (m_cart)
- {
- uint8_t *ROM;
- uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
-
- m_cart->rom_alloc(len, tag());
-
- ROM = m_cart->get_rom_base();
-
- if (!loaded_through_softlist())
- fread(ROM, len);
- else
- memcpy(ROM, get_software_region("rom"), len);
-
- if (!loaded_through_softlist())
- {
- // attempt to detect cart type without softlist assistance
- m_type = get_cart_type(ROM, len);
- }
- else
- {
- // or for softlist loading, use the type specified
- const char *pcb_name = get_feature("slot");
- if (pcb_name)
- m_type = jakks_gamekey_get_pcb_id(pcb_name);
- }
-
- return image_init_result::PASS;
- }
-
- return image_init_result::PASS;
-}
-
-
-/*-------------------------------------------------
- get_cart_type - code to detect cart type from
- fullpath
- -------------------------------------------------*/
-
-int jakks_gamekey_slot_device::get_cart_type(const uint8_t *ROM, uint32_t len)
-{
- // without code analysis we have no way of knowing.
- int type = JAKKS_GAMEKEY_PLAIN;
- return type;
-}
-
-
-/*-------------------------------------------------
- get default card software
- -------------------------------------------------*/
-
-std::string jakks_gamekey_slot_device::get_default_card_software(get_default_card_software_hook &hook) const
-{
- if (hook.image_file())
- {
- const char *slot_string;
- uint32_t len = hook.image_file()->size();
- std::vector<uint8_t> rom(len);
- int type;
-
- hook.image_file()->read(&rom[0], len);
-
- type = get_cart_type(&rom[0], len);
- slot_string = jakks_gamekey_get_slot(type);
-
- printf("type: %s\n", slot_string);
-
- return std::string(slot_string);
- }
-
- return software_get_default_slot("plain");
-}
-
-/*-------------------------------------------------
- read
- -------------------------------------------------*/
-
-READ16_MEMBER(jakks_gamekey_slot_device::read_cart)
-{
- return m_cart->read_cart(space, offset);
-}
-
-/*-------------------------------------------------
- write
- -------------------------------------------------*/
-
-WRITE16_MEMBER(jakks_gamekey_slot_device::write_cart)
-{
- m_cart->write_cart(space, offset, data);
-}
-
-/*-------------------------------------------------
- read seeprom
- -------------------------------------------------*/
-
-uint8_t jakks_gamekey_slot_device::read_cart_seeprom(void)
-{
- return m_cart->read_cart_seeprom();
-}
-
-/*-------------------------------------------------
- write seeprom
- -------------------------------------------------*/
-
-WRITE16_MEMBER(jakks_gamekey_slot_device::write_cart_seeprom)
-{
- m_cart->write_cart_seeprom(space, offset, data);
-}
diff --git a/src/devices/bus/jakks_gamekey/slot.h b/src/devices/bus/jakks_gamekey/slot.h
deleted file mode 100644
index 8fd0961aad8..00000000000
--- a/src/devices/bus/jakks_gamekey/slot.h
+++ /dev/null
@@ -1,119 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Haywood
-#ifndef MAME_BUS_JAKKS_GAMEKEY_SLOT_H
-#define MAME_BUS_JAKKS_GAMEKEY_SLOT_H
-
-#pragma once
-
-#include "softlist_dev.h"
-
-/***************************************************************************
- TYPE DEFINITIONS
- ***************************************************************************/
-
-/* PCB */
-enum
-{
- JAKKS_GAMEKEY_PLAIN = 0,
- JAKKS_GAMEKEY_I2C_BASE,
- JAKKS_GAMEKEY_I2C_24LC04,
-};
-
-// ======================> device_jakks_gamekey_interface
-
-class device_jakks_gamekey_interface : public device_slot_card_interface
-{
-public:
- // construction/destruction
- virtual ~device_jakks_gamekey_interface();
-
- // reading and writing
- virtual DECLARE_READ16_MEMBER(read_cart) { return 0xffff; }
- virtual DECLARE_WRITE16_MEMBER(write_cart) { }
-
- virtual uint8_t read_cart_seeprom(void) { return 1; }
- virtual DECLARE_WRITE16_MEMBER(write_cart_seeprom) { }
-
- void rom_alloc(uint32_t size, const char *tag);
- uint8_t* get_rom_base() { return m_rom; }
- uint32_t get_rom_size() { return m_rom_size; }
-
-protected:
- device_jakks_gamekey_interface(const machine_config &mconfig, device_t &device);
-
- // internal state
- uint8_t *m_rom;
- uint32_t m_rom_size;
-};
-
-// ======================> jakks_gamekey_slot_device
-
-class jakks_gamekey_slot_device : public device_t,
- public device_image_interface,
- public device_slot_interface
-{
-public:
- // construction/destruction
- jakks_gamekey_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- template <typename T>
- jakks_gamekey_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&opts, const char *dflt)
- : jakks_gamekey_slot_device(mconfig, tag, owner, clock)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- virtual ~jakks_gamekey_slot_device();
-
- // image-level overrides
- virtual image_init_result call_load() override;
- virtual void call_unload() override {}
- virtual const software_list_loader &get_software_list_loader() const override { return rom_software_list_loader::instance(); }
-
- int get_type() { return m_type; }
- static int get_cart_type(const uint8_t *ROM, uint32_t len);
-
- virtual iodevice_t image_type() const override { return IO_CARTSLOT; }
- virtual bool is_readable() const override { return 1; }
- virtual bool is_writeable() const override { return 0; }
- virtual bool is_creatable() const override { return 0; }
- virtual bool must_be_loaded() const override { return 0; }
- virtual bool is_reset_on_load() const override { return 1; }
- virtual const char *image_interface() const override { return "jakks_gamekey"; }
- virtual const char *file_extensions() const override { return "bin,u1"; }
-
- // slot interface overrides
- virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
-
- // reading and writing
- virtual DECLARE_READ16_MEMBER(read_cart);
- virtual DECLARE_WRITE16_MEMBER(write_cart);
-
- virtual uint8_t read_cart_seeprom(void);
- virtual DECLARE_WRITE16_MEMBER(write_cart_seeprom);
-
- bool has_cart() { return m_cart ? true : false; }
-
-protected:
- // device-level overrides
- virtual void device_start() override;
-
- int m_type;
- device_jakks_gamekey_interface* m_cart;
-};
-
-// device type definition
-DECLARE_DEVICE_TYPE(JAKKS_GAMEKEY_SLOT, jakks_gamekey_slot_device)
-
-/***************************************************************************
- DEVICE CONFIGURATION MACROS
- ***************************************************************************/
-
-#define JAKKSSLOT_ROM_REGION_TAG ":cart:rom"
-
-void jakks_gamekey(device_slot_interface &device);
-
-#endif // MAME_BUS_JAKKS_GAMEKEY_SLOT_H
diff --git a/src/devices/bus/kc/d002.cpp b/src/devices/bus/kc/d002.cpp
index 03dc9fb8f3b..24a361a8f2d 100644
--- a/src/devices/bus/kc/d002.cpp
+++ b/src/devices/bus/kc/d002.cpp
@@ -109,36 +109,40 @@ void kc_d002_device::device_reset()
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void kc_d002_device::device_add_mconfig(machine_config &config)
-{
- KCCART_SLOT(config, m_expansions[0], kc85_cart, nullptr);
- m_expansions[0]->set_next_slot("m4");
- m_expansions[0]->irq().set(FUNC(kc_d002_device::out_irq_w));
- m_expansions[0]->nmi().set(FUNC(kc_d002_device::out_nmi_w));
- m_expansions[0]->halt().set(FUNC(kc_d002_device::out_halt_w));
- KCCART_SLOT(config, m_expansions[1], kc85_cart, nullptr);
- m_expansions[1]->set_next_slot("m8");
- m_expansions[1]->irq().set(FUNC(kc_d002_device::out_irq_w));
- m_expansions[1]->nmi().set(FUNC(kc_d002_device::out_nmi_w));
- m_expansions[1]->halt().set(FUNC(kc_d002_device::out_halt_w));
- KCCART_SLOT(config, m_expansions[2], kc85_cart, nullptr);
- m_expansions[2]->set_next_slot("mc");
- m_expansions[2]->irq().set(FUNC(kc_d002_device::out_irq_w));
- m_expansions[2]->nmi().set(FUNC(kc_d002_device::out_nmi_w));
- m_expansions[2]->halt().set(FUNC(kc_d002_device::out_halt_w));
- KCCART_SLOT(config, m_expansions[3], kc85_cart, nullptr);
- m_expansions[3]->set_next_slot("exp");
- m_expansions[3]->irq().set(FUNC(kc_d002_device::out_irq_w));
- m_expansions[3]->nmi().set(FUNC(kc_d002_device::out_nmi_w));
- m_expansions[3]->halt().set(FUNC(kc_d002_device::out_halt_w));
+MACHINE_CONFIG_START(kc_d002_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("m0", KCCART_SLOT, 0)
+ MCFG_DEVICE_SLOT_INTERFACE(kc85_cart, nullptr, false)
+ MCFG_KCCART_SLOT_NEXT_SLOT("m4")
+ MCFG_KCCART_SLOT_OUT_IRQ_CB(WRITELINE(*this, kc_d002_device, out_irq_w))
+ MCFG_KCCART_SLOT_OUT_NMI_CB(WRITELINE(*this, kc_d002_device, out_nmi_w))
+ MCFG_KCCART_SLOT_OUT_HALT_CB(WRITELINE(*this, kc_d002_device, out_halt_w))
+ MCFG_DEVICE_ADD("m4", KCCART_SLOT, 0)
+ MCFG_DEVICE_SLOT_INTERFACE(kc85_cart, nullptr, false)
+ MCFG_KCCART_SLOT_NEXT_SLOT("m8")
+ MCFG_KCCART_SLOT_OUT_IRQ_CB(WRITELINE(*this, kc_d002_device, out_irq_w))
+ MCFG_KCCART_SLOT_OUT_NMI_CB(WRITELINE(*this, kc_d002_device, out_nmi_w))
+ MCFG_KCCART_SLOT_OUT_HALT_CB(WRITELINE(*this, kc_d002_device, out_halt_w))
+ MCFG_DEVICE_ADD("m8", KCCART_SLOT, 0)
+ MCFG_DEVICE_SLOT_INTERFACE(kc85_cart, nullptr, false)
+ MCFG_KCCART_SLOT_NEXT_SLOT("mc")
+ MCFG_KCCART_SLOT_OUT_IRQ_CB(WRITELINE(*this, kc_d002_device, out_irq_w))
+ MCFG_KCCART_SLOT_OUT_NMI_CB(WRITELINE(*this, kc_d002_device, out_nmi_w))
+ MCFG_KCCART_SLOT_OUT_HALT_CB(WRITELINE(*this, kc_d002_device, out_halt_w))
+ MCFG_DEVICE_ADD("mc", KCCART_SLOT, 0)
+ MCFG_DEVICE_SLOT_INTERFACE(kc85_cart, nullptr, false)
+ MCFG_KCCART_SLOT_NEXT_SLOT("exp")
+ MCFG_KCCART_SLOT_OUT_IRQ_CB(WRITELINE(*this, kc_d002_device, out_irq_w))
+ MCFG_KCCART_SLOT_OUT_NMI_CB(WRITELINE(*this, kc_d002_device, out_nmi_w))
+ MCFG_KCCART_SLOT_OUT_HALT_CB(WRITELINE(*this, kc_d002_device, out_halt_w))
// expansion interface
- KCCART_SLOT(config, m_expansions[4], kc85_exp, nullptr);
- m_expansions[4]->set_next_slot(nullptr);
- m_expansions[4]->irq().set(FUNC(kc_d002_device::out_irq_w));
- m_expansions[4]->nmi().set(FUNC(kc_d002_device::out_nmi_w));
- m_expansions[4]->halt().set(FUNC(kc_d002_device::out_halt_w));
-}
+ MCFG_DEVICE_ADD("exp", KCCART_SLOT, 0)
+ MCFG_DEVICE_SLOT_INTERFACE(kc85_exp, nullptr, false)
+ MCFG_KCEXP_SLOT_NEXT_SLOT(nullptr)
+ MCFG_KCEXP_SLOT_OUT_IRQ_CB(WRITELINE(*this, kc_d002_device, out_irq_w))
+ MCFG_KCEXP_SLOT_OUT_NMI_CB(WRITELINE(*this, kc_d002_device, out_nmi_w))
+ MCFG_KCEXP_SLOT_OUT_HALT_CB(WRITELINE(*this, kc_d002_device, out_halt_w))
+MACHINE_CONFIG_END
//-------------------------------------------------
// input_ports - device-specific input ports
diff --git a/src/devices/bus/kc/d004.cpp b/src/devices/bus/kc/d004.cpp
index f07b6de1695..188166640cd 100644
--- a/src/devices/bus/kc/d004.cpp
+++ b/src/devices/bus/kc/d004.cpp
@@ -33,7 +33,7 @@ void kc_d004_device::kc_d004_io(address_map &map)
map.unmap_value_high();
map.global_mask(0xff);
map(0xf0, 0xf1).m(UPD765_TAG, FUNC(upd765a_device::map));
- map(0xf2, 0xf3).rw(UPD765_TAG, FUNC(upd765a_device::dma_r), FUNC(upd765a_device::dma_w));
+ map(0xf2, 0xf3).rw(UPD765_TAG, FUNC(upd765a_device::mdma_r), FUNC(upd765a_device::mdma_w));
map(0xf4, 0xf4).r(FUNC(kc_d004_device::hw_input_gate_r));
map(0xf6, 0xf7).w(FUNC(kc_d004_device::fdd_select_w));
map(0xf8, 0xf9).w(FUNC(kc_d004_device::hw_terminal_count_w));
@@ -45,7 +45,7 @@ void kc_d004_gide_device::kc_d004_gide_io(address_map &map)
map.unmap_value_high();
map(0x0000, 0xffff).rw(FUNC(kc_d004_gide_device::gide_r), FUNC(kc_d004_gide_device::gide_w));
map(0x00f0, 0x00f1).mirror(0xff00).m(UPD765_TAG, FUNC(upd765a_device::map));
- map(0x00f2, 0x00f3).mirror(0xff00).rw(UPD765_TAG, FUNC(upd765a_device::dma_r), FUNC(upd765a_device::dma_w));
+ map(0x00f2, 0x00f3).mirror(0xff00).rw(UPD765_TAG, FUNC(upd765a_device::mdma_r), FUNC(upd765a_device::mdma_w));
map(0x00f4, 0x00f4).mirror(0xff00).r(FUNC(kc_d004_gide_device::hw_input_gate_r));
map(0x00f6, 0x00f7).mirror(0xff00).w(FUNC(kc_d004_gide_device::fdd_select_w));
map(0x00f8, 0x00f9).mirror(0xff00).w(FUNC(kc_d004_gide_device::hw_terminal_count_w));
diff --git a/src/devices/bus/kc/kc.h b/src/devices/bus/kc/kc.h
index 0c14a8ef5d3..0689169c5ee 100644
--- a/src/devices/bus/kc/kc.h
+++ b/src/devices/bus/kc/kc.h
@@ -48,21 +48,12 @@ class kcexp_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- kcexp_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : kcexp_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
kcexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~kcexp_slot_device();
- auto irq() { return m_out_irq_cb.bind(); }
- auto nmi() { return m_out_nmi_cb.bind(); }
- auto halt() { return m_out_halt_cb.bind(); }
+ template <class Object> devcb_base &set_out_irq_callback(Object &&cb) { return m_out_irq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_nmi_callback(Object &&cb) { return m_out_nmi_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_halt_callback(Object &&cb) { return m_out_halt_cb.set_callback(std::forward<Object>(cb)); }
// inline configuration
void set_next_slot(const char *next_module_tag) { m_next_slot_tag = next_module_tag; }
@@ -100,15 +91,6 @@ class kccart_slot_device : public kcexp_slot_device,
{
public:
// construction/destruction
- template <typename T>
- kccart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : kccart_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
kccart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~kccart_slot_device();
@@ -133,4 +115,42 @@ public:
DECLARE_DEVICE_TYPE(KCEXP_SLOT, kcexp_slot_device)
DECLARE_DEVICE_TYPE(KCCART_SLOT, kccart_slot_device)
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_KCEXP_SLOT_OUT_IRQ_CB(_devcb) \
+ downcast<kcexp_slot_device &>(*device).set_out_irq_callback(DEVCB_##_devcb);
+
+#define MCFG_KCEXP_SLOT_OUT_NMI_CB(_devcb) \
+ downcast<kcexp_slot_device &>(*device).set_out_nmi_callback(DEVCB_##_devcb);
+
+#define MCFG_KCEXP_SLOT_OUT_HALT_CB(_devcb) \
+ downcast<kcexp_slot_device &>(*device).set_out_halt_callback(DEVCB_##_devcb);
+
+#define MCFG_KCEXP_SLOT_NEXT_SLOT(_next_slot_tag) \
+ downcast<kcexp_slot_device &>(*device).set_next_slot(_next_slot_tag);
+
+
+#define MCFG_KCCART_SLOT_OUT_IRQ_CB(_devcb) \
+ downcast<kccart_slot_device &>(*device).set_out_irq_callback(DEVCB_##_devcb);
+
+#define MCFG_KCCART_SLOT_OUT_NMI_CB(_devcb) \
+ downcast<kccart_slot_device &>(*device).set_out_nmi_callback(DEVCB_##_devcb);
+
+#define MCFG_KCCART_SLOT_OUT_HALT_CB(_devcb) \
+ downcast<kccart_slot_device &>(*device).set_out_halt_callback(DEVCB_##_devcb);
+
+#define MCFG_KCCART_SLOT_NEXT_SLOT(_next_slot_tag) \
+ downcast<kccart_slot_device &>(*device).set_next_slot(_next_slot_tag);
+
+// #define MCFG_KC85_EXPANSION_ADD(_tag,_next_slot_tag,_config,_slot_intf,_def_slot)
+// MCFG_DEVICE_ADD(_tag, KCEXP_SLOT, 0)
+// MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+// #define MCFG_KC85_CARTRIDGE_ADD(_tag,_next_slot_tag,_config,_slot_intf,_def_slot)
+// MCFG_DEVICE_ADD(_tag, KCCART_SLOT, 0)
+// MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
#endif // MAME_BUS_KC_KC_H
diff --git a/src/devices/bus/lpci/mpc105.cpp b/src/devices/bus/lpci/mpc105.cpp
index 5816153f134..bf1583add8d 100644
--- a/src/devices/bus/lpci/mpc105.cpp
+++ b/src/devices/bus/lpci/mpc105.cpp
@@ -32,10 +32,11 @@ DEFINE_DEVICE_TYPE(MPC105, mpc105_device, "mpc105", "Motorola MPC105")
mpc105_device::mpc105_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MPC105, tag, owner, clock),
pci_device_interface( mconfig, *this ),
+ m_cpu_tag(nullptr),
m_bank_base_default(0),
m_bank_base(0),
m_bank_enable(0),
- m_maincpu(*this, finder_base::DUMMY_TAG)
+ m_maincpu(nullptr)
{
}
@@ -45,6 +46,7 @@ mpc105_device::mpc105_device(const machine_config &mconfig, const char *tag, dev
void mpc105_device::device_start()
{
+ m_maincpu = machine().device<cpu_device>(m_cpu_tag);
}
//-------------------------------------------------
diff --git a/src/devices/bus/lpci/mpc105.h b/src/devices/bus/lpci/mpc105.h
index 94f9181a2d7..65ab5a59637 100644
--- a/src/devices/bus/lpci/mpc105.h
+++ b/src/devices/bus/lpci/mpc105.h
@@ -17,6 +17,11 @@
#define MPC105_MEMORYBANK_COUNT 8
+#define MCFG_MPC105_CPU( _tag ) \
+ downcast<mpc105_device &>(*device).set_cpu(_tag);
+
+#define MCFG_MPC105_BANK_BASE_DEFAULT( bank_base_default ) \
+ downcast<mpc105_device &>(*device).set_bank_base_default(bank_base_default);
// ======================> mpc105_device
@@ -27,7 +32,7 @@ public:
// construction/destruction
mpc105_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template <typename T> void set_cpu(T &&tag) { m_maincpu.set_tag(std::forward<T>(tag)); }
+ void set_cpu(const char *tag) { m_cpu_tag = tag; }
void set_bank_base_default(int bank_base_default) { m_bank_base_default = bank_base_default; }
virtual uint32_t pci_read(pci_bus_device *pcibus, int function, int offset, uint32_t mem_mask) override;
@@ -41,12 +46,13 @@ protected:
void update_memory();
private:
+ const char *m_cpu_tag;
int m_bank_base_default;
int m_bank_base;
uint8_t m_bank_enable;
uint32_t m_bank_registers[8];
- required_device<cpu_device> m_maincpu;
+ cpu_device* m_maincpu;
};
diff --git a/src/devices/bus/lpci/pci.h b/src/devices/bus/lpci/pci.h
index 7f93875fcfb..6f7da915176 100644
--- a/src/devices/bus/lpci/pci.h
+++ b/src/devices/bus/lpci/pci.h
@@ -114,4 +114,20 @@ private:
// device type definition
DECLARE_DEVICE_TYPE(PCI_BUS, pci_bus_device)
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_PCI_BUS_ADD(_tag, _busnum) \
+ MCFG_DEVICE_ADD(_tag, PCI_BUS, 0) \
+ downcast<pci_bus_device *>(device)->set_busnum(_busnum);
+#define MCFG_PCI_BUS_DEVICE(_tag, _slot_intf, _def_slot, _fixed) \
+ MCFG_DEVICE_ADD(_tag, PCI_CONNECTOR, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed)
+
+#define MCFG_PCI_BUS_SIBLING(_father_tag) \
+ downcast<pci_bus_device *>(device)->set_father(_father_tag);
+
+
#endif // MAME_BUS_LPCI_PCI_H
diff --git a/src/devices/bus/lpci/southbridge.cpp b/src/devices/bus/lpci/southbridge.cpp
index c4ce2257ed1..01228cddc3b 100644
--- a/src/devices/bus/lpci/southbridge.cpp
+++ b/src/devices/bus/lpci/southbridge.cpp
@@ -90,8 +90,7 @@ void southbridge_device::device_add_mconfig(machine_config &config)
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50);
ISA16(config, m_isabus, 0);
- m_isabus->set_memspace(":maincpu", AS_PROGRAM);
- m_isabus->set_iospace(":maincpu", AS_IO);
+ m_isabus->set_cputag(":maincpu");
m_isabus->irq3_callback().set("pic8259_master", FUNC(pic8259_device::ir3_w));
m_isabus->irq4_callback().set("pic8259_master", FUNC(pic8259_device::ir4_w));
m_isabus->irq5_callback().set("pic8259_master", FUNC(pic8259_device::ir5_w));
@@ -110,7 +109,6 @@ void southbridge_device::device_add_mconfig(machine_config &config)
m_isabus->drq5_callback().set("dma8237_2", FUNC(am9517a_device::dreq1_w));
m_isabus->drq6_callback().set("dma8237_2", FUNC(am9517a_device::dreq2_w));
m_isabus->drq7_callback().set("dma8237_2", FUNC(am9517a_device::dreq3_w));
- m_isabus->iochck_callback().set(FUNC(southbridge_device::iochck_w));
}
southbridge_device::southbridge_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
@@ -217,9 +215,9 @@ WRITE8_MEMBER(southbridge_device::eisa_irq_write)
void southbridge_device::device_start()
{
- spaceio = &m_maincpu->space(AS_IO);
+ spaceio = &machine().device(":maincpu")->memory().space(AS_IO);
- spaceio->install_readwrite_handler(0x0000, 0x001f, read8sm_delegate(FUNC(am9517a_device::read), &(*m_dma8237_1)), write8sm_delegate(FUNC(am9517a_device::write), &(*m_dma8237_1)), 0xffffffff);
+ spaceio->install_readwrite_handler(0x0000, 0x001f, read8_delegate(FUNC(am9517a_device::read), &(*m_dma8237_1)), write8_delegate(FUNC(am9517a_device::write), &(*m_dma8237_1)), 0xffffffff);
spaceio->install_readwrite_handler(0x0020, 0x003f, read8sm_delegate(FUNC(pic8259_device::read), &(*m_pic8259_master)), write8sm_delegate(FUNC(pic8259_device::write), &(*m_pic8259_master)), 0xffffffff);
spaceio->install_readwrite_handler(0x0040, 0x005f, read8sm_delegate(FUNC(pit8254_device::read), &(*m_pit8254)), write8sm_delegate(FUNC(pit8254_device::write), &(*m_pit8254)), 0xffffffff);
spaceio->install_readwrite_handler(0x0060, 0x0063, read8_delegate(FUNC(southbridge_device::at_portb_r), this), write8_delegate(FUNC(southbridge_device::at_portb_w), this), 0x0000ff00);
@@ -481,24 +479,17 @@ WRITE8_MEMBER( southbridge_device::at_portb_w )
m_pit8254->write_gate2(BIT(data, 0));
at_speaker_set_spkrdata( BIT(data, 1));
m_channel_check = BIT(data, 3);
- if (m_channel_check)
- m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
-}
-
-WRITE_LINE_MEMBER( southbridge_device::iochck_w )
-{
- if (!state && !m_channel_check && m_nmi_enabled)
- m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
+ m_isabus->set_nmi_state((m_nmi_enabled==0) && (m_channel_check==0));
}
READ8_MEMBER( southbridge_device::at_dma8237_2_r )
{
- return m_dma8237_2->read(offset / 2);
+ return m_dma8237_2->read( space, offset / 2);
}
WRITE8_MEMBER( southbridge_device::at_dma8237_2_w )
{
- m_dma8237_2->write(offset / 2, data);
+ m_dma8237_2->write( space, offset / 2, data);
}
/***************************************************************************
@@ -516,8 +507,7 @@ static void pc_isa_onboard(device_slot_interface &device)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void southbridge_extended_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(southbridge_extended_device::device_add_mconfig)
southbridge_device::device_add_mconfig(config);
at_keyboard_controller_device &keybc(AT_KEYBOARD_CONTROLLER(config, "keybc", XTAL(12'000'000)));
@@ -527,20 +517,20 @@ void southbridge_extended_device::device_add_mconfig(machine_config &config)
keybc.kbd_clk().set("pc_kbdc", FUNC(pc_kbdc_device::clock_write_from_mb));
keybc.kbd_data().set("pc_kbdc", FUNC(pc_kbdc_device::data_write_from_mb));
- PC_KBDC(config, m_pc_kbdc, 0);
- m_pc_kbdc->out_clock_cb().set(m_keybc, FUNC(at_keyboard_controller_device::kbd_clk_w));
- m_pc_kbdc->out_data_cb().set(m_keybc, FUNC(at_keyboard_controller_device::kbd_data_w));
- PC_KBDC_SLOT(config, "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL).set_pc_kbdc_slot(m_pc_kbdc);
+ MCFG_DEVICE_ADD("pc_kbdc", PC_KBDC, 0)
+ MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE("keybc", at_keyboard_controller_device, kbd_clk_w))
+ MCFG_PC_KBDC_OUT_DATA_CB(WRITELINE("keybc", at_keyboard_controller_device, kbd_data_w))
+ MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL)
ds12885_device &rtc(DS12885(config, "rtc"));
rtc.irq().set("pic8259_slave", FUNC(pic8259_device::ir0_w));
rtc.set_century_index(0x32);
// on board devices
- ISA16_SLOT(config, "board1", 0, "isabus", pc_isa_onboard, "fdcsmc", true); // FIXME: determine ISA bus clock
- ISA16_SLOT(config, "board2", 0, "isabus", pc_isa_onboard, "comat", true);
- ISA16_SLOT(config, "board3", 0, "isabus", pc_isa_onboard, "lpt", true);
-}
+ MCFG_DEVICE_ADD("board1", ISA16_SLOT, 0, "isabus", pc_isa_onboard, "fdcsmc", true) // FIXME: determine ISA bus clock
+ MCFG_DEVICE_ADD("board2", ISA16_SLOT, 0, "isabus", pc_isa_onboard, "comat", true)
+ MCFG_DEVICE_ADD("board3", ISA16_SLOT, 0, "isabus", pc_isa_onboard, "lpt", true)
+MACHINE_CONFIG_END
southbridge_extended_device::southbridge_extended_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: southbridge_device(mconfig, type, tag, owner, clock),
@@ -556,13 +546,13 @@ southbridge_extended_device::southbridge_extended_device(const machine_config &m
void southbridge_extended_device::device_start()
{
- address_space& spaceio = m_maincpu->space(AS_IO);
+ address_space& spaceio = machine().device(":maincpu")->memory().space(AS_IO);
southbridge_device::device_start();
- spaceio.install_readwrite_handler(0x0060, 0x0063, read8smo_delegate(FUNC(at_keyboard_controller_device::data_r), &(*m_keybc)), write8smo_delegate(FUNC(at_keyboard_controller_device::data_w), &(*m_keybc)), 0x000000ff);
- spaceio.install_readwrite_handler(0x0064, 0x0067, read8smo_delegate(FUNC(at_keyboard_controller_device::status_r), &(*m_keybc)), write8smo_delegate(FUNC(at_keyboard_controller_device::command_w), &(*m_keybc)), 0xffffffff);
- spaceio.install_readwrite_handler(0x0070, 0x007f, read8sm_delegate(FUNC(ds12885_device::read), &(*m_ds12885)), write8sm_delegate(FUNC(ds12885_device::write), &(*m_ds12885)), 0xffffffff);
+ spaceio.install_readwrite_handler(0x0060, 0x0063, read8_delegate(FUNC(at_keyboard_controller_device::data_r), &(*m_keybc)), write8_delegate(FUNC(at_keyboard_controller_device::data_w), &(*m_keybc)), 0x000000ff);
+ spaceio.install_readwrite_handler(0x0064, 0x0067, read8_delegate(FUNC(at_keyboard_controller_device::status_r), &(*m_keybc)), write8_delegate(FUNC(at_keyboard_controller_device::command_w), &(*m_keybc)), 0xffffffff);
+ spaceio.install_readwrite_handler(0x0070, 0x007f, read8_delegate(FUNC(ds12885_device::read), &(*m_ds12885)), write8_delegate(FUNC(ds12885_device::write), &(*m_ds12885)), 0xffffffff);
}
//-------------------------------------------------
@@ -578,11 +568,10 @@ WRITE8_MEMBER( southbridge_extended_device::write_rtc )
{
if (offset==0) {
m_nmi_enabled = BIT(data,7);
- if (!m_nmi_enabled)
- m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
- m_ds12885->write(0,data);
+ m_isabus->set_nmi_state((m_nmi_enabled==0) && (m_channel_check==0));
+ m_ds12885->write(space,0,data);
}
else {
- m_ds12885->write(offset,data);
+ m_ds12885->write(space,offset,data);
}
}
diff --git a/src/devices/bus/lpci/southbridge.h b/src/devices/bus/lpci/southbridge.h
index 7c2c8f3760f..0e25c8392f4 100644
--- a/src/devices/bus/lpci/southbridge.h
+++ b/src/devices/bus/lpci/southbridge.h
@@ -87,7 +87,6 @@ private:
DECLARE_WRITE8_MEMBER(at_page8_w);
DECLARE_READ8_MEMBER(at_portb_r);
DECLARE_WRITE8_MEMBER(at_portb_w);
- DECLARE_WRITE_LINE_MEMBER(iochck_w);
DECLARE_READ8_MEMBER(get_slave_ack);
DECLARE_WRITE_LINE_MEMBER(at_pit8254_out0_changed);
DECLARE_WRITE_LINE_MEMBER(at_pit8254_out1_changed);
diff --git a/src/devices/bus/m5/slot.h b/src/devices/bus/m5/slot.h
index e2a835238b9..48cb4d15124 100644
--- a/src/devices/bus/m5/slot.h
+++ b/src/devices/bus/m5/slot.h
@@ -66,17 +66,7 @@ class m5_cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- m5_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : m5_cart_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- m5_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ m5_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~m5_cart_slot_device();
// device-level overrides
@@ -126,4 +116,9 @@ DECLARE_DEVICE_TYPE(M5_CART_SLOT, m5_cart_slot_device)
#define M5SLOT_ROM_REGION_TAG ":cart:rom"
+#define MCFG_M5_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, M5_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
#endif // MAME_BUS_M5_SLOT_H
diff --git a/src/devices/bus/macpds/macpds.h b/src/devices/bus/macpds/macpds.h
index 2354549afd5..d37a393a78a 100644
--- a/src/devices/bus/macpds/macpds.h
+++ b/src/devices/bus/macpds/macpds.h
@@ -14,6 +14,22 @@
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MACPDS_SLOT_REMOVE(_tag) \
+ MCFG_DEVICE_REMOVE(_tag)
+
+#define MCFG_MACPDS_ONBOARD_ADD(_nbtag, _tag, _dev_type, _def_inp) \
+ MCFG_DEVICE_ADD(_tag, _dev_type, 0) \
+ MCFG_DEVICE_INPUT_DEFAULTS(_def_inp) \
+ downcast<device_macpds_card_interface &>(*device).set_macpds_tag(_nbtag, _tag);
+
+#define MCFG_MACPDS_BUS_REMOVE(_tag) \
+ MCFG_DEVICE_REMOVE(_tag)
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/devices/bus/macpds/pds_tpdfpd.cpp b/src/devices/bus/macpds/pds_tpdfpd.cpp
index 1a3f2671e5c..aba55746cc2 100644
--- a/src/devices/bus/macpds/pds_tpdfpd.cpp
+++ b/src/devices/bus/macpds/pds_tpdfpd.cpp
@@ -58,12 +58,13 @@ DEFINE_DEVICE_TYPE(PDS_SEDISPLAY, macpds_sedisplay_device, "pds_sefp", "Radius S
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void macpds_sedisplay_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, SEDISPLAY_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(macpds_sedisplay_device::screen_update));
- screen.set_raw(55_MHz_XTAL, 800, 0, 640, 1024, 0, 870);
-}
+MACHINE_CONFIG_START(macpds_sedisplay_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( SEDISPLAY_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, macpds_sedisplay_device, screen_update)
+ MCFG_SCREEN_SIZE(1280, 960)
+ MCFG_SCREEN_REFRESH_RATE(70)
+ MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 870-1)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/megadrive/eeprom.cpp b/src/devices/bus/megadrive/eeprom.cpp
index 32787dec152..a39daf4fb52 100644
--- a/src/devices/bus/megadrive/eeprom.cpp
+++ b/src/devices/bus/megadrive/eeprom.cpp
@@ -107,40 +107,33 @@ md_eeprom_blara_device::md_eeprom_blara_device(const machine_config &mconfig, co
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void md_std_eeprom_device::device_add_mconfig(machine_config &config)
-{
- I2C_24C01(config, m_i2cmem);
-}
+MACHINE_CONFIG_START(md_std_eeprom_device::device_add_mconfig)
+ MCFG_24C01_ADD("i2cmem")
+MACHINE_CONFIG_END
-void md_eeprom_nbajam_device::device_add_mconfig(machine_config &config)
-{
- I2C_24C02(config, m_i2cmem);
-}
+MACHINE_CONFIG_START(md_eeprom_nbajam_device::device_add_mconfig)
+ MCFG_24C02_ADD("i2cmem")
+MACHINE_CONFIG_END
-void md_eeprom_nbajamte_device::device_add_mconfig(machine_config &config)
-{
- I2C_24C01(config, m_i2cmem);
-}
+MACHINE_CONFIG_START(md_eeprom_nbajamte_device::device_add_mconfig)
+ MCFG_24C02_ADD("i2cmem")
+MACHINE_CONFIG_END
-void md_eeprom_cslam_device::device_add_mconfig(machine_config &config)
-{
- I2C_24C64(config, m_i2cmem);
-}
+MACHINE_CONFIG_START(md_eeprom_cslam_device::device_add_mconfig)
+ MCFG_24C64_ADD("i2cmem")
+MACHINE_CONFIG_END
-void md_eeprom_nflqb_device::device_add_mconfig(machine_config &config)
-{
- I2C_24C16(config, m_i2cmem);
-}
+MACHINE_CONFIG_START(md_eeprom_nflqb_device::device_add_mconfig)
+ MCFG_24C16_ADD("i2cmem")
+MACHINE_CONFIG_END
-void md_eeprom_nhlpa_device::device_add_mconfig(machine_config &config)
-{
- I2C_24C01(config, m_i2cmem);
-}
+MACHINE_CONFIG_START(md_eeprom_nhlpa_device::device_add_mconfig)
+ MCFG_24C01_ADD("i2cmem")
+MACHINE_CONFIG_END
-void md_eeprom_blara_device::device_add_mconfig(machine_config &config)
-{
- I2C_24C64(config, m_i2cmem);
-}
+MACHINE_CONFIG_START(md_eeprom_blara_device::device_add_mconfig)
+ MCFG_24C64_ADD("i2cmem")
+MACHINE_CONFIG_END
void md_std_eeprom_device::device_start()
{
diff --git a/src/devices/bus/megadrive/ggenie.cpp b/src/devices/bus/megadrive/ggenie.cpp
index 17dbb78fc1d..a6001971529 100644
--- a/src/devices/bus/megadrive/ggenie.cpp
+++ b/src/devices/bus/megadrive/ggenie.cpp
@@ -172,8 +172,7 @@ static void ggenie_sub_cart(device_slot_interface &device)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void md_rom_ggenie_device::device_add_mconfig(machine_config &config)
-{
- MD_CART_SLOT(config, m_exp, ggenie_sub_cart, nullptr);
- m_exp->set_must_be_loaded(false);
-}
+MACHINE_CONFIG_START(md_rom_ggenie_device::device_add_mconfig)
+ MCFG_MD_CARTRIDGE_ADD("subslot", ggenie_sub_cart, nullptr)
+ MCFG_MD_CARTRIDGE_NOT_MANDATORY
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/megadrive/jcart.cpp b/src/devices/bus/megadrive/jcart.cpp
index 76f38ff0dd3..aa6d763e517 100644
--- a/src/devices/bus/megadrive/jcart.cpp
+++ b/src/devices/bus/megadrive/jcart.cpp
@@ -81,15 +81,13 @@ md_seprom_mm96_device::md_seprom_mm96_device(const machine_config &mconfig, cons
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void md_seprom_codemast_device::device_add_mconfig(machine_config &config)
-{
- I2C_24C08(config, m_i2cmem);
-}
+MACHINE_CONFIG_START(md_seprom_codemast_device::device_add_mconfig)
+ MCFG_24C08_ADD("i2cmem")
+MACHINE_CONFIG_END
-void md_seprom_mm96_device::device_add_mconfig(machine_config &config)
-{
- I2C_24C16A(config, m_i2cmem);
-}
+MACHINE_CONFIG_START(md_seprom_mm96_device::device_add_mconfig)
+ MCFG_24C16A_ADD("i2cmem")
+MACHINE_CONFIG_END
static INPUT_PORTS_START( jcart_ipt )
diff --git a/src/devices/bus/megadrive/md_slot.h b/src/devices/bus/megadrive/md_slot.h
index 42fd2503f76..c9372ada7df 100644
--- a/src/devices/bus/megadrive/md_slot.h
+++ b/src/devices/bus/megadrive/md_slot.h
@@ -211,16 +211,6 @@ class md_cart_slot_device : public base_md_cart_slot_device
{
public:
// construction/destruction
- template <typename T>
- md_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : md_cart_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
md_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual const char *image_interface() const override { return "megadriv_cart"; }
virtual const char *file_extensions() const override { return "smd,bin,md,gen"; }
@@ -279,4 +269,12 @@ DECLARE_DEVICE_TYPE(COPERA_CART_SLOT, copera_cart_slot_device)
#define MDSLOT_ROM_REGION_TAG ":cart:rom"
+#define MCFG_MD_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, MD_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+#define MCFG_MD_CARTRIDGE_NOT_MANDATORY \
+ static_cast<md_cart_slot_device *>(device)->set_must_be_loaded(false);
+
+
#endif // MAME_BUS_MEGADRIVE_MD_SLOT_H
diff --git a/src/devices/bus/megadrive/sk.cpp b/src/devices/bus/megadrive/sk.cpp
index c45574ff1a3..b48163e9b94 100644
--- a/src/devices/bus/megadrive/sk.cpp
+++ b/src/devices/bus/megadrive/sk.cpp
@@ -79,8 +79,7 @@ static void sk_sub_cart(device_slot_interface &device)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void md_rom_sk_device::device_add_mconfig(machine_config &config)
-{
- MD_CART_SLOT(config, m_exp, sk_sub_cart, nullptr);
- m_exp->set_must_be_loaded(false);
-}
+MACHINE_CONFIG_START(md_rom_sk_device::device_add_mconfig)
+ MCFG_MD_CARTRIDGE_ADD("subslot", sk_sub_cart, nullptr)
+ MCFG_MD_CARTRIDGE_NOT_MANDATORY
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/megadrive/svp.cpp b/src/devices/bus/megadrive/svp.cpp
index fe4ae33536e..2ed4e40ba1f 100644
--- a/src/devices/bus/megadrive/svp.cpp
+++ b/src/devices/bus/megadrive/svp.cpp
@@ -347,12 +347,11 @@ void md_rom_svp_device::md_svp_ext_map(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void md_rom_svp_device::device_add_mconfig(machine_config &config)
-{
- SSP1601(config, m_svp, MASTER_CLOCK_NTSC / 7 * 3); /* ~23 MHz (guessed) */
- m_svp->set_addrmap(AS_PROGRAM, &md_rom_svp_device::md_svp_ssp_map);
- m_svp->set_addrmap(AS_IO, &md_rom_svp_device::md_svp_ext_map);
-}
+MACHINE_CONFIG_START(md_rom_svp_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("svp", SSP1601, MASTER_CLOCK_NTSC / 7 * 3) /* ~23 MHz (guessed) */
+ MCFG_DEVICE_PROGRAM_MAP(md_svp_ssp_map)
+ MCFG_DEVICE_IO_MAP(md_svp_ext_map)
+MACHINE_CONFIG_END
ioport_constructor md_rom_svp_device::device_input_ports() const
{
diff --git a/src/devices/bus/midi/midi.h b/src/devices/bus/midi/midi.h
index 162d2d7545e..e85a69b9b35 100644
--- a/src/devices/bus/midi/midi.h
+++ b/src/devices/bus/midi/midi.h
@@ -6,6 +6,13 @@
#pragma once
+#define MCFG_MIDI_PORT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, MIDI_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+#define MCFG_MIDI_RX_HANDLER(_devcb) \
+ downcast<midi_port_device &>(*device).set_rx_handler(DEVCB_##_devcb);
+
class device_midi_port_interface;
class midi_port_device : public device_t,
@@ -27,6 +34,7 @@ public:
virtual ~midi_port_device();
// static configuration helpers
+ template <class Object> devcb_base &set_rx_handler(Object &&cb) { return m_rxd_handler.set_callback(std::forward<Object>(cb)); }
auto rxd_handler() { return m_rxd_handler.bind(); }
DECLARE_WRITE_LINE_MEMBER( write_txd );
diff --git a/src/devices/bus/midi/midiinport.cpp b/src/devices/bus/midi/midiinport.cpp
index bad75b6959e..81bbeb80f1c 100644
--- a/src/devices/bus/midi/midiinport.cpp
+++ b/src/devices/bus/midi/midiinport.cpp
@@ -20,8 +20,7 @@ midiin_port_device::midiin_port_device(const machine_config &mconfig, const char
{
}
-void midiin_port_device::device_add_mconfig(machine_config &config)
-{
- MIDIIN(config, m_midiin, 0);
- m_midiin->input_callback().set(FUNC(midiin_port_device::read));
-}
+MACHINE_CONFIG_START(midiin_port_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("midiinimg", MIDIIN, 0)
+ MCFG_MIDIIN_INPUT_CB(WRITELINE(*this, midiin_port_device, read))
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/midi/midioutport.cpp b/src/devices/bus/midi/midioutport.cpp
index 7f15c79fc70..449b85b4649 100644
--- a/src/devices/bus/midi/midioutport.cpp
+++ b/src/devices/bus/midi/midioutport.cpp
@@ -20,7 +20,6 @@ midiout_port_device::midiout_port_device(const machine_config &mconfig, const ch
{
}
-void midiout_port_device::device_add_mconfig(machine_config &config)
-{
- MIDIOUT(config, m_midiout, 0);
-}
+MACHINE_CONFIG_START(midiout_port_device::device_add_mconfig)
+ MCFG_MIDIOUT_ADD("midioutimg")
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/msx_cart/arc.cpp b/src/devices/bus/msx_cart/arc.cpp
index 406ec8f4de3..3504071ec4c 100644
--- a/src/devices/bus/msx_cart/arc.cpp
+++ b/src/devices/bus/msx_cart/arc.cpp
@@ -18,8 +18,9 @@ msx_cart_arc_device::msx_cart_arc_device(const machine_config &mconfig, const ch
void msx_cart_arc_device::device_start()
{
// Install IO read/write handlers
- io_space().install_write_handler(0x7f, 0x7f, write8smo_delegate(FUNC(msx_cart_arc_device::io_7f_w), this));
- io_space().install_read_handler(0x7f, 0x7f, read8smo_delegate(FUNC(msx_cart_arc_device::io_7f_r), this));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0x7f, 0x7f, write8_delegate(FUNC(msx_cart_arc_device::io_7f_w), this));
+ space.install_read_handler(0x7f, 0x7f, read8_delegate(FUNC(msx_cart_arc_device::io_7f_r), this));
}
@@ -38,7 +39,7 @@ void msx_cart_arc_device::initialize_cartridge()
}
-uint8_t msx_cart_arc_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_arc_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -48,7 +49,7 @@ uint8_t msx_cart_arc_device::read_cart(offs_t offset)
}
-void msx_cart_arc_device::io_7f_w(uint8_t data)
+WRITE8_MEMBER(msx_cart_arc_device::io_7f_w)
{
if (data == 0x35)
{
@@ -57,7 +58,7 @@ void msx_cart_arc_device::io_7f_w(uint8_t data)
}
-uint8_t msx_cart_arc_device::io_7f_r()
+READ8_MEMBER(msx_cart_arc_device::io_7f_r)
{
return ((m_7f & 0x03) == 0x03) ? 0xda : 0xff;
}
diff --git a/src/devices/bus/msx_cart/arc.h b/src/devices/bus/msx_cart/arc.h
index 69f4427a01f..308589961fd 100644
--- a/src/devices/bus/msx_cart/arc.h
+++ b/src/devices/bus/msx_cart/arc.h
@@ -18,7 +18,10 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+
+ DECLARE_WRITE8_MEMBER(io_7f_w);
+ DECLARE_READ8_MEMBER(io_7f_r);
protected:
// device-level overrides
@@ -26,9 +29,6 @@ protected:
virtual void device_reset() override;
private:
- void io_7f_w(uint8_t data);
- uint8_t io_7f_r();
-
uint8_t m_7f;
};
diff --git a/src/devices/bus/msx_cart/ascii.cpp b/src/devices/bus/msx_cart/ascii.cpp
index 7d1b354b404..c7598a8ccc0 100644
--- a/src/devices/bus/msx_cart/ascii.cpp
+++ b/src/devices/bus/msx_cart/ascii.cpp
@@ -27,12 +27,8 @@ msx_cart_ascii8_device::msx_cart_ascii8_device(const machine_config &mconfig, co
void msx_cart_ascii8_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_ascii8_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_ascii8_device::restore_banks), this));
}
@@ -76,7 +72,7 @@ void msx_cart_ascii8_device::initialize_cartridge()
}
-uint8_t msx_cart_ascii8_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_ascii8_device::read_cart)
{
if ( offset >= 0x4000 && offset < 0xC000 )
{
@@ -86,7 +82,7 @@ uint8_t msx_cart_ascii8_device::read_cart(offs_t offset)
}
-void msx_cart_ascii8_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_ascii8_device::write_cart)
{
if (offset >= 0x6000 && offset < 0x8000)
{
@@ -115,12 +111,8 @@ msx_cart_ascii16_device::msx_cart_ascii16_device(const machine_config &mconfig,
void msx_cart_ascii16_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_ascii16_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_ascii16_device::restore_banks), this));
}
@@ -164,7 +156,7 @@ void msx_cart_ascii16_device::initialize_cartridge()
}
-uint8_t msx_cart_ascii16_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_ascii16_device::read_cart)
{
if ( offset >= 0x4000 && offset < 0xC000 )
{
@@ -174,7 +166,7 @@ uint8_t msx_cart_ascii16_device::read_cart(offs_t offset)
}
-void msx_cart_ascii16_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_ascii16_device::write_cart)
{
if (offset >= 0x6000 && offset < 0x6800)
{
@@ -210,12 +202,8 @@ msx_cart_ascii8_sram_device::msx_cart_ascii8_sram_device(const machine_config &m
void msx_cart_ascii8_sram_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_ascii8_sram_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_ascii8_sram_device::restore_banks), this));
}
@@ -284,7 +272,7 @@ void msx_cart_ascii8_sram_device::initialize_cartridge()
}
-uint8_t msx_cart_ascii8_sram_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_ascii8_sram_device::read_cart)
{
if ( offset >= 0x4000 && offset < 0xC000 )
{
@@ -299,7 +287,7 @@ uint8_t msx_cart_ascii8_sram_device::read_cart(offs_t offset)
}
-void msx_cart_ascii8_sram_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_ascii8_sram_device::write_cart)
{
if (offset >= 0x6000 && offset < 0x8000)
{
@@ -339,12 +327,8 @@ msx_cart_ascii16_sram_device::msx_cart_ascii16_sram_device(const machine_config
void msx_cart_ascii16_sram_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_ascii16_sram_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_ascii16_sram_device::restore_banks), this));
}
@@ -413,7 +397,7 @@ void msx_cart_ascii16_sram_device::initialize_cartridge()
}
-uint8_t msx_cart_ascii16_sram_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_ascii16_sram_device::read_cart)
{
if ( offset >= 0x4000 && offset < 0xC000 )
{
@@ -435,7 +419,7 @@ uint8_t msx_cart_ascii16_sram_device::read_cart(offs_t offset)
}
-void msx_cart_ascii16_sram_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_ascii16_sram_device::write_cart)
{
if (offset >= 0x6000 && offset < 0x6800)
{
@@ -477,12 +461,8 @@ msx_cart_msxwrite_device::msx_cart_msxwrite_device(const machine_config &mconfig
void msx_cart_msxwrite_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_msxwrite_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_msxwrite_device::restore_banks), this));
}
@@ -526,7 +506,7 @@ void msx_cart_msxwrite_device::initialize_cartridge()
}
-uint8_t msx_cart_msxwrite_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_msxwrite_device::read_cart)
{
if ( offset >= 0x4000 && offset < 0xC000 )
{
@@ -536,7 +516,7 @@ uint8_t msx_cart_msxwrite_device::read_cart(offs_t offset)
}
-void msx_cart_msxwrite_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_msxwrite_device::write_cart)
{
// The rom writes to 6fff and 7fff for banking, unknown whether
// other locations also trigger banking.
diff --git a/src/devices/bus/msx_cart/ascii.h b/src/devices/bus/msx_cart/ascii.h
index 0c5898fed40..2df178dc31d 100644
--- a/src/devices/bus/msx_cart/ascii.h
+++ b/src/devices/bus/msx_cart/ascii.h
@@ -22,14 +22,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
@@ -47,14 +46,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
@@ -72,14 +70,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
@@ -100,14 +97,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
@@ -128,14 +124,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/bm_012.cpp b/src/devices/bus/msx_cart/bm_012.cpp
index f38215ac6cc..db354b1e65c 100644
--- a/src/devices/bus/msx_cart/bm_012.cpp
+++ b/src/devices/bus/msx_cart/bm_012.cpp
@@ -39,8 +39,7 @@ void msx_cart_bm_012_device::bm_012_memory_map(address_map &map)
}
-void msx_cart_bm_012_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_bm_012_device::device_add_mconfig)
// 12MHz XTAL @ X1
// Toshiba TMPZ84C015AF-6 (@U5) components:
// - Z80
@@ -70,12 +69,13 @@ void msx_cart_bm_012_device::device_add_mconfig(machine_config &config)
m_bm012_pio->out_brdy_callback().set("tmpz84c015af", FUNC(tmpz84c015_device::strobe_b));
// MIDI ports
- MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(FUNC(msx_cart_bm_012_device::midi_in));
+ MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
+ MCFG_MIDI_RX_HANDLER(WRITELINE(*this, msx_cart_bm_012_device, midi_in))
- MIDI_PORT(config, "mdthru", midiout_slot, "midiout");
+ MCFG_MIDI_PORT_ADD("mdthru", midiout_slot, "midiout")
- MIDI_PORT(config, "mdout", midiout_slot, "midiout");
-}
+ MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
+MACHINE_CONFIG_END
ROM_START( msx_cart_bm_012 )
@@ -94,8 +94,9 @@ const tiny_rom_entry *msx_cart_bm_012_device::device_rom_region() const
void msx_cart_bm_012_device::device_start()
{
// Install IO read/write handlers
- io_space().install_write_handler(0x70, 0x73, write8_delegate(FUNC(z80pio_device::write_alt), m_bm012_pio.target()));
- io_space().install_read_handler(0x70, 0x73, read8_delegate(FUNC(z80pio_device::read_alt), m_bm012_pio.target()));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0x70, 0x73, write8_delegate(FUNC(z80pio_device::write_alt), m_bm012_pio.target()));
+ space.install_read_handler(0x70, 0x73, read8_delegate(FUNC(z80pio_device::read_alt), m_bm012_pio.target()));
}
diff --git a/src/devices/bus/msx_cart/cartridge.cpp b/src/devices/bus/msx_cart/cartridge.cpp
index 3a3af30d191..9c722e74872 100644
--- a/src/devices/bus/msx_cart/cartridge.cpp
+++ b/src/devices/bus/msx_cart/cartridge.cpp
@@ -26,8 +26,6 @@
#include "super_swangi.h"
#include "yamaha.h"
-#include "bus/msx_slot/cartridge.h"
-
void msx_cart(device_slot_interface &device)
{
@@ -74,7 +72,7 @@ void msx_cart(device_slot_interface &device)
msx_cart_interface::msx_cart_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device)
- , m_exp(nullptr)
+ , m_out_irq_cb(*this)
{
}
@@ -102,21 +100,6 @@ void msx_cart_interface::sram_alloc(uint32_t size)
std::fill_n(m_sram.begin(), size, 0x00);
}
-WRITE_LINE_MEMBER(msx_cart_interface::irq_out)
-{
- m_exp->irq_out(state);
-}
-
-address_space &msx_cart_interface::memory_space() const
-{
- return m_exp->memory_space();
-}
-
-address_space &msx_cart_interface::io_space() const
-{
- return m_exp->io_space();
-}
-
// Several yamaha machines had 60 pin expansion slots. The pinouts of these slots was
// exactly the same as the regular 50 pin cartridge slots. The lowest 10 pins are simply
diff --git a/src/devices/bus/msx_cart/cartridge.h b/src/devices/bus/msx_cart/cartridge.h
index 529d2f0a081..381ec09e566 100644
--- a/src/devices/bus/msx_cart/cartridge.h
+++ b/src/devices/bus/msx_cart/cartridge.h
@@ -10,26 +10,19 @@ void msx_cart(device_slot_interface &device);
void msx_yamaha_60pin(device_slot_interface &device); // 60 pin expansion slots as found in yamaha machines
-class msx_slot_cartridge_device;
-
class msx_cart_interface : public device_slot_card_interface
{
- friend class msx_slot_cartridge_device;
-
public:
+ template <class Object> void set_out_irq_cb(Object &&cb) { m_out_irq_cb.set_callback(std::forward<Object>(cb)); }
+
// This is called after loading cartridge contents and allows the cartridge
// implementation to perform some additional initialization based on the
// cartridge contents.
virtual void initialize_cartridge() { }
- virtual void interface_pre_start() override { assert(m_exp != nullptr); }
// reading and writing
- virtual uint8_t read_cart(offs_t offset) { return 0xff; }
- virtual void write_cart(offs_t offset, uint8_t data) { }
-
- DECLARE_WRITE_LINE_MEMBER(irq_out);
- address_space &memory_space() const;
- address_space &io_space() const;
+ virtual DECLARE_READ8_MEMBER(read_cart) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_cart) { }
// ROM/RAM/SRAM management
// Mainly used by the cartridge slot when loading images
@@ -50,13 +43,13 @@ public:
protected:
msx_cart_interface(const machine_config &mconfig, device_t &device);
+ virtual void interface_pre_start() override { m_out_irq_cb.resolve_safe(); }
+
std::vector<uint8_t> m_rom;
std::vector<uint8_t> m_ram;
std::vector<uint8_t> m_rom_vlm5030;
std::vector<uint8_t> m_sram;
-
-private:
- msx_slot_cartridge_device *m_exp;
+ devcb_write_line m_out_irq_cb;
};
diff --git a/src/devices/bus/msx_cart/crossblaim.cpp b/src/devices/bus/msx_cart/crossblaim.cpp
index 6494e492f5b..dfd7907ac46 100644
--- a/src/devices/bus/msx_cart/crossblaim.cpp
+++ b/src/devices/bus/msx_cart/crossblaim.cpp
@@ -21,12 +21,8 @@ msx_cart_crossblaim_device::msx_cart_crossblaim_device(const machine_config &mco
void msx_cart_crossblaim_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_crossblaim_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_crossblaim_device::restore_banks), this));
}
@@ -62,7 +58,7 @@ void msx_cart_crossblaim_device::initialize_cartridge()
}
-uint8_t msx_cart_crossblaim_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_crossblaim_device::read_cart)
{
uint8_t *bank_base = m_bank_base[offset >> 14];
@@ -75,7 +71,7 @@ uint8_t msx_cart_crossblaim_device::read_cart(offs_t offset)
}
-void msx_cart_crossblaim_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_crossblaim_device::write_cart)
{
m_selected_bank = data & 3;
if (m_selected_bank == 0)
diff --git a/src/devices/bus/msx_cart/crossblaim.h b/src/devices/bus/msx_cart/crossblaim.h
index 04a44c1d905..a1321dd06df 100644
--- a/src/devices/bus/msx_cart/crossblaim.h
+++ b/src/devices/bus/msx_cart/crossblaim.h
@@ -18,14 +18,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/disk.cpp b/src/devices/bus/msx_cart/disk.cpp
index 7bbbdd292c0..a0e03e54920 100644
--- a/src/devices/bus/msx_cart/disk.cpp
+++ b/src/devices/bus/msx_cart/disk.cpp
@@ -197,8 +197,7 @@ void msx_cart_disk_device::initialize_cartridge()
}
-void msx_cart_vy0010_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_vy0010_device::device_add_mconfig)
// From VY-0010 schematic:
// HLT pulled high
// SSO/-ENMF + -DDEN + ENP + -5/8 - pulled low
@@ -207,63 +206,60 @@ void msx_cart_vy0010_device::device_add_mconfig(machine_config &config)
m_fdc->set_force_ready(true);
// Single sided 3.5" floppy drive
- FLOPPY_CONNECTOR(config, "fdc:0", msx_floppies, "35ssdd", msx_cart_disk_device::floppy_formats);
+ MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35ssdd", msx_cart_disk_device::floppy_formats)
// Attach software lists
// We do not know in what kind of machine the user has inserted the floppy interface
// so we list all msx floppy software lists.
//
- SOFTWARE_LIST(config, "flop_list").set_original("msx2_flop");
- SOFTWARE_LIST(config, "msx1_flop_list").set_compatible("msx1_flop");
-}
+ MCFG_SOFTWARE_LIST_ADD("flop_list","msx2_flop")
+ MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flop_list","msx1_flop")
+MACHINE_CONFIG_END
-void msx_cart_fsfd1_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_fsfd1_device::device_add_mconfig)
WD2793(config, m_fdc, 4_MHz_XTAL / 4);
// Double sided 3.5" floppy drive
- FLOPPY_CONNECTOR(config, "fdc:0", msx_floppies, "35dd", msx_cart_disk_device::floppy_formats);
+ MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35dd", msx_cart_disk_device::floppy_formats)
// Attach software lists
// We do not know in what kind of machine the user has inserted the floppy interface
// so we list all msx floppy software lists.
//
- SOFTWARE_LIST(config, "flop_list").set_original("msx2_flop");
- SOFTWARE_LIST(config, "msx1_flop_list").set_compatible("msx1_flop");
-}
+ MCFG_SOFTWARE_LIST_ADD("flop_list","msx2_flop")
+ MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flop_list","msx1_flop")
+MACHINE_CONFIG_END
-void msx_cart_fsfd1a_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_fsfd1a_device::device_add_mconfig)
TC8566AF(config, m_fdc, 16'000'000);
// Double sided 3.5" floppy drive
- FLOPPY_CONNECTOR(config, "fdc:0", msx_floppies, "35dd", msx_cart_disk_device::floppy_formats);
+ MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35dd", msx_cart_disk_device::floppy_formats)
// Attach software lists
// We do not know in what kind of machine the user has inserted the floppy interface
// so we list all msx floppy software lists.
//
- SOFTWARE_LIST(config, "flop_list").set_original("msx2_flop");
- SOFTWARE_LIST(config, "msx1_flop_list").set_compatible("msx1_flop");
-}
+ MCFG_SOFTWARE_LIST_ADD("flop_list","msx2_flop")
+ MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flop_list","msx1_flop")
+MACHINE_CONFIG_END
-void msx_cart_fscf351_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_fscf351_device::device_add_mconfig)
MB8877(config, m_fdc, 4_MHz_XTAL / 4);
m_fdc->set_force_ready(true);
// Double sided 3.5" floppy drive
- FLOPPY_CONNECTOR(config, "fdc:0", msx_floppies, "35dd", msx_cart_disk_device::floppy_formats);
+ MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35dd", msx_cart_disk_device::floppy_formats)
// Attach software lists
// We do not know in what kind of machine the user has inserted the floppy interface
// so we list all msx floppy software lists.
//
- SOFTWARE_LIST(config, "flop_list").set_original("msx2_flop");
- SOFTWARE_LIST(config, "msx1_flop_list").set_compatible("msx1_flop");
-}
+ MCFG_SOFTWARE_LIST_ADD("flop_list","msx2_flop")
+ MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flop_list","msx1_flop")
+MACHINE_CONFIG_END
void msx_cart_disk_type1_device::device_start()
@@ -272,10 +268,12 @@ void msx_cart_disk_type1_device::device_start()
save_item(NAME(m_side_control));
save_item(NAME(m_control));
+
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_disk_type1_device::post_load), this));
}
-void msx_cart_disk_type1_device::device_post_load()
+void msx_cart_disk_type1_device::post_load()
{
uint8_t data = m_control;
@@ -340,7 +338,7 @@ void msx_cart_disk_type1_device::device_reset()
}
-uint8_t msx_cart_disk_type1_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_disk_type1_device::read_cart)
{
switch (offset)
{
@@ -381,7 +379,7 @@ uint8_t msx_cart_disk_type1_device::read_cart(offs_t offset)
}
-void msx_cart_disk_type1_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_disk_type1_device::write_cart)
{
switch (offset)
{
@@ -427,6 +425,8 @@ void msx_cart_disk_type2_device::device_start()
m_led.resolve();
save_item(NAME(m_control));
+
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_disk_type2_device::post_load), this));
}
@@ -436,7 +436,7 @@ void msx_cart_disk_type2_device::device_reset()
}
-void msx_cart_disk_type2_device::device_post_load()
+void msx_cart_disk_type2_device::post_load()
{
uint8_t data = m_control;
@@ -483,7 +483,7 @@ void msx_cart_disk_type2_device::set_control(uint8_t data)
}
-uint8_t msx_cart_disk_type2_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_disk_type2_device::read_cart)
{
switch (offset)
{
@@ -516,7 +516,7 @@ uint8_t msx_cart_disk_type2_device::read_cart(offs_t offset)
}
-void msx_cart_disk_type2_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_disk_type2_device::write_cart)
{
switch (offset)
{
@@ -564,17 +564,17 @@ void msx_cart_fsfd1a_device::device_reset()
}
-uint8_t msx_cart_fsfd1a_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_fsfd1a_device::read_cart)
{
switch (offset)
{
case 0x7ffa:
case 0xbffa:
- return m_fdc->msr_r();
+ return m_fdc->msr_r(space, 4);
case 0x7ffb:
case 0xbffb:
- return m_fdc->fifo_r();
+ return m_fdc->fifo_r(space, 5);
}
if (offset >= 0x4000 && offset < 0x8000)
@@ -585,23 +585,23 @@ uint8_t msx_cart_fsfd1a_device::read_cart(offs_t offset)
}
-void msx_cart_fsfd1a_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_fsfd1a_device::write_cart)
{
switch (offset)
{
case 0x7ff8:
case 0xbff8:
- m_fdc->dor_w(data);
+ m_fdc->dor_w(space, 2, data);
break;
case 0x7ff9:
case 0xbff9:
- m_fdc->cr1_w(data);
+ m_fdc->cr1_w(space, 3, data);
break;
case 0x7ffb:
case 0xbffb:
- m_fdc->fifo_w(data);
+ m_fdc->fifo_w(space, 5, data);
break;
default:
diff --git a/src/devices/bus/msx_cart/disk.h b/src/devices/bus/msx_cart/disk.h
index ce238992349..908f2ef7229 100644
--- a/src/devices/bus/msx_cart/disk.h
+++ b/src/devices/bus/msx_cart/disk.h
@@ -45,8 +45,8 @@ protected:
class msx_cart_disk_type1_device : public msx_cart_disk_wd_device
{
public:
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
msx_cart_disk_type1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -54,7 +54,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
+
+ void post_load();
output_finder<> m_led;
uint8_t m_side_control;
@@ -68,8 +69,8 @@ protected:
class msx_cart_disk_type2_device : public msx_cart_disk_wd_device
{
public:
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
msx_cart_disk_type2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -77,7 +78,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
+
+ void post_load();
output_finder<> m_led;
uint8_t m_control;
@@ -137,8 +139,8 @@ protected:
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
};
diff --git a/src/devices/bus/msx_cart/dooly.cpp b/src/devices/bus/msx_cart/dooly.cpp
index a0c4c7b4f83..d1d3ad9ff39 100644
--- a/src/devices/bus/msx_cart/dooly.cpp
+++ b/src/devices/bus/msx_cart/dooly.cpp
@@ -36,7 +36,7 @@ void msx_cart_dooly_device::initialize_cartridge()
}
-uint8_t msx_cart_dooly_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_dooly_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -54,7 +54,7 @@ uint8_t msx_cart_dooly_device::read_cart(offs_t offset)
}
-void msx_cart_dooly_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_dooly_device::write_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
diff --git a/src/devices/bus/msx_cart/dooly.h b/src/devices/bus/msx_cart/dooly.h
index 76f58ae762d..3ef7b365c82 100644
--- a/src/devices/bus/msx_cart/dooly.h
+++ b/src/devices/bus/msx_cart/dooly.h
@@ -18,8 +18,8 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
diff --git a/src/devices/bus/msx_cart/fmpac.cpp b/src/devices/bus/msx_cart/fmpac.cpp
index a5229a6c61e..7054c8c366a 100644
--- a/src/devices/bus/msx_cart/fmpac.cpp
+++ b/src/devices/bus/msx_cart/fmpac.cpp
@@ -29,12 +29,12 @@ msx_cart_fmpac_device::msx_cart_fmpac_device(const machine_config &mconfig, cons
}
-void msx_cart_fmpac_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_fmpac_device::device_add_mconfig)
// This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'.
SPEAKER(config, "mono").front_center();
- YM2413(config, m_ym2413, XTAL(10'738'635)/3).add_route(ALL_OUTPUTS, "mono", 0.40);
-}
+ MCFG_DEVICE_ADD("ym2413", YM2413, XTAL(10'738'635)/3)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
+MACHINE_CONFIG_END
void msx_cart_fmpac_device::device_start()
@@ -46,14 +46,11 @@ void msx_cart_fmpac_device::device_start()
save_item(NAME(m_1fff));
save_item(NAME(m_7ff6));
- // Install IO read/write handlers
- io_space().install_write_handler(0x7c, 0x7d, write8sm_delegate(FUNC(msx_cart_fmpac_device::write_ym2413), this));
-}
-
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_fmpac_device::restore_banks), this));
-void msx_cart_fmpac_device::device_post_load()
-{
- restore_banks();
+ // Install IO read/write handlers
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0x7c, 0x7d, write8_delegate(FUNC(msx_cart_fmpac_device::write_ym2413), this));
}
@@ -90,7 +87,7 @@ void msx_cart_fmpac_device::initialize_cartridge()
}
-uint8_t msx_cart_fmpac_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_fmpac_device::read_cart)
{
if (offset >= 0x4000 && offset < 0x8000)
{
@@ -119,7 +116,7 @@ uint8_t msx_cart_fmpac_device::read_cart(offs_t offset)
}
-void msx_cart_fmpac_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_fmpac_device::write_cart)
{
if (offset >= 0x4000 && offset < 0x6000)
{
@@ -144,7 +141,7 @@ void msx_cart_fmpac_device::write_cart(offs_t offset, uint8_t data)
case 0x7ff5:
if (m_opll_active)
{
- m_ym2413->write(offset & 1, data);
+ m_ym2413->write(space, offset & 1, data);
}
break;
@@ -162,10 +159,10 @@ void msx_cart_fmpac_device::write_cart(offs_t offset, uint8_t data)
}
-void msx_cart_fmpac_device::write_ym2413(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_fmpac_device::write_ym2413)
{
if (m_opll_active)
{
- m_ym2413->write(offset & 1, data);
+ m_ym2413->write(space, offset & 1, data);
}
}
diff --git a/src/devices/bus/msx_cart/fmpac.h b/src/devices/bus/msx_cart/fmpac.h
index a0f660b1620..7100fe4a07c 100644
--- a/src/devices/bus/msx_cart/fmpac.h
+++ b/src/devices/bus/msx_cart/fmpac.h
@@ -19,13 +19,14 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
+
+ DECLARE_WRITE8_MEMBER(write_ym2413);
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
@@ -33,8 +34,6 @@ protected:
void restore_banks();
private:
- void write_ym2413(offs_t offset, uint8_t data);
-
required_device<ym2413_device> m_ym2413;
uint8_t m_selected_bank;
diff --git a/src/devices/bus/msx_cart/fs_sr022.cpp b/src/devices/bus/msx_cart/fs_sr022.cpp
index bb84a759214..7e0eac793df 100644
--- a/src/devices/bus/msx_cart/fs_sr022.cpp
+++ b/src/devices/bus/msx_cart/fs_sr022.cpp
@@ -38,7 +38,7 @@ void msx_cart_fs_sr022_device::initialize_cartridge()
}
-uint8_t msx_cart_fs_sr022_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_fs_sr022_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -52,7 +52,7 @@ uint8_t msx_cart_fs_sr022_device::read_cart(offs_t offset)
}
-void msx_cart_fs_sr022_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_fs_sr022_device::write_cart)
{
switch (offset)
{
diff --git a/src/devices/bus/msx_cart/fs_sr022.h b/src/devices/bus/msx_cart/fs_sr022.h
index 2456b90a101..bf3259090e1 100644
--- a/src/devices/bus/msx_cart/fs_sr022.h
+++ b/src/devices/bus/msx_cart/fs_sr022.h
@@ -18,8 +18,8 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
diff --git a/src/devices/bus/msx_cart/halnote.cpp b/src/devices/bus/msx_cart/halnote.cpp
index 43f7947ec2c..013d2b83680 100644
--- a/src/devices/bus/msx_cart/halnote.cpp
+++ b/src/devices/bus/msx_cart/halnote.cpp
@@ -19,12 +19,8 @@ msx_cart_halnote_device::msx_cart_halnote_device(const machine_config &mconfig,
void msx_cart_halnote_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_halnote_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_halnote_device::restore_banks), this));
}
@@ -88,7 +84,7 @@ void msx_cart_halnote_device::initialize_cartridge()
}
-uint8_t msx_cart_halnote_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_halnote_device::read_cart)
{
if (offset >= 0xc000)
{
@@ -110,7 +106,7 @@ uint8_t msx_cart_halnote_device::read_cart(offs_t offset)
}
-void msx_cart_halnote_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_halnote_device::write_cart)
{
if (offset < 0x4000)
{
diff --git a/src/devices/bus/msx_cart/halnote.h b/src/devices/bus/msx_cart/halnote.h
index a9c1972afeb..ad64d2539ee 100644
--- a/src/devices/bus/msx_cart/halnote.h
+++ b/src/devices/bus/msx_cart/halnote.h
@@ -18,14 +18,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/hfox.cpp b/src/devices/bus/msx_cart/hfox.cpp
index 181d9710fcc..d7fb793e42d 100644
--- a/src/devices/bus/msx_cart/hfox.cpp
+++ b/src/devices/bus/msx_cart/hfox.cpp
@@ -19,12 +19,8 @@ msx_cart_hfox_device::msx_cart_hfox_device(const machine_config &mconfig, const
void msx_cart_hfox_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_hfox_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_hfox_device::restore_banks), this));
}
@@ -52,7 +48,7 @@ void msx_cart_hfox_device::initialize_cartridge()
}
-uint8_t msx_cart_hfox_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_hfox_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -62,7 +58,7 @@ uint8_t msx_cart_hfox_device::read_cart(offs_t offset)
}
-void msx_cart_hfox_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_hfox_device::write_cart)
{
switch (offset)
{
diff --git a/src/devices/bus/msx_cart/hfox.h b/src/devices/bus/msx_cart/hfox.h
index 6254bae3610..debcbc31308 100644
--- a/src/devices/bus/msx_cart/hfox.h
+++ b/src/devices/bus/msx_cart/hfox.h
@@ -16,14 +16,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/holy_quran.cpp b/src/devices/bus/msx_cart/holy_quran.cpp
index 046ed194502..4c44656a9e3 100644
--- a/src/devices/bus/msx_cart/holy_quran.cpp
+++ b/src/devices/bus/msx_cart/holy_quran.cpp
@@ -30,12 +30,8 @@ void msx_cart_holy_quran_device::device_start()
{
save_item(NAME(m_selected_bank));
save_item(NAME(m_decrypt));
-}
-
-void msx_cart_holy_quran_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_holy_quran_device::restore_banks), this));
}
@@ -68,7 +64,7 @@ void msx_cart_holy_quran_device::initialize_cartridge()
}
-uint8_t msx_cart_holy_quran_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_holy_quran_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -92,7 +88,7 @@ uint8_t msx_cart_holy_quran_device::read_cart(offs_t offset)
}
-void msx_cart_holy_quran_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_holy_quran_device::write_cart)
{
switch (offset)
{
diff --git a/src/devices/bus/msx_cart/holy_quran.h b/src/devices/bus/msx_cart/holy_quran.h
index 8d63a8271d9..b805282790c 100644
--- a/src/devices/bus/msx_cart/holy_quran.h
+++ b/src/devices/bus/msx_cart/holy_quran.h
@@ -18,14 +18,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/konami.cpp b/src/devices/bus/msx_cart/konami.cpp
index f5ac42be362..e1d4e35321f 100644
--- a/src/devices/bus/msx_cart/konami.cpp
+++ b/src/devices/bus/msx_cart/konami.cpp
@@ -35,12 +35,8 @@ msx_cart_konami_device::msx_cart_konami_device(const machine_config &mconfig, co
void msx_cart_konami_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_konami_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_konami_device::restore_banks), this));
}
@@ -88,13 +84,13 @@ void msx_cart_konami_device::initialize_cartridge()
}
-uint8_t msx_cart_konami_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_konami_device::read_cart)
{
return m_bank_base[offset >> 13][offset & 0x1fff];
}
-void msx_cart_konami_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_konami_device::write_cart)
{
switch (offset & 0xe000)
{
@@ -145,24 +141,20 @@ msx_cart_konami_scc_device::msx_cart_konami_scc_device(const machine_config &mco
}
-void msx_cart_konami_scc_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_konami_scc_device::device_add_mconfig)
// This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'.
SPEAKER(config, "mono").front_center();
- K051649(config, m_k051649, XTAL(10'738'635)/3/2).add_route(ALL_OUTPUTS, "mono", 0.15);
-}
+ MCFG_DEVICE_ADD("k051649", K051649, XTAL(10'738'635)/3/2)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
+MACHINE_CONFIG_END
void msx_cart_konami_scc_device::device_start()
{
save_item(NAME(m_selected_bank));
save_item(NAME(m_scc_active));
-}
-
-void msx_cart_konami_scc_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_konami_scc_device::restore_banks), this));
}
@@ -211,7 +203,7 @@ void msx_cart_konami_scc_device::initialize_cartridge()
}
-uint8_t msx_cart_konami_scc_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_konami_scc_device::read_cart)
{
if ( m_scc_active && offset >= 0x9800 && offset < 0xa000 )
{
@@ -219,13 +211,13 @@ uint8_t msx_cart_konami_scc_device::read_cart(offs_t offset)
{
if ((offset & 0xff) >= 0xe0)
{
- return m_k051649->k051649_test_r();
+ return m_k051649->k051649_test_r(space, offset & 0xff);
}
return 0xff;
}
else
{
- return m_k051649->k051649_waveform_r(offset & 0x7f);
+ return m_k051649->k051649_waveform_r(space, offset & 0x7f);
}
}
@@ -233,7 +225,7 @@ uint8_t msx_cart_konami_scc_device::read_cart(offs_t offset)
}
-void msx_cart_konami_scc_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_konami_scc_device::write_cart)
{
switch (offset & 0xf800)
{
@@ -263,27 +255,27 @@ void msx_cart_konami_scc_device::write_cart(offs_t offset, uint8_t data)
if (offset < 0x80)
{
- m_k051649->k051649_waveform_w(offset, data);
+ m_k051649->k051649_waveform_w(space, offset, data);
}
else if (offset < 0xa0)
{
offset &= 0x0f;
if (offset < 0x0a)
{
- m_k051649->k051649_frequency_w(offset, data);
+ m_k051649->k051649_frequency_w(space, offset, data);
}
else if (offset < 0x0f)
{
- m_k051649->k051649_volume_w(offset - 0xa, data);
+ m_k051649->k051649_volume_w(space, offset - 0xa, data);
}
else
{
- m_k051649->k051649_keyonoff_w(data);
+ m_k051649->k051649_keyonoff_w(space, 0, data);
}
}
else if (offset >= 0xe0)
{
- m_k051649->k051649_test_w(data);
+ m_k051649->k051649_test_w(space, offset, data);
}
}
break;
@@ -319,12 +311,8 @@ msx_cart_gamemaster2_device::msx_cart_gamemaster2_device(const machine_config &m
void msx_cart_gamemaster2_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_gamemaster2_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_gamemaster2_device::restore_banks), this));
}
@@ -409,7 +397,7 @@ void msx_cart_gamemaster2_device::initialize_cartridge()
}
-uint8_t msx_cart_gamemaster2_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_gamemaster2_device::read_cart)
{
uint8_t bank = offset >> 13;
@@ -443,7 +431,7 @@ uint8_t msx_cart_gamemaster2_device::read_cart(offs_t offset)
}
-void msx_cart_gamemaster2_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_gamemaster2_device::write_cart)
{
switch (offset & 0xf000)
{
@@ -484,15 +472,13 @@ msx_cart_synthesizer_device::msx_cart_synthesizer_device(const machine_config &m
}
-void msx_cart_synthesizer_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_synthesizer_device::device_add_mconfig)
// This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'.
SPEAKER(config, "speaker").front_center();
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.1); // unknown DAC
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
-}
+ MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.1) // unknown DAC
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT)
+MACHINE_CONFIG_END
void msx_cart_synthesizer_device::device_start()
@@ -511,7 +497,7 @@ void msx_cart_synthesizer_device::initialize_cartridge()
}
-uint8_t msx_cart_synthesizer_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_synthesizer_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000 )
{
@@ -521,7 +507,7 @@ uint8_t msx_cart_synthesizer_device::read_cart(offs_t offset)
}
-void msx_cart_synthesizer_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_synthesizer_device::write_cart)
{
if ((offset & 0xc010) == 0x4000)
{
@@ -559,12 +545,12 @@ msx_cart_konami_sound_device::msx_cart_konami_sound_device(const machine_config
}
-void msx_cart_konami_sound_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_konami_sound_device::device_add_mconfig)
// This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'.
SPEAKER(config, "mono").front_center();
- K051649(config, m_k052539, XTAL(10'738'635)/3/2).add_route(ALL_OUTPUTS, "mono", 0.15);
-}
+ MCFG_DEVICE_ADD("k052539", K051649, XTAL(10'738'635)/3/2)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
+MACHINE_CONFIG_END
void msx_cart_konami_sound_device::device_start()
@@ -573,12 +559,8 @@ void msx_cart_konami_sound_device::device_start()
save_item(NAME(m_scc_active));
save_item(NAME(m_sccplus_active));
save_item(NAME(m_ram_enabled));
-}
-
-void msx_cart_konami_sound_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_konami_sound_device::restore_banks), this));
}
@@ -636,14 +618,14 @@ void msx_cart_konami_sound_device::initialize_cartridge()
}
-uint8_t msx_cart_konami_sound_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_konami_sound_device::read_cart)
{
if ( m_scc_active && offset >= 0x9800 && offset < 0x9fe0 )
{
offset &= 0xff;
if (offset < 0x80)
{
- return m_k052539->k051649_waveform_r(offset);
+ return m_k052539->k051649_waveform_r(space, offset);
}
if (offset < 0xa0)
{
@@ -651,11 +633,11 @@ uint8_t msx_cart_konami_sound_device::read_cart(offs_t offset)
}
if (offset < 0xc0)
{
- return m_k052539->k051649_waveform_r(offset & 0x9f);
+ return m_k052539->k051649_waveform_r(space, offset & 0x9f);
}
if (offset < 0xe0)
{
- return m_k052539->k051649_test_r();
+ return m_k052539->k051649_test_r(space, offset & 0xff);
}
return 0xff;
}
@@ -665,11 +647,11 @@ uint8_t msx_cart_konami_sound_device::read_cart(offs_t offset)
if (offset < 0xa0)
{
- return m_k052539->k052539_waveform_r(offset);
+ return m_k052539->k052539_waveform_r(space, offset);
}
if (offset >= 0xc0 && offset < 0xe0)
{
- return m_k052539->k051649_test_r();
+ return m_k052539->k051649_test_r(space, offset);
}
return 0xff;
}
@@ -684,7 +666,7 @@ uint8_t msx_cart_konami_sound_device::read_cart(offs_t offset)
}
-void msx_cart_konami_sound_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_konami_sound_device::write_cart)
{
switch (offset & 0xe000)
{
@@ -732,27 +714,27 @@ void msx_cart_konami_sound_device::write_cart(offs_t offset, uint8_t data)
if (offset < 0x80)
{
- m_k052539->k051649_waveform_w(offset, data);
+ m_k052539->k051649_waveform_w(space, offset, data);
}
else if (offset < 0xa0)
{
offset &= 0x0f;
if (offset < 0x0a)
{
- m_k052539->k051649_frequency_w(offset, data);
+ m_k052539->k051649_frequency_w(space, offset, data);
}
else if (offset < 0x0f)
{
- m_k052539->k051649_volume_w(offset - 0xa, data);
+ m_k052539->k051649_volume_w(space, offset - 0xa, data);
}
else
{
- m_k052539->k051649_keyonoff_w(data);
+ m_k052539->k051649_keyonoff_w(space, 0, data);
}
}
else if (offset >= 0xe0)
{
- m_k052539->k051649_test_w(data);
+ m_k052539->k051649_test_w(space, offset, data);
}
}
break;
@@ -795,27 +777,27 @@ void msx_cart_konami_sound_device::write_cart(offs_t offset, uint8_t data)
offset &= 0xff;
if (offset < 0xa0)
{
- m_k052539->k052539_waveform_w(offset, data);
+ m_k052539->k052539_waveform_w(space, offset, data);
}
else if (offset < 0xc0)
{
offset &= 0x0f;
if (offset < 0x0a)
{
- m_k052539->k051649_frequency_w(offset, data);
+ m_k052539->k051649_frequency_w(space, offset, data);
}
else if (offset < 0x0f)
{
- m_k052539->k051649_volume_w(offset - 0x0a, data);
+ m_k052539->k051649_volume_w(space, offset - 0x0a, data);
}
else if (offset == 0x0f)
{
- m_k052539->k051649_keyonoff_w(data);
+ m_k052539->k051649_keyonoff_w(space, 0, data);
}
}
else if (offset < 0xe0)
{
- m_k052539->k051649_test_w(data);
+ m_k052539->k051649_test_w(space, offset, data);
}
}
}
@@ -890,22 +872,22 @@ void msx_cart_keyboard_master_device::vlm_map(address_map &map)
}
-void msx_cart_keyboard_master_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_keyboard_master_device::device_add_mconfig)
// This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'.
SPEAKER(config, "mono").front_center();
- VLM5030(config, m_vlm5030, XTAL(3'579'545));
- m_vlm5030->add_route(ALL_OUTPUTS, "mono", 0.40);
- m_vlm5030->set_addrmap(0, &msx_cart_keyboard_master_device::vlm_map);
-}
+ MCFG_DEVICE_ADD("vlm5030", VLM5030, XTAL(3'579'545))
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
+ MCFG_DEVICE_ADDRESS_MAP(0, vlm_map)
+MACHINE_CONFIG_END
void msx_cart_keyboard_master_device::device_start()
{
// Install IO read/write handlers
- io_space().install_write_handler(0x00, 0x00, write8smo_delegate(FUNC(vlm5030_device::data_w), m_vlm5030.target()));
- io_space().install_write_handler(0x20, 0x20, write8smo_delegate(FUNC(msx_cart_keyboard_master_device::io_20_w), this));
- io_space().install_read_handler(0x00, 0x00, read8smo_delegate(FUNC(msx_cart_keyboard_master_device::io_00_r), this));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0x00, 0x00, write8_delegate(FUNC(vlm5030_device::data_w), m_vlm5030.target()));
+ space.install_write_handler(0x20, 0x20, write8_delegate(FUNC(msx_cart_keyboard_master_device::io_20_w), this));
+ space.install_read_handler(0x00, 0x00, read8_delegate(FUNC(msx_cart_keyboard_master_device::io_00_r), this));
}
@@ -918,7 +900,7 @@ void msx_cart_keyboard_master_device::initialize_cartridge()
}
-uint8_t msx_cart_keyboard_master_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_keyboard_master_device::read_cart)
{
if (offset >= 0x4000 && offset < 0x8000)
{
@@ -928,13 +910,13 @@ uint8_t msx_cart_keyboard_master_device::read_cart(offs_t offset)
}
-uint8_t msx_cart_keyboard_master_device::read_vlm(offs_t offset)
+READ8_MEMBER(msx_cart_keyboard_master_device::read_vlm)
{
return m_rom_vlm5030[offset];
}
-void msx_cart_keyboard_master_device::io_20_w(uint8_t data)
+WRITE8_MEMBER(msx_cart_keyboard_master_device::io_20_w)
{
m_vlm5030->rst((data & 0x01) ? 1 : 0);
m_vlm5030->vcu((data & 0x04) ? 1 : 0);
@@ -942,7 +924,7 @@ void msx_cart_keyboard_master_device::io_20_w(uint8_t data)
}
-uint8_t msx_cart_keyboard_master_device::io_00_r()
+READ8_MEMBER(msx_cart_keyboard_master_device::io_00_r)
{
return m_vlm5030->bsy() ? 0x10 : 0x00;
}
diff --git a/src/devices/bus/msx_cart/konami.h b/src/devices/bus/msx_cart/konami.h
index 58ad4f3cfb7..3985884f568 100644
--- a/src/devices/bus/msx_cart/konami.h
+++ b/src/devices/bus/msx_cart/konami.h
@@ -25,14 +25,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
@@ -50,14 +49,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
virtual void device_add_mconfig(machine_config &config) override;
@@ -80,14 +78,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
@@ -106,8 +103,8 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
@@ -126,8 +123,8 @@ class msx_cart_konami_sound_device : public device_t, public msx_cart_interface
public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
msx_cart_konami_sound_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -135,7 +132,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
virtual void device_add_mconfig(machine_config &config) override;
@@ -190,14 +186,14 @@ protected:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
private:
required_device<vlm5030_device> m_vlm5030;
- uint8_t read_vlm(offs_t offset);
- void io_20_w(uint8_t data);
- uint8_t io_00_r();
+ DECLARE_READ8_MEMBER(read_vlm);
+ DECLARE_WRITE8_MEMBER(io_20_w);
+ DECLARE_READ8_MEMBER(io_00_r);
void vlm_map(address_map &map);
};
diff --git a/src/devices/bus/msx_cart/korean.cpp b/src/devices/bus/msx_cart/korean.cpp
index 1906a5eb51b..cfa96ecb7aa 100644
--- a/src/devices/bus/msx_cart/korean.cpp
+++ b/src/devices/bus/msx_cart/korean.cpp
@@ -21,12 +21,8 @@ msx_cart_korean_80in1_device::msx_cart_korean_80in1_device(const machine_config
void msx_cart_korean_80in1_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_korean_80in1_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_korean_80in1_device::restore_banks), this));
}
@@ -76,7 +72,7 @@ void msx_cart_korean_80in1_device::initialize_cartridge()
}
-uint8_t msx_cart_korean_80in1_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_korean_80in1_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -87,7 +83,7 @@ uint8_t msx_cart_korean_80in1_device::read_cart(offs_t offset)
}
-void msx_cart_korean_80in1_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_korean_80in1_device::write_cart)
{
if (offset >= 0x4000 && offset < 0x4004)
{
@@ -116,14 +112,11 @@ void msx_cart_korean_90in1_device::device_start()
{
save_item(NAME(m_selected_bank));
- // Install IO read/write handlers
- io_space().install_write_handler(0x77, 0x77, write8smo_delegate(FUNC(msx_cart_korean_90in1_device::banking), this));
-}
-
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_korean_90in1_device::restore_banks), this));
-void msx_cart_korean_90in1_device::device_post_load()
-{
- restore_banks();
+ // Install IO read/write handlers
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0x77, 0x77, write8_delegate(FUNC(msx_cart_korean_90in1_device::banking), this));
}
@@ -188,7 +181,7 @@ void msx_cart_korean_90in1_device::initialize_cartridge()
}
-uint8_t msx_cart_korean_90in1_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_korean_90in1_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -199,7 +192,7 @@ uint8_t msx_cart_korean_90in1_device::read_cart(offs_t offset)
}
-void msx_cart_korean_90in1_device::banking(uint8_t data)
+WRITE8_MEMBER(msx_cart_korean_90in1_device::banking)
{
m_selected_bank = data;
restore_banks();
@@ -222,12 +215,8 @@ msx_cart_korean_126in1_device::msx_cart_korean_126in1_device(const machine_confi
void msx_cart_korean_126in1_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_korean_126in1_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_korean_126in1_device::restore_banks), this));
}
@@ -277,7 +266,7 @@ void msx_cart_korean_126in1_device::initialize_cartridge()
}
-uint8_t msx_cart_korean_126in1_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_korean_126in1_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -288,7 +277,7 @@ uint8_t msx_cart_korean_126in1_device::read_cart(offs_t offset)
}
-void msx_cart_korean_126in1_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_korean_126in1_device::write_cart)
{
if (offset >= 0x4000 && offset < 0x4002)
{
diff --git a/src/devices/bus/msx_cart/korean.h b/src/devices/bus/msx_cart/korean.h
index 62c5a6ba82b..b34438da13e 100644
--- a/src/devices/bus/msx_cart/korean.h
+++ b/src/devices/bus/msx_cart/korean.h
@@ -20,14 +20,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
private:
void restore_banks();
@@ -46,17 +45,16 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+
+ DECLARE_WRITE8_MEMBER(banking);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
private:
- void banking(uint8_t data);
-
void restore_banks();
uint8_t m_bank_mask;
@@ -72,14 +70,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
private:
void restore_banks();
diff --git a/src/devices/bus/msx_cart/majutsushi.cpp b/src/devices/bus/msx_cart/majutsushi.cpp
index 66efee9188f..ef76b62af2a 100644
--- a/src/devices/bus/msx_cart/majutsushi.cpp
+++ b/src/devices/bus/msx_cart/majutsushi.cpp
@@ -26,26 +26,20 @@ msx_cart_majutsushi_device::msx_cart_majutsushi_device(const machine_config &mco
}
-void msx_cart_majutsushi_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_majutsushi_device::device_add_mconfig)
// This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'.
SPEAKER(config, "speaker").front_center();
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.05); // unknown DAC
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
-}
+ MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.05) // unknown DAC
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT)
+MACHINE_CONFIG_END
void msx_cart_majutsushi_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_majutsushi_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_majutsushi_device::restore_banks), this));
}
@@ -82,13 +76,13 @@ void msx_cart_majutsushi_device::initialize_cartridge()
}
-uint8_t msx_cart_majutsushi_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_majutsushi_device::read_cart)
{
return m_bank_base[offset >> 13][offset & 0x1fff];
}
-void msx_cart_majutsushi_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_majutsushi_device::write_cart)
{
switch (offset & 0xe000)
{
diff --git a/src/devices/bus/msx_cart/majutsushi.h b/src/devices/bus/msx_cart/majutsushi.h
index ebdf549272e..596fac47050 100644
--- a/src/devices/bus/msx_cart/majutsushi.h
+++ b/src/devices/bus/msx_cart/majutsushi.h
@@ -19,14 +19,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/bus/msx_cart/moonsound.cpp b/src/devices/bus/msx_cart/moonsound.cpp
index e01498c57bc..d8b1fda9a5e 100644
--- a/src/devices/bus/msx_cart/moonsound.cpp
+++ b/src/devices/bus/msx_cart/moonsound.cpp
@@ -67,10 +67,13 @@ const tiny_rom_entry *msx_cart_moonsound_device::device_rom_region() const
void msx_cart_moonsound_device::device_start()
{
+ m_out_irq_cb.resolve_safe();
+
// Install IO read/write handlers
- io_space().install_readwrite_handler(0x7e, 0x7f, read8sm_delegate(FUNC(msx_cart_moonsound_device::read_ymf278b_pcm), this), write8sm_delegate(FUNC(msx_cart_moonsound_device::write_ymf278b_pcm), this));
- io_space().install_readwrite_handler(0xc4, 0xc7, read8sm_delegate(FUNC(msx_cart_moonsound_device::read_ymf278b_fm), this), write8sm_delegate(FUNC(msx_cart_moonsound_device::write_ymf278b_fm), this));
- io_space().install_read_handler(0xc0, 0xc0, read8smo_delegate(FUNC(msx_cart_moonsound_device::read_c0), this));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_readwrite_handler(0x7e, 0x7f, read8_delegate(FUNC(msx_cart_moonsound_device::read_ymf278b_pcm), this), write8_delegate(FUNC(msx_cart_moonsound_device::write_ymf278b_pcm), this));
+ space.install_readwrite_handler(0xc4, 0xc7, read8_delegate(FUNC(msx_cart_moonsound_device::read_ymf278b_fm), this), write8_delegate(FUNC(msx_cart_moonsound_device::write_ymf278b_fm), this));
+ space.install_read_handler(0xc0, 0xc0, read8_delegate(FUNC(msx_cart_moonsound_device::read_c0), this));
}
@@ -82,40 +85,40 @@ void msx_cart_moonsound_device::device_reset()
WRITE_LINE_MEMBER(msx_cart_moonsound_device::irq_w)
{
LOG("moonsound: irq state %d\n", state);
- irq_out(state);
+ m_out_irq_cb(state);
}
-void msx_cart_moonsound_device::write_ymf278b_fm(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_moonsound_device::write_ymf278b_fm)
{
LOG("moonsound: write 0x%02x, data 0x%02x\n", 0xc4 + offset, data);
- m_ymf278b->write(offset, data);
+ m_ymf278b->write(space, offset, data);
}
-uint8_t msx_cart_moonsound_device::read_ymf278b_fm(offs_t offset)
+READ8_MEMBER(msx_cart_moonsound_device::read_ymf278b_fm)
{
LOG("moonsound: read 0x%02x\n", 0xc4 + offset);
- return m_ymf278b->read(offset);
+ return m_ymf278b->read(space, offset);
}
-void msx_cart_moonsound_device::write_ymf278b_pcm(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_moonsound_device::write_ymf278b_pcm)
{
LOG("moonsound: write 0x%02x, data 0x%02x\n", 0x7e + offset, data);
- m_ymf278b->write(4 + offset, data);
+ m_ymf278b->write(space, 4 + offset, data);
}
-uint8_t msx_cart_moonsound_device::read_ymf278b_pcm(offs_t offset)
+READ8_MEMBER(msx_cart_moonsound_device::read_ymf278b_pcm)
{
LOG("moonsound: read 0x%02x\n", 0x7e + offset);
- return m_ymf278b->read(4 + offset);
+ return m_ymf278b->read(space, 4 + offset);
}
// For detecting presence of moonsound cartridge
-uint8_t msx_cart_moonsound_device::read_c0()
+READ8_MEMBER(msx_cart_moonsound_device::read_c0)
{
LOG("moonsound: read 0xc0\n");
return 0x00;
diff --git a/src/devices/bus/msx_cart/moonsound.h b/src/devices/bus/msx_cart/moonsound.h
index ca30dfb5c35..02f16c94ed3 100644
--- a/src/devices/bus/msx_cart/moonsound.h
+++ b/src/devices/bus/msx_cart/moonsound.h
@@ -27,11 +27,11 @@ protected:
private:
DECLARE_WRITE_LINE_MEMBER(irq_w);
- void write_ymf278b_fm(offs_t offset, uint8_t data);
- uint8_t read_ymf278b_fm(offs_t offset);
- void write_ymf278b_pcm(offs_t offset, uint8_t data);
- uint8_t read_ymf278b_pcm(offs_t offset);
- uint8_t read_c0();
+ DECLARE_WRITE8_MEMBER(write_ymf278b_fm);
+ DECLARE_READ8_MEMBER(read_ymf278b_fm);
+ DECLARE_WRITE8_MEMBER(write_ymf278b_pcm);
+ DECLARE_READ8_MEMBER(read_ymf278b_pcm);
+ DECLARE_READ8_MEMBER(read_c0);
void ymf278b_map(address_map &map);
diff --git a/src/devices/bus/msx_cart/msx_audio.cpp b/src/devices/bus/msx_cart/msx_audio.cpp
index 679c035b014..61f96ff1eaa 100644
--- a/src/devices/bus/msx_cart/msx_audio.cpp
+++ b/src/devices/bus/msx_cart/msx_audio.cpp
@@ -96,8 +96,9 @@ void msx_cart_msx_audio_hxmu900_device::device_add_mconfig(machine_config &confi
void msx_cart_msx_audio_hxmu900_device::device_start()
{
// Install IO read/write handlers
- io_space().install_write_handler(0xc0, 0xc1, write8sm_delegate(FUNC(y8950_device::write), m_y8950.target()));
- io_space().install_read_handler(0xc0, 0xc1, read8sm_delegate(FUNC(y8950_device::read), m_y8950.target()));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0xc0, 0xc1, write8_delegate(FUNC(y8950_device::write), m_y8950.target()));
+ space.install_read_handler(0xc0, 0xc1, read8_delegate(FUNC(y8950_device::read), m_y8950.target()));
}
@@ -110,7 +111,7 @@ void msx_cart_msx_audio_hxmu900_device::initialize_cartridge()
}
-uint8_t msx_cart_msx_audio_hxmu900_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_msx_audio_hxmu900_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xC000)
{
@@ -200,10 +201,11 @@ WRITE_LINE_MEMBER(msx_cart_msx_audio_nms1205_device::midi_in)
void msx_cart_msx_audio_nms1205_device::device_start()
{
// Install IO read/write handlers
- io_space().install_write_handler(0xc0, 0xc1, write8sm_delegate(FUNC(y8950_device::write), m_y8950.target()));
- io_space().install_read_handler(0xc0, 0xc1, read8sm_delegate(FUNC(y8950_device::read), m_y8950.target()));
- io_space().install_write_handler(0x00, 0x01, write8sm_delegate(FUNC(acia6850_device::write), m_acia6850.target()));
- io_space().install_read_handler(0x04, 0x05, read8sm_delegate(FUNC(acia6850_device::read), m_acia6850.target()));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0xc0, 0xc1, write8_delegate(FUNC(y8950_device::write), m_y8950.target()));
+ space.install_read_handler(0xc0, 0xc1, read8_delegate(FUNC(y8950_device::read), m_y8950.target()));
+ space.install_write_handler(0x00, 0x01, write8_delegate(FUNC(acia6850_device::write), m_acia6850.target()));
+ space.install_read_handler(0x04, 0x05, read8_delegate(FUNC(acia6850_device::read), m_acia6850.target()));
}
@@ -216,7 +218,7 @@ void msx_cart_msx_audio_nms1205_device::initialize_cartridge()
}
-uint8_t msx_cart_msx_audio_nms1205_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_msx_audio_nms1205_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xC000)
{
@@ -287,8 +289,9 @@ const tiny_rom_entry *msx_cart_msx_audio_fsca1_device::device_rom_region() const
void msx_cart_msx_audio_fsca1_device::device_start()
{
// Install IO read/write handlers
- io_space().install_write_handler(0xc0, 0xc3, write8sm_delegate(FUNC(msx_cart_msx_audio_fsca1_device::write_y8950), this));
- io_space().install_read_handler(0xc0, 0xc3, read8sm_delegate(FUNC(msx_cart_msx_audio_fsca1_device::read_y8950), this));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0xc0, 0xc3, write8_delegate(FUNC(msx_cart_msx_audio_fsca1_device::write_y8950), this));
+ space.install_read_handler(0xc0, 0xc3, read8_delegate(FUNC(msx_cart_msx_audio_fsca1_device::read_y8950), this));
}
@@ -301,7 +304,7 @@ void msx_cart_msx_audio_fsca1_device::initialize_cartridge()
}
-uint8_t msx_cart_msx_audio_fsca1_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_msx_audio_fsca1_device::read_cart)
{
if (m_7ffe == 0 && (offset & 0xB000) == 0x3000)
{
@@ -311,7 +314,7 @@ uint8_t msx_cart_msx_audio_fsca1_device::read_cart(offs_t offset)
}
-void msx_cart_msx_audio_fsca1_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_msx_audio_fsca1_device::write_cart)
{
if (offset == 0x7ffe)
{
@@ -335,45 +338,45 @@ void msx_cart_msx_audio_fsca1_device::write_cart(offs_t offset, uint8_t data)
}
-void msx_cart_msx_audio_fsca1_device::write_y8950(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_msx_audio_fsca1_device::write_y8950)
{
if (offset & 2)
{
if (m_7fff & 0x02)
{
- m_y8950->write(offset, data);
+ m_y8950->write(space, offset, data);
}
}
else
{
if (m_7fff & 0x01)
{
- m_y8950->write(offset, data);
+ m_y8950->write(space, offset, data);
}
}
}
-uint8_t msx_cart_msx_audio_fsca1_device::read_y8950(offs_t offset)
+READ8_MEMBER(msx_cart_msx_audio_fsca1_device::read_y8950)
{
if (offset & 2)
{
- return (m_7fff & 0x02) ? m_y8950->read(offset) : 0xff;
+ return (m_7fff & 0x02) ? m_y8950->read(space, offset) : 0xff;
}
else
{
- return (m_7fff & 0x01) ? m_y8950->read(offset) : 0xff;
+ return (m_7fff & 0x01) ? m_y8950->read(space, offset) : 0xff;
}
}
-void msx_cart_msx_audio_fsca1_device::y8950_io_w(uint8_t data)
+WRITE8_MEMBER(msx_cart_msx_audio_fsca1_device::y8950_io_w)
{
logerror("msx_fsca1::y8950_io_w: %02x\n", data);
}
-uint8_t msx_cart_msx_audio_fsca1_device::y8950_io_r()
+READ8_MEMBER(msx_cart_msx_audio_fsca1_device::y8950_io_r)
{
return m_io_config->read();
}
diff --git a/src/devices/bus/msx_cart/msx_audio.h b/src/devices/bus/msx_cart/msx_audio.h
index 3aeee7cddf1..d9fc89baa8c 100644
--- a/src/devices/bus/msx_cart/msx_audio.h
+++ b/src/devices/bus/msx_cart/msx_audio.h
@@ -23,7 +23,7 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
protected:
virtual void device_start() override;
@@ -44,7 +44,7 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
protected:
virtual void device_start() override;
@@ -71,8 +71,8 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
virtual void device_start() override;
@@ -82,12 +82,12 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual const tiny_rom_entry *device_rom_region() const override;
-private:
- void write_y8950(offs_t offset, uint8_t data);
- uint8_t read_y8950(offs_t offset);
+ DECLARE_WRITE8_MEMBER(write_y8950);
+ DECLARE_READ8_MEMBER(read_y8950);
- void y8950_io_w(uint8_t data);
- uint8_t y8950_io_r();
+private:
+ DECLARE_WRITE8_MEMBER(y8950_io_w);
+ DECLARE_READ8_MEMBER(y8950_io_r);
required_device<y8950_device> m_y8950;
required_ioport m_io_config;
diff --git a/src/devices/bus/msx_cart/msx_audio_kb.cpp b/src/devices/bus/msx_cart/msx_audio_kb.cpp
index 68303c56667..9bbae0aab93 100644
--- a/src/devices/bus/msx_cart/msx_audio_kb.cpp
+++ b/src/devices/bus/msx_cart/msx_audio_kb.cpp
@@ -21,20 +21,20 @@ void msx_audio_kbdc_port_device::device_start()
}
-void msx_audio_kbdc_port_device::write(uint8_t data)
+WRITE8_MEMBER(msx_audio_kbdc_port_device::write)
{
if (m_keyboard)
{
- m_keyboard->write(data);
+ m_keyboard->write(space, offset, data);
}
}
-uint8_t msx_audio_kbdc_port_device::read()
+READ8_MEMBER(msx_audio_kbdc_port_device::read)
{
if (m_keyboard)
{
- return m_keyboard->read();
+ return m_keyboard->read(space, offset);
}
return 0xff;
}
@@ -57,7 +57,7 @@ public:
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t read() override
+ virtual DECLARE_READ8_MEMBER(read) override
{
uint8_t result = 0xff;
@@ -71,7 +71,7 @@ public:
return result;
}
- virtual void write(uint8_t data) override
+ virtual DECLARE_WRITE8_MEMBER(write) override
{
m_row = data;
}
@@ -187,7 +187,7 @@ public:
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t read() override
+ virtual DECLARE_READ8_MEMBER(read) override
{
uint8_t result = 0xff;
@@ -201,7 +201,7 @@ public:
return result;
}
- virtual void write(uint8_t data) override
+ virtual DECLARE_WRITE8_MEMBER(write) override
{
logerror("msx_nms1160::write %02x\n", data);
m_row = data;
diff --git a/src/devices/bus/msx_cart/msx_audio_kb.h b/src/devices/bus/msx_cart/msx_audio_kb.h
index 93a2d026214..25f0a2d24f8 100644
--- a/src/devices/bus/msx_cart/msx_audio_kb.h
+++ b/src/devices/bus/msx_cart/msx_audio_kb.h
@@ -10,8 +10,9 @@ DECLARE_DEVICE_TYPE(MSX_AUDIO_KBDC_PORT, msx_audio_kbdc_port_device)
class msx_audio_kb_port_interface : public device_slot_card_interface
{
public:
- virtual uint8_t read() { return 0xff; }
- virtual void write(uint8_t data) { }
+
+ virtual DECLARE_READ8_MEMBER(read) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write) { }
protected:
// construction/destruction
@@ -38,8 +39,8 @@ public:
virtual void device_start() override;
// Physical connection simply consists of 8 input and 8 output lines split across 2 connectors
- void write(uint8_t data);
- uint8_t read();
+ DECLARE_WRITE8_MEMBER(write);
+ DECLARE_READ8_MEMBER(read);
protected:
diff --git a/src/devices/bus/msx_cart/msxdos2.cpp b/src/devices/bus/msx_cart/msxdos2.cpp
index 7f3e506b007..f4e391f66e9 100644
--- a/src/devices/bus/msx_cart/msxdos2.cpp
+++ b/src/devices/bus/msx_cart/msxdos2.cpp
@@ -18,12 +18,8 @@ msx_cart_msxdos2_device::msx_cart_msxdos2_device(const machine_config &mconfig,
void msx_cart_msxdos2_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_msxdos2_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_msxdos2_device::restore_banks), this));
}
@@ -50,7 +46,7 @@ void msx_cart_msxdos2_device::initialize_cartridge()
}
-uint8_t msx_cart_msxdos2_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_msxdos2_device::read_cart)
{
if (offset >= 0x4000 && offset < 0x8000)
{
@@ -61,7 +57,7 @@ uint8_t msx_cart_msxdos2_device::read_cart(offs_t offset)
}
-void msx_cart_msxdos2_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_msxdos2_device::write_cart)
{
if (offset == 0x6000)
{
diff --git a/src/devices/bus/msx_cart/msxdos2.h b/src/devices/bus/msx_cart/msxdos2.h
index dd5eb51d245..b30fbb70bd8 100644
--- a/src/devices/bus/msx_cart/msxdos2.h
+++ b/src/devices/bus/msx_cart/msxdos2.h
@@ -18,14 +18,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/nomapper.cpp b/src/devices/bus/msx_cart/nomapper.cpp
index 24ebbb38e0d..5152464cbc4 100644
--- a/src/devices/bus/msx_cart/nomapper.cpp
+++ b/src/devices/bus/msx_cart/nomapper.cpp
@@ -84,7 +84,7 @@ void msx_cart_nomapper_device::initialize_cartridge()
m_end_address = std::min<uint32_t>(m_start_address + size, 0x10000);
}
-uint8_t msx_cart_nomapper_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_nomapper_device::read_cart)
{
if ( offset >= m_start_address && offset < m_end_address )
{
diff --git a/src/devices/bus/msx_cart/nomapper.h b/src/devices/bus/msx_cart/nomapper.h
index eb5e40e1d08..7b29b6a69b3 100644
--- a/src/devices/bus/msx_cart/nomapper.h
+++ b/src/devices/bus/msx_cart/nomapper.h
@@ -21,7 +21,7 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
private:
uint32_t m_start_address;
diff --git a/src/devices/bus/msx_cart/rtype.cpp b/src/devices/bus/msx_cart/rtype.cpp
index 6cda0efb4e8..3853cfeed9a 100644
--- a/src/devices/bus/msx_cart/rtype.cpp
+++ b/src/devices/bus/msx_cart/rtype.cpp
@@ -21,12 +21,8 @@ msx_cart_rtype_device::msx_cart_rtype_device(const machine_config &mconfig, cons
void msx_cart_rtype_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_rtype_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_rtype_device::restore_banks), this));
}
@@ -58,7 +54,7 @@ void msx_cart_rtype_device::initialize_cartridge()
}
-uint8_t msx_cart_rtype_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_rtype_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -68,7 +64,7 @@ uint8_t msx_cart_rtype_device::read_cart(offs_t offset)
}
-void msx_cart_rtype_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_rtype_device::write_cart)
{
if (offset >= 0x7000 && offset < 0x8000)
{
diff --git a/src/devices/bus/msx_cart/rtype.h b/src/devices/bus/msx_cart/rtype.h
index 31583455a0a..435d8666273 100644
--- a/src/devices/bus/msx_cart/rtype.h
+++ b/src/devices/bus/msx_cart/rtype.h
@@ -18,14 +18,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/super_swangi.cpp b/src/devices/bus/msx_cart/super_swangi.cpp
index a64b0648195..75ee75be6a0 100644
--- a/src/devices/bus/msx_cart/super_swangi.cpp
+++ b/src/devices/bus/msx_cart/super_swangi.cpp
@@ -19,12 +19,8 @@ msx_cart_super_swangi_device::msx_cart_super_swangi_device(const machine_config
void msx_cart_super_swangi_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_super_swangi_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_super_swangi_device::restore_banks), this));
}
@@ -52,7 +48,7 @@ void msx_cart_super_swangi_device::initialize_cartridge()
}
-uint8_t msx_cart_super_swangi_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_super_swangi_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -62,7 +58,7 @@ uint8_t msx_cart_super_swangi_device::read_cart(offs_t offset)
}
-void msx_cart_super_swangi_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_super_swangi_device::write_cart)
{
if (offset == 0x8000)
{
diff --git a/src/devices/bus/msx_cart/super_swangi.h b/src/devices/bus/msx_cart/super_swangi.h
index f0f5ee216bd..cf3b9f3b7c9 100644
--- a/src/devices/bus/msx_cart/super_swangi.h
+++ b/src/devices/bus/msx_cart/super_swangi.h
@@ -18,14 +18,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/superloderunner.cpp b/src/devices/bus/msx_cart/superloderunner.cpp
index b846a935953..51289c24f10 100644
--- a/src/devices/bus/msx_cart/superloderunner.cpp
+++ b/src/devices/bus/msx_cart/superloderunner.cpp
@@ -19,14 +19,11 @@ void msx_cart_superloderunner_device::device_start()
{
save_item(NAME(m_selected_bank));
- // Install evil memory write handler
- memory_space().install_write_handler(0x0000, 0x0000, write8smo_delegate(FUNC(msx_cart_superloderunner_device::banking), this));
-}
-
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_superloderunner_device::restore_banks), this));
-void msx_cart_superloderunner_device::device_post_load()
-{
- restore_banks();
+ // Install evil memory write handler
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_PROGRAM);
+ space.install_write_handler(0x0000, 0x0000, write8_delegate(FUNC(msx_cart_superloderunner_device::banking), this));
}
@@ -47,7 +44,7 @@ void msx_cart_superloderunner_device::initialize_cartridge()
}
-uint8_t msx_cart_superloderunner_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_superloderunner_device::read_cart)
{
if (offset >= 0x8000 && offset < 0xc000)
{
@@ -58,7 +55,7 @@ uint8_t msx_cart_superloderunner_device::read_cart(offs_t offset)
}
-void msx_cart_superloderunner_device::banking(uint8_t data)
+WRITE8_MEMBER(msx_cart_superloderunner_device::banking)
{
m_selected_bank = data;
restore_banks();
diff --git a/src/devices/bus/msx_cart/superloderunner.h b/src/devices/bus/msx_cart/superloderunner.h
index bd763ca2c08..b8e73535ebf 100644
--- a/src/devices/bus/msx_cart/superloderunner.h
+++ b/src/devices/bus/msx_cart/superloderunner.h
@@ -18,18 +18,17 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+
+ DECLARE_WRITE8_MEMBER(banking);
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_post_load() override;
void restore_banks();
private:
- void banking(uint8_t data);
-
uint8_t m_selected_bank;
uint8_t *m_bank_base;
};
diff --git a/src/devices/bus/msx_cart/yamaha.cpp b/src/devices/bus/msx_cart/yamaha.cpp
index 9296779f1b3..e6f7dc844fe 100644
--- a/src/devices/bus/msx_cart/yamaha.cpp
+++ b/src/devices/bus/msx_cart/yamaha.cpp
@@ -131,22 +131,22 @@ void msx_cart_sfg_device::check_irq()
{
if (m_ym2151_irq_state != CLEAR_LINE || m_ym2148_irq_state != CLEAR_LINE)
{
- irq_out(ASSERT_LINE);
+ m_out_irq_cb(ASSERT_LINE);
}
else
{
- irq_out(CLEAR_LINE);
+ m_out_irq_cb(CLEAR_LINE);
}
}
-uint8_t msx_cart_sfg_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_sfg_device::read_cart)
{
switch (offset & 0x3fff)
{
case 0x3ff0: // YM-2151 status read
case 0x3ff1: // YM-2151 status read mirror?
- return m_ym2151->status_r();
+ return m_ym2151->status_r(space, 0);
case 0x3ff2: // YM-2148 keyboard column read
case 0x3ff3: // YM-2148 --
@@ -155,7 +155,7 @@ uint8_t msx_cart_sfg_device::read_cart(offs_t offset)
case 0x3ff6: // YM-2148 MIDI UART status register
// ------x- - 1 = received a byte/receive buffer full?
// -------x - 1 = ready to send next byte/send buffer empty?
- return m_ym2148->read(offset & 7);
+ return m_ym2148->read(space, offset & 7);
}
if (offset < 0x8000)
@@ -167,16 +167,16 @@ uint8_t msx_cart_sfg_device::read_cart(offs_t offset)
}
-void msx_cart_sfg_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_sfg_device::write_cart)
{
switch (offset & 0x3fff)
{
case 0x3ff0: // YM-2151 register
- m_ym2151->register_w(data);
+ m_ym2151->register_w(space, 0, data);
break;
case 0x3ff1: // YM-2151 data
- m_ym2151->data_w(data);
+ m_ym2151->data_w(space, 0, data);
break;
case 0x3ff2: // YM-2148 write keyboard row
@@ -191,7 +191,7 @@ void msx_cart_sfg_device::write_cart(offs_t offset, uint8_t data)
// x------- - 1 = reset
// -----x-- - 1 = enable receiving / sending midi data
// -------x - 1 = enable receiving / sending midi data
- m_ym2148->write(offset & 7, data);
+ m_ym2148->write(space, offset & 7, data);
break;
default:
diff --git a/src/devices/bus/msx_cart/yamaha.h b/src/devices/bus/msx_cart/yamaha.h
index e5072dc5dcf..b8f30bf057f 100644
--- a/src/devices/bus/msx_cart/yamaha.h
+++ b/src/devices/bus/msx_cart/yamaha.h
@@ -18,9 +18,8 @@ DECLARE_DEVICE_TYPE(MSX_CART_SFG05, msx_cart_sfg05_device)
class msx_cart_sfg_device : public device_t, public msx_cart_interface
{
public:
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
-
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
msx_cart_sfg_device(const machine_config &mconfig, const device_type type, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/bus/msx_slot/bunsetsu.cpp b/src/devices/bus/msx_slot/bunsetsu.cpp
index 79a07b2e53a..a2f8a131a54 100644
--- a/src/devices/bus/msx_slot/bunsetsu.cpp
+++ b/src/devices/bus/msx_slot/bunsetsu.cpp
@@ -25,17 +25,17 @@ void msx_slot_bunsetsu_device::device_reset()
}
-uint8_t msx_slot_bunsetsu_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_bunsetsu_device::read)
{
if (offset == 0xbfff)
{
return m_bunsetsu_region[m_bunsetsu_address++ & 0x1ffff];
}
- return msx_slot_rom_device::read(offset);
+ return msx_slot_rom_device::read(space, offset);
}
-void msx_slot_bunsetsu_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_bunsetsu_device::write)
{
switch (offset)
{
diff --git a/src/devices/bus/msx_slot/bunsetsu.h b/src/devices/bus/msx_slot/bunsetsu.h
index df0bcedb32f..70649340824 100644
--- a/src/devices/bus/msx_slot/bunsetsu.h
+++ b/src/devices/bus/msx_slot/bunsetsu.h
@@ -12,6 +12,11 @@
DECLARE_DEVICE_TYPE(MSX_SLOT_BUNSETSU, msx_slot_bunsetsu_device)
+#define MCFG_MSX_SLOT_BUNSETSU_ADD(_tag, _startpage, _numpages, _region, _offset, _bunsetsu_region_tag) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_BUNSETSU, _startpage, _numpages) \
+ downcast<msx_slot_rom_device &>(*device).set_rom_start(_region, _offset); \
+ downcast<msx_slot_bunsetsu_device &>(*device).set_bunsetsu_region_tag(_bunsetsu_region_tag);
+
class msx_slot_bunsetsu_device : public msx_slot_rom_device
{
public:
@@ -20,8 +25,8 @@ public:
// configuration helpers
void set_bunsetsu_region_tag(const char *tag) { m_bunsetsu_region.set_tag(tag); }
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
protected:
virtual void device_reset() override;
diff --git a/src/devices/bus/msx_slot/cartridge.cpp b/src/devices/bus/msx_slot/cartridge.cpp
index 87b89f93c78..522ea6f4548 100644
--- a/src/devices/bus/msx_slot/cartridge.cpp
+++ b/src/devices/bus/msx_slot/cartridge.cpp
@@ -43,7 +43,7 @@ msx_slot_cartridge_device::msx_slot_cartridge_device(const machine_config &mconf
: device_t(mconfig, type, tag, owner, clock)
, device_image_interface(mconfig, *this)
, device_slot_interface(mconfig, *this)
- , msx_internal_slot_interface(mconfig, *this)
+ , msx_internal_slot_interface()
, m_irq_handler(*this)
, m_cartridge(nullptr)
{
@@ -90,17 +90,10 @@ static const char *msx_cart_get_slot_option(int type)
}
-void msx_slot_cartridge_device::device_resolve_objects()
+void msx_slot_cartridge_device::device_start()
{
m_irq_handler.resolve_safe();
m_cartridge = dynamic_cast<msx_cart_interface *>(get_card_device());
- if (m_cartridge)
- m_cartridge->m_exp = this;
-}
-
-
-void msx_slot_cartridge_device::device_start()
-{
}
@@ -176,7 +169,7 @@ image_init_result msx_slot_cartridge_device::call_load()
}
}
- m_cartridge->m_exp = this;
+ m_cartridge->set_out_irq_cb(DEVCB_WRITELINE(*this, msx_slot_cartridge_device, irq_out));
m_cartridge->initialize_cartridge();
if (m_cartridge->get_sram_size() > 0)
@@ -338,21 +331,21 @@ std::string msx_slot_cartridge_device::get_default_card_software(get_default_car
}
-uint8_t msx_slot_cartridge_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_cartridge_device::read)
{
if ( m_cartridge )
{
- return m_cartridge->read_cart(offset);
+ return m_cartridge->read_cart(space, offset);
}
return 0xFF;
}
-void msx_slot_cartridge_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_cartridge_device::write)
{
if ( m_cartridge )
{
- m_cartridge->write_cart(offset, data);
+ m_cartridge->write_cart(space, offset, data);
}
}
@@ -367,4 +360,8 @@ msx_slot_yamaha_expansion_device::msx_slot_yamaha_expansion_device(const machine
void msx_slot_yamaha_expansion_device::device_start()
{
+ m_irq_handler.resolve_safe();
+ m_cartridge = dynamic_cast<msx_cart_interface *>(get_card_device());
+ if (m_cartridge)
+ m_cartridge->set_out_irq_cb(DEVCB_WRITELINE(*this, msx_slot_cartridge_device, irq_out));
}
diff --git a/src/devices/bus/msx_slot/cartridge.h b/src/devices/bus/msx_slot/cartridge.h
index faabf394042..be0856e8d82 100644
--- a/src/devices/bus/msx_slot/cartridge.h
+++ b/src/devices/bus/msx_slot/cartridge.h
@@ -14,6 +14,18 @@ DECLARE_DEVICE_TYPE(MSX_SLOT_CARTRIDGE, msx_slot_cartridge_device)
DECLARE_DEVICE_TYPE(MSX_SLOT_YAMAHA_EXPANSION, msx_slot_yamaha_expansion_device)
+#define MCFG_MSX_SLOT_CARTRIDGE_ADD(_tag, _devcb) \
+ MCFG_DEVICE_ADD(_tag, MSX_SLOT_CARTRIDGE, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(msx_cart, nullptr, false) \
+ downcast<msx_slot_cartridge_device &>(*device).set_irq_handler(DEVCB_##_devcb);
+
+
+#define MCFG_MSX_SLOT_YAMAHA_EXPANSION_ADD(_tag, _devcb, _default) \
+ MCFG_DEVICE_ADD(_tag, MSX_SLOT_YAMAHA_EXPANSION, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(msx_yamaha_60pin, _default, false) \
+ downcast<msx_slot_cartridge_device &>(*device).set_irq_handler(DEVCB_##_devcb);
+
+
class msx_slot_cartridge_device : public device_t
, public device_image_interface
, public device_slot_interface
@@ -23,8 +35,8 @@ public:
// construction/destruction
msx_slot_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // configuration helpers
- auto irq_handler() { return m_irq_handler.bind(); }
+ // static configuration helpers
+ template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
// image-level overrides
virtual image_init_result call_load() override;
@@ -45,8 +57,8 @@ public:
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
// msx_internal_slot-level overrides
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
DECLARE_WRITE_LINE_MEMBER(irq_out);
@@ -54,7 +66,6 @@ protected:
msx_slot_cartridge_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void device_resolve_objects() override;
virtual void device_start() override;
devcb_write_line m_irq_handler;
diff --git a/src/devices/bus/msx_slot/disk.cpp b/src/devices/bus/msx_slot/disk.cpp
index 309b7f2d80f..39ec248e3f2 100644
--- a/src/devices/bus/msx_slot/disk.cpp
+++ b/src/devices/bus/msx_slot/disk.cpp
@@ -137,6 +137,8 @@ void msx_slot_disk1_device::device_start()
save_item(NAME(m_side_control));
save_item(NAME(m_control));
+
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_slot_disk1_device::post_load), this));
}
@@ -146,7 +148,7 @@ void msx_slot_disk1_device::device_reset()
}
-void msx_slot_disk1_device::device_post_load()
+void msx_slot_disk1_device::post_load()
{
uint8_t data = m_control;
@@ -205,7 +207,7 @@ void msx_slot_disk1_device::set_control(uint8_t data)
}
-uint8_t msx_slot_disk1_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_disk1_device::read)
{
switch (offset)
{
@@ -238,11 +240,11 @@ uint8_t msx_slot_disk1_device::read(offs_t offset)
return 0x3f | (m_fdc->intrq_r() ? 0 : 0x40) | (m_fdc->drq_r() ? 0 : 0x80);
}
- return msx_slot_rom_device::read(offset);
+ return msx_slot_rom_device::read(space, offset);
}
-void msx_slot_disk1_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_disk1_device::write)
{
switch (offset)
{
@@ -296,6 +298,8 @@ void msx_slot_disk2_device::device_start()
msx_slot_wd_disk_device::device_start();
save_item(NAME(m_control));
+
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_slot_disk2_device::post_load), this));
}
@@ -305,7 +309,7 @@ void msx_slot_disk2_device::device_reset()
}
-void msx_slot_disk2_device::device_post_load()
+void msx_slot_disk2_device::post_load()
{
uint8_t data = m_control;
@@ -352,7 +356,7 @@ void msx_slot_disk2_device::set_control(uint8_t data)
}
-uint8_t msx_slot_disk2_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_disk2_device::read)
{
switch (offset)
{
@@ -377,11 +381,11 @@ uint8_t msx_slot_disk2_device::read(offs_t offset)
return 0x3f | (m_fdc->drq_r() ? 0 : 0x40) | (m_fdc->intrq_r() ? 0x80 : 0);
}
- return msx_slot_rom_device::read(offset);
+ return msx_slot_rom_device::read(space, offset);
}
-void msx_slot_disk2_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_disk2_device::write)
{
switch (offset)
{
@@ -427,20 +431,20 @@ msx_slot_disk3_device::msx_slot_disk3_device(const machine_config &mconfig, cons
}
-void msx_slot_disk3_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_disk3_device::write)
{
switch (offset)
{
case 0x7ff8: // CR0 : 0 - 0 - MEN1 - MEN0 - 0 - -FRST - 0 - DSA
- m_fdc->dor_w(data);
+ m_fdc->dor_w(space, 2, data);
break;
case 0x7ff9: // CR1 : 0 - 0 - C4E - C4 - SBME - SBM - TCE - FDCTC
- m_fdc->cr1_w(data);
+ m_fdc->cr1_w(space, 3, data);
break;
case 0x7ffb: // Data Register
- m_fdc->fifo_w(data);
+ m_fdc->fifo_w(space, 5, data);
break;
default:
@@ -450,17 +454,17 @@ void msx_slot_disk3_device::write(offs_t offset, uint8_t data)
}
-uint8_t msx_slot_disk3_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_disk3_device::read)
{
switch (offset)
{
case 0x7ffa: // Status Register
- return m_fdc->msr_r();
+ return m_fdc->msr_r(space, 4);
case 0x7ffb: // Data Register
- return m_fdc->fifo_r();
+ return m_fdc->fifo_r(space, 5);
}
- return msx_slot_rom_device::read(offset);
+ return msx_slot_rom_device::read(space, offset);
}
@@ -473,7 +477,7 @@ msx_slot_disk4_device::msx_slot_disk4_device(const machine_config &mconfig, cons
}
-void msx_slot_disk4_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_disk4_device::write)
{
switch (offset)
{
@@ -481,15 +485,15 @@ void msx_slot_disk4_device::write(offs_t offset, uint8_t data)
break;
case 0x7ff2: // CR0 : 0 - 0 - MEN1 - MEN0 - 0 - -FRST - 0 - DSA
- m_fdc->dor_w(data);
+ m_fdc->dor_w(space, 2, data);
break;
case 0x7ff3: // CR1 : 0 - 0 - C4E - C4 - SBME - SBM - TCE - FDCTC
- m_fdc->cr1_w(data);
+ m_fdc->cr1_w(space, 3, data);
break;
case 0x7ff5: // Data Register
- m_fdc->fifo_w(data);
+ m_fdc->fifo_w(space, 5, data);
break;
default:
@@ -499,7 +503,7 @@ void msx_slot_disk4_device::write(offs_t offset, uint8_t data)
}
-uint8_t msx_slot_disk4_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_disk4_device::read)
{
switch (offset)
{
@@ -508,12 +512,12 @@ uint8_t msx_slot_disk4_device::read(offs_t offset)
break;
case 0x7ff4: // Status Register
- return m_fdc->msr_r();
+ return m_fdc->msr_r(space, 4);
case 0x7ff5: // Data Register
- return m_fdc->fifo_r();
+ return m_fdc->fifo_r(space, 5);
}
- return msx_slot_rom_device::read(offset);
+ return msx_slot_rom_device::read(space, offset);
}
@@ -532,9 +536,12 @@ void msx_slot_disk5_device::device_start()
save_item(NAME(m_control));
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_slot_disk5_device::post_load), this));
+
// Install IO read/write handlers
- io_space().install_write_handler(0xd0, 0xd4, write8sm_delegate(FUNC(msx_slot_disk5_device::io_write), this));
- io_space().install_read_handler(0xd0, 0xd4, read8sm_delegate(FUNC(msx_slot_disk5_device::io_read), this));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0xd0, 0xd4, write8_delegate(FUNC(msx_slot_disk5_device::io_write), this));
+ space.install_read_handler(0xd0, 0xd4, read8_delegate(FUNC(msx_slot_disk5_device::io_read), this));
}
@@ -544,7 +551,7 @@ void msx_slot_disk5_device::device_reset()
}
-void msx_slot_disk5_device::device_post_load()
+void msx_slot_disk5_device::post_load()
{
set_control(m_control);
}
@@ -587,7 +594,7 @@ void msx_slot_disk5_device::set_control(uint8_t control)
}
-uint8_t msx_slot_disk5_device::io_read(offs_t offset)
+READ8_MEMBER(msx_slot_disk5_device::io_read)
{
switch (offset)
{
@@ -611,7 +618,7 @@ uint8_t msx_slot_disk5_device::io_read(offs_t offset)
}
-void msx_slot_disk5_device::io_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_disk5_device::io_write)
{
switch (offset)
{
@@ -655,6 +662,8 @@ void msx_slot_disk6_device::device_start()
save_item(NAME(m_side_motor));
save_item(NAME(m_drive_select0));
save_item(NAME(m_drive_select1));
+
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_slot_disk6_device::post_load), this));
}
@@ -664,7 +673,7 @@ void msx_slot_disk6_device::device_reset()
}
-void msx_slot_disk6_device::device_post_load()
+void msx_slot_disk6_device::post_load()
{
select_drive();
}
@@ -706,7 +715,7 @@ void msx_slot_disk6_device::set_side_motor()
}
-uint8_t msx_slot_disk6_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_disk6_device::read)
{
switch (offset)
{
@@ -748,11 +757,11 @@ uint8_t msx_slot_disk6_device::read(offs_t offset)
return 0x3f | (m_fdc->intrq_r() ? 0 : 0x40) | (m_fdc->drq_r() ? 0 : 0x80);
}
- return msx_slot_rom_device::read(offset);
+ return msx_slot_rom_device::read(space, offset);
}
-void msx_slot_disk6_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_disk6_device::write)
{
switch (offset)
{
diff --git a/src/devices/bus/msx_slot/disk.h b/src/devices/bus/msx_slot/disk.h
index 184ea2caf66..3b949f159e2 100644
--- a/src/devices/bus/msx_slot/disk.h
+++ b/src/devices/bus/msx_slot/disk.h
@@ -26,6 +26,51 @@ DECLARE_DEVICE_TYPE(MSX_SLOT_DISK5, msx_slot_disk5_device)
DECLARE_DEVICE_TYPE(MSX_SLOT_DISK6, msx_slot_disk6_device)
+#define MCFG_MSX_SLOT_DISK1_ADD(_tag, _startpage, _numpages, _region, _offset, _fdc_tag, _floppy0_tag, _floppy1_tag) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_DISK1, _startpage, _numpages) \
+ downcast<msx_slot_rom_device &>(*device).set_rom_start(_region, _offset); \
+ downcast<msx_slot_disk_device &>(*device).set_fdc_tag(_fdc_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy0_tag(_floppy0_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy1_tag(_floppy1_tag);
+
+#define MCFG_MSX_SLOT_DISK2_ADD(_tag, _startpage, _numpages, _region, _offset, _fdc_tag, _floppy0_tag, _floppy1_tag) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_DISK2, _startpage, _numpages) \
+ downcast<msx_slot_rom_device &>(*device).set_rom_start(_region, _offset); \
+ downcast<msx_slot_disk_device &>(*device).set_fdc_tag(_fdc_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy0_tag(_floppy0_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy1_tag(_floppy1_tag);
+
+#define MCFG_MSX_SLOT_DISK3_ADD(_tag, _startpage, _numpages, _region, _offset, _fdc_tag, _floppy0_tag, _floppy1_tag) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_DISK3, _startpage, _numpages) \
+ downcast<msx_slot_rom_device &>(*device).set_rom_start(_region, _offset); \
+ downcast<msx_slot_disk_device &>(*device).set_fdc_tag(_fdc_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy0_tag(_floppy0_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy1_tag(_floppy1_tag);
+
+#define MCFG_MSX_SLOT_DISK4_ADD(_tag, _startpage, _numpages, _region, _offset, _fdc_tag, _floppy0_tag, _floppy1_tag) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_DISK4, _startpage, _numpages) \
+ downcast<msx_slot_rom_device &>(*device).set_rom_start(_region, _offset); \
+ downcast<msx_slot_disk_device &>(*device).set_fdc_tag(_fdc_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy0_tag(_floppy0_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy1_tag(_floppy1_tag);
+
+#define MCFG_MSX_SLOT_DISK5_ADD(_tag, _startpage, _numpages, _region, _offset, _fdc_tag, _floppy0_tag, _floppy1_tag, _floppy2_tag, _floppy3_tag) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_DISK5, _startpage, _numpages) \
+ downcast<msx_slot_rom_device &>(*device).set_rom_start(_region, _offset); \
+ downcast<msx_slot_disk_device &>(*device).set_fdc_tag(_fdc_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy0_tag(_floppy0_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy1_tag(_floppy1_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy2_tag(_floppy2_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy3_tag(_floppy3_tag);
+
+#define MCFG_MSX_SLOT_DISK6_ADD(_tag, _startpage, _numpages, _region, _offset, _fdc_tag, _floppy0_tag, _floppy1_tag) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_DISK6, _startpage, _numpages) \
+ downcast<msx_slot_rom_device &>(*device).set_rom_start(_region, _offset); \
+ downcast<msx_slot_disk_device &>(*device).set_fdc_tag(_fdc_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy0_tag(_floppy0_tag); \
+ downcast<msx_slot_disk_device &>(*device).set_floppy1_tag(_floppy1_tag);
+
+
class msx_slot_disk_device : public msx_slot_rom_device
{
public:
@@ -36,21 +81,6 @@ public:
void set_floppy2_tag(const char *tag) { m_floppy2_tag = tag; }
void set_floppy3_tag(const char *tag) { m_floppy3_tag = tag; }
- void set_tags(const char *fdc_tag, const char *floppy0_tag, const char *floppy1_tag)
- {
- m_fdc_tag = fdc_tag;
- m_floppy0_tag = floppy0_tag;
- m_floppy1_tag = floppy1_tag;
- }
- void set_tags(const char *fdc_tag, const char *floppy0_tag, const char *floppy1_tag, const char *floppy2_tag, const char *floppy3_tag)
- {
- m_fdc_tag = fdc_tag;
- m_floppy0_tag = floppy0_tag;
- m_floppy1_tag = floppy1_tag;
- m_floppy2_tag = floppy2_tag;
- m_floppy3_tag = floppy3_tag;
- }
-
protected:
msx_slot_disk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -98,13 +128,14 @@ class msx_slot_disk1_device : public msx_slot_wd_disk_device
public:
msx_slot_disk1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
+
+ void post_load();
private:
uint8_t m_side_control;
@@ -120,13 +151,14 @@ class msx_slot_disk2_device : public msx_slot_wd_disk_device
public:
msx_slot_disk2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
+
+ void post_load();
private:
uint8_t m_control;
@@ -140,8 +172,8 @@ class msx_slot_disk3_device : public msx_slot_tc8566_disk_device
public:
msx_slot_disk3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
};
@@ -150,8 +182,8 @@ class msx_slot_disk4_device : public msx_slot_tc8566_disk_device
public:
msx_slot_disk4_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
};
@@ -160,15 +192,16 @@ class msx_slot_disk5_device : public msx_slot_wd_disk_device
public:
msx_slot_disk5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ DECLARE_READ8_MEMBER(io_read);
+ DECLARE_WRITE8_MEMBER(io_write);
+
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
-private:
- uint8_t io_read(offs_t offset);
- void io_write(offs_t offset, uint8_t data);
+ void post_load();
+private:
uint8_t m_control;
void set_control(uint8_t control);
@@ -180,13 +213,14 @@ class msx_slot_disk6_device : public msx_slot_wd_disk_device
public:
msx_slot_disk6_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
+
+ void post_load();
private:
uint8_t m_side_motor;
diff --git a/src/devices/bus/msx_slot/fs4600.cpp b/src/devices/bus/msx_slot/fs4600.cpp
index a7470fc2a78..dc975cdd4ba 100644
--- a/src/devices/bus/msx_slot/fs4600.cpp
+++ b/src/devices/bus/msx_slot/fs4600.cpp
@@ -13,7 +13,7 @@ DEFINE_DEVICE_TYPE(MSX_SLOT_FS4600, msx_slot_fs4600_device, "msx_slot_fs4600", "
msx_slot_fs4600_device::msx_slot_fs4600_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MSX_SLOT_FS4600, tag, owner, clock)
- , msx_internal_slot_interface(mconfig, *this)
+ , msx_internal_slot_interface()
, m_nvram(*this, "nvram")
, m_rom_region(*this, finder_base::DUMMY_TAG)
, m_region_offset(0)
@@ -48,12 +48,8 @@ void msx_slot_fs4600_device::device_start()
save_item(NAME(m_sram_address));
save_item(NAME(m_control));
- restore_banks();
-}
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_slot_fs4600_device::restore_banks), this));
-
-void msx_slot_fs4600_device::device_post_load()
-{
restore_banks();
}
@@ -67,7 +63,7 @@ void msx_slot_fs4600_device::restore_banks()
}
-uint8_t msx_slot_fs4600_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_fs4600_device::read)
{
if ((m_control & 0x02) && ((offset & 0x3fff) == 0x3ffd))
{
@@ -81,7 +77,7 @@ uint8_t msx_slot_fs4600_device::read(offs_t offset)
}
-void msx_slot_fs4600_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_fs4600_device::write)
{
if (offset == 0x7ff9)
{
diff --git a/src/devices/bus/msx_slot/fs4600.h b/src/devices/bus/msx_slot/fs4600.h
index 4b571c2ef56..c92bd7a3a1f 100644
--- a/src/devices/bus/msx_slot/fs4600.h
+++ b/src/devices/bus/msx_slot/fs4600.h
@@ -12,6 +12,10 @@
DECLARE_DEVICE_TYPE(MSX_SLOT_FS4600, msx_slot_fs4600_device)
+#define MCFG_MSX_SLOT_FS4600_ADD(_tag, _startpage, _numpages, _region, _offset) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_FS4600, _startpage, _numpages) \
+ downcast<msx_slot_fs4600_device &>(*device).set_rom_start(_region, _offset);
+
class msx_slot_fs4600_device : public device_t, public msx_internal_slot_interface
{
public:
@@ -20,12 +24,11 @@ public:
// configuration helpers
void set_rom_start(const char *region, uint32_t offset) { m_rom_region.set_tag(region); m_region_offset = offset; }
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
protected:
virtual void device_start() override;
- virtual void device_post_load() override;
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/bus/msx_slot/music.cpp b/src/devices/bus/msx_slot/music.cpp
index 0e3ae00b0f3..1e526dab7eb 100644
--- a/src/devices/bus/msx_slot/music.cpp
+++ b/src/devices/bus/msx_slot/music.cpp
@@ -32,17 +32,18 @@ void msx_slot_music_device::device_start()
}
// Install IO read/write handlers
- io_space().install_write_handler(0x7c, 0x7d, write8sm_delegate(FUNC(msx_slot_music_device::write_ym2413), this));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0x7c, 0x7d, write8_delegate(FUNC(msx_slot_music_device::write_ym2413), this));
}
-uint8_t msx_slot_music_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_music_device::read)
{
- return msx_slot_rom_device::read(offset);
+ return msx_slot_rom_device::read(space, offset);
}
-void msx_slot_music_device::write_ym2413(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_music_device::write_ym2413)
{
- m_ym2413->write(offset & 1, data);
+ m_ym2413->write(space, offset & 1, data);
}
diff --git a/src/devices/bus/msx_slot/music.h b/src/devices/bus/msx_slot/music.h
index 385e568c4e5..ae2ddc979d0 100644
--- a/src/devices/bus/msx_slot/music.h
+++ b/src/devices/bus/msx_slot/music.h
@@ -13,6 +13,11 @@
DECLARE_DEVICE_TYPE(MSX_SLOT_MUSIC, msx_slot_music_device)
+#define MCFG_MSX_SLOT_MUSIC_ADD(_tag, _startpage, _numpages, _region, _offset, _ym2413_tag) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_MUSIC, _startpage, _numpages) \
+ downcast<msx_slot_rom_device &>(*device).set_rom_start(_region, _offset); \
+ downcast<msx_slot_music_device &>(*device).set_ym2413_tag(_ym2413_tag);
+
class msx_slot_music_device : public msx_slot_rom_device
{
public:
@@ -21,14 +26,14 @@ public:
// configuration helpers
void set_ym2413_tag(const char *tag) { m_ym2413_tag = tag; }
- virtual uint8_t read(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+
+ DECLARE_WRITE8_MEMBER(write_ym2413);
protected:
virtual void device_start() override;
private:
- void write_ym2413(offs_t offset, uint8_t data);
-
ym2413_device *m_ym2413;
const char *m_ym2413_tag;
};
diff --git a/src/devices/bus/msx_slot/panasonic08.cpp b/src/devices/bus/msx_slot/panasonic08.cpp
index 0c46350051e..450f4fce1de 100644
--- a/src/devices/bus/msx_slot/panasonic08.cpp
+++ b/src/devices/bus/msx_slot/panasonic08.cpp
@@ -18,7 +18,7 @@ DEFINE_DEVICE_TYPE(MSX_SLOT_PANASONIC08, msx_slot_panasonic08_device, "msx_slot_
msx_slot_panasonic08_device::msx_slot_panasonic08_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MSX_SLOT_PANASONIC08, tag, owner, clock)
- , msx_internal_slot_interface(mconfig, *this)
+ , msx_internal_slot_interface()
, m_nvram(*this, "nvram")
, m_rom_region(*this, finder_base::DUMMY_TAG)
, m_region_offset(0)
@@ -56,12 +56,8 @@ void msx_slot_panasonic08_device::device_start()
save_item(NAME(m_selected_bank));
save_item(NAME(m_control));
- restore_banks();
-}
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_slot_panasonic08_device::restore_banks), this));
-
-void msx_slot_panasonic08_device::device_post_load()
-{
restore_banks();
}
@@ -89,7 +85,7 @@ void msx_slot_panasonic08_device::restore_banks()
}
-uint8_t msx_slot_panasonic08_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_panasonic08_device::read)
{
if (m_control & 0x04)
{
@@ -108,7 +104,7 @@ uint8_t msx_slot_panasonic08_device::read(offs_t offset)
}
-void msx_slot_panasonic08_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_panasonic08_device::write)
{
if ((offset & 0xc000) == 0x8000 || (offset & 0xc000) == 0x0000)
{
diff --git a/src/devices/bus/msx_slot/panasonic08.h b/src/devices/bus/msx_slot/panasonic08.h
index b21a4964e3b..33da0b6620b 100644
--- a/src/devices/bus/msx_slot/panasonic08.h
+++ b/src/devices/bus/msx_slot/panasonic08.h
@@ -12,6 +12,10 @@
DECLARE_DEVICE_TYPE(MSX_SLOT_PANASONIC08, msx_slot_panasonic08_device)
+#define MCFG_MSX_SLOT_PANASONIC08_ADD(_tag, _startpage, _numpages, _region, _offset) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_PANASONIC08, _startpage, _numpages) \
+ downcast<msx_slot_panasonic08_device &>(*device).set_rom_start(_region, _offset);
+
class msx_slot_panasonic08_device : public device_t, public msx_internal_slot_interface
{
public:
@@ -20,12 +24,11 @@ public:
// configuration helpers
void set_rom_start(const char *region, uint32_t offset) { m_rom_region.set_tag(region); m_region_offset = offset; }
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
protected:
virtual void device_start() override;
- virtual void device_post_load() override;
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/bus/msx_slot/ram.cpp b/src/devices/bus/msx_slot/ram.cpp
index 835a5551b92..a113dab1d39 100644
--- a/src/devices/bus/msx_slot/ram.cpp
+++ b/src/devices/bus/msx_slot/ram.cpp
@@ -8,7 +8,7 @@ DEFINE_DEVICE_TYPE(MSX_SLOT_RAM, msx_slot_ram_device, "msx_slot_ram", "MSX Inter
msx_slot_ram_device::msx_slot_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MSX_SLOT_RAM, tag, owner, clock)
- , msx_internal_slot_interface(mconfig, *this)
+ , msx_internal_slot_interface()
{
}
@@ -18,7 +18,7 @@ void msx_slot_ram_device::device_start()
save_item(NAME(m_ram));
}
-uint8_t msx_slot_ram_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_ram_device::read)
{
if ( offset >= m_start_address && offset < m_end_address )
{
@@ -27,7 +27,7 @@ uint8_t msx_slot_ram_device::read(offs_t offset)
return 0xFF;
}
-void msx_slot_ram_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_ram_device::write)
{
if ( offset >= m_start_address && offset < m_end_address )
{
diff --git a/src/devices/bus/msx_slot/ram.h b/src/devices/bus/msx_slot/ram.h
index f96271ad066..17bff978148 100644
--- a/src/devices/bus/msx_slot/ram.h
+++ b/src/devices/bus/msx_slot/ram.h
@@ -5,17 +5,23 @@
#include "slot.h"
+#define MCFG_MSX_SLOT_RAM_ADD(_tag, _startpage, _numpages) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_RAM, _startpage, _numpages)
+
+#define MCFG_MSX_SLOT_RAM_8KB \
+ downcast<msx_slot_ram_device &>(*device).force_start_address(0xe000);
+
+
class msx_slot_ram_device : public device_t,
public msx_internal_slot_interface
{
public:
msx_slot_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // Set to 0xe000 for 8KB RAM
void force_start_address(uint16_t start) { m_start_address = start; }
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
protected:
virtual void device_start() override;
diff --git a/src/devices/bus/msx_slot/ram_mm.cpp b/src/devices/bus/msx_slot/ram_mm.cpp
index ade67f6eb66..1b765c832f2 100644
--- a/src/devices/bus/msx_slot/ram_mm.cpp
+++ b/src/devices/bus/msx_slot/ram_mm.cpp
@@ -7,7 +7,7 @@ DEFINE_DEVICE_TYPE(MSX_SLOT_RAM_MM, msx_slot_ram_mm_device, "msx_slot_ram_mm", "
msx_slot_ram_mm_device::msx_slot_ram_mm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MSX_SLOT_RAM_MM, tag, owner, clock)
- , msx_internal_slot_interface(mconfig, *this)
+ , msx_internal_slot_interface()
, m_total_size(0)
, m_bank_mask(0)
, m_ramio_set_bits(0)
@@ -40,14 +40,12 @@ void msx_slot_ram_mm_device::device_start()
save_item(NAME(m_ram));
save_item(NAME(m_bank_selected));
- // Install IO read/write handlers
- io_space().install_read_handler(0xFC, 0xFF, read8sm_delegate(FUNC(msx_slot_ram_mm_device::read_mapper_bank), this));
- io_space().install_write_handler(0xFC, 0xFF, write8sm_delegate(FUNC(msx_slot_ram_mm_device::write_mapper_bank), this));
-}
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_slot_ram_mm_device::restore_banks), this));
-void msx_slot_ram_mm_device::device_post_load()
-{
- restore_banks();
+ // Install IO read/write handlers
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_read_handler(0xFC, 0xFF, read8_delegate(FUNC(msx_slot_ram_mm_device::read_mapper_bank), this));
+ space.install_write_handler(0xFC, 0xFF, write8_delegate(FUNC(msx_slot_ram_mm_device::write_mapper_bank), this));
}
void msx_slot_ram_mm_device::restore_banks()
@@ -58,22 +56,22 @@ void msx_slot_ram_mm_device::restore_banks()
}
}
-uint8_t msx_slot_ram_mm_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_ram_mm_device::read)
{
return m_bank_base[offset >> 14][offset & 0x3fff];
}
-void msx_slot_ram_mm_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_ram_mm_device::write)
{
m_bank_base[offset >> 14][offset & 0x3fff] = data;
}
-uint8_t msx_slot_ram_mm_device::read_mapper_bank(offs_t offset)
+READ8_MEMBER(msx_slot_ram_mm_device::read_mapper_bank)
{
return m_bank_selected[offset & 3] | m_ramio_set_bits;
}
-void msx_slot_ram_mm_device::write_mapper_bank(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_ram_mm_device::write_mapper_bank)
{
offset &= 3;
diff --git a/src/devices/bus/msx_slot/ram_mm.h b/src/devices/bus/msx_slot/ram_mm.h
index 55f13659a4c..87837909b2d 100644
--- a/src/devices/bus/msx_slot/ram_mm.h
+++ b/src/devices/bus/msx_slot/ram_mm.h
@@ -5,27 +5,33 @@
#include "slot.h"
+#define MCFG_MSX_SLOT_RAM_MM_ADD(_tag, _total_size) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_RAM_MM, 0, 4) \
+ downcast<msx_slot_ram_mm_device &>(*device).set_total_size(_total_size);
+
+#define MCFG_MSX_SLOT_RAMM_SET_RAMIO_BITS(_ramio_set_bits) \
+ downcast<msx_slot_ram_mm_device &>(*device).set_ramio_set_bits(_ramio_set_bits);
+
class msx_slot_ram_mm_device : public device_t, public msx_internal_slot_interface
{
public:
msx_slot_ram_mm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- msx_slot_ram_mm_device &set_total_size(uint32_t total_size) { m_total_size = total_size; return *this; }
- msx_slot_ram_mm_device &set_ramio_bits(uint8_t ramio_set_bits) { m_ramio_set_bits = ramio_set_bits; return *this; }
+ void set_total_size(uint32_t total_size) { m_total_size = total_size; }
+ void set_ramio_set_bits(uint8_t ramio_set_bits) { m_ramio_set_bits = ramio_set_bits; }
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
+
+ DECLARE_READ8_MEMBER(read_mapper_bank);
+ DECLARE_WRITE8_MEMBER(write_mapper_bank);
protected:
virtual void device_start() override;
- virtual void device_post_load() override;
void restore_banks();
private:
- uint8_t read_mapper_bank(offs_t offset);
- void write_mapper_bank(offs_t offset, uint8_t data);
-
std::vector<uint8_t> m_ram;
uint32_t m_total_size;
uint8_t m_bank_mask;
diff --git a/src/devices/bus/msx_slot/rom.cpp b/src/devices/bus/msx_slot/rom.cpp
index aafc37b345b..186077edb55 100644
--- a/src/devices/bus/msx_slot/rom.cpp
+++ b/src/devices/bus/msx_slot/rom.cpp
@@ -15,7 +15,7 @@ msx_slot_rom_device::msx_slot_rom_device(const machine_config &mconfig, const ch
msx_slot_rom_device::msx_slot_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
- , msx_internal_slot_interface(mconfig, *this)
+ , msx_internal_slot_interface()
, m_rom_region(*this, finder_base::DUMMY_TAG)
, m_region_offset(0)
, m_rom(nullptr)
@@ -35,7 +35,7 @@ void msx_slot_rom_device::device_start()
}
-uint8_t msx_slot_rom_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_rom_device::read)
{
if (offset >= m_start_address && offset < m_end_address)
{
diff --git a/src/devices/bus/msx_slot/rom.h b/src/devices/bus/msx_slot/rom.h
index 6bcd480a5a3..eee554a362a 100644
--- a/src/devices/bus/msx_slot/rom.h
+++ b/src/devices/bus/msx_slot/rom.h
@@ -7,6 +7,10 @@
#include "slot.h"
+#define MCFG_MSX_SLOT_ROM_ADD(_tag, _startpage, _numpages, _region, _offset) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_ROM, _startpage, _numpages) \
+ downcast<msx_slot_rom_device &>(*device).set_rom_start(_region, _offset);
+
class msx_slot_rom_device : public device_t,
public msx_internal_slot_interface
{
@@ -16,7 +20,7 @@ public:
// configuration helpers
void set_rom_start(const char *region, uint32_t offset) { m_rom_region.set_tag(region); m_region_offset = offset; }
- virtual uint8_t read(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
protected:
msx_slot_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/bus/msx_slot/slot.cpp b/src/devices/bus/msx_slot/slot.cpp
index 345cf6e0a5c..3b826c87fa2 100644
--- a/src/devices/bus/msx_slot/slot.cpp
+++ b/src/devices/bus/msx_slot/slot.cpp
@@ -13,12 +13,9 @@ pages; and multiple pieces of rom/ram/components can occur in a single slot.
#include "emu.h"
#include "slot.h"
-msx_internal_slot_interface::msx_internal_slot_interface(const machine_config &mconfig, device_t &device)
- : m_mem_space(device, finder_base::DUMMY_TAG, -1)
- , m_io_space(device, finder_base::DUMMY_TAG, -1)
- , m_start_address(0)
+msx_internal_slot_interface::msx_internal_slot_interface()
+ : m_start_address(0)
, m_size(0)
, m_end_address(0)
{
- (void)mconfig;
}
diff --git a/src/devices/bus/msx_slot/slot.h b/src/devices/bus/msx_slot/slot.h
index 3a95c7b6b75..ad51f0c4f9d 100644
--- a/src/devices/bus/msx_slot/slot.h
+++ b/src/devices/bus/msx_slot/slot.h
@@ -15,29 +15,25 @@ pages; and multiple pieces of rom/ram/components can occur in a single slot.
#pragma once
+#define MCFG_MSX_INTERNAL_SLOT_ADD(_tag, _type, _startpage, _numpages) \
+ MCFG_DEVICE_ADD(_tag, _type, 0) \
+ dynamic_cast<msx_internal_slot_interface &>(*device).set_start_address(_startpage * 0x4000); \
+ dynamic_cast<msx_internal_slot_interface &>(*device).set_size(_numpages * 0x4000);
+
class msx_internal_slot_interface
{
public:
- msx_internal_slot_interface(const machine_config &mconfig, device_t &device);
- msx_internal_slot_interface(const msx_internal_slot_interface &device) = delete;
+ msx_internal_slot_interface();
virtual ~msx_internal_slot_interface() { }
// configuration helpers
- template <typename T> void set_memory_space(T &&tag, int spacenum) { m_mem_space.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_io_space(T &&tag, int spacenum) { m_io_space.set_tag(std::forward<T>(tag), spacenum); }
void set_start_address(uint32_t start_address) { m_start_address = start_address; m_end_address = m_start_address + m_size; }
void set_size(uint32_t size) { m_size = size; m_end_address = m_start_address + m_size; }
- virtual uint8_t read(offs_t offset) { return 0xFF; }
- virtual void write(offs_t offset, uint8_t data) { }
-
- address_space &memory_space() const { return *m_mem_space; }
- address_space &io_space() const { return *m_io_space; }
+ virtual DECLARE_READ8_MEMBER(read) { return 0xFF; }
+ virtual DECLARE_WRITE8_MEMBER(write) { }
protected:
- required_address_space m_mem_space;
- required_address_space m_io_space;
-
uint32_t m_start_address;
uint32_t m_size;
uint32_t m_end_address;
diff --git a/src/devices/bus/msx_slot/sony08.cpp b/src/devices/bus/msx_slot/sony08.cpp
index 652ed134457..96f3f0fdedc 100644
--- a/src/devices/bus/msx_slot/sony08.cpp
+++ b/src/devices/bus/msx_slot/sony08.cpp
@@ -15,7 +15,7 @@ DEFINE_DEVICE_TYPE(MSX_SLOT_SONY08, msx_slot_sony08_device, "msx_slot_sony08", "
msx_slot_sony08_device::msx_slot_sony08_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MSX_SLOT_SONY08, tag, owner, clock)
- , msx_internal_slot_interface(mconfig, *this)
+ , msx_internal_slot_interface()
, m_nvram(*this, "nvram")
, m_rom_region(*this, finder_base::DUMMY_TAG)
, m_region_offset(0)
@@ -50,12 +50,8 @@ void msx_slot_sony08_device::device_start()
save_item(NAME(m_selected_bank));
- restore_banks();
-}
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_slot_sony08_device::restore_banks), this));
-
-void msx_slot_sony08_device::device_post_load()
-{
restore_banks();
}
@@ -100,7 +96,7 @@ void msx_slot_sony08_device::restore_banks()
}
-uint8_t msx_slot_sony08_device::read(offs_t offset)
+READ8_MEMBER(msx_slot_sony08_device::read)
{
if (offset >= 0xc000)
{
@@ -122,7 +118,7 @@ uint8_t msx_slot_sony08_device::read(offs_t offset)
}
-void msx_slot_sony08_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_slot_sony08_device::write)
{
if (offset < 0x4000)
{
diff --git a/src/devices/bus/msx_slot/sony08.h b/src/devices/bus/msx_slot/sony08.h
index 74c8fd95f35..8dfd0297951 100644
--- a/src/devices/bus/msx_slot/sony08.h
+++ b/src/devices/bus/msx_slot/sony08.h
@@ -12,6 +12,10 @@
DECLARE_DEVICE_TYPE(MSX_SLOT_SONY08, msx_slot_sony08_device)
+#define MCFG_MSX_SLOT_SONY08_ADD(_tag, _startpage, _numpages, _region, _offset) \
+ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_SONY08, _startpage, _numpages) \
+ downcast<msx_slot_sony08_device &>(*device).set_rom_start(_region, _offset);
+
class msx_slot_sony08_device : public device_t, public msx_internal_slot_interface
{
public:
@@ -20,12 +24,11 @@ public:
// configuration helpers
void set_rom_start(const char *region, uint32_t offset) { m_rom_region.set_tag(region); m_region_offset = offset; }
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
protected:
virtual void device_start() override;
- virtual void device_post_load() override;
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/bus/mtx/exp.cpp b/src/devices/bus/mtx/exp.cpp
deleted file mode 100644
index 1bfd5068679..00000000000
--- a/src/devices/bus/mtx/exp.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- MTX expansion emulation
-
-**********************************************************************/
-
-#include "emu.h"
-#include "exp.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(MTX_EXP_SLOT, mtx_exp_slot_device, "mtx_exp_slot", "MTX expansion slot")
-
-
-//**************************************************************************
-// DEVICE MTX_BUS PORT INTERFACE
-//**************************************************************************
-
-//-------------------------------------------------
-// device_mtx_exp_interface - constructor
-//-------------------------------------------------
-
-device_mtx_exp_interface::device_mtx_exp_interface(const machine_config &mconfig, device_t &device)
- : device_slot_card_interface(mconfig, device)
-{
- m_slot = dynamic_cast<mtx_exp_slot_device *>(device.owner());
-}
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// mtx_exp_slot_device - constructor
-//-------------------------------------------------
-
-mtx_exp_slot_device::mtx_exp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, MTX_EXP_SLOT, tag, owner, clock)
- , device_slot_interface(mconfig, *this)
- , m_program(*this, finder_base::DUMMY_TAG, -1)
- , m_io(*this, finder_base::DUMMY_TAG, -1)
- , m_card(nullptr)
- , m_busreq_handler(*this)
- , m_int_handler(*this)
- , m_nmi_handler(*this)
-{
-}
-
-
-//-------------------------------------------------
-// device_validity_check -
-//-------------------------------------------------
-
-void mtx_exp_slot_device::device_validity_check(validity_checker &valid) const
-{
- device_t *const carddev = get_card_device();
- if (carddev && !dynamic_cast<device_mtx_exp_interface *>(carddev))
- osd_printf_error("Card device %s (%s) does not implement device_mtx_exp_interface\n", carddev->tag(), carddev->name());
-}
-
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void mtx_exp_slot_device::device_start()
-{
- device_t *const carddev = get_card_device();
- if (carddev && !dynamic_cast<device_mtx_exp_interface *>(carddev))
- osd_printf_error("Card device %s (%s) does not implement device_mtx_exp_interface\n", carddev->tag(), carddev->name());
-
- // resolve callbacks
- m_busreq_handler.resolve_safe();
- m_int_handler.resolve_safe();
- m_nmi_handler.resolve_safe();
-}
-
-
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void mtx_exp_slot_device::device_reset()
-{
-}
-
-
-//-------------------------------------------------
-// SLOT_INTERFACE( mtx_exp_devices )
-//-------------------------------------------------
-
-
-// slot devices
-//#include "fdx.h"
-#include "sdx.h"
-
-
-void mtx_expansion_devices(device_slot_interface &device)
-{
- //device.option_add("fdx", MTX_FDX); /* FDX Floppy Disc System */
- device.option_add("sdxbas", MTX_SDXBAS); /* SDX Floppy Disc System (SDX ROM)*/
- device.option_add("sdxcpm", MTX_SDXCPM); /* SDX Floppy Disc System (CP/M ROM and 80 column card) */
-}
diff --git a/src/devices/bus/mtx/exp.h b/src/devices/bus/mtx/exp.h
deleted file mode 100644
index d4e05f2f9c9..00000000000
--- a/src/devices/bus/mtx/exp.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- MTX expansion emulation
-
-**********************************************************************/
-
-
-#ifndef MAME_BUS_MTX_EXP_H
-#define MAME_BUS_MTX_EXP_H
-
-#pragma once
-
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> mtx_exp_slot_device
-
-class device_mtx_exp_interface;
-
-class mtx_exp_slot_device : public device_t, public device_slot_interface
-{
-public:
- // construction/destruction
- template <typename T>
- mtx_exp_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&slot_options, const char *default_option)
- : mtx_exp_slot_device(mconfig, tag, owner)
- {
- option_reset();
- slot_options(*this);
- set_default_option(default_option);
- set_fixed(false);
- }
-
- mtx_exp_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0);
-
- template <typename T> void set_program_space(T &&tag, int spacenum) { m_program.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_io_space(T &&tag, int spacenum) { m_io.set_tag(std::forward<T>(tag), spacenum); }
-
- // callbacks
- auto busreq_handler() { return m_busreq_handler.bind(); }
- auto int_handler() { return m_int_handler.bind(); }
- auto nmi_handler() { return m_nmi_handler.bind(); }
-
- DECLARE_WRITE_LINE_MEMBER( busreq_w ) { m_busreq_handler(state); }
- DECLARE_WRITE_LINE_MEMBER( int_w ) { m_int_handler(state); }
- DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); }
-
- // address spaces we are attached to
- required_address_space m_program;
- required_address_space m_io;
-
-protected:
- // device-level overrides
- virtual void device_validity_check(validity_checker &valid) const override;
- virtual void device_start() override;
- virtual void device_reset() override;
-
- device_mtx_exp_interface *m_card;
-
-private:
- devcb_write_line m_busreq_handler;
- devcb_write_line m_int_handler;
- devcb_write_line m_nmi_handler;
-};
-
-
-// ======================> device_mtx_exp_interface
-
-class device_mtx_exp_interface : public device_slot_card_interface
-{
-public:
- // construction/destruction
- device_mtx_exp_interface(const machine_config &mconfig, device_t &device);
-
-protected:
- address_space &program_space() { return *m_slot->m_program; }
- address_space &io_space() { return *m_slot->m_io; }
-
- mtx_exp_slot_device *m_slot;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(MTX_EXP_SLOT, mtx_exp_slot_device)
-
-void mtx_expansion_devices(device_slot_interface &device);
-
-
-#endif // MAME_BUS_MTX_EXP_H
diff --git a/src/devices/bus/mtx/sdx.cpp b/src/devices/bus/mtx/sdx.cpp
deleted file mode 100644
index 44687e09f08..00000000000
--- a/src/devices/bus/mtx/sdx.cpp
+++ /dev/null
@@ -1,425 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- MTX SDX Controller
-
-**********************************************************************/
-
-
-#include "emu.h"
-#include "sdx.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(MTX_SDXBAS, mtx_sdxbas_device, "mtx_sdxbas", "MTX SDX Controller (BASIC)")
-DEFINE_DEVICE_TYPE(MTX_SDXCPM, mtx_sdxcpm_device, "mtx_sdxcpm", "MTX SDX Controller (CP/M)")
-
-
-//-------------------------------------------------
-// SLOT_INTERFACE( sdx_floppies )
-//-------------------------------------------------
-
-static void sdx_floppies(device_slot_interface &device)
-{
- device.option_add("35dd", FLOPPY_35_DD);
- device.option_add("525qd", FLOPPY_525_QD);
-}
-
-FLOPPY_FORMATS_MEMBER(mtx_sdx_device::floppy_formats)
- FLOPPY_MTX_FORMAT
-FLOPPY_FORMATS_END
-
-//-------------------------------------------------
-// ROM( sdx )
-//-------------------------------------------------
-
-ROM_START( sdxbas )
- ROM_REGION(0x2000, "sdx_rom", ROMREGION_ERASE00)
- ROM_DEFAULT_BIOS("sdx07")
- ROM_SYSTEM_BIOS(0, "sdx07", "Type 07")
- ROMX_LOAD("sdxbas07.rom", 0x0000, 0x2000, CRC(db88b245) SHA1(05c89db8e39ec3165b4620432f48e1d59abe10dd), ROM_BIOS(0))
- ROM_SYSTEM_BIOS(1, "sdx03", "Type 03")
- ROMX_LOAD("sdxbas03.rom", 0x0000, 0x2000, CRC(2fc46a46) SHA1(f08e6a8cffbb3ca39633be6e9958bec85d1e5981), ROM_BIOS(1))
-ROM_END
-
-ROM_START( sdxcpm )
- ROM_REGION(0x2000, "sdx_rom", ROMREGION_ERASE00)
- ROM_DEFAULT_BIOS("sdx07")
- ROM_SYSTEM_BIOS(0, "sdx07", "SDX07 CP/M")
- ROMX_LOAD("sdxcpm07.rom", 0x0000, 0x2000, CRC(622a04ea) SHA1(c633ce1054b45afda53116e0c6e272a1ae6a2155), ROM_BIOS(0))
-
- ROM_REGION(0x2000, "chargen", 0)
- ROM_LOAD("80z_7a.bin", 0x0000, 0x1000, CRC(ea6fe865) SHA1(f84883f79bed34501e5828336894fad929bddbb5)) // alpha
- ROM_LOAD("80z_9a.bin", 0x1000, 0x1000, NO_DUMP) // graphic
-ROM_END
-
-//-------------------------------------------------
-// INPUT_PORTS( sdx )
-//-------------------------------------------------
-
-INPUT_PORTS_START( sdx )
- PORT_START("DSW0")
- PORT_DIPNAME(0x01, 0x00, "Drive A: Head-load solenoid present") PORT_DIPLOCATION("SW1:1")
- PORT_DIPSETTING(0x00, DEF_STR(Yes))
- PORT_DIPSETTING(0x01, DEF_STR(No))
- PORT_DIPNAME(0x02, 0x00, "Drive A: Double-sided drive") PORT_DIPLOCATION("SW1:2")
- PORT_DIPSETTING(0x00, DEF_STR(Yes))
- PORT_DIPSETTING(0x02, DEF_STR(No))
- PORT_DIPNAME(0x04, 0x00, "Drive A: 96 TPI drive") PORT_DIPLOCATION("SW1:3")
- PORT_DIPSETTING(0x00, DEF_STR(Yes))
- PORT_DIPSETTING(0x04, DEF_STR(No))
- PORT_DIPNAME(0x08, 0x00, "Drive A: Stepping rate") PORT_DIPLOCATION("SW1:4")
- PORT_DIPSETTING(0x00, "Stepping rate 6ms")
- PORT_DIPSETTING(0x08, "Stepping rate 12ms")
-
- PORT_START("DSW1")
- PORT_DIPNAME(0x01, 0x00, "Drive B: Head-load solenoid present") PORT_DIPLOCATION("SW2:1")
- PORT_DIPSETTING(0x00, DEF_STR(Yes))
- PORT_DIPSETTING(0x01, DEF_STR(No))
- PORT_DIPNAME(0x02, 0x00, "Drive B: Double-sided drive") PORT_DIPLOCATION("SW2:2")
- PORT_DIPSETTING(0x00, DEF_STR(Yes))
- PORT_DIPSETTING(0x02, DEF_STR(No))
- PORT_DIPNAME(0x04, 0x00, "Drive B: 96 TPI drive") PORT_DIPLOCATION("SW2:3")
- PORT_DIPSETTING(0x00, DEF_STR(Yes))
- PORT_DIPSETTING(0x04, DEF_STR(No))
- PORT_DIPNAME(0x08, 0x00, "Drive B: Stepping rate") PORT_DIPLOCATION("SW2:4")
- PORT_DIPSETTING(0x00, "Stepping rate 6ms")
- PORT_DIPSETTING(0x08, "Stepping rate 12ms")
-INPUT_PORTS_END
-
-//-------------------------------------------------
-// input_ports - device-specific input ports
-//-------------------------------------------------
-
-ioport_constructor mtx_sdx_device::device_input_ports() const
-{
- return INPUT_PORTS_NAME(sdx);
-}
-
-//-------------------------------------------------
-// gfx_layout mtx_sdx_charlayout
-//-------------------------------------------------
-
-static const gfx_layout mtx_sdx_charlayout =
-{
- 8, 10, /* 8 x 10 characters */
- 256, /* 256 characters */
- 1, /* 1 bits per pixel */
- { 0 }, /* no bitplanes */
- /* x offsets */
- { 0, 1, 2, 3, 4, 5, 6, 7 },
- /* y offsets */
- { 0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8, 8 * 8, 9 * 8 },
- 8 * 16 /* every char takes 16 bytes */
-};
-
-//-------------------------------------------------
-// GFXDECODE( gfx_mtx_sdx )
-//-------------------------------------------------
-
-static GFXDECODE_START(gfx_mtx_sdx)
- GFXDECODE_ENTRY("chargen", 0, mtx_sdx_charlayout, 0, 8)
-GFXDECODE_END
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void mtx_sdxbas_device::device_add_mconfig(machine_config &config)
-{
- /* fdc */
- MB8877(config, m_fdc, 8_MHz_XTAL / 8);
- m_fdc->hld_wr_callback().set(FUNC(mtx_sdx_device::motor_w));
-
- FLOPPY_CONNECTOR(config, "fdc:0", sdx_floppies, "525qd", mtx_sdx_device::floppy_formats).enable_sound(true);
- FLOPPY_CONNECTOR(config, "fdc:1", sdx_floppies, "525qd", mtx_sdx_device::floppy_formats).enable_sound(true);
-}
-
-void mtx_sdxcpm_device::device_add_mconfig(machine_config &config)
-{
- /* fdc */
- MB8877(config, m_fdc, 8_MHz_XTAL / 8);
- m_fdc->hld_wr_callback().set(FUNC(mtx_sdx_device::motor_w));
-
- FLOPPY_CONNECTOR(config, "fdc:0", sdx_floppies, "525qd", mtx_sdx_device::floppy_formats).enable_sound(true);
- FLOPPY_CONNECTOR(config, "fdc:1", sdx_floppies, "525qd", mtx_sdx_device::floppy_formats).enable_sound(true);
-
- /* 80 column video card - required to be installed in MTX internally */
- SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
- m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
- m_screen->set_refresh_hz(50);
- m_screen->set_size(960, 313);
- m_screen->set_visarea(00, 640 - 1, 0, 240 - 1);
- m_screen->set_screen_update("crtc", FUNC(hd6845_device::screen_update));
-
- GFXDECODE(config, "gfxdecode", "palette", gfx_mtx_sdx);
- PALETTE(config, "palette", palette_device::RGB_3BIT);
-
- HD6845(config, m_crtc, 15_MHz_XTAL / 8);
- m_crtc->set_screen("screen");
- m_crtc->set_show_border_area(false);
- m_crtc->set_char_width(8);
- m_crtc->set_update_row_callback(FUNC(mtx_sdxcpm_device::crtc_update_row), this);
-}
-
-
-const tiny_rom_entry *mtx_sdxbas_device::device_rom_region() const
-{
- return ROM_NAME( sdxbas );
-}
-
-const tiny_rom_entry *mtx_sdxcpm_device::device_rom_region() const
-{
- return ROM_NAME( sdxcpm );
-}
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// mtx_sdx_device - constructor
-//-------------------------------------------------
-
-mtx_sdx_device::mtx_sdx_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_mtx_exp_interface(mconfig, *this)
- , m_sdx_rom(*this, "sdx_rom")
- , m_fdc(*this, "fdc")
- , m_floppy0(*this, "fdc:0")
- , m_floppy1(*this, "fdc:1")
- , m_dsw(*this, "DSW%u", 0)
-{
-}
-
-mtx_sdxbas_device::mtx_sdxbas_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mtx_sdx_device(mconfig, MTX_SDXBAS, tag, owner, clock)
-{
-}
-
-mtx_sdxcpm_device::mtx_sdxcpm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mtx_sdx_device(mconfig, MTX_SDXCPM, tag, owner, clock)
- , m_screen(*this, "screen")
- , m_palette(*this, "palette")
- , m_crtc(*this, "crtc")
- , m_char_rom(*this, "chargen")
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void mtx_sdxbas_device::device_start()
-{
- save_item(NAME(m_control));
-}
-
-void mtx_sdxcpm_device::device_start()
-{
- save_item(NAME(m_control));
- save_item(NAME(m_80col_ascii));
- save_item(NAME(m_80col_attr));
- save_item(NAME(m_80col_addr));
- save_item(NAME(m_80col_char_ram));
- save_item(NAME(m_80col_attr_ram));
-}
-
-
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void mtx_sdxbas_device::device_reset()
-{
- machine().root_device().membank("rommap_bank1")->configure_entry(3, m_sdx_rom->base());
-
- /* SDX FDC */
- io_space().install_readwrite_handler(0x10, 0x13, read8sm_delegate(FUNC(mb8877_device::read), m_fdc.target()), write8sm_delegate(FUNC(mb8877_device::write), m_fdc.target()));
- io_space().install_readwrite_handler(0x14, 0x14, read8_delegate(FUNC(mtx_sdx_device::sdx_status_r), this), write8_delegate(FUNC(mtx_sdx_device::sdx_control_w), this));
-}
-
-void mtx_sdxcpm_device::device_reset()
-{
- machine().root_device().membank("rommap_bank1")->configure_entry(3, m_sdx_rom->base());
-
- /* SDX FDC */
- io_space().install_readwrite_handler(0x10, 0x13, read8sm_delegate(FUNC(mb8877_device::read), m_fdc.target()), write8sm_delegate(FUNC(mb8877_device::write), m_fdc.target()));
- io_space().install_readwrite_handler(0x14, 0x14, read8_delegate(FUNC(mtx_sdx_device::sdx_status_r), this), write8_delegate(FUNC(mtx_sdx_device::sdx_control_w), this));
-
- /* 80 column */
- io_space().install_readwrite_handler(0x30, 0x33, read8_delegate(FUNC(mtx_sdxcpm_device::mtx_80col_r), this), write8_delegate(FUNC(mtx_sdxcpm_device::mtx_80col_w), this));
- io_space().install_readwrite_handler(0x38, 0x38, read8smo_delegate(FUNC(mc6845_device::status_r), m_crtc.target()), write8smo_delegate(FUNC(mc6845_device::address_w), m_crtc.target()));
- io_space().install_readwrite_handler(0x39, 0x39, read8smo_delegate(FUNC(mc6845_device::register_r), m_crtc.target()), write8smo_delegate(FUNC(mc6845_device::register_w), m_crtc.target()));
-
- memset(m_80col_char_ram, 0, sizeof(m_80col_char_ram));
- memset(m_80col_attr_ram, 0, sizeof(m_80col_attr_ram));
-}
-
-
-//**************************************************************************
-// IMPLEMENTATION
-//**************************************************************************
-
-READ8_MEMBER(mtx_sdx_device::sdx_status_r)
-{
- /*
- bit description
- 0 Head load: 1 - head load on drive
- 1 Double-sided: 1 if drive double-sided
- 2 TPI: 0 - 48 TPI drive. 1 - 96 TPI drive
- 3 Track stepping rate: 0 - 12ms, 1 - 6ms
- 4 No. of drives: 0 - 1 drive, 1 - 2 drives
- 5 Ready: 1 - drive ready
- 6 Interrupt: 1 - FDC interrupt request
- 7 Data request: 1 - FDC data request
- */
-
- uint8_t data = 0x00;
-
- data |= m_dsw[BIT(m_control, 0)].read_safe(0x0f) & 0x0f;
-
- data |= (m_floppy0->get_device() && m_floppy1->get_device()) ? 0x10 : 0x00;
-
- if (m_floppy)
- data |= m_floppy->ready_r() ? 0x00 : 0x20;
-
- data |= m_fdc->intrq_r() ? 0x40 : 0x00;
- data |= m_fdc->drq_r() ? 0x80 : 0x00;
-
- return data;
-}
-
-WRITE8_MEMBER(mtx_sdx_device::sdx_control_w)
-{
- /*
- bit description
- 0 Drive select: 0 - drive A, 1 - drive B
- 1 Side select: 0 - side 0, 1 - side 1
- 2 Motor on: 1 - turns drive motor on
- 3 Motor ready: 1 - drive motor ready
- 4 Density: 0 - FM, 1 - MFM
- */
-
- m_control = data;
-
- /* bit 0: drive select */
- m_floppy = BIT(data, 0) ? m_floppy1->get_device() : m_floppy0->get_device();
-
- m_fdc->set_floppy(m_floppy);
-
- if (m_floppy)
- {
- /* bit 1: side select */
- m_floppy->ss_w(BIT(data, 1));
- logerror("motor on %d\n", BIT(data, 2));
- /* bit 2: motor on */
- m_floppy->mon_w(!(BIT(data, 2) || m_fdc->hld_r()));
- logerror("head load %d\n", m_fdc->hld_r());
- /* bit 3: motor ready */
- //if (BIT(data, 3))
- //m_floppy->mon_w(!BIT(data, 2));
- //m_floppy->mon_w(!BIT(data, 3));
- logerror("motor ready %d\n", BIT(data, 3));
- }
-
- /* bit 4: density */
- m_fdc->dden_w(!BIT(data, 4));
-}
-
-WRITE_LINE_MEMBER(mtx_sdx_device::motor_w)
-{
- if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(0);
- if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(0);
-}
-
-//-------------------------------------------------
-// 80 column video board
-//-------------------------------------------------
-
-READ8_MEMBER(mtx_sdxcpm_device::mtx_80col_r)
-{
- uint8_t data = 0xff;
-
- switch (offset)
- {
- case 0:
- /* ring the bell */
- break;
- case 2:
- if (!BIT(m_80col_addr, 15))
- data = m_80col_char_ram[m_80col_addr & 0x07ff];
- break;
- case 3:
- if (!BIT(m_80col_addr, 15))
- data = m_80col_attr_ram[m_80col_addr & 0x07ff];
- break;
- }
- return data;
-}
-
-WRITE8_MEMBER(mtx_sdxcpm_device::mtx_80col_w)
-{
- switch (offset)
- {
- case 0:
- m_80col_addr = (m_80col_addr & 0xff00) | data;
- /* write to ram */
- if (BIT(m_80col_addr, 15))
- {
- /* write enable ascii ram */
- if (BIT(m_80col_addr, 14))
- m_80col_char_ram[m_80col_addr & 0x07ff] = m_80col_ascii;
-
- /* write enable attribute ram */
- if (BIT(m_80col_addr, 13))
- m_80col_attr_ram[m_80col_addr & 0x07ff] = m_80col_attr;
- }
- break;
- case 1:
- m_80col_addr = (data << 8) | (m_80col_addr & 0x00ff);
- break;
- case 2:
- m_80col_ascii = data;
- break;
- case 3:
- m_80col_attr = data;
- break;
- }
-}
-
-MC6845_UPDATE_ROW(mtx_sdxcpm_device::crtc_update_row)
-{
- const pen_t *pen = m_palette->pens();
-
- for (int column = 0; column < x_count; column++)
- {
- uint8_t code = m_80col_char_ram[(ma + column) & 0x7ff];
- uint8_t attr = m_80col_attr_ram[(ma + column) & 0x7ff];
- offs_t addr = (code << 4) | (ra & 0x0f);
- uint8_t data = m_char_rom->base()[addr];
-
- if (column == cursor_x)
- {
- data = 0xff;
- attr = 0x07;
- }
-
- for (int bit = 0; bit < 8; bit++)
- {
- int x = (column * 8) + bit;
- int fg = attr & 0x07;
- int bg = attr & 0x38;
-
- int color = BIT(data, 7) ? fg : bg;
-
- bitmap.pix32(y, x) = pen[de ? color : 0];
-
- data <<= 1;
- }
- }
-}
diff --git a/src/devices/bus/mtx/sdx.h b/src/devices/bus/mtx/sdx.h
deleted file mode 100644
index dff83358dd4..00000000000
--- a/src/devices/bus/mtx/sdx.h
+++ /dev/null
@@ -1,105 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- MTX SDX Controller
-
-**********************************************************************/
-
-
-#ifndef MAME_BUS_MTX_EXP_SDX_H
-#define MAME_BUS_MTX_EXP_SDX_H
-
-#include "exp.h"
-#include "imagedev/floppy.h"
-#include "machine/wd_fdc.h"
-#include "video/mc6845.h"
-#include "formats/mtx_dsk.h"
-#include "emupal.h"
-#include "screen.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-class mtx_sdx_device :
- public device_t,
- public device_mtx_exp_interface
-{
-public:
- DECLARE_FLOPPY_FORMATS(floppy_formats);
-
- // optional information overrides
- virtual ioport_constructor device_input_ports() const override;
-
- DECLARE_READ8_MEMBER(sdx_status_r);
- DECLARE_WRITE8_MEMBER(sdx_control_w);
- DECLARE_WRITE_LINE_MEMBER(motor_w);
-
-protected:
- // construction/destruction
- mtx_sdx_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
- required_memory_region m_sdx_rom;
- required_device<mb8877_device> m_fdc;
- required_device<floppy_connector> m_floppy0;
- required_device<floppy_connector> m_floppy1;
- required_ioport_array<2> m_dsw;
- floppy_image_device *m_floppy;
- uint8_t m_control;
-};
-
-class mtx_sdxbas_device : public mtx_sdx_device
-{
-public:
- // construction/destruction
- mtx_sdxbas_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // optional information overrides
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-};
-
-class mtx_sdxcpm_device : public mtx_sdx_device
-{
-public:
- // construction/destruction
- mtx_sdxcpm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // optional information overrides
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
-private:
- DECLARE_READ8_MEMBER(mtx_80col_r);
- DECLARE_WRITE8_MEMBER(mtx_80col_w);
- MC6845_UPDATE_ROW(crtc_update_row);
-
- required_device<screen_device> m_screen;
- required_device<palette_device> m_palette;
- required_device<mc6845_device> m_crtc;
- required_memory_region m_char_rom;
- uint8_t m_80col_char_ram[0x800];
- uint8_t m_80col_attr_ram[0x800];
- uint8_t m_80col_ascii, m_80col_attr;
- uint16_t m_80col_addr;
-};
-
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(MTX_SDXBAS, mtx_sdxbas_device)
-DECLARE_DEVICE_TYPE(MTX_SDXCPM, mtx_sdxcpm_device)
-
-
-#endif // MAME_BUS_MTX_EXP_SDX_H
diff --git a/src/devices/bus/nasbus/avc.cpp b/src/devices/bus/nasbus/avc.cpp
index 4aacc354567..a0a71da3666 100644
--- a/src/devices/bus/nasbus/avc.cpp
+++ b/src/devices/bus/nasbus/avc.cpp
@@ -22,11 +22,10 @@ DEFINE_DEVICE_TYPE(NASCOM_AVC, nascom_avc_device, "nascom_avc", "Nascom Advanced
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nascom_avc_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(16250000, 1024, 0, 768, 320, 0, 256);
- screen.set_screen_update("mc6845", FUNC(mc6845_device::screen_update));
+MACHINE_CONFIG_START(nascom_avc_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_RAW_PARAMS(16250000, 1024, 0, 768, 320, 0, 256)
+ MCFG_SCREEN_UPDATE_DEVICE("mc6845", mc6845_device, screen_update)
PALETTE(config, m_palette, palette_device::RGB_3BIT);
@@ -35,7 +34,7 @@ void nascom_avc_device::device_add_mconfig(machine_config &config)
m_crtc->set_show_border_area(false);
m_crtc->set_char_width(6);
m_crtc->set_update_row_callback(FUNC(nascom_avc_device::crtc_update_row), this);
-}
+MACHINE_CONFIG_END
//**************************************************************************
@@ -78,8 +77,8 @@ void nascom_avc_device::device_start()
void nascom_avc_device::device_reset()
{
- io_space().install_write_handler(0xb0, 0xb0, write8smo_delegate(FUNC(mc6845_device::address_w), m_crtc.target()));
- io_space().install_readwrite_handler(0xb1, 0xb1, read8smo_delegate(FUNC(mc6845_device::register_r), m_crtc.target()), write8smo_delegate(FUNC(mc6845_device::register_w), m_crtc.target()));
+ io_space().install_write_handler(0xb0, 0xb0, write8_delegate(FUNC(mc6845_device::address_w), m_crtc.target()));
+ io_space().install_readwrite_handler(0xb1, 0xb1, read8_delegate(FUNC(mc6845_device::register_r), m_crtc.target()), write8_delegate(FUNC(mc6845_device::register_w), m_crtc.target()));
io_space().install_write_handler(0xb2, 0xb2, write8_delegate(FUNC(nascom_avc_device::control_w), this));
}
diff --git a/src/devices/bus/nasbus/nasbus.cpp b/src/devices/bus/nasbus/nasbus.cpp
index ed6cf27bc7a..585b1043c07 100644
--- a/src/devices/bus/nasbus/nasbus.cpp
+++ b/src/devices/bus/nasbus/nasbus.cpp
@@ -22,14 +22,15 @@ DEFINE_DEVICE_TYPE(NASBUS_SLOT, nasbus_slot_device, "nasbus_slot", "NASBUS Slot"
// nasbus_slot_device - constructor
//-------------------------------------------------
-nasbus_slot_device::nasbus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : nasbus_slot_device(mconfig, NASBUS_SLOT, tag, owner, clock)
+nasbus_slot_device::nasbus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ nasbus_slot_device(mconfig, NASBUS_SLOT, tag, owner, clock)
{
}
-nasbus_slot_device::nasbus_slot_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_slot_interface(mconfig, *this)
+nasbus_slot_device::nasbus_slot_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_slot_interface(mconfig, *this),
+ m_nasbus_tag(nullptr)
{
}
@@ -43,7 +44,7 @@ void nasbus_slot_device::device_start()
if (dev)
{
- nasbus_device *m_nasbus = downcast<nasbus_device *>(owner()->subdevice(NASBUS_TAG));
+ nasbus_device *m_nasbus = downcast<nasbus_device *>(m_owner->subdevice(m_nasbus_tag));
m_nasbus->add_card(dev);
}
}
@@ -61,8 +62,8 @@ DEFINE_DEVICE_TYPE(NASBUS, nasbus_device, "nasbus", "NASBUS Backplane")
nasbus_device::nasbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, NASBUS, tag, owner, clock),
- m_program(*this, finder_base::DUMMY_TAG, -1),
- m_io(*this, finder_base::DUMMY_TAG, -1),
+ m_program(nullptr),
+ m_io(nullptr),
m_ram_disable_handler(*this)
{
}
@@ -104,6 +105,24 @@ void nasbus_device::add_card(device_nasbus_card_interface *card)
m_dev.append(*card);
}
+//-------------------------------------------------
+// set_program_space - set address space we are attached to
+//-------------------------------------------------
+
+void nasbus_device::set_program_space(address_space *program)
+{
+ m_program = program;
+}
+
+//-------------------------------------------------
+// set_io_space - set address space we are attached to
+//-------------------------------------------------
+
+void nasbus_device::set_io_space(address_space *io)
+{
+ m_io = io;
+}
+
// callbacks from slot device to the host
WRITE_LINE_MEMBER( nasbus_device::ram_disable_w ) { m_ram_disable_handler(state); }
diff --git a/src/devices/bus/nasbus/nasbus.h b/src/devices/bus/nasbus/nasbus.h
index c2c11e2db9a..8a0a1d3775f 100644
--- a/src/devices/bus/nasbus/nasbus.h
+++ b/src/devices/bus/nasbus/nasbus.h
@@ -102,6 +102,22 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_NASBUS_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, NASBUS, 0)
+
+#define MCFG_NASBUS_SLOT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, NASBUS_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<nasbus_slot_device &>(*device).set_nasbus_slot(this, NASBUS_TAG);
+
+#define MCFG_NASBUS_RAM_DISABLE_HANDLER(_devcb) \
+ downcast<nasbus_device &>(*device).set_ram_disable_handler(DEVCB_##_devcb);
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -114,22 +130,18 @@ class nasbus_slot_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- template <typename T>
- nasbus_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : nasbus_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
nasbus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ // inline configuration
+ void set_nasbus_slot(device_t *owner, const char *nasbus_tag) { m_owner = owner; m_nasbus_tag = nasbus_tag; }
protected:
nasbus_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
+
+ // configuration
+ const char *m_nasbus_tag;
};
// device type definition
@@ -142,15 +154,15 @@ class nasbus_device : public device_t
friend class device_nasbus_card_interface;
public:
// construction/destruction
- nasbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ nasbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~nasbus_device();
- auto ram_disable() { return m_ram_disable_handler.bind(); }
+ template <class Object> devcb_base &set_ram_disable_handler(Object &&cb) { return m_ram_disable_handler.set_callback(std::forward<Object>(cb)); }
void add_card(device_nasbus_card_interface *card);
- template <typename T> void set_program_space(T &&tag, int spacenum) { m_program.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_io_space(T &&tag, int spacenum) { m_io.set_tag(std::forward<T>(tag), spacenum); }
+ void set_program_space(address_space *program);
+ void set_io_space(address_space *io);
// from cards
DECLARE_WRITE_LINE_MEMBER( ram_disable_w );
@@ -161,8 +173,8 @@ protected:
virtual void device_reset() override;
private:
- required_address_space m_program;
- required_address_space m_io;
+ address_space *m_program;
+ address_space *m_io;
simple_list<device_nasbus_card_interface> m_dev;
diff --git a/src/devices/bus/neogeo/boot_cthd.cpp b/src/devices/bus/neogeo/boot_cthd.cpp
index 70c4d891ad5..2f6659fddbe 100644
--- a/src/devices/bus/neogeo/boot_cthd.cpp
+++ b/src/devices/bus/neogeo/boot_cthd.cpp
@@ -48,10 +48,9 @@ void neogeo_cthd2k3_cart_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-void neogeo_cthd2k3_cart_device::device_add_mconfig(machine_config &config)
-{
- NG_CTHD_PROT(config, m_prot);
-}
+MACHINE_CONFIG_START(neogeo_cthd2k3_cart_device::device_add_mconfig)
+ MCFG_CTHD_PROT_ADD("cthd_prot")
+MACHINE_CONFIG_END
/*************************************************
@@ -123,9 +122,8 @@ void neogeo_matrimbl_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
}
-void neogeo_matrimbl_cart_device::device_add_mconfig(machine_config &config)
-{
- NG_KOF2002_PROT(config, m_kof2k2_prot);
- NG_CMC_PROT(config, m_cmc_prot);
- NG_CTHD_PROT(config, m_prot);
-}
+ MACHINE_CONFIG_START(neogeo_matrimbl_cart_device::device_add_mconfig)
+ MCFG_KOF2002_PROT_ADD("kof2k2_prot")
+ MCFG_CMC_PROT_ADD("cmc_prot")
+ MCFG_CTHD_PROT_ADD("cthd_prot")
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/neogeo/boot_kof10th.cpp b/src/devices/bus/neogeo/boot_kof10th.cpp
index d1dd9c925f5..1fa9aeb1d84 100644
--- a/src/devices/bus/neogeo/boot_kof10th.cpp
+++ b/src/devices/bus/neogeo/boot_kof10th.cpp
@@ -48,10 +48,9 @@ void neogeo_kof10th_cart_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-void neogeo_kof10th_cart_device::device_add_mconfig(machine_config &config)
-{
- NEOBOOT_PROT(config, m_prot);
-}
+MACHINE_CONFIG_START(neogeo_kof10th_cart_device::device_add_mconfig)
+ MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
+MACHINE_CONFIG_END
void neogeo_kof10th_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
diff --git a/src/devices/bus/neogeo/boot_kof2k2.cpp b/src/devices/bus/neogeo/boot_kof2k2.cpp
index 8bbf3ab0962..611ff47a382 100644
--- a/src/devices/bus/neogeo/boot_kof2k2.cpp
+++ b/src/devices/bus/neogeo/boot_kof2k2.cpp
@@ -12,27 +12,24 @@
#include "boot_kof2k2.h"
-void neogeo_kof2002b_cart_device::device_add_mconfig(machine_config &config)
-{
- NEOBOOT_PROT(config, m_prot);
- NG_CMC_PROT(config, m_cmc_prot);
- NG_PCM2_PROT(config, m_pcm2_prot);
- NG_KOF2002_PROT(config, m_kof2k2_prot);
-}
-
-void neogeo_kf2k2mp_cart_device::device_add_mconfig(machine_config &config)
-{
- NEOBOOT_PROT(config, m_prot);
- NG_CMC_PROT(config, m_cmc_prot);
- NG_PCM2_PROT(config, m_pcm2_prot);
-}
-
-void neogeo_kf2k2mp2_cart_device::device_add_mconfig(machine_config &config)
-{
- NEOBOOT_PROT(config, m_prot);
- NG_CMC_PROT(config, m_cmc_prot);
- NG_PCM2_PROT(config, m_pcm2_prot);
-}
+MACHINE_CONFIG_START(neogeo_kof2002b_cart_device::device_add_mconfig)
+ MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
+ MCFG_CMC_PROT_ADD("cmc_prot")
+ MCFG_PCM2_PROT_ADD("pcm2_prot")
+ MCFG_KOF2002_PROT_ADD("kof2k2_prot")
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(neogeo_kf2k2mp_cart_device::device_add_mconfig)
+ MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
+ MCFG_CMC_PROT_ADD("cmc_prot")
+ MCFG_PCM2_PROT_ADD("pcm2_prot")
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(neogeo_kf2k2mp2_cart_device::device_add_mconfig)
+ MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
+ MCFG_CMC_PROT_ADD("cmc_prot")
+ MCFG_PCM2_PROT_ADD("pcm2_prot")
+MACHINE_CONFIG_END
/*************************************************
kof2002b
diff --git a/src/devices/bus/neogeo/boot_kof2k3.cpp b/src/devices/bus/neogeo/boot_kof2k3.cpp
index 172a0ad56db..2c0f4f375a3 100644
--- a/src/devices/bus/neogeo/boot_kof2k3.cpp
+++ b/src/devices/bus/neogeo/boot_kof2k3.cpp
@@ -12,29 +12,26 @@
#include "boot_kof2k3.h"
-void neogeo_kf2k3bl_cart_device::device_add_mconfig(machine_config &config)
-{
- NEOBOOT_PROT(config, m_prot);
- NG_CMC_PROT(config, m_cmc_prot);
- NG_PCM2_PROT(config, m_pcm2_prot);
- NG_KOF2K3BL_PROT(config, m_kof2k3bl_prot);
-}
-
-void neogeo_kf2k3pl_cart_device::device_add_mconfig(machine_config &config)
-{
- NEOBOOT_PROT(config, m_prot);
- NG_CMC_PROT(config, m_cmc_prot);
- NG_PCM2_PROT(config, m_pcm2_prot);
- NG_KOF2K3BL_PROT(config, m_kof2k3bl_prot);
-}
-
-void neogeo_kf2k3upl_cart_device::device_add_mconfig(machine_config &config)
-{
- NEOBOOT_PROT(config, m_prot);
- NG_CMC_PROT(config, m_cmc_prot);
- NG_PCM2_PROT(config, m_pcm2_prot);
- NG_KOF2K3BL_PROT(config, m_kof2k3bl_prot);
-}
+MACHINE_CONFIG_START(neogeo_kf2k3bl_cart_device::device_add_mconfig)
+ MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
+ MCFG_CMC_PROT_ADD("cmc_prot")
+ MCFG_PCM2_PROT_ADD("pcm2_prot")
+ MCFG_KOF2K3BL_PROT_ADD("kof2k3bl_prot")
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(neogeo_kf2k3pl_cart_device::device_add_mconfig)
+ MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
+ MCFG_CMC_PROT_ADD("cmc_prot")
+ MCFG_PCM2_PROT_ADD("pcm2_prot")
+ MCFG_KOF2K3BL_PROT_ADD("kof2k3bl_prot")
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(neogeo_kf2k3upl_cart_device::device_add_mconfig)
+ MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
+ MCFG_CMC_PROT_ADD("cmc_prot")
+ MCFG_PCM2_PROT_ADD("pcm2_prot")
+ MCFG_KOF2K3BL_PROT_ADD("kof2k3bl_prot")
+MACHINE_CONFIG_END
/*************************************************
kf2k3bl
diff --git a/src/devices/bus/neogeo/boot_misc.cpp b/src/devices/bus/neogeo/boot_misc.cpp
index b544fa93976..f22a0236ebf 100644
--- a/src/devices/bus/neogeo/boot_misc.cpp
+++ b/src/devices/bus/neogeo/boot_misc.cpp
@@ -48,10 +48,9 @@ void neogeo_bootleg_cart_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-void neogeo_bootleg_cart_device::device_add_mconfig(machine_config &config)
-{
- NEOBOOT_PROT(config, m_prot);
-}
+MACHINE_CONFIG_START(neogeo_bootleg_cart_device::device_add_mconfig)
+ MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
+MACHINE_CONFIG_END
/*************************************************
@@ -208,11 +207,10 @@ void neogeo_mslug3b6_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
m_cmc_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, MSLUG3_GFX_KEY);
}
-void neogeo_mslug3b6_cart_device::device_add_mconfig(machine_config &config)
-{
- NG_CMC_PROT(config, m_cmc_prot);
- NEOBOOT_PROT(config, m_prot);
-}
+MACHINE_CONFIG_START(neogeo_mslug3b6_cart_device::device_add_mconfig)
+ MCFG_CMC_PROT_ADD("cmc_prot")
+ MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
+MACHINE_CONFIG_END
/*************************************************
@@ -236,12 +234,11 @@ void neogeo_ms5plus_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
m_prot->sx_decrypt(fix_region, fix_region_size, 1);
}
-void neogeo_ms5plus_cart_device::device_add_mconfig(machine_config &config)
-{
- NEOBOOT_PROT(config, m_prot);
- NG_CMC_PROT(config, m_cmc_prot);
- NG_PCM2_PROT(config, m_pcm2_prot);
-}
+MACHINE_CONFIG_START(neogeo_ms5plus_cart_device::device_add_mconfig)
+ MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
+ MCFG_CMC_PROT_ADD("cmc_prot")
+ MCFG_PCM2_PROT_ADD("pcm2_prot")
+MACHINE_CONFIG_END
/*************************************************
diff --git a/src/devices/bus/neogeo/boot_svc.cpp b/src/devices/bus/neogeo/boot_svc.cpp
index aac306be5ce..dac4a8aedad 100644
--- a/src/devices/bus/neogeo/boot_svc.cpp
+++ b/src/devices/bus/neogeo/boot_svc.cpp
@@ -30,11 +30,10 @@ void neogeo_svcboot_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
m_prot->svcboot_cx_decrypt(spr_region, spr_region_size);
}
-void neogeo_svcboot_cart_device::device_add_mconfig(machine_config &config)
-{
- NEOBOOT_PROT(config, m_prot);
- NG_PVC_PROT(config, m_pvc_prot);
-}
+MACHINE_CONFIG_START(neogeo_svcboot_cart_device::device_add_mconfig)
+ MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
+ MCFG_PVC_PROT_ADD("pvc_prot")
+MACHINE_CONFIG_END
/*************************************************
@@ -97,8 +96,7 @@ void neogeo_svcsplus_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
}
-void neogeo_svcsplus_cart_device::device_add_mconfig(machine_config &config)
-{
- NEOBOOT_PROT(config, m_prot);
- NG_PVC_PROT(config, m_pvc_prot);
-}
+MACHINE_CONFIG_START(neogeo_svcsplus_cart_device::device_add_mconfig)
+ MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
+ MCFG_PVC_PROT_ADD("pvc_prot")
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/neogeo/cmc.cpp b/src/devices/bus/neogeo/cmc.cpp
index d1fb1b699f8..841244c478e 100644
--- a/src/devices/bus/neogeo/cmc.cpp
+++ b/src/devices/bus/neogeo/cmc.cpp
@@ -44,10 +44,9 @@ void neogeo_cmc_cart_device::device_reset()
}
-void neogeo_cmc_cart_device::device_add_mconfig(machine_config &config)
-{
- NG_CMC_PROT(config, m_prot);
-}
+MACHINE_CONFIG_START(neogeo_cmc_cart_device::device_add_mconfig)
+ MCFG_CMC_PROT_ADD("cmc_prot")
+MACHINE_CONFIG_END
/*************************************************
@@ -252,23 +251,19 @@ void neogeo_cmc_kof2000n_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
DEFINE_DEVICE_TYPE(NEOGEO_CMC_JOCKEYGP_CART, neogeo_cmc_jockeygp_cart_device, "neocart_jockeygp", "Neo Geo Jockey GP CMC50 Cart")
neogeo_cmc_jockeygp_cart_device::neogeo_cmc_jockeygp_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- neogeo_cmc_cart_device(mconfig, NEOGEO_CMC_JOCKEYGP_CART, tag, owner, clock),
- m_nvram(*this, "nvram")
+ neogeo_cmc_cart_device(mconfig, NEOGEO_CMC_JOCKEYGP_CART, tag, owner, clock)
{
}
void neogeo_cmc_jockeygp_cart_device::device_start()
{
- m_ram = make_unique_clear<uint16_t[]>(0x2000/2);
- m_nvram->set_base(m_ram.get(), 0x2000);
- save_pointer(NAME(m_ram), 0x2000/2);
+ save_item(NAME(m_ram));
}
-void neogeo_cmc_jockeygp_cart_device::device_add_mconfig(machine_config &config)
+void neogeo_cmc_jockeygp_cart_device::device_reset()
{
- neogeo_cmc_cart_device::device_add_mconfig(config);
- NVRAM(config, m_nvram);
+ memset(m_ram, 0, 0x2000);
}
void neogeo_cmc_jockeygp_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
diff --git a/src/devices/bus/neogeo/cmc.h b/src/devices/bus/neogeo/cmc.h
index bba8251d2e5..88b1c27cd9f 100644
--- a/src/devices/bus/neogeo/cmc.h
+++ b/src/devices/bus/neogeo/cmc.h
@@ -8,7 +8,6 @@
#include "slot.h"
#include "rom.h"
#include "prot_cmc.h"
-#include "machine/nvram.h"
// ======================> neogeo_cmc_cart_device
@@ -219,13 +218,10 @@ public:
protected:
virtual void device_start() override;
-
- virtual void device_add_mconfig(machine_config &config) override;
+ virtual void device_reset() override;
private:
- std::unique_ptr<uint16_t[]> m_ram;
-
- required_device<nvram_device> m_nvram;
+ uint16_t m_ram[0x1000];
};
DECLARE_DEVICE_TYPE(NEOGEO_CMC_JOCKEYGP_CART, neogeo_cmc_jockeygp_cart_device)
diff --git a/src/devices/bus/neogeo/fatfury2.cpp b/src/devices/bus/neogeo/fatfury2.cpp
index 66fcfdc98a1..b3c9dea575e 100644
--- a/src/devices/bus/neogeo/fatfury2.cpp
+++ b/src/devices/bus/neogeo/fatfury2.cpp
@@ -43,7 +43,6 @@ void neogeo_fatfury2_cart_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-void neogeo_fatfury2_cart_device::device_add_mconfig(machine_config &config)
-{
- NG_FATFURY2_PROT(config, m_prot);
-}
+MACHINE_CONFIG_START(neogeo_fatfury2_cart_device::device_add_mconfig)
+ MCFG_FATFURY2_PROT_ADD("fatfury2_prot")
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/neogeo/kof2k2.cpp b/src/devices/bus/neogeo/kof2k2.cpp
index 8ff5f040d3a..e313c93034a 100644
--- a/src/devices/bus/neogeo/kof2k2.cpp
+++ b/src/devices/bus/neogeo/kof2k2.cpp
@@ -3,7 +3,7 @@
/***********************************************************************************************************
Neo Geo cart emulation
- The King of Fighters 2002 cart type (CMC + PCM2 + Additional CPU encryption)
+ The King of Fighers 2002 cart type (CMC + PCM2 + Additional CPU encryption)
***********************************************************************************************************/
@@ -50,12 +50,11 @@ void neogeo_kof2k2type_cart_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-void neogeo_kof2k2type_cart_device::device_add_mconfig(machine_config &config)
-{
- NG_CMC_PROT(config, m_cmc_prot);
- NG_PCM2_PROT(config, m_pcm2_prot);
- NG_KOF2002_PROT(config, m_kof2k2_prot);
-}
+MACHINE_CONFIG_START(neogeo_kof2k2type_cart_device::device_add_mconfig)
+ MCFG_CMC_PROT_ADD("cmc_prot")
+ MCFG_PCM2_PROT_ADD("pcm2_prot")
+ MCFG_KOF2002_PROT_ADD("kof2002_prot")
+MACHINE_CONFIG_END
/*************************************************
diff --git a/src/devices/bus/neogeo/kof98.cpp b/src/devices/bus/neogeo/kof98.cpp
index 52f6b5fe523..bc53a930bac 100644
--- a/src/devices/bus/neogeo/kof98.cpp
+++ b/src/devices/bus/neogeo/kof98.cpp
@@ -43,10 +43,9 @@ void neogeo_kof98_cart_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-void neogeo_kof98_cart_device::device_add_mconfig(machine_config &config)
-{
- NG_KOF98_PROT(config, m_prot);
-}
+MACHINE_CONFIG_START(neogeo_kof98_cart_device::device_add_mconfig)
+ MCFG_KOF98_PROT_ADD("kof98_prot")
+MACHINE_CONFIG_END
void neogeo_kof98_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
{
diff --git a/src/devices/bus/neogeo/mslugx.cpp b/src/devices/bus/neogeo/mslugx.cpp
index 2917841cac3..521f5636a1b 100644
--- a/src/devices/bus/neogeo/mslugx.cpp
+++ b/src/devices/bus/neogeo/mslugx.cpp
@@ -43,7 +43,6 @@ void neogeo_mslugx_cart_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-void neogeo_mslugx_cart_device::device_add_mconfig(machine_config &config)
-{
- NG_MSLUGX_PROT(config, m_prot);
-}
+MACHINE_CONFIG_START(neogeo_mslugx_cart_device::device_add_mconfig)
+ MCFG_MSLUGX_PROT_ADD("mslugx_prot")
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/neogeo/pcm2.cpp b/src/devices/bus/neogeo/pcm2.cpp
index 521c796d59a..e098d796229 100644
--- a/src/devices/bus/neogeo/pcm2.cpp
+++ b/src/devices/bus/neogeo/pcm2.cpp
@@ -49,11 +49,10 @@ void neogeo_pcm2_cart_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-void neogeo_pcm2_cart_device::device_add_mconfig(machine_config &config)
-{
- NG_CMC_PROT(config, m_cmc_prot);
- NG_PCM2_PROT(config, m_pcm2_prot);
-}
+MACHINE_CONFIG_START(neogeo_pcm2_cart_device::device_add_mconfig)
+ MCFG_CMC_PROT_ADD("cmc_prot")
+ MCFG_PCM2_PROT_ADD("pcm2_prot")
+MACHINE_CONFIG_END
/*************************************************
diff --git a/src/devices/bus/neogeo/prot_cmc.h b/src/devices/bus/neogeo/prot_cmc.h
index 2853c71aa8f..46a6a6c6766 100644
--- a/src/devices/bus/neogeo/prot_cmc.h
+++ b/src/devices/bus/neogeo/prot_cmc.h
@@ -9,6 +9,9 @@
DECLARE_DEVICE_TYPE(NG_CMC_PROT, cmc_prot_device)
+#define MCFG_CMC_PROT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, NG_CMC_PROT, 0)
+
// cmc42
#define KOF99_GFX_KEY (0x00)
#define GAROU_GFX_KEY (0x06)
@@ -41,7 +44,7 @@ class cmc_prot_device : public device_t
{
public:
// construction/destruction
- cmc_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ cmc_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void decrypt(uint8_t *r0, uint8_t *r1,
uint8_t c0, uint8_t c1,
diff --git a/src/devices/bus/neogeo/prot_cthd.h b/src/devices/bus/neogeo/prot_cthd.h
index 95ae38289b3..455674a56c8 100644
--- a/src/devices/bus/neogeo/prot_cthd.h
+++ b/src/devices/bus/neogeo/prot_cthd.h
@@ -8,11 +8,15 @@
DECLARE_DEVICE_TYPE(NG_CTHD_PROT, cthd_prot_device)
+#define MCFG_CTHD_PROT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, NG_CTHD_PROT, 0)
+
+
class cthd_prot_device : public device_t
{
public:
// construction/destruction
- cthd_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ cthd_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void fix_do(uint8_t* sprrom, uint32_t sprrom_size, int start, int end, int bit3shift, int bit2shift, int bit1shift, int bit0shift);
void gfx_address_fix(uint8_t* sprrom, uint32_t sprrom_size, int start, int end);
diff --git a/src/devices/bus/neogeo/prot_fatfury2.h b/src/devices/bus/neogeo/prot_fatfury2.h
index bb33d1c10c1..8c75e7f5d46 100644
--- a/src/devices/bus/neogeo/prot_fatfury2.h
+++ b/src/devices/bus/neogeo/prot_fatfury2.h
@@ -8,12 +8,15 @@
DECLARE_DEVICE_TYPE(NG_FATFURY2_PROT, fatfury2_prot_device)
+#define MCFG_FATFURY2_PROT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, NG_FATFURY2_PROT, 0)
+
class fatfury2_prot_device : public device_t
{
public:
// construction/destruction
- fatfury2_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ fatfury2_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ16_MEMBER( protection_r );
DECLARE_WRITE16_MEMBER( protection_w );
diff --git a/src/devices/bus/neogeo/prot_kof2k2.h b/src/devices/bus/neogeo/prot_kof2k2.h
index 324da5a8918..4eb764f006d 100644
--- a/src/devices/bus/neogeo/prot_kof2k2.h
+++ b/src/devices/bus/neogeo/prot_kof2k2.h
@@ -9,12 +9,15 @@
DECLARE_DEVICE_TYPE(NG_KOF2002_PROT, kof2002_prot_device)
+#define MCFG_KOF2002_PROT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, NG_KOF2002_PROT, 0)
+
class kof2002_prot_device : public device_t
{
public:
// construction/destruction
- kof2002_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ kof2002_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void kof2002_decrypt_68k(uint8_t* cpurom, uint32_t cpurom_size);
void matrim_decrypt_68k(uint8_t* cpurom, uint32_t cpurom_size);
diff --git a/src/devices/bus/neogeo/prot_kof2k3bl.h b/src/devices/bus/neogeo/prot_kof2k3bl.h
index 52d87e87bfe..8520bd90716 100644
--- a/src/devices/bus/neogeo/prot_kof2k3bl.h
+++ b/src/devices/bus/neogeo/prot_kof2k3bl.h
@@ -8,12 +8,15 @@
DECLARE_DEVICE_TYPE(NG_KOF2K3BL_PROT, kof2k3bl_prot_device)
+#define MCFG_KOF2K3BL_PROT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, NG_KOF2K3BL_PROT, 0)
+
class kof2k3bl_prot_device : public device_t
{
public:
// construction/destruction
- kof2k3bl_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ kof2k3bl_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ16_MEMBER(protection_r);
DECLARE_WRITE16_MEMBER(kof2003_w);
diff --git a/src/devices/bus/neogeo/prot_kof98.h b/src/devices/bus/neogeo/prot_kof98.h
index 652e098898a..ff0783e29ad 100644
--- a/src/devices/bus/neogeo/prot_kof98.h
+++ b/src/devices/bus/neogeo/prot_kof98.h
@@ -9,12 +9,15 @@
DECLARE_DEVICE_TYPE(NG_KOF98_PROT, kof98_prot_device)
+#define MCFG_KOF98_PROT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, NG_KOF98_PROT, 0)
+
class kof98_prot_device : public device_t
{
public:
// construction/destruction
- kof98_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ kof98_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void decrypt_68k(uint8_t* cpurom, uint32_t cpurom_size);
DECLARE_WRITE16_MEMBER(protection_w);
diff --git a/src/devices/bus/neogeo/prot_misc.h b/src/devices/bus/neogeo/prot_misc.h
index e1525fc44f6..f2b0c1f06d6 100644
--- a/src/devices/bus/neogeo/prot_misc.h
+++ b/src/devices/bus/neogeo/prot_misc.h
@@ -8,12 +8,15 @@
DECLARE_DEVICE_TYPE(NEOBOOT_PROT, neoboot_prot_device)
+#define MCFG_NEOBOOT_PROT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, NEOBOOT_PROT, 0)
+
class neoboot_prot_device : public device_t
{
public:
// construction/destruction
- neoboot_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ neoboot_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void cx_decrypt(uint8_t* sprrom, uint32_t sprrom_size);
void sx_decrypt(uint8_t* fixed, uint32_t fixed_size, int value);
diff --git a/src/devices/bus/neogeo/prot_mslugx.h b/src/devices/bus/neogeo/prot_mslugx.h
index 106bce3ad84..91ab71e463d 100644
--- a/src/devices/bus/neogeo/prot_mslugx.h
+++ b/src/devices/bus/neogeo/prot_mslugx.h
@@ -9,12 +9,15 @@
DECLARE_DEVICE_TYPE(NG_MSLUGX_PROT, mslugx_prot_device)
+#define MCFG_MSLUGX_PROT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, NG_MSLUGX_PROT, 0)
+
class mslugx_prot_device : public device_t
{
public:
// construction/destruction
- mslugx_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ mslugx_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_WRITE16_MEMBER( protection_w );
DECLARE_READ16_MEMBER( protection_r );
diff --git a/src/devices/bus/neogeo/prot_pcm2.h b/src/devices/bus/neogeo/prot_pcm2.h
index 707e9ab94b4..666b38b4bee 100644
--- a/src/devices/bus/neogeo/prot_pcm2.h
+++ b/src/devices/bus/neogeo/prot_pcm2.h
@@ -9,12 +9,15 @@
DECLARE_DEVICE_TYPE(NG_PCM2_PROT, pcm2_prot_device)
+#define MCFG_PCM2_PROT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, NG_PCM2_PROT, 0)
+
class pcm2_prot_device : public device_t
{
public:
// construction/destruction
- pcm2_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ pcm2_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void decrypt(uint8_t* ymrom, uint32_t ymsize, int value);
void swap(uint8_t* ymrom, uint32_t ymsize, int value);
diff --git a/src/devices/bus/neogeo/prot_pvc.h b/src/devices/bus/neogeo/prot_pvc.h
index d2855808331..4f7d73f4020 100644
--- a/src/devices/bus/neogeo/prot_pvc.h
+++ b/src/devices/bus/neogeo/prot_pvc.h
@@ -8,12 +8,15 @@
DECLARE_DEVICE_TYPE(NG_PVC_PROT, pvc_prot_device)
+#define MCFG_PVC_PROT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, NG_PVC_PROT, 0)
+
class pvc_prot_device : public device_t
{
public:
// construction/destruction
- pvc_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ pvc_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void pvc_write_unpack_color();
void pvc_write_pack_color();
diff --git a/src/devices/bus/neogeo/prot_sma.h b/src/devices/bus/neogeo/prot_sma.h
index c36af941132..f0ee9733bd0 100644
--- a/src/devices/bus/neogeo/prot_sma.h
+++ b/src/devices/bus/neogeo/prot_sma.h
@@ -9,12 +9,15 @@
DECLARE_DEVICE_TYPE(NG_SMA_PROT, sma_prot_device)
+#define MCFG_SMA_PROT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, NG_SMA_PROT, 0)
+
class sma_prot_device : public device_t
{
public:
// construction/destruction
- sma_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ sma_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
//DECLARE_WRITE16_MEMBER( kof99_bankswitch_w );
//DECLARE_WRITE16_MEMBER( garou_bankswitch_w );
diff --git a/src/devices/bus/neogeo/pvc.cpp b/src/devices/bus/neogeo/pvc.cpp
index 26987ab33dc..bb9d0098159 100644
--- a/src/devices/bus/neogeo/pvc.cpp
+++ b/src/devices/bus/neogeo/pvc.cpp
@@ -50,12 +50,11 @@ void neogeo_pvc_cart_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-void neogeo_pvc_cart_device::device_add_mconfig(machine_config &config)
-{
- NG_CMC_PROT(config, m_cmc_prot);
- NG_PCM2_PROT(config, m_pcm2_prot);
- NG_PVC_PROT(config, m_pvc_prot);
-}
+MACHINE_CONFIG_START(neogeo_pvc_cart_device::device_add_mconfig)
+ MCFG_CMC_PROT_ADD("cmc_prot")
+ MCFG_PCM2_PROT_ADD("pcm2_prot")
+ MCFG_PVC_PROT_ADD("pvc_prot")
+MACHINE_CONFIG_END
/*************************************************
diff --git a/src/devices/bus/neogeo/rom.cpp b/src/devices/bus/neogeo/rom.cpp
index 0f54a808cef..10c61858386 100644
--- a/src/devices/bus/neogeo/rom.cpp
+++ b/src/devices/bus/neogeo/rom.cpp
@@ -73,19 +73,17 @@ WRITE16_MEMBER(neogeo_rom_device::banksel_w)
DEFINE_DEVICE_TYPE(NEOGEO_VLINER_CART, neogeo_vliner_cart_device, "neocart_vliner", "Neo Geo V-Liner Cart")
neogeo_vliner_cart_device::neogeo_vliner_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- neogeo_rom_device(mconfig, NEOGEO_VLINER_CART, tag, owner, clock),
- m_nvram(*this, "nvram")
+ neogeo_rom_device(mconfig, NEOGEO_VLINER_CART, tag, owner, clock)
{
}
+
void neogeo_vliner_cart_device::device_start()
{
- m_cart_ram = make_unique_clear<uint16_t[]>(0x2000/2);
- m_nvram->set_base(m_cart_ram.get(), 0x2000);
- save_pointer(NAME(m_cart_ram), 0x2000/2);
+ save_item(NAME(m_cart_ram));
}
-void neogeo_vliner_cart_device::device_add_mconfig(machine_config &config)
+void neogeo_vliner_cart_device::device_reset()
{
- NVRAM(config, m_nvram);
+ memset(m_cart_ram, 0, 0x2000);
}
diff --git a/src/devices/bus/neogeo/rom.h b/src/devices/bus/neogeo/rom.h
index 1f62a890859..17efc4da4a7 100644
--- a/src/devices/bus/neogeo/rom.h
+++ b/src/devices/bus/neogeo/rom.h
@@ -6,7 +6,6 @@
#pragma once
#include "slot.h"
-#include "machine/nvram.h"
// ======================> neogeo_rom_device
@@ -51,13 +50,10 @@ public:
protected:
virtual void device_start() override;
-
- virtual void device_add_mconfig(machine_config &config) override;
+ virtual void device_reset() override;
private:
- std::unique_ptr<uint16_t[]> m_cart_ram;
-
- required_device<nvram_device> m_nvram;
+ uint16_t m_cart_ram[0x1000];
};
DECLARE_DEVICE_TYPE(NEOGEO_VLINER_CART, neogeo_vliner_cart_device)
diff --git a/src/devices/bus/neogeo/slot.h b/src/devices/bus/neogeo/slot.h
index b5be4c5e901..edeb2452a1d 100644
--- a/src/devices/bus/neogeo/slot.h
+++ b/src/devices/bus/neogeo/slot.h
@@ -190,15 +190,6 @@ class neogeo_cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- neogeo_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : neogeo_cart_slot_device(mconfig, tag, owner, (uint16_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
neogeo_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint16_t clock);
virtual ~neogeo_cart_slot_device();
@@ -347,4 +338,15 @@ private:
// device type definition
DECLARE_DEVICE_TYPE(NEOGEO_CART_SLOT, neogeo_cart_slot_device)
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+ ***************************************************************************/
+
+
+#define MCFG_NEOGEO_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, NEOGEO_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
#endif // MAME_BUS_NEOGEO_SLOT_H
diff --git a/src/devices/bus/neogeo/sma.cpp b/src/devices/bus/neogeo/sma.cpp
index ee031e4f44f..70b03aa0a28 100644
--- a/src/devices/bus/neogeo/sma.cpp
+++ b/src/devices/bus/neogeo/sma.cpp
@@ -55,11 +55,10 @@ void neogeo_sma_cart_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-void neogeo_sma_cart_device::device_add_mconfig(machine_config &config)
-{
- NG_SMA_PROT(config, m_sma_prot);
- NG_CMC_PROT(config, m_cmc_prot);
-}
+MACHINE_CONFIG_START(neogeo_sma_cart_device::device_add_mconfig)
+ MCFG_SMA_PROT_ADD("sma_prot")
+ MCFG_CMC_PROT_ADD("cmc_prot")
+MACHINE_CONFIG_END
/*************************************************
diff --git a/src/devices/bus/neogeo_ctrl/ctrl.h b/src/devices/bus/neogeo_ctrl/ctrl.h
index bfe568d9b7e..aee534d61ad 100644
--- a/src/devices/bus/neogeo_ctrl/ctrl.h
+++ b/src/devices/bus/neogeo_ctrl/ctrl.h
@@ -42,15 +42,6 @@ class neogeo_control_port_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- template <typename T>
- neogeo_control_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt, bool const fixed)
- : neogeo_control_port_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(fixed);
- }
neogeo_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~neogeo_control_port_device();
@@ -92,15 +83,6 @@ class neogeo_ctrl_edge_port_device : public device_t, public device_slot_interfa
{
public:
// construction/destruction
- template <typename T>
- neogeo_ctrl_edge_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt, bool const fixed)
- : neogeo_ctrl_edge_port_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(fixed);
- }
neogeo_ctrl_edge_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~neogeo_ctrl_edge_port_device();
@@ -122,6 +104,20 @@ DECLARE_DEVICE_TYPE(NEOGEO_CONTROL_PORT, neogeo_control_port_device)
DECLARE_DEVICE_TYPE(NEOGEO_CTRL_EDGE_CONNECTOR, neogeo_ctrl_edge_port_device)
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_NEOGEO_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot, _fixed) \
+ MCFG_DEVICE_ADD(_tag, NEOGEO_CONTROL_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed)
+
+#define MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD(_tag, _slot_intf, _def_slot, _fixed) \
+ MCFG_DEVICE_ADD(_tag, NEOGEO_CTRL_EDGE_CONNECTOR, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed)
+
+
+
void neogeo_controls(device_slot_interface &device);
void neogeo_arc_edge(device_slot_interface &device);
void neogeo_arc_edge_fixed(device_slot_interface &device);
diff --git a/src/devices/bus/nes/2a03pur.cpp b/src/devices/bus/nes/2a03pur.cpp
index 87e364b1638..ddb3820770d 100644
--- a/src/devices/bus/nes/2a03pur.cpp
+++ b/src/devices/bus/nes/2a03pur.cpp
@@ -91,7 +91,7 @@ void nes_2a03pur_device::pcb_reset()
This has been assigned to iNES mapper 31.
-------------------------------------------------*/
-void nes_2a03pur_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_2a03pur_device::write_l)
{
LOG_MMC(("2a03 puritans write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -99,7 +99,7 @@ void nes_2a03pur_device::write_l(offs_t offset, uint8_t data)
m_reg[offset & 7] = data & ((m_prg_chunks << 2) - 1);
}
-uint8_t nes_2a03pur_device::read_h(offs_t offset)
+READ8_MEMBER(nes_2a03pur_device::read_h)
{
LOG_MMC(("2a03 puritans read_h, offset: %04x\n", offset));
diff --git a/src/devices/bus/nes/2a03pur.h b/src/devices/bus/nes/2a03pur.h
index 970898ff128..2ec647ccc4a 100644
--- a/src/devices/bus/nes/2a03pur.h
+++ b/src/devices/bus/nes/2a03pur.h
@@ -16,8 +16,8 @@ public:
// construction/destruction
nes_2a03pur_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/act53.cpp b/src/devices/bus/nes/act53.cpp
index 2a441c36153..f163be268fd 100644
--- a/src/devices/bus/nes/act53.cpp
+++ b/src/devices/bus/nes/act53.cpp
@@ -158,7 +158,7 @@ void nes_action53_device::update_mirr()
}
}
-void nes_action53_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_action53_device::write_l)
{
LOG_MMC(("action 53 write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -167,7 +167,7 @@ void nes_action53_device::write_l(offs_t offset, uint8_t data)
}
-void nes_action53_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_action53_device::write_h)
{
LOG_MMC(("action 53 write_h, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/act53.h b/src/devices/bus/nes/act53.h
index 8e4b1c3b073..1f299a5a5da 100644
--- a/src/devices/bus/nes/act53.h
+++ b/src/devices/bus/nes/act53.h
@@ -14,8 +14,8 @@ public:
// construction/destruction
nes_action53_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/aladdin.cpp b/src/devices/bus/nes/aladdin.cpp
index db57b61ff00..e9d81555a72 100644
--- a/src/devices/bus/nes/aladdin.cpp
+++ b/src/devices/bus/nes/aladdin.cpp
@@ -52,7 +52,7 @@ aladdin_cart_interface::~aladdin_cart_interface()
{
}
-uint8_t aladdin_cart_interface::read(offs_t offset)
+READ8_MEMBER(aladdin_cart_interface::read)
{
if (offset < 0x4000)
return m_rom[(m_lobank * 0x4000) + (offset & 0x3fff)];
@@ -84,10 +84,10 @@ void nes_aladdin_slot_device::device_start()
m_cart = dynamic_cast<aladdin_cart_interface *>(get_card_device());
}
-uint8_t nes_aladdin_slot_device::read(offs_t offset)
+READ8_MEMBER(nes_aladdin_slot_device::read)
{
if (m_cart)
- return m_cart->read(offset);
+ return m_cart->read(space, offset, mem_mask);
return 0xff;
}
@@ -296,19 +296,19 @@ void nes_aladdin_device::pcb_reset()
-------------------------------------------------*/
-uint8_t nes_aladdin_device::read_h(offs_t offset)
+READ8_MEMBER(nes_aladdin_device::read_h)
{
LOG_MMC(("aladdin read_h, offset: %04x\n", offset));
// this shall be the proper code, but it's a bit slower, so we access directly the subcart below
- //return m_subslot->read(offset);
+ //return m_subslot->read(space, offset, mem_mask);
if (m_subslot->m_cart)
- return m_subslot->m_cart->read(offset);
+ return m_subslot->m_cart->read(space, offset, mem_mask);
else // this is "fake" in the sense that we fill CPU space with 0xff if no Aladdin cart is loaded
return hi_access_rom(offset);
}
-void nes_aladdin_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_aladdin_device::write_h)
{
LOG_MMC(("aladdin write_h, offset: %04x, data: %02x\n", offset, data));
m_subslot->write_prg(offset, data);
@@ -325,7 +325,6 @@ static void ade_cart(device_slot_interface &device)
}
-void nes_aladdin_device::device_add_mconfig(machine_config &config)
-{
- NES_ALADDIN_SLOT(config, m_subslot, ade_cart);
-}
+MACHINE_CONFIG_START(nes_aladdin_device::device_add_mconfig)
+ MCFG_ALADDIN_MINICART_ADD("ade_slot", ade_cart)
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/nes/aladdin.h b/src/devices/bus/nes/aladdin.h
index 9014bf6969a..de6725bb9f1 100644
--- a/src/devices/bus/nes/aladdin.h
+++ b/src/devices/bus/nes/aladdin.h
@@ -24,7 +24,7 @@ public:
virtual ~aladdin_cart_interface();
// reading and writing
- virtual uint8_t read(offs_t offset);
+ virtual DECLARE_READ8_MEMBER(read);
uint8_t *get_cart_base() { return m_rom; }
void set_cart_size(uint32_t size) { m_rom_size = size; m_rom_mask = (size / 0x4000) - 1; }
@@ -50,16 +50,6 @@ class nes_aladdin_slot_device : public device_t,
friend class nes_aladdin_device;
public:
// construction/destruction
- template <typename T>
- nes_aladdin_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts)
- : nes_aladdin_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(nullptr);
- set_fixed(false);
- }
-
nes_aladdin_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~nes_aladdin_slot_device();
@@ -82,7 +72,7 @@ public:
// slot interface overrides
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
- uint8_t read(offs_t offset);
+ virtual DECLARE_READ8_MEMBER(read);
void write_prg(uint32_t offset, uint8_t data) { if (m_cart) m_cart->write_prg(offset, data); }
protected:
@@ -93,6 +83,11 @@ protected:
DECLARE_DEVICE_TYPE(NES_ALADDIN_SLOT, nes_aladdin_slot_device)
+#define MCFG_ALADDIN_MINICART_ADD(_tag, _slot_intf) \
+ MCFG_DEVICE_ADD(_tag, NES_ALADDIN_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, nullptr, false)
+
+
//----------------------------------
//
// Aladdin Minicart implementation
@@ -160,8 +155,8 @@ public:
// construction/destruction
nes_aladdin_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/ave.cpp b/src/devices/bus/nes/ave.cpp
index 2e93ea17501..823d66e2e57 100644
--- a/src/devices/bus/nes/ave.cpp
+++ b/src/devices/bus/nes/ave.cpp
@@ -122,7 +122,7 @@ void nes_maxi15_device::pcb_reset()
-------------------------------------------------*/
-void nes_nina001_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_nina001_device::write_m)
{
LOG_MMC(("nina-001 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -155,7 +155,7 @@ void nes_nina001_device::write_m(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_nina006_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_nina006_device::write_l)
{
LOG_MMC(("nina-006 write_l, offset: %04x, data: %02x\n", offset, data));
@@ -192,7 +192,7 @@ void nes_maxi15_device::update_banks()
}
}
-uint8_t nes_maxi15_device::read_h(offs_t offset)
+READ8_MEMBER(nes_maxi15_device::read_h)
{
LOG_MMC(("Maxi 15 read_h, offset: %04x\n", offset));
diff --git a/src/devices/bus/nes/ave.h b/src/devices/bus/nes/ave.h
index b40d2ed6d9d..5fdd233b3c3 100644
--- a/src/devices/bus/nes/ave.h
+++ b/src/devices/bus/nes/ave.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_nina001_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -34,7 +34,7 @@ public:
// construction/destruction
nes_nina006_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
@@ -52,7 +52,7 @@ public:
// construction/destruction
nes_maxi15_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/bandai.cpp b/src/devices/bus/nes/bandai.cpp
index 1dd82f1747d..ff87be980d5 100644
--- a/src/devices/bus/nes/bandai.cpp
+++ b/src/devices/bus/nes/bandai.cpp
@@ -205,7 +205,7 @@ void nes_fjump2_device::pcb_reset()
-------------------------------------------------*/
-void nes_oekakids_device::nt_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_oekakids_device::nt_w)
{
int page = ((offset & 0xc00) >> 10);
@@ -220,7 +220,7 @@ void nes_oekakids_device::nt_w(offs_t offset, uint8_t data)
m_nt_access[page][offset & 0x3ff] = data;
}
-uint8_t nes_oekakids_device::nt_r(offs_t offset)
+READ8_MEMBER(nes_oekakids_device::nt_r)
{
int page = ((offset & 0xc00) >> 10);
@@ -253,7 +253,7 @@ void nes_oekakids_device::ppu_latch(offs_t offset)
#endif
}
-void nes_oekakids_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_oekakids_device::write_h)
{
LOG_MMC(("oeka kids write_h, offset: %04x, data: %02x\n", offset, data));
@@ -308,7 +308,7 @@ void nes_fcg_device::device_timer(emu_timer &timer, device_timer_id id, int para
}
}
-void nes_fcg_device::fcg_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_fcg_device::fcg_write)
{
LOG_MMC(("lz93d50_write, offset: %04x, data: %02x\n", offset, data));
@@ -346,12 +346,12 @@ void nes_fcg_device::fcg_write(offs_t offset, uint8_t data)
}
}
-void nes_fcg_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_fcg_device::write_m)
{
LOG_MMC(("lz93d50 write_m, offset: %04x, data: %02x\n", offset, data));
if (m_battery.empty() && m_prgram.empty())
- fcg_write(offset & 0x0f, data);
+ fcg_write(space, offset & 0x0f, data, mem_mask);
else if (!m_battery.empty())
m_battery[offset] = data;
else
@@ -361,7 +361,7 @@ void nes_fcg_device::write_m(offs_t offset, uint8_t data)
// FCG board does not access regs in 0x8000-0xffff space!
// only later design lz93d50 (and its variants do)!
-void nes_lz93d50_24c01_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_lz93d50_24c01_device::write_h)
{
LOG_MMC(("lz93d50_24c01 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -373,12 +373,12 @@ void nes_lz93d50_24c01_device::write_h(offs_t offset, uint8_t data)
m_i2c_dir = BIT(data, 7);
break;
default:
- fcg_write(offset & 0x0f, data);
+ fcg_write(space, offset & 0x0f, data, mem_mask);
break;
}
}
-uint8_t nes_lz93d50_24c01_device::read_m(offs_t offset)
+READ8_MEMBER(nes_lz93d50_24c01_device::read_m)
{
LOG_MMC(("lz93d50 EEPROM read, offset: %04x\n", offset));
if (m_i2c_dir)
@@ -391,15 +391,13 @@ uint8_t nes_lz93d50_24c01_device::read_m(offs_t offset)
// SERIAL I2C DEVICE
//-------------------------------------------------
-void nes_lz93d50_24c01_device::device_add_mconfig(machine_config &config)
-{
- I2C_24C01(config, m_i2cmem);
-}
+MACHINE_CONFIG_START(nes_lz93d50_24c01_device::device_add_mconfig)
+ MCFG_24C01_ADD("i2cmem")
+MACHINE_CONFIG_END
-void nes_lz93d50_24c02_device::device_add_mconfig(machine_config &config)
-{
- I2C_24C02(config, m_i2cmem);
-}
+MACHINE_CONFIG_START(nes_lz93d50_24c02_device::device_add_mconfig)
+ MCFG_24C02_ADD("i2cmem")
+MACHINE_CONFIG_END
/*-------------------------------------------------
@@ -430,19 +428,19 @@ void nes_fjump2_device::set_prg()
prg16_cdef(prg_base | 0x0f);
}
-uint8_t nes_fjump2_device::read_m(offs_t offset)
+READ8_MEMBER(nes_fjump2_device::read_m)
{
LOG_MMC(("fjump2 read_m, offset: %04x\n", offset));
return m_battery[offset & (m_battery.size() - 1)];
}
-void nes_fjump2_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_fjump2_device::write_m)
{
LOG_MMC(("fjump2 write_m, offset: %04x, data: %02x\n", offset, data));
m_battery[offset & (m_battery.size() - 1)] = data;
}
-void nes_fjump2_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_fjump2_device::write_h)
{
LOG_MMC(("fjump2 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -460,7 +458,7 @@ void nes_fjump2_device::write_h(offs_t offset, uint8_t data)
set_prg();
break;
default:
- fcg_write(offset & 0x0f, data);
+ fcg_write(space, offset & 0x0f, data, mem_mask);
break;
}
}
diff --git a/src/devices/bus/nes/bandai.h b/src/devices/bus/nes/bandai.h
index e7cb0a1d0cd..e44ff99de20 100644
--- a/src/devices/bus/nes/bandai.h
+++ b/src/devices/bus/nes/bandai.h
@@ -17,9 +17,9 @@ public:
// construction/destruction
nes_oekakids_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
- virtual uint8_t nt_r(offs_t offset) override;
- virtual void nt_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
+ virtual DECLARE_READ8_MEMBER(nt_r) override;
+ virtual DECLARE_WRITE8_MEMBER(nt_w) override;
virtual void pcb_reset() override;
@@ -46,8 +46,8 @@ public:
nes_fcg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- void fcg_write(offs_t offset, uint8_t data);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(fcg_write);
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -75,7 +75,7 @@ public:
nes_lz93d50_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override { fcg_write(offset, data); }
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { fcg_write(space, offset, data, mem_mask); }
protected:
nes_lz93d50_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -90,8 +90,8 @@ public:
// construction/destruction
nes_lz93d50_24c01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -131,9 +131,9 @@ public:
// construction/destruction
nes_fjump2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/benshieng.cpp b/src/devices/bus/nes/benshieng.cpp
index 2b3c7818f58..921d7c5b56f 100644
--- a/src/devices/bus/nes/benshieng.cpp
+++ b/src/devices/bus/nes/benshieng.cpp
@@ -86,7 +86,7 @@ void nes_benshieng_device::update_banks()
chr2_6(m_mmc_vrom_bank[3], CHRROM);
}
-void nes_benshieng_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_benshieng_device::write_h)
{
uint8_t helper = (offset & 0xc00) >> 10;
LOG_MMC(("benshieng write_h, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/benshieng.h b/src/devices/bus/nes/benshieng.h
index 599de5a6e9c..c25aba92508 100644
--- a/src/devices/bus/nes/benshieng.h
+++ b/src/devices/bus/nes/benshieng.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_benshieng_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/bootleg.cpp b/src/devices/bus/nes/bootleg.cpp
index d585a8df9de..49cccaa6a3b 100644
--- a/src/devices/bus/nes/bootleg.cpp
+++ b/src/devices/bus/nes/bootleg.cpp
@@ -570,7 +570,7 @@ void nes_ax5705_device::set_prg()
prg8_ab(m_mmc_prg_bank[1]);
}
-void nes_ax5705_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ax5705_device::write_h)
{
uint8_t bank;
LOG_MMC(("ax5705 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -652,7 +652,7 @@ void nes_sc127_device::hblank_irq(int scanline, int vblank, int blanked)
}
}
-void nes_sc127_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sc127_device::write_h)
{
LOG_MMC(("sc127 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -715,7 +715,7 @@ void nes_mbaby_device::device_timer(emu_timer &timer, device_timer_id id, int pa
}
}
-void nes_mbaby_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_mbaby_device::write_h)
{
LOG_MMC(("Mario Baby write_h, offset: %04x, data: %02x\n", offset, data));
@@ -746,7 +746,7 @@ void nes_mbaby_device::write_h(offs_t offset, uint8_t data)
}
}
-uint8_t nes_mbaby_device::read_m(offs_t offset)
+READ8_MEMBER(nes_mbaby_device::read_m)
{
LOG_MMC(("Mario Baby read_m, offset: %04x\n", offset));
return m_prg[(m_latch * 0x2000) + (offset & 0x1fff)];
@@ -764,7 +764,7 @@ uint8_t nes_mbaby_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_asn_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_asn_device::write_h)
{
LOG_MMC(("Ai Senshi Nicol write_h, offset: %04x, data: %02x\n", offset, data));
@@ -775,7 +775,7 @@ void nes_asn_device::write_h(offs_t offset, uint8_t data)
m_latch = data;
}
-uint8_t nes_asn_device::read_m(offs_t offset)
+READ8_MEMBER(nes_asn_device::read_m)
{
LOG_MMC(("Ai Senshi Nicol read_m, offset: %04x\n", offset));
return m_prg[((m_latch * 0x2000) + (offset & 0x1fff)) & (m_prg_size - 1)];
@@ -811,7 +811,7 @@ void nes_smb3p_device::device_timer(emu_timer &timer, device_timer_id id, int pa
}
}
-void nes_smb3p_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_smb3p_device::write_h)
{
LOG_MMC(("btl_smb3_w, offset: %04x, data: %02x\n", offset, data));
switch (offset & 0x0f)
@@ -879,7 +879,7 @@ void nes_btl_dn_device::hblank_irq(int scanline, int vblank, int blanked )
hold_irq_line();
}
-void nes_btl_dn_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_btl_dn_device::write_h)
{
uint8_t bank;
LOG_MMC(("btl_dn write_h, offset: %04x, data: %02x\n", offset, data));
@@ -933,13 +933,13 @@ void nes_btl_dn_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_whirl2706_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_whirl2706_device::write_h)
{
LOG_MMC(("whirl2706 write_h, offset: %04x, data: %02x\n", offset, data));
m_latch = data;
}
-uint8_t nes_whirl2706_device::read_m(offs_t offset)
+READ8_MEMBER(nes_whirl2706_device::read_m)
{
LOG_MMC(("whirl2706 read_m, offset: %04x\n", offset));
return m_prg[(m_latch * 0x2000 + (offset & 0x1fff)) & (m_prg_size - 1)];
@@ -975,7 +975,7 @@ void nes_smb2j_device::device_timer(emu_timer &timer, device_timer_id id, int pa
}
}
-void nes_smb2j_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_smb2j_device::write_l)
{
LOG_MMC(("smb2j write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -984,7 +984,7 @@ void nes_smb2j_device::write_l(offs_t offset, uint8_t data)
m_irq_enable = data & 3; // maybe also m_irq_count = 0?!?
}
-void nes_smb2j_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_smb2j_device::write_h)
{
LOG_MMC(("smb2j write_h, offset: %04x, data: %02x\n", offset, data));
@@ -992,7 +992,7 @@ void nes_smb2j_device::write_h(offs_t offset, uint8_t data)
m_irq_enable = data & 3;
}
-void nes_smb2j_device::write_ex(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_smb2j_device::write_ex)
{
LOG_MMC(("smb2j write_ex, offset: %04x, data: %02x\n", offset, data));
@@ -1010,7 +1010,7 @@ void nes_smb2j_device::write_ex(offs_t offset, uint8_t data)
}
}
-uint8_t nes_smb2j_device::read_l(offs_t offset)
+READ8_MEMBER(nes_smb2j_device::read_l)
{
LOG_MMC(("smb2j read_l, offset: %04x\n", offset));
offset += 0x100;
@@ -1018,10 +1018,10 @@ uint8_t nes_smb2j_device::read_l(offs_t offset)
if (offset >= 0x1000)
return m_prg[0x10000 + (offset & 0x0fff)];
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
-uint8_t nes_smb2j_device::read_m(offs_t offset)
+READ8_MEMBER(nes_smb2j_device::read_m)
{
LOG_MMC(("smb2j read_m, offset: %04x\n", offset));
return m_prg[0x4000 + offset];
@@ -1057,7 +1057,7 @@ void nes_smb2ja_device::device_timer(emu_timer &timer, device_timer_id id, int p
}
}
-void nes_smb2ja_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_smb2ja_device::write_h)
{
LOG_MMC(("smb2ja write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1076,7 +1076,7 @@ void nes_smb2ja_device::write_h(offs_t offset, uint8_t data)
}
}
-uint8_t nes_smb2ja_device::read_m(offs_t offset)
+READ8_MEMBER(nes_smb2ja_device::read_m)
{
LOG_MMC(("smb2ja read_m, offset: %04x\n", offset));
return m_prg[(0xfe * 0x2000 + (offset & 0x1fff)) & (m_prg_size - 1)];
@@ -1114,7 +1114,7 @@ void nes_smb2jb_device::device_timer(emu_timer &timer, device_timer_id id, int p
}
}
-void nes_smb2jb_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_smb2jb_device::write_l)
{
uint8_t prg;
LOG_MMC(("smb2jb write_l, offset: %04x, data: %02x\n", offset, data));
@@ -1134,14 +1134,14 @@ void nes_smb2jb_device::write_l(offs_t offset, uint8_t data)
}
}
-uint8_t nes_smb2jb_device::read_m(offs_t offset)
+READ8_MEMBER(nes_smb2jb_device::read_m)
{
LOG_MMC(("smb2jb read_m, offset: %04x\n", offset));
return m_prg[((0x0f * 0x2000) + (offset & 0x1fff)) & (m_prg_size - 1)];
}
/* This goes to 0x4020-0x403f & 0x40a0-0x40bf */
-void nes_smb2jb_device::write_ex(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_smb2jb_device::write_ex)
{
uint8_t prg;
LOG_MMC(("smb2jb write_ex, offset: %04x, data: %02x\n", offset, data));
@@ -1169,7 +1169,7 @@ void nes_smb2jb_device::write_ex(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_09034a_device::write_ex(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_09034a_device::write_ex)
{
LOG_MMC(("09-034a write_ex, offset: %04x, data: %02x\n", offset, data));
@@ -1177,7 +1177,7 @@ void nes_09034a_device::write_ex(offs_t offset, uint8_t data)
m_reg = data & 1;
}
-uint8_t nes_09034a_device::read_m(offs_t offset)
+READ8_MEMBER(nes_09034a_device::read_m)
{
LOG_MMC(("09-034a read_m, offset: %04x\n", offset));
// in 0x6000-0x7fff is mapped the 2nd PRG chip which starts after 32K (hence the +4)
@@ -1198,7 +1198,7 @@ uint8_t nes_09034a_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_tobidase_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_tobidase_device::write_l)
{
LOG_MMC(("tobidase write_h, offset: %04x, data: %02x\n", offset, data));
offset += 0x4100;
@@ -1207,7 +1207,7 @@ void nes_tobidase_device::write_l(offs_t offset, uint8_t data)
m_latch = data & 0x0f;
}
-uint8_t nes_tobidase_device::read_m(offs_t offset)
+READ8_MEMBER(nes_tobidase_device::read_m)
{
LOG_MMC(("tobidase read_m, offset: %04x\n", offset));
if (m_latch >= 0x0c)
@@ -1229,13 +1229,13 @@ uint8_t nes_tobidase_device::read_m(offs_t offset)
-------------------------------------------------*/
-uint8_t nes_lh32_device::read_m(offs_t offset)
+READ8_MEMBER(nes_lh32_device::read_m)
{
LOG_MMC(("lh32 read_m, offset: %04x\n", offset));
return m_prg[(m_latch * 0x2000) + (offset & 0x1fff)];
}
-uint8_t nes_lh32_device::read_h(offs_t offset)
+READ8_MEMBER(nes_lh32_device::read_h)
{
// LOG_MMC(("lh32 read_h, offset: %04x\n", offset));
@@ -1245,7 +1245,7 @@ uint8_t nes_lh32_device::read_h(offs_t offset)
return hi_access_rom(offset);
}
-void nes_lh32_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_lh32_device::write_m)
{
LOG_MMC(("lh32 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -1256,7 +1256,7 @@ void nes_lh32_device::write_m(offs_t offset, uint8_t data)
}
}
-void nes_lh32_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_lh32_device::write_h)
{
LOG_MMC(("lh32 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1285,13 +1285,13 @@ void nes_lh10_device::update_prg()
prg8_ab(m_reg[7]);
}
-uint8_t nes_lh10_device::read_m(offs_t offset)
+READ8_MEMBER(nes_lh10_device::read_m)
{
LOG_MMC(("lh10 read_m, offset: %04x\n", offset));
return m_prg[(0x0e * 0x2000) + (offset & 0x1fff)];
}
-uint8_t nes_lh10_device::read_h(offs_t offset)
+READ8_MEMBER(nes_lh10_device::read_h)
{
// LOG_MMC(("lh10 read_h, offset: %04x\n", offset));
@@ -1301,7 +1301,7 @@ uint8_t nes_lh10_device::read_h(offs_t offset)
return hi_access_rom(offset);
}
-void nes_lh10_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_lh10_device::write_h)
{
LOG_MMC(("lh10 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1354,13 +1354,13 @@ void nes_lh53_device::device_timer(emu_timer &timer, device_timer_id id, int par
}
}
-uint8_t nes_lh53_device::read_m(offs_t offset)
+READ8_MEMBER(nes_lh53_device::read_m)
{
LOG_MMC(("lh53 read_m, offset: %04x\n", offset));
return m_prg[(m_reg * 0x2000) + (offset & 0x1fff)];
}
-uint8_t nes_lh53_device::read_h(offs_t offset)
+READ8_MEMBER(nes_lh53_device::read_h)
{
// LOG_MMC(("lh53 read_h, offset: %04x\n", offset));
@@ -1370,7 +1370,7 @@ uint8_t nes_lh53_device::read_h(offs_t offset)
return hi_access_rom(offset);
}
-void nes_lh53_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_lh53_device::write_h)
{
LOG_MMC(("lh53 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1412,7 +1412,7 @@ void nes_lh53_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-uint8_t nes_2708_device::read_m(offs_t offset)
+READ8_MEMBER(nes_2708_device::read_m)
{
LOG_MMC(("btl-2708 read_m, offset: %04x\n", offset));
if (!m_reg[1])
@@ -1421,14 +1421,14 @@ uint8_t nes_2708_device::read_m(offs_t offset)
return m_prg[(m_reg[0] * 0x2000) + (offset & 0x1fff)];
}
-void nes_2708_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_2708_device::write_m)
{
LOG_MMC(("btl-2708 write_m, offset: %04x, data: %02x\n", offset, data));
// if (!m_reg[1])
m_prgram[offset] = data; // lower 8K of WRAM
}
-uint8_t nes_2708_device::read_h(offs_t offset)
+READ8_MEMBER(nes_2708_device::read_h)
{
// LOG_MMC(("btl-2708 read_h, offset: %04x\n", offset));
@@ -1438,7 +1438,7 @@ uint8_t nes_2708_device::read_h(offs_t offset)
return hi_access_rom(offset);
}
-void nes_2708_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_2708_device::write_h)
{
LOG_MMC(("btl-2708 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1475,20 +1475,20 @@ void nes_2708_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_ac08_device::write_ex(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ac08_device::write_ex)
{
LOG_MMC(("AC-08 write_ex, offset: %04x, data: %02x\n", offset, data));
if (offset == 5) // $4025
set_nt_mirroring(!BIT(data, 3) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ);
}
-uint8_t nes_ac08_device::read_m(offs_t offset)
+READ8_MEMBER(nes_ac08_device::read_m)
{
LOG_MMC(("AC-08 read_m, offset: %04x\n", offset));
return m_prg[(m_latch * 0x2000) + (offset & 0x1fff)];
}
-void nes_ac08_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ac08_device::write_h)
{
LOG_MMC(("AC-08 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1511,13 +1511,13 @@ void nes_ac08_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-uint8_t nes_unl_bb_device::read_m(offs_t offset)
+READ8_MEMBER(nes_unl_bb_device::read_m)
{
LOG_MMC(("unl-bb read_m, offset: %04x\n", offset));
return m_prg[(((m_reg[0] & 3 & m_prg_mask) * 0x2000) + (offset & 0x1fff))];
}
-void nes_unl_bb_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_unl_bb_device::write_h)
{
LOG_MMC(("unl-bb write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1549,7 +1549,7 @@ void nes_unl_bb_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-uint8_t nes_mmalee_device::read_m(offs_t offset)
+READ8_MEMBER(nes_mmalee_device::read_m)
{
LOG_MMC(("mmalee read_m, offset: %04x\n", offset));
@@ -1561,7 +1561,7 @@ uint8_t nes_mmalee_device::read_m(offs_t offset)
return ((offset + 0x6000) & 0xff00) >> 8;
}
-void nes_mmalee_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_mmalee_device::write_m)
{
LOG_MMC(("mmalee write_m, offset: %04x, data: %02x\n", offset, data));
@@ -1594,7 +1594,7 @@ void nes_shuiguan_device::device_timer(emu_timer &timer, device_timer_id id, int
}
}
-void nes_shuiguan_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_shuiguan_device::write_h)
{
int bank;
LOG_MMC(("shuiguan write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1646,7 +1646,7 @@ void nes_shuiguan_device::write_h(offs_t offset, uint8_t data)
}
}
-uint8_t nes_shuiguan_device::read_m(offs_t offset)
+READ8_MEMBER(nes_shuiguan_device::read_m)
{
// always first bank??
LOG_MMC(("shuiguan read_m, offset: %04x\n", offset));
@@ -1670,7 +1670,7 @@ uint8_t nes_shuiguan_device::read_m(offs_t offset)
-------------------------------------------------*/
-uint8_t nes_rt01_device::read_h(offs_t offset)
+READ8_MEMBER(nes_rt01_device::read_h)
{
// LOG_MMC(("rt01 read_h, offset: %04x\n", offset));
diff --git a/src/devices/bus/nes/bootleg.h b/src/devices/bus/nes/bootleg.h
index 42213b131b8..a048f0955d4 100644
--- a/src/devices/bus/nes/bootleg.h
+++ b/src/devices/bus/nes/bootleg.h
@@ -14,7 +14,7 @@ public:
// construction/destruction
nes_ax5705_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -36,7 +36,7 @@ class nes_sc127_device : public nes_nrom_device
public:
// construction/destruction
nes_sc127_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
@@ -58,8 +58,8 @@ class nes_mbaby_device : public nes_nrom_device
public:
// construction/destruction
nes_mbaby_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -87,8 +87,8 @@ public:
// construction/destruction
nes_asn_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -109,7 +109,7 @@ public:
// construction/destruction
nes_smb3p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -134,7 +134,7 @@ class nes_btl_dn_device : public nes_nrom_device
public:
// construction/destruction
nes_btl_dn_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
@@ -156,8 +156,8 @@ public:
// construction/destruction
nes_whirl2706_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -178,11 +178,11 @@ public:
// construction/destruction
nes_smb2j_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_ex(offs_t offset, uint8_t data) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ex) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -207,8 +207,8 @@ class nes_smb2ja_device : public nes_nrom_device
public:
// construction/destruction
nes_smb2ja_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -233,9 +233,9 @@ class nes_smb2jb_device : public nes_nrom_device
public:
// construction/destruction
nes_smb2jb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_ex(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ex) override;
virtual void pcb_reset() override;
@@ -261,8 +261,8 @@ public:
// construction/destruction
nes_09034a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_ex(offs_t offset, uint8_t data) override;
- virtual uint8_t read_m(offs_t offset) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ex) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
virtual void pcb_reset() override;
@@ -283,8 +283,8 @@ public:
// construction/destruction
nes_tobidase_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
@@ -305,10 +305,10 @@ public:
// construction/destruction
nes_lh32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -329,9 +329,9 @@ public:
// construction/destruction
nes_lh10_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -354,10 +354,10 @@ public:
// construction/destruction
nes_lh53_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override {}
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override {}
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -385,10 +385,10 @@ public:
// construction/destruction
nes_2708_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -408,9 +408,9 @@ public:
// nes_ac08_device/destruction
nes_ac08_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_ex(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ex) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -429,8 +429,8 @@ class nes_unl_bb_device : public nes_nrom_device
public:
// construction/destruction
nes_unl_bb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -450,8 +450,8 @@ public:
// construction/destruction
nes_mmalee_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -468,8 +468,8 @@ public:
// construction/destruction
nes_shuiguan_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -496,7 +496,7 @@ public:
// construction/destruction
nes_rt01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/camerica.cpp b/src/devices/bus/nes/camerica.cpp
index 5870b2911ab..7b9d413f6c9 100644
--- a/src/devices/bus/nes/camerica.cpp
+++ b/src/devices/bus/nes/camerica.cpp
@@ -136,7 +136,7 @@ void nes_golden5_device::pcb_reset()
-------------------------------------------------*/
-void nes_bf9093_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bf9093_device::write_h)
{
LOG_MMC(("bf9093 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -174,7 +174,7 @@ void nes_bf9093_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bf9096_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bf9096_device::write_h)
{
LOG_MMC(("bf9096 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -203,7 +203,7 @@ void nes_bf9096_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_golden5_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_golden5_device::write_h)
{
LOG_MMC(("golden5 write_h, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/camerica.h b/src/devices/bus/nes/camerica.h
index 7688249a64c..b7a4782c342 100644
--- a/src/devices/bus/nes/camerica.h
+++ b/src/devices/bus/nes/camerica.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_bf9093_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -34,8 +34,8 @@ public:
// construction/destruction
nes_bf9096_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
- virtual void write_m(offs_t offset, uint8_t data) override { write_h(offset, data); }
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override { write_h(space, offset, data, mem_mask); }
virtual void pcb_reset() override;
@@ -56,7 +56,7 @@ public:
// construction/destruction
nes_golden5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/cne.cpp b/src/devices/bus/nes/cne.cpp
index c81e7a2bdc8..1f0ad793937 100644
--- a/src/devices/bus/nes/cne.cpp
+++ b/src/devices/bus/nes/cne.cpp
@@ -112,7 +112,7 @@ void nes_cne_shlz_device::pcb_reset()
-------------------------------------------------*/
-void nes_cne_decathl_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_cne_decathl_device::write_h)
{
LOG_MMC(("cne_decathl_w, offset: %04x, data: %02x\n", offset, data));
@@ -146,7 +146,7 @@ void nes_cne_decathl_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_cne_fsb_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_cne_fsb_device::write_m)
{
LOG_MMC(("cne_fsb write_m, offset: %04x, data: %02x\n", offset, data));
@@ -184,7 +184,7 @@ void nes_cne_fsb_device::write_m(offs_t offset, uint8_t data)
m_battery[offset] = data;
}
-uint8_t nes_cne_fsb_device::read_m(offs_t offset)
+READ8_MEMBER(nes_cne_fsb_device::read_m)
{
LOG_MMC(("cne_fsb read_m, offset: %04x\n", offset));
@@ -211,7 +211,7 @@ uint8_t nes_cne_fsb_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_cne_shlz_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_cne_shlz_device::write_l)
{
LOG_MMC(("cne_shlz write_l, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/cne.h b/src/devices/bus/nes/cne.h
index da0623cbde3..d5e117c791a 100644
--- a/src/devices/bus/nes/cne.h
+++ b/src/devices/bus/nes/cne.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_cne_decathl_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -34,8 +34,8 @@ public:
// construction/destruction
nes_cne_fsb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -53,7 +53,7 @@ public:
// construction/destruction
nes_cne_shlz_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/cony.cpp b/src/devices/bus/nes/cony.cpp
index e42ae833f82..78c89a57141 100644
--- a/src/devices/bus/nes/cony.cpp
+++ b/src/devices/bus/nes/cony.cpp
@@ -174,7 +174,7 @@ void nes_cony_device::device_timer(emu_timer &timer, device_timer_id id, int par
}
}
-void nes_cony_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_cony_device::write_l)
{
LOG_MMC(("cony write_l, offset: %04x, data: %02x\n", offset, data));
@@ -182,7 +182,7 @@ void nes_cony_device::write_l(offs_t offset, uint8_t data)
m_low_reg[offset & 0x03] = data;
}
-uint8_t nes_cony_device::read_l(offs_t offset)
+READ8_MEMBER(nes_cony_device::read_l)
{
LOG_MMC(("cony read_l, offset: %04x\n", offset));
@@ -229,7 +229,7 @@ void nes_cony_device::set_chr()
}
}
-void nes_cony_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_cony_device::write_h)
{
LOG_MMC(("cony write_h, offset: %04x, data: %02x\n", offset, data));
@@ -310,7 +310,7 @@ void nes_cony_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_yoko_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_yoko_device::write_l)
{
LOG_MMC(("yoko write_l, offset: %04x, data: %02x\n", offset, data));
@@ -318,7 +318,7 @@ void nes_yoko_device::write_l(offs_t offset, uint8_t data)
m_low_reg[offset & 0x03] = data;
}
-uint8_t nes_yoko_device::read_l(offs_t offset)
+READ8_MEMBER(nes_yoko_device::read_l)
{
LOG_MMC(("yoko read_l, offset: %04x\n", offset));
@@ -359,7 +359,7 @@ void nes_yoko_device::set_chr()
chr2_6(m_reg[7], CHRROM);
}
-void nes_yoko_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_yoko_device::write_h)
{
LOG_MMC(("yoko write_h, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/cony.h b/src/devices/bus/nes/cony.h
index aa767a88c13..b7b759a7fe1 100644
--- a/src/devices/bus/nes/cony.h
+++ b/src/devices/bus/nes/cony.h
@@ -16,9 +16,9 @@ public:
// construction/destruction
nes_cony_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -54,9 +54,9 @@ public:
// construction/destruction
nes_yoko_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/datach.cpp b/src/devices/bus/nes/datach.cpp
index 5262b6d927a..c8549924f68 100644
--- a/src/devices/bus/nes/datach.cpp
+++ b/src/devices/bus/nes/datach.cpp
@@ -52,7 +52,7 @@ datach_cart_interface::~datach_cart_interface()
{
}
-uint8_t datach_cart_interface::read(offs_t offset)
+READ8_MEMBER(datach_cart_interface::read)
{
if (offset < 0x4000)
return m_rom[(m_bank * 0x4000) + (offset & 0x3fff)];
@@ -84,10 +84,10 @@ void nes_datach_slot_device::device_start()
m_cart = dynamic_cast<datach_cart_interface *>(get_card_device());
}
-uint8_t nes_datach_slot_device::read(offs_t offset)
+READ8_MEMBER(nes_datach_slot_device::read)
{
if (m_cart)
- return m_cart->read(offset);
+ return m_cart->read(space, offset, mem_mask);
return 0xff;
}
@@ -201,10 +201,9 @@ uint8_t *nes_datach_rom_device::get_cart_base()
}
-void nes_datach_24c01_device::device_add_mconfig(machine_config &config)
-{
- I2C_24C01(config, m_i2cmem);
-}
+MACHINE_CONFIG_START(nes_datach_24c01_device::device_add_mconfig)
+ MCFG_24C01_ADD("i2cmem")
+MACHINE_CONFIG_END
//---------------------------------
@@ -284,7 +283,7 @@ void nes_datach_device::pcb_reset()
-------------------------------------------------*/
-uint8_t nes_datach_device::read_m(offs_t offset)
+READ8_MEMBER(nes_datach_device::read_m)
{
LOG_MMC(("Datach read_m, offset: %04x\n", offset));
uint8_t i2c_val = 0;
@@ -301,19 +300,19 @@ uint8_t nes_datach_device::read_m(offs_t offset)
}
-uint8_t nes_datach_device::read_h(offs_t offset)
+READ8_MEMBER(nes_datach_device::read_h)
{
LOG_MMC(("Datach read_h, offset: %04x\n", offset));
// this shall be the proper code, but it's a bit slower, so we access directly the subcart below
- //return m_subslot->read(offset);
+ //return m_subslot->read(space, offset, mem_mask);
if (m_subslot->m_cart)
- return m_subslot->m_cart->read(offset);
+ return m_subslot->m_cart->read(space, offset, mem_mask);
else // this is "fake" in the sense that we fill CPU space with 0xff if no Datach cart is loaded
return hi_access_rom(offset);
}
-void nes_datach_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_datach_device::write_h)
{
LOG_MMC(("Datach write_h, offset: %04x, data: %02x\n", offset, data));
@@ -353,7 +352,7 @@ void nes_datach_device::write_h(offs_t offset, uint8_t data)
#endif
break;
default:
- fcg_write(offset & 0x0f, data);
+ fcg_write(space, offset & 0x0f, data, mem_mask);
break;
}
}
@@ -369,12 +368,11 @@ static void datach_cart(device_slot_interface &device)
}
-void nes_datach_device::device_add_mconfig(machine_config &config)
-{
- BARCODE_READER(config, m_reader, 0);
- NES_DATACH_SLOT(config, m_subslot, 0, datach_cart);
- I2C_24C02(config, m_i2cmem);
-}
+MACHINE_CONFIG_START(nes_datach_device::device_add_mconfig)
+ BARCODE_READER(config, "datach", 0);
+ MCFG_DATACH_MINICART_ADD("datach_slot", datach_cart)
+ MCFG_24C02_ADD("i2cmem")
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/nes/datach.h b/src/devices/bus/nes/datach.h
index 81865baa69f..5d4decd64fa 100644
--- a/src/devices/bus/nes/datach.h
+++ b/src/devices/bus/nes/datach.h
@@ -25,7 +25,7 @@ public:
virtual ~datach_cart_interface();
// reading and writing
- virtual uint8_t read(offs_t offset);
+ virtual DECLARE_READ8_MEMBER(read);
uint8_t *get_cart_base() { return m_rom; }
void write_prg_bank(uint8_t bank) { m_bank = bank; }
@@ -52,15 +52,6 @@ class nes_datach_slot_device : public device_t,
friend class nes_datach_device;
public:
// construction/destruction
- template <typename T>
- nes_datach_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock, T &&opts)
- : nes_datach_slot_device(mconfig, tag, owner, clock)
- {
- option_reset();
- opts(*this);
- set_default_option(nullptr);
- set_fixed(false);
- }
nes_datach_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~nes_datach_slot_device();
@@ -83,7 +74,7 @@ public:
// slot interface overrides
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
- uint8_t read(offs_t offset);
+ virtual DECLARE_READ8_MEMBER(read);
void write_prg_bank(uint8_t bank) { if (m_cart) m_cart->write_prg_bank(bank); }
protected:
@@ -94,6 +85,11 @@ protected:
DECLARE_DEVICE_TYPE(NES_DATACH_SLOT, nes_datach_slot_device)
+#define MCFG_DATACH_MINICART_ADD(_tag, _slot_intf) \
+ MCFG_DEVICE_ADD(_tag, NES_DATACH_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, nullptr, false)
+
+
//--------------------------------
//
// Datach Minicart implementation
@@ -152,9 +148,9 @@ public:
// construction/destruction
nes_datach_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/discrete.cpp b/src/devices/bus/nes/discrete.cpp
index 2fb7883d063..2e1f6a4c81b 100644
--- a/src/devices/bus/nes/discrete.cpp
+++ b/src/devices/bus/nes/discrete.cpp
@@ -134,7 +134,7 @@ void nes_74x161x138_device::pcb_reset()
-------------------------------------------------*/
// there are two 'variants' depending on hardwired or mapper ctrl mirroring
-void nes_74x161x161x32_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_74x161x161x32_device::write_h)
{
LOG_MMC(("74x161x161x32 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -155,7 +155,7 @@ void nes_74x161x161x32_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_74x139x74_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_74x139x74_device::write_m)
{
LOG_MMC(("74x139x74 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -179,7 +179,7 @@ void nes_74x139x74_device::write_m(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_74x377_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_74x377_device::write_h)
{
LOG_MMC(("74x377 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -200,7 +200,7 @@ void nes_74x377_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_74x161x138_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_74x161x138_device::write_m)
{
LOG_MMC(("74x161x138 write_m, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/discrete.h b/src/devices/bus/nes/discrete.h
index 861b8b643bf..51576a77e41 100644
--- a/src/devices/bus/nes/discrete.h
+++ b/src/devices/bus/nes/discrete.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_74x161x161x32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -34,7 +34,7 @@ public:
// construction/destruction
nes_74x139x74_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -52,7 +52,7 @@ public:
// construction/destruction
nes_74x377_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -70,7 +70,7 @@ public:
// construction/destruction
nes_74x161x138_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/disksys.cpp b/src/devices/bus/nes/disksys.cpp
index 71101492822..0f350fb7922 100644
--- a/src/devices/bus/nes/disksys.cpp
+++ b/src/devices/bus/nes/disksys.cpp
@@ -51,10 +51,9 @@ static const floppy_interface nes_floppy_interface =
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nes_disksys_device::device_add_mconfig(machine_config &config)
-{
- LEGACY_FLOPPY(config, FLOPPY_0, 0, &nes_floppy_interface);
-}
+MACHINE_CONFIG_START(nes_disksys_device::device_add_mconfig)
+ MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, nes_floppy_interface)
+MACHINE_CONFIG_END
ROM_START( disksys )
@@ -173,7 +172,7 @@ void nes_disksys_device::pcb_reset()
-------------------------------------------------*/
-void nes_disksys_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_disksys_device::write_h)
{
LOG_MMC(("Famicom Disk System write_h, offset %04x, data: %02x\n", offset, data));
@@ -181,7 +180,7 @@ void nes_disksys_device::write_h(offs_t offset, uint8_t data)
m_prgram[offset + 0x2000] = data;
}
-uint8_t nes_disksys_device::read_h(offs_t offset)
+READ8_MEMBER(nes_disksys_device::read_h)
{
LOG_MMC(("Famicom Disk System read_h, offset: %04x\n", offset));
@@ -191,13 +190,13 @@ uint8_t nes_disksys_device::read_h(offs_t offset)
return m_2c33_rom[offset & 0x1fff];
}
-void nes_disksys_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_disksys_device::write_m)
{
LOG_MMC(("Famicom Disk System write_m, offset: %04x, data: %02x\n", offset, data));
m_prgram[offset] = data;
}
-uint8_t nes_disksys_device::read_m(offs_t offset)
+READ8_MEMBER(nes_disksys_device::read_m)
{
LOG_MMC(("Famicom Disk System read_m, offset: %04x\n", offset));
return m_prgram[offset];
@@ -209,7 +208,7 @@ void nes_disksys_device::hblank_irq(int scanline, int vblank, int blanked)
hold_irq_line();
}
-void nes_disksys_device::write_ex(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_disksys_device::write_ex)
{
LOG_MMC(("Famicom Disk System write_ex, offset: %04x, data: %02x\n", offset, data));
@@ -281,7 +280,7 @@ void nes_disksys_device::write_ex(offs_t offset, uint8_t data)
}
}
-uint8_t nes_disksys_device::read_ex(offs_t offset)
+READ8_MEMBER(nes_disksys_device::read_ex)
{
LOG_MMC(("Famicom Disk System read_ex, offset: %04x\n", offset));
uint8_t ret;
diff --git a/src/devices/bus/nes/disksys.h b/src/devices/bus/nes/disksys.h
index 1e3e45afb1e..907ee06abef 100644
--- a/src/devices/bus/nes/disksys.h
+++ b/src/devices/bus/nes/disksys.h
@@ -17,12 +17,12 @@ public:
// construction/destruction
nes_disksys_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_ex(offs_t offset) override;
- virtual uint8_t read_m(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_ex(offs_t offset, uint8_t data) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_ex) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ex) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void disk_flip_side() override;
diff --git a/src/devices/bus/nes/ggenie.cpp b/src/devices/bus/nes/ggenie.cpp
index bb5866feac7..462c9c5da37 100644
--- a/src/devices/bus/nes/ggenie.cpp
+++ b/src/devices/bus/nes/ggenie.cpp
@@ -80,7 +80,7 @@ void nes_ggenie_device::pcb_reset()
-------------------------------------------------*/
-void nes_ggenie_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ggenie_device::write_h)
{
// LOG_MMC(("axrom write_h, offset: %04x, data: %02x\n", offset, data));
if (!m_gg_bypass)
@@ -150,22 +150,22 @@ void nes_ggenie_device::write_h(offs_t offset, uint8_t data)
}
}
else
- m_ggslot->write_h(offset, data);
+ m_ggslot->write_h(space, offset, data, mem_mask);
}
-void nes_ggenie_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ggenie_device::write_m)
{
if (m_gg_bypass && m_ggslot)
- m_ggslot->write_m(offset, data);
+ m_ggslot->write_m(space, offset, data, mem_mask);
}
-void nes_ggenie_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ggenie_device::write_l)
{
if (m_gg_bypass && m_ggslot)
- m_ggslot->write_l(offset, data);
+ m_ggslot->write_l(space, offset, data, mem_mask);
}
-uint8_t nes_ggenie_device::read_h(offs_t offset)
+READ8_MEMBER(nes_ggenie_device::read_h)
{
if (m_gg_bypass && m_ggslot->m_cart)
{
@@ -186,29 +186,29 @@ uint8_t nes_ggenie_device::read_h(offs_t offset)
return hi_access_rom(offset);
}
-uint8_t nes_ggenie_device::read_m(offs_t offset)
+READ8_MEMBER(nes_ggenie_device::read_m)
{
if (m_gg_bypass && m_ggslot->m_cart)
- return m_ggslot->m_cart->read_m(offset);
+ return m_ggslot->m_cart->read_m(space, offset, mem_mask);
return 0xff;
}
-uint8_t nes_ggenie_device::read_l(offs_t offset)
+READ8_MEMBER(nes_ggenie_device::read_l)
{
if (m_gg_bypass && m_ggslot->m_cart)
- return m_ggslot->m_cart->read_l(offset);
+ return m_ggslot->m_cart->read_l(space, offset, mem_mask);
return 0xff;
}
-void nes_ggenie_device::chr_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ggenie_device::chr_w)
{
int bank = offset >> 10;
if (m_gg_bypass && m_ggslot->m_cart)
{
- m_ggslot->m_cart->chr_w(offset, data);
+ m_ggslot->m_cart->chr_w(space, offset, data, mem_mask);
return;
}
@@ -216,24 +216,24 @@ void nes_ggenie_device::chr_w(offs_t offset, uint8_t data)
m_chr_access[bank][offset & 0x3ff] = data;
}
-uint8_t nes_ggenie_device::chr_r(offs_t offset)
+READ8_MEMBER(nes_ggenie_device::chr_r)
{
int bank = offset >> 10;
if (m_gg_bypass && m_ggslot->m_cart)
- return m_ggslot->m_cart->chr_r(offset);
+ return m_ggslot->m_cart->chr_r(space, offset, mem_mask);
return m_chr_access[bank][offset & 0x3ff];
}
-void nes_ggenie_device::nt_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ggenie_device::nt_w)
{
int page = ((offset & 0xc00) >> 10);
if (m_gg_bypass && m_ggslot->m_cart)
{
- m_ggslot->m_cart->nt_w(offset, data);
+ m_ggslot->m_cart->nt_w(space, offset, data, mem_mask);
return;
}
@@ -243,12 +243,12 @@ void nes_ggenie_device::nt_w(offs_t offset, uint8_t data)
m_nt_access[page][offset & 0x3ff] = data;
}
-uint8_t nes_ggenie_device::nt_r(offs_t offset)
+READ8_MEMBER(nes_ggenie_device::nt_r)
{
int page = ((offset & 0xc00) >> 10);
if (m_gg_bypass && m_ggslot->m_cart)
- return m_ggslot->m_cart->nt_r(offset);
+ return m_ggslot->m_cart->nt_r(space, offset, mem_mask);
return m_nt_access[page][offset & 0x3ff];
}
diff --git a/src/devices/bus/nes/ggenie.h b/src/devices/bus/nes/ggenie.h
index 2d6974be849..1ca577ec7b0 100644
--- a/src/devices/bus/nes/ggenie.h
+++ b/src/devices/bus/nes/ggenie.h
@@ -16,17 +16,17 @@ public:
// construction/destruction
nes_ggenie_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_m(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
-
- virtual uint8_t chr_r(offs_t offset) override;
- virtual void chr_w(offs_t offset, uint8_t data) override;
- virtual uint8_t nt_r(offs_t offset) override;
- virtual void nt_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
+
+ virtual DECLARE_READ8_MEMBER(chr_r) override;
+ virtual DECLARE_WRITE8_MEMBER(chr_w) override;
+ virtual DECLARE_READ8_MEMBER(nt_r) override;
+ virtual DECLARE_WRITE8_MEMBER(nt_w) override;
void hblank_irq(int scanline, int vblank, int blanked) override { if (m_gg_bypass && m_ggslot->m_cart) m_ggslot->m_cart->hblank_irq(scanline, vblank, blanked); }
void scanline_irq(int scanline, int vblank, int blanked) override { if (m_gg_bypass && m_ggslot->m_cart) m_ggslot->m_cart->scanline_irq(scanline, vblank, blanked); }
diff --git a/src/devices/bus/nes/henggedianzi.cpp b/src/devices/bus/nes/henggedianzi.cpp
index 0f9acd05d45..5d75850a0c8 100644
--- a/src/devices/bus/nes/henggedianzi.cpp
+++ b/src/devices/bus/nes/henggedianzi.cpp
@@ -135,7 +135,7 @@ void nes_hengg_shjy3_device::pcb_reset()
-------------------------------------------------*/
-void nes_hengg_srich_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_hengg_srich_device::write_h)
{
LOG_MMC(("hengg_srich write_h, offset: %04x, data: %02x\n", offset, data));
@@ -162,7 +162,7 @@ void nes_hengg_srich_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_hengg_xhzs_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_hengg_xhzs_device::write_l)
{
LOG_MMC(("hengg_xhzs write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x4100;
@@ -171,7 +171,7 @@ void nes_hengg_xhzs_device::write_l(offs_t offset, uint8_t data)
prg32(data >> 1);
}
-void nes_hengg_xhzs_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_hengg_xhzs_device::write_h)
{
LOG_MMC(("hengg_xhzs write_h, offset: %04x, data: %02x\n", offset, data));
@@ -225,7 +225,7 @@ void nes_hengg_shjy3_device::update_banks()
}
}
-void nes_hengg_shjy3_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_hengg_shjy3_device::write_h)
{
LOG_MMC(("shjy3 write_h, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/henggedianzi.h b/src/devices/bus/nes/henggedianzi.h
index 0bf0b2faebc..d74da743425 100644
--- a/src/devices/bus/nes/henggedianzi.h
+++ b/src/devices/bus/nes/henggedianzi.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_hengg_srich_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -34,8 +34,8 @@ public:
// construction/destruction
nes_hengg_xhzs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -53,7 +53,7 @@ public:
// construction/destruction
nes_hengg_shjy3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/hes.cpp b/src/devices/bus/nes/hes.cpp
index 946ea1f9585..8d1d3a7a590 100644
--- a/src/devices/bus/nes/hes.cpp
+++ b/src/devices/bus/nes/hes.cpp
@@ -73,7 +73,7 @@ void nes_hes_device::pcb_reset()
-------------------------------------------------*/
-void nes_hes_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_hes_device::write_l)
{
LOG_MMC(("hes write_l, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/hes.h b/src/devices/bus/nes/hes.h
index ea72578ad98..d45d20a1a3f 100644
--- a/src/devices/bus/nes/hes.h
+++ b/src/devices/bus/nes/hes.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_hes_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/hosenkan.cpp b/src/devices/bus/nes/hosenkan.cpp
index ae7749b7e9a..4200655897e 100644
--- a/src/devices/bus/nes/hosenkan.cpp
+++ b/src/devices/bus/nes/hosenkan.cpp
@@ -105,7 +105,7 @@ void nes_hosenkan_device::hblank_irq( int scanline, int vblank, int blanked )
m_irq_clear = 0;
}
-void nes_hosenkan_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_hosenkan_device::write_h)
{
LOG_MMC(("hosenkan write_h, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/hosenkan.h b/src/devices/bus/nes/hosenkan.h
index 163aef76edc..153638a9cbe 100644
--- a/src/devices/bus/nes/hosenkan.h
+++ b/src/devices/bus/nes/hosenkan.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_hosenkan_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/irem.cpp b/src/devices/bus/nes/irem.cpp
index c55cb588506..15ef687dbea 100644
--- a/src/devices/bus/nes/irem.cpp
+++ b/src/devices/bus/nes/irem.cpp
@@ -166,7 +166,7 @@ void nes_h3001_device::pcb_reset()
-------------------------------------------------*/
-void nes_lrog017_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_lrog017_device::write_h)
{
LOG_MMC(("lrog017 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -185,7 +185,7 @@ void nes_lrog017_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_holydivr_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_holydivr_device::write_h)
{
LOG_MMC(("holy diver write_h, offset: %04x, data: %02x\n", offset, data));
@@ -209,7 +209,7 @@ void nes_holydivr_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_tam_s1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_tam_s1_device::write_h)
{
LOG_MMC(("tam s1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -233,7 +233,7 @@ void nes_tam_s1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_g101_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_g101_device::write_h)
{
LOG_MMC(("g101 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -299,7 +299,7 @@ void nes_h3001_device::device_timer(emu_timer &timer, device_timer_id id, int pa
}
}
-void nes_h3001_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_h3001_device::write_h)
{
LOG_MMC(("h3001 write_h, offset %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/irem.h b/src/devices/bus/nes/irem.h
index 82fd0815c38..a50077e70a3 100644
--- a/src/devices/bus/nes/irem.h
+++ b/src/devices/bus/nes/irem.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_lrog017_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -34,7 +34,7 @@ public:
// construction/destruction
nes_holydivr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -52,7 +52,7 @@ public:
// construction/destruction
nes_tam_s1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -70,7 +70,7 @@ public:
// construction/destruction
nes_g101_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -90,7 +90,7 @@ public:
// construction/destruction
nes_h3001_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/jaleco.cpp b/src/devices/bus/nes/jaleco.cpp
index 740c3c799b8..907580d6a1e 100644
--- a/src/devices/bus/nes/jaleco.cpp
+++ b/src/devices/bus/nes/jaleco.cpp
@@ -253,7 +253,7 @@ void nes_ss88006_device::pcb_reset()
-------------------------------------------------*/
-void nes_jf11_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_jf11_device::write_m)
{
LOG_MMC(("jf11 write_m, offset: %04x, data: %02x\n", offset, data));
chr8(data, CHRROM);
@@ -274,7 +274,7 @@ void nes_jf11_device::write_m(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_jf13_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_jf13_device::write_m)
{
LOG_MMC(("jf13 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -301,7 +301,7 @@ void nes_jf13_device::write_m(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_jf16_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_jf16_device::write_h)
{
LOG_MMC(("jf16 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -330,7 +330,7 @@ void nes_jf16_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_jf17_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_jf17_device::write_h)
{
LOG_MMC(("jf17 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -345,7 +345,7 @@ void nes_jf17_device::write_h(offs_t offset, uint8_t data)
m_latch = data;
}
-void nes_jf17_adpcm_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_jf17_adpcm_device::write_h)
{
LOG_MMC(("jf17 + ADPCM write_h, offset: %04x, data: %02x\n", offset, data));
@@ -379,7 +379,7 @@ void nes_jf17_adpcm_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_jf19_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_jf19_device::write_h)
{
LOG_MMC(("jf19 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -392,7 +392,7 @@ void nes_jf19_device::write_h(offs_t offset, uint8_t data)
chr8(data & 0x0f, CHRROM);
}
-void nes_jf19_adpcm_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_jf19_adpcm_device::write_h)
{
LOG_MMC(("jf19 + ADPCM write_h, offset: %04x, data: %02x\n", offset, data));
@@ -474,7 +474,7 @@ void nes_ss88006_device::device_timer(emu_timer &timer, device_timer_id id, int
}
}
-void nes_ss88006_device::ss88006_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ss88006_device::ss88006_write)
{
uint8_t bank;
LOG_MMC(("ss88006 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -564,7 +564,7 @@ void nes_ss88006_device::ss88006_write(offs_t offset, uint8_t data)
// bits2-bits6 are sample number, bit1 is setup/enable/disable
// program first write sample # + bit1 set to 'init' the sample
// then it writes sample # + bit1 clear to 'start' the sample
-void nes_ss88006_adpcm_device::ss88006_adpcm_write(offs_t offset, uint8_t data, samples_device &dev)
+void nes_ss88006_adpcm_device::ss88006_adpcm_write(address_space &space, offs_t offset, uint8_t data, samples_device *dev)
{
LOG_MMC(("ss88006 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -575,13 +575,13 @@ void nes_ss88006_adpcm_device::ss88006_adpcm_write(offs_t offset, uint8_t data,
{
// printf("sample write: data: %02x\n", data);
if ((m_latch & 2) && !(data & 2))
- dev.start((data >> 2) & 0x1f, (data >> 2) & 0x1f);
+ dev->start((data >> 2) & 0x1f, (data >> 2) & 0x1f);
}
m_latch = data;
break;
default:
- ss88006_write(offset, data);
+ ss88006_write(space, offset, data);
break;
}
}
diff --git a/src/devices/bus/nes/jaleco.h b/src/devices/bus/nes/jaleco.h
index 53cc5716ce3..ed8c04da7a0 100644
--- a/src/devices/bus/nes/jaleco.h
+++ b/src/devices/bus/nes/jaleco.h
@@ -17,7 +17,7 @@ public:
// construction/destruction
nes_jf11_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -35,7 +35,7 @@ public:
// construction/destruction
nes_jf13_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -58,7 +58,7 @@ public:
// construction/destruction
nes_jf16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -76,7 +76,7 @@ public:
// construction/destruction
nes_jf17_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -98,7 +98,7 @@ public:
// construction/destruction
nes_jf17_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
protected:
virtual void device_add_mconfig(machine_config &config) override;
@@ -116,7 +116,7 @@ public:
// construction/destruction
nes_jf19_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -136,7 +136,7 @@ public:
// construction/destruction
nes_jf19_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
protected:
virtual void device_add_mconfig(machine_config &config) override;
@@ -154,8 +154,8 @@ public:
// construction/destruction
nes_ss88006_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void ss88006_write(offs_t offset, uint8_t data);
- virtual void write_h(offs_t offset, uint8_t data) override { ss88006_write(offset, data); }
+ virtual DECLARE_WRITE8_MEMBER(ss88006_write);
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { ss88006_write(space, offset, data, mem_mask); }
virtual void pcb_reset() override;
@@ -188,7 +188,7 @@ protected:
// construction/destruction
nes_ss88006_adpcm_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
- void ss88006_adpcm_write(offs_t offset, uint8_t data, samples_device &dev);
+ void ss88006_adpcm_write(address_space &space, offs_t offset, uint8_t data, samples_device *dev);
};
@@ -204,7 +204,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
private:
- virtual void write_h(offs_t offset, uint8_t data) override { ss88006_adpcm_write(offset, data, *m_samples); }
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { ss88006_adpcm_write(space, offset, data, m_samples); }
required_device<samples_device> m_samples;
};
@@ -222,7 +222,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
private:
- virtual void write_h(offs_t offset, uint8_t data) override { ss88006_adpcm_write(offset, data, *m_samples); }
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { ss88006_adpcm_write(space, offset, data, m_samples); }
required_device<samples_device> m_samples;
};
@@ -240,7 +240,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
private:
- virtual void write_h(offs_t offset, uint8_t data) override { ss88006_adpcm_write(offset, data, *m_samples); }
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { ss88006_adpcm_write(space, offset, data, m_samples); }
required_device<samples_device> m_samples;
};
@@ -258,7 +258,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
private:
- virtual void write_h(offs_t offset, uint8_t data) override { ss88006_adpcm_write(offset, data, *m_samples); }
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { ss88006_adpcm_write(space, offset, data, m_samples); }
required_device<samples_device> m_samples;
};
diff --git a/src/devices/bus/nes/jy.cpp b/src/devices/bus/nes/jy.cpp
index 8a54624cd5a..33c1e6e6cac 100644
--- a/src/devices/bus/nes/jy.cpp
+++ b/src/devices/bus/nes/jy.cpp
@@ -144,14 +144,14 @@ void nes_jy_typea_device::pcb_reset()
-------------------------------------------------*/
-uint8_t nes_jy_typea_device::nt_r(offs_t offset)
+READ8_MEMBER(nes_jy_typea_device::nt_r)
{
int page = ((offset & 0xc00) >> 10);
irq_clock(0, 2);
return m_nt_access[page][offset & 0x3ff];
}
-uint8_t nes_jy_typea_device::chr_r(offs_t offset)
+READ8_MEMBER(nes_jy_typea_device::chr_r)
{
int bank = offset >> 10;
irq_clock(0, 2);
@@ -241,7 +241,7 @@ void nes_jy_typea_device::scanline_irq(int scanline, int vblank, int blanked)
// 0x5000-0x5fff : sort of protection?
-uint8_t nes_jy_typea_device::read_l(offs_t offset)
+READ8_MEMBER(nes_jy_typea_device::read_l)
{
LOG_MMC(("JY Company write_m, offset: %04x\n", offset));
offset += 0x100;
@@ -249,7 +249,7 @@ uint8_t nes_jy_typea_device::read_l(offs_t offset)
if (offset >= 0x1000 && offset < 0x1800)
{
// bit6/bit7 DSW read
- return get_open_bus() & 0x3f;
+ return m_open_bus & 0x3f;
}
if (offset >= 0x1800)
@@ -262,10 +262,10 @@ uint8_t nes_jy_typea_device::read_l(offs_t offset)
return m_latch;
}
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
-void nes_jy_typea_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_jy_typea_device::write_l)
{
LOG_MMC(("JY Company write_m, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -282,14 +282,14 @@ void nes_jy_typea_device::write_l(offs_t offset, uint8_t data)
}
// 0x6000-0x7fff : WRAM or open bus
-uint8_t nes_jy_typea_device::read_m(offs_t offset)
+READ8_MEMBER(nes_jy_typea_device::read_m)
{
LOG_MMC(("JY Company write_m, offset: %04x\n", offset));
if (m_reg[0] & 0x80)
return m_prg[(m_bank_6000 & m_prg_mask) * 0x2000 + (offset & 0x1fff)];
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
@@ -425,7 +425,7 @@ void nes_jy_typea_device::update_banks(int reg)
}
-void nes_jy_typea_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_jy_typea_device::write_h)
{
LOG_MMC(("JY Company write_m, offset: %04x, data: %02x\n", offset, data));
@@ -569,7 +569,7 @@ void nes_jy_typec_device::update_mirror_typec()
update_mirror_typea();
}
-uint8_t nes_jy_typec_device::chr_r(offs_t offset)
+READ8_MEMBER(nes_jy_typec_device::chr_r)
{
int bank = offset >> 10;
diff --git a/src/devices/bus/nes/jy.h b/src/devices/bus/nes/jy.h
index d318bfae60a..80be5d98631 100644
--- a/src/devices/bus/nes/jy.h
+++ b/src/devices/bus/nes/jy.h
@@ -16,13 +16,13 @@ public:
// construction/destruction
nes_jy_typea_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
- virtual uint8_t chr_r(offs_t offset) override;
- virtual uint8_t nt_r(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(chr_r) override;
+ virtual DECLARE_READ8_MEMBER(nt_r) override;
virtual void scanline_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
@@ -90,7 +90,7 @@ public:
// construction/destruction
nes_jy_typec_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t chr_r(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(chr_r) override;
protected:
void update_mirror_typec();
diff --git a/src/devices/bus/nes/kaiser.cpp b/src/devices/bus/nes/kaiser.cpp
index 52690376e4b..2e228782785 100644
--- a/src/devices/bus/nes/kaiser.cpp
+++ b/src/devices/bus/nes/kaiser.cpp
@@ -295,7 +295,7 @@ void nes_ks7037_device::pcb_reset()
-------------------------------------------------*/
-void nes_ks7058_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks7058_device::write_h)
{
LOG_MMC(("ks7058 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -322,7 +322,7 @@ void nes_ks7058_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_ks7022_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks7022_device::write_h)
{
LOG_MMC(("ks7022 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -333,7 +333,7 @@ void nes_ks7022_device::write_h(offs_t offset, uint8_t data)
m_latch = data & 0x0f;
}
-uint8_t nes_ks7022_device::read_h(offs_t offset)
+READ8_MEMBER(nes_ks7022_device::read_h)
{
LOG_MMC(("ks7022 read_h, offset: %04x\n", offset));
@@ -388,7 +388,7 @@ void nes_ks7032_device::prg_update()
prg8_cd(m_reg[3]);
}
-void nes_ks7032_device::ks7032_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks7032_device::ks7032_write)
{
LOG_MMC(("ks7032_write, offset: %04x, data: %02x\n", offset, data));
@@ -419,7 +419,7 @@ void nes_ks7032_device::ks7032_write(offs_t offset, uint8_t data)
}
}
-uint8_t nes_ks7032_device::read_m(offs_t offset)
+READ8_MEMBER(nes_ks7032_device::read_m)
{
LOG_MMC(("ks7032 read_m, offset: %04x\n", offset));
return m_prg[((m_reg[4] * 0x2000) + (offset & 0x1fff)) & (m_prg_size - 1)];
@@ -438,7 +438,7 @@ uint8_t nes_ks7032_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_ks202_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks202_device::write_h)
{
LOG_MMC(("ks202 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -458,12 +458,12 @@ void nes_ks202_device::write_h(offs_t offset, uint8_t data)
}
break;
default:
- ks7032_write(offset, data);
+ ks7032_write(space, offset, data, mem_mask);
break;
}
}
-uint8_t nes_ks202_device::read_m(offs_t offset)
+READ8_MEMBER(nes_ks202_device::read_m)
{
LOG_MMC(("ks202 read_m, offset: %04x\n", offset));
return m_prgram[offset & 0x1fff];
@@ -499,7 +499,7 @@ void nes_ks7017_device::device_timer(emu_timer &timer, device_timer_id id, int p
}
}
-void nes_ks7017_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks7017_device::write_l)
{
LOG_MMC(("ks7017 write_l, offset: %04x, data: %02x\n", offset, data));
@@ -512,7 +512,7 @@ void nes_ks7017_device::write_l(offs_t offset, uint8_t data)
prg16_89ab(m_latch);
}
-void nes_ks7017_device::write_ex(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks7017_device::write_ex)
{
LOG_MMC(("ks7017 write_ex, offset: %04x, data: %02x\n", offset, data));
offset += 0x20;
@@ -530,7 +530,7 @@ void nes_ks7017_device::write_ex(offs_t offset, uint8_t data)
set_nt_mirroring(BIT(data, 3) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
}
-uint8_t nes_ks7017_device::read_ex(offs_t offset)
+READ8_MEMBER(nes_ks7017_device::read_ex)
{
LOG_MMC(("ks7017 read_ex, offset: %04x\n", offset));
offset += 0x20;
@@ -542,7 +542,7 @@ uint8_t nes_ks7017_device::read_ex(offs_t offset)
return temp;
}
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
/*-------------------------------------------------
@@ -557,7 +557,7 @@ uint8_t nes_ks7017_device::read_ex(offs_t offset)
-------------------------------------------------*/
-void nes_ks7012_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks7012_device::write_h)
{
LOG_MMC(("ks7012 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -580,13 +580,13 @@ void nes_ks7012_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_ks7013b_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks7013b_device::write_m)
{
LOG_MMC(("ks7013b write_l, offset: %04x, data: %02x\n", offset, data));
prg16_89ab(data);
}
-void nes_ks7013b_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks7013b_device::write_h)
{
LOG_MMC(("ks7013b write_h, offset: %04x, data: %02x\n", offset, data));
set_nt_mirroring((data & 1) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
@@ -613,20 +613,20 @@ void nes_ks7013b_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-uint8_t nes_ks7031_device::read_m(offs_t offset)
+READ8_MEMBER(nes_ks7031_device::read_m)
{
// LOG_MMC(("ks7031 read_m, offset: %04x\n", offset));
return m_prg[(m_reg[(offset >> 11) & 3] * 0x0800) + (offset & 0x7ff)];
}
-uint8_t nes_ks7031_device::read_h(offs_t offset)
+READ8_MEMBER(nes_ks7031_device::read_h)
{
// here the first 32K are accessed, but in 16x2K blocks loaded in reverse order
int accessed_2k = (offset >> 11) & 0x0f;
return m_prg[((0x0f - accessed_2k) * 0x0800) + (offset & 0x7ff)];
}
-void nes_ks7031_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks7031_device::write_h)
{
LOG_MMC(("ks7031 write_h, offset: %04x, data: %02x\n", offset, data));
m_reg[(offset >> 11) & 3] = data & 0x3f;
@@ -646,13 +646,13 @@ void nes_ks7031_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-uint8_t nes_ks7016_device::read_m(offs_t offset)
+READ8_MEMBER(nes_ks7016_device::read_m)
{
// LOG_MMC(("ks7016 read_m, offset: %04x\n", offset));
return m_prg[((m_reg * 0x2000) + (offset & 0x1fff)) & (m_prg_size - 1)];
}
-void nes_ks7016_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks7016_device::write_h)
{
LOG_MMC(("ks7016 write_h, offset: %04x, data: %02x\n", offset, data));
uint8_t mask = offset & 0x30;
@@ -692,7 +692,7 @@ void nes_ks7037_device::update_prg()
set_nt_page(3, CIRAM, m_reg[5] & 1, 1);
}
-uint8_t nes_ks7037_device::read_m(offs_t offset)
+READ8_MEMBER(nes_ks7037_device::read_m)
{
// LOG_MMC(("ks7037 read_m, offset: %04x\n", offset));
if (offset < 0x1000)
@@ -701,14 +701,14 @@ uint8_t nes_ks7037_device::read_m(offs_t offset)
return m_prg[(0x1e * 0x1000) + (offset & 0x0fff)];
}
-void nes_ks7037_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks7037_device::write_m)
{
LOG_MMC(("ks7037 write_m, offset: %04x, data: %02x\n", offset, data));
if (offset < 0x1000)
m_prgram[offset & 0x0fff] = data;
}
-uint8_t nes_ks7037_device::read_h(offs_t offset)
+READ8_MEMBER(nes_ks7037_device::read_h)
{
// LOG_MMC(("ks7037 read_h, offset: %04x\n", offset));
@@ -718,7 +718,7 @@ uint8_t nes_ks7037_device::read_h(offs_t offset)
return hi_access_rom(offset);
}
-void nes_ks7037_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks7037_device::write_h)
{
LOG_MMC(("ks7037 write_h, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/kaiser.h b/src/devices/bus/nes/kaiser.h
index e0e31658cdb..8c544059aa9 100644
--- a/src/devices/bus/nes/kaiser.h
+++ b/src/devices/bus/nes/kaiser.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_ks7058_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -34,8 +34,8 @@ public:
// construction/destruction
nes_ks7022_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -56,9 +56,9 @@ public:
// construction/destruction
nes_ks7032_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- void ks7032_write(offs_t offset, uint8_t data);
- virtual void write_h(offs_t offset, uint8_t data) override { ks7032_write(offset, data); }
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(ks7032_write);
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { ks7032_write(space, offset, data, mem_mask); }
virtual void pcb_reset() override;
@@ -91,8 +91,8 @@ public:
nes_ks202_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
};
@@ -104,9 +104,9 @@ public:
// construction/destruction
nes_ks7017_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_ex(offs_t offset) override;
- virtual void write_ex(offs_t offset, uint8_t data) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_ex) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ex) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
@@ -135,7 +135,7 @@ public:
// construction/destruction
nes_ks7012_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -152,8 +152,8 @@ public:
// construction/destruction
nes_ks7013b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -171,9 +171,9 @@ public:
// construction/destruction
nes_ks7031_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -194,8 +194,8 @@ public:
// construction/destruction
nes_ks7016_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -215,10 +215,10 @@ public:
// construction/destruction
nes_ks7037_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/karastudio.cpp b/src/devices/bus/nes/karastudio.cpp
index fc98a658213..1b828001078 100644
--- a/src/devices/bus/nes/karastudio.cpp
+++ b/src/devices/bus/nes/karastudio.cpp
@@ -60,7 +60,7 @@ kstudio_cart_interface::~kstudio_cart_interface()
{
}
-uint8_t kstudio_cart_interface::read(offs_t offset)
+READ8_MEMBER(kstudio_cart_interface::read)
{
return m_rom[(m_bank * 0x4000) + (offset & 0x3fff)];
}
@@ -89,10 +89,10 @@ void nes_kstudio_slot_device::device_start()
m_cart = dynamic_cast<kstudio_cart_interface *>(get_card_device());
}
-uint8_t nes_kstudio_slot_device::read(offs_t offset)
+READ8_MEMBER(nes_kstudio_slot_device::read)
{
if (m_cart)
- return m_cart->read(offset);
+ return m_cart->read(space, offset, mem_mask);
return 0xff;
}
@@ -225,29 +225,29 @@ void nes_karaokestudio_device::pcb_reset()
-------------------------------------------------*/
-uint8_t nes_karaokestudio_device::read_m(offs_t offset)
+READ8_MEMBER(nes_karaokestudio_device::read_m)
{
LOG_MMC(("karaoke studio read_m, offset: %04x\n", offset));
return m_mic_ipt->read();
}
-uint8_t nes_karaokestudio_device::read_h(offs_t offset)
+READ8_MEMBER(nes_karaokestudio_device::read_h)
{
LOG_MMC(("karaoke studio read_h, offset: %04x\n", offset));
// this shall be the proper code, but it's a bit slower, so we access directly the subcart below
- //return m_subslot->read(offset);
+ //return m_subslot->read(space, offset, mem_mask);
// access expansion cart only if all of the followings are verified
// * we are in $8000-$bfff range
// * there has been a bankswitch write to map the expansion to such range
// * there actually is an expansion cart mounted
if (offset < 0x4000 && m_exp_active && m_subslot->m_cart)
- return m_subslot->m_cart->read(offset);
+ return m_subslot->m_cart->read(space, offset, mem_mask);
else
return hi_access_rom(offset);
}
-void nes_karaokestudio_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_karaokestudio_device::write_h)
{
LOG_MMC(("karaoke studio write_h, offset: %04x, data: %02x\n", offset, data));
// bit3 1 = M ROM (main unit), 0=E ROM (expansion)
@@ -296,7 +296,6 @@ static void karaoke_studio_cart(device_slot_interface &device)
}
-void nes_karaokestudio_device::device_add_mconfig(machine_config &config)
-{
- NES_KSEXPANSION_SLOT(config, m_subslot, karaoke_studio_cart);
-}
+MACHINE_CONFIG_START(nes_karaokestudio_device::device_add_mconfig)
+ MCFG_KSTUDIO_MINICART_ADD("exp_slot", karaoke_studio_cart)
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/nes/karastudio.h b/src/devices/bus/nes/karastudio.h
index fcb481f046e..bd712722fe9 100644
--- a/src/devices/bus/nes/karastudio.h
+++ b/src/devices/bus/nes/karastudio.h
@@ -24,7 +24,7 @@ public:
virtual ~kstudio_cart_interface();
// reading and writing
- virtual uint8_t read(offs_t offset);
+ virtual DECLARE_READ8_MEMBER(read);
uint8_t *get_cart_base() { return m_rom; }
void write_prg_bank(uint8_t bank) { m_bank = bank; }
@@ -49,16 +49,6 @@ class nes_kstudio_slot_device : public device_t,
friend class nes_karaokestudio_device;
public:
// construction/destruction
- template <typename T>
- nes_kstudio_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts)
- : nes_kstudio_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(nullptr);
- set_fixed(false);
- }
-
nes_kstudio_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~nes_kstudio_slot_device();
@@ -78,7 +68,7 @@ public:
// slot interface overrides
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
- uint8_t read(offs_t offset);
+ virtual DECLARE_READ8_MEMBER(read);
void write_prg_bank(uint8_t bank) { if (m_cart) m_cart->write_prg_bank(bank); }
protected:
@@ -92,6 +82,11 @@ protected:
DECLARE_DEVICE_TYPE(NES_KSEXPANSION_SLOT, nes_kstudio_slot_device)
+#define MCFG_KSTUDIO_MINICART_ADD(_tag, _slot_intf) \
+ MCFG_DEVICE_ADD(_tag, NES_KSEXPANSION_SLOT, 0) \
+MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, nullptr, false)
+
+
//-----------------------------------------------
//
// Karaoke Studio Expansion cart implementation
@@ -135,9 +130,9 @@ public:
// construction/destruction
nes_karaokestudio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/konami.cpp b/src/devices/bus/nes/konami.cpp
index 2d3f20863cb..320ceb1eb9b 100644
--- a/src/devices/bus/nes/konami.cpp
+++ b/src/devices/bus/nes/konami.cpp
@@ -81,7 +81,7 @@ nes_konami_vrc6_device::nes_konami_vrc6_device(const machine_config &mconfig, co
}
nes_konami_vrc7_device::nes_konami_vrc7_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : nes_konami_vrc4_device(mconfig, NES_VRC7, tag, owner, clock), m_vrc7snd(*this, "vrc7snd")
+ : nes_konami_vrc4_device(mconfig, NES_VRC7, tag, owner, clock), m_ym2413(*this, "ym")
{
}
@@ -239,7 +239,7 @@ void nes_konami_vrc7_device::pcb_reset()
-------------------------------------------------*/
-void nes_konami_vrc1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_konami_vrc1_device::write_h)
{
LOG_MMC(("VRC-1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -280,7 +280,7 @@ void nes_konami_vrc1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-uint8_t nes_konami_vrc2_device::read_m(offs_t offset)
+READ8_MEMBER(nes_konami_vrc2_device::read_m)
{
LOG_MMC(("VRC-2 read_m, offset: %04x\n", offset));
@@ -289,10 +289,10 @@ uint8_t nes_konami_vrc2_device::read_m(offs_t offset)
else if (!m_prgram.empty())
return m_prgram[offset & (m_prgram.size() - 1)];
else // sort of protection? it returns open bus in $7000-$7fff and (open bus & 0xfe) | m_latch in $6000-$6fff
- return (offset < 0x1000) ? ((get_open_bus() & 0xfe) | (m_latch & 1)) : get_open_bus();
+ return (offset < 0x1000) ? ((m_open_bus & 0xfe) | (m_latch & 1)) : m_open_bus;
}
-void nes_konami_vrc2_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_konami_vrc2_device::write_m)
{
LOG_MMC(("VRC-2 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -304,7 +304,7 @@ void nes_konami_vrc2_device::write_m(offs_t offset, uint8_t data)
m_latch = data;
}
-void nes_konami_vrc2_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_konami_vrc2_device::write_h)
{
uint8_t bank, shift, mask;
uint16_t add_lines = ((offset << (9 - m_vrc_ls_prg_a)) & 0x200) | ((offset << (8 - m_vrc_ls_prg_b)) & 0x100);
@@ -385,7 +385,7 @@ void nes_konami_vrc3_device::device_timer(emu_timer &timer, device_timer_id id,
}
}
-void nes_konami_vrc3_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_konami_vrc3_device::write_h)
{
LOG_MMC(("VRC-3 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -482,7 +482,7 @@ void nes_konami_vrc4_device::set_prg()
}
}
-void nes_konami_vrc4_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_konami_vrc4_device::write_h)
{
uint8_t bank, shift, mask;
uint16_t add_lines = ((offset << (9 - m_vrc_ls_prg_a)) & 0x200) | ((offset << (8 - m_vrc_ls_prg_b)) & 0x100);
@@ -564,7 +564,7 @@ void nes_konami_vrc4_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_konami_vrc6_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_konami_vrc6_device::write_h)
{
uint8_t bank;
uint16_t add_lines = ((offset << (9 - m_vrc_ls_prg_a)) & 0x200) | ((offset << (8 - m_vrc_ls_prg_b)) & 0x100);
@@ -579,10 +579,10 @@ void nes_konami_vrc6_device::write_h(offs_t offset, uint8_t data)
prg8_cd(data);
break;
case 0x1000: // pulse 1 & global control
- m_vrc6snd->write(add_lines>>8, data);
+ m_vrc6snd->write(space, add_lines>>8, data);
break;
case 0x2000: // pulse 2
- m_vrc6snd->write((add_lines>>8) | 0x100, data);
+ m_vrc6snd->write(space, (add_lines>>8) | 0x100, data);
break;
case 0x3000:
if (add_lines == 0x300)
@@ -596,7 +596,7 @@ void nes_konami_vrc6_device::write_h(offs_t offset, uint8_t data)
}
}
else // saw
- m_vrc6snd->write((add_lines>>8) | 0x200, data);
+ m_vrc6snd->write(space, (add_lines>>8) | 0x200, data);
break;
case 0x5000:
case 0x6000:
@@ -637,15 +637,16 @@ void nes_konami_vrc6_device::write_h(offs_t offset, uint8_t data)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nes_konami_vrc6_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(nes_konami_vrc6_device::device_add_mconfig)
+
// additional sound hardware
SPEAKER(config, "addon").front_center();
// TODO: this is not how VRC6 clock signaling works!
// The board uses the CLK pin in reality, not hardcoded NTSC values!
- VRC6(config, m_vrc6snd, XTAL(21'477'272)/12).add_route(ALL_OUTPUTS, "addon", 0.5);
-}
+ MCFG_DEVICE_ADD("vrc6snd", VRC6, XTAL(21'477'272)/12)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 0.5)
+MACHINE_CONFIG_END
/*-------------------------------------------------
@@ -659,7 +660,7 @@ void nes_konami_vrc6_device::device_add_mconfig(machine_config &config)
-------------------------------------------------*/
-void nes_konami_vrc7_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_konami_vrc7_device::write_h)
{
uint8_t bank;
LOG_MMC(("VRC-7 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -681,11 +682,11 @@ void nes_konami_vrc7_device::write_h(offs_t offset, uint8_t data)
case 0x1010:
case 0x1018:
- m_vrc7snd->register_port_w(data);
+ m_ym2413->register_port_w(space, 0, data);
break;
case 0x1030:
case 0x1038:
- m_vrc7snd->data_port_w(data);
+ m_ym2413->data_port_w(space, 0, data);
break;
case 0x2000:
@@ -758,12 +759,15 @@ void nes_konami_vrc7_device::write_h(offs_t offset, uint8_t data)
// and has one output pin for audio, multiplexed for all 6 channels; OPLL has two output pins, one for
// FM and one for Rhythm, and has no special status pin.
-void nes_konami_vrc7_device::device_add_mconfig(machine_config &config)
-{
+// FIXME: we currently emulate this as a base YM2413!
+
+MACHINE_CONFIG_START(nes_konami_vrc7_device::device_add_mconfig)
+
// additional sound hardware
SPEAKER(config, "addon").front_center();
// TODO: this is not how VRC7 clock signaling works!
// The board uses the CLK pin in reality, not hardcoded NTSC values!
- VRC7(config, m_vrc7snd, XTAL(21'477'272)/6).add_route(0, "addon", 1.0).add_route(1, "addon", 0.0);
-}
+ MCFG_DEVICE_ADD("ym", YM2413, XTAL(21'477'272)/12)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 0.5)
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/nes/konami.h b/src/devices/bus/nes/konami.h
index 86afa1832e1..db269170f53 100644
--- a/src/devices/bus/nes/konami.h
+++ b/src/devices/bus/nes/konami.h
@@ -18,7 +18,7 @@ public:
// construction/destruction
nes_konami_vrc1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -39,9 +39,9 @@ public:
// construction/destruction
nes_konami_vrc2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -63,7 +63,7 @@ public:
// construction/destruction
nes_konami_vrc3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -91,7 +91,7 @@ public:
// construction/destruction
nes_konami_vrc4_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -126,7 +126,7 @@ public:
// construction/destruction
nes_konami_vrc6_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
protected:
// device-level overrides
@@ -146,7 +146,7 @@ public:
// construction/destruction
nes_konami_vrc7_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -157,7 +157,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
private:
- required_device<vrc7snd_device> m_vrc7snd;
+ required_device<ym2413_device> m_ym2413;
};
diff --git a/src/devices/bus/nes/legacy.cpp b/src/devices/bus/nes/legacy.cpp
index a3ab9377082..d2b1c697296 100644
--- a/src/devices/bus/nes/legacy.cpp
+++ b/src/devices/bus/nes/legacy.cpp
@@ -136,7 +136,7 @@ void nes_ffe8_device::pcb_reset()
-------------------------------------------------*/
-void nes_ffe3_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ffe3_device::write_h)
{
LOG_MMC(("mapper8 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -174,7 +174,7 @@ void nes_ffe4_device::device_timer(emu_timer &timer, device_timer_id id, int par
}
}
-void nes_ffe4_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ffe4_device::write_l)
{
LOG_MMC(("mapper6 write_l, offset: %04x, data: %02x\n", offset, data));
@@ -202,7 +202,7 @@ void nes_ffe4_device::write_l(offs_t offset, uint8_t data)
}
}
-void nes_ffe4_device::chr_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ffe4_device::chr_w)
{
int bank = offset >> 10;
if (m_exram_enabled)
@@ -212,7 +212,7 @@ void nes_ffe4_device::chr_w(offs_t offset, uint8_t data)
m_chr_access[bank][offset & 0x3ff] = data;
}
-uint8_t nes_ffe4_device::chr_r(offs_t offset)
+READ8_MEMBER(nes_ffe4_device::chr_r)
{
int bank = offset >> 10;
if (m_exram_enabled)
@@ -222,7 +222,7 @@ uint8_t nes_ffe4_device::chr_r(offs_t offset)
}
-void nes_ffe4_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ffe4_device::write_h)
{
LOG_MMC(("mapper6 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -257,7 +257,7 @@ void nes_ffe4_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_ffe8_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ffe8_device::write_l)
{
LOG_MMC(("mapper17 write_l, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/legacy.h b/src/devices/bus/nes/legacy.h
index 92722c0591c..91b44e108c0 100644
--- a/src/devices/bus/nes/legacy.h
+++ b/src/devices/bus/nes/legacy.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_ffe3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -34,10 +34,10 @@ public:
// construction/destruction
nes_ffe4_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
- virtual uint8_t chr_r(offs_t offset) override;
- virtual void chr_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
+ virtual DECLARE_READ8_MEMBER(chr_r) override;
+ virtual DECLARE_WRITE8_MEMBER(chr_w) override;
virtual void pcb_reset() override;
@@ -71,8 +71,8 @@ public:
nes_ffe8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override {}
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override {}
virtual void pcb_reset() override;
};
diff --git a/src/devices/bus/nes/mmc1.cpp b/src/devices/bus/nes/mmc1.cpp
index 9a27c601b4c..d324c153782 100644
--- a/src/devices/bus/nes/mmc1.cpp
+++ b/src/devices/bus/nes/mmc1.cpp
@@ -219,7 +219,7 @@ void nes_sxrom_device::update_regs(int reg)
}
}
-void nes_sxrom_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER( nes_sxrom_device::write_h )
{
LOG_MMC(("sxrom write_h, offset: %04x, data: %02x\n", offset, data));
@@ -265,7 +265,7 @@ void nes_sxrom_device::write_h(offs_t offset, uint8_t data)
}
}
-void nes_sxrom_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sxrom_device::write_m)
{
uint8_t bank = (m_reg[1] >> 2) & 3;
LOG_MMC(("sxrom write_m, offset: %04x, data: %02x\n", offset, data));
@@ -279,7 +279,7 @@ void nes_sxrom_device::write_m(offs_t offset, uint8_t data)
}
}
-uint8_t nes_sxrom_device::read_m(offs_t offset)
+READ8_MEMBER(nes_sxrom_device::read_m)
{
uint8_t bank = (m_reg[1] >> 2) & 3;
LOG_MMC(("sxrom read_m, offset: %04x\n", offset));
@@ -292,11 +292,11 @@ uint8_t nes_sxrom_device::read_m(offs_t offset)
return m_prgram[((bank * 0x2000) + offset) & (m_prgram.size() - 1)];
}
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
// SOROM has two RAM banks, the first is not battery backed up, the second is.
-void nes_sorom_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sorom_device::write_m)
{
uint8_t type = BIT(m_reg[0], 4) ? BIT(m_reg[1], 4) : BIT(m_reg[1], 3);
LOG_MMC(("sorom write_m, offset: %04x, data: %02x\n", offset, data));
@@ -310,7 +310,7 @@ void nes_sorom_device::write_m(offs_t offset, uint8_t data)
}
}
-uint8_t nes_sorom_device::read_m(offs_t offset)
+READ8_MEMBER(nes_sorom_device::read_m)
{
uint8_t type = BIT(m_reg[0], 4) ? BIT(m_reg[1], 4) : BIT(m_reg[1], 3);
LOG_MMC(("sorom read_m, offset: %04x\n", offset));
@@ -323,11 +323,11 @@ uint8_t nes_sorom_device::read_m(offs_t offset)
return m_prgram[offset & (m_prgram.size() - 1)];
}
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
// MMC1A boards have no wram enable/disable bit
-void nes_sxrom_a_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sxrom_a_device::write_m)
{
uint8_t bank = (m_reg[1] >> 2) & 3;
LOG_MMC(("sxrom_a write_m, offset: %04x, data: %02x\n", offset, data));
@@ -338,7 +338,7 @@ void nes_sxrom_a_device::write_m(offs_t offset, uint8_t data)
m_prgram[((bank * 0x2000) + offset) & (m_prgram.size() - 1)] = data;
}
-uint8_t nes_sxrom_a_device::read_m(offs_t offset)
+READ8_MEMBER(nes_sxrom_a_device::read_m)
{
uint8_t bank = (m_reg[1] >> 2) & 3;
LOG_MMC(("sxrom_a read_m, offset: %04x\n", offset));
@@ -348,10 +348,10 @@ uint8_t nes_sxrom_a_device::read_m(offs_t offset)
if (!m_prgram.empty())
return m_prgram[((bank * 0x2000) + offset) & (m_prgram.size() - 1)];
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
-void nes_sorom_a_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sorom_a_device::write_m)
{
uint8_t type = BIT(m_reg[0], 4) ? BIT(m_reg[1], 4) : BIT(m_reg[1], 3);
LOG_MMC(("sorom_a write_m, offset: %04x, data: %02x\n", offset, data));
@@ -362,7 +362,7 @@ void nes_sorom_a_device::write_m(offs_t offset, uint8_t data)
m_prgram[offset & (m_prgram.size() - 1)] = data;
}
-uint8_t nes_sorom_a_device::read_m(offs_t offset)
+READ8_MEMBER(nes_sorom_a_device::read_m)
{
uint8_t type = BIT(m_reg[0], 4) ? BIT(m_reg[1], 4) : BIT(m_reg[1], 3);
LOG_MMC(("sorom_a read_m, offset: %04x\n", offset));
diff --git a/src/devices/bus/nes/mmc1.h b/src/devices/bus/nes/mmc1.h
index c8ccb835d76..dd9ecccac75 100644
--- a/src/devices/bus/nes/mmc1.h
+++ b/src/devices/bus/nes/mmc1.h
@@ -16,9 +16,9 @@ public:
// construction/destruction
nes_sxrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -46,8 +46,8 @@ public:
// construction/destruction
nes_sorom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
};
@@ -58,8 +58,8 @@ public:
// construction/destruction
nes_sxrom_a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
};
class nes_sorom_a_device : public nes_sxrom_device
@@ -68,8 +68,8 @@ public:
// construction/destruction
nes_sorom_a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
};
diff --git a/src/devices/bus/nes/mmc2.cpp b/src/devices/bus/nes/mmc2.cpp
index 8be7b04d2d7..1055ce98921 100644
--- a/src/devices/bus/nes/mmc2.cpp
+++ b/src/devices/bus/nes/mmc2.cpp
@@ -130,7 +130,7 @@ void nes_pxrom_device::ppu_latch(offs_t offset)
}
}
-void nes_pxrom_device::pxrom_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( nes_pxrom_device::pxrom_write )
{
LOG_MMC(("pxrom write_h, offset: %04x, data: %02x\n", offset, data));
switch (offset & 0x7000)
@@ -182,7 +182,7 @@ void nes_pxrom_device::pxrom_write(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_fxrom_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER( nes_fxrom_device::write_h )
{
LOG_MMC(("fxrom write_h, offset: %04x, data: %02x\n", offset, data));
switch (offset & 0x7000)
@@ -191,7 +191,7 @@ void nes_fxrom_device::write_h(offs_t offset, uint8_t data)
prg16_89ab(data);
break;
default:
- pxrom_write(offset, data);
+ pxrom_write(space, offset, data, mem_mask);
break;
}
}
diff --git a/src/devices/bus/nes/mmc2.h b/src/devices/bus/nes/mmc2.h
index 9f4d100d2f6..cfd81aa87d3 100644
--- a/src/devices/bus/nes/mmc2.h
+++ b/src/devices/bus/nes/mmc2.h
@@ -16,8 +16,8 @@ public:
// construction/destruction
nes_pxrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void pxrom_write(offs_t offset, uint8_t data);
- virtual void write_h(offs_t offset, uint8_t data) override { pxrom_write(offset, data); }
+ virtual DECLARE_WRITE8_MEMBER(pxrom_write);
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { pxrom_write(space, offset, data, mem_mask); }
virtual void ppu_latch(offs_t offset) override;
virtual void pcb_reset() override;
@@ -42,7 +42,7 @@ public:
nes_fxrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
};
diff --git a/src/devices/bus/nes/mmc3.cpp b/src/devices/bus/nes/mmc3.cpp
index d6f7f37dc4a..f8497dbd42d 100644
--- a/src/devices/bus/nes/mmc3.cpp
+++ b/src/devices/bus/nes/mmc3.cpp
@@ -244,7 +244,7 @@ void nes_txrom_device::set_chr( uint8_t chr, int chr_base, int chr_mask )
chr_cb(chr_page ^ 7, chr_base | (m_mmc_vrom_bank[5] & chr_mask), chr);
}
-void nes_txrom_device::txrom_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_txrom_device::txrom_write)
{
uint8_t mmc_helper, cmd;
@@ -313,7 +313,7 @@ void nes_txrom_device::txrom_write(offs_t offset, uint8_t data)
}
}
-void nes_txrom_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_txrom_device::write_m)
{
LOG_MMC(("txrom write_m, offset: %04x, data: %02x\n", offset, data));
@@ -326,7 +326,7 @@ void nes_txrom_device::write_m(offs_t offset, uint8_t data)
}
}
-uint8_t nes_txrom_device::read_m(offs_t offset)
+READ8_MEMBER(nes_txrom_device::read_m)
{
LOG_MMC(("txrom read_m, offset: %04x\n", offset));
@@ -338,7 +338,7 @@ uint8_t nes_txrom_device::read_m(offs_t offset)
return m_prgram[offset & (m_prgram.size() - 1)];
}
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
@@ -350,7 +350,7 @@ uint8_t nes_txrom_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_hkrom_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_hkrom_device::write_m)
{
uint8_t write_hi, write_lo;
LOG_MMC(("hkrom write_m, offset: %04x, data: %02x\n", offset, data));
@@ -369,15 +369,15 @@ void nes_hkrom_device::write_m(offs_t offset, uint8_t data)
m_mmc6_ram[offset & 0x3ff] = data;
}
-uint8_t nes_hkrom_device::read_m(offs_t offset)
+READ8_MEMBER(nes_hkrom_device::read_m)
{
LOG_MMC(("hkrom read_m, offset: %04x\n", offset));
if (offset < 0x1000)
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
if (!(m_mmc6_reg & 0xa0))
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
if (BIT(offset, 9) && BIT(m_mmc6_reg, 7)) // access to upper half of 1k when upper read is enabled
return m_mmc6_ram[offset & 0x3ff];
@@ -389,7 +389,7 @@ uint8_t nes_hkrom_device::read_m(offs_t offset)
return 0x00;
}
-void nes_hkrom_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_hkrom_device::write_h)
{
uint8_t mmc6_helper;
LOG_MMC(("hkrom write_h, offset: %04x, data: %02x\n", offset, data));
@@ -423,7 +423,7 @@ void nes_hkrom_device::write_h(offs_t offset, uint8_t data)
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
@@ -465,7 +465,7 @@ void nes_txsrom_device::chr_cb( int start, int bank, int source )
chr1_x(start, bank, source);
}
-void nes_txsrom_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_txsrom_device::write_h)
{
LOG_MMC(("txsrom write_h, offset: %04x, data: %02x\n", offset, data));
@@ -475,7 +475,7 @@ void nes_txsrom_device::write_h(offs_t offset, uint8_t data)
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
@@ -524,7 +524,7 @@ void nes_tqrom_device::set_chr( uint8_t chr, int chr_base, int chr_mask )
-------------------------------------------------*/
-void nes_qj_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_qj_device::write_m)
{
LOG_MMC(("qj write_m, offset: %04x, data: %02x\n", offset, data));
@@ -546,7 +546,7 @@ void nes_qj_device::write_m(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_zz_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_zz_device::write_m)
{
uint8_t mmc_helper = data & 0x07;
LOG_MMC(("zz write_m, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/mmc3.h b/src/devices/bus/nes/mmc3.h
index 5ef9e8dbdaa..d16a0000268 100644
--- a/src/devices/bus/nes/mmc3.h
+++ b/src/devices/bus/nes/mmc3.h
@@ -16,10 +16,10 @@ public:
// construction/destruction
nes_txrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void txrom_write(offs_t offset, uint8_t data);
- virtual void write_h(offs_t offset, uint8_t data) override { txrom_write(offset, data); }
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(txrom_write);
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { txrom_write(space, offset, data, mem_mask); }
virtual void prg_cb(int start, int bank);
virtual void chr_cb(int start, int bank, int source);
@@ -62,9 +62,9 @@ public:
// construction/destruction
nes_hkrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -89,7 +89,7 @@ public:
nes_txsrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void chr_cb(int start, int bank, int source) override;
protected:
@@ -119,7 +119,7 @@ public:
nes_qj_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
};
@@ -133,7 +133,7 @@ public:
nes_zz_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
};
diff --git a/src/devices/bus/nes/mmc3_clones.cpp b/src/devices/bus/nes/mmc3_clones.cpp
index 9be591c7d9f..5c578c0fcbd 100644
--- a/src/devices/bus/nes/mmc3_clones.cpp
+++ b/src/devices/bus/nes/mmc3_clones.cpp
@@ -637,11 +637,11 @@ void nes_pjoy84_device::pcb_reset()
-------------------------------------------------*/
-void nes_nitra_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_nitra_device::write_h)
{
LOG_MMC(("nitra write_h, offset: %04x, data: %02x\n", offset, data));
- txrom_write((offset & 0x6000) | ((offset & 0x400) >> 10), offset & 0xff);
+ txrom_write(space, (offset & 0x6000) | ((offset & 0x400) >> 10), offset & 0xff, mem_mask);
}
/*-------------------------------------------------
@@ -656,12 +656,12 @@ void nes_nitra_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_ks7057_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ks7057_device::write_h)
{
LOG_MMC(("ks7057 write_h, offset: %04x, data: %02x\n", offset, data));
offset = (BIT(offset, 0) << 1) | BIT(offset, 1) | (offset & ~0x03);
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
}
/*-------------------------------------------------
@@ -679,11 +679,11 @@ void nes_ks7057_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_sbros11_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sbros11_device::write_h)
{
LOG_MMC(("smb11 write_h, offset: %04x, data: %02x\n", offset, data));
- txrom_write((offset & 0x6000) | ((offset & 0x04) >> 2), data);
+ txrom_write(space, (offset & 0x6000) | ((offset & 0x04) >> 2), data, mem_mask);
}
/*-------------------------------------------------
@@ -711,14 +711,14 @@ void nes_malisb_device::chr_cb(int start, int bank, int source)
chr1_x(start, bank, source);
}
-void nes_malisb_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_malisb_device::write_h)
{
LOG_MMC(("malisb write_h, offset: %04x, data: %02x\n", offset, data));
if (offset > 0x4000)
- txrom_write((offset & 0xfffe) | ((offset & 0x04) >> 2) | ((offset & 0x08) >> 3), data);
+ txrom_write(space, (offset & 0xfffe) | ((offset & 0x04) >> 2) | ((offset & 0x08) >> 3), data, mem_mask);
else
- txrom_write((offset & 0xfffe) | ((offset & 0x08) >> 3), data);
+ txrom_write(space, (offset & 0xfffe) | ((offset & 0x08) >> 3), data, mem_mask);
}
/*-------------------------------------------------
@@ -736,7 +736,7 @@ void nes_malisb_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_family4646_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_family4646_device::write_m)
{
LOG_MMC(("family4646 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -763,7 +763,7 @@ void nes_family4646_device::write_m(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_pikay2k_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_pikay2k_device::write_h)
{
LOG_MMC(("pikay2k write_h, offset: %04x, data: %02x\n", offset, data));
@@ -776,20 +776,20 @@ void nes_pikay2k_device::write_h(offs_t offset, uint8_t data)
case 0x2000:
m_reg[0] = 0;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
// strange WRAM usage: it is protected at start, and gets unprotected after the first write to 0xa000
-void nes_pikay2k_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_pikay2k_device::write_m)
{
LOG_MMC(("pikay2k write_m, offset: %04x, data: %02x\n", offset, data));
m_prgram[offset & 0x1fff] = data;
}
-uint8_t nes_pikay2k_device::read_m(offs_t offset)
+READ8_MEMBER(nes_pikay2k_device::read_m)
{
LOG_MMC(("pikay2k read_m, offset: %04x\n", offset));
@@ -820,7 +820,7 @@ void nes_8237_device::chr_cb(int start, int bank, int source)
chr1_x(start, bank, source);
}
-void nes_8237_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_8237_device::write_l)
{
LOG_MMC(("unl_8237 write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -854,7 +854,7 @@ void nes_8237_device::write_l(offs_t offset, uint8_t data)
}
}
-void nes_8237_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_8237_device::write_h)
{
static const uint8_t conv_table[8] = {0, 2, 6, 1, 7, 3, 4, 5};
LOG_MMC(("unl_8237 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -870,7 +870,7 @@ void nes_8237_device::write_h(offs_t offset, uint8_t data)
case 0x3000:
m_cd_enable = 1;
data = (data & 0xc0) | conv_table[data & 0x07];
- txrom_write(0x0000, data);
+ txrom_write(space, 0x0000, data, mem_mask);
break;
case 0x4000:
@@ -878,7 +878,7 @@ void nes_8237_device::write_h(offs_t offset, uint8_t data)
if (m_cd_enable)
{
m_cd_enable = 0;
- txrom_write(0x0001, data);
+ txrom_write(space, 0x0001, data, mem_mask);
}
break;
@@ -886,9 +886,9 @@ void nes_8237_device::write_h(offs_t offset, uint8_t data)
break;
case 0x7000:
- txrom_write(0x6001, data);
- txrom_write(0x4000, data);
- txrom_write(0x4001, data);
+ txrom_write(space, 0x6001, data, mem_mask);
+ txrom_write(space, 0x4000, data, mem_mask);
+ txrom_write(space, 0x4001, data, mem_mask);
break;
}
}
@@ -907,7 +907,7 @@ void nes_8237_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_sglionk_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sglionk_device::write_m)
{
LOG_MMC(("sglionk write_m, offset: %04x, data: %02x\n", offset, data));
@@ -923,7 +923,7 @@ void nes_sglionk_device::write_m(offs_t offset, uint8_t data)
}
-void nes_sglionk_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sglionk_device::write_h)
{
static const uint8_t conv_table[8] = {0, 3, 1, 5, 6, 7, 2, 4};
LOG_MMC(("sglionk write_h, offset: %04x, data: %02x\n", offset, data));
@@ -938,13 +938,13 @@ void nes_sglionk_device::write_h(offs_t offset, uint8_t data)
case 0x2000:
m_reg_enabled = 1;
data = (data & 0xc0) | conv_table[data & 0x07];
- txrom_write(0x0000, data);
+ txrom_write(space, 0x0000, data, mem_mask);
break;
case 0x4000:
if (m_reg_enabled && (m_reg & 0x80) == 0)
{
m_reg_enabled = 0;
- txrom_write(0x0001, data);
+ txrom_write(space, 0x0001, data, mem_mask);
}
break;
}
@@ -954,12 +954,12 @@ void nes_sglionk_device::write_h(offs_t offset, uint8_t data)
switch (offset & 0x03)
{
case 0x02:
- txrom_write(0x6000, data);
+ txrom_write(space, 0x6000, data, mem_mask);
break;
case 0x03:
- txrom_write(0x6001, data);
- txrom_write(0x4000, data);
- txrom_write(0x4001, data);
+ txrom_write(space, 0x6001, data, mem_mask);
+ txrom_write(space, 0x4000, data, mem_mask);
+ txrom_write(space, 0x4001, data, mem_mask);
break;
}
}
@@ -1022,7 +1022,7 @@ void nes_sgboog_device::set_prg(int prg_base, int prg_mask)
}
}
-void nes_sgboog_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sgboog_device::write_l)
{
LOG_MMC(("sgboog write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -1046,7 +1046,7 @@ void nes_sgboog_device::write_l(offs_t offset, uint8_t data)
}
}
-void nes_sgboog_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sgboog_device::write_m)
{
LOG_MMC(("sgboog write_m, offset: %04x, data: %02x\n", offset, data));
@@ -1069,7 +1069,7 @@ void nes_sgboog_device::write_m(offs_t offset, uint8_t data)
}
}
-void nes_sgboog_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sgboog_device::write_h)
{
static const uint8_t conv_table[8] = {0,2,5,3,6,1,7,4};
LOG_MMC(("sgboog write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1085,14 +1085,14 @@ void nes_sgboog_device::write_h(offs_t offset, uint8_t data)
if (m_reg[2] && ((m_reg[0] & 0x80) == 0 || (m_latch & 0x07) < 6)) // if we use the prg16 banks and cmd=6,7 DON'T enter!
{
m_reg[2] = 0;
- txrom_write(0x0001, data);
+ txrom_write(space, 0x0001, data, mem_mask);
}
break;
case 0x2000:
data = (data & 0xc0) | conv_table[data & 0x07];
m_reg[2] = 1;
- txrom_write(0x0000, data);
+ txrom_write(space, 0x0000, data, mem_mask);
break;
case 0x4000:
@@ -1100,21 +1100,21 @@ void nes_sgboog_device::write_h(offs_t offset, uint8_t data)
break;
case 0x4001:
- txrom_write(0x6001, data);
+ txrom_write(space, 0x6001, data, mem_mask);
break;
case 0x6001:
- txrom_write(0x4000, data);
- txrom_write(0x4001, data);
+ txrom_write(space, 0x4000, data, mem_mask);
+ txrom_write(space, 0x4001, data, mem_mask);
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
else
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
}
/*-------------------------------------------------
@@ -1140,7 +1140,7 @@ void nes_kasing_device::prg_cb(int start, int bank)
prg8_x(start, bank);
}
-void nes_kasing_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_kasing_device::write_m)
{
LOG_MMC(("kasing write_m, offset: %04x, data: %02x\n", offset, data));
@@ -1172,7 +1172,7 @@ void nes_kasing_device::write_m(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_kay_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_kay_device::write_l)
{
LOG_MMC(("kay write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -1195,7 +1195,7 @@ void nes_kay_device::write_l(offs_t offset, uint8_t data)
}
}
-uint8_t nes_kay_device::read_l(offs_t offset)
+READ8_MEMBER(nes_kay_device::read_l)
{
LOG_MMC(("kay read_l, offset: %04x\n", offset));
offset += 0x100;
@@ -1269,14 +1269,14 @@ void nes_kay_device::chr_cb(int start, int bank, int source)
chr1_x(start, bank, source);
}
-void nes_kay_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_kay_device::write_h)
{
LOG_MMC(("kay write_h, offset: %04x, data: %02x\n", offset, data));
switch (offset & 0x6003)
{
case 0x0000:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
set_prg(m_prg_base, m_prg_mask);
break;
@@ -1285,19 +1285,19 @@ void nes_kay_device::write_h(offs_t offset, uint8_t data)
| (BIT(data, 3) << 2) | (BIT(data, 4) << 1) | BIT(data, 5);
if (!m_reg[7])
update_regs();
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
set_prg(m_prg_base, m_prg_mask);
break;
case 0x0003:
m_reg[5] = data;
update_regs();
- txrom_write(0x0000, data);
+ txrom_write(space, 0x0000, data, mem_mask);
set_prg(m_prg_base, m_prg_mask);
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
@@ -1314,7 +1314,7 @@ void nes_h2288_device::prg_cb(int start, int bank)
prg8_x(start, bank);
}
-void nes_h2288_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_h2288_device::write_l)
{
LOG_MMC(("h2288 write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -1334,7 +1334,7 @@ void nes_h2288_device::write_l(offs_t offset, uint8_t data)
}
}
-uint8_t nes_h2288_device::read_l(offs_t offset)
+READ8_MEMBER(nes_h2288_device::read_l)
{
LOG_MMC(("h2288 read_l, offset: %04x\n", offset));
offset += 0x100;
@@ -1351,7 +1351,7 @@ uint8_t nes_h2288_device::read_l(offs_t offset)
return 0;
}
-void nes_h2288_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_h2288_device::write_h)
{
static const uint8_t conv_table[8] = {0, 3, 1, 5, 6, 7, 2, 4};
LOG_MMC(("h2288 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1359,11 +1359,11 @@ void nes_h2288_device::write_h(offs_t offset, uint8_t data)
switch (offset & 0x6001)
{
case 0x0000:
- txrom_write(0x0000, (data & 0xc0) | conv_table[data & 0x07]);
+ txrom_write(space, 0x0000, (data & 0xc0) | conv_table[data & 0x07], mem_mask);
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
@@ -1378,7 +1378,7 @@ void nes_h2288_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_6035052_device::write_ex(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_6035052_device::write_ex)
{
LOG_MMC(("6035052 write_ex, offset: %04x, data: %02x\n", offset, data));
m_prot = data & 0x03;
@@ -1386,7 +1386,7 @@ void nes_6035052_device::write_ex(offs_t offset, uint8_t data)
m_prot = 2;
}
-uint8_t nes_6035052_device::read_ex(offs_t offset)
+READ8_MEMBER(nes_6035052_device::read_ex)
{
LOG_MMC(("6035052 read_ex, offset: %04x\n", offset));
return m_prot;
@@ -1406,7 +1406,7 @@ uint8_t nes_6035052_device::read_ex(offs_t offset)
-------------------------------------------------*/
-void nes_txc_tw_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_txc_tw_device::write_l)
{
LOG_MMC(("txc_tw write_l, offset: %04x, data: %02x\n", offset, data));
@@ -1436,22 +1436,22 @@ inline uint8_t kof97_unscramble( uint8_t data )
return ((data >> 1) & 0x01) | ((data >> 4) & 0x02) | ((data << 2) & 0x04) | ((data >> 0) & 0xd8) | ((data << 3) & 0x20);
}
-void nes_kof97_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_kof97_device::write_h)
{
LOG_MMC(("kof97 write_h, offset: %04x, data: %02x\n", offset, data));
/* Addresses 0x9000, 0xa000, 0xd000 & 0xf000 behaves differently than MMC3 */
if (offset == 0x1000)
- txrom_write(0x0001, kof97_unscramble(data));
+ txrom_write(space, 0x0001, kof97_unscramble(data), mem_mask);
else if (offset == 0x2000)
- txrom_write(0x0000, kof97_unscramble(data));
+ txrom_write(space, 0x0000, kof97_unscramble(data), mem_mask);
else if (offset == 0x5000)
- txrom_write(0x4001, kof97_unscramble(data));
+ txrom_write(space, 0x4001, kof97_unscramble(data), mem_mask);
else if (offset == 0x7000)
- txrom_write(0x6001, kof97_unscramble(data));
+ txrom_write(space, 0x6001, kof97_unscramble(data), mem_mask);
/* Other addresses behaves like MMC3, up to unscrambling data */
else
- txrom_write(offset, kof97_unscramble(data));
+ txrom_write(space, offset, kof97_unscramble(data), mem_mask);
}
/*-------------------------------------------------
@@ -1485,7 +1485,7 @@ void nes_kof96_device::chr_cb(int start, int bank, int source)
chr1_x(start, bank, source);
}
-void nes_kof96_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_kof96_device::write_l)
{
uint8_t new_bank;
LOG_MMC(("kof96 write_l, offset: %04x, data: %02x\n", offset, data));
@@ -1532,11 +1532,11 @@ void nes_kof96_device::write_l(offs_t offset, uint8_t data)
if (!m_reg[3] && offset > 0x1000)
{
m_reg[3] = 1;
- poke(0x4017, 0x40); // FIXME
+ space.write_byte(0x4017, 0x40);
}
}
-uint8_t nes_kof96_device::read_l(offs_t offset)
+READ8_MEMBER(nes_kof96_device::read_l)
{
LOG_MMC(("kof96 read_l, offset: %04x\n", offset));
offset += 0x100;
@@ -1547,7 +1547,7 @@ uint8_t nes_kof96_device::read_l(offs_t offset)
return 0;
}
-void nes_kof96_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_kof96_device::write_h)
{
LOG_MMC(("kof96 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1555,12 +1555,12 @@ void nes_kof96_device::write_h(offs_t offset, uint8_t data)
{
case 0x0000:
m_reg[2] = 1;
- txrom_write(0x0000, data);
+ txrom_write(space, 0x0000, data, mem_mask);
break;
case 0x0001:
if (m_reg[2])
- txrom_write(0x0001, data);
+ txrom_write(space, 0x0001, data, mem_mask);
break;
case 0x0002:
@@ -1576,7 +1576,7 @@ void nes_kof96_device::write_h(offs_t offset, uint8_t data)
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
@@ -1600,7 +1600,7 @@ void nes_sf3_device::set_chr(uint8_t chr_source, int chr_base, int chr_mask)
chr2_6(chr_base | (m_mmc_vrom_bank[2] & chr_mask), chr_source);
}
-void nes_sf3_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sf3_device::write_h)
{
uint8_t cmd;
LOG_MMC(("sf3 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1624,7 +1624,7 @@ void nes_sf3_device::write_h(offs_t offset, uint8_t data)
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
@@ -1643,7 +1643,7 @@ void nes_sf3_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_gouder_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_gouder_device::write_l)
{
static const uint8_t conv_table[256] =
{
@@ -1675,7 +1675,7 @@ void nes_gouder_device::write_l(offs_t offset, uint8_t data)
prg32(((data >> 3) & 0x02) | (data & 0x01));
}
-uint8_t nes_gouder_device::read_l(offs_t offset)
+READ8_MEMBER(nes_gouder_device::read_l)
{
LOG_MMC(("gouder read_l, offset: %04x\n", offset));
@@ -1722,7 +1722,7 @@ void nes_sa9602b_device::prg_cb(int start, int bank)
}
-void nes_sa9602b_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER( nes_sa9602b_device::write_h )
{
LOG_MMC(("sa9602b write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1738,7 +1738,7 @@ void nes_sa9602b_device::write_h(offs_t offset, uint8_t data)
break;
}
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
}
/*-------------------------------------------------
@@ -1762,7 +1762,7 @@ void nes_sachen_shero_device::chr_cb( int start, int bank, int source )
}
-void nes_sachen_shero_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER( nes_sachen_shero_device::write_l )
{
LOG_MMC(("shero write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x4100;
@@ -1777,7 +1777,7 @@ void nes_sachen_shero_device::write_l(offs_t offset, uint8_t data)
}
}
-uint8_t nes_sachen_shero_device::read_l(offs_t offset)
+READ8_MEMBER( nes_sachen_shero_device::read_l )
{
LOG_MMC(("shero read_l, offset: %04x\n", offset));
offset += 0x4100;
@@ -1786,7 +1786,7 @@ uint8_t nes_sachen_shero_device::read_l(offs_t offset)
{
// DSW read!
}
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
@@ -1886,7 +1886,7 @@ void nes_fk23c_device::fk23c_set_chr()
}
}
-void nes_fk23c_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_fk23c_device::write_l)
{
LOG_MMC(("fk23c write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -1903,7 +1903,7 @@ void nes_fk23c_device::write_l(offs_t offset, uint8_t data)
}
}
-void nes_fk23c_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_fk23c_device::write_h)
{
LOG_MMC(("fk23c write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1929,7 +1929,7 @@ void nes_fk23c_device::write_h(offs_t offset, uint8_t data)
fk23c_set_chr();
}
else
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
case 0x2000:
@@ -1937,7 +1937,7 @@ void nes_fk23c_device::write_h(offs_t offset, uint8_t data)
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
@@ -1971,7 +1971,7 @@ void nes_s24in1sc03_device::chr_cb(int start, int bank, int source)
chr1_x(start, chr_base | bank, chr);
}
-void nes_s24in1sc03_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_s24in1sc03_device::write_l)
{
LOG_MMC(("s24in1sc03 write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -2009,7 +2009,7 @@ void nes_s24in1sc03_device::write_l(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_15in1_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_15in1_device::write_m)
{
LOG_MMC(("bmc_15in1 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -2037,7 +2037,7 @@ void nes_bmc_15in1_device::write_m(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_sbig7_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_sbig7_device::write_h)
{
uint8_t page;
LOG_MMC(("bmc_sbig7 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -2058,7 +2058,7 @@ void nes_bmc_sbig7_device::write_h(offs_t offset, uint8_t data)
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
@@ -2076,7 +2076,7 @@ void nes_bmc_sbig7_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_hik8_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_hik8_device::write_m)
{
LOG_MMC(("bmc_hik8 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -2123,7 +2123,7 @@ void nes_bmc_hik8_device::write_m(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_hik4_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_hik4_device::write_m)
{
LOG_MMC(("bmc_hik4 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -2162,7 +2162,7 @@ void nes_bmc_hik4_device::write_m(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_mario7in1_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_mario7in1_device::write_m)
{
uint8_t helper1, helper2;
LOG_MMC(("bmc_mario7in1 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -2204,7 +2204,7 @@ void nes_bmc_mario7in1_device::write_m(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_gold7in1_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_gold7in1_device::write_m)
{
uint8_t helper1, helper2;
LOG_MMC(("bmc_gold7in1 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -2265,7 +2265,7 @@ void nes_bmc_gc6in1_device::chr_cb(int start, int bank, int source)
chr1_x(start, ((m_reg[1] & 0x03) << 8) | bank, source);
}
-void nes_bmc_gc6in1_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_gc6in1_device::write_l)
{
uint8_t bank;
LOG_MMC(("bmc_gc6in1 write_l, offset: %04x, data: %02x\n", offset, data));
@@ -2294,7 +2294,7 @@ void nes_bmc_gc6in1_device::write_l(offs_t offset, uint8_t data)
}
}
-void nes_bmc_gc6in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_gc6in1_device::write_h)
{
uint8_t cmd;
static const uint8_t conv_table[8] = {0, 6, 3, 7, 5, 2, 4, 1};
@@ -2303,20 +2303,20 @@ void nes_bmc_gc6in1_device::write_h(offs_t offset, uint8_t data)
if (!m_reg[2])
{
// in this case we act like MMC3, only with alt prg/chr handlers
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
}
else
{
switch (offset & 0x6001)
{
case 0x0000:
- txrom_write(0x4000, data);
+ txrom_write(space, 0x4000, data, mem_mask);
break;
case 0x0001:
data = (data & 0xc0) | conv_table[data & 0x07];
m_reg[3] = 1;
- txrom_write(0x0000, data);
+ txrom_write(space, 0x0000, data, mem_mask);
break;
case 0x2000:
@@ -2346,7 +2346,7 @@ void nes_bmc_gc6in1_device::write_h(offs_t offset, uint8_t data)
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
@@ -2377,7 +2377,7 @@ void nes_bmc_411120c_device::chr_cb(int start, int bank, int source)
chr1_x(start, bank | ((m_reg & 3) << 7), source);
}
-void nes_bmc_411120c_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_411120c_device::write_m)
{
LOG_MMC(("bmc_411120c write_m, offset: %04x, data: %02x\n", offset, data));
@@ -2422,7 +2422,7 @@ void nes_bmc_830118c_device::chr_cb(int start, int bank, int source)
chr1_x(start, (bank & 0x7f) | ((m_reg & 0x0c) << 5), source);
}
-void nes_bmc_830118c_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_830118c_device::write_m)
{
LOG_MMC(("bmc_830118c write_m, offset: %04x, data: %02x\n", offset, data));
@@ -2478,7 +2478,7 @@ inline void nes_pjoy84_device::set_base_mask()
m_chr_mask = BIT(m_reg[0], 7) ? 0x7f : 0xff;
}
-void nes_pjoy84_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_pjoy84_device::write_m)
{
LOG_MMC(("pjoy84 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -2523,7 +2523,7 @@ void nes_coolboy_device::chr_cb(int start, int bank, int source)
chr1_x(start, bank, source);
}
-void nes_coolboy_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_coolboy_device::write_m)
{
LOG_MMC(("coolboy write_m, offset: %04x, data: %02x\n", offset, data));
@@ -2593,7 +2593,7 @@ void nes_a9746_device::update_banks(uint8_t value)
}
}
-void nes_a9746_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_a9746_device::write_h)
{
LOG_MMC(("unl_a9746 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -2619,7 +2619,7 @@ void nes_a9746_device::write_h(offs_t offset, uint8_t data)
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
diff --git a/src/devices/bus/nes/mmc3_clones.h b/src/devices/bus/nes/mmc3_clones.h
index 680e86b4c9c..b6102e8fd62 100644
--- a/src/devices/bus/nes/mmc3_clones.h
+++ b/src/devices/bus/nes/mmc3_clones.h
@@ -17,7 +17,7 @@ public:
nes_nitra_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
};
@@ -30,7 +30,7 @@ public:
nes_ks7057_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
};
@@ -43,7 +43,7 @@ public:
nes_sbros11_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
};
@@ -56,7 +56,7 @@ public:
nes_malisb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
};
@@ -71,7 +71,7 @@ public:
nes_family4646_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
};
@@ -85,9 +85,9 @@ public:
// construction/destruction
nes_pikay2k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -110,8 +110,8 @@ public:
// device-level overrides
virtual void device_start() override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
@@ -131,8 +131,8 @@ public:
// construction/destruction
nes_sglionk_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -154,9 +154,9 @@ public:
// construction/destruction
nes_sgboog_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
@@ -181,7 +181,7 @@ public:
// construction/destruction
nes_kasing_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void prg_cb(int start, int bank) override;
virtual void pcb_reset() override;
@@ -203,9 +203,9 @@ public:
// construction/destruction
nes_kay_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
@@ -230,9 +230,9 @@ public:
// construction/destruction
nes_h2288_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void prg_cb(int start, int bank) override;
virtual void pcb_reset() override;
@@ -254,12 +254,12 @@ public:
// construction/destruction
nes_6035052_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_ex(offs_t offset) override;
- virtual void write_ex(offs_t offset, uint8_t data) override;
- virtual uint8_t read_l(offs_t offset) override { return read_ex(offset); }
- virtual uint8_t read_m(offs_t offset) override { return read_ex(offset); }
- virtual void write_l(offs_t offset, uint8_t data) override { write_ex(offset, data); }
- virtual void write_m(offs_t offset, uint8_t data) override { write_ex(offset, data); }
+ virtual DECLARE_READ8_MEMBER(read_ex) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ex) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override { return read_ex(space, offset, mem_mask); }
+ virtual DECLARE_READ8_MEMBER(read_m) override { return read_ex(space, offset, mem_mask); }
+ virtual DECLARE_WRITE8_MEMBER(write_l) override { write_ex(space, offset, data, mem_mask); }
+ virtual DECLARE_WRITE8_MEMBER(write_m) override { write_ex(space, offset, data, mem_mask); }
virtual void pcb_reset() override;
@@ -281,8 +281,8 @@ public:
nes_txc_tw_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_m(offs_t offset, uint8_t data) override { write_l(offset & 0xff, data); } // offset does not really count for this mapper }
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override { write_l(space, offset & 0xff, data, mem_mask); } // offset does not really count for this mapper }
virtual void prg_cb(int start, int bank) override;
};
@@ -296,7 +296,7 @@ public:
nes_kof97_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
};
@@ -308,9 +308,9 @@ public:
// construction/destruction
nes_kof96_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override; // offset does not really count for this mapper
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override; // offset does not really count for this mapper
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
@@ -334,7 +334,7 @@ public:
nes_sf3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
protected:
virtual void set_chr(uint8_t chr, int chr_base, int chr_mask) override;
@@ -349,8 +349,8 @@ public:
// construction/destruction
nes_gouder_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void prg_cb(int start, int bank) override;
virtual void pcb_reset() override;
@@ -372,7 +372,7 @@ public:
// construction/destruction
nes_sa9602b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void prg_cb(int start, int bank) override;
virtual void pcb_reset() override;
@@ -395,8 +395,8 @@ public:
// construction/destruction
nes_sachen_shero_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void chr_cb(int start, int bank, int source) override;
virtual void pcb_reset() override;
@@ -418,7 +418,7 @@ public:
// construction/destruction
nes_a9746_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset();
@@ -441,8 +441,8 @@ public:
// construction/destruction
nes_fk23c_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
@@ -481,7 +481,7 @@ public:
// construction/destruction
nes_s24in1sc03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
@@ -505,7 +505,7 @@ public:
nes_bmc_15in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
};
@@ -520,7 +520,7 @@ public:
nes_bmc_sbig7_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
};
@@ -534,7 +534,7 @@ public:
// construction/destruction
nes_bmc_hik8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -557,7 +557,7 @@ public:
nes_bmc_hik4_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
};
@@ -571,7 +571,7 @@ public:
// construction/destruction
nes_bmc_mario7in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -592,7 +592,7 @@ public:
// construction/destruction
nes_bmc_gold7in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -613,8 +613,8 @@ public:
// construction/destruction
nes_bmc_gc6in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
@@ -637,7 +637,7 @@ public:
// construction/destruction
nes_bmc_411120c_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
@@ -660,7 +660,7 @@ public:
// construction/destruction
nes_bmc_830118c_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
@@ -683,7 +683,7 @@ public:
// construction/destruction
nes_pjoy84_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
@@ -707,7 +707,7 @@ public:
nes_coolboy_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
diff --git a/src/devices/bus/nes/mmc5.cpp b/src/devices/bus/nes/mmc5.cpp
index b512f914e8b..681b9491ef2 100644
--- a/src/devices/bus/nes/mmc5.cpp
+++ b/src/devices/bus/nes/mmc5.cpp
@@ -287,7 +287,7 @@ inline bool nes_exrom_device::in_split()
return false;
}
-uint8_t nes_exrom_device::nt_r(offs_t offset)
+READ8_MEMBER(nes_exrom_device::nt_r)
{
int page = ((offset & 0xc00) >> 10);
@@ -339,7 +339,7 @@ uint8_t nes_exrom_device::nt_r(offs_t offset)
}
}
-void nes_exrom_device::nt_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_exrom_device::nt_w)
{
int page = ((offset & 0xc00) >> 10);
@@ -397,7 +397,7 @@ inline uint8_t nes_exrom_device::bg_ex1_chr_r(uint32_t offset)
return m_vrom[helper & (m_vrom_size - 1)];
}
-uint8_t nes_exrom_device::chr_r(offs_t offset)
+READ8_MEMBER(nes_exrom_device::chr_r)
{
int bank = offset >> 10;
@@ -425,7 +425,7 @@ uint8_t nes_exrom_device::chr_r(offs_t offset)
}
-uint8_t nes_exrom_device::read_l(offs_t offset)
+READ8_MEMBER(nes_exrom_device::read_l)
{
int value;
LOG_MMC(("exrom read_l, offset: %04x\n", offset));
@@ -437,7 +437,7 @@ uint8_t nes_exrom_device::read_l(offs_t offset)
if (BIT(m_exram_control, 1)) // Modes 2,3 = read
return m_exram[offset - 0x1c00];
else
- return get_open_bus(); // Modes 0,1 = open bus
+ return m_open_bus; // Modes 0,1 = open bus
}
switch (offset)
@@ -455,12 +455,12 @@ uint8_t nes_exrom_device::read_l(offs_t offset)
default:
logerror("MMC5 uncaught read, offset: %04x\n", offset + 0x4100);
- return get_open_bus();
+ return m_open_bus;
}
}
-void nes_exrom_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_exrom_device::write_l)
{
LOG_MMC(("exrom write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -618,7 +618,7 @@ void nes_exrom_device::write_l(offs_t offset, uint8_t data)
// bit3 select the chip (2 of them can be accessed, each up to 32KB)
// bit1 & bit2 select the 8KB banks inside the chip
// same mechanism is used also when "WRAM" is mapped in higher banks
-uint8_t nes_exrom_device::read_m(offs_t offset)
+READ8_MEMBER(nes_exrom_device::read_m)
{
LOG_MMC(("exrom read_m, offset: %04x\n", offset));
if (!m_battery.empty() && !m_prgram.empty()) // 2 chips present: first is BWRAM, second is WRAM
@@ -633,10 +633,10 @@ uint8_t nes_exrom_device::read_m(offs_t offset)
else if (!m_battery.empty()) // 1 chip, BWRAM
return m_battery[(offset + (m_wram_base & 0x03) * 0x2000) & (m_battery.size() - 1)];
else
- return get_open_bus();
+ return m_open_bus;
}
-void nes_exrom_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_exrom_device::write_m)
{
LOG_MMC(("exrom write_m, offset: %04x, data: %02x\n", offset, data));
if (m_wram_protect_1 != 0x02 || m_wram_protect_2 != 0x01)
@@ -649,7 +649,7 @@ void nes_exrom_device::write_m(offs_t offset, uint8_t data)
}
// some games (e.g. Bandit Kings of Ancient China) write to PRG-RAM through 0x8000-0xdfff
-uint8_t nes_exrom_device::read_h(offs_t offset)
+READ8_MEMBER(nes_exrom_device::read_h)
{
LOG_MMC(("exrom read_h, offset: %04x\n", offset));
int bank = offset / 0x2000;
@@ -665,7 +665,7 @@ uint8_t nes_exrom_device::read_h(offs_t offset)
return hi_access_rom(offset);
}
-void nes_exrom_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_exrom_device::write_h)
{
LOG_MMC(("exrom write_h, offset: %04x, data: %02x\n", offset, data));
int bank = offset / 0x2000;
diff --git a/src/devices/bus/nes/mmc5.h b/src/devices/bus/nes/mmc5.h
index 093a64471d0..c0c07cb07a9 100644
--- a/src/devices/bus/nes/mmc5.h
+++ b/src/devices/bus/nes/mmc5.h
@@ -20,16 +20,16 @@ public:
nes_exrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
~nes_exrom_device();
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_m(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
-
- virtual uint8_t chr_r(offs_t offset) override;
- virtual uint8_t nt_r(offs_t offset) override;
- virtual void nt_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
+
+ virtual DECLARE_READ8_MEMBER(chr_r) override;
+ virtual DECLARE_READ8_MEMBER(nt_r) override;
+ virtual DECLARE_WRITE8_MEMBER(nt_w) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/multigame.cpp b/src/devices/bus/nes/multigame.cpp
index c117520afe5..6971e68ac61 100644
--- a/src/devices/bus/nes/multigame.cpp
+++ b/src/devices/bus/nes/multigame.cpp
@@ -1016,7 +1016,7 @@ void nes_bmc_42in1reset_device::pcb_reset()
-------------------------------------------------*/
-void nes_action52_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_action52_device::write_h)
{
uint8_t pmode = offset & 0x20;
int pbank = (offset & 0x1fc0) >> 6;
@@ -1048,7 +1048,7 @@ void nes_action52_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_caltron_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_caltron_device::write_m)
{
LOG_MMC(("caltron write_m, offset: %04x, data: %02x\n", offset, data));
@@ -1057,7 +1057,7 @@ void nes_caltron_device::write_m(offs_t offset, uint8_t data)
prg32(offset & 0x07);
}
-void nes_caltron_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_caltron_device::write_h)
{
LOG_MMC(("caltron write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1077,7 +1077,7 @@ void nes_caltron_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_rumblestat_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_rumblestat_device::write_m)
{
LOG_MMC(("rumblestation write_m, offset: %04x, data: %02x\n", offset, data));
@@ -1087,7 +1087,7 @@ void nes_rumblestat_device::write_m(offs_t offset, uint8_t data)
chr8(m_chr, CHRROM);
}
-void nes_rumblestat_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_rumblestat_device::write_h)
{
LOG_MMC(("rumblestation write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1129,14 +1129,14 @@ void nes_svision16_device::update_prg()
}
-uint8_t nes_svision16_device::read_m(offs_t offset)
+READ8_MEMBER(nes_svision16_device::read_m)
{
int bank = (((m_latch1 & 0x0f) << 4) | 0x0f) + 4 ; // +4 due to the eeprom
LOG_MMC(("svision16 read_m, offset: %04x\n", offset));
return m_prg[((bank * 0x2000) + (offset & 0x1fff)) & m_prg_mask];
}
-void nes_svision16_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_svision16_device::write_m)
{
LOG_MMC(("svision16 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -1145,7 +1145,7 @@ void nes_svision16_device::write_m(offs_t offset, uint8_t data)
set_nt_mirroring(BIT(data, 5) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
}
-void nes_svision16_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_svision16_device::write_h)
{
LOG_MMC(("svision16 write_h, offset: %04x, data: %02x\n", offset, data));
m_latch2 = data;
@@ -1175,7 +1175,7 @@ void nes_n625092_device::set_prg(uint8_t reg1, uint8_t reg2)
prg16_cdef(helper2 | ((reg1 & 0x70) >> 1));
}
-void nes_n625092_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_n625092_device::write_h)
{
LOG_MMC(("n625092 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1213,7 +1213,7 @@ void nes_n625092_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_a65as_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_a65as_device::write_h)
{
uint8_t helper = (data & 0x30) >> 1;
LOG_MMC(("a65as write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1242,7 +1242,7 @@ void nes_a65as_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_t262_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_t262_device::write_h)
{
uint8_t mmc_helper;
LOG_MMC(("t262 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1281,7 +1281,7 @@ void nes_t262_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
// Are this correct or should they work the same?
-void nes_novel1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_novel1_device::write_h)
{
LOG_MMC(("novel1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1289,7 +1289,7 @@ void nes_novel1_device::write_h(offs_t offset, uint8_t data)
chr8(offset & 0x07, CHRROM);
}
-void nes_novel2_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_novel2_device::write_h)
{
LOG_MMC(("novel2 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1311,7 +1311,7 @@ void nes_novel2_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_studyngame_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_studyngame_device::write_h)
{
LOG_MMC(("studyngame write_h, offset: %04x, data: %02x\n", offset, data));
prg32(data);
@@ -1330,7 +1330,7 @@ void nes_studyngame_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_sgun20in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sgun20in1_device::write_h)
{
LOG_MMC(("supergun20in1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1345,7 +1345,7 @@ void nes_sgun20in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_vt5201_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_vt5201_device::write_h)
{
LOG_MMC(("vt5201 wirte_h, offset: %04x, data: %02x\n", offset, data));
@@ -1364,7 +1364,7 @@ void nes_vt5201_device::write_h(offs_t offset, uint8_t data)
chr8(offset, CHRROM);
}
-uint8_t nes_vt5201_device::read_h(offs_t offset)
+READ8_MEMBER(nes_vt5201_device::read_h)
{
LOG_MMC(("bmc_vt5201 read_h, offset: %04x\n", offset));
// m_dipsetting = ioport("CARTDIPS")->read();
@@ -1383,7 +1383,7 @@ uint8_t nes_vt5201_device::read_h(offs_t offset)
-------------------------------------------------*/
-void nes_810544c_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_810544c_device::write_h)
{
uint8_t bank = (offset >> 7);
LOG_MMC(("810544 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1407,7 +1407,7 @@ void nes_810544c_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_ntd03_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ntd03_device::write_h)
{
uint8_t pbank = (offset >> 10) & 0x1e;
uint8_t cbank = ((offset & 0x300) >> 5) | (offset & 0x07);
@@ -1434,7 +1434,7 @@ void nes_ntd03_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_gb63_device::chr_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_gb63_device::chr_w)
{
int bank = offset >> 10;
@@ -1459,7 +1459,7 @@ void nes_bmc_gb63_device::update_banks()
// m_vram_disable = BIT(m_reg[1], 1) ? 0 : 1;
}
-void nes_bmc_gb63_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_gb63_device::write_h)
{
LOG_MMC(("bmc_gb63 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1468,13 +1468,13 @@ void nes_bmc_gb63_device::write_h(offs_t offset, uint8_t data)
update_banks();
}
-uint8_t nes_bmc_gb63_device::read_h(offs_t offset)
+READ8_MEMBER(nes_bmc_gb63_device::read_h)
{
LOG_MMC(("bmc_gb63 read_h, offset: %04x\n", offset));
// m_dipsetting = ioport("CARTDIPS")->read();
if (m_latch == 1)
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
else
return hi_access_rom(offset);
}
@@ -1493,7 +1493,7 @@ uint8_t nes_bmc_gb63_device::read_h(offs_t offset)
-------------------------------------------------*/
-void nes_bmc_gka_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_gka_device::write_h)
{
LOG_MMC(("bmc_gka write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1529,7 +1529,7 @@ void nes_bmc_gka_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_gkb_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_gkb_device::write_h)
{
uint8_t bank = (offset & 0x40) ? 0 : 1;
LOG_MMC(("bmc_gkb write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1551,7 +1551,7 @@ void nes_bmc_gkb_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_ws_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_ws_device::write_m)
{
uint8_t mmc_helper;
LOG_MMC(("bmc_ws write_m, offset: %04x, data: %02x\n", offset, data));
@@ -1588,7 +1588,7 @@ void nes_bmc_ws_device::write_m(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_11160_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_11160_device::write_h)
{
LOG_MMC(("bmc_11160 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1607,7 +1607,7 @@ void nes_bmc_11160_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_g146_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_g146_device::write_h)
{
LOG_MMC(("bmc_g146 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1640,7 +1640,7 @@ void nes_bmc_g146_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_8157_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_8157_device::write_h)
{
LOG_MMC(("bmc_8157 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1653,7 +1653,7 @@ void nes_bmc_8157_device::write_h(offs_t offset, uint8_t data)
set_nt_mirroring(!BIT(offset, 1) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
}
-uint8_t nes_bmc_8157_device::read_h(offs_t offset)
+READ8_MEMBER(nes_bmc_8157_device::read_h)
{
LOG_MMC(("bmc_8157 read_h, offset: %04x\n", offset));
// m_dipsetting = ioport("CARTDIPS")->read();
@@ -1678,7 +1678,7 @@ uint8_t nes_bmc_8157_device::read_h(offs_t offset)
-------------------------------------------------*/
-void nes_bmc_hik300_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_hik300_device::write_h)
{
LOG_MMC(("bmc_hik300 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1707,7 +1707,7 @@ void nes_bmc_hik300_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_s700_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_s700_device::write_h)
{
LOG_MMC(("bmc_s700 write_h, offset :%04x, data: %02x\n", offset, data));
@@ -1754,7 +1754,7 @@ void nes_bmc_ball11_device::set_banks()
}
}
-void nes_bmc_ball11_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_ball11_device::write_m)
{
LOG_MMC(("bmc_ball11 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -1762,7 +1762,7 @@ void nes_bmc_ball11_device::write_m(offs_t offset, uint8_t data)
set_banks();
}
-void nes_bmc_ball11_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_ball11_device::write_h)
{
LOG_MMC(("bmc_ball11 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1793,7 +1793,7 @@ void nes_bmc_ball11_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_22games_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_22games_device::write_h)
{
LOG_MMC(("bmc_22games write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1846,7 +1846,7 @@ void nes_bmc_64y2k_device::set_prg()
prg16_cdef(helper2);
}
-void nes_bmc_64y2k_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_64y2k_device::write_l)
{
LOG_MMC(("bmc64y2k write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -1866,7 +1866,7 @@ void nes_bmc_64y2k_device::write_l(offs_t offset, uint8_t data)
set_nt_mirroring(BIT(data, 5) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
}
-void nes_bmc_64y2k_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_64y2k_device::write_h)
{
LOG_MMC(("bmc64y2k write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1904,7 +1904,7 @@ void nes_bmc_12in1_device::update_banks()
set_nt_mirroring(BIT(m_reg[2], 2) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
}
-void nes_bmc_12in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_12in1_device::write_h)
{
LOG_MMC(("bmc_12in1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1930,7 +1930,7 @@ void nes_bmc_12in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_20in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_20in1_device::write_h)
{
LOG_MMC(("bmc_20in1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1953,7 +1953,7 @@ void nes_bmc_20in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_21in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_21in1_device::write_h)
{
LOG_MMC(("bmc_21in1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1974,7 +1974,7 @@ void nes_bmc_21in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_31in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_31in1_device::write_h)
{
LOG_MMC(("bmc_31in1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -2006,7 +2006,7 @@ void nes_bmc_31in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_35in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_35in1_device::write_h)
{
LOG_MMC(("bmc_35in1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -2028,7 +2028,7 @@ void nes_bmc_35in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_36in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_36in1_device::write_h)
{
LOG_MMC(("bmc_36in1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -2052,7 +2052,7 @@ void nes_bmc_36in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_64in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_64in1_device::write_h)
{
int bank = (offset >> 1) & (offset >> 2) & 0x01;
@@ -2082,7 +2082,7 @@ void nes_bmc_64in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_70in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_70in1_device::write_h)
{
LOG_MMC(("bmc70in1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -2105,7 +2105,7 @@ void nes_bmc_70in1_device::write_h(offs_t offset, uint8_t data)
}
}
-uint8_t nes_bmc_70in1_device::read_h(offs_t offset)
+READ8_MEMBER(nes_bmc_70in1_device::read_h)
{
LOG_MMC(("bmc70in1 read_h, offset: %04x\n", offset));
@@ -2128,7 +2128,7 @@ uint8_t nes_bmc_70in1_device::read_h(offs_t offset)
-------------------------------------------------*/
-void nes_bmc_72in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_72in1_device::write_h)
{
int hi_bank = offset & 0x40;
int size_16 = offset & 0x1000;
@@ -2165,7 +2165,7 @@ void nes_bmc_72in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
// does this work for super42in1 as well?!?
-void nes_bmc_76in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_76in1_device::write_h)
{
int hi_bank;
int size_16;
@@ -2210,7 +2210,7 @@ void nes_bmc_76in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_110in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_110in1_device::write_h)
{
uint8_t helper1 = (offset >> 12) ? 0 : 1;
uint8_t helper2 = ((offset >> 8) & 0x40) | ((offset >> 6) & 0x3f);
@@ -2237,7 +2237,7 @@ void nes_bmc_110in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_150in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_150in1_device::write_h)
{
int bank = (offset >> 1) & 0x07;
@@ -2261,7 +2261,7 @@ void nes_bmc_150in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_190in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_190in1_device::write_h)
{
LOG_MMC(("bmc190in1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -2287,7 +2287,7 @@ void nes_bmc_190in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_800in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_800in1_device::write_h)
{
LOG_MMC(("bmc800in1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -2312,7 +2312,7 @@ void nes_bmc_800in1_device::write_h(offs_t offset, uint8_t data)
prg16_cdef(m_reg[1]);
}
-uint8_t nes_bmc_800in1_device::read_h(offs_t offset)
+READ8_MEMBER(nes_bmc_800in1_device::read_h)
{
LOG_MMC(("bmc800in1 read_h, offset: %04x\n", offset));
@@ -2335,7 +2335,7 @@ uint8_t nes_bmc_800in1_device::read_h(offs_t offset)
-------------------------------------------------*/
-void nes_bmc_1200in1_device::chr_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_1200in1_device::chr_w)
{
int bank = offset >> 10;
@@ -2344,7 +2344,7 @@ void nes_bmc_1200in1_device::chr_w(offs_t offset, uint8_t data)
}
-void nes_bmc_1200in1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_1200in1_device::write_h)
{
int bank = ((offset >> 2) & 0x1f) | ((offset & 0x0100) >> 3);
@@ -2390,7 +2390,7 @@ void nes_bmc_1200in1_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_gold260_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_gold260_device::write_h)
{
int bank = (offset & 0x1f) | ((offset & 0x0300) >> 3);
LOG_MMC(("bmc_gold260 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -2428,7 +2428,7 @@ void nes_bmc_gold260_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_gold150_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_gold150_device::write_h)
{
int bank = (offset & 0x1f) | ((offset & 0x0200) >> 4);
LOG_MMC(("bmc_gold150 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -2450,12 +2450,12 @@ void nes_bmc_gold150_device::write_h(offs_t offset, uint8_t data)
prg32(bank);
}
-uint8_t nes_bmc_gold150_device::read_h(offs_t offset)
+READ8_MEMBER(nes_bmc_gold150_device::read_h)
{
LOG_MMC(("bmc_gold150 read_h, offset: %04x\n", offset));
if (m_latch) // open bus
- return get_open_bus();
+ return m_open_bus;
else
return hi_access_rom(offset);
}
@@ -2475,7 +2475,7 @@ uint8_t nes_bmc_gold150_device::read_h(offs_t offset)
-------------------------------------------------*/
-void nes_bmc_ch001_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_ch001_device::write_h)
{
int bank = ((offset >> 1) & 0x1fc);
LOG_MMC(("bmc_ch001 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -2503,12 +2503,12 @@ void nes_bmc_ch001_device::write_h(offs_t offset, uint8_t data)
prg8_ef((offset & 0x07c ) | ((offset & 0x6) ? 0x3 : 0x1));
}
-uint8_t nes_bmc_ch001_device::read_h(offs_t offset)
+READ8_MEMBER(nes_bmc_ch001_device::read_h)
{
LOG_MMC(("bmc_ch001 read_h, offset: %04x\n", offset));
if (m_latch && offset < 0x4000) // open bus
- return get_open_bus();
+ return m_open_bus;
else
return hi_access_rom(offset);
}
@@ -2528,7 +2528,7 @@ uint8_t nes_bmc_ch001_device::read_h(offs_t offset)
-------------------------------------------------*/
-void nes_bmc_super22_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_super22_device::write_h)
{
LOG_MMC(("bmc_super22 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -2581,7 +2581,7 @@ void nes_bmc_super22_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bmc_42in1reset_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bmc_42in1reset_device::write_h)
{
int bank;
LOG_MMC(("bmc_42in1reset write_h, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/multigame.h b/src/devices/bus/nes/multigame.h
index 51db3e9f821..e88ec21be58 100644
--- a/src/devices/bus/nes/multigame.h
+++ b/src/devices/bus/nes/multigame.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_action52_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -34,8 +34,8 @@ public:
// construction/destruction
nes_caltron_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -56,8 +56,8 @@ public:
// construction/destruction
nes_rumblestat_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -78,9 +78,9 @@ public:
// construction/destruction
nes_svision16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -102,7 +102,7 @@ public:
// construction/destruction
nes_n625092_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -124,7 +124,7 @@ public:
// construction/destruction
nes_a65as_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -142,7 +142,7 @@ public:
// construction/destruction
nes_t262_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -163,7 +163,7 @@ public:
// construction/destruction
nes_novel1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -181,7 +181,7 @@ public:
// construction/destruction
nes_novel2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -199,7 +199,7 @@ public:
// construction/destruction
nes_studyngame_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -217,7 +217,7 @@ public:
// construction/destruction
nes_sgun20in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -235,8 +235,8 @@ public:
// construction/destruction
nes_vt5201_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -257,7 +257,7 @@ public:
// construction/destruction
nes_810544c_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -275,7 +275,7 @@ public:
// construction/destruction
nes_ntd03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -293,9 +293,9 @@ public:
// construction/destruction
nes_bmc_gb63_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
- virtual void chr_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
+ virtual DECLARE_WRITE8_MEMBER(chr_w) override;
virtual void pcb_reset() override;
@@ -318,7 +318,7 @@ public:
// construction/destruction
nes_bmc_gka_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -339,7 +339,7 @@ public:
// construction/destruction
nes_bmc_gkb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -357,7 +357,7 @@ public:
// construction/destruction
nes_bmc_ws_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -378,7 +378,7 @@ public:
// construction/destruction
nes_bmc_11160_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -396,7 +396,7 @@ public:
// construction/destruction
nes_bmc_g146_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -414,8 +414,8 @@ public:
// construction/destruction
nes_bmc_8157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -433,7 +433,7 @@ public:
// construction/destruction
nes_bmc_hik300_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -451,7 +451,7 @@ public:
// construction/destruction
nes_bmc_s700_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -469,8 +469,8 @@ public:
// construction/destruction
nes_bmc_ball11_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -492,7 +492,7 @@ public:
// construction/destruction
nes_bmc_22games_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -510,8 +510,8 @@ public:
// construction/destruction
nes_bmc_64y2k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -533,7 +533,7 @@ public:
// construction/destruction
nes_bmc_12in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -555,7 +555,7 @@ public:
// construction/destruction
nes_bmc_20in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -573,7 +573,7 @@ public:
// construction/destruction
nes_bmc_21in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -591,7 +591,7 @@ public:
// construction/destruction
nes_bmc_31in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -609,7 +609,7 @@ public:
// construction/destruction
nes_bmc_35in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -627,7 +627,7 @@ public:
// construction/destruction
nes_bmc_36in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -645,7 +645,7 @@ public:
// construction/destruction
nes_bmc_64in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -663,8 +663,8 @@ public:
// construction/destruction
nes_bmc_70in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -686,7 +686,7 @@ public:
// construction/destruction
nes_bmc_72in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -704,7 +704,7 @@ public:
// construction/destruction
nes_bmc_76in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -725,7 +725,7 @@ public:
// construction/destruction
nes_bmc_110in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -743,7 +743,7 @@ public:
// construction/destruction
nes_bmc_150in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -761,7 +761,7 @@ public:
// construction/destruction
nes_bmc_190in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -779,8 +779,8 @@ public:
// construction/destruction
nes_bmc_800in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -802,8 +802,8 @@ public:
// construction/destruction
nes_bmc_1200in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
- virtual void chr_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
+ virtual DECLARE_WRITE8_MEMBER(chr_w) override;
virtual void pcb_reset() override;
@@ -824,8 +824,8 @@ public:
// construction/destruction
nes_bmc_gold150_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -846,7 +846,7 @@ public:
// construction/destruction
nes_bmc_gold260_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -864,8 +864,8 @@ public:
// construction/destruction
nes_bmc_ch001_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -886,7 +886,7 @@ public:
// construction/destruction
nes_bmc_super22_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -922,7 +922,7 @@ public:
// construction/destruction
nes_bmc_42in1reset_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/namcot.cpp b/src/devices/bus/nes/namcot.cpp
index e2898d6b9ba..84b41996272 100644
--- a/src/devices/bus/nes/namcot.cpp
+++ b/src/devices/bus/nes/namcot.cpp
@@ -246,7 +246,7 @@ void nes_namcot163_device::pcb_reset()
-------------------------------------------------*/
-void nes_namcot3433_device::dxrom_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_namcot3433_device::dxrom_write)
{
LOG_MMC(("dxrom_write, offset: %04x, data: %02x\n", offset, data));
@@ -290,7 +290,7 @@ void nes_namcot3433_device::dxrom_write(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_namcot3446_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_namcot3446_device::write_h)
{
LOG_MMC(("namcot3446 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -334,7 +334,7 @@ void nes_namcot3446_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_namcot3425_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_namcot3425_device::write_h)
{
uint8_t mode;
LOG_MMC(("namcot3425 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -407,7 +407,7 @@ void nes_namcot340_device::device_timer(emu_timer &timer, device_timer_id id, in
}
}
-void nes_namcot340_device::n340_lowrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_namcot340_device::n340_lowrite)
{
LOG_MMC(("n340_lowrite, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -426,7 +426,7 @@ void nes_namcot340_device::n340_lowrite(offs_t offset, uint8_t data)
}
}
-uint8_t nes_namcot340_device::n340_loread(offs_t offset)
+READ8_MEMBER(nes_namcot340_device::n340_loread)
{
LOG_MMC(("n340_loread, offset: %04x\n", offset));
offset += 0x100;
@@ -444,7 +444,7 @@ uint8_t nes_namcot340_device::n340_loread(offs_t offset)
}
}
-void nes_namcot340_device::n340_hiwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_namcot340_device::n340_hiwrite)
{
LOG_MMC(("n340_hiwrite, offset: %04x, data: %02x\n", offset, data));
@@ -505,17 +505,17 @@ void nes_namcot340_device::n340_hiwrite(offs_t offset, uint8_t data)
-------------------------------------------------*/
-uint8_t nes_namcot175_device::read_m(offs_t offset)
+READ8_MEMBER(nes_namcot175_device::read_m)
{
// the only game supporting this is Family Circuit '91, and it has 2KB of battery
// but it's mirrored up to 8KB (see Sprint Race -> Back Up menu breakage if not)
if (!m_battery.empty() && !m_wram_protect)
return m_battery[offset & (m_battery.size() - 1)];
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
-void nes_namcot175_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_namcot175_device::write_m)
{
// the only game supporting this is Family Circuit '91, and it has 2KB of battery
// but it's mirrored up to 8KB (see Sprint Race -> Back Up menu breakage if not)
@@ -523,7 +523,7 @@ void nes_namcot175_device::write_m(offs_t offset, uint8_t data)
m_battery[offset & (m_battery.size() - 1)] = data;
}
-void nes_namcot175_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_namcot175_device::write_h)
{
LOG_MMC(("namcot175 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -536,7 +536,7 @@ void nes_namcot175_device::write_h(offs_t offset, uint8_t data)
prg8_89(data & 0x3f);
break;
default:
- n340_hiwrite(offset, data);
+ n340_hiwrite(space, offset, data, mem_mask);
break;
}
}
@@ -560,7 +560,7 @@ void nes_namcot175_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_namcot163_device::chr_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_namcot163_device::chr_w)
{
int bank = offset >> 10;
@@ -576,7 +576,7 @@ void nes_namcot163_device::chr_w(offs_t offset, uint8_t data)
// or ROM, so no write
}
-uint8_t nes_namcot163_device::chr_r(offs_t offset)
+READ8_MEMBER(nes_namcot163_device::chr_r)
{
int bank = offset >> 10;
if (!(m_latch & 0x40) && m_chr_bank >= 0xe0)
@@ -590,15 +590,15 @@ uint8_t nes_namcot163_device::chr_r(offs_t offset)
}
-uint8_t nes_namcot163_device::read_m(offs_t offset)
+READ8_MEMBER(nes_namcot163_device::read_m)
{
if (!m_battery.empty() && offset < m_battery.size())
return m_battery[offset & (m_battery.size() - 1)];
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
-void nes_namcot163_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_namcot163_device::write_m)
{
// the pcb can separately protect each 2KB chunk of the external wram from writes
int bank = (offset & 0x1800) >> 11;
@@ -606,7 +606,7 @@ void nes_namcot163_device::write_m(offs_t offset, uint8_t data)
m_battery[offset & (m_battery.size() - 1)] = data;
}
-void nes_namcot163_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_namcot163_device::write_l)
{
LOG_MMC(("namcot163 write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -617,12 +617,12 @@ void nes_namcot163_device::write_l(offs_t offset, uint8_t data)
LOG_MMC(("Namcot-163 sound reg write, data: %02x\n", data));
break;
default:
- n340_lowrite(offset, data);
+ n340_lowrite(space, offset, data, mem_mask);
break;
}
}
-uint8_t nes_namcot163_device::read_l(offs_t offset)
+READ8_MEMBER(nes_namcot163_device::read_l)
{
LOG_MMC(("namcot163 read_l, offset: %04x\n", offset));
offset += 0x100;
@@ -633,7 +633,7 @@ uint8_t nes_namcot163_device::read_l(offs_t offset)
LOG_MMC(("Namcot-163 sound reg read\n"));
return 0;
default:
- return n340_loread(offset);
+ return n340_loread(space, offset, mem_mask);
}
}
@@ -645,7 +645,7 @@ void nes_namcot163_device::set_mirror(uint8_t page, uint8_t data)
set_nt_page(page, CIRAM, data & 0x01, 1);
}
-void nes_namcot163_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_namcot163_device::write_h)
{
int page;
LOG_MMC(("namcot163 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -680,7 +680,7 @@ void nes_namcot163_device::write_h(offs_t offset, uint8_t data)
LOG_MMC(("Namcot-163 sound address write, data: %02x\n", data));
break;
default:
- n340_hiwrite(offset, data);
+ n340_hiwrite(space, offset, data, mem_mask);
break;
}
}
diff --git a/src/devices/bus/nes/namcot.h b/src/devices/bus/nes/namcot.h
index bcf72f5bad4..a4ab64084e1 100644
--- a/src/devices/bus/nes/namcot.h
+++ b/src/devices/bus/nes/namcot.h
@@ -16,8 +16,8 @@ public:
// construction/destruction
nes_namcot3433_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void dxrom_write(offs_t offset, uint8_t data);
- virtual void write_h(offs_t offset, uint8_t data) override { dxrom_write(offset, data); }
+ virtual DECLARE_WRITE8_MEMBER(dxrom_write);
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { dxrom_write(space, offset, data, mem_mask); }
virtual void pcb_reset() override;
@@ -40,7 +40,7 @@ public:
// construction/destruction
nes_namcot3446_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -61,7 +61,7 @@ public:
// construction/destruction
nes_namcot3425_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -83,12 +83,12 @@ public:
// construction/destruction
nes_namcot340_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- uint8_t n340_loread(offs_t offset);
- void n340_lowrite(offs_t offset, uint8_t data);
- void n340_hiwrite(offs_t offset, uint8_t data);
- virtual uint8_t read_l(offs_t offset) override { return n340_loread(offset); }
- virtual void write_l(offs_t offset, uint8_t data) override { n340_lowrite(offset, data); }
- virtual void write_h(offs_t offset, uint8_t data) override { n340_hiwrite(offset, data); }
+ virtual DECLARE_READ8_MEMBER(n340_loread);
+ virtual DECLARE_WRITE8_MEMBER(n340_lowrite);
+ virtual DECLARE_WRITE8_MEMBER(n340_hiwrite);
+ virtual DECLARE_READ8_MEMBER(read_l) override { return n340_loread(space, offset, mem_mask); }
+ virtual DECLARE_WRITE8_MEMBER(write_l) override { n340_lowrite(space, offset, data, mem_mask); }
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { n340_hiwrite(space, offset, data, mem_mask); }
virtual void pcb_reset() override;
@@ -122,9 +122,9 @@ public:
// device-level overrides
virtual void device_start() override;
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -141,15 +141,15 @@ public:
// construction/destruction
nes_namcot163_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
// we have to overwrite these to allow CIRAM to be used for VRAM, even if it's not clear which game(s) use this
- virtual uint8_t chr_r(offs_t offset) override;
- virtual void chr_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(chr_r) override;
+ virtual DECLARE_WRITE8_MEMBER(chr_w) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/nanjing.cpp b/src/devices/bus/nes/nanjing.cpp
index 9719816beb2..26a7e20f97c 100644
--- a/src/devices/bus/nes/nanjing.cpp
+++ b/src/devices/bus/nes/nanjing.cpp
@@ -111,7 +111,7 @@ void nes_nanjing_device::hblank_irq(int scanline, int vblank, int blanked)
}
-void nes_nanjing_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_nanjing_device::write_l)
{
LOG_MMC(("nanjing write_l, offset: %04x, data: %02x\n", offset, data));
@@ -154,7 +154,7 @@ void nes_nanjing_device::write_l(offs_t offset, uint8_t data)
prg32((m_reg[0] & 0x0f) | ((m_reg[1] & 0x0f) << 4));
}
-uint8_t nes_nanjing_device::read_l(offs_t offset)
+READ8_MEMBER(nes_nanjing_device::read_l)
{
uint8_t value = 0;
LOG_MMC(("nanjing read_l, offset: %04x\n", offset));
diff --git a/src/devices/bus/nes/nanjing.h b/src/devices/bus/nes/nanjing.h
index c5a71032573..a231872a124 100644
--- a/src/devices/bus/nes/nanjing.h
+++ b/src/devices/bus/nes/nanjing.h
@@ -19,8 +19,8 @@ public:
nes_nanjing_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
~nes_nanjing_device();
- virtual uint8_t read_l(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/nes_slot.cpp b/src/devices/bus/nes/nes_slot.cpp
index ab8235ccc55..c3d036b8493 100644
--- a/src/devices/bus/nes/nes_slot.cpp
+++ b/src/devices/bus/nes/nes_slot.cpp
@@ -592,12 +592,6 @@ void device_nes_cart_interface::reset_cpu()
m_maincpu->set_pc(0xfffc);
}
-void device_nes_cart_interface::poke(offs_t offset, uint8_t data)
-{
- // even worse hack
- m_maincpu->space(AS_PROGRAM).write_byte(offset, data);
-}
-
//-------------------------------------------------
// Other helpers
//-------------------------------------------------
@@ -630,7 +624,7 @@ uint8_t device_nes_cart_interface::account_bus_conflict(uint32_t offset, uint8_t
// PPU accessors
//-------------------------------------------------
-void device_nes_cart_interface::chr_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(device_nes_cart_interface::chr_w)
{
int bank = offset >> 10;
@@ -638,14 +632,14 @@ void device_nes_cart_interface::chr_w(offs_t offset, uint8_t data)
m_chr_access[bank][offset & 0x3ff] = data;
}
-uint8_t device_nes_cart_interface::chr_r(offs_t offset)
+READ8_MEMBER(device_nes_cart_interface::chr_r)
{
int bank = offset >> 10;
return m_chr_access[bank][offset & 0x3ff];
}
-void device_nes_cart_interface::nt_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(device_nes_cart_interface::nt_w)
{
int page = ((offset & 0xc00) >> 10);
@@ -655,7 +649,7 @@ void device_nes_cart_interface::nt_w(offs_t offset, uint8_t data)
m_nt_access[page][offset & 0x3ff] = data;
}
-uint8_t device_nes_cart_interface::nt_r(offs_t offset)
+READ8_MEMBER(device_nes_cart_interface::nt_r)
{
int page = ((offset & 0xc00) >> 10);
return m_nt_access[page][offset & 0x3ff];
@@ -671,26 +665,26 @@ uint8_t device_nes_cart_interface::nt_r(offs_t offset)
// source)
//-------------------------------------------------
-uint8_t device_nes_cart_interface::read_l(offs_t offset)
+READ8_MEMBER(device_nes_cart_interface::read_l)
{
- return get_open_bus();
+ return m_open_bus;
}
-uint8_t device_nes_cart_interface::read_m(offs_t offset)
+READ8_MEMBER(device_nes_cart_interface::read_m)
{
if (!m_battery.empty())
return m_battery[offset & (m_battery.size() - 1)];
if (!m_prgram.empty())
return m_prgram[offset & (m_prgram.size() - 1)];
- return get_open_bus();
+ return m_open_bus;
}
-void device_nes_cart_interface::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(device_nes_cart_interface::write_l)
{
}
-void device_nes_cart_interface::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(device_nes_cart_interface::write_m)
{
if (!m_battery.empty())
m_battery[offset & (m_battery.size() - 1)] = data;
@@ -698,7 +692,7 @@ void device_nes_cart_interface::write_m(offs_t offset, uint8_t data)
m_prgram[offset & (m_prgram.size() - 1)] = data;
}
-void device_nes_cart_interface::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(device_nes_cart_interface::write_h)
{
}
@@ -746,9 +740,6 @@ void device_nes_cart_interface::pcb_start(running_machine &machine, uint8_t *cir
device().save_item(NAME(m_vram));
if (!m_battery.empty())
device().save_item(NAME(m_battery));
-
- // open bus
- device().save_item(NAME(m_open_bus));
}
void device_nes_cart_interface::pcb_reg_postload(running_machine &machine)
@@ -952,11 +943,11 @@ std::string nes_cart_slot_device::get_default_card_software(get_default_card_sof
read
-------------------------------------------------*/
-uint8_t nes_cart_slot_device::read_l(offs_t offset)
+READ8_MEMBER(nes_cart_slot_device::read_l)
{
if (m_cart)
{
- uint8_t val = m_cart->read_l(offset);
+ uint8_t val = m_cart->read_l(space, offset);
// update open bus
m_cart->set_open_bus(((offset + 0x4100) & 0xff00) >> 8);
return val;
@@ -965,11 +956,11 @@ uint8_t nes_cart_slot_device::read_l(offs_t offset)
return 0xff;
}
-uint8_t nes_cart_slot_device::read_m(offs_t offset)
+READ8_MEMBER(nes_cart_slot_device::read_m)
{
if (m_cart)
{
- uint8_t val = m_cart->read_m(offset);
+ uint8_t val = m_cart->read_m(space, offset);
// update open bus
m_cart->set_open_bus(((offset + 0x6000) & 0xff00) >> 8);
return val;
@@ -978,11 +969,11 @@ uint8_t nes_cart_slot_device::read_m(offs_t offset)
return 0xff;
}
-uint8_t nes_cart_slot_device::read_h(offs_t offset)
+READ8_MEMBER(nes_cart_slot_device::read_h)
{
if (m_cart)
{
- uint8_t val = m_cart->read_h(offset);
+ uint8_t val = m_cart->read_h(space, offset);
// update open bus
m_cart->set_open_bus(((offset + 0x8000) & 0xff00) >> 8);
return val;
@@ -991,11 +982,11 @@ uint8_t nes_cart_slot_device::read_h(offs_t offset)
return 0xff;
}
-uint8_t nes_cart_slot_device::read_ex(offs_t offset)
+READ8_MEMBER(nes_cart_slot_device::read_ex)
{
if (m_cart)
{
- uint8_t val = m_cart->read_ex(offset);
+ uint8_t val = m_cart->read_ex(space, offset);
// update open bus
m_cart->set_open_bus(((offset + 0x4020) & 0xff00) >> 8);
return val;
@@ -1009,41 +1000,41 @@ uint8_t nes_cart_slot_device::read_ex(offs_t offset)
write
-------------------------------------------------*/
-void nes_cart_slot_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_cart_slot_device::write_l)
{
if (m_cart)
{
- m_cart->write_l(offset, data);
+ m_cart->write_l(space, offset, data);
// update open bus
m_cart->set_open_bus(((offset + 0x4100) & 0xff00) >> 8);
}
}
-void nes_cart_slot_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_cart_slot_device::write_m)
{
if (m_cart)
{
- m_cart->write_m(offset, data);
+ m_cart->write_m(space, offset, data);
// update open bus
m_cart->set_open_bus(((offset + 0x6000) & 0xff00) >> 8);
}
}
-void nes_cart_slot_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_cart_slot_device::write_h)
{
if (m_cart)
{
- m_cart->write_h(offset, data);
+ m_cart->write_h(space, offset, data);
// update open bus
m_cart->set_open_bus(((offset + 0x8000) & 0xff00) >> 8);
}
}
-void nes_cart_slot_device::write_ex(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_cart_slot_device::write_ex)
{
if (m_cart)
{
- m_cart->write_ex(offset, data);
+ m_cart->write_ex(space, offset, data);
// update open bus
m_cart->set_open_bus(((offset + 0x4020) & 0xff00) >> 8);
}
diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h
index 952ffd74b1f..b86dbfb1e41 100644
--- a/src/devices/bus/nes/nes_slot.h
+++ b/src/devices/bus/nes/nes_slot.h
@@ -166,19 +166,19 @@ public:
virtual ~device_nes_cart_interface();
// reading and writing
- virtual uint8_t read_l(offs_t offset);
- virtual uint8_t read_m(offs_t offset);
- virtual uint8_t read_h(offs_t offset) { return 0xff; }
- virtual uint8_t read_ex(offs_t offset) { return 0xff; }
- virtual void write_l(offs_t offset, uint8_t data);
- virtual void write_m(offs_t offset, uint8_t data);
- virtual void write_h(offs_t offset, uint8_t data);
- virtual void write_ex(offs_t offset, uint8_t data) { }
-
- virtual uint8_t chr_r(offs_t offset);
- virtual void chr_w(offs_t offset, uint8_t data);
- virtual uint8_t nt_r(offs_t offset);
- virtual void nt_w(offs_t offset, uint8_t data);
+ virtual DECLARE_READ8_MEMBER(read_l);
+ virtual DECLARE_READ8_MEMBER(read_m);
+ virtual DECLARE_READ8_MEMBER(read_h) { return 0xff; }
+ virtual DECLARE_READ8_MEMBER(read_ex) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_l);
+ virtual DECLARE_WRITE8_MEMBER(write_m);
+ virtual DECLARE_WRITE8_MEMBER(write_h);
+ virtual DECLARE_WRITE8_MEMBER(write_ex) { }
+
+ virtual DECLARE_READ8_MEMBER(chr_r);
+ virtual DECLARE_WRITE8_MEMBER(chr_w);
+ virtual DECLARE_READ8_MEMBER(nt_r);
+ virtual DECLARE_WRITE8_MEMBER(nt_w);
// hack until disk system is made modern!
virtual void disk_flip_side() { }
@@ -202,7 +202,6 @@ public:
void set_vrc_lines(int PRG_A, int PRG_B, int CHR) { m_vrc_ls_prg_a = PRG_A; m_vrc_ls_prg_b = PRG_B; m_vrc_ls_chr = CHR; }
void set_x1_005_alt(bool val) { m_x1_005_alt_mirroring = val; }
void set_bus_conflict(bool val) { m_bus_conflict = val; }
- uint8_t get_open_bus() { return m_open_bus; }
void set_open_bus(uint8_t val) { m_open_bus = val; }
uint8_t *get_prg_base() { return m_prg; }
@@ -238,7 +237,6 @@ protected:
DECLARE_WRITE_LINE_MEMBER(set_irq_line);
void hold_irq_line();
void reset_cpu();
- void poke(offs_t offset, uint8_t data);
// internal state
uint8_t *m_prg;
@@ -272,10 +270,8 @@ protected:
bool m_pcb_ctrl_mirror, m_four_screen_vram, m_has_trainer;
bool m_x1_005_alt_mirroring; // temp hack for two kind of mirroring in Taito X1-005 boards (to be replaced with pin checking)
bool m_bus_conflict;
-private:
uint8_t m_open_bus;
-public:
// PRG
inline int prg_8k_bank_num(int bank);
inline void update_prg_banks(int prg_bank_start, int prg_bank_end);
@@ -392,14 +388,14 @@ public:
int nes_get_pcb_id(const char *slot);
// reading and writing
- virtual uint8_t read_l(offs_t offset);
- virtual uint8_t read_m(offs_t offset);
- virtual uint8_t read_h(offs_t offset);
- virtual uint8_t read_ex(offs_t offset);
- virtual void write_l(offs_t offset, uint8_t data);
- virtual void write_m(offs_t offset, uint8_t data);
- virtual void write_h(offs_t offset, uint8_t data);
- virtual void write_ex(offs_t offset, uint8_t data);
+ virtual DECLARE_READ8_MEMBER(read_l);
+ virtual DECLARE_READ8_MEMBER(read_m);
+ virtual DECLARE_READ8_MEMBER(read_h);
+ virtual DECLARE_READ8_MEMBER(read_ex);
+ virtual DECLARE_WRITE8_MEMBER(write_l);
+ virtual DECLARE_WRITE8_MEMBER(write_m);
+ virtual DECLARE_WRITE8_MEMBER(write_h);
+ virtual DECLARE_WRITE8_MEMBER(write_ex);
// hack until disk system is made modern!
virtual void disk_flip_side() { if (m_cart) m_cart->disk_flip_side(); }
@@ -433,4 +429,9 @@ DECLARE_DEVICE_TYPE(NES_CART_SLOT, nes_cart_slot_device)
#define NESSLOT_PRGROM_REGION_TAG ":cart:prg_rom"
#define NESSLOT_CHRROM_REGION_TAG ":cart:chr_rom"
+
+#define MCFG_NES_CARTRIDGE_NOT_MANDATORY \
+ static_cast<nes_cart_slot_device *>(device)->set_must_be_loaded(false);
+
+
#endif // MAME_BUS_NES_NES_SLOT_H
diff --git a/src/devices/bus/nes/ntdec.cpp b/src/devices/bus/nes/ntdec.cpp
index 6fbcd6f31ef..5ea3458e8f3 100644
--- a/src/devices/bus/nes/ntdec.cpp
+++ b/src/devices/bus/nes/ntdec.cpp
@@ -102,7 +102,7 @@ void nes_ntdec_fh_device::pcb_reset()
-------------------------------------------------*/
-void nes_ntdec_asder_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ntdec_asder_device::write_h)
{
LOG_MMC(("ntdec_asder write_h, offset: %04x, data: %02x\n", offset, data));
@@ -165,7 +165,7 @@ void nes_ntdec_asder_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_ntdec_fh_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_ntdec_fh_device::write_m)
{
LOG_MMC(("ntdec_fh write_m, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/ntdec.h b/src/devices/bus/nes/ntdec.h
index 062c5d7dcec..1e5e8ef6cbb 100644
--- a/src/devices/bus/nes/ntdec.h
+++ b/src/devices/bus/nes/ntdec.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_ntdec_asder_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -37,7 +37,7 @@ public:
// construction/destruction
nes_ntdec_fh_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/nxrom.cpp b/src/devices/bus/nes/nxrom.cpp
index 352b7534250..e78fd6d1527 100644
--- a/src/devices/bus/nes/nxrom.cpp
+++ b/src/devices/bus/nes/nxrom.cpp
@@ -145,6 +145,9 @@ void nes_nrom_device::common_start()
save_item(NAME(m_nt_src));
save_item(NAME(m_nt_orig));
save_item(NAME(m_nt_writable));
+
+ // open bus
+ save_item(NAME(m_open_bus));
}
void nes_nrom_device::pcb_reset()
@@ -288,23 +291,23 @@ void nes_un1rom_device::pcb_reset()
-------------------------------------------------*/
-uint8_t nes_nrom368_device::read_l(offs_t offset)
+READ8_MEMBER(nes_nrom368_device::read_l)
{
LOG_MMC(("nrom368 read_l, offset: %04x\n", offset));
offset += 0x100;
if (offset >= 0x800)
return m_prg[offset - 0x800];
else
- return get_open_bus();
+ return m_open_bus;
}
-uint8_t nes_nrom368_device::read_m(offs_t offset)
+READ8_MEMBER(nes_nrom368_device::read_m)
{
LOG_MMC(("nrom368 read_m, offset: %04x\n", offset));
return m_prg[0x1800 + (offset & 0x1fff)];
}
-uint8_t nes_nrom368_device::read_h(offs_t offset)
+READ8_MEMBER(nes_nrom368_device::read_h)
{
LOG_MMC(("nrom368 read_h, offset: %04x\n", offset));
return m_prg[0x3800 + (offset & 0x7fff)];
@@ -331,7 +334,7 @@ uint8_t nes_nrom368_device::read_h(offs_t offset)
-------------------------------------------------*/
-void nes_axrom_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_axrom_device::write_h)
{
LOG_MMC(("axrom write_h, offset: %04x, data: %02x\n", offset, data));
@@ -352,7 +355,7 @@ void nes_axrom_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_bxrom_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bxrom_device::write_h)
{
/* This portion of the mapper is nearly identical to Mapper 7, except no one-screen mirroring */
/* Deadly Towers is really a BxROM game - the demo screens look wrong using mapper 7. */
@@ -388,7 +391,7 @@ void nes_bxrom_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_cnrom_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_cnrom_device::write_h)
{
LOG_MMC(("cxrom write_h, offset: %04x, data: %02x\n", offset, data));
@@ -409,7 +412,7 @@ void nes_cnrom_device::write_h(offs_t offset, uint8_t data)
chr8(data, CHRROM);
}
-uint8_t nes_cnrom_device::chr_r(offs_t offset)
+READ8_MEMBER(nes_cnrom_device::chr_r)
{
int bank = offset >> 10;
@@ -418,7 +421,7 @@ uint8_t nes_cnrom_device::chr_r(offs_t offset)
// give actual VROM content or open bus values.
// For most boards, chr_open_bus remains always zero.
if (m_chr_open_bus)
- return get_open_bus();
+ return m_open_bus;
return m_chr_access[bank][offset & 0x3ff];
}
@@ -438,7 +441,7 @@ uint8_t nes_cnrom_device::chr_r(offs_t offset)
-------------------------------------------------*/
-void nes_cprom_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_cprom_device::write_h)
{
LOG_MMC(("cprom write_h, offset: %04x, data: %02x\n", offset, data));
@@ -459,7 +462,7 @@ void nes_cprom_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_gxrom_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_gxrom_device::write_h)
{
LOG_MMC(("gxrom write_h, offset %04x, data: %02x\n", offset, data));
@@ -485,7 +488,7 @@ void nes_gxrom_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_uxrom_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_uxrom_device::write_h)
{
LOG_MMC(("uxrom write_h, offset: %04x, data: %02x\n", offset, data));
@@ -511,7 +514,7 @@ void nes_uxrom_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_uxrom_cc_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_uxrom_cc_device::write_h)
{
LOG_MMC(("uxrom_cc write_h, offset: %04x, data: %02x\n", offset, data));
@@ -532,7 +535,7 @@ void nes_uxrom_cc_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_un1rom_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_un1rom_device::write_h)
{
LOG_MMC(("un1rom write_h, offset: %04x, data: %02x\n", offset, data));
@@ -555,7 +558,7 @@ void nes_un1rom_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_nochr_device::chr_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_nochr_device::chr_w)
{
int mirr = get_mirroring();
if (mirr == PPU_MIRROR_HIGH)
@@ -566,7 +569,7 @@ void nes_nochr_device::chr_w(offs_t offset, uint8_t data)
m_ciram[offset & 0x7ff] = data; // not sure here, since there is no software to test...
}
-uint8_t nes_nochr_device::chr_r(offs_t offset)
+READ8_MEMBER(nes_nochr_device::chr_r)
{
int mirr = get_mirroring();
if (mirr == PPU_MIRROR_HIGH)
diff --git a/src/devices/bus/nes/nxrom.h b/src/devices/bus/nes/nxrom.h
index 382abf05390..721ed5b5e98 100644
--- a/src/devices/bus/nes/nxrom.h
+++ b/src/devices/bus/nes/nxrom.h
@@ -36,9 +36,9 @@ public:
// construction/destruction
nes_nrom368_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_m(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
};
@@ -62,7 +62,7 @@ public:
// construction/destruction
nes_axrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -80,7 +80,7 @@ public:
// construction/destruction
nes_bxrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -98,8 +98,8 @@ public:
// construction/destruction
nes_cnrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t chr_r(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(chr_r) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -122,7 +122,7 @@ public:
// construction/destruction
nes_cprom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -140,7 +140,7 @@ public:
// construction/destruction
nes_gxrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -158,7 +158,7 @@ public:
// construction/destruction
nes_uxrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -176,7 +176,7 @@ public:
// construction/destruction
nes_uxrom_cc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -194,7 +194,7 @@ public:
// construction/destruction
nes_un1rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -213,8 +213,8 @@ public:
nes_nochr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual uint8_t chr_r(offs_t offset) override;
- virtual void chr_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(chr_r) override;
+ virtual DECLARE_WRITE8_MEMBER(chr_w) override;
};
diff --git a/src/devices/bus/nes/pirate.cpp b/src/devices/bus/nes/pirate.cpp
index acda901ecca..1d2035a9b91 100644
--- a/src/devices/bus/nes/pirate.cpp
+++ b/src/devices/bus/nes/pirate.cpp
@@ -423,7 +423,7 @@ void nes_cityfight_device::pcb_reset()
-------------------------------------------------*/
-void nes_agci_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_agci_device::write_h)
{
LOG_MMC(("agci write_h, offset: %04x, data: %02x\n", offset, data));
@@ -445,7 +445,7 @@ void nes_agci_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_dreamtech_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_dreamtech_device::write_l)
{
LOG_MMC(("dreamtech write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -467,7 +467,7 @@ void nes_dreamtech_device::write_l(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_fukutake_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_fukutake_device::write_l)
{
LOG_MMC(("fukutake write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -483,7 +483,7 @@ void nes_fukutake_device::write_l(offs_t offset, uint8_t data)
m_ram[offset - 0x400] = data;
}
-uint8_t nes_fukutake_device::read_l(offs_t offset)
+READ8_MEMBER(nes_fukutake_device::read_l)
{
LOG_MMC(("fukutake read_l, offset: %04x\n", offset));
offset += 0x100;
@@ -503,13 +503,13 @@ uint8_t nes_fukutake_device::read_l(offs_t offset)
return 0;
}
-void nes_fukutake_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_fukutake_device::write_m)
{
LOG_MMC(("fukutake write_m, offset: %04x, data: %02x\n", offset, data));
m_prgram[((m_latch * 0x2000) + offset) & (m_prgram.size() - 1)] = data;
}
-uint8_t nes_fukutake_device::read_m(offs_t offset)
+READ8_MEMBER(nes_fukutake_device::read_m)
{
LOG_MMC(("fukutake read_m, offset: %04x\n", offset));
return m_prgram[((m_latch * 0x2000) + offset) & (m_prgram.size() - 1)];
@@ -540,7 +540,7 @@ void nes_futuremedia_device::hblank_irq(int scanline, int vblank, int blanked)
}
}
-void nes_futuremedia_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_futuremedia_device::write_h)
{
LOG_MMC(("futuremedia write_h, offset: %04x, data: %02x\n", offset, data));
@@ -603,7 +603,7 @@ void nes_futuremedia_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_magseries_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_magseries_device::write_h)
{
LOG_MMC(("magseries write_h, offset: %04x, data: %02x\n", offset, data));
@@ -626,7 +626,7 @@ void nes_magseries_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_daou306_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_daou306_device::write_h)
{
LOG_MMC(("daou306 write_h, offset: %04x, data: %02x\n", offset, data));
int reg = BIT(offset, 2) ? 8 : 0;
@@ -695,7 +695,7 @@ void nes_daou306_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_cc21_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_cc21_device::write_h)
{
LOG_MMC(("cc21 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -718,7 +718,7 @@ void nes_cc21_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_xiaozy_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_xiaozy_device::write_l)
{
LOG_MMC(("xiaozy write_l, offset: %04x, data: %02x\n", offset, data));
@@ -739,7 +739,7 @@ void nes_xiaozy_device::write_l(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_edu2k_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_edu2k_device::write_h)
{
LOG_MMC(("edu2k write_h, offset: %04x, data: %02x\n", offset, data));
@@ -747,13 +747,13 @@ void nes_edu2k_device::write_h(offs_t offset, uint8_t data)
m_latch = (data & 0xc0) >> 6;
}
-void nes_edu2k_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_edu2k_device::write_m)
{
LOG_MMC(("edu2k write_m, offset: %04x, data: %02x\n", offset, data));
m_prgram[((m_latch * 0x2000) + offset) & (m_prgram.size() - 1)] = data;
}
-uint8_t nes_edu2k_device::read_m(offs_t offset)
+READ8_MEMBER(nes_edu2k_device::read_m)
{
LOG_MMC(("edu2k read_m, offset: %04x\n", offset));
return m_prgram[((m_latch * 0x2000) + offset) & (m_prgram.size() - 1)];
@@ -787,7 +787,7 @@ void nes_t230_device::hblank_irq(int scanline, int vblank, int blanked)
}
}
-void nes_t230_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_t230_device::write_h)
{
LOG_MMC(("t230 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -869,7 +869,7 @@ void nes_mk2_device::hblank_irq( int scanline, int vblank, int blanked )
m_irq_clear = 0;
}
-void nes_mk2_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_mk2_device::write_m)
{
LOG_MMC(("mk2 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -921,7 +921,7 @@ void nes_whero_device::hblank_irq(int scanline, int vblank, int blanked)
}
}
-void nes_whero_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_whero_device::write_h)
{
int bank, shift, mask1, mask2;
LOG_MMC(("World Hero write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1005,7 +1005,7 @@ void nes_whero_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_43272_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_43272_device::write_h)
{
LOG_MMC(("unl_43272 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1016,7 +1016,7 @@ void nes_43272_device::write_h(offs_t offset, uint8_t data)
}
-uint8_t nes_43272_device::read_h(offs_t offset)
+READ8_MEMBER(nes_43272_device::read_h)
{
uint8_t mask = (m_latch & 0x400) ? 0xfe : 0xff;
LOG_MMC(("unl_43272 read_h, offset: %04x\n", offset));
@@ -1054,7 +1054,7 @@ void nes_tf1201_device::update_prg()
prg8_cd(m_swap ? m_prg : 0xff );
}
-void nes_tf1201_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_tf1201_device::write_h)
{
int bank;
LOG_MMC(("unl_tf1201 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1139,7 +1139,7 @@ void nes_cityfight_device::update_prg()
prg8_cd(m_prg_reg);
}
-void nes_cityfight_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_cityfight_device::write_h)
{
int bank;
LOG_MMC(("unl_cityfight write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1244,7 +1244,7 @@ void nes_fujiya_device::pcb_reset()
m_latch = 0;
}
-void nes_fujiya_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_fujiya_device::write_m)
{
LOG_MMC(("fujiya write_m, offset: %04x, data: %02x\n", offset, data));
offset += 0x6000;
@@ -1253,7 +1253,7 @@ void nes_fujiya_device::write_m(offs_t offset, uint8_t data)
m_latch = (data & 0x40) << 1;
}
-uint8_t nes_fujiya_device::read_m(offs_t offset)
+READ8_MEMBER(nes_fujiya_device::read_m)
{
LOG_MMC(("fujiya read_m, offset: %04x\n", offset));
offset += 0x6000;
@@ -1261,6 +1261,6 @@ uint8_t nes_fujiya_device::read_m(offs_t offset)
if (offset == 0x7001 || offset == 0x7777)
return m_latch | ((offset >> 8) & 0x7f);
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
#endif
diff --git a/src/devices/bus/nes/pirate.h b/src/devices/bus/nes/pirate.h
index e99bd703aec..91424d32e25 100644
--- a/src/devices/bus/nes/pirate.h
+++ b/src/devices/bus/nes/pirate.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_agci_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -34,7 +34,7 @@ public:
// construction/destruction
nes_dreamtech_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
@@ -52,10 +52,10 @@ public:
// construction/destruction
nes_fukutake_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -77,7 +77,7 @@ public:
// construction/destruction
nes_futuremedia_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
@@ -101,7 +101,7 @@ public:
// construction/destruction
nes_magseries_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -119,7 +119,7 @@ public:
// construction/destruction
nes_daou306_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -140,7 +140,7 @@ public:
// construction/destruction
nes_cc21_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -158,7 +158,7 @@ public:
// construction/destruction
nes_xiaozy_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
@@ -176,9 +176,9 @@ public:
// construction/destruction
nes_edu2k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -199,7 +199,7 @@ public:
// construction/destruction
nes_t230_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
@@ -225,7 +225,7 @@ public:
// construction/destruction
nes_mk2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
@@ -249,7 +249,7 @@ public:
// construction/destruction
nes_whero_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
@@ -276,8 +276,8 @@ public:
// construction/destruction
nes_43272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -298,7 +298,7 @@ public:
// construction/destruction
nes_tf1201_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
@@ -325,7 +325,7 @@ public:
// construction/destruction
nes_cityfight_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -359,8 +359,8 @@ public:
// construction/destruction
nes_fujiya_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/pt554.cpp b/src/devices/bus/nes/pt554.cpp
index db16ca42e37..98524a04bc7 100644
--- a/src/devices/bus/nes/pt554.cpp
+++ b/src/devices/bus/nes/pt554.cpp
@@ -59,7 +59,7 @@ nes_bandai_pt554_device::nes_bandai_pt554_device(const machine_config &mconfig,
-------------------------------------------------*/
-void nes_bandai_pt554_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_bandai_pt554_device::write_m)
{
LOG_MMC(("Bandai PT-554 Sound write, data: %02x\n", data));
diff --git a/src/devices/bus/nes/pt554.h b/src/devices/bus/nes/pt554.h
index 746750c52ed..f25281ea4f0 100644
--- a/src/devices/bus/nes/pt554.h
+++ b/src/devices/bus/nes/pt554.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_bandai_pt554_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
protected:
// device-level overrides
diff --git a/src/devices/bus/nes/racermate.cpp b/src/devices/bus/nes/racermate.cpp
index 111cb997dd0..5b578da0e09 100644
--- a/src/devices/bus/nes/racermate.cpp
+++ b/src/devices/bus/nes/racermate.cpp
@@ -81,7 +81,7 @@ void nes_racermate_device::update_banks()
prg16_89ab(m_latch >> 6);
}
-void nes_racermate_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_racermate_device::write_h)
{
LOG_MMC(("racermate write_h, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/racermate.h b/src/devices/bus/nes/racermate.h
index cb74a06a6b0..5366ec1a6ea 100644
--- a/src/devices/bus/nes/racermate.h
+++ b/src/devices/bus/nes/racermate.h
@@ -16,7 +16,7 @@ public:
// device-level overrides
virtual void device_start() override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/rcm.cpp b/src/devices/bus/nes/rcm.cpp
index fdd07830381..5c861922afb 100644
--- a/src/devices/bus/nes/rcm.cpp
+++ b/src/devices/bus/nes/rcm.cpp
@@ -161,7 +161,7 @@ void nes_3dblock_device::pcb_reset()
-------------------------------------------------*/
-void nes_gs2015_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_gs2015_device::write_h)
{
LOG_MMC(("gs2015 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -169,7 +169,7 @@ void nes_gs2015_device::write_h(offs_t offset, uint8_t data)
chr8(offset >> 1, m_chr_source);
}
-uint8_t nes_gs2015_device::read_m(offs_t offset)
+READ8_MEMBER(nes_gs2015_device::read_m)
{
LOG_MMC(("gs2015 read_m, offset: %04x\n", offset));
return 0; // Videopoker Bonza needs this (sort of protection? or related to inputs?)
@@ -186,7 +186,7 @@ uint8_t nes_gs2015_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_gs2004_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_gs2004_device::write_h)
{
LOG_MMC(("gs2004 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -204,7 +204,7 @@ void nes_gs2004_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_gs2013_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_gs2013_device::write_h)
{
LOG_MMC(("gs2013 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -232,7 +232,7 @@ void nes_gs2013_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_tf9_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_tf9_device::write_h)
{
LOG_MMC(("tetrisfam write_h, offset: %04x, data: %02x\n", offset, data));
@@ -279,7 +279,7 @@ void nes_3dblock_device::hblank_irq(int scanline, int vblank, int blanked)
}
}
-void nes_3dblock_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_3dblock_device::write_l)
{
LOG_MMC(("3dblock write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
diff --git a/src/devices/bus/nes/rcm.h b/src/devices/bus/nes/rcm.h
index 005869fe09c..f37a6074432 100644
--- a/src/devices/bus/nes/rcm.h
+++ b/src/devices/bus/nes/rcm.h
@@ -16,9 +16,9 @@ public:
// construction/destruction
nes_gs2015_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override { return read_m(offset); }
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override { return read_m(space, offset, mem_mask); }
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -36,7 +36,7 @@ public:
// construction/destruction
nes_gs2004_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -54,7 +54,7 @@ public:
// construction/destruction
nes_gs2013_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -72,7 +72,7 @@ public:
// construction/destruction
nes_tf9_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -90,7 +90,7 @@ public:
// construction/destruction
nes_3dblock_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/rexsoft.cpp b/src/devices/bus/nes/rexsoft.cpp
index c10b88afe01..3d868a0c970 100644
--- a/src/devices/bus/nes/rexsoft.cpp
+++ b/src/devices/bus/nes/rexsoft.cpp
@@ -112,7 +112,7 @@ void nes_rex_sl1632_device::pcb_reset()
-------------------------------------------------*/
-void nes_rex_dbz5_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_rex_dbz5_device::write_l)
{
LOG_MMC(("rex_dbz write_l, offset: %04x, data: %02x\n", offset, data));
@@ -121,7 +121,7 @@ void nes_rex_dbz5_device::write_l(offs_t offset, uint8_t data)
}
/* we would need to use this read handler in 0x6000-0x7fff as well */
-uint8_t nes_rex_dbz5_device::read_l(offs_t offset)
+READ8_MEMBER(nes_rex_dbz5_device::read_l)
{
LOG_MMC(("rex_dbz read_l, offset: %04x\n", offset));
return 0x01;
@@ -208,7 +208,7 @@ void nes_rex_sl1632_device::set_chr(uint8_t chr, int chr_base, int chr_mask)
chr1_x(chr_page ^ 7, chr_base2[7] | (bank[7] & chr_mask), chr);
}
-void nes_rex_sl1632_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_rex_sl1632_device::write_h)
{
uint8_t helper1, helper2;
LOG_MMC(("rex_sl1632 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -232,7 +232,7 @@ void nes_rex_sl1632_device::write_h(offs_t offset, uint8_t data)
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
diff --git a/src/devices/bus/nes/rexsoft.h b/src/devices/bus/nes/rexsoft.h
index 0c44c73139d..61fe876633a 100644
--- a/src/devices/bus/nes/rexsoft.h
+++ b/src/devices/bus/nes/rexsoft.h
@@ -16,10 +16,10 @@ public:
// construction/destruction
nes_rex_dbz5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_m(offs_t offset) override { return read_l(offset); }
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void chr_cb(int start, int bank, int source) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override { return read_l(space, offset, mem_mask); }
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual void chr_cb( int start, int bank, int source ) override;
virtual void pcb_reset() override;
@@ -40,7 +40,7 @@ public:
// construction/destruction
nes_rex_sl1632_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/sachen.cpp b/src/devices/bus/nes/sachen.cpp
index 0622bfec8d4..369c4cde885 100644
--- a/src/devices/bus/nes/sachen.cpp
+++ b/src/devices/bus/nes/sachen.cpp
@@ -308,7 +308,7 @@ void nes_sachen_8259d_device::pcb_reset()
-------------------------------------------------*/
-void nes_sachen_sa009_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sachen_sa009_device::write_l)
{
LOG_MMC(("SA009 write_l, offset: %04x, data: %02x\n", offset, data));
@@ -327,7 +327,7 @@ void nes_sachen_sa009_device::write_l(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_sachen_sa0036_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sachen_sa0036_device::write_h)
{
LOG_MMC(("sa0036 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -346,7 +346,7 @@ void nes_sachen_sa0036_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_sachen_sa0037_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sachen_sa0037_device::write_h)
{
LOG_MMC(("sa0037 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -369,7 +369,7 @@ void nes_sachen_sa0037_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_sachen_sa72007_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sachen_sa72007_device::write_l)
{
LOG_MMC(("SA72007 write_l, offset: %04x, data: %02x\n", offset, data));
@@ -390,7 +390,7 @@ void nes_sachen_sa72007_device::write_l(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_sachen_sa72008_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sachen_sa72008_device::write_l)
{
LOG_MMC(("SA72008 write_l, offset: %04x, data: %02x\n", offset, data));
@@ -410,7 +410,7 @@ void nes_sachen_sa72008_device::write_l(offs_t offset, uint8_t data)
-------------------------------------------------*/
-uint8_t nes_sachen_tca01_device::read_l(offs_t offset)
+READ8_MEMBER(nes_sachen_tca01_device::read_l)
{
LOG_MMC(("TCA-01 read_l, offset: %04x\n", offset));
@@ -433,7 +433,7 @@ uint8_t nes_sachen_tca01_device::read_l(offs_t offset)
-------------------------------------------------*/
-void nes_sachen_tcu01_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sachen_tcu01_device::write_l)
{
LOG_MMC(("TCU-01 write_l, offset: %04x, data: %02x\n", offset, data));
@@ -456,7 +456,7 @@ void nes_sachen_tcu01_device::write_l(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_sachen_tcu02_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sachen_tcu02_device::write_l)
{
LOG_MMC(("TCU-02 write_l, offset: %04x, data: %02x\n", offset, data));
@@ -467,7 +467,7 @@ void nes_sachen_tcu02_device::write_l(offs_t offset, uint8_t data)
}
}
-uint8_t nes_sachen_tcu02_device::read_l(offs_t offset)
+READ8_MEMBER(nes_sachen_tcu02_device::read_l)
{
LOG_MMC(("TCU-02 read_l, offset: %04x\n", offset));
@@ -512,7 +512,7 @@ void nes_sachen_74x374_device::set_mirror(uint8_t nt) // also used by mappers 13
}
-void nes_sachen_74x374_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sachen_74x374_device::write_l)
{
LOG_MMC(("Sachen 74*374 write_l, offset: %04x, data: %02x\n", offset, data));
@@ -551,7 +551,7 @@ void nes_sachen_74x374_device::write_l(offs_t offset, uint8_t data)
}
}
-uint8_t nes_sachen_74x374_device::read_l(offs_t offset)
+READ8_MEMBER(nes_sachen_74x374_device::read_l)
{
LOG_MMC(("Sachen 74*374 read_l, offset: %04x", offset));
@@ -562,7 +562,7 @@ uint8_t nes_sachen_74x374_device::read_l(offs_t offset)
return 0;
}
-void nes_sachen_74x374_alt_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sachen_74x374_alt_device::write_l)
{
LOG_MMC(("Sachen 74*374 Alt write_l, offset: %04x, data: %02x\n", offset, data));
@@ -626,7 +626,7 @@ void nes_sachen_8259a_device::chr_update()
}
}
-void nes_sachen_8259a_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sachen_8259a_device::write_l)
{
LOG_MMC(("Sachen 8259 write_l, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/sachen.h b/src/devices/bus/nes/sachen.h
index b23599345b3..cfec9363bdc 100644
--- a/src/devices/bus/nes/sachen.h
+++ b/src/devices/bus/nes/sachen.h
@@ -16,7 +16,7 @@ public:
// construction/destruction
nes_sachen_sa009_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
@@ -34,7 +34,7 @@ public:
// construction/destruction
nes_sachen_sa0036_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -52,7 +52,7 @@ public:
// construction/destruction
nes_sachen_sa0037_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -70,7 +70,7 @@ public:
// construction/destruction
nes_sachen_sa72007_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
@@ -88,7 +88,7 @@ public:
// construction/destruction
nes_sachen_sa72008_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
@@ -106,7 +106,7 @@ public:
// construction/destruction
nes_sachen_tca01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
virtual void pcb_reset() override;
@@ -124,9 +124,9 @@ public:
// construction/destruction
nes_sachen_tcu01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_m(offs_t offset, uint8_t data) override { write_l((offset + 0x100) & 0xfff, data); }
- virtual void write_h(offs_t offset, uint8_t data) override { write_l((offset + 0x100) & 0xfff, data); }
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override { write_l(space, (offset + 0x100) & 0xfff, data, mem_mask); }
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { write_l(space, (offset + 0x100) & 0xfff, data, mem_mask); }
virtual void pcb_reset() override;
@@ -144,8 +144,8 @@ public:
// construction/destruction
nes_sachen_tcu02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
@@ -166,8 +166,8 @@ public:
// construction/destruction
nes_sachen_74x374_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
@@ -191,8 +191,8 @@ public:
nes_sachen_74x374_alt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual uint8_t read_l(offs_t offset) override { return 0xff; } // no read_l here
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override { return 0xff; } // no read_l here
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
};
@@ -204,8 +204,8 @@ public:
// construction/destruction
nes_sachen_8259a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_m(offs_t offset, uint8_t data) override { write_l((offset + 0x100) & 0xfff, data); }
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override { write_l(space, (offset + 0x100) & 0xfff, data, mem_mask); }
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/somari.cpp b/src/devices/bus/nes/somari.cpp
index c517a4fae16..f4a5c2e7f40 100644
--- a/src/devices/bus/nes/somari.cpp
+++ b/src/devices/bus/nes/somari.cpp
@@ -157,7 +157,7 @@ void nes_somari_device::pcb_reset()
-------------------------------------------------*/
// MMC1 Mode emulation
-void nes_somari_device::mmc1_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_somari_device::mmc1_w)
{
assert(m_board_mode == 2);
@@ -191,7 +191,7 @@ void nes_somari_device::mmc1_w(offs_t offset, uint8_t data)
}
// MMC3 Mode emulation
-void nes_somari_device::mmc3_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_somari_device::mmc3_w)
{
uint8_t mmc_helper, cmd;
@@ -240,7 +240,7 @@ void nes_somari_device::mmc3_w(offs_t offset, uint8_t data)
}
// VRC2 Mode emulation
-void nes_somari_device::vrc2_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_somari_device::vrc2_w)
{
uint8_t bank, shift;
@@ -381,15 +381,15 @@ void nes_somari_device::update_mirror()
}
-void nes_somari_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_somari_device::write_h)
{
LOG_MMC(("somari write_h, mode %d, offset: %04x, data: %02x\n", m_board_mode, offset, data));
switch (m_board_mode)
{
- case SOMARI_VRC2_MODE: vrc2_w(offset, data); break;
- case SOMARI_MMC3_MODE: mmc3_w(offset, data); break;
- case SOMARI_MMC1_MODE: mmc1_w(offset, data); break;
+ case SOMARI_VRC2_MODE: vrc2_w(space, offset, data, mem_mask); break;
+ case SOMARI_MMC3_MODE: mmc3_w(space, offset, data, mem_mask); break;
+ case SOMARI_MMC1_MODE: mmc1_w(space, offset, data, mem_mask); break;
}
}
@@ -409,7 +409,7 @@ void nes_somari_device::bank_update_switchmode()
update_chr();
}
-void nes_somari_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_somari_device::write_m)
{
LOG_MMC(("somari write_m, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/somari.h b/src/devices/bus/nes/somari.h
index dda299b3a99..7b5d2920923 100644
--- a/src/devices/bus/nes/somari.h
+++ b/src/devices/bus/nes/somari.h
@@ -16,12 +16,12 @@ public:
// construction/destruction
nes_somari_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override { write_m(offset + 0x100, data); }
- virtual void write_m(offs_t offset, uint8_t data) override;
- void mmc1_w(offs_t offset, uint8_t data);
- void mmc3_w(offs_t offset, uint8_t data);
- void vrc2_w(offs_t offset, uint8_t data);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override { write_m(space, offset + 0x100, data, mem_mask); }
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(mmc1_w);
+ virtual DECLARE_WRITE8_MEMBER(mmc3_w);
+ virtual DECLARE_WRITE8_MEMBER(vrc2_w);
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/subor.cpp b/src/devices/bus/nes/subor.cpp
index 0fa25b2b5bb..c15e8761112 100644
--- a/src/devices/bus/nes/subor.cpp
+++ b/src/devices/bus/nes/subor.cpp
@@ -183,7 +183,7 @@ void nes_subor2_device::ppu_latch(offs_t offset)
nt
-------------------------------------------------*/
-uint8_t nes_subor2_device::nt_r(offs_t offset)
+READ8_MEMBER(nes_subor2_device::nt_r)
{
int page = ((offset & 0xc00) >> 10);
@@ -234,7 +234,7 @@ void nes_subor2_device::update_banks()
read
-------------------------------------------------*/
-uint8_t nes_subor2_device::read_l(offs_t offset)
+READ8_MEMBER(nes_subor2_device::read_l)
{
LOG_MMC("subor2 read_l, offset: %04x\n", offset);
@@ -242,14 +242,14 @@ uint8_t nes_subor2_device::read_l(offs_t offset)
{
return 0x8F;
}
- return get_open_bus();
+ return m_open_bus;
}
/*-------------------------------------------------
write
-------------------------------------------------*/
-void nes_subor0_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_subor0_device::write_h)
{
uint8_t subor_helper1, subor_helper2;
LOG_MMC("subor0 write_h, offset: %04x, data: %02x\n", offset, data);
@@ -279,7 +279,7 @@ void nes_subor0_device::write_h(offs_t offset, uint8_t data)
prg16_cdef(subor_helper2);
}
-void nes_subor1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_subor1_device::write_h)
{
uint8_t subor_helper1, subor_helper2;
LOG_MMC("subor1 write_h, offset: %04x, data: %02x\n", offset, data);
@@ -309,7 +309,7 @@ void nes_subor1_device::write_h(offs_t offset, uint8_t data)
prg16_cdef(subor_helper2);
}
-void nes_subor2_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_subor2_device::write_l)
{
LOG_MMC("subor2 write_l, offset: %04x, data: %02x\n", offset, data);
diff --git a/src/devices/bus/nes/subor.h b/src/devices/bus/nes/subor.h
index a4ffc13a553..93e542cf481 100644
--- a/src/devices/bus/nes/subor.h
+++ b/src/devices/bus/nes/subor.h
@@ -20,7 +20,7 @@ public:
// construction/destruction
nes_subor0_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -41,7 +41,7 @@ public:
// construction/destruction
nes_subor1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -62,9 +62,9 @@ public:
// construction/destruction
nes_subor2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t nt_r(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual uint8_t read_l(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(nt_r) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
virtual void ppu_latch(offs_t offset) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/sunsoft.cpp b/src/devices/bus/nes/sunsoft.cpp
index be90e36e535..f62fa24e67d 100644
--- a/src/devices/bus/nes/sunsoft.cpp
+++ b/src/devices/bus/nes/sunsoft.cpp
@@ -209,7 +209,7 @@ void nes_sunsoft_fme7_device::pcb_reset()
-------------------------------------------------*/
-void nes_sunsoft_1_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sunsoft_1_device::write_m)
{
LOG_MMC(("Sunsoft 1 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -235,7 +235,7 @@ void nes_sunsoft_1_device::write_m(offs_t offset, uint8_t data)
// there are two 'variants' depending on hardwired or mapper ctrl mirroring
-void nes_sunsoft_2_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sunsoft_2_device::write_h)
{
uint8_t helper = (data & 0x07) | ((data & 0x80) ? 0x08 : 0x00);
LOG_MMC(("Sunsoft 2 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -282,7 +282,7 @@ void nes_sunsoft_3_device::device_timer(emu_timer &timer, device_timer_id id, in
}
}
-void nes_sunsoft_3_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sunsoft_3_device::write_h)
{
LOG_MMC(("Sunsoft 3 write_h, offset %04x, data: %02x\n", offset, data));
@@ -384,7 +384,7 @@ void nes_sunsoft_4_device::sun4_mirror( int mirror, int mirr0, int mirr1 )
}
}
-void nes_sunsoft_4_device::sun4_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sunsoft_4_device::sun4_write)
{
LOG_MMC(("Sunsoft 4 write_h, offset %04x, data: %02x\n", offset, data));
@@ -424,7 +424,7 @@ void nes_sunsoft_4_device::sun4_write(offs_t offset, uint8_t data)
}
}
-void nes_sunsoft_4_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sunsoft_4_device::write_m)
{
LOG_MMC(("Sunsoft 4 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -434,7 +434,7 @@ void nes_sunsoft_4_device::write_m(offs_t offset, uint8_t data)
m_prgram[offset & (m_prgram.size() - 1)] = data;
}
-uint8_t nes_sunsoft_4_device::read_m(offs_t offset)
+READ8_MEMBER(nes_sunsoft_4_device::read_m)
{
LOG_MMC(("Sunsoft 4 read_m, offset: %04x\n", offset));
@@ -443,7 +443,7 @@ uint8_t nes_sunsoft_4_device::read_m(offs_t offset)
if (!m_prgram.empty() && m_wram_enable)
return m_prgram[offset & (m_prgram.size() - 1)];
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
/*-------------------------------------------------
@@ -475,7 +475,7 @@ void nes_sunsoft_fme7_device::device_timer(emu_timer &timer, device_timer_id id,
}
}
-void nes_sunsoft_fme7_device::fme7_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sunsoft_fme7_device::fme7_write)
{
LOG_MMC(("fme7_write, offset %04x, data: %02x\n", offset, data));
@@ -533,7 +533,7 @@ void nes_sunsoft_fme7_device::fme7_write(offs_t offset, uint8_t data)
}
}
-void nes_sunsoft_fme7_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sunsoft_fme7_device::write_m)
{
uint8_t bank = m_wram_bank & 0x3f;
LOG_MMC(("Sunsoft FME7 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -549,7 +549,7 @@ void nes_sunsoft_fme7_device::write_m(offs_t offset, uint8_t data)
}
}
-uint8_t nes_sunsoft_fme7_device::read_m(offs_t offset)
+READ8_MEMBER(nes_sunsoft_fme7_device::read_m)
{
uint8_t bank = m_wram_bank & 0x3f;
LOG_MMC(("Sunsoft FME7 read_m, offset: %04x\n", offset));
@@ -564,7 +564,7 @@ uint8_t nes_sunsoft_fme7_device::read_m(offs_t offset)
return m_prgram[((bank * 0x2000) + offset) & (m_prgram.size() - 1)];
}
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
@@ -578,20 +578,20 @@ uint8_t nes_sunsoft_fme7_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_sunsoft_5_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sunsoft_5_device::write_h)
{
LOG_MMC(("sunsoft 5 write_h, offset %04x, data: %02x\n", offset, data));
switch (offset & 0x6000)
{
case 0x4000:
- m_ym2149->address_w(data & 0x0f);
+ m_ym2149->address_w(space, 0, data & 0x0f);
break;
case 0x6000:
- m_ym2149->data_w(data);
+ m_ym2149->data_w(space, 0, data);
break;
default:
- fme7_write(offset, data);
+ fme7_write(space, offset, data, mem_mask);
break;
}
}
diff --git a/src/devices/bus/nes/sunsoft.h b/src/devices/bus/nes/sunsoft.h
index c02b94647cf..b4b035d515d 100644
--- a/src/devices/bus/nes/sunsoft.h
+++ b/src/devices/bus/nes/sunsoft.h
@@ -17,7 +17,7 @@ public:
// construction/destruction
nes_sunsoft_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -35,7 +35,7 @@ public:
// construction/destruction
nes_sunsoft_2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -53,7 +53,7 @@ public:
// construction/destruction
nes_sunsoft_3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -78,10 +78,10 @@ public:
// construction/destruction
nes_sunsoft_4_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- void sun4_write(offs_t offset, uint8_t data);
- virtual void write_h(offs_t offset, uint8_t data) override { sun4_write(offset, data); }
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(sun4_write);
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { sun4_write(space, offset, data, mem_mask); }
virtual void pcb_reset() override;
@@ -104,10 +104,10 @@ public:
// construction/destruction
nes_sunsoft_fme7_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- void fme7_write(offs_t offset, uint8_t data);
- virtual void write_h(offs_t offset, uint8_t data) override { fme7_write(offset, data); }
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(fme7_write);
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { fme7_write(space, offset, data, mem_mask); }
virtual void pcb_reset() override;
@@ -138,7 +138,7 @@ public:
// construction/destruction
nes_sunsoft_5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
protected:
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/bus/nes/sunsoft_dcs.cpp b/src/devices/bus/nes/sunsoft_dcs.cpp
index 23c81894666..5df2c6557d2 100644
--- a/src/devices/bus/nes/sunsoft_dcs.cpp
+++ b/src/devices/bus/nes/sunsoft_dcs.cpp
@@ -68,10 +68,10 @@ void nes_ntb_slot_device::device_start()
m_cart = dynamic_cast<ntb_cart_interface *>(get_card_device());
}
-uint8_t nes_ntb_slot_device::read(offs_t offset)
+READ8_MEMBER(nes_ntb_slot_device::read)
{
if (m_cart)
- return m_cart->read(offset);
+ return m_cart->read(space, offset, mem_mask);
return 0xff;
}
@@ -212,7 +212,7 @@ void nes_sunsoft_dcs_device::pcb_reset()
-------------------------------------------------*/
-void nes_sunsoft_dcs_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sunsoft_dcs_device::write_h)
{
LOG_MMC(("Sunsoft DCS write_h, offset %04x, data: %02x\n", offset, data));
@@ -224,27 +224,27 @@ void nes_sunsoft_dcs_device::write_h(offs_t offset, uint8_t data)
m_wram_enable = BIT(data, 4);
break;
default:
- sun4_write(offset, data);
+ sun4_write(space, offset, data, mem_mask);
break;
}
}
-uint8_t nes_sunsoft_dcs_device::read_h(offs_t offset)
+READ8_MEMBER(nes_sunsoft_dcs_device::read_h)
{
LOG_MMC(("Sunsoft DCS read_h, offset: %04x\n", offset));
if (m_exrom_enable && m_subslot->m_cart && offset < 0x4000)
{
if (m_timer_on)
- return m_subslot->m_cart->read(offset);
+ return m_subslot->m_cart->read(space, offset, mem_mask);
else
- return get_open_bus(); // after the timer is off, this returns open bus...
+ return m_open_bus; // after the timer is off, this returns open bus...
}
else
return hi_access_rom(offset);
}
-void nes_sunsoft_dcs_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_sunsoft_dcs_device::write_m)
{
LOG_MMC(("Sunsoft DCS write_m, offset: %04x, data: %02x\n", offset, data));
@@ -260,7 +260,7 @@ void nes_sunsoft_dcs_device::write_m(offs_t offset, uint8_t data)
}
}
-uint8_t nes_sunsoft_dcs_device::read_m(offs_t offset)
+READ8_MEMBER(nes_sunsoft_dcs_device::read_m)
{
LOG_MMC(("Sunsoft DCS read_m, offset: %04x\n", offset));
@@ -269,7 +269,7 @@ uint8_t nes_sunsoft_dcs_device::read_m(offs_t offset)
if (!m_prgram.empty() && m_wram_enable)
return m_prgram[offset & (m_prgram.size() - 1)];
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
@@ -285,10 +285,9 @@ static void ntb_cart(device_slot_interface &device)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nes_sunsoft_dcs_device::device_add_mconfig(machine_config &config)
-{
- NES_NTB_SLOT(config, m_subslot, ntb_cart);
-}
+MACHINE_CONFIG_START(nes_sunsoft_dcs_device::device_add_mconfig)
+ MCFG_NTB_MINICART_ADD("ntb_slot", ntb_cart)
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/nes/sunsoft_dcs.h b/src/devices/bus/nes/sunsoft_dcs.h
index 51a11b22ae4..f14d9f9c8c1 100644
--- a/src/devices/bus/nes/sunsoft_dcs.h
+++ b/src/devices/bus/nes/sunsoft_dcs.h
@@ -24,7 +24,7 @@ public:
virtual ~ntb_cart_interface();
// reading and writing
- virtual uint8_t read(offs_t offset) { return m_rom[offset]; }
+ virtual DECLARE_READ8_MEMBER(read) { return m_rom[offset]; }
uint8_t *get_cart_base() { return m_rom; }
@@ -46,16 +46,6 @@ class nes_ntb_slot_device : public device_t,
friend class nes_sunsoft_dcs_device;
public:
// construction/destruction
- template <typename T>
- nes_ntb_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts)
- : nes_ntb_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(nullptr);
- set_fixed(false);
- }
-
nes_ntb_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~nes_ntb_slot_device();
@@ -78,7 +68,7 @@ public:
// slot interface overrides
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
- virtual uint8_t read(offs_t offset);
+ virtual DECLARE_READ8_MEMBER(read);
protected:
ntb_cart_interface* m_cart;
@@ -88,6 +78,11 @@ protected:
DECLARE_DEVICE_TYPE(NES_NTB_SLOT, nes_ntb_slot_device)
+#define MCFG_NTB_MINICART_ADD(_tag, _slot_intf) \
+ MCFG_DEVICE_ADD(_tag, NES_NTB_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, nullptr, false)
+
+
//-----------------------------------------------
//
// Nantettate!! Baseball Minicart implementation
@@ -133,10 +128,10 @@ public:
// construction/destruction
nes_sunsoft_dcs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/taito.cpp b/src/devices/bus/nes/taito.cpp
index 28c37b6109c..2868bfea1dc 100644
--- a/src/devices/bus/nes/taito.cpp
+++ b/src/devices/bus/nes/taito.cpp
@@ -172,7 +172,7 @@ void nes_x1_017_device::pcb_reset()
-------------------------------------------------*/
-void nes_tc0190fmc_device::tc0190fmc_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_tc0190fmc_device::tc0190fmc_write)
{
LOG_MMC(("tc0190fmc_write, offset: %04x, data: %02x\n", offset, data));
@@ -240,7 +240,7 @@ void nes_tc0190fmc_pal16r4_device::hblank_irq( int scanline, int vblank, int bla
}
}
-void nes_tc0190fmc_pal16r4_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_tc0190fmc_pal16r4_device::write_h)
{
LOG_MMC(("tc0190fmc pal16r4 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -256,7 +256,7 @@ void nes_tc0190fmc_pal16r4_device::write_h(offs_t offset, uint8_t data)
case 0x2001:
case 0x2002:
case 0x2003:
- tc0190fmc_write(offset, data);
+ tc0190fmc_write(space, offset, data, mem_mask);
break;
case 0x4000:
m_irq_count_latch = (0x100 - data) & 0xff;
@@ -291,7 +291,7 @@ void nes_tc0190fmc_pal16r4_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_x1_005_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_x1_005_device::write_m)
{
LOG_MMC(("x1_005 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -355,14 +355,14 @@ void nes_x1_005_device::write_m(offs_t offset, uint8_t data)
m_x1_005_ram[offset & 0x7f] = data;
}
-uint8_t nes_x1_005_device::read_m(offs_t offset)
+READ8_MEMBER(nes_x1_005_device::read_m)
{
LOG_MMC(("x1_005 read_m, offset: %04x\n", offset));
if (offset >= 0x1f00 && m_latch == 0xa3)
return m_x1_005_ram[offset & 0x7f];
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
/*-------------------------------------------------
@@ -399,7 +399,7 @@ void nes_x1_017_device::set_chr()
chr1_x(7 ^ m_latch, m_mmc_vrom_bank[5], CHRROM);
}
-void nes_x1_017_device::write_m(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_x1_017_device::write_m)
{
LOG_MMC(("x1017 write_m, offset: %04x, data: %02x\n", offset, data));
@@ -453,7 +453,7 @@ void nes_x1_017_device::write_m(offs_t offset, uint8_t data)
m_x1_017_ram[0x1000 + (offset & 0x3ff)] = data;
}
-uint8_t nes_x1_017_device::read_m(offs_t offset)
+READ8_MEMBER(nes_x1_017_device::read_m)
{
LOG_MMC(("x1017 read_m, offset: %04x\n", offset));
@@ -465,5 +465,5 @@ uint8_t nes_x1_017_device::read_m(offs_t offset)
if (offset < 0x1400 && m_reg[2] == 0x84)
return m_x1_017_ram[0x1000 + (offset & 0x3ff)];
- return get_open_bus(); // open bus
+ return m_open_bus; // open bus
}
diff --git a/src/devices/bus/nes/taito.h b/src/devices/bus/nes/taito.h
index b4efa553c86..8f3ccb2a8ee 100644
--- a/src/devices/bus/nes/taito.h
+++ b/src/devices/bus/nes/taito.h
@@ -16,8 +16,8 @@ public:
// construction/destruction
nes_tc0190fmc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void tc0190fmc_write(offs_t offset, uint8_t data);
- virtual void write_h(offs_t offset, uint8_t data) override { tc0190fmc_write(offset, data); }
+ virtual DECLARE_WRITE8_MEMBER(tc0190fmc_write);
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { tc0190fmc_write(space, offset, data, mem_mask); }
virtual void pcb_reset() override;
@@ -37,7 +37,7 @@ public:
// construction/destruction
nes_tc0190fmc_pal16r4_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
@@ -60,8 +60,8 @@ public:
// construction/destruction
nes_x1_005_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
@@ -84,8 +84,8 @@ public:
// construction/destruction
nes_x1_017_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_m(offs_t offset) override;
- virtual void write_m(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_m) override;
+ virtual DECLARE_WRITE8_MEMBER(write_m) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/tengen.cpp b/src/devices/bus/nes/tengen.cpp
index f6228685796..9cef09434a0 100644
--- a/src/devices/bus/nes/tengen.cpp
+++ b/src/devices/bus/nes/tengen.cpp
@@ -126,7 +126,7 @@ void nes_tengen032_device::pcb_reset()
-------------------------------------------------*/
-void nes_tengen008_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_tengen008_device::write_h)
{
LOG_MMC(("tengen008 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -240,7 +240,7 @@ void nes_tengen032_device::set_chr()
chr_cb(7 ^ chr_page, m_mmc_vrom_bank[5], CHRROM);
}
-void nes_tengen032_device::tengen032_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_tengen032_device::tengen032_write)
{
uint8_t helper, cmd;
LOG_MMC(("tengen032_write, offset: %04x, data: %02x\n", offset, data));
@@ -359,7 +359,7 @@ void nes_tengen037_device::chr_cb( int start, int bank, int source )
}
-void nes_tengen037_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_tengen037_device::write_h)
{
LOG_MMC(("tengen037 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -369,7 +369,7 @@ void nes_tengen037_device::write_h(offs_t offset, uint8_t data)
break;
default:
- tengen032_write(offset, data);
+ tengen032_write(space, offset, data, mem_mask);
break;
}
}
diff --git a/src/devices/bus/nes/tengen.h b/src/devices/bus/nes/tengen.h
index 6d651339f86..dce41f4fbb4 100644
--- a/src/devices/bus/nes/tengen.h
+++ b/src/devices/bus/nes/tengen.h
@@ -14,7 +14,7 @@ public:
// construction/destruction
nes_tengen008_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -32,8 +32,8 @@ public:
// construction/destruction
nes_tengen032_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void tengen032_write(offs_t offset, uint8_t data);
- virtual void write_h(offs_t offset, uint8_t data) override { tengen032_write(offset, data); }
+ virtual DECLARE_WRITE8_MEMBER(tengen032_write);
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { tengen032_write(space, offset, data, mem_mask); }
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
@@ -74,7 +74,7 @@ public:
nes_tengen037_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void chr_cb(int start, int bank, int source) override;
protected:
diff --git a/src/devices/bus/nes/txc.cpp b/src/devices/bus/nes/txc.cpp
index 4149c6262a3..f3ab8efc5f9 100644
--- a/src/devices/bus/nes/txc.cpp
+++ b/src/devices/bus/nes/txc.cpp
@@ -139,7 +139,7 @@ void nes_txc_commandos_device::pcb_reset()
-------------------------------------------------*/
-void nes_txc_22211_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_txc_22211_device::write_l)
{
LOG_MMC(("TXC 22111 write_l, offset: %04x, data: %02x\n", offset, data));
@@ -147,7 +147,7 @@ void nes_txc_22211_device::write_l(offs_t offset, uint8_t data)
m_reg[offset & 0x03] = data;
}
-uint8_t nes_txc_22211_device::read_l(offs_t offset)
+READ8_MEMBER(nes_txc_22211_device::read_l)
{
LOG_MMC(("TXC 22111 read_l, offset: %04x\n", offset));
@@ -157,7 +157,7 @@ uint8_t nes_txc_22211_device::read_l(offs_t offset)
return 0x00;
}
-void nes_txc_22211_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_txc_22211_device::write_h)
{
LOG_MMC(("TXC 22111 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -180,7 +180,7 @@ void nes_txc_22211_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_txc_dumarc_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_txc_dumarc_device::write_h)
{
LOG_MMC(("TXC Du Ma Racing write_h, offset: %04x, data: %02x\n", offset, data));
@@ -203,7 +203,7 @@ void nes_txc_dumarc_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-uint8_t nes_txc_mjblock_device::read_l(offs_t offset)
+READ8_MEMBER(nes_txc_mjblock_device::read_l)
{
LOG_MMC(("TXC mjblock read_l, offset: %04x\n", offset));
@@ -226,7 +226,7 @@ uint8_t nes_txc_mjblock_device::read_l(offs_t offset)
-------------------------------------------------*/
-void nes_txc_strikew_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_txc_strikew_device::write_h)
{
LOG_MMC(("TXC Strike Wolf write_h, offset: %04x, data: %02x\n", offset, data));
@@ -256,12 +256,12 @@ void nes_txc_strikew_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-uint8_t nes_txc_commandos_device::read_l(offs_t offset)
+READ8_MEMBER(nes_txc_commandos_device::read_l)
{
return 0x50;
}
-void nes_txc_commandos_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_txc_commandos_device::write_h)
{
LOG_MMC(("TXC Commandos write_h, offset: %04x, data: %02x\n", offset, data));
diff --git a/src/devices/bus/nes/txc.h b/src/devices/bus/nes/txc.h
index 9ad5e2807dc..f4b875b51ba 100644
--- a/src/devices/bus/nes/txc.h
+++ b/src/devices/bus/nes/txc.h
@@ -16,9 +16,9 @@ public:
// construction/destruction
nes_txc_22211_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -41,7 +41,7 @@ public:
nes_txc_dumarc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
};
@@ -54,7 +54,7 @@ public:
nes_txc_mjblock_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual uint8_t read_l(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
};
@@ -66,7 +66,7 @@ public:
// construction/destruction
nes_txc_strikew_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -84,8 +84,8 @@ public:
// construction/destruction
nes_txc_commandos_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/waixing.cpp b/src/devices/bus/nes/waixing.cpp
index 3706d64b26e..791779f0a76 100644
--- a/src/devices/bus/nes/waixing.cpp
+++ b/src/devices/bus/nes/waixing.cpp
@@ -433,7 +433,7 @@ void nes_waixing_a1_device::chr_cb(int start, int bank, int source)
chr1_x(start, bank, chr_src);
}
-void nes_waixing_a_device::waixing_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_a_device::waixing_write)
{
LOG_MMC(("waixing_write, offset: %04x, data: %02x\n", offset, data));
@@ -447,12 +447,12 @@ void nes_waixing_a_device::waixing_write(offs_t offset, uint8_t data)
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
-uint8_t nes_waixing_a_device::read_l(offs_t offset)
+READ8_MEMBER(nes_waixing_a_device::read_l)
{
LOG_MMC(("waixing read_l, offset: %04x\n", offset));
offset += 0x100;
@@ -462,7 +462,7 @@ uint8_t nes_waixing_a_device::read_l(offs_t offset)
return 0xff;
}
-void nes_waixing_a_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_a_device::write_l)
{
LOG_MMC(("waixing write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -597,7 +597,7 @@ void nes_waixing_f_device::set_prg( int prg_base, int prg_mask )
prg_cb(3, m_mmc_prg_bank[3]);
}
-void nes_waixing_f_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_f_device::write_h)
{
uint8_t cmd;
LOG_MMC(("waixing_f write_h, offset: %04x, data: %02x\n", offset, data));
@@ -628,7 +628,7 @@ void nes_waixing_f_device::write_h(offs_t offset, uint8_t data)
break;
default:
- waixing_write(offset, data);
+ waixing_write(space, offset, data, mem_mask);
break;
}
}
@@ -668,7 +668,7 @@ void nes_waixing_g_device::set_chr(uint8_t chr, int chr_base, int chr_mask)
chr_cb(chr_page ^ 7, chr_base | (m_mmc_vrom_bank[5] & chr_mask), chr);
}
-void nes_waixing_g_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_g_device::write_h)
{
uint8_t cmd;
LOG_MMC(("waixing_g write_h, offset: %04x, data: %02x\n", offset, data));
@@ -699,7 +699,7 @@ void nes_waixing_g_device::write_h(offs_t offset, uint8_t data)
break;
default:
- waixing_write(offset, data);
+ waixing_write(space, offset, data, mem_mask);
break;
}
}
@@ -731,7 +731,7 @@ void nes_waixing_h_device::chr_cb(int start, int bank, int source)
chr1_x(start, bank, source);
}
-void nes_waixing_h_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_h_device::write_h)
{
uint8_t cmd;
LOG_MMC(("waixing_h write_h, offset: %04x, data: %02x\n", offset, data));
@@ -767,12 +767,12 @@ void nes_waixing_h_device::write_h(offs_t offset, uint8_t data)
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
-void nes_waixing_h1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_h1_device::write_h)
{
uint8_t cmd;
LOG_MMC(("waixing_h1 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -805,7 +805,7 @@ void nes_waixing_h1_device::write_h(offs_t offset, uint8_t data)
break;
default:
- txrom_write(offset, data);
+ txrom_write(space, offset, data, mem_mask);
break;
}
}
@@ -832,7 +832,7 @@ void nes_waixing_j_device::set_prg( int prg_base, int prg_mask )
prg_cb(3, m_reg[3]);
}
-void nes_waixing_j_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_j_device::write_h)
{
uint8_t cmd;
LOG_MMC(("waixing_f write_h, offset: %04x, data: %02x\n", offset, data));
@@ -862,7 +862,7 @@ void nes_waixing_j_device::write_h(offs_t offset, uint8_t data)
// break;
default:
- waixing_write(offset, data);
+ waixing_write(space, offset, data, mem_mask);
break;
}
}
@@ -887,7 +887,7 @@ void nes_waixing_sh2_device::chr_cb(int start, int bank, int source)
chr4_4(m_reg[1], m_reg[1] ? CHRRAM : CHRROM);
}
-uint8_t nes_waixing_sh2_device::chr_r(offs_t offset)
+READ8_MEMBER(nes_waixing_sh2_device::chr_r)
{
int bank = offset >> 10;
uint8_t val = m_chr_access[bank][offset & 0x3ff]; // this would be usual return value
@@ -940,7 +940,7 @@ void nes_waixing_sec_device::chr_cb(int start, int bank, int source)
chr1_x(start, bank, source);
}
-void nes_waixing_sec_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_sec_device::write_l)
{
LOG_MMC(("waixing_sec write_l, offset: %04x, data: %02x\n", offset, data));
offset += 0x100;
@@ -979,7 +979,7 @@ void nes_waixing_sgz_device::hblank_irq(int scanline, int vblank, int blanked)
}
}
-void nes_waixing_sgz_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_sgz_device::write_h)
{
uint8_t helper, bank;
LOG_MMC(("waixing_sgz write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1047,7 +1047,7 @@ void nes_waixing_sgz_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_waixing_sgzlz_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_sgzlz_device::write_l)
{
LOG_MMC(("waixing_sgzlz write_l, offset: %04x, data: %02x\n", offset, data));
if (offset >= 0x700 && offset <= 0xEFF)
@@ -1112,7 +1112,7 @@ void nes_waixing_sgzlz_device::write_l(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_waixing_ffv_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_ffv_device::write_l)
{
uint8_t helper;
LOG_MMC(("waixing_ffv write_l, offset: %04x, data: %02x\n", offset, data));
@@ -1161,7 +1161,7 @@ void nes_waixing_ffv_device::write_l(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_waixing_wxzs_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_wxzs_device::write_h)
{
LOG_MMC(("waixing_zs write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1191,7 +1191,7 @@ void nes_waixing_wxzs_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_waixing_dq8_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_dq8_device::write_h)
{
LOG_MMC(("waixing_dq8 write_h, offset: %04x, data: %02x\n", offset, data));
@@ -1212,7 +1212,7 @@ void nes_waixing_dq8_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_waixing_wxzs2_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_wxzs2_device::write_h)
{
uint8_t flip = (data & 0x80) >> 7;
uint8_t helper = (data & 0x7f) << 1;
@@ -1265,7 +1265,7 @@ void nes_waixing_wxzs2_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_waixing_fs304_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_waixing_fs304_device::write_l)
{
LOG_MMC(("fs304 write_l, offset: %04x, data: %02x\n", offset, data));
int bank;
diff --git a/src/devices/bus/nes/waixing.h b/src/devices/bus/nes/waixing.h
index bb6fcaf831a..5488973a14c 100644
--- a/src/devices/bus/nes/waixing.h
+++ b/src/devices/bus/nes/waixing.h
@@ -16,10 +16,10 @@ public:
// construction/destruction
nes_waixing_a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t read_l(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void waixing_write(offs_t offset, uint8_t data);
- virtual void write_h(offs_t offset, uint8_t data) override { waixing_write(offset, data); }
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(waixing_write);
+ virtual DECLARE_WRITE8_MEMBER(write_h) override { waixing_write(space, offset, data, mem_mask); }
virtual void chr_cb(int start, int bank, int source) override;
virtual void pcb_reset() override;
@@ -109,7 +109,7 @@ public:
nes_waixing_f_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
@@ -129,7 +129,7 @@ public:
nes_waixing_g_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void chr_cb(int start, int bank, int source) override;
virtual void pcb_reset() override;
@@ -155,7 +155,7 @@ protected:
nes_waixing_h_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
};
@@ -168,7 +168,7 @@ public:
nes_waixing_h1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
// This variant does not ignore the wram protect!
};
@@ -194,7 +194,7 @@ public:
// construction/destruction
nes_waixing_j_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -217,7 +217,7 @@ public:
// device-level overrides
virtual void device_start() override;
- virtual uint8_t chr_r(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(chr_r) override;
virtual void chr_cb(int start, int bank, int source) override;
virtual void pcb_reset() override;
@@ -235,7 +235,7 @@ public:
// construction/destruction
nes_waixing_sec_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void prg_cb(int start, int bank) override;
virtual void chr_cb(int start, int bank, int source) override;
@@ -257,7 +257,7 @@ public:
// construction/destruction
nes_waixing_sgz_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void hblank_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
@@ -281,7 +281,7 @@ public:
// construction/destruction
nes_waixing_sgzlz_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
@@ -301,7 +301,7 @@ public:
// construction/destruction
nes_waixing_ffv_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
@@ -321,7 +321,7 @@ public:
// construction/destruction
nes_waixing_wxzs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -339,7 +339,7 @@ public:
// construction/destruction
nes_waixing_dq8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -357,7 +357,7 @@ public:
// construction/destruction
nes_waixing_wxzs2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
@@ -375,7 +375,7 @@ public:
// construction/destruction
nes_waixing_fs304_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void write_l(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/zemina.cpp b/src/devices/bus/nes/zemina.cpp
index 22741967572..bb4b3b61bc0 100644
--- a/src/devices/bus/nes/zemina.cpp
+++ b/src/devices/bus/nes/zemina.cpp
@@ -80,7 +80,7 @@ void nes_zemina_device::pcb_reset()
write
-------------------------------------------------*/
-void nes_zemina_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nes_zemina_device::write_h)
{
LOG_MMC("zemina write_h, offset: %04x, data: %02x\n", offset, data);
diff --git a/src/devices/bus/nes/zemina.h b/src/devices/bus/nes/zemina.h
index 752c7f1382d..87d170d053d 100644
--- a/src/devices/bus/nes/zemina.h
+++ b/src/devices/bus/nes/zemina.h
@@ -20,7 +20,7 @@ public:
// device-level overrides
virtual void device_start() override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
virtual void pcb_reset() override;
};
diff --git a/src/devices/bus/nes_ctrl/fckeybrd.cpp b/src/devices/bus/nes_ctrl/fckeybrd.cpp
index 5633254c8fb..9c81fbea67e 100644
--- a/src/devices/bus/nes_ctrl/fckeybrd.cpp
+++ b/src/devices/bus/nes_ctrl/fckeybrd.cpp
@@ -123,12 +123,11 @@ ioport_constructor nes_fckeybrd_device::device_input_ports() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nes_fckeybrd_device::device_add_mconfig(machine_config &config)
-{
- CASSETTE(config, m_cassette);
- m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED);
- m_cassette->set_interface("fc_cass");
-}
+MACHINE_CONFIG_START(nes_fckeybrd_device::device_add_mconfig)
+ MCFG_CASSETTE_ADD("tape")
+ MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
+ MCFG_CASSETTE_INTERFACE("fc_cass")
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/nes_ctrl/miracle.cpp b/src/devices/bus/nes_ctrl/miracle.cpp
index d9f445f58ef..6f41774f1e0 100644
--- a/src/devices/bus/nes_ctrl/miracle.cpp
+++ b/src/devices/bus/nes_ctrl/miracle.cpp
@@ -22,12 +22,12 @@
DEFINE_DEVICE_TYPE(NES_MIRACLE, nes_miracle_device, "nes_miracle", "NES Miracle Piano Controller")
-void nes_miracle_device::device_add_mconfig(machine_config &config)
-{
- MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(FUNC(nes_miracle_device::rx_w));
+MACHINE_CONFIG_START(nes_miracle_device::device_add_mconfig)
+ MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
+ MCFG_MIDI_RX_HANDLER(WRITELINE(*this, nes_miracle_device, rx_w))
- MIDI_PORT(config, "mdout", midiout_slot, "midiout");
-}
+ MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/newbrain/eim.cpp b/src/devices/bus/newbrain/eim.cpp
index 3f0b7a19ee0..2bafd008eb6 100644
--- a/src/devices/bus/newbrain/eim.cpp
+++ b/src/devices/bus/newbrain/eim.cpp
@@ -67,15 +67,14 @@ const tiny_rom_entry *newbrain_eim_device::device_rom_region() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void newbrain_eim_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(newbrain_eim_device::device_add_mconfig)
// devices
Z80CTC(config, m_ctc, XTAL(16'000'000)/8);
m_ctc->zc_callback<0>().set(m_acia, FUNC(acia6850_device::write_rxc));
m_ctc->zc_callback<1>().set(m_acia, FUNC(acia6850_device::write_txc));
m_ctc->zc_callback<2>().set(FUNC(newbrain_eim_device::ctc_z2_w));
- TIMER(config, "z80ctc_c2").configure_periodic(FUNC(newbrain_eim_device::ctc_c2_tick), attotime::from_hz(XTAL(16'000'000)/4/13));
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("z80ctc_c2", newbrain_eim_device, ctc_c2_tick, attotime::from_hz(XTAL(16'000'000)/4/13))
adc0809_device &adc(ADC0809(config, ADC0809_TAG, 500000));
adc.eoc_callback().set(FUNC(newbrain_eim_device::adc_eoc_w));
@@ -93,11 +92,11 @@ void newbrain_eim_device::device_add_mconfig(machine_config &config)
RS232_PORT(config, RS232_TAG, default_rs232_devices, nullptr);
- NEWBRAIN_EXPANSION_SLOT(config, m_exp, XTAL(16'000'000)/8, newbrain_expansion_cards, "fdc");
+ MCFG_NEWBRAIN_EXPANSION_SLOT_ADD(NEWBRAIN_EXPANSION_SLOT_TAG, XTAL(16'000'000)/8, newbrain_expansion_cards, "fdc")
// internal ram
RAM(config, RAM_TAG).set_default_size("96K");
-}
+MACHINE_CONFIG_END
//**************************************************************************
@@ -145,9 +144,9 @@ void newbrain_eim_device::device_reset()
// mreq_r - memory request read
//-------------------------------------------------
-uint8_t newbrain_eim_device::mreq_r(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh)
+uint8_t newbrain_eim_device::mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh)
{
- return m_exp->mreq_r(offset, data, romov, exrm, raminh);
+ return m_exp->mreq_r(space, offset, data, romov, exrm, raminh);
}
@@ -155,9 +154,9 @@ uint8_t newbrain_eim_device::mreq_r(offs_t offset, uint8_t data, bool &romov, in
// mreq_w - memory request write
//-------------------------------------------------
-void newbrain_eim_device::mreq_w(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh)
+void newbrain_eim_device::mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh)
{
- m_exp->mreq_w(offset, data, romov, exrm, raminh);
+ m_exp->mreq_w(space, offset, data, romov, exrm, raminh);
}
@@ -165,9 +164,9 @@ void newbrain_eim_device::mreq_w(offs_t offset, uint8_t data, bool &romov, int &
// iorq_r - I/O request read
//-------------------------------------------------
-uint8_t newbrain_eim_device::iorq_r(offs_t offset, uint8_t data, bool &prtov)
+uint8_t newbrain_eim_device::iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov)
{
- return m_exp->iorq_r(offset, data, prtov);
+ return m_exp->iorq_r(space, offset, data, prtov);
}
@@ -175,9 +174,9 @@ uint8_t newbrain_eim_device::iorq_r(offs_t offset, uint8_t data, bool &prtov)
// iorq_w - I/O request write
//-------------------------------------------------
-void newbrain_eim_device::iorq_w(offs_t offset, uint8_t data, bool &prtov)
+void newbrain_eim_device::iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov)
{
- m_exp->iorq_w(offset, data, prtov);
+ m_exp->iorq_w(space, offset, data, prtov);
}
diff --git a/src/devices/bus/newbrain/eim.h b/src/devices/bus/newbrain/eim.h
index 19b456338fd..3e83b22112e 100644
--- a/src/devices/bus/newbrain/eim.h
+++ b/src/devices/bus/newbrain/eim.h
@@ -48,10 +48,10 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_newbrain_expansion_slot_interface overrides
- virtual uint8_t mreq_r(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) override;
- virtual void mreq_w(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) override;
- virtual uint8_t iorq_r(offs_t offset, uint8_t data, bool &prtov) override;
- virtual void iorq_w(offs_t offset, uint8_t data, bool &prtov) override;
+ virtual uint8_t mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) override;
+ virtual void mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) override;
+ virtual uint8_t iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov) override;
+ virtual void iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov) override;
private:
DECLARE_WRITE_LINE_MEMBER( acia_interrupt );
diff --git a/src/devices/bus/newbrain/exp.cpp b/src/devices/bus/newbrain/exp.cpp
index a1a9e2210ed..b4675c3b89f 100644
--- a/src/devices/bus/newbrain/exp.cpp
+++ b/src/devices/bus/newbrain/exp.cpp
@@ -77,11 +77,11 @@ void newbrain_expansion_slot_device::device_reset()
// mreq_r - memory request read
//-------------------------------------------------
-uint8_t newbrain_expansion_slot_device::mreq_r(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh)
+uint8_t newbrain_expansion_slot_device::mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh)
{
if (m_card != nullptr)
{
- data = m_card->mreq_r(offset, data, romov, exrm, raminh);
+ data = m_card->mreq_r(space, offset, data, romov, exrm, raminh);
}
return data;
@@ -92,11 +92,11 @@ uint8_t newbrain_expansion_slot_device::mreq_r(offs_t offset, uint8_t data, bool
// mreq_w - memory request write
//-------------------------------------------------
-void newbrain_expansion_slot_device::mreq_w(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh)
+void newbrain_expansion_slot_device::mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh)
{
if (m_card != nullptr)
{
- m_card->mreq_w(offset, data, romov, exrm, raminh);
+ m_card->mreq_w(space, offset, data, romov, exrm, raminh);
}
}
@@ -105,11 +105,11 @@ void newbrain_expansion_slot_device::mreq_w(offs_t offset, uint8_t data, bool &r
// iorq_r - I/O request read
//-------------------------------------------------
-uint8_t newbrain_expansion_slot_device::iorq_r(offs_t offset, uint8_t data, bool &prtov)
+uint8_t newbrain_expansion_slot_device::iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov)
{
if (m_card != nullptr)
{
- data = m_card->iorq_r(offset, data, prtov);
+ data = m_card->iorq_r(space, offset, data, prtov);
}
return data;
@@ -120,11 +120,11 @@ uint8_t newbrain_expansion_slot_device::iorq_r(offs_t offset, uint8_t data, bool
// iorq_w - I/O request write
//-------------------------------------------------
-void newbrain_expansion_slot_device::iorq_w(offs_t offset, uint8_t data, bool &prtov)
+void newbrain_expansion_slot_device::iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov)
{
if (m_card != nullptr)
{
- m_card->iorq_w(offset, data, prtov);
+ m_card->iorq_w(space, offset, data, prtov);
}
}
diff --git a/src/devices/bus/newbrain/exp.h b/src/devices/bus/newbrain/exp.h
index e9e56c1bd66..e3ab89a35ef 100644
--- a/src/devices/bus/newbrain/exp.h
+++ b/src/devices/bus/newbrain/exp.h
@@ -49,6 +49,17 @@
#define NEWBRAIN_EXPANSION_SLOT_TAG "exp"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_NEWBRAIN_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, NEWBRAIN_EXPANSION_SLOT, _clock) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -62,24 +73,14 @@ class newbrain_expansion_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- newbrain_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock, T &&opts, char const *dflt)
- : newbrain_expansion_slot_device(mconfig, tag, owner, clock)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
newbrain_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// computer interface
- uint8_t mreq_r(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh);
- void mreq_w(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh);
+ uint8_t mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh);
+ void mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh);
- uint8_t iorq_r(offs_t offset, uint8_t data, bool &prtov);
- void iorq_w(offs_t offset, uint8_t data, bool &prtov);
+ uint8_t iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov);
+ void iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov);
protected:
// device-level overrides
@@ -97,12 +98,12 @@ class device_newbrain_expansion_slot_interface : public device_slot_card_interfa
{
public:
// memory access
- virtual uint8_t mreq_r(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { return data; }
- virtual void mreq_w(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { }
+ virtual uint8_t mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { return data; }
+ virtual void mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { }
// I/O access
- virtual uint8_t iorq_r(offs_t offset, uint8_t data, bool &prtov) { return data; }
- virtual void iorq_w(offs_t offset, uint8_t data, bool &prtov) { }
+ virtual uint8_t iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov) { return data; }
+ virtual void iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov) { }
protected:
// construction/destruction
diff --git a/src/devices/bus/newbrain/fdc.cpp b/src/devices/bus/newbrain/fdc.cpp
index 7cadbd0bddd..597def0509b 100644
--- a/src/devices/bus/newbrain/fdc.cpp
+++ b/src/devices/bus/newbrain/fdc.cpp
@@ -104,22 +104,21 @@ static void newbrain_floppies(device_slot_interface &device)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void newbrain_fdc_device::device_add_mconfig(machine_config &config)
-{
- Z80(config, m_maincpu, XTAL(4'000'000));
- m_maincpu->set_addrmap(AS_PROGRAM, &newbrain_fdc_device::newbrain_fdc_mem);
- m_maincpu->set_addrmap(AS_IO, &newbrain_fdc_device::newbrain_fdc_io);
+MACHINE_CONFIG_START(newbrain_fdc_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(Z80_TAG, Z80, XTAL(4'000'000))
+ MCFG_DEVICE_PROGRAM_MAP(newbrain_fdc_mem)
+ MCFG_DEVICE_IO_MAP(newbrain_fdc_io)
UPD765A(config, m_fdc, 8'000'000, false, true);
m_fdc->intrq_wr_callback().set(FUNC(newbrain_fdc_device::fdc_int_w));
- FLOPPY_CONNECTOR(config, UPD765_TAG ":0", newbrain_floppies, "525dd", floppy_image_device::default_floppy_formats);
- FLOPPY_CONNECTOR(config, UPD765_TAG ":1", newbrain_floppies, "525dd", floppy_image_device::default_floppy_formats);
- FLOPPY_CONNECTOR(config, UPD765_TAG ":2", newbrain_floppies, nullptr, floppy_image_device::default_floppy_formats);
- FLOPPY_CONNECTOR(config, UPD765_TAG ":3", newbrain_floppies, nullptr, floppy_image_device::default_floppy_formats);
+ MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", newbrain_floppies, "525dd", floppy_image_device::default_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", newbrain_floppies, "525dd", floppy_image_device::default_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":2", newbrain_floppies, nullptr, floppy_image_device::default_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":3", newbrain_floppies, nullptr, floppy_image_device::default_floppy_formats)
- NEWBRAIN_EXPANSION_SLOT(config, m_exp, XTAL(16'000'000)/8, newbrain_expansion_cards, nullptr);
-}
+ MCFG_NEWBRAIN_EXPANSION_SLOT_ADD(NEWBRAIN_EXPANSION_SLOT_TAG, XTAL(16'000'000)/8, newbrain_expansion_cards, nullptr)
+MACHINE_CONFIG_END
//**************************************************************************
@@ -177,9 +176,9 @@ void newbrain_fdc_device::device_reset()
// mreq_r - memory request read
//-------------------------------------------------
-uint8_t newbrain_fdc_device::mreq_r(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh)
+uint8_t newbrain_fdc_device::mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh)
{
- return m_exp->mreq_r(offset, data, romov, exrm, raminh);
+ return m_exp->mreq_r(space, offset, data, romov, exrm, raminh);
}
@@ -187,9 +186,9 @@ uint8_t newbrain_fdc_device::mreq_r(offs_t offset, uint8_t data, bool &romov, in
// mreq_w - memory request write
//-------------------------------------------------
-void newbrain_fdc_device::mreq_w(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh)
+void newbrain_fdc_device::mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh)
{
- m_exp->mreq_w(offset, data, romov, exrm, raminh);
+ m_exp->mreq_w(space, offset, data, romov, exrm, raminh);
}
@@ -197,9 +196,9 @@ void newbrain_fdc_device::mreq_w(offs_t offset, uint8_t data, bool &romov, int &
// iorq_r - I/O request read
//-------------------------------------------------
-uint8_t newbrain_fdc_device::iorq_r(offs_t offset, uint8_t data, bool &prtov)
+uint8_t newbrain_fdc_device::iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov)
{
- return m_exp->iorq_r(offset, data, prtov);
+ return m_exp->iorq_r(space, offset, data, prtov);
}
@@ -207,13 +206,13 @@ uint8_t newbrain_fdc_device::iorq_r(offs_t offset, uint8_t data, bool &prtov)
// iorq_w - I/O request write
//-------------------------------------------------
-void newbrain_fdc_device::iorq_w(offs_t offset, uint8_t data, bool &prtov)
+void newbrain_fdc_device::iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov)
{
- m_exp->iorq_w(offset, data, prtov);
+ m_exp->iorq_w(space, offset, data, prtov);
if ((offset & 0x20f) == 0x20f)
{
- io_dec_w(data);
+ io_dec_w(space, 0, data);
}
}
@@ -245,7 +244,7 @@ WRITE_LINE_MEMBER( newbrain_fdc_device::fdc_int_w )
// fdc_auxiliary_w -
//-------------------------------------------------
-void newbrain_fdc_device::fdc_auxiliary_w(uint8_t data)
+WRITE8_MEMBER( newbrain_fdc_device::fdc_auxiliary_w )
{
/*
@@ -279,7 +278,7 @@ void newbrain_fdc_device::fdc_auxiliary_w(uint8_t data)
// fdc_control_r -
//-------------------------------------------------
-uint8_t newbrain_fdc_device::fdc_control_r()
+READ8_MEMBER( newbrain_fdc_device::fdc_control_r )
{
/*
@@ -304,7 +303,7 @@ uint8_t newbrain_fdc_device::fdc_control_r()
// io_dec_w - 0x20f
//-------------------------------------------------
-void newbrain_fdc_device::io_dec_w(uint8_t data)
+WRITE8_MEMBER( newbrain_fdc_device::io_dec_w )
{
/*
diff --git a/src/devices/bus/newbrain/fdc.h b/src/devices/bus/newbrain/fdc.h
index e5d6665a078..e5a40ae0748 100644
--- a/src/devices/bus/newbrain/fdc.h
+++ b/src/devices/bus/newbrain/fdc.h
@@ -40,17 +40,17 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_newbrain_expansion_slot_interface overrides
- virtual uint8_t mreq_r(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) override;
- virtual void mreq_w(offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) override;
- virtual uint8_t iorq_r(offs_t offset, uint8_t data, bool &prtov) override;
- virtual void iorq_w(offs_t offset, uint8_t data, bool &prtov) override;
+ virtual uint8_t mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) override;
+ virtual void mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) override;
+ virtual uint8_t iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov) override;
+ virtual void iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov) override;
private:
DECLARE_WRITE_LINE_MEMBER( fdc_int_w );
- void fdc_auxiliary_w(uint8_t data);
- uint8_t fdc_control_r();
- void io_dec_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( fdc_auxiliary_w );
+ DECLARE_READ8_MEMBER( fdc_control_r );
+ DECLARE_WRITE8_MEMBER( io_dec_w );
void newbrain_fdc_io(address_map &map);
void newbrain_fdc_mem(address_map &map);
diff --git a/src/devices/bus/nubus/nubus.cpp b/src/devices/bus/nubus/nubus.cpp
index dc7db80a2ef..b0fc2a4667d 100644
--- a/src/devices/bus/nubus/nubus.cpp
+++ b/src/devices/bus/nubus/nubus.cpp
@@ -70,24 +70,23 @@ nubus_device::nubus_device(const machine_config &mconfig, const char *tag, devic
nubus_device::nubus_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_space(*this, finder_base::DUMMY_TAG, -1),
+ m_maincpu(nullptr),
m_out_irq9_cb(*this),
m_out_irqa_cb(*this),
m_out_irqb_cb(*this),
m_out_irqc_cb(*this),
m_out_irqd_cb(*this),
- m_out_irqe_cb(*this)
+ m_out_irqe_cb(*this),
+ m_cputag(nullptr)
{
}
-
//-------------------------------------------------
-// device_resolve_objects - resolve objects that
-// may be needed for other devices to set
-// initial conditions at start time
+// device_start - device-specific startup
//-------------------------------------------------
-void nubus_device::device_resolve_objects()
+void nubus_device::device_start()
{
+ m_maincpu = machine().device<cpu_device>(m_cputag);
// resolve callbacks
m_out_irq9_cb.resolve_safe();
m_out_irqa_cb.resolve_safe();
@@ -98,10 +97,10 @@ void nubus_device::device_resolve_objects()
}
//-------------------------------------------------
-// device_start - device-specific startup
+// device_reset - device-specific reset
//-------------------------------------------------
-void nubus_device::device_start()
+void nubus_device::device_reset()
{
}
@@ -112,14 +111,15 @@ void nubus_device::add_nubus_card(device_nubus_card_interface *card)
void nubus_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler, uint32_t mask)
{
- int buswidth = m_space->data_width();
+ m_maincpu = machine().device<cpu_device>(m_cputag);
+ int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
switch(buswidth)
{
case 32:
- m_space->install_readwrite_handler(start, end, rhandler, whandler, mask);
+ m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask);
break;
case 64:
- m_space->install_readwrite_handler(start, end, rhandler, whandler, ((uint64_t)mask<<32)|mask);
+ m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, ((uint64_t)mask<<32)|mask);
break;
default:
fatalerror("NUBUS: Bus width %d not supported\n", buswidth);
@@ -128,14 +128,15 @@ void nubus_device::install_device(offs_t start, offs_t end, read8_delegate rhand
void nubus_device::install_device(offs_t start, offs_t end, read16_delegate rhandler, write16_delegate whandler, uint32_t mask)
{
- int buswidth = m_space->data_width();
+ m_maincpu = machine().device<cpu_device>(m_cputag);
+ int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
switch(buswidth)
{
case 32:
- m_space->install_readwrite_handler(start, end, rhandler, whandler, mask);
+ m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask);
break;
case 64:
- m_space->install_readwrite_handler(start, end, rhandler, whandler, ((uint64_t)mask<<32)|mask);
+ m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, ((uint64_t)mask<<32)|mask);
break;
default:
fatalerror("NUBUS: Bus width %d not supported\n", buswidth);
@@ -144,14 +145,15 @@ void nubus_device::install_device(offs_t start, offs_t end, read16_delegate rhan
void nubus_device::install_device(offs_t start, offs_t end, read32_delegate rhandler, write32_delegate whandler, uint32_t mask)
{
- int buswidth = m_space->data_width();
+ m_maincpu = machine().device<cpu_device>(m_cputag);
+ int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
switch(buswidth)
{
case 32:
- m_space->install_readwrite_handler(start, end, rhandler, whandler, mask);
+ m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask);
break;
case 64:
- m_space->install_readwrite_handler(start, end, rhandler, whandler, ((uint64_t)mask<<32)|mask);
+ m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, ((uint64_t)mask<<32)|mask);
break;
default:
fatalerror("NUBUS: Bus width %d not supported\n", buswidth);
@@ -160,14 +162,15 @@ void nubus_device::install_device(offs_t start, offs_t end, read32_delegate rhan
void nubus_device::install_readonly_device(offs_t start, offs_t end, read32_delegate rhandler, uint32_t mask)
{
- int buswidth = m_space->data_width();
+ m_maincpu = machine().device<cpu_device>(m_cputag);
+ int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
switch(buswidth)
{
case 32:
- m_space->install_read_handler(start, end, rhandler, mask);
+ m_maincpu->space(AS_PROGRAM).install_read_handler(start, end, rhandler, mask);
break;
case 64:
- m_space->install_read_handler(start, end, rhandler, ((uint64_t)mask<<32)|mask);
+ m_maincpu->space(AS_PROGRAM).install_read_handler(start, end, rhandler, ((uint64_t)mask<<32)|mask);
break;
default:
fatalerror("NUBUS: Bus width %d not supported\n", buswidth);
@@ -176,14 +179,15 @@ void nubus_device::install_readonly_device(offs_t start, offs_t end, read32_dele
void nubus_device::install_writeonly_device(offs_t start, offs_t end, write32_delegate whandler, uint32_t mask)
{
- int buswidth = m_space->data_width();
+ m_maincpu = machine().device<cpu_device>(m_cputag);
+ int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
switch(buswidth)
{
case 32:
- m_space->install_write_handler(start, end, whandler, mask);
+ m_maincpu->space(AS_PROGRAM).install_write_handler(start, end, whandler, mask);
break;
case 64:
- m_space->install_write_handler(start, end, whandler, ((uint64_t)mask<<32)|mask);
+ m_maincpu->space(AS_PROGRAM).install_write_handler(start, end, whandler, ((uint64_t)mask<<32)|mask);
break;
default:
fatalerror("NUBUS: Bus width %d not supported\n", buswidth);
@@ -193,7 +197,9 @@ void nubus_device::install_writeonly_device(offs_t start, offs_t end, write32_de
void nubus_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data)
{
// printf("install_bank: %s @ %x->%x\n", tag, start, end);
- m_space->install_readwrite_bank(start, end, 0, tag);
+ m_maincpu = machine().device<cpu_device>(m_cputag);
+ address_space &space = m_maincpu->space(AS_PROGRAM);
+ space.install_readwrite_bank(start, end, 0, tag );
machine().root_device().membank(siblingtag(tag).c_str())->set_base(data);
}
diff --git a/src/devices/bus/nubus/nubus.h b/src/devices/bus/nubus/nubus.h
index a1b9496fcf8..919f989ebfb 100644
--- a/src/devices/bus/nubus/nubus.h
+++ b/src/devices/bus/nubus/nubus.h
@@ -14,6 +14,44 @@
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_NUBUS_CPU(_cputag) \
+ downcast<nubus_device &>(*device).set_cputag(_cputag);
+
+#define MCFG_NUBUS_OUT_IRQ9_CB(_devcb) \
+ downcast<nubus_device &>(*device).set_out_irq9_callback(DEVCB_##_devcb);
+
+#define MCFG_NUBUS_OUT_IRQA_CB(_devcb) \
+ downcast<nubus_device &>(*device).set_out_irqa_callback(DEVCB_##_devcb);
+
+#define MCFG_NUBUS_OUT_IRQB_CB(_devcb) \
+ downcast<nubus_device &>(*device).set_out_irqb_callback(DEVCB_##_devcb);
+
+#define MCFG_NUBUS_OUT_IRQC_CB(_devcb) \
+ downcast<nubus_device &>(*device).set_out_irqc_callback(DEVCB_##_devcb);
+
+#define MCFG_NUBUS_OUT_IRQD_CB(_devcb) \
+ downcast<nubus_device &>(*device).set_out_irqd_callback(DEVCB_##_devcb);
+
+#define MCFG_NUBUS_OUT_IRQE_CB(_devcb) \
+ downcast<nubus_device &>(*device).set_out_irqe_callback(DEVCB_##_devcb);
+
+#define MCFG_NUBUS_SLOT_ADD(_nbtag, _tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, NUBUS_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<nubus_slot_device &>(*device).set_nubus_slot(_nbtag, _tag);
+#define MCFG_NUBUS_SLOT_REMOVE(_tag) \
+ MCFG_DEVICE_REMOVE(_tag)
+
+#define MCFG_NUBUS_ONBOARD_ADD(_nbtag, _tag, _dev_type, _def_inp) \
+ MCFG_DEVICE_ADD(_tag, _dev_type, 0) \
+ MCFG_DEVICE_INPUT_DEFAULTS(_def_inp) \
+ downcast<device_nubus_card_interface &>(*device).set_nubus_tag(_nbtag, _tag);
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -62,7 +100,13 @@ public:
~nubus_device() { m_device_list.detach_all(); }
// inline configuration
- template <typename T> void set_space(T &&tag, int spacenum) { m_space.set_tag(std::forward<T>(tag), spacenum); }
+ void set_cputag(const char *tag) { m_cputag = tag; }
+ template <class Object> devcb_base &set_out_irq9_callback(Object &&cb) { return m_out_irq9_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_irqa_callback(Object &&cb) { return m_out_irqa_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_irqb_callback(Object &&cb) { return m_out_irqb_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_irqc_callback(Object &&cb) { return m_out_irqc_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_irqd_callback(Object &&cb) { return m_out_irqd_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_irqe_callback(Object &&cb) { return m_out_irqe_cb.set_callback(std::forward<Object>(cb)); }
auto out_irq9_callback() { return m_out_irq9_cb.bind(); }
auto out_irqa_callback() { return m_out_irqa_cb.bind(); }
auto out_irqb_callback() { return m_out_irqb_cb.bind(); }
@@ -90,11 +134,11 @@ protected:
nubus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void device_resolve_objects() override;
virtual void device_start() override;
+ virtual void device_reset() override;
// internal state
- required_address_space m_space;
+ cpu_device *m_maincpu;
devcb_write_line m_out_irq9_cb;
devcb_write_line m_out_irqa_cb;
@@ -104,6 +148,7 @@ protected:
devcb_write_line m_out_irqe_cb;
simple_list<device_nubus_card_interface> m_device_list;
+ const char *m_cputag;
};
diff --git a/src/devices/bus/nubus/nubus_48gc.cpp b/src/devices/bus/nubus/nubus_48gc.cpp
index 86f4fca21ec..e089e1986db 100644
--- a/src/devices/bus/nubus/nubus_48gc.cpp
+++ b/src/devices/bus/nubus/nubus_48gc.cpp
@@ -39,16 +39,15 @@ DEFINE_DEVICE_TYPE(NUBUS_824GC, nubus_824gc_device, "nb_824gc", "Apple 8*24 vide
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void jmfb_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, GC48_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(jmfb_device::screen_update));
- screen.set_raw(25175000, 800, 0, 640, 525, 0, 480);
-// screen.set_size(1152, 870);
-// screen.set_visarea(0, 1152-1, 0, 870-1);
-// screen.set_refresh_hz(75);
-// screen.set_vblank_time(ATTOSECONDS_IN_USEC(1260));
-}
+MACHINE_CONFIG_START(jmfb_device::device_add_mconfig)
+ MCFG_SCREEN_ADD(GC48_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, jmfb_device, screen_update)
+ MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480)
+// MCFG_SCREEN_SIZE(1152, 870)
+// MCFG_SCREEN_VISIBLE_AREA(0, 1152-1, 0, 870-1)
+// MCFG_SCREEN_REFRESH_RATE(75)
+// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260))
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/nubus_asntmc3b.cpp b/src/devices/bus/nubus/nubus_asntmc3b.cpp
index f6c0135af5f..46f9d382eb8 100644
--- a/src/devices/bus/nubus/nubus_asntmc3b.cpp
+++ b/src/devices/bus/nubus/nubus_asntmc3b.cpp
@@ -41,13 +41,12 @@ DEFINE_DEVICE_TYPE(NUBUS_APPLEENET, nubus_appleenet_device, "nb_aenet", "Apple N
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_mac8390_device::device_add_mconfig(machine_config &config)
-{
- DP8390D(config, m_dp83902, 0);
- m_dp83902->irq_callback().set(FUNC(nubus_mac8390_device::dp_irq_w));
- m_dp83902->mem_read_callback().set(FUNC(nubus_mac8390_device::dp_mem_read));
- m_dp83902->mem_write_callback().set(FUNC(nubus_mac8390_device::dp_mem_write));
-}
+MACHINE_CONFIG_START(nubus_mac8390_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(MAC8390_839X, DP8390D, 0)
+ MCFG_DP8390D_IRQ_CB(WRITELINE(*this, nubus_mac8390_device, dp_irq_w))
+ MCFG_DP8390D_MEM_READ_CB(READ8(*this, nubus_mac8390_device, dp_mem_read))
+ MCFG_DP8390D_MEM_WRITE_CB(WRITE8(*this, nubus_mac8390_device, dp_mem_write))
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/nubus_cb264.cpp b/src/devices/bus/nubus/nubus_cb264.cpp
index 01bff0877da..9efb5e6d088 100644
--- a/src/devices/bus/nubus/nubus_cb264.cpp
+++ b/src/devices/bus/nubus/nubus_cb264.cpp
@@ -40,14 +40,13 @@ DEFINE_DEVICE_TYPE(NUBUS_CB264, nubus_cb264_device, "nb_c264", "RasterOps ColorB
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_cb264_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, CB264_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(nubus_cb264_device::screen_update));
- screen.set_raw(25175000, 800, 0, 640, 525, 0, 480);
- screen.set_size(1024, 768);
- screen.set_visarea(0, 640-1, 0, 480-1);
-}
+MACHINE_CONFIG_START(nubus_cb264_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( CB264_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_cb264_device, screen_update)
+ MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480)
+ MCFG_SCREEN_SIZE(1024,768)
+ MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/nubus_image.cpp b/src/devices/bus/nubus/nubus_image.cpp
index 8e2d39fb943..1618bda4da7 100644
--- a/src/devices/bus/nubus/nubus_image.cpp
+++ b/src/devices/bus/nubus/nubus_image.cpp
@@ -130,10 +130,9 @@ DEFINE_DEVICE_TYPE(NUBUS_IMAGE, nubus_image_device, "nb_image", "NuBus Disk Imag
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_image_device::device_add_mconfig(machine_config &config)
-{
- MESSIMG_DISK(config, IMAGE_DISK0_TAG, 0);
-}
+MACHINE_CONFIG_START(nubus_image_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(IMAGE_DISK0_TAG, MESSIMG_DISK, 0)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/nubus_m2hires.cpp b/src/devices/bus/nubus/nubus_m2hires.cpp
index c575f7d94b1..6ac472eeb5b 100644
--- a/src/devices/bus/nubus/nubus_m2hires.cpp
+++ b/src/devices/bus/nubus/nubus_m2hires.cpp
@@ -36,14 +36,13 @@ DEFINE_DEVICE_TYPE(NUBUS_M2HIRES, nubus_m2hires_device, "nb_m2hr", "Macintosh II
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_m2hires_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, M2HIRES_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(nubus_m2hires_device::screen_update));
- screen.set_raw(25175000, 800, 0, 640, 525, 0, 480);
- screen.set_size(1024, 768);
- screen.set_visarea(0, 640-1, 0, 480-1);
-}
+MACHINE_CONFIG_START(nubus_m2hires_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( M2HIRES_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_m2hires_device, screen_update)
+ MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480)
+ MCFG_SCREEN_SIZE(1024,768)
+ MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/nubus_m2video.cpp b/src/devices/bus/nubus/nubus_m2video.cpp
index b16391b640d..d7eea8cf22e 100644
--- a/src/devices/bus/nubus/nubus_m2video.cpp
+++ b/src/devices/bus/nubus/nubus_m2video.cpp
@@ -38,14 +38,13 @@ DEFINE_DEVICE_TYPE(NUBUS_M2VIDEO, nubus_m2video_device, "nb_m2vc", "Macintosh II
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_m2video_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, M2VIDEO_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(nubus_m2video_device::screen_update));
- screen.set_raw(25175000, 800, 0, 640, 525, 0, 480);
- screen.set_size(1024, 768);
- screen.set_visarea(0, 640-1, 0, 480-1);
-}
+MACHINE_CONFIG_START(nubus_m2video_device::device_add_mconfig)
+ MCFG_SCREEN_ADD(M2VIDEO_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_m2video_device, screen_update)
+ MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480)
+ MCFG_SCREEN_SIZE(1024,768)
+ MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/nubus_radiustpd.cpp b/src/devices/bus/nubus/nubus_radiustpd.cpp
index 1ee2e0cb7fb..98a3ab3e514 100644
--- a/src/devices/bus/nubus/nubus_radiustpd.cpp
+++ b/src/devices/bus/nubus/nubus_radiustpd.cpp
@@ -37,12 +37,13 @@ DEFINE_DEVICE_TYPE(NUBUS_RADIUSTPD, nubus_radiustpd_device, "nb_rtpd", "Radius T
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_radiustpd_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, RADIUSTPD_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(nubus_radiustpd_device::screen_update));
- screen.set_raw(99.522_MHz_XTAL, 1536, 0, 1152, 900, 0, 880); // 64.79 kHz horizontal, 72 Hz refresh
-}
+MACHINE_CONFIG_START(nubus_radiustpd_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( RADIUSTPD_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_radiustpd_device, screen_update)
+ MCFG_SCREEN_SIZE(1280, 960)
+ MCFG_SCREEN_REFRESH_RATE(70)
+ MCFG_SCREEN_VISIBLE_AREA(0, 1152-1, 0, 880-1)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/nubus_spec8.cpp b/src/devices/bus/nubus/nubus_spec8.cpp
index 1353d3b9a9d..d3d45d9b076 100644
--- a/src/devices/bus/nubus/nubus_spec8.cpp
+++ b/src/devices/bus/nubus/nubus_spec8.cpp
@@ -40,14 +40,13 @@ DEFINE_DEVICE_TYPE(NUBUS_SPEC8S3, nubus_spec8s3_device, "nb_sp8s3", "SuperMac Sp
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_spec8s3_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, SPEC8S3_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(nubus_spec8s3_device::screen_update));
- screen.set_raw(25175000, 800, 0, 640, 525, 0, 480);
- screen.set_size(1024, 768);
- screen.set_visarea(0, 1024-1, 0, 768-1);
-}
+MACHINE_CONFIG_START(nubus_spec8s3_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( SPEC8S3_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_spec8s3_device, screen_update)
+ MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480)
+ MCFG_SCREEN_SIZE(1024,768)
+ MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/nubus_specpdq.cpp b/src/devices/bus/nubus/nubus_specpdq.cpp
index 2e09a258bd2..d9e463e7fbf 100644
--- a/src/devices/bus/nubus/nubus_specpdq.cpp
+++ b/src/devices/bus/nubus/nubus_specpdq.cpp
@@ -29,9 +29,6 @@
#include "nubus_specpdq.h"
#include "screen.h"
-//#define VERBOSE 1
-#include "logmacro.h"
-
#define SPECPDQ_SCREEN_NAME "specpdq_screen"
#define SPECPDQ_ROM_REGION "specpdq_rom"
@@ -54,16 +51,15 @@ DEFINE_DEVICE_TYPE(NUBUS_SPECPDQ, nubus_specpdq_device, "nb_spdq", "SuperMac Spe
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_specpdq_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, SPECPDQ_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(nubus_specpdq_device::screen_update));
- screen.set_raw(25175000, 800, 0, 640, 525, 0, 480);
- screen.set_size(1280, 1024);
- screen.set_visarea(0, 1152-1, 0, 844-1);
+MACHINE_CONFIG_START(nubus_specpdq_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( SPECPDQ_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_specpdq_device, screen_update)
+ MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480)
+ MCFG_SCREEN_SIZE(1280,1024)
+ MCFG_SCREEN_VISIBLE_AREA(0, 1152-1, 0, 844-1)
- PALETTE(config, m_palette).set_entries(256);
-}
+ MCFG_PALETTE_ADD("palette", 256)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
@@ -246,7 +242,7 @@ WRITE32_MEMBER( nubus_specpdq_device::specpdq_w )
switch (offset)
{
case 0xc0054: // mode 1
- LOG("%x to mode1\n", data);
+// logerror("%x to mode1\n", data);
break;
case 0xc005c: // interrupt control
@@ -265,7 +261,7 @@ WRITE32_MEMBER( nubus_specpdq_device::specpdq_w )
break;
case 0xc007a:
- LOG("%x to mode2\n", data);
+// logerror("%x to mode2\n", data);
switch (data)
{
@@ -282,11 +278,11 @@ WRITE32_MEMBER( nubus_specpdq_device::specpdq_w )
break;
}
- LOG("m_mode = %d\n", m_mode);
+// logerror("m_mode = %d\n", m_mode);
break;
case 0x120000: // DAC address
- LOG("%08x to DAC control %s\n", data,machine().describe_context());
+// logerror("%08x to DAC control %s\n", data,machine().describe_context());
m_clutoffs = ((data>>8)&0xff)^0xff;
break;
@@ -295,7 +291,7 @@ WRITE32_MEMBER( nubus_specpdq_device::specpdq_w )
if (m_count == 3)
{
- LOG("RAMDAC: color %d = %02x %02x %02x %s\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], machine().describe_context());
+// logerror("RAMDAC: color %d = %02x %02x %02x %s\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], machine().describe_context());
m_palette->set_pen_color(m_clutoffs, rgb_t(m_colors[0], m_colors[1], m_colors[2]));
m_palette_val[m_clutoffs] = rgb_t(m_colors[0], m_colors[1], m_colors[2]);
m_clutoffs++;
@@ -372,10 +368,7 @@ WRITE32_MEMBER( nubus_specpdq_device::specpdq_w )
case 0x18103d:
case 0x18103e:
case 0x18103f:
- if(offset == 0x181000) {
- machine().debug_break();
- LOG("Pattern %08x @ %x\n", data ^ 0xffffffff, offset);
- }
+// logerror("Pattern %08x @ %x\n", data ^ 0xffffffff, offset);
m_fillbytes[((offset&0x3f)*4)] = ((data>>24) & 0xff) ^ 0xff;
m_fillbytes[((offset&0x3f)*4)+1] = ((data>>16) & 0xff) ^ 0xff;
m_fillbytes[((offset&0x3f)*4)+2] = ((data>>8) & 0xff) ^ 0xff;
@@ -384,107 +377,81 @@ WRITE32_MEMBER( nubus_specpdq_device::specpdq_w )
// blitter control
case 0x182006:
- LOG("%08x (%d) to blitter ctrl 1 %s rectangle\n", data^0xffffffff, data^0xffffffff, machine().describe_context());
+// logerror("%08x (%d) to blitter ctrl 1 %s\n", data^0xffffffff, data^0xffffffff, machine().describe_context());
break;
case 0x182008:
- LOG("%08x (%d) to blitter ctrl 2 %s rectangle\n", data^0xffffffff, data^0xffffffff, machine().describe_context());
+// logerror("%08x (%d) to blitter ctrl 2 %s\n", data^0xffffffff, data^0xffffffff, machine().describe_context());
m_patofsx = (data ^ 0xffffffff) & 7;
m_patofsy = ((data ^ 0xffffffff)>>3) & 7;
break;
case 0x18200e:
- LOG("%08x (%d) to blitter ctrl 3 %s\n", data^0xffffffff, data^0xffffffff, machine().describe_context());
+// logerror("%08x (%d) to blitter ctrl 3 %s\n", data^0xffffffff, data^0xffffffff, machine().describe_context());
m_width = data ^ 0xffffffff;
break;
case 0x18200b:
- LOG("%08x (%d) to blitter ctrl 4 %s\n", data^0xffffffff, data^0xffffffff, machine().describe_context());
+// logerror("%08x (%d) to blitter ctrl 4 %s\n", data^0xffffffff, data^0xffffffff, machine().describe_context());
m_height = (data ^ 0xffffffff) & 0xffff;
break;
case 0x18200a:
data ^= 0xffffffff;
- LOG("%08x to blitter ctrl 5 %s\n", data, machine().describe_context());
+// logerror("%08x to blitter ctrl 5 %s\n", data, machine().describe_context());
m_vram_src = data>>2;
break;
case 0x182009:
data ^= 0xffffffff;
- LOG("%08x to blitter ctrl 6 %s\n", data, machine().describe_context());
+// logerror("%08x to blitter ctrl 6 %s\n", data, machine().describe_context());
m_vram_addr = data>>2;
break;
case 0x182007:
data ^= 0xffffffff;
- LOG("%08x to blitter ctrl 7 %s\n", data, machine().describe_context());
+// logerror("%08x to blitter ctrl 7 %s\n", data, machine().describe_context());
// fill rectangle
if (data == 2)
{
int x, y;
- uint8_t *vram = &m_vram[m_vram_addr & ~3];
-
- int ddx = m_vram_addr & 3;
-
- LOG("Fill rectangle with %02x %02x %02x %02x, adr %x (%d, %d) width %d height %d delta %d %d\n", m_fillbytes[0], m_fillbytes[1], m_fillbytes[2], m_fillbytes[3], m_vram_addr, m_vram_addr % 1152, m_vram_addr / 1152, m_width, m_height, m_patofsx, m_patofsy);
-
- for (y = 0; y <= m_height; y++)
- {
- for (x = 0; x <= m_width; x++)
- {
- vram[(y * 1152)+BYTE4_XOR_BE(x + ddx)] = m_fillbytes[((m_patofsx + x) & 0x1f)+(((m_patofsy + y) & 0x7) << 5)];
- }
- }
- }
- else if (data == 0x100)
- {
- int x, y;
- uint8_t *vram = &m_vram[m_vram_addr & ~3];
- uint8_t *vramsrc = &m_vram[m_vram_src & ~3];
+ uint8_t *vram = &m_vram[m_vram_addr + m_patofsx]; // m_vram_addr is missing the low 2 bits, we add them back here
- int sdx = m_vram_src & 3;
- int ddx = m_vram_addr & 3;
+// logerror("Fill rectangle with %02x %02x %02x %02x, width %d height %d\n", m_fillbytes[0], m_fillbytes[1], m_fillbytes[2], m_fillbytes[3], m_width, m_height);
- LOG("Copy rectangle forwards, width %d height %d dst %x (%d, %d) src %x (%d, %d)\n", m_width, m_height, m_vram_addr, m_vram_addr % 1152, m_vram_addr / 1152, m_vram_src, m_vram_src % 1152, m_vram_src / 1152);
-
- for (y = 0; y <= m_height; y++)
+ for (y = 0; y < m_height; y++)
{
- for (x = 0; x <= m_width; x++)
+ for (x = 0; x < m_width; x++)
{
- vram[(y * 1152)+BYTE4_XOR_BE(x + ddx)] = vramsrc[(y * 1152)+BYTE4_XOR_BE(x + sdx)];
+ vram[(y * 1152)+x] = m_fillbytes[((m_patofsx + x) & 0x1f)+(((m_patofsy + y) & 0x7)*32)];
}
}
- (void)vramsrc; (void)sdx;
}
- else if (data == 0x101)
+ else if ((data == 0x101) || (data == 0x100))
{
int x, y;
- uint8_t *vram = &m_vram[m_vram_addr & ~3];
- uint8_t *vramsrc = &m_vram[m_vram_src & ~3];
-
- int sdx = m_vram_src & 3;
- int ddx = m_vram_addr & 3;
+ uint8_t *vram = &m_vram[m_vram_addr];
+ uint8_t *vramsrc = &m_vram[m_vram_src];
- LOG("Copy rectangle backwards, width %d height %d dst %x (%d, %d) src %x (%d, %d)\n", m_width, m_height, m_vram_addr, m_vram_addr % 1152, m_vram_addr / 1152, m_vram_src, m_vram_src % 1152, m_vram_src / 1152);
+// logerror("Copy rectangle, width %d height %d src %x dst %x\n", m_width, m_height, m_vram_addr, m_vram_src);
for (y = 0; y < m_height; y++)
{
for (x = 0; x < m_width; x++)
{
- vram[(-y * 1152)+BYTE4_XOR_BE(-x + ddx)] = vramsrc[(-y * 1152)+BYTE4_XOR_BE(-x + sdx)];
+ vram[(y * 1152)+x] = vramsrc[(y * 1152)+x];
}
}
- (void)vramsrc; (void)sdx;
}
else
{
- LOG("Unknown blitter command %08x\n", data);
+ logerror("Unknown blitter command %08x\n", data);
}
break;
default:
- LOG("specpdq_w: %08x @ %x (mask %08x %s)\n", data^0xffffffff, offset, mem_mask, machine().describe_context());
+// logerror("specpdq_w: %08x @ %x (mask %08x %s)\n", data^0xffffffff, offset, mem_mask, machine().describe_context());
break;
}
}
diff --git a/src/devices/bus/nubus/nubus_vikbw.cpp b/src/devices/bus/nubus/nubus_vikbw.cpp
index ab3af18fe72..040f452b2d2 100644
--- a/src/devices/bus/nubus/nubus_vikbw.cpp
+++ b/src/devices/bus/nubus/nubus_vikbw.cpp
@@ -36,14 +36,13 @@ DEFINE_DEVICE_TYPE(NUBUS_VIKBW, nubus_vikbw_device, "nb_vikbw", "Moniterm Viking
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_vikbw_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, VIKBW_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(nubus_vikbw_device::screen_update));
- screen.set_size(1024, 768);
- screen.set_visarea(0, 1024-1, 0, 768-1);
- screen.set_refresh_hz(70);
-}
+MACHINE_CONFIG_START(nubus_vikbw_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( VIKBW_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_vikbw_device, screen_update)
+ MCFG_SCREEN_SIZE(1024,768)
+ MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1)
+ MCFG_SCREEN_REFRESH_RATE(70)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/nubus_wsportrait.cpp b/src/devices/bus/nubus/nubus_wsportrait.cpp
index 12702c052a6..19c25347738 100644
--- a/src/devices/bus/nubus/nubus_wsportrait.cpp
+++ b/src/devices/bus/nubus/nubus_wsportrait.cpp
@@ -39,14 +39,13 @@ DEFINE_DEVICE_TYPE(NUBUS_WSPORTRAIT, nubus_wsportrait_device, "nb_wspt", "Macint
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_wsportrait_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, WSPORTRAIT_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(nubus_wsportrait_device::screen_update));
- screen.set_size(1024, 960);
- screen.set_refresh_hz(75.0);
- screen.set_visarea(0, 640-1, 0, 870-1);
-}
+MACHINE_CONFIG_START(nubus_wsportrait_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( WSPORTRAIT_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_wsportrait_device, screen_update)
+ MCFG_SCREEN_SIZE(1024,960)
+ MCFG_SCREEN_REFRESH_RATE(75.0)
+ MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 870-1)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/pds30_30hr.cpp b/src/devices/bus/nubus/pds30_30hr.cpp
index 190872708f6..8888c50b5fa 100644
--- a/src/devices/bus/nubus/pds30_30hr.cpp
+++ b/src/devices/bus/nubus/pds30_30hr.cpp
@@ -39,14 +39,13 @@ DEFINE_DEVICE_TYPE(PDS030_XCEED30HR, nubus_xceed30hr_device, "pd3_30hr", "Micron
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_xceed30hr_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, XCEED30HR_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(nubus_xceed30hr_device::screen_update));
- screen.set_raw(25175000, 800, 0, 640, 525, 0, 480);
- screen.set_size(1024, 768);
- screen.set_visarea(0, 640-1, 0, 480-1);
-}
+MACHINE_CONFIG_START(nubus_xceed30hr_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( XCEED30HR_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_xceed30hr_device, screen_update)
+ MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480)
+ MCFG_SCREEN_SIZE(1024,768)
+ MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/pds30_cb264.cpp b/src/devices/bus/nubus/pds30_cb264.cpp
index 4d153596fe0..6ec398a5257 100644
--- a/src/devices/bus/nubus/pds30_cb264.cpp
+++ b/src/devices/bus/nubus/pds30_cb264.cpp
@@ -32,14 +32,13 @@ DEFINE_DEVICE_TYPE(PDS030_CB264SE30, nubus_cb264se30_device, "pd3_c264", "Raster
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_cb264se30_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, CB264SE30_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(nubus_cb264se30_device::screen_update));
- screen.set_raw(25175000, 800, 0, 640, 525, 0, 480);
- screen.set_size(1024, 768);
- screen.set_visarea(0, 640-1, 0, 480-1);
-}
+MACHINE_CONFIG_START(nubus_cb264se30_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( CB264SE30_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_cb264se30_device, screen_update)
+ MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480)
+ MCFG_SCREEN_SIZE(1024,768)
+ MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/pds30_mc30.cpp b/src/devices/bus/nubus/pds30_mc30.cpp
index 6770b517deb..a314b7f9981 100644
--- a/src/devices/bus/nubus/pds30_mc30.cpp
+++ b/src/devices/bus/nubus/pds30_mc30.cpp
@@ -35,14 +35,13 @@ DEFINE_DEVICE_TYPE(PDS030_XCEEDMC30, nubus_xceedmc30_device, "pd3_mclr", "Micron
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_xceedmc30_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, XCEEDMC30_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(nubus_xceedmc30_device::screen_update));
- screen.set_raw(25175000, 800, 0, 640, 525, 0, 480);
- screen.set_size(1024, 768);
- screen.set_visarea(0, 640-1, 0, 480-1);
-}
+MACHINE_CONFIG_START(nubus_xceedmc30_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( XCEEDMC30_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_xceedmc30_device, screen_update)
+ MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480)
+ MCFG_SCREEN_SIZE(1024,768)
+ MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/pds30_procolor816.cpp b/src/devices/bus/nubus/pds30_procolor816.cpp
index 440ba6c86d7..db1c02fea31 100644
--- a/src/devices/bus/nubus/pds30_procolor816.cpp
+++ b/src/devices/bus/nubus/pds30_procolor816.cpp
@@ -38,14 +38,13 @@ DEFINE_DEVICE_TYPE(PDS030_PROCOLOR816, nubus_procolor816_device, "pd3_pc16", "La
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_procolor816_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, PROCOLOR816_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(nubus_procolor816_device::screen_update));
- screen.set_raw(25175000, 800, 0, 640, 525, 0, 480);
- screen.set_size(1024, 768);
- screen.set_visarea(0, 640-1, 0, 480-1);
-}
+MACHINE_CONFIG_START(nubus_procolor816_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( PROCOLOR816_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_procolor816_device, screen_update)
+ MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480)
+ MCFG_SCREEN_SIZE(1024,768)
+ MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/nubus/pds30_sigmalview.cpp b/src/devices/bus/nubus/pds30_sigmalview.cpp
index 51f27a03713..ea05362d8ea 100644
--- a/src/devices/bus/nubus/pds30_sigmalview.cpp
+++ b/src/devices/bus/nubus/pds30_sigmalview.cpp
@@ -32,14 +32,13 @@ DEFINE_DEVICE_TYPE(PDS030_LVIEW, nubus_lview_device, "pd3_lviw", "Sigma Designs
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void nubus_lview_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, LVIEW_SCREEN_NAME, SCREEN_TYPE_RASTER));
- screen.set_screen_update(FUNC(nubus_lview_device::screen_update));
- screen.set_size(832, 600);
- screen.set_refresh_hz(70);
- screen.set_visarea(0, 832-1, 0, 600-1);
-}
+MACHINE_CONFIG_START(nubus_lview_device::device_add_mconfig)
+ MCFG_SCREEN_ADD( LVIEW_SCREEN_NAME, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_lview_device, screen_update)
+ MCFG_SCREEN_SIZE(832,600)
+ MCFG_SCREEN_REFRESH_RATE(70)
+ MCFG_SCREEN_VISIBLE_AREA(0, 832-1, 0, 600-1)
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/bus/odyssey2/chess.cpp b/src/devices/bus/odyssey2/chess.cpp
index 44890a394ce..d2ba5d05f5f 100644
--- a/src/devices/bus/odyssey2/chess.cpp
+++ b/src/devices/bus/odyssey2/chess.cpp
@@ -45,9 +45,8 @@ void o2_chess_device::chess_io(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void o2_chess_device::device_add_mconfig(machine_config &config)
-{
- NSC800(config, m_cpu, XTAL(4'000'000));
- m_cpu->set_addrmap(AS_PROGRAM, &o2_chess_device::chess_mem);
- m_cpu->set_addrmap(AS_IO, &o2_chess_device::chess_io);
-}
+MACHINE_CONFIG_START(o2_chess_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("subcpu", NSC800, XTAL(4'000'000))
+ MCFG_DEVICE_PROGRAM_MAP(chess_mem)
+ MCFG_DEVICE_IO_MAP(chess_io)
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/odyssey2/slot.h b/src/devices/bus/odyssey2/slot.h
index bfb10c025bd..28192aa3457 100644
--- a/src/devices/bus/odyssey2/slot.h
+++ b/src/devices/bus/odyssey2/slot.h
@@ -65,17 +65,7 @@ class o2_cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- o2_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : o2_cart_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~o2_cart_slot_device();
// device-level overrides
@@ -124,6 +114,10 @@ DECLARE_DEVICE_TYPE(O2_CART_SLOT, o2_cart_slot_device)
#define O2SLOT_ROM_REGION_TAG ":cart:rom"
+#define MCFG_O2_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, O2_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
void o2_cart(device_slot_interface &device);
#endif // MAME_BUS_ODYSSEY2_SLOT_H
diff --git a/src/devices/bus/odyssey2/voice.cpp b/src/devices/bus/odyssey2/voice.cpp
index 83c199f7431..073b4a83173 100644
--- a/src/devices/bus/odyssey2/voice.cpp
+++ b/src/devices/bus/odyssey2/voice.cpp
@@ -43,8 +43,7 @@ void o2_voice_device::device_start()
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void o2_voice_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(o2_voice_device::device_add_mconfig)
SPEAKER(config, "mono").front_center();
SP0256(config, m_speech, 3120000);
@@ -52,8 +51,8 @@ void o2_voice_device::device_add_mconfig(machine_config &config)
// The Voice uses a speaker with its own volume control so the relative volumes to use are subjective, these sound good
m_speech->add_route(ALL_OUTPUTS, "mono", 1.00);
- O2_CART_SLOT(config, m_subslot, o2_cart, nullptr);
-}
+ MCFG_O2_CARTRIDGE_ADD("subslot", o2_cart, nullptr)
+MACHINE_CONFIG_END
ROM_START( o2voice )
diff --git a/src/devices/bus/pc1512/mouse.h b/src/devices/bus/pc1512/mouse.h
index 9c71eb4d89d..db432598a98 100644
--- a/src/devices/bus/pc1512/mouse.h
+++ b/src/devices/bus/pc1512/mouse.h
@@ -32,6 +32,23 @@
#define PC1512_MOUSE_PORT_TAG "mous"
+#define MCFG_PC1512_MOUSE_PORT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, PC1512_MOUSE_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+#define MCFG_PC1512_MOUSE_PORT_X_CB(_write) \
+ downcast<pc1512_mouse_port_device &>(*device).set_x_wr_callback(DEVCB_##_write);
+
+#define MCFG_PC1512_MOUSE_PORT_Y_CB(_write) \
+ downcast<pc1512_mouse_port_device &>(*device).set_y_wr_callback(DEVCB_##_write);
+
+#define MCFG_PC1512_MOUSE_PORT_M1_CB(_write) \
+ downcast<pc1512_mouse_port_device &>(*device).set_m1_wr_callback(DEVCB_##_write);
+
+#define MCFG_PC1512_MOUSE_PORT_M2_CB(_write) \
+ downcast<pc1512_mouse_port_device &>(*device).set_m2_wr_callback(DEVCB_##_write);
+
+
//**************************************************************************
// TYPE DEFINITIONS
@@ -61,23 +78,13 @@ class pc1512_mouse_port_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- template <typename T>
- pc1512_mouse_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : pc1512_mouse_port_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- pc1512_mouse_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ pc1512_mouse_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration helpers
- auto x_wr_callback() { return m_write_x.bind(); }
- auto y_wr_callback() { return m_write_y.bind(); }
- auto m1_wr_callback() { return m_write_m1.bind(); }
- auto m2_wr_callback() { return m_write_m2.bind(); }
+ template <class Object> devcb_base &set_x_wr_callback(Object &&cb) { return m_write_x.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_y_wr_callback(Object &&cb) { return m_write_y.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_m1_wr_callback(Object &&cb) { return m_write_m1.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_m2_wr_callback(Object &&cb) { return m_write_m2.set_callback(std::forward<Object>(cb)); }
// peripheral interface
void x_w(uint8_t data) { m_write_x(data); }
diff --git a/src/devices/bus/pc_kbd/ec1841.cpp b/src/devices/bus/pc_kbd/ec1841.cpp
index 2a36345e1fa..51822723c7e 100644
--- a/src/devices/bus/pc_kbd/ec1841.cpp
+++ b/src/devices/bus/pc_kbd/ec1841.cpp
@@ -34,17 +34,17 @@
#include "emu.h"
#include "ec1841.h"
+#define VERBOSE_DBG 0 /* general debug messages */
-//#define LOG_GENERAL (1U << 0) //defined in logmacro.h already
-#define LOG_KEYBOARD (1U << 1)
-#define LOG_DEBUG (1U << 2)
+#define DBG_LOG(N,M,A) \
+ do { \
+ if(VERBOSE_DBG>=N) \
+ { \
+ logerror("%11.6f at %s: ",machine().time().as_double(),machine().describe_context()); \
+ logerror A; \
+ } \
+ } while (0)
-//#define VERBOSE (LOG_DEBUG)
-//#define LOG_OUTPUT_FUNC printf
-#include "logmacro.h"
-
-#define LOGKBD(...) LOGMASKED(LOG_KEYBOARD, __VA_ARGS__)
-#define LOGDBG(...) LOGMASKED(LOG_DEBUG, __VA_ARGS__)
//**************************************************************************
@@ -54,6 +54,7 @@
#define I8048_TAG "i8048"
+
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
@@ -326,7 +327,7 @@ void ec_1841_keyboard_device::device_reset()
WRITE_LINE_MEMBER( ec_1841_keyboard_device::clock_write )
{
- LOG("clock write %d\n", state);
+ DBG_LOG(1,0,( "%s: clock write %d\n", tag(), state));
}
@@ -336,7 +337,7 @@ WRITE_LINE_MEMBER( ec_1841_keyboard_device::clock_write )
WRITE_LINE_MEMBER( ec_1841_keyboard_device::data_write )
{
- LOG("data write %d\n", state);
+ DBG_LOG(1,0,( "%s: data write %d\n", tag(), state));
}
@@ -346,7 +347,7 @@ WRITE_LINE_MEMBER( ec_1841_keyboard_device::data_write )
WRITE8_MEMBER( ec_1841_keyboard_device::bus_w )
{
- LOGDBG("bus_w %02x\n", data);
+ DBG_LOG(2,0,( "%s: bus_w %02x\n", tag(), data));
m_bus = data;
}
@@ -378,7 +379,7 @@ READ8_MEMBER( ec_1841_keyboard_device::p1_r )
data |= clock_signal();
data |= data_signal() << 1;
- LOG("p1_r %02x\n", data);
+ DBG_LOG(1,0,( "%s: p1_r %02x\n", tag(), data));
return data;
}
@@ -402,7 +403,7 @@ WRITE8_MEMBER( ec_1841_keyboard_device::p1_w )
6 LED XXX
7 LED XXX
*/
- LOG("p1_w %02x\n", data);
+ DBG_LOG(1,0,( "%s: p1_w %02x\n", tag(), data));
m_p1 = data;
}
@@ -426,7 +427,7 @@ WRITE8_MEMBER( ec_1841_keyboard_device::p2_w )
6 XXX CLOCK out 2?
7 XXX
*/
- LOG("p2_w %02x\n", data);
+ DBG_LOG(1,0,( "%s: p2_w %02x\n", tag(), data));
m_pc_kbdc->data_write_from_kb(BIT(data, 2));
m_pc_kbdc->clock_write_from_kb(BIT(data, 1));
@@ -449,7 +450,7 @@ READ_LINE_MEMBER( ec_1841_keyboard_device::t1_r )
m_q = BIT(sense, (m_bus >> 4) & 7);
}
- LOG("bus %02X t1_r %d\n", m_bus, m_q);
+ DBG_LOG(1,0,( "%s: bus %02X t1_r %d\n", tag(), m_bus, m_q));
return m_q;
}
diff --git a/src/devices/bus/pc_kbd/iskr1030.cpp b/src/devices/bus/pc_kbd/iskr1030.cpp
index 3f91451d9ab..e55eabcfc20 100644
--- a/src/devices/bus/pc_kbd/iskr1030.cpp
+++ b/src/devices/bus/pc_kbd/iskr1030.cpp
@@ -9,17 +9,17 @@
#include "emu.h"
#include "iskr1030.h"
+#define VERBOSE_DBG 1 /* general debug messages */
-//#define LOG_GENERAL (1U << 0) //defined in logmacro.h already
-#define LOG_KEYBOARD (1U << 1)
-#define LOG_DEBUG (1U << 2)
+#define DBG_LOG(N,M,A) \
+ do { \
+ if(VERBOSE_DBG>=N) \
+ { \
+ logerror("%11.6f at %s: ",machine().time().as_double(),machine().describe_context()); \
+ logerror A; \
+ } \
+ } while (0)
-//#define VERBOSE (LOG_DEBUG)
-//#define LOG_OUTPUT_FUNC printf
-#include "logmacro.h"
-
-#define LOGKBD(...) LOGMASKED(LOG_KEYBOARD, __VA_ARGS__)
-#define LOGDBG(...) LOGMASKED(LOG_DEBUG, __VA_ARGS__)
//**************************************************************************
@@ -29,6 +29,7 @@
#define I8048_TAG "i8048"
+
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
@@ -319,7 +320,7 @@ void iskr_1030_keyboard_device::device_reset()
WRITE_LINE_MEMBER( iskr_1030_keyboard_device::clock_write )
{
- LOG("clock write %d\n", state);
+ DBG_LOG(1,0,( "%s: clock write %d\n", tag(), state));
m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE);
}
@@ -330,7 +331,7 @@ WRITE_LINE_MEMBER( iskr_1030_keyboard_device::clock_write )
WRITE_LINE_MEMBER( iskr_1030_keyboard_device::data_write )
{
- LOG("data write %d\n", state);
+ DBG_LOG(1,0,( "%s: data write %d\n", tag(), state));
}
@@ -344,12 +345,12 @@ READ_LINE_MEMBER( iskr_1030_keyboard_device::t1_r )
uint8_t bias = m_p1 & 15;
if (!BIT(m_p1, 7)) {
- LOGDBG("t1_r (l) %d\n", data);
+ DBG_LOG(2,0,( "%s: t1_r (l) %d\n", tag(), data));
return data;
}
if (bias) {
- LOGDBG("t1_r (b) %d\n", bias);
+ DBG_LOG(2,0,( "%s: t1_r (b) %d\n", tag(), bias));
return 1;
}
@@ -383,7 +384,7 @@ READ_LINE_MEMBER( iskr_1030_keyboard_device::t1_r )
}
data = BIT(data, m_bus&3);
- LOGDBG("t1_r (k r%d c%d) %d\n", m_bus&3, m_bus>>2, data);
+ DBG_LOG(2,0,( "%s: t1_r (k r%d c%d) %d\n", tag(), m_bus&3, m_bus>>2, data));
return data;
}
@@ -394,7 +395,7 @@ READ_LINE_MEMBER( iskr_1030_keyboard_device::t1_r )
WRITE8_MEMBER( iskr_1030_keyboard_device::ram_w )
{
- LOGDBG("ram_w[%02x] <- %02x\n", offset, data);
+ DBG_LOG(2,0,( "%s: ram_w[%02x] <- %02x\n", tag(), offset, data));
m_bus = offset;
m_ram[offset] = data;
@@ -407,7 +408,7 @@ WRITE8_MEMBER( iskr_1030_keyboard_device::ram_w )
READ8_MEMBER( iskr_1030_keyboard_device::ram_r )
{
- LOGDBG("ram_r[%02x] = %02x\n", offset, m_ram[offset]);
+ DBG_LOG(2,0,( "%s: ram_r[%02x] = %02x\n", tag(), offset, m_ram[offset]));
return m_ram[offset];
}
@@ -434,7 +435,7 @@ READ8_MEMBER( iskr_1030_keyboard_device::p1_r )
uint8_t data = 0;
- LOG("p1_r %02x\n", data);
+ DBG_LOG(1,0,( "%s: p1_r %02x\n", tag(), data));
return data;
}
@@ -458,7 +459,7 @@ WRITE8_MEMBER( iskr_1030_keyboard_device::p2_w )
6 LED NLK
7 LED CLK
*/
- LOG("p2_w %02x\n", data);
+ DBG_LOG(1,0,( "%s: p2_w %02x\n", tag(), data));
m_p2 = data;
}
@@ -485,7 +486,7 @@ WRITE8_MEMBER( iskr_1030_keyboard_device::p1_w )
m_p1 = data;
- LOG("p1_w %02x (c %d d %d bias %d)\n", data, BIT(data, 4), BIT(data, 5), data&15);
+ DBG_LOG(1,0,( "%s: p1_w %02x (c %d d %d bias %d)\n", tag(), data, BIT(data, 4), BIT(data, 5), data&15));
m_pc_kbdc->data_write_from_kb(BIT(data, 5));
m_pc_kbdc->clock_write_from_kb(BIT(data, 4));
diff --git a/src/devices/bus/pc_kbd/pc_kbdc.cpp b/src/devices/bus/pc_kbd/pc_kbdc.cpp
index 5e99056adbe..6d28227bca2 100644
--- a/src/devices/bus/pc_kbd/pc_kbdc.cpp
+++ b/src/devices/bus/pc_kbd/pc_kbdc.cpp
@@ -118,12 +118,9 @@ void pc_kbdc_device::update_clock_state()
// We first set our state to prevent possible endless loops
m_clock_state = new_clock_state;
- // Send state to keyboard interface logic on mainboard
- m_out_clock_cb(m_clock_state);
-
// Send state to keyboard
if (m_keyboard)
- m_keyboard->clock_write(m_clock_state);
+ m_keyboard->clock_write( m_clock_state );
}
}
@@ -137,9 +134,6 @@ void pc_kbdc_device::update_data_state()
// We first set our state to prevent possible endless loops
m_data_state = new_data_state;
- // Send state to keyboard interface logic on mainboard
- m_out_data_cb(m_data_state);
-
// Send state to keyboard
if (m_keyboard)
m_keyboard->data_write(m_data_state);
@@ -163,15 +157,23 @@ WRITE_LINE_MEMBER(pc_kbdc_device::data_write_from_mb)
WRITE_LINE_MEMBER(pc_kbdc_device::clock_write_from_kb)
{
- m_kb_clock_state = state;
- update_clock_state();
+ state = state ? 1 : 0;
+ if (state != m_kb_clock_state)
+ {
+ m_out_clock_cb(m_kb_clock_state = state);
+ update_clock_state();
+ }
}
WRITE_LINE_MEMBER(pc_kbdc_device::data_write_from_kb)
{
- m_kb_data_state = state;
- update_data_state();
+ state = state ? 1 : 0;
+ if (state != m_kb_data_state)
+ {
+ m_out_data_cb(m_kb_data_state = state);
+ update_data_state();
+ }
}
diff --git a/src/devices/bus/pc_kbd/pc_kbdc.h b/src/devices/bus/pc_kbd/pc_kbdc.h
index ff1168c314c..dac06daf60f 100644
--- a/src/devices/bus/pc_kbd/pc_kbdc.h
+++ b/src/devices/bus/pc_kbd/pc_kbdc.h
@@ -17,6 +17,21 @@ set the data line and then set the clock line.
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_PC_KBDC_OUT_CLOCK_CB(_devcb) \
+ downcast<pc_kbdc_device &>(*device).set_out_clock_callback(DEVCB_##_devcb);
+
+#define MCFG_PC_KBDC_OUT_DATA_CB(_devcb) \
+ downcast<pc_kbdc_device &>(*device).set_out_data_callback(DEVCB_##_devcb);
+
+#define MCFG_PC_KBDC_SLOT_ADD(_kbdc_tag, _tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, PC_KBDC_SLOT, 0 ) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<pc_kbdc_slot_device &>(*device).set_pc_kbdc_slot(subdevice(_kbdc_tag) );
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -61,6 +76,8 @@ public:
// construction/destruction
pc_kbdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <class Object> devcb_base &set_out_clock_callback(Object &&cb) { return m_out_clock_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_data_callback(Object &&cb) { return m_out_data_cb.set_callback(std::forward<Object>(cb)); }
auto out_clock_cb() { return m_out_clock_cb.bind(); }
auto out_data_cb() { return m_out_data_cb.bind(); }
diff --git a/src/devices/bus/pce/pce_slot.h b/src/devices/bus/pce/pce_slot.h
index add982a534b..658384cb82b 100644
--- a/src/devices/bus/pce/pce_slot.h
+++ b/src/devices/bus/pce/pce_slot.h
@@ -65,17 +65,6 @@ class pce_cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- pce_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt, const char *interface)
- : pce_cart_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- set_intf(interface);
- }
-
pce_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~pce_cart_slot_device();
@@ -126,4 +115,15 @@ DECLARE_DEVICE_TYPE(PCE_CART_SLOT, pce_cart_slot_device)
#define PCESLOT_ROM_REGION_TAG ":cart:rom"
+#define MCFG_PCE_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, PCE_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ static_cast<pce_cart_slot_device *>(device)->set_intf("pce_cart");
+
+#define MCFG_TG16_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, PCE_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ static_cast<pce_cart_slot_device *>(device)->set_intf("tg16_cart");
+
+
#endif // MAME_BUS_PCE_PCE_SLOT_H
diff --git a/src/devices/bus/pet/2joysnd.cpp b/src/devices/bus/pet/2joysnd.cpp
index 7bc3915a283..b89ca59f7f8 100644
--- a/src/devices/bus/pet/2joysnd.cpp
+++ b/src/devices/bus/pet/2joysnd.cpp
@@ -93,13 +93,12 @@ ioport_constructor pet_userport_joystick_and_sound_device::device_input_ports()
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void pet_userport_joystick_and_sound_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(pet_userport_joystick_and_sound_device::device_add_mconfig)
SPEAKER(config, "speaker").front_center();
- DAC_1BIT(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.99);
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
-}
+ MCFG_DEVICE_ADD("dac", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.99)
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/bus/pet/64k.cpp b/src/devices/bus/pet/64k.cpp
index 85f91114386..34249220f3e 100644
--- a/src/devices/bus/pet/64k.cpp
+++ b/src/devices/bus/pet/64k.cpp
@@ -113,7 +113,7 @@ void pet_64k_expansion_device::device_reset()
// pet_norom_r - NO ROM read
//-------------------------------------------------
-int pet_64k_expansion_device::pet_norom_r(offs_t offset, int sel)
+int pet_64k_expansion_device::pet_norom_r(address_space &space, offs_t offset, int sel)
{
return !BIT(m_ctrl, 7);
}
@@ -123,7 +123,7 @@ int pet_64k_expansion_device::pet_norom_r(offs_t offset, int sel)
// pet_bd_r - buffered data read
//-------------------------------------------------
-uint8_t pet_64k_expansion_device::pet_bd_r(offs_t offset, uint8_t data, int &sel)
+uint8_t pet_64k_expansion_device::pet_bd_r(address_space &space, offs_t offset, uint8_t data, int &sel)
{
if (BIT(m_ctrl, 7))
{
@@ -164,7 +164,7 @@ uint8_t pet_64k_expansion_device::pet_bd_r(offs_t offset, uint8_t data, int &sel
// pet_bd_w - buffered data write
//-------------------------------------------------
-void pet_64k_expansion_device::pet_bd_w(offs_t offset, uint8_t data, int &sel)
+void pet_64k_expansion_device::pet_bd_w(address_space &space, offs_t offset, uint8_t data, int &sel)
{
if (BIT(m_ctrl, 7))
{
diff --git a/src/devices/bus/pet/64k.h b/src/devices/bus/pet/64k.h
index 7cf03cd621b..82f50cab77a 100644
--- a/src/devices/bus/pet/64k.h
+++ b/src/devices/bus/pet/64k.h
@@ -33,9 +33,9 @@ protected:
virtual void device_reset() override;
// device_pet_expansion_card_interface overrides
- virtual int pet_norom_r(offs_t offset, int sel) override;
- virtual uint8_t pet_bd_r(offs_t offset, uint8_t data, int &sel) override;
- virtual void pet_bd_w(offs_t offset, uint8_t data, int &sel) override;
+ virtual int pet_norom_r(address_space &space, offs_t offset, int sel) override;
+ virtual uint8_t pet_bd_r(address_space &space, offs_t offset, uint8_t data, int &sel) override;
+ virtual void pet_bd_w(address_space &space, offs_t offset, uint8_t data, int &sel) override;
private:
inline uint8_t read_ram(offs_t offset);
diff --git a/src/devices/bus/pet/c2n.cpp b/src/devices/bus/pet/c2n.cpp
index e7ac6e27c28..1212f46c3ca 100644
--- a/src/devices/bus/pet/c2n.cpp
+++ b/src/devices/bus/pet/c2n.cpp
@@ -24,13 +24,12 @@ DEFINE_DEVICE_TYPE(C1531, c1531_device, "c1531", "Commodore 1531 Datassette")
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void c2n_device::device_add_mconfig(machine_config &config)
-{
- CASSETTE(config, m_cassette);
- m_cassette->set_formats(cbm_cassette_formats);
- m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED);
- m_cassette->set_interface("cbm_cass");
-}
+MACHINE_CONFIG_START(c2n_device::device_add_mconfig)
+ MCFG_CASSETTE_ADD("cassette" )
+ MCFG_CASSETTE_FORMATS(cbm_cassette_formats)
+ MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED)
+ MCFG_CASSETTE_INTERFACE("cbm_cass")
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/pet/cass.h b/src/devices/bus/pet/cass.h
index babfdf2058d..d5a43fee19c 100644
--- a/src/devices/bus/pet/cass.h
+++ b/src/devices/bus/pet/cass.h
@@ -31,6 +31,18 @@
#define PET_DATASSETTE_PORT2_TAG "tape2"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_PET_DATASSETTE_PORT_ADD(_tag, _slot_intf, _def_slot, _devcb) \
+ MCFG_DEVICE_ADD(_tag, PET_DATASSETTE_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<pet_datassette_port_device &>(*device).set_read_handler(DEVCB_##_devcb);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -56,6 +68,7 @@ public:
virtual ~pet_datassette_port_device();
// static configuration helpers
+ template <class Object> devcb_base &set_read_handler(Object &&cb) { return m_read_handler.set_callback(std::forward<Object>(cb)); }
auto read_handler() { return m_read_handler.bind(); }
// computer interface
diff --git a/src/devices/bus/pet/cb2snd.cpp b/src/devices/bus/pet/cb2snd.cpp
index fffbb70923e..a9f5ccb480a 100644
--- a/src/devices/bus/pet/cb2snd.cpp
+++ b/src/devices/bus/pet/cb2snd.cpp
@@ -26,13 +26,12 @@ DEFINE_DEVICE_TYPE(PET_USERPORT_CB2_SOUND_DEVICE, pet_userport_cb2_sound_device,
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void pet_userport_cb2_sound_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(pet_userport_cb2_sound_device::device_add_mconfig)
SPEAKER(config, "speaker").front_center();
- DAC_1BIT(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.99);
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
-}
+ MCFG_DEVICE_ADD("dac", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.99)
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/bus/pet/exp.cpp b/src/devices/bus/pet/exp.cpp
index 07aa7155b93..ab7cc9e04dd 100644
--- a/src/devices/bus/pet/exp.cpp
+++ b/src/devices/bus/pet/exp.cpp
@@ -115,9 +115,9 @@ void pet_expansion_slot_device::device_reset()
// norom_r - NO ROM read
//-------------------------------------------------
-int pet_expansion_slot_device::norom_r(offs_t offset, int sel)
+int pet_expansion_slot_device::norom_r(address_space &space, offs_t offset, int sel)
{
- return m_card ? m_card->pet_norom_r(offset, sel) : 1;
+ return m_card ? m_card->pet_norom_r(space, offset, sel) : 1;
}
@@ -125,11 +125,11 @@ int pet_expansion_slot_device::norom_r(offs_t offset, int sel)
// read - buffered data read
//-------------------------------------------------
-uint8_t pet_expansion_slot_device::read(offs_t offset, uint8_t data, int &sel)
+uint8_t pet_expansion_slot_device::read(address_space &space, offs_t offset, uint8_t data, int &sel)
{
if (m_card != nullptr)
{
- data = m_card->pet_bd_r(offset, data, sel);
+ data = m_card->pet_bd_r(space, offset, data, sel);
}
return data;
@@ -140,11 +140,11 @@ uint8_t pet_expansion_slot_device::read(offs_t offset, uint8_t data, int &sel)
// write - buffered data write
//-------------------------------------------------
-void pet_expansion_slot_device::write(offs_t offset, uint8_t data, int &sel)
+void pet_expansion_slot_device::write(address_space &space, offs_t offset, uint8_t data, int &sel)
{
if (m_card != nullptr)
{
- m_card->pet_bd_w(offset, data, sel);
+ m_card->pet_bd_w(space, offset, data, sel);
}
}
diff --git a/src/devices/bus/pet/exp.h b/src/devices/bus/pet/exp.h
index 39309b65f4c..d44dcea6d19 100644
--- a/src/devices/bus/pet/exp.h
+++ b/src/devices/bus/pet/exp.h
@@ -23,6 +23,21 @@
#define PET_EXPANSION_SLOT_TAG "exp"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_PET_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, PET_EXPANSION_SLOT, _clock) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+#define MCFG_PET_EXPANSION_SLOT_DMA_CALLBACKS(_read, _write) \
+ downcast<pet_expansion_slot_device *>(device)->set_callbacks(DEVCB_##_read, DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -48,13 +63,18 @@ public:
pet_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~pet_expansion_slot_device();
+ template <class Read, class Write> void set_callbacks(Read &&rd, Write &&wr) {
+ m_read_dma.set_callback(std::forward<Read>(rd));
+ m_write_dma.set_callback(std::forward<Write>(wr));
+ }
+
auto dma_read_callback() { return m_read_dma.bind(); }
auto dma_write_callback() { return m_write_dma.bind(); }
// computer interface
- int norom_r(offs_t offset, int sel);
- uint8_t read(offs_t offset, uint8_t data, int &sel);
- void write(offs_t offset, uint8_t data, int &sel);
+ int norom_r(address_space &space, offs_t offset, int sel);
+ uint8_t read(address_space &space, offs_t offset, uint8_t data, int &sel);
+ void write(address_space &space, offs_t offset, uint8_t data, int &sel);
DECLARE_READ_LINE_MEMBER( diag_r );
DECLARE_WRITE_LINE_MEMBER( irq_w );
@@ -111,9 +131,9 @@ protected:
device_pet_expansion_card_interface(const machine_config &mconfig, device_t &device);
// runtime
- virtual int pet_norom_r(offs_t offset, int sel) { return 1; }
- virtual uint8_t pet_bd_r(offs_t offset, uint8_t data, int &sel) { return data; };
- virtual void pet_bd_w(offs_t offset, uint8_t data, int &sel) { };
+ virtual int pet_norom_r(address_space &space, offs_t offset, int sel) { return 1; }
+ virtual uint8_t pet_bd_r(address_space &space, offs_t offset, uint8_t data, int &sel) { return data; };
+ virtual void pet_bd_w(address_space &space, offs_t offset, uint8_t data, int &sel) { };
virtual int pet_diag_r() { return 1; }
virtual void pet_irq_w(int state) { }
diff --git a/src/devices/bus/pet/hsg.cpp b/src/devices/bus/pet/hsg.cpp
index 7c6e7c657d6..5288b632174 100644
--- a/src/devices/bus/pet/hsg.cpp
+++ b/src/devices/bus/pet/hsg.cpp
@@ -91,39 +91,37 @@ void cbm8000_hsg_b_device::hsg_b_map(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void cbm8000_hsg_a_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER, rgb_t::green()));
- screen.set_screen_update(EF9365_TAG, FUNC(ef9365_device::screen_update));
- screen.set_size(512, 512);
- screen.set_visarea(0, 512-1, 0, 512-1);
- screen.set_refresh_hz(25);
+MACHINE_CONFIG_START(cbm8000_hsg_a_device::device_add_mconfig)
+ MCFG_SCREEN_ADD_MONOCHROME(SCREEN_TAG, RASTER, rgb_t::green())
+ MCFG_SCREEN_UPDATE_DEVICE(EF9365_TAG, ef9365_device, screen_update)
+ MCFG_SCREEN_SIZE(512, 512)
+ MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 512-1)
+ MCFG_SCREEN_REFRESH_RATE(25)
PALETTE(config, "palette", palette_device::MONOCHROME);
- EF9365(config, m_gdc, 1750000);
- m_gdc->set_screen(SCREEN_TAG);
- m_gdc->set_addrmap(0, &cbm8000_hsg_a_device::hsg_a_map);
- m_gdc->set_palette_tag("palette");
- m_gdc->set_nb_bitplanes(1);
- m_gdc->set_display_mode(ef9365_device::DISPLAY_MODE_512x512);
-}
-
-void cbm8000_hsg_b_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER, rgb_t::green()));
- screen.set_screen_update(EF9366_TAG, FUNC(ef9365_device::screen_update));
- screen.set_size(512, 256);
- screen.set_visarea(0, 512-1, 0, 256-1);
- screen.set_refresh_hz(50);
+ MCFG_DEVICE_ADD(EF9365_TAG, EF9365, 1750000)
+ MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
+ MCFG_DEVICE_ADDRESS_MAP(0, hsg_a_map)
+ MCFG_EF936X_PALETTE("palette")
+ MCFG_EF936X_BITPLANES_CNT(1);
+ MCFG_EF936X_DISPLAYMODE(DISPLAY_MODE_512x512);
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(cbm8000_hsg_b_device::device_add_mconfig)
+ MCFG_SCREEN_ADD_MONOCHROME(SCREEN_TAG, RASTER, rgb_t::green())
+ MCFG_SCREEN_UPDATE_DEVICE(EF9366_TAG, ef9365_device, screen_update)
+ MCFG_SCREEN_SIZE(512, 256)
+ MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
+ MCFG_SCREEN_REFRESH_RATE(50)
PALETTE(config, "palette", palette_device::MONOCHROME);
- EF9365(config, m_gdc, 1750000); //EF9366
- m_gdc->set_screen(SCREEN_TAG);
- m_gdc->set_addrmap(0, &cbm8000_hsg_b_device::hsg_b_map);
- m_gdc->set_palette_tag("palette");
- m_gdc->set_nb_bitplanes(1);
- m_gdc->set_display_mode(ef9365_device::DISPLAY_MODE_512x256);
-}
+ MCFG_DEVICE_ADD(EF9366_TAG, EF9365, 1750000)
+ MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
+ MCFG_DEVICE_ADDRESS_MAP(0, hsg_b_map)
+ MCFG_EF936X_PALETTE("palette")
+ MCFG_EF936X_BITPLANES_CNT(1);
+ MCFG_EF936X_DISPLAYMODE(DISPLAY_MODE_512x256);
+MACHINE_CONFIG_END
@@ -178,7 +176,7 @@ void cbm8000_hsg_device::device_reset()
// pet_norom_r - NO ROM read
//-------------------------------------------------
-int cbm8000_hsg_device::pet_norom_r(offs_t offset, int sel)
+int cbm8000_hsg_device::pet_norom_r(address_space &space, offs_t offset, int sel)
{
return !(offset >= 0x9000 && offset < 0xaf00);
}
@@ -188,7 +186,7 @@ int cbm8000_hsg_device::pet_norom_r(offs_t offset, int sel)
// pet_bd_r - buffered data read
//-------------------------------------------------
-uint8_t cbm8000_hsg_device::pet_bd_r(offs_t offset, uint8_t data, int &sel)
+uint8_t cbm8000_hsg_device::pet_bd_r(address_space &space, offs_t offset, uint8_t data, int &sel)
{
switch (sel)
{
@@ -224,7 +222,7 @@ uint8_t cbm8000_hsg_device::pet_bd_r(offs_t offset, uint8_t data, int &sel)
}
else if (offset >= 0xaf70 && offset < 0xaf80)
{
- data = m_gdc->data_r(offset & 0x0f);
+ data = m_gdc->data_r(space, offset & 0x0f);
}
break;
}
@@ -237,7 +235,7 @@ uint8_t cbm8000_hsg_device::pet_bd_r(offs_t offset, uint8_t data, int &sel)
// pet_bd_w - buffered data write
//-------------------------------------------------
-void cbm8000_hsg_device::pet_bd_w(offs_t offset, uint8_t data, int &sel)
+void cbm8000_hsg_device::pet_bd_w(address_space &space, offs_t offset, uint8_t data, int &sel)
{
if (offset == 0xaf00)
{
@@ -258,6 +256,6 @@ void cbm8000_hsg_device::pet_bd_w(offs_t offset, uint8_t data, int &sel)
}
else if (offset >= 0xaf70 && offset < 0xaf80)
{
- m_gdc->data_w(offset & 0x0f, data);
+ m_gdc->data_w(space, offset & 0x0f, data);
}
}
diff --git a/src/devices/bus/pet/hsg.h b/src/devices/bus/pet/hsg.h
index e86cb101ac3..44abebbf9ef 100644
--- a/src/devices/bus/pet/hsg.h
+++ b/src/devices/bus/pet/hsg.h
@@ -36,13 +36,12 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override;
// device_pet_expansion_card_interface overrides
- virtual int pet_norom_r(offs_t offset, int sel) override;
- virtual uint8_t pet_bd_r(offs_t offset, uint8_t data, int &sel) override;
- virtual void pet_bd_w(offs_t offset, uint8_t data, int &sel) override;
-
- required_device<ef9365_device> m_gdc;
+ virtual int pet_norom_r(address_space &space, offs_t offset, int sel) override;
+ virtual uint8_t pet_bd_r(address_space &space, offs_t offset, uint8_t data, int &sel) override;
+ virtual void pet_bd_w(address_space &space, offs_t offset, uint8_t data, int &sel) override;
private:
+ required_device<ef9365_device> m_gdc;
required_memory_region m_9000;
required_memory_region m_a000;
};
diff --git a/src/devices/bus/pet/superpet.cpp b/src/devices/bus/pet/superpet.cpp
index ab518bec49f..1aa3ed05014 100644
--- a/src/devices/bus/pet/superpet.cpp
+++ b/src/devices/bus/pet/superpet.cpp
@@ -225,7 +225,7 @@ void superpet_device::device_reset()
// pet_norom_r - NO ROM read
//-------------------------------------------------
-int superpet_device::pet_norom_r(offs_t offset, int sel)
+int superpet_device::pet_norom_r(address_space &space, offs_t offset, int sel)
{
return BIT(m_system, 0);
}
@@ -235,9 +235,9 @@ int superpet_device::pet_norom_r(offs_t offset, int sel)
// pet_bd_r - buffered data read
//-------------------------------------------------
-uint8_t superpet_device::pet_bd_r(offs_t offset, uint8_t data, int &sel)
+uint8_t superpet_device::pet_bd_r(address_space &space, offs_t offset, uint8_t data, int &sel)
{
- int norom = pet_norom_r(offset, sel);
+ int norom = pet_norom_r(space, offset, sel);
switch (sel)
{
@@ -277,14 +277,14 @@ uint8_t superpet_device::pet_bd_r(offs_t offset, uint8_t data, int &sel)
case 0xefe1:
case 0xefe2:
case 0xefe3:
- data = m_dongle->read(offset & 0x03);
+ data = m_dongle->read(space, offset & 0x03);
break;
case 0xeff0:
case 0xeff1:
case 0xeff2:
case 0xeff3:
- data = m_acia->read(offset & 0x03);
+ data = m_acia->read(space, offset & 0x03);
break;
}
@@ -296,7 +296,7 @@ uint8_t superpet_device::pet_bd_r(offs_t offset, uint8_t data, int &sel)
// pet_bd_w - buffered data write
//-------------------------------------------------
-void superpet_device::pet_bd_w(offs_t offset, uint8_t data, int &sel)
+void superpet_device::pet_bd_w(address_space &space, offs_t offset, uint8_t data, int &sel)
{
switch (sel)
{
@@ -314,7 +314,7 @@ void superpet_device::pet_bd_w(offs_t offset, uint8_t data, int &sel)
case 0xefe1:
case 0xefe2:
case 0xefe3:
- m_dongle->write(offset & 0x03, data);
+ m_dongle->write(space, offset & 0x03, data);
printf("6702 %u %02x\n", offset & 0x03, data);
break;
@@ -322,7 +322,7 @@ void superpet_device::pet_bd_w(offs_t offset, uint8_t data, int &sel)
case 0xeff1:
case 0xeff2:
case 0xeff3:
- m_acia->write(offset & 0x03, data);
+ m_acia->write(space, offset & 0x03, data);
break;
case 0xeff8:
diff --git a/src/devices/bus/pet/superpet.h b/src/devices/bus/pet/superpet.h
index 6a6dfde0889..35c74af8ab0 100644
--- a/src/devices/bus/pet/superpet.h
+++ b/src/devices/bus/pet/superpet.h
@@ -41,9 +41,9 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_pet_expansion_card_interface overrides
- virtual int pet_norom_r(offs_t offset, int sel) override;
- virtual uint8_t pet_bd_r(offs_t offset, uint8_t data, int &sel) override;
- virtual void pet_bd_w(offs_t offset, uint8_t data, int &sel) override;
+ virtual int pet_norom_r(address_space &space, offs_t offset, int sel) override;
+ virtual uint8_t pet_bd_r(address_space &space, offs_t offset, uint8_t data, int &sel) override;
+ virtual void pet_bd_w(address_space &space, offs_t offset, uint8_t data, int &sel) override;
virtual int pet_diag_r() override;
virtual void pet_irq_w(int state) override;
diff --git a/src/devices/bus/plus4/c1551.cpp b/src/devices/bus/plus4/c1551.cpp
index 333dea55fb0..63cda307f2b 100644
--- a/src/devices/bus/plus4/c1551.cpp
+++ b/src/devices/bus/plus4/c1551.cpp
@@ -57,7 +57,7 @@ const tiny_rom_entry *c1551_device::device_rom_region() const
// M6510_INTERFACE( cpu_intf )
//-------------------------------------------------
-uint8_t c1551_device::port_r()
+READ8_MEMBER( c1551_device::port_r )
{
/*
@@ -85,7 +85,7 @@ uint8_t c1551_device::port_r()
return data;
}
-void c1551_device::port_w(uint8_t data)
+WRITE8_MEMBER( c1551_device::port_w )
{
/*
@@ -120,7 +120,7 @@ void c1551_device::port_w(uint8_t data)
// tpi6525_interface tpi0_intf
//-------------------------------------------------
-uint8_t c1551_device::tcbm_data_r()
+READ8_MEMBER( c1551_device::tcbm_data_r )
{
/*
@@ -140,7 +140,7 @@ uint8_t c1551_device::tcbm_data_r()
return m_tcbm_data;
}
-void c1551_device::tcbm_data_w(uint8_t data)
+WRITE8_MEMBER( c1551_device::tcbm_data_w )
{
/*
@@ -160,9 +160,9 @@ void c1551_device::tcbm_data_w(uint8_t data)
m_tcbm_data = data;
}
-uint8_t c1551_device::tpi0_r(offs_t offset)
+READ8_MEMBER( c1551_device::tpi0_r )
{
- uint8_t data = m_tpi0->read(offset);
+ uint8_t data = m_tpi0->read(space, offset);
m_ga->ted_w(0);
m_ga->ted_w(1);
@@ -170,15 +170,15 @@ uint8_t c1551_device::tpi0_r(offs_t offset)
return data;
}
-void c1551_device::tpi0_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( c1551_device::tpi0_w )
{
- m_tpi0->write(offset, data);
+ m_tpi0->write(space, offset, data);
m_ga->ted_w(0);
m_ga->ted_w(1);
}
-uint8_t c1551_device::tpi0_pc_r()
+READ8_MEMBER( c1551_device::tpi0_pc_r )
{
/*
@@ -209,7 +209,7 @@ uint8_t c1551_device::tpi0_pc_r()
return data;
}
-void c1551_device::tpi0_pc_w(uint8_t data)
+WRITE8_MEMBER( c1551_device::tpi0_pc_w )
{
/*
@@ -243,7 +243,7 @@ void c1551_device::tpi0_pc_w(uint8_t data)
// tpi6525_interface tpi1_intf
//-------------------------------------------------
-uint8_t c1551_device::tpi1_pb_r()
+READ8_MEMBER( c1551_device::tpi1_pb_r )
{
/*
@@ -263,7 +263,7 @@ uint8_t c1551_device::tpi1_pb_r()
return m_status & 0x03;
}
-uint8_t c1551_device::tpi1_pc_r()
+READ8_MEMBER( c1551_device::tpi1_pc_r )
{
/*
@@ -288,7 +288,7 @@ uint8_t c1551_device::tpi1_pc_r()
return data;
}
-void c1551_device::tpi1_pc_w(uint8_t data)
+WRITE8_MEMBER( c1551_device::tpi1_pc_w )
{
/*
@@ -524,13 +524,13 @@ bool c1551_device::tpi1_selected(offs_t offset)
// plus4_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t c1551_device::plus4_cd_r(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
+uint8_t c1551_device::plus4_cd_r(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
{
- data = m_exp->cd_r(offset, data, ba, cs0, c1l, c2l, cs1, c1h, c2h);
+ data = m_exp->cd_r(space, offset, data, ba, cs0, c1l, c2l, cs1, c1h, c2h);
if (tpi1_selected(offset))
{
- data = m_tpi1->read(offset & 0x07);
+ data = m_tpi1->read(space, offset & 0x07);
}
return data;
@@ -541,12 +541,12 @@ uint8_t c1551_device::plus4_cd_r(offs_t offset, uint8_t data, int ba, int cs0, i
// plus4_cd_w - cartridge data write
//-------------------------------------------------
-void c1551_device::plus4_cd_w(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
+void c1551_device::plus4_cd_w(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
{
if (tpi1_selected(offset))
{
- m_tpi1->write(offset & 0x07, data);
+ m_tpi1->write(space, offset & 0x07, data);
}
- m_exp->cd_w(offset, data, ba, cs0, c1l, c2l, cs1, c1h, c2h);
+ m_exp->cd_w(space, offset, data, ba, cs0, c1l, c2l, cs1, c1h, c2h);
}
diff --git a/src/devices/bus/plus4/c1551.h b/src/devices/bus/plus4/c1551.h
index 3fce289461c..b108fc94ef1 100644
--- a/src/devices/bus/plus4/c1551.h
+++ b/src/devices/bus/plus4/c1551.h
@@ -44,24 +44,24 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_plus4_expansion_card_interface overrides
- virtual uint8_t plus4_cd_r(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) override;
- virtual void plus4_cd_w(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) override;
+ virtual uint8_t plus4_cd_r(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) override;
+ virtual void plus4_cd_w(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) override;
private:
- uint8_t port_r();
- void port_w(uint8_t data);
+ DECLARE_READ8_MEMBER( port_r );
+ DECLARE_WRITE8_MEMBER( port_w );
- uint8_t tcbm_data_r();
- void tcbm_data_w(uint8_t data);
- uint8_t tpi0_pc_r();
- void tpi0_pc_w(uint8_t data);
+ DECLARE_READ8_MEMBER( tcbm_data_r );
+ DECLARE_WRITE8_MEMBER( tcbm_data_w );
+ DECLARE_READ8_MEMBER( tpi0_pc_r );
+ DECLARE_WRITE8_MEMBER( tpi0_pc_w );
- uint8_t tpi1_pb_r();
- uint8_t tpi1_pc_r();
- void tpi1_pc_w(uint8_t data);
+ DECLARE_READ8_MEMBER( tpi1_pb_r );
+ DECLARE_READ8_MEMBER( tpi1_pc_r );
+ DECLARE_WRITE8_MEMBER( tpi1_pc_w );
- uint8_t tpi0_r(offs_t offset);
- void tpi0_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( tpi0_r );
+ DECLARE_WRITE8_MEMBER( tpi0_w );
void c1551_mem(address_map &map);
diff --git a/src/devices/bus/plus4/exp.cpp b/src/devices/bus/plus4/exp.cpp
index 83e8ad4277a..d9ee8642eba 100644
--- a/src/devices/bus/plus4/exp.cpp
+++ b/src/devices/bus/plus4/exp.cpp
@@ -167,11 +167,11 @@ std::string plus4_expansion_slot_device::get_default_card_software(get_default_c
// cd_r - cartridge data read
//-------------------------------------------------
-uint8_t plus4_expansion_slot_device::cd_r(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
+uint8_t plus4_expansion_slot_device::cd_r(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
{
if (m_card != nullptr)
{
- data = m_card->plus4_cd_r(offset, data, ba, cs0, c1l, c1h, cs1, c2l, c2h);
+ data = m_card->plus4_cd_r(space, offset, data, ba, cs0, c1l, c1h, cs1, c2l, c2h);
}
return data;
@@ -182,11 +182,11 @@ uint8_t plus4_expansion_slot_device::cd_r(offs_t offset, uint8_t data, int ba, i
// cd_w - cartridge data write
//-------------------------------------------------
-void plus4_expansion_slot_device::cd_w(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
+void plus4_expansion_slot_device::cd_w(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
{
if (m_card != nullptr)
{
- m_card->plus4_cd_w(offset, data, ba, cs0, c1l, c1h, cs1, c2l, c2h);
+ m_card->plus4_cd_w(space, offset, data, ba, cs0, c1l, c1h, cs1, c2l, c2h);
}
}
diff --git a/src/devices/bus/plus4/exp.h b/src/devices/bus/plus4/exp.h
index 9f625442d99..e61755a497e 100644
--- a/src/devices/bus/plus4/exp.h
+++ b/src/devices/bus/plus4/exp.h
@@ -49,6 +49,37 @@
#define PLUS4_EXPANSION_SLOT_TAG "exp"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_PLUS4_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, PLUS4_EXPANSION_SLOT, _clock) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+#define MCFG_PLUS4_PASSTHRU_EXPANSION_SLOT_ADD() \
+ MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, 0, plus4_expansion_cards, nullptr) \
+ MCFG_PLUS4_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(DEVICE_SELF_OWNER, plus4_expansion_slot_device, irq_w)) \
+ MCFG_PLUS4_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(DEVICE_SELF_OWNER, plus4_expansion_slot_device, dma_cd_r)) \
+ MCFG_PLUS4_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(DEVICE_SELF_OWNER, plus4_expansion_slot_device, dma_cd_w)) \
+ MCFG_PLUS4_EXPANSION_SLOT_AEC_CALLBACK(WRITELINE(DEVICE_SELF_OWNER, plus4_expansion_slot_device, aec_w))
+
+
+#define MCFG_PLUS4_EXPANSION_SLOT_IRQ_CALLBACK(_write) \
+ downcast<plus4_expansion_slot_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
+
+#define MCFG_PLUS4_EXPANSION_SLOT_CD_INPUT_CALLBACK(_read) \
+ downcast<plus4_expansion_slot_device &>(*device).set_cd_rd_callback(DEVCB_##_read);
+
+#define MCFG_PLUS4_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(_write) \
+ downcast<plus4_expansion_slot_device &>(*device).set_cd_wr_callback(DEVCB_##_write);
+
+#define MCFG_PLUS4_EXPANSION_SLOT_AEC_CALLBACK(_write) \
+ downcast<plus4_expansion_slot_device &>(*device).set_aec_wr_callback(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -80,12 +111,12 @@ public:
auto aec_wr_callback() { return m_write_aec.bind(); }
// computer interface
- uint8_t cd_r(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h);
- void cd_w(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h);
+ uint8_t cd_r(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h);
+ void cd_w(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h);
// cartridge interface
- uint8_t dma_cd_r(offs_t offset) { return m_read_dma_cd(offset); }
- void dma_cd_w(offs_t offset, uint8_t data) { m_write_dma_cd(offset, data); }
+ DECLARE_READ8_MEMBER( dma_cd_r ) { return m_read_dma_cd(offset); }
+ DECLARE_WRITE8_MEMBER( dma_cd_w ) { m_write_dma_cd(offset, data); }
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_write_irq(state); }
DECLARE_WRITE_LINE_MEMBER( aec_w ) { m_write_aec(state); }
int phi2() { return clock(); }
@@ -133,8 +164,8 @@ public:
virtual ~device_plus4_expansion_card_interface();
// runtime
- virtual uint8_t plus4_cd_r(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) { return data; }
- virtual void plus4_cd_w(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) { }
+ virtual uint8_t plus4_cd_r(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) { return data; }
+ virtual void plus4_cd_w(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) { }
protected:
device_plus4_expansion_card_interface(const machine_config &mconfig, device_t &device);
diff --git a/src/devices/bus/plus4/sid.cpp b/src/devices/bus/plus4/sid.cpp
index 1ebfdafd657..f97deec6310 100644
--- a/src/devices/bus/plus4/sid.cpp
+++ b/src/devices/bus/plus4/sid.cpp
@@ -64,13 +64,13 @@ const tiny_rom_entry *plus4_sid_cartridge_device::device_rom_region() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void plus4_sid_cartridge_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(plus4_sid_cartridge_device::device_add_mconfig)
SPEAKER(config, "speaker").front_center();
- MOS8580(config, m_sid, XTAL(17'734'470)/20).add_route(ALL_OUTPUTS, "speaker", 1.0);
+ MCFG_DEVICE_ADD(MOS8580_TAG, MOS8580, XTAL(17'734'470)/20)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
- VCS_CONTROL_PORT(config, m_joy, vcs_control_port_devices, nullptr);
-}
+ MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, nullptr)
+MACHINE_CONFIG_END
@@ -114,15 +114,15 @@ void plus4_sid_cartridge_device::device_reset()
// plus4_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t plus4_sid_cartridge_device::plus4_cd_r(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
+uint8_t plus4_sid_cartridge_device::plus4_cd_r(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
{
if ((offset >= 0xfe80 && offset < 0xfea0) || (offset >= 0xfd40 && offset < 0xfd60))
{
- data = m_sid->read(offset & 0x1f);
+ data = m_sid->read(space, offset & 0x1f);
}
else if (offset >= 0xfd80 && offset < 0xfd90)
{
- data = m_joy->joy_r(machine().dummy_space(), 0);
+ data = m_joy->joy_r(space, 0);
}
return data;
@@ -133,11 +133,11 @@ uint8_t plus4_sid_cartridge_device::plus4_cd_r(offs_t offset, uint8_t data, int
// plus4_cd_w - cartridge data write
//-------------------------------------------------
-void plus4_sid_cartridge_device::plus4_cd_w(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
+void plus4_sid_cartridge_device::plus4_cd_w(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
{
if ((offset >= 0xfe80 && offset < 0xfea0) || (offset >= 0xfd40 && offset < 0xfd60))
{
- m_sid->write(offset & 0x1f, data);
+ m_sid->write(space, offset & 0x1f, data);
}
}
diff --git a/src/devices/bus/plus4/sid.h b/src/devices/bus/plus4/sid.h
index 1566381e6d2..90a22fa15c8 100644
--- a/src/devices/bus/plus4/sid.h
+++ b/src/devices/bus/plus4/sid.h
@@ -40,8 +40,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_plus4_expansion_card_interface overrides
- virtual uint8_t plus4_cd_r(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) override;
- virtual void plus4_cd_w(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) override;
+ virtual uint8_t plus4_cd_r(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) override;
+ virtual void plus4_cd_w(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) override;
virtual void plus4_breset_w(int state);
private:
diff --git a/src/devices/bus/plus4/std.cpp b/src/devices/bus/plus4/std.cpp
index c8efe4b679f..835ecac7d4a 100644
--- a/src/devices/bus/plus4/std.cpp
+++ b/src/devices/bus/plus4/std.cpp
@@ -47,7 +47,7 @@ void plus4_standard_cartridge_device::device_start()
// plus4_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t plus4_standard_cartridge_device::plus4_cd_r(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
+uint8_t plus4_standard_cartridge_device::plus4_cd_r(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h)
{
if (!c1l && m_c1l.bytes())
{
diff --git a/src/devices/bus/plus4/std.h b/src/devices/bus/plus4/std.h
index f1f3ae75328..d154f0bcadc 100644
--- a/src/devices/bus/plus4/std.h
+++ b/src/devices/bus/plus4/std.h
@@ -33,7 +33,7 @@ protected:
virtual void device_start() override;
// device_plus4_expansion_card_interface overrides
- virtual uint8_t plus4_cd_r(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) override;
+ virtual uint8_t plus4_cd_r(address_space &space, offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) override;
};
diff --git a/src/devices/bus/pofo/ccm.h b/src/devices/bus/pofo/ccm.h
index 42bfcb4356d..b7deab09c69 100644
--- a/src/devices/bus/pofo/ccm.h
+++ b/src/devices/bus/pofo/ccm.h
@@ -60,6 +60,17 @@
#define PORTFOLIO_MEMORY_CARD_SLOT_B_TAG "ccmb"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_PORTFOLIO_MEMORY_CARD_SLOT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, PORTFOLIO_MEMORY_CARD_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -75,8 +86,8 @@ class device_portfolio_memory_card_slot_interface : public device_slot_card_inte
public:
virtual bool cdet() { return 1; }
- virtual uint8_t nrdi_r(offs_t offset) { return 0xff; }
- virtual void nwri_w(offs_t offset, uint8_t data) { }
+ virtual uint8_t nrdi_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void nwri_w(address_space &space, offs_t offset, uint8_t data) { }
protected:
// construction/destruction
@@ -97,23 +108,13 @@ class portfolio_memory_card_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- portfolio_memory_card_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : portfolio_memory_card_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- portfolio_memory_card_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ portfolio_memory_card_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// computer interface
bool cdet_r() { return (m_card != nullptr) ? m_card->cdet() : 1; }
- uint8_t nrdi_r(offs_t offset) { return (m_card != nullptr) ? m_card->nrdi_r(offset) : 0xff; }
- void nwri_w(offs_t offset, uint8_t data) { if (m_card != nullptr) m_card->nwri_w(offset, data); }
+ DECLARE_READ8_MEMBER( nrdi_r ) { return (m_card != nullptr) ? m_card->nrdi_r(space, offset) : 0xff; }
+ DECLARE_WRITE8_MEMBER( nwri_w ) { if (m_card != nullptr) m_card->nwri_w(space, offset, data); }
protected:
// device-level overrides
diff --git a/src/devices/bus/pofo/exp.h b/src/devices/bus/pofo/exp.h
index 2206d5af2fe..ab0685d28ca 100644
--- a/src/devices/bus/pofo/exp.h
+++ b/src/devices/bus/pofo/exp.h
@@ -54,6 +54,26 @@
#define PORTFOLIO_EXPANSION_SLOT_TAG "exp"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_PORTFOLIO_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, PORTFOLIO_EXPANSION_SLOT, _clock) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+#define MCFG_PORTFOLIO_EXPANSION_SLOT_EINT_CALLBACK(_write) \
+ downcast<portfolio_expansion_slot_device &>(*device).set_eint_wr_callback(DEVCB_##_write);
+
+#define MCFG_PORTFOLIO_EXPANSION_SLOT_NMIO_CALLBACK(_write) \
+ downcast<portfolio_expansion_slot_device &>(*device).set_nmio_wr_callback(DEVCB_##_write);
+
+#define MCFG_PORTFOLIO_EXPANSION_SLOT_WAKE_CALLBACK(_write) \
+ downcast<portfolio_expansion_slot_device &>(*device).set_wake_wr_callback(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -72,8 +92,8 @@ public:
virtual uint8_t iack_r() { return 0xff; }
virtual uint8_t eack_r() { return 0xff; }
- virtual uint8_t nrdi_r(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { return data; }
- virtual void nwri_w(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { }
+ virtual uint8_t nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { return data; }
+ virtual void nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { }
virtual WRITE_LINE_MEMBER( iint_w ) { }
@@ -95,21 +115,11 @@ class portfolio_expansion_slot_device : public device_t, public device_slot_inte
{
public:
// construction/destruction
- template <typename T>
- portfolio_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock, T &&opts, char const *dflt)
- : portfolio_expansion_slot_device(mconfig, tag, owner, clock)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
portfolio_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto eint_wr_callback() { return m_write_eint.bind(); }
- auto nmio_wr_callback() { return m_write_nmio.bind(); }
- auto wake_wr_callback() { return m_write_wake.bind(); }
+ template <class Object> devcb_base &set_eint_wr_callback(Object &&cb) { return m_write_eint.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_nmio_wr_callback(Object &&cb) { return m_write_nmio.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_wake_wr_callback(Object &&cb) { return m_write_wake.set_callback(std::forward<Object>(cb)); }
// computer interface
bool nmd1_r() { return (m_card != nullptr) ? m_card->nmd1() : 1; }
@@ -119,8 +129,8 @@ public:
uint8_t iack_r() { return (m_card != nullptr) ? m_card->iack_r() : 0xff; };
uint8_t eack_r() { return (m_card != nullptr) ? m_card->eack_r() : 0xff; };
- uint8_t nrdi_r(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { return (m_card != nullptr) ? m_card->nrdi_r(offset, data, iom, bcom, ncc1) : data; }
- void nwri_w(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { if (m_card != nullptr) m_card->nwri_w(offset, data, iom, bcom, ncc1); }
+ uint8_t nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { return (m_card != nullptr) ? m_card->nrdi_r(space, offset, data, iom, bcom, ncc1) : data; }
+ void nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { if (m_card != nullptr) m_card->nwri_w(space, offset, data, iom, bcom, ncc1); }
WRITE_LINE_MEMBER( iint_w ) { if (m_card != nullptr) m_card->iint_w(state); }
diff --git a/src/devices/bus/pofo/hpc101.cpp b/src/devices/bus/pofo/hpc101.cpp
index d62f1002f7d..93268e95bb6 100644
--- a/src/devices/bus/pofo/hpc101.cpp
+++ b/src/devices/bus/pofo/hpc101.cpp
@@ -33,31 +33,28 @@ DEFINE_DEVICE_TYPE(POFO_HPC101, pofo_hpc101_device, "pofo_hpc101", "Atari Portfo
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void pofo_hpc101_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(pofo_hpc101_device::device_add_mconfig)
I8255A(config, m_ppi);
m_ppi->out_pa_callback().set("cent_data_out", FUNC(output_latch_device::bus_w));
m_ppi->out_pb_callback().set("cent_ctrl_out", FUNC(output_latch_device::bus_w));
m_ppi->in_pc_callback().set("cent_status_in", FUNC(input_buffer_device::bus_r));
- centronics_device &centronics(CENTRONICS(config, CENTRONICS_TAG, centronics_devices, "printer"));
- centronics.ack_handler().set("cent_status_in", FUNC(input_buffer_device::write_bit5));
- centronics.busy_handler().set("cent_status_in", FUNC(input_buffer_device::write_bit4));
- centronics.fault_handler().set("cent_status_in", FUNC(input_buffer_device::write_bit3));
- centronics.select_handler().set("cent_status_in", FUNC(input_buffer_device::write_bit1));
- centronics.perror_handler().set("cent_status_in", FUNC(input_buffer_device::write_bit0));
-
- output_latch_device &cent_data_out(OUTPUT_LATCH(config, "cent_data_out"));
- centronics.set_output_latch(cent_data_out);
+ MCFG_DEVICE_ADD(CENTRONICS_TAG, CENTRONICS, centronics_devices, "printer")
+ MCFG_CENTRONICS_ACK_HANDLER(WRITELINE("cent_status_in", input_buffer_device, write_bit5))
+ MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE("cent_status_in", input_buffer_device, write_bit4))
+ MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE("cent_status_in", input_buffer_device, write_bit3))
+ MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE("cent_status_in", input_buffer_device, write_bit1))
+ MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE("cent_status_in", input_buffer_device, write_bit0))
- INPUT_BUFFER(config, "cent_status_in");
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG)
+ MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0)
- output_latch_device &cent_ctrl_out(OUTPUT_LATCH(config, "cent_ctrl_out"));
- cent_ctrl_out.bit_handler<0>().set(CENTRONICS_TAG, FUNC(centronics_device::write_strobe));
- cent_ctrl_out.bit_handler<1>().set(CENTRONICS_TAG, FUNC(centronics_device::write_autofd));
- cent_ctrl_out.bit_handler<2>().set(CENTRONICS_TAG, FUNC(centronics_device::write_init));
- cent_ctrl_out.bit_handler<3>().set(CENTRONICS_TAG, FUNC(centronics_device::write_select_in));
-}
+ MCFG_DEVICE_ADD("cent_ctrl_out", OUTPUT_LATCH, 0)
+ MCFG_OUTPUT_LATCH_BIT0_HANDLER(WRITELINE(CENTRONICS_TAG, centronics_device, write_strobe))
+ MCFG_OUTPUT_LATCH_BIT1_HANDLER(WRITELINE(CENTRONICS_TAG, centronics_device, write_autofd))
+ MCFG_OUTPUT_LATCH_BIT2_HANDLER(WRITELINE(CENTRONICS_TAG, centronics_device, write_init))
+ MCFG_OUTPUT_LATCH_BIT3_HANDLER(WRITELINE(CENTRONICS_TAG, centronics_device, write_select_in))
+MACHINE_CONFIG_END
//**************************************************************************
@@ -99,7 +96,7 @@ void pofo_hpc101_device::device_reset()
// nrdi_r - read
//-------------------------------------------------
-uint8_t pofo_hpc101_device::nrdi_r(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
+uint8_t pofo_hpc101_device::nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
{
if (!bcom)
{
@@ -122,7 +119,7 @@ uint8_t pofo_hpc101_device::nrdi_r(offs_t offset, uint8_t data, bool iom, bool b
// nwri_w - write
//-------------------------------------------------
-void pofo_hpc101_device::nwri_w(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
+void pofo_hpc101_device::nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
{
if (!bcom)
{
diff --git a/src/devices/bus/pofo/hpc101.h b/src/devices/bus/pofo/hpc101.h
index fa18b5d6d4d..797f95c32d3 100644
--- a/src/devices/bus/pofo/hpc101.h
+++ b/src/devices/bus/pofo/hpc101.h
@@ -40,8 +40,8 @@ protected:
// device_portfolio_expansion_slot_interface overrides
bool pdet() override { return 1; }
- virtual uint8_t nrdi_r(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) override;
- virtual void nwri_w(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) override;
+ virtual uint8_t nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) override;
+ virtual void nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) override;
private:
required_device<i8255_device> m_ppi;
diff --git a/src/devices/bus/pofo/hpc102.cpp b/src/devices/bus/pofo/hpc102.cpp
index 42bc8b550fe..298b36c7cbe 100644
--- a/src/devices/bus/pofo/hpc102.cpp
+++ b/src/devices/bus/pofo/hpc102.cpp
@@ -99,7 +99,7 @@ uint8_t pofo_hpc102_device::eack_r()
// nrdi_r - read
//-------------------------------------------------
-uint8_t pofo_hpc102_device::nrdi_r(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
+uint8_t pofo_hpc102_device::nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
{
if (!bcom)
{
@@ -110,7 +110,7 @@ uint8_t pofo_hpc102_device::nrdi_r(offs_t offset, uint8_t data, bool iom, bool b
if (!(offset & 0x08))
{
- data = m_uart->ins8250_r(machine().dummy_space(), offset & 0x07);
+ data = m_uart->ins8250_r(space, offset & 0x07);
}
}
@@ -122,7 +122,7 @@ uint8_t pofo_hpc102_device::nrdi_r(offs_t offset, uint8_t data, bool iom, bool b
// nwri_w - write
//-------------------------------------------------
-void pofo_hpc102_device::nwri_w(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
+void pofo_hpc102_device::nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
{
if (!bcom)
{
@@ -133,7 +133,7 @@ void pofo_hpc102_device::nwri_w(offs_t offset, uint8_t data, bool iom, bool bcom
if (!(offset & 0x08))
{
- m_uart->ins8250_w(machine().dummy_space(), offset & 0x07, data);
+ m_uart->ins8250_w(space, offset & 0x07, data);
}
}
}
diff --git a/src/devices/bus/pofo/hpc102.h b/src/devices/bus/pofo/hpc102.h
index c7168b12787..bfe91e9f459 100644
--- a/src/devices/bus/pofo/hpc102.h
+++ b/src/devices/bus/pofo/hpc102.h
@@ -42,8 +42,8 @@ protected:
virtual uint8_t eack_r() override;
- virtual uint8_t nrdi_r(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) override;
- virtual void nwri_w(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) override;
+ virtual uint8_t nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) override;
+ virtual void nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) override;
private:
required_device<ins8250_device> m_uart;
diff --git a/src/devices/bus/pofo/hpc104.cpp b/src/devices/bus/pofo/hpc104.cpp
index a6e66f13da8..a6de6852e78 100644
--- a/src/devices/bus/pofo/hpc104.cpp
+++ b/src/devices/bus/pofo/hpc104.cpp
@@ -31,15 +31,14 @@ DEFINE_DEVICE_TYPE(POFO_HPC104_2, pofo_hpc104_2_device, "pofo_hpc104_2", "Atari
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void pofo_hpc104_device::device_add_mconfig(machine_config &config)
-{
- PORTFOLIO_MEMORY_CARD_SLOT(config, m_ccm, portfolio_memory_cards, nullptr);
+MACHINE_CONFIG_START(pofo_hpc104_device::device_add_mconfig)
+ MCFG_PORTFOLIO_MEMORY_CARD_SLOT_ADD(PORTFOLIO_MEMORY_CARD_SLOT_B_TAG, portfolio_memory_cards, nullptr)
- PORTFOLIO_EXPANSION_SLOT(config, m_exp, XTAL(4'915'200), portfolio_expansion_cards, nullptr);
- m_exp->eint_wr_callback().set(DEVICE_SELF_OWNER, FUNC(portfolio_expansion_slot_device::eint_w));
- m_exp->nmio_wr_callback().set(DEVICE_SELF_OWNER, FUNC(portfolio_expansion_slot_device::nmio_w));
- m_exp->wake_wr_callback().set(DEVICE_SELF_OWNER, FUNC(portfolio_expansion_slot_device::wake_w));
-}
+ MCFG_PORTFOLIO_EXPANSION_SLOT_ADD(PORTFOLIO_EXPANSION_SLOT_TAG, XTAL(4'915'200), portfolio_expansion_cards, nullptr)
+ MCFG_PORTFOLIO_EXPANSION_SLOT_EINT_CALLBACK(WRITELINE(DEVICE_SELF_OWNER, portfolio_expansion_slot_device, eint_w))
+ MCFG_PORTFOLIO_EXPANSION_SLOT_NMIO_CALLBACK(WRITELINE(DEVICE_SELF_OWNER, portfolio_expansion_slot_device, nmio_w))
+ MCFG_PORTFOLIO_EXPANSION_SLOT_WAKE_CALLBACK(WRITELINE(DEVICE_SELF_OWNER, portfolio_expansion_slot_device, wake_w))
+MACHINE_CONFIG_END
//-------------------------------------------------
@@ -147,15 +146,15 @@ void pofo_hpc104_device::device_reset()
// nrdi_r - read
//-------------------------------------------------
-uint8_t pofo_hpc104_device::nrdi_r(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
+uint8_t pofo_hpc104_device::nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
{
- data = m_exp->nrdi_r(offset, data, iom, bcom, m_ncc1_out || ncc1);
+ data = m_exp->nrdi_r(space, offset, data, iom, bcom, m_ncc1_out || ncc1);
if (!iom)
{
if (!(!m_ncc1_out || ncc1))
{
- data = m_ccm->nrdi_r(offset & 0x1ffff);
+ data = m_ccm->nrdi_r(space, offset & 0x1ffff);
if (LOG) logerror("%s %s CCM1 read %05x:%02x\n", machine().time().as_string(), machine().describe_context(), offset & 0x1ffff, data);
}
@@ -184,9 +183,9 @@ uint8_t pofo_hpc104_device::nrdi_r(offs_t offset, uint8_t data, bool iom, bool b
// nwri_w - write
//-------------------------------------------------
-void pofo_hpc104_device::nwri_w(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
+void pofo_hpc104_device::nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
{
- m_exp->nwri_w(offset, data, iom, bcom, m_ncc1_out || ncc1);
+ m_exp->nwri_w(space, offset, data, iom, bcom, m_ncc1_out || ncc1);
if (!iom)
{
@@ -194,7 +193,7 @@ void pofo_hpc104_device::nwri_w(offs_t offset, uint8_t data, bool iom, bool bcom
{
if (LOG) logerror("%s %s CCM1 write %05x:%02x\n", machine().time().as_string(), machine().describe_context(), offset & 0x1ffff, data);
- m_ccm->nwri_w(offset & 0x1ffff, data);
+ m_ccm->nwri_w(space, offset & 0x1ffff, data);
}
if (m_sw1)
diff --git a/src/devices/bus/pofo/hpc104.h b/src/devices/bus/pofo/hpc104.h
index 042bece210e..f863a45f39b 100644
--- a/src/devices/bus/pofo/hpc104.h
+++ b/src/devices/bus/pofo/hpc104.h
@@ -50,8 +50,8 @@ protected:
// device_portfolio_expansion_slot_interface overrides
virtual bool nmd1() override { return m_ccm->cdet_r(); }
- virtual uint8_t nrdi_r(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) override;
- virtual void nwri_w(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) override;
+ virtual uint8_t nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) override;
+ virtual void nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) override;
virtual WRITE_LINE_MEMBER( iint_w ) override { m_exp->iint_w(state); }
diff --git a/src/devices/bus/pofo/ram.cpp b/src/devices/bus/pofo/ram.cpp
index 5498a9b8c32..6ef861a0b5d 100644
--- a/src/devices/bus/pofo/ram.cpp
+++ b/src/devices/bus/pofo/ram.cpp
@@ -48,7 +48,7 @@ void portfolio_ram_card_device::device_start()
// nrdi_r - read
//-------------------------------------------------
-uint8_t portfolio_ram_card_device::nrdi_r(offs_t offset)
+uint8_t portfolio_ram_card_device::nrdi_r(address_space &space, offs_t offset)
{
return m_nvram[offset];
}
@@ -58,7 +58,7 @@ uint8_t portfolio_ram_card_device::nrdi_r(offs_t offset)
// nwri_w - write
//-------------------------------------------------
-void portfolio_ram_card_device::nwri_w(offs_t offset, uint8_t data)
+void portfolio_ram_card_device::nwri_w(address_space &space, offs_t offset, uint8_t data)
{
m_nvram[offset] = data;
}
diff --git a/src/devices/bus/pofo/ram.h b/src/devices/bus/pofo/ram.h
index 2c19f807816..9d126b51a2c 100644
--- a/src/devices/bus/pofo/ram.h
+++ b/src/devices/bus/pofo/ram.h
@@ -42,8 +42,8 @@ protected:
// device_portfolio_memory_card_slot_interface overrides
virtual bool cdet() override { return 0; }
- virtual uint8_t nrdi_r(offs_t offset) override;
- virtual void nwri_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t nrdi_r(address_space &space, offs_t offset) override;
+ virtual void nwri_w(address_space &space, offs_t offset, uint8_t data) override;
};
diff --git a/src/devices/bus/pofo/rom.cpp b/src/devices/bus/pofo/rom.cpp
index ac336eb0b77..8155444783a 100644
--- a/src/devices/bus/pofo/rom.cpp
+++ b/src/devices/bus/pofo/rom.cpp
@@ -46,7 +46,7 @@ void portfolio_rom_card_device::device_start()
// nrdi_r - read
//-------------------------------------------------
-uint8_t portfolio_rom_card_device::nrdi_r(offs_t offset)
+uint8_t portfolio_rom_card_device::nrdi_r(address_space &space, offs_t offset)
{
return m_rom[offset];
}
diff --git a/src/devices/bus/pofo/rom.h b/src/devices/bus/pofo/rom.h
index 6df19402a36..eab0ff1fde4 100644
--- a/src/devices/bus/pofo/rom.h
+++ b/src/devices/bus/pofo/rom.h
@@ -35,7 +35,7 @@ protected:
// device_portfolio_memory_card_slot_interface overrides
virtual bool cdet() override { return 0; }
- virtual uint8_t nrdi_r(offs_t offset) override;
+ virtual uint8_t nrdi_r(address_space &space, offs_t offset) override;
};
diff --git a/src/devices/bus/psi_kbd/ergoline.cpp b/src/devices/bus/psi_kbd/ergoline.cpp
index 7b892cf861b..20c02052221 100644
--- a/src/devices/bus/psi_kbd/ergoline.cpp
+++ b/src/devices/bus/psi_kbd/ergoline.cpp
@@ -58,12 +58,11 @@ const tiny_rom_entry *ergoline_keyboard_device::device_rom_region() const
return ROM_NAME(kbd_pcb);
}
-void ergoline_keyboard_device::device_add_mconfig(machine_config &config)
-{
- i8031_device &maincpu(I8031(config, "maincpu", XTAL(5'529'600)));
- maincpu.set_addrmap(AS_PROGRAM, &ergoline_keyboard_device::kbd_mem);
- maincpu.set_addrmap(AS_IO, &ergoline_keyboard_device::kbd_io);
-}
+MACHINE_CONFIG_START(ergoline_keyboard_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("maincpu", I8031, XTAL(5'529'600))
+ MCFG_DEVICE_PROGRAM_MAP(kbd_mem)
+ MCFG_DEVICE_IO_MAP(kbd_io)
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/psi_kbd/psi_kbd.h b/src/devices/bus/psi_kbd/psi_kbd.h
index 39aaa84d9d3..8e62b1df17b 100644
--- a/src/devices/bus/psi_kbd/psi_kbd.h
+++ b/src/devices/bus/psi_kbd/psi_kbd.h
@@ -30,8 +30,21 @@
#pragma once
-// supported devices
-void psi_keyboard_devices(device_slot_interface &device);
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_PSI_KEYBOARD_INTERFACE_ADD(_tag, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, PSI_KEYBOARD_INTERFACE, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(psi_keyboard_devices, _def_slot, false)
+
+#define MCFG_PSI_KEYBOARD_RX_HANDLER(_devcb) \
+ downcast<psi_keyboard_bus_device &>(*device).set_rx_handler(DEVCB_##_devcb);
+
+#define MCFG_PSI_KEYBOARD_KEY_STROBE_HANDLER(_devcb) \
+ downcast<psi_keyboard_bus_device &>(*device).set_key_strobe_handler(DEVCB_##_devcb);
+
//**************************************************************************
// TYPE DEFINITIONS
@@ -45,20 +58,12 @@ class psi_keyboard_bus_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- psi_keyboard_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, const char *dflt)
- : psi_keyboard_bus_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- psi_keyboard_devices(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
psi_keyboard_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~psi_keyboard_bus_device();
// callbacks
- auto rx() { return m_rx_handler.bind(); }
- auto key_strobe() { return m_key_strobe_handler.bind(); }
+ template <class Object> devcb_base &set_rx_handler(Object &&cb) { return m_rx_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_key_strobe_handler(Object &&cb) { return m_key_strobe_handler.set_callback(std::forward<Object>(cb)); }
// called from keyboard
DECLARE_WRITE_LINE_MEMBER( rx_w ) { m_rx_handler(state); }
@@ -99,7 +104,12 @@ protected:
psi_keyboard_bus_device *m_host;
};
+
// device type definition
DECLARE_DEVICE_TYPE(PSI_KEYBOARD_INTERFACE, psi_keyboard_bus_device)
+// supported devices
+void psi_keyboard_devices(device_slot_interface &device);
+
+
#endif // MAME_BUS_PSI_KBD_PSI_KBD_H
diff --git a/src/devices/bus/psx/ctlrport.cpp b/src/devices/bus/psx/ctlrport.cpp
index 05aae5c5b72..b3c34f8b2b5 100644
--- a/src/devices/bus/psx/ctlrport.cpp
+++ b/src/devices/bus/psx/ctlrport.cpp
@@ -25,10 +25,9 @@ void psx_controller_port_device::device_config_complete()
m_dev = dynamic_cast<device_psx_controller_interface *>(get_card_device());
}
-void psx_controller_port_device::device_add_mconfig(machine_config &config)
-{
- PSXCARD(config, m_card, 0);
-}
+MACHINE_CONFIG_START(psx_controller_port_device::device_add_mconfig)
+ MCFG_PSXCARD_ADD("card")
+MACHINE_CONFIG_END
void psx_controller_port_device::disable_card(bool state)
{
diff --git a/src/devices/bus/psx/ctlrport.h b/src/devices/bus/psx/ctlrport.h
index 2058cf4868c..718ac8fb35d 100644
--- a/src/devices/bus/psx/ctlrport.h
+++ b/src/devices/bus/psx/ctlrport.h
@@ -77,6 +77,11 @@ private:
required_ioport m_pad1;
};
+#define MCFG_PSX_CONTROLLER_PORTS_DSR_HANDLER(_devcb) \
+ downcast<psxcontrollerports_device &>(*device).set_dsr_handler(DEVCB_##_devcb);
+
+#define MCFG_PSX_CONTROLLER_PORTS_RXD_HANDLER(_devcb) \
+ downcast<psxcontrollerports_device &>(*device).set_rxd_handler(DEVCB_##_devcb);
class psxcontrollerports_device : public device_t
{
diff --git a/src/devices/bus/psx/gamebooster.cpp b/src/devices/bus/psx/gamebooster.cpp
index 309ff1949a3..3513f7714e2 100644
--- a/src/devices/bus/psx/gamebooster.cpp
+++ b/src/devices/bus/psx/gamebooster.cpp
@@ -82,8 +82,8 @@ READ16_MEMBER(psx_gamebooster_device::exp_r)
offset -= 0x20000;
uint16_t retval = 0;;
- if (mem_mask & 0xff00) retval |= (m_cartslot->read_rom((offset*2)+1))<<8;
- if (mem_mask & 0x00ff) retval |= m_cartslot->read_rom((offset*2)+0);
+ if (mem_mask & 0xff00) retval |= (m_cartslot->read_rom(space, (offset*2)+1))<<8;
+ if (mem_mask & 0x00ff) retval |= m_cartslot->read_rom(space, (offset*2)+0);
return retval;
}
@@ -107,8 +107,8 @@ WRITE16_MEMBER(psx_gamebooster_device::exp_w)
offset -= 0x20000;
logerror("%s: psx_gamebooster_device::exp_w %04x %04x\n", machine().describe_context(), offset*2, data);
- if (mem_mask & 0xff00) m_cartslot->write_bank((offset*2)+1, data>>8);
- if (mem_mask & 0x00ff) m_cartslot->write_bank((offset*2)+0, data); // send this 2nd or it erases the bank with the above
+ if (mem_mask & 0xff00) m_cartslot->write_bank(space, (offset*2)+1, data>>8);
+ if (mem_mask & 0x00ff) m_cartslot->write_bank(space, (offset*2)+0, data); // send this 2nd or it erases the bank with the above
}
else
diff --git a/src/devices/bus/psx/memcard.h b/src/devices/bus/psx/memcard.h
index e292d89e589..51ac4f044ba 100644
--- a/src/devices/bus/psx/memcard.h
+++ b/src/devices/bus/psx/memcard.h
@@ -8,6 +8,8 @@
class psx_controller_port_device;
+#define MCFG_PSXCARD_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, PSXCARD, 0)
class psxcard_device : public device_t,
public device_image_interface
diff --git a/src/devices/bus/ql/cst_q_plus4.cpp b/src/devices/bus/ql/cst_q_plus4.cpp
index 96269dc6ef5..52f1602ba5b 100644
--- a/src/devices/bus/ql/cst_q_plus4.cpp
+++ b/src/devices/bus/ql/cst_q_plus4.cpp
@@ -50,22 +50,21 @@ const tiny_rom_entry *cst_q_plus4_device::device_rom_region() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void cst_q_plus4_device::device_add_mconfig(machine_config &config)
-{
- PIA6821(config, MC6821_TAG, 0);
+MACHINE_CONFIG_START(cst_q_plus4_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(MC6821_TAG, PIA6821, 0)
- QL_EXPANSION_SLOT(config, m_exp1, DERIVED_CLOCK(1, 1), ql_expansion_cards, nullptr);
- m_exp1->extintl_wr_callback().set(FUNC(cst_q_plus4_device::exp1_extintl_w));
+ MCFG_DEVICE_ADD("exp1", QL_EXPANSION_SLOT, DERIVED_CLOCK(1, 1), ql_expansion_cards, nullptr)
+ MCFG_QL_EXPANSION_SLOT_EXTINTL_CALLBACK(WRITELINE(*this, cst_q_plus4_device, exp1_extintl_w))
- QL_EXPANSION_SLOT(config, m_exp2, DERIVED_CLOCK(1, 1), ql_expansion_cards, nullptr);
- m_exp2->extintl_wr_callback().set(FUNC(cst_q_plus4_device::exp2_extintl_w));
+ MCFG_DEVICE_ADD("exp2", QL_EXPANSION_SLOT, DERIVED_CLOCK(1, 1), ql_expansion_cards, nullptr)
+ MCFG_QL_EXPANSION_SLOT_EXTINTL_CALLBACK(WRITELINE(*this, cst_q_plus4_device, exp2_extintl_w))
- QL_EXPANSION_SLOT(config, m_exp3, DERIVED_CLOCK(1, 1), ql_expansion_cards, nullptr);
- m_exp3->extintl_wr_callback().set(FUNC(cst_q_plus4_device::exp3_extintl_w));
+ MCFG_DEVICE_ADD("exp3", QL_EXPANSION_SLOT, DERIVED_CLOCK(1, 1), ql_expansion_cards, nullptr)
+ MCFG_QL_EXPANSION_SLOT_EXTINTL_CALLBACK(WRITELINE(*this, cst_q_plus4_device, exp3_extintl_w))
- QL_EXPANSION_SLOT(config, m_exp4, DERIVED_CLOCK(1, 1), ql_expansion_cards, nullptr);
- m_exp4->extintl_wr_callback().set(FUNC(cst_q_plus4_device::exp4_extintl_w));
-}
+ MCFG_DEVICE_ADD("exp4", QL_EXPANSION_SLOT, DERIVED_CLOCK(1, 1), ql_expansion_cards, nullptr)
+ MCFG_QL_EXPANSION_SLOT_EXTINTL_CALLBACK(WRITELINE(*this, cst_q_plus4_device, exp4_extintl_w))
+MACHINE_CONFIG_END
@@ -106,17 +105,17 @@ void cst_q_plus4_device::device_start()
// read -
//-------------------------------------------------
-uint8_t cst_q_plus4_device::read(offs_t offset, uint8_t data)
+uint8_t cst_q_plus4_device::read(address_space &space, offs_t offset, uint8_t data)
{
if (offset >= 0xc000 && offset < 0xc200)
{
data = m_rom->base()[offset & 0x1fff];
}
- data = m_exp1->read(offset, data);
- data = m_exp2->read(offset, data);
- data = m_exp3->read(offset, data);
- data = m_exp4->read(offset, data);
+ data = m_exp1->read(space, offset, data);
+ data = m_exp2->read(space, offset, data);
+ data = m_exp3->read(space, offset, data);
+ data = m_exp4->read(space, offset, data);
return data;
}
@@ -126,10 +125,10 @@ uint8_t cst_q_plus4_device::read(offs_t offset, uint8_t data)
// write -
//-------------------------------------------------
-void cst_q_plus4_device::write(offs_t offset, uint8_t data)
+void cst_q_plus4_device::write(address_space &space, offs_t offset, uint8_t data)
{
- m_exp1->write(offset, data);
- m_exp2->write(offset, data);
- m_exp3->write(offset, data);
- m_exp4->write(offset, data);
+ m_exp1->write(space, offset, data);
+ m_exp2->write(space, offset, data);
+ m_exp3->write(space, offset, data);
+ m_exp4->write(space, offset, data);
}
diff --git a/src/devices/bus/ql/cst_q_plus4.h b/src/devices/bus/ql/cst_q_plus4.h
index 4c8ea616f51..0eff45e3840 100644
--- a/src/devices/bus/ql/cst_q_plus4.h
+++ b/src/devices/bus/ql/cst_q_plus4.h
@@ -37,8 +37,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_ql_expansion_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data) override;
private:
DECLARE_WRITE_LINE_MEMBER( exp1_extintl_w ) { m_exp1_extinl = state; update_extintl(); }
diff --git a/src/devices/bus/ql/cst_qdisc.cpp b/src/devices/bus/ql/cst_qdisc.cpp
index 2fe46dc4f5e..a3940d41b1a 100644
--- a/src/devices/bus/ql/cst_qdisc.cpp
+++ b/src/devices/bus/ql/cst_qdisc.cpp
@@ -71,7 +71,7 @@ void cst_ql_disc_interface_device::device_start()
// read -
//-------------------------------------------------
-uint8_t cst_ql_disc_interface_device::read(offs_t offset, uint8_t data)
+uint8_t cst_ql_disc_interface_device::read(address_space &space, offs_t offset, uint8_t data)
{
return data;
}
@@ -81,6 +81,6 @@ uint8_t cst_ql_disc_interface_device::read(offs_t offset, uint8_t data)
// write -
//-------------------------------------------------
-void cst_ql_disc_interface_device::write(offs_t offset, uint8_t data)
+void cst_ql_disc_interface_device::write(address_space &space, offs_t offset, uint8_t data)
{
}
diff --git a/src/devices/bus/ql/cst_qdisc.h b/src/devices/bus/ql/cst_qdisc.h
index fdd492f1230..4bbcbd0913f 100644
--- a/src/devices/bus/ql/cst_qdisc.h
+++ b/src/devices/bus/ql/cst_qdisc.h
@@ -36,8 +36,8 @@ protected:
virtual void device_start() override;
// device_ql_expansion_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data) override;
};
diff --git a/src/devices/bus/ql/cumana_fdi.cpp b/src/devices/bus/ql/cumana_fdi.cpp
index 204dea12608..a8d1b7c376b 100644
--- a/src/devices/bus/ql/cumana_fdi.cpp
+++ b/src/devices/bus/ql/cumana_fdi.cpp
@@ -71,7 +71,7 @@ void cumana_floppy_disk_interface_device::device_start()
// read -
//-------------------------------------------------
-uint8_t cumana_floppy_disk_interface_device::read(offs_t offset, uint8_t data)
+uint8_t cumana_floppy_disk_interface_device::read(address_space &space, offs_t offset, uint8_t data)
{
return data;
}
@@ -81,6 +81,6 @@ uint8_t cumana_floppy_disk_interface_device::read(offs_t offset, uint8_t data)
// write -
//-------------------------------------------------
-void cumana_floppy_disk_interface_device::write(offs_t offset, uint8_t data)
+void cumana_floppy_disk_interface_device::write(address_space &space, offs_t offset, uint8_t data)
{
}
diff --git a/src/devices/bus/ql/cumana_fdi.h b/src/devices/bus/ql/cumana_fdi.h
index 2080251fcf3..a0da6952cab 100644
--- a/src/devices/bus/ql/cumana_fdi.h
+++ b/src/devices/bus/ql/cumana_fdi.h
@@ -35,8 +35,8 @@ protected:
virtual void device_start() override;
// device_ql_expansion_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data) override;
};
diff --git a/src/devices/bus/ql/exp.h b/src/devices/bus/ql/exp.h
index 43e8a7b77d5..ed5febc4854 100644
--- a/src/devices/bus/ql/exp.h
+++ b/src/devices/bus/ql/exp.h
@@ -49,6 +49,24 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_QL_EXPANSION_SLOT_IPL0L_CALLBACK(_write) \
+ downcast<ql_expansion_slot_device &>(*device).set_ipl0l_wr_callback(DEVCB_##_write);
+
+#define MCFG_QL_EXPANSION_SLOT_IPL1L_CALLBACK(_write) \
+ downcast<ql_expansion_slot_device &>(*device).set_ipl1l_wr_callback(DEVCB_##_write);
+
+#define MCFG_QL_EXPANSION_SLOT_BERRL_CALLBACK(_write) \
+ downcast<ql_expansion_slot_device &>(*device).set_berrl_wr_callback(DEVCB_##_write);
+
+#define MCFG_QL_EXPANSION_SLOT_EXTINTL_CALLBACK(_write) \
+ downcast<ql_expansion_slot_device &>(*device).set_extintl_wr_callback(DEVCB_##_write);
+
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -62,8 +80,8 @@ class device_ql_expansion_card_interface : public device_slot_card_interface
public:
virtual void romoeh_w(int state) { m_romoeh = state; }
- virtual uint8_t read(offs_t offset, uint8_t data) { return data; }
- virtual void write(offs_t offset, uint8_t data) { }
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) { return data; }
+ virtual void write(address_space &space, offs_t offset, uint8_t data) { }
protected:
// construction/destruction
@@ -94,14 +112,14 @@ public:
}
ql_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto ipl0l_wr_callback() { return m_write_ipl0l.bind(); }
- auto ipl1l_wr_callback() { return m_write_ipl1l.bind(); }
- auto berrl_wr_callback() { return m_write_berrl.bind(); }
- auto extintl_wr_callback() { return m_write_extintl.bind(); }
+ template <class Object> devcb_base &set_ipl0l_wr_callback(Object &&cb) { return m_write_ipl0l.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ipl1l_wr_callback(Object &&cb) { return m_write_ipl1l.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_berrl_wr_callback(Object &&cb) { return m_write_berrl.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_extintl_wr_callback(Object &&cb) { return m_write_extintl.set_callback(std::forward<Object>(cb)); }
// computer interface
- uint8_t read(offs_t offset, uint8_t data) { if (m_card) data = m_card->read(offset, data); return data; }
- void write(offs_t offset, uint8_t data) { if (m_card) m_card->write(offset, data); }
+ uint8_t read(address_space &space, offs_t offset, uint8_t data) { if (m_card) data = m_card->read(space, offset, data); return data; }
+ void write(address_space &space, offs_t offset, uint8_t data) { if (m_card) m_card->write(space, offset, data); }
DECLARE_WRITE_LINE_MEMBER( romoeh_w ) { if (m_card) m_card->romoeh_w(state); }
// card interface
diff --git a/src/devices/bus/ql/kempston_di.cpp b/src/devices/bus/ql/kempston_di.cpp
index 1535f171ff6..599e9bebcc7 100644
--- a/src/devices/bus/ql/kempston_di.cpp
+++ b/src/devices/bus/ql/kempston_di.cpp
@@ -69,7 +69,7 @@ void kempston_disk_interface_device::device_start()
// read -
//-------------------------------------------------
-uint8_t kempston_disk_interface_device::read(offs_t offset, uint8_t data)
+uint8_t kempston_disk_interface_device::read(address_space &space, offs_t offset, uint8_t data)
{
return data;
}
@@ -79,6 +79,6 @@ uint8_t kempston_disk_interface_device::read(offs_t offset, uint8_t data)
// write -
//-------------------------------------------------
-void kempston_disk_interface_device::write(offs_t offset, uint8_t data)
+void kempston_disk_interface_device::write(address_space &space, offs_t offset, uint8_t data)
{
}
diff --git a/src/devices/bus/ql/kempston_di.h b/src/devices/bus/ql/kempston_di.h
index cc75a5fe0fc..e37c3d7f6b7 100644
--- a/src/devices/bus/ql/kempston_di.h
+++ b/src/devices/bus/ql/kempston_di.h
@@ -35,8 +35,8 @@ protected:
virtual void device_start() override;
// device_ql_expansion_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data) override;
};
diff --git a/src/devices/bus/ql/miracle_gold_card.cpp b/src/devices/bus/ql/miracle_gold_card.cpp
index bf6be7fe136..a7acd24e2d7 100644
--- a/src/devices/bus/ql/miracle_gold_card.cpp
+++ b/src/devices/bus/ql/miracle_gold_card.cpp
@@ -71,7 +71,7 @@ void miracle_gold_card_device::device_start()
// read -
//-------------------------------------------------
-uint8_t miracle_gold_card_device::read(offs_t offset, uint8_t data)
+uint8_t miracle_gold_card_device::read(address_space &space, offs_t offset, uint8_t data)
{
return data;
}
@@ -81,6 +81,6 @@ uint8_t miracle_gold_card_device::read(offs_t offset, uint8_t data)
// write -
//-------------------------------------------------
-void miracle_gold_card_device::write(offs_t offset, uint8_t data)
+void miracle_gold_card_device::write(address_space &space, offs_t offset, uint8_t data)
{
}
diff --git a/src/devices/bus/ql/miracle_gold_card.h b/src/devices/bus/ql/miracle_gold_card.h
index 7ed9d0e2eb8..feea55de78c 100644
--- a/src/devices/bus/ql/miracle_gold_card.h
+++ b/src/devices/bus/ql/miracle_gold_card.h
@@ -35,8 +35,8 @@ protected:
virtual void device_start() override;
// device_ql_expansion_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data) override;
};
diff --git a/src/devices/bus/ql/miracle_hd.cpp b/src/devices/bus/ql/miracle_hd.cpp
index f2f16715c72..146945737a2 100644
--- a/src/devices/bus/ql/miracle_hd.cpp
+++ b/src/devices/bus/ql/miracle_hd.cpp
@@ -69,7 +69,7 @@ void miracle_hard_disk_device::device_start()
// read -
//-------------------------------------------------
-uint8_t miracle_hard_disk_device::read(offs_t offset, uint8_t data)
+uint8_t miracle_hard_disk_device::read(address_space &space, offs_t offset, uint8_t data)
{
return data;
}
@@ -79,6 +79,6 @@ uint8_t miracle_hard_disk_device::read(offs_t offset, uint8_t data)
// write -
//-------------------------------------------------
-void miracle_hard_disk_device::write(offs_t offset, uint8_t data)
+void miracle_hard_disk_device::write(address_space &space, offs_t offset, uint8_t data)
{
}
diff --git a/src/devices/bus/ql/miracle_hd.h b/src/devices/bus/ql/miracle_hd.h
index 983dce66f8b..0bcd260bb87 100644
--- a/src/devices/bus/ql/miracle_hd.h
+++ b/src/devices/bus/ql/miracle_hd.h
@@ -36,8 +36,8 @@ protected:
virtual void device_start() override;
// device_ql_rom_cartridge_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data) override;
};
diff --git a/src/devices/bus/ql/mp_fdi.cpp b/src/devices/bus/ql/mp_fdi.cpp
index 4e2a90ce52d..06324a4be67 100644
--- a/src/devices/bus/ql/mp_fdi.cpp
+++ b/src/devices/bus/ql/mp_fdi.cpp
@@ -69,7 +69,7 @@ void micro_peripherals_floppy_disk_interface_device::device_start()
// read -
//-------------------------------------------------
-uint8_t micro_peripherals_floppy_disk_interface_device::read(offs_t offset, uint8_t data)
+uint8_t micro_peripherals_floppy_disk_interface_device::read(address_space &space, offs_t offset, uint8_t data)
{
return data;
}
@@ -79,6 +79,6 @@ uint8_t micro_peripherals_floppy_disk_interface_device::read(offs_t offset, uint
// write -
//-------------------------------------------------
-void micro_peripherals_floppy_disk_interface_device::write(offs_t offset, uint8_t data)
+void micro_peripherals_floppy_disk_interface_device::write(address_space &space, offs_t offset, uint8_t data)
{
}
diff --git a/src/devices/bus/ql/mp_fdi.h b/src/devices/bus/ql/mp_fdi.h
index 3fc9d9d8c83..9939e540ba7 100644
--- a/src/devices/bus/ql/mp_fdi.h
+++ b/src/devices/bus/ql/mp_fdi.h
@@ -34,8 +34,8 @@ protected:
virtual void device_start() override;
// device_ql_expansion_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data) override;
};
diff --git a/src/devices/bus/ql/opd_basic_master.cpp b/src/devices/bus/ql/opd_basic_master.cpp
index b3b6f18dc19..015fca91a37 100644
--- a/src/devices/bus/ql/opd_basic_master.cpp
+++ b/src/devices/bus/ql/opd_basic_master.cpp
@@ -67,7 +67,7 @@ void opd_basic_master_device::device_start()
// read -
//-------------------------------------------------
-uint8_t opd_basic_master_device::read(offs_t offset, uint8_t data)
+uint8_t opd_basic_master_device::read(address_space &space, offs_t offset, uint8_t data)
{
return data;
}
@@ -77,6 +77,6 @@ uint8_t opd_basic_master_device::read(offs_t offset, uint8_t data)
// write -
//-------------------------------------------------
-void opd_basic_master_device::write(offs_t offset, uint8_t data)
+void opd_basic_master_device::write(address_space &space, offs_t offset, uint8_t data)
{
}
diff --git a/src/devices/bus/ql/opd_basic_master.h b/src/devices/bus/ql/opd_basic_master.h
index 3592823dd2b..d22b50eff8c 100644
--- a/src/devices/bus/ql/opd_basic_master.h
+++ b/src/devices/bus/ql/opd_basic_master.h
@@ -35,8 +35,8 @@ protected:
virtual void device_start() override;
// device_ql_expansion_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data) override;
};
diff --git a/src/devices/bus/ql/pcml_qdisk.cpp b/src/devices/bus/ql/pcml_qdisk.cpp
index ed92c569509..7b3d7b25e6c 100644
--- a/src/devices/bus/ql/pcml_qdisk.cpp
+++ b/src/devices/bus/ql/pcml_qdisk.cpp
@@ -69,7 +69,7 @@ void pcml_q_disk_interface_device::device_start()
// read -
//-------------------------------------------------
-uint8_t pcml_q_disk_interface_device::read(offs_t offset, uint8_t data)
+uint8_t pcml_q_disk_interface_device::read(address_space &space, offs_t offset, uint8_t data)
{
return data;
}
@@ -79,6 +79,6 @@ uint8_t pcml_q_disk_interface_device::read(offs_t offset, uint8_t data)
// write -
//-------------------------------------------------
-void pcml_q_disk_interface_device::write(offs_t offset, uint8_t data)
+void pcml_q_disk_interface_device::write(address_space &space, offs_t offset, uint8_t data)
{
}
diff --git a/src/devices/bus/ql/pcml_qdisk.h b/src/devices/bus/ql/pcml_qdisk.h
index cedd3f953f7..e9904df6eb0 100644
--- a/src/devices/bus/ql/pcml_qdisk.h
+++ b/src/devices/bus/ql/pcml_qdisk.h
@@ -35,8 +35,8 @@ protected:
virtual void device_start() override;
// device_ql_expansion_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data) override;
};
diff --git a/src/devices/bus/ql/qubide.cpp b/src/devices/bus/ql/qubide.cpp
index 10583d28023..e88493048d9 100644
--- a/src/devices/bus/ql/qubide.cpp
+++ b/src/devices/bus/ql/qubide.cpp
@@ -202,7 +202,7 @@ void qubide_device::device_reset()
// read -
//-------------------------------------------------
-uint8_t qubide_device::read(offs_t offset, uint8_t data)
+uint8_t qubide_device::read(address_space &space, offs_t offset, uint8_t data)
{
if ((offset & 0xfc000) == m_base)
{
@@ -247,7 +247,7 @@ uint8_t qubide_device::read(offs_t offset, uint8_t data)
// write -
//-------------------------------------------------
-void qubide_device::write(offs_t offset, uint8_t data)
+void qubide_device::write(address_space &space, offs_t offset, uint8_t data)
{
if ((offset & 0xfc000) == m_base)
{
diff --git a/src/devices/bus/ql/qubide.h b/src/devices/bus/ql/qubide.h
index 5e1ac6d1860..680e5e6b655 100644
--- a/src/devices/bus/ql/qubide.h
+++ b/src/devices/bus/ql/qubide.h
@@ -39,8 +39,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_ql_expansion_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data) override;
private:
required_device<ata_interface_device> m_ata;
diff --git a/src/devices/bus/ql/rom.h b/src/devices/bus/ql/rom.h
index 0c8ec4a6bca..e337fb9f096 100644
--- a/src/devices/bus/ql/rom.h
+++ b/src/devices/bus/ql/rom.h
@@ -50,8 +50,8 @@ public:
virtual ~device_ql_rom_cartridge_card_interface();
virtual void romoeh_w(int state) { m_romoeh = state; }
- virtual uint8_t read(offs_t offset, uint8_t data) { return data; }
- virtual void write(offs_t offset, uint8_t data) { }
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) { return data; }
+ virtual void write(address_space &space, offs_t offset, uint8_t data) { }
protected:
device_ql_rom_cartridge_card_interface(const machine_config &mconfig, device_t &device);
@@ -86,8 +86,8 @@ public:
ql_rom_cartridge_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
// computer interface
- uint8_t read(offs_t offset, uint8_t data) { if (m_card) data = m_card->read(offset, data); return data; }
- void write(offs_t offset, uint8_t data) { if (m_card) m_card->write(offset, data); }
+ uint8_t read(address_space &space, offs_t offset, uint8_t data) { if (m_card) data = m_card->read(space, offset, data); return data; }
+ void write(address_space &space, offs_t offset, uint8_t data) { if (m_card) m_card->write(space, offset, data); }
DECLARE_WRITE_LINE_MEMBER( romoeh_w ) { if (m_card) m_card->romoeh_w(state); }
protected:
diff --git a/src/devices/bus/ql/sandy_superdisk.cpp b/src/devices/bus/ql/sandy_superdisk.cpp
index 1af96f2de81..19ee4ebbc9c 100644
--- a/src/devices/bus/ql/sandy_superdisk.cpp
+++ b/src/devices/bus/ql/sandy_superdisk.cpp
@@ -149,7 +149,7 @@ void sandy_super_disk_device::device_reset()
// read -
//-------------------------------------------------
-uint8_t sandy_super_disk_device::read(offs_t offset, uint8_t data)
+uint8_t sandy_super_disk_device::read(address_space &space, offs_t offset, uint8_t data)
{
if ((offset & 0xf0000) == 0xc0000)
{
@@ -195,7 +195,7 @@ uint8_t sandy_super_disk_device::read(offs_t offset, uint8_t data)
// write -
//-------------------------------------------------
-void sandy_super_disk_device::write(offs_t offset, uint8_t data)
+void sandy_super_disk_device::write(address_space &space, offs_t offset, uint8_t data)
{
if ((offset & 0xf0000) == 0xc0000)
{
diff --git a/src/devices/bus/ql/sandy_superdisk.h b/src/devices/bus/ql/sandy_superdisk.h
index 5a264272e12..1bc7192aad5 100644
--- a/src/devices/bus/ql/sandy_superdisk.h
+++ b/src/devices/bus/ql/sandy_superdisk.h
@@ -41,8 +41,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_ql_expansion_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data) override;
private:
WRITE_LINE_MEMBER( busy_w );
diff --git a/src/devices/bus/ql/sandy_superqboard.cpp b/src/devices/bus/ql/sandy_superqboard.cpp
index bc8f4c78478..05ff550c47d 100644
--- a/src/devices/bus/ql/sandy_superqboard.cpp
+++ b/src/devices/bus/ql/sandy_superqboard.cpp
@@ -285,7 +285,7 @@ void sandy_superqboard_device::device_reset()
// read -
//-------------------------------------------------
-uint8_t sandy_superqboard_device::read(offs_t offset, uint8_t data)
+uint8_t sandy_superqboard_device::read(address_space &space, offs_t offset, uint8_t data)
{
if ((offset & 0xf0000) == 0xc0000)
{
@@ -345,7 +345,7 @@ uint8_t sandy_superqboard_device::read(offs_t offset, uint8_t data)
// write -
//-------------------------------------------------
-void sandy_superqboard_device::write(offs_t offset, uint8_t data)
+void sandy_superqboard_device::write(address_space &space, offs_t offset, uint8_t data)
{
if ((offset & 0xf0000) == 0xc0000)
{
diff --git a/src/devices/bus/ql/sandy_superqboard.h b/src/devices/bus/ql/sandy_superqboard.h
index 94bfe0c7dad..94d2066020b 100644
--- a/src/devices/bus/ql/sandy_superqboard.h
+++ b/src/devices/bus/ql/sandy_superqboard.h
@@ -46,8 +46,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_ql_expansion_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data) override;
private:
WRITE_LINE_MEMBER( busy_w );
diff --git a/src/devices/bus/ql/std.cpp b/src/devices/bus/ql/std.cpp
index b1171c46336..5e13a0ff32f 100644
--- a/src/devices/bus/ql/std.cpp
+++ b/src/devices/bus/ql/std.cpp
@@ -47,7 +47,7 @@ void ql_standard_rom_cartridge_device::device_start()
// read - cartridge data read
//-------------------------------------------------
-uint8_t ql_standard_rom_cartridge_device::read(offs_t offset, uint8_t data)
+uint8_t ql_standard_rom_cartridge_device::read(address_space &space, offs_t offset, uint8_t data)
{
if (m_romoeh && m_rom.bytes())
{
diff --git a/src/devices/bus/ql/std.h b/src/devices/bus/ql/std.h
index 823c3a70008..b1b4e404c4c 100644
--- a/src/devices/bus/ql/std.h
+++ b/src/devices/bus/ql/std.h
@@ -32,7 +32,7 @@ protected:
virtual void device_start() override;
// device_ql_rom_cartridge_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
};
diff --git a/src/devices/bus/ql/trumpcard.cpp b/src/devices/bus/ql/trumpcard.cpp
index 473fc9bb78e..bc515b7da9c 100644
--- a/src/devices/bus/ql/trumpcard.cpp
+++ b/src/devices/bus/ql/trumpcard.cpp
@@ -167,7 +167,7 @@ void ql_trump_card_device::device_reset()
// read -
//-------------------------------------------------
-uint8_t ql_trump_card_device::read(offs_t offset, uint8_t data)
+uint8_t ql_trump_card_device::read(address_space &space, offs_t offset, uint8_t data)
{
if (offset >= 0xc000 && offset < 0x10000)
{
@@ -220,7 +220,7 @@ uint8_t ql_trump_card_device::read(offs_t offset, uint8_t data)
// write -
//-------------------------------------------------
-void ql_trump_card_device::write(offs_t offset, uint8_t data)
+void ql_trump_card_device::write(address_space &space, offs_t offset, uint8_t data)
{
if (offset >= 0x1c000 && offset <= 0x1c003)
{
diff --git a/src/devices/bus/ql/trumpcard.h b/src/devices/bus/ql/trumpcard.h
index d9926160928..4dc18ceccd4 100644
--- a/src/devices/bus/ql/trumpcard.h
+++ b/src/devices/bus/ql/trumpcard.h
@@ -42,8 +42,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_ql_expansion_card_interface overrides
- virtual uint8_t read(offs_t offset, uint8_t data) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual uint8_t read(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void write(address_space &space, offs_t offset, uint8_t data) override;
private:
diff --git a/src/devices/bus/rs232/null_modem.cpp b/src/devices/bus/rs232/null_modem.cpp
index 08366b01df9..def7bd2a315 100644
--- a/src/devices/bus/rs232/null_modem.cpp
+++ b/src/devices/bus/rs232/null_modem.cpp
@@ -22,10 +22,9 @@ null_modem_device::null_modem_device(const machine_config &mconfig, const char *
{
}
-void null_modem_device::device_add_mconfig(machine_config &config)
-{
- BITBANGER(config, m_stream, 0);
-}
+MACHINE_CONFIG_START(null_modem_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("stream", BITBANGER, 0)
+MACHINE_CONFIG_END
static INPUT_PORTS_START(null_modem)
MCFG_RS232_BAUD("RS232_TXBAUD", RS232_BAUD_9600, "TX Baud", null_modem_device, update_serial)
diff --git a/src/devices/bus/rs232/printer.cpp b/src/devices/bus/rs232/printer.cpp
index fb87c9ead79..b8b1ec87d34 100644
--- a/src/devices/bus/rs232/printer.cpp
+++ b/src/devices/bus/rs232/printer.cpp
@@ -16,11 +16,10 @@ serial_printer_device::serial_printer_device(const machine_config &mconfig, cons
{
}
-void serial_printer_device::device_add_mconfig(machine_config &config)
-{
- PRINTER(config, m_printer, 0);
- m_printer->online_callback().set(FUNC(serial_printer_device::printer_online));
-}
+MACHINE_CONFIG_START(serial_printer_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("printer", PRINTER, 0)
+ MCFG_PRINTER_ONLINE_CB(WRITELINE(*this, serial_printer_device, printer_online))
+MACHINE_CONFIG_END
static INPUT_PORTS_START(serial_printer)
MCFG_RS232_BAUD("RS232_RXBAUD", RS232_BAUD_9600, "RX Baud", serial_printer_device, update_serial)
diff --git a/src/devices/bus/rs232/xvd701.cpp b/src/devices/bus/rs232/xvd701.cpp
index b2635d21c02..ef9ca09c258 100644
--- a/src/devices/bus/rs232/xvd701.cpp
+++ b/src/devices/bus/rs232/xvd701.cpp
@@ -12,9 +12,8 @@ jvc_xvd701_device::jvc_xvd701_device(const machine_config &mconfig, const char *
{
}
-void jvc_xvd701_device::device_add_mconfig(machine_config &config)
-{
-}
+MACHINE_CONFIG_START(jvc_xvd701_device::device_add_mconfig)
+MACHINE_CONFIG_END
static INPUT_PORTS_START(xvd701)
INPUT_PORTS_END
diff --git a/src/devices/bus/s100/dj2db.cpp b/src/devices/bus/s100/dj2db.cpp
index 7c33182ea5d..f3cff259db3 100644
--- a/src/devices/bus/s100/dj2db.cpp
+++ b/src/devices/bus/s100/dj2db.cpp
@@ -301,7 +301,7 @@ void s100_dj2db_device::device_reset()
// s100_smemr_r - memory read
//-------------------------------------------------
-uint8_t s100_dj2db_device::s100_smemr_r(offs_t offset)
+uint8_t s100_dj2db_device::s100_smemr_r(address_space &space, offs_t offset)
{
uint8_t data = 0;
@@ -380,7 +380,7 @@ uint8_t s100_dj2db_device::s100_smemr_r(offs_t offset)
// s100_mwrt_w - memory write
//-------------------------------------------------
-void s100_dj2db_device::s100_mwrt_w(offs_t offset, uint8_t data)
+void s100_dj2db_device::s100_mwrt_w(address_space &space, offs_t offset, uint8_t data)
{
// if (!(m_board_enbl & m_phantom)) return;
@@ -473,7 +473,7 @@ void s100_dj2db_device::s100_mwrt_w(offs_t offset, uint8_t data)
// s100_sinp_r - I/O read
//-------------------------------------------------
-uint8_t s100_dj2db_device::s100_sinp_r(offs_t offset)
+uint8_t s100_dj2db_device::s100_sinp_r(address_space &space, offs_t offset)
{
return 0xff;
}
@@ -483,7 +483,7 @@ uint8_t s100_dj2db_device::s100_sinp_r(offs_t offset)
// s100_sout_w - I/O write
//-------------------------------------------------
-void s100_dj2db_device::s100_sout_w(offs_t offset, uint8_t data)
+void s100_dj2db_device::s100_sout_w(address_space &space, offs_t offset, uint8_t data)
{
if (offset == 0x41)
{
diff --git a/src/devices/bus/s100/dj2db.h b/src/devices/bus/s100/dj2db.h
index 616113bb038..e82b4431095 100644
--- a/src/devices/bus/s100/dj2db.h
+++ b/src/devices/bus/s100/dj2db.h
@@ -42,10 +42,10 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_s100_card_interface overrides
- virtual uint8_t s100_smemr_r(offs_t offset) override;
- virtual void s100_mwrt_w(offs_t offset, uint8_t data) override;
- virtual uint8_t s100_sinp_r(offs_t offset) override;
- virtual void s100_sout_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t s100_smemr_r(address_space &space, offs_t offset) override;
+ virtual void s100_mwrt_w(address_space &space, offs_t offset, uint8_t data) override;
+ virtual uint8_t s100_sinp_r(address_space &space, offs_t offset) override;
+ virtual void s100_sout_w(address_space &space, offs_t offset, uint8_t data) override;
virtual void s100_phantom_w(int state) override;
private:
diff --git a/src/devices/bus/s100/djdma.cpp b/src/devices/bus/s100/djdma.cpp
index 0ee7dab0a0c..39522d321b4 100644
--- a/src/devices/bus/s100/djdma.cpp
+++ b/src/devices/bus/s100/djdma.cpp
@@ -146,7 +146,7 @@ void s100_djdma_device::device_reset()
// s100_sout_w - I/O write
//-------------------------------------------------
-void s100_djdma_device::s100_sout_w(offs_t offset, uint8_t data)
+void s100_djdma_device::s100_sout_w(address_space &space, offs_t offset, uint8_t data)
{
// O4 = /ATTN (responds to address EF only)
if (!BIT(m_cmdaddr[offset & 0xff], 3))
diff --git a/src/devices/bus/s100/djdma.h b/src/devices/bus/s100/djdma.h
index d9453aef25c..29d07c5860f 100644
--- a/src/devices/bus/s100/djdma.h
+++ b/src/devices/bus/s100/djdma.h
@@ -34,7 +34,7 @@ protected:
virtual void device_reset() override;
// bus-level overrides;
- virtual void s100_sout_w(offs_t offset, uint8_t data) override;
+ virtual void s100_sout_w(address_space &space, offs_t offset, uint8_t data) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/bus/s100/mm65k16s.cpp b/src/devices/bus/s100/mm65k16s.cpp
index ae098a2e29c..27cdc021d39 100644
--- a/src/devices/bus/s100/mm65k16s.cpp
+++ b/src/devices/bus/s100/mm65k16s.cpp
@@ -233,7 +233,7 @@ void s100_mm65k16s_device::device_reset()
// s100_smemr_r - memory read
//-------------------------------------------------
-uint8_t s100_mm65k16s_device::s100_smemr_r(offs_t offset)
+uint8_t s100_mm65k16s_device::s100_smemr_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
@@ -250,7 +250,7 @@ uint8_t s100_mm65k16s_device::s100_smemr_r(offs_t offset)
// s100_mwrt_w - memory write
//-------------------------------------------------
-void s100_mm65k16s_device::s100_mwrt_w(offs_t offset, uint8_t data)
+void s100_mm65k16s_device::s100_mwrt_w(address_space &space, offs_t offset, uint8_t data)
{
if (offset < 0xf800)
{
diff --git a/src/devices/bus/s100/mm65k16s.h b/src/devices/bus/s100/mm65k16s.h
index 10fa1daff7a..e46d13f955e 100644
--- a/src/devices/bus/s100/mm65k16s.h
+++ b/src/devices/bus/s100/mm65k16s.h
@@ -38,8 +38,8 @@ protected:
virtual void device_reset() override;
// device_s100_card_interface overrides
- virtual uint8_t s100_smemr_r(offs_t offset) override;
- virtual void s100_mwrt_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t s100_smemr_r(address_space &space, offs_t offset) override;
+ virtual void s100_mwrt_w(address_space &space, offs_t offset, uint8_t data) override;
virtual void s100_phantom_w(int state) override;
private:
diff --git a/src/devices/bus/s100/nsmdsa.cpp b/src/devices/bus/s100/nsmdsa.cpp
index 90d19b3fcb3..8efa1c9f392 100644
--- a/src/devices/bus/s100/nsmdsa.cpp
+++ b/src/devices/bus/s100/nsmdsa.cpp
@@ -57,11 +57,10 @@ static void mds_a_floppies(device_slot_interface &device)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void s100_mds_a_device::device_add_mconfig(machine_config &config)
-{
- for (auto &floppy : m_floppy)
- FLOPPY_CONNECTOR(config, floppy, mds_a_floppies, "525sd", floppy_image_device::default_floppy_formats);
-}
+MACHINE_CONFIG_START(s100_mds_a_device::device_add_mconfig)
+ MCFG_FLOPPY_DRIVE_ADD("floppy0", mds_a_floppies, "525sd", floppy_image_device::default_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD("floppy1", mds_a_floppies, "525sd", floppy_image_device::default_floppy_formats)
+MACHINE_CONFIG_END
@@ -76,7 +75,8 @@ void s100_mds_a_device::device_add_mconfig(machine_config &config)
s100_mds_a_device::s100_mds_a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, S100_MDS_A, tag, owner, clock),
device_s100_card_interface(mconfig, *this),
- m_floppy(*this, "floppy%u", 0U),
+ m_floppy0(*this, "floppy0"),
+ m_floppy1(*this, "floppy1"),
m_psel_rom(*this, "psel"),
m_pgm_rom(*this, "pgm")
{
@@ -105,7 +105,7 @@ void s100_mds_a_device::device_reset()
// s100_smemr_r - memory read
//-------------------------------------------------
-uint8_t s100_mds_a_device::s100_smemr_r(offs_t offset)
+uint8_t s100_mds_a_device::s100_smemr_r(address_space &space, offs_t offset)
{
return 0xff;
}
diff --git a/src/devices/bus/s100/nsmdsa.h b/src/devices/bus/s100/nsmdsa.h
index a36f39127ec..5bcaf7505c0 100644
--- a/src/devices/bus/s100/nsmdsa.h
+++ b/src/devices/bus/s100/nsmdsa.h
@@ -39,10 +39,11 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_s100_card_interface overrides
- virtual uint8_t s100_smemr_r(offs_t offset) override;
+ virtual uint8_t s100_smemr_r(address_space &space, offs_t offset) override;
private:
- required_device_array<floppy_connector, 2> m_floppy;
+ required_device<floppy_connector> m_floppy0;
+ required_device<floppy_connector> m_floppy1;
required_memory_region m_psel_rom;
required_memory_region m_pgm_rom;
};
diff --git a/src/devices/bus/s100/nsmdsad.cpp b/src/devices/bus/s100/nsmdsad.cpp
index d1358e85bf0..d13f6a7f748 100644
--- a/src/devices/bus/s100/nsmdsad.cpp
+++ b/src/devices/bus/s100/nsmdsad.cpp
@@ -58,11 +58,10 @@ static void mds_ad_floppies(device_slot_interface &device)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void s100_mds_ad_device::device_add_mconfig(machine_config &config)
-{
- for (auto &floppy : m_floppy)
- FLOPPY_CONNECTOR(config, floppy, mds_ad_floppies, "525dd", floppy_image_device::default_floppy_formats);
-}
+MACHINE_CONFIG_START(s100_mds_ad_device::device_add_mconfig)
+ MCFG_FLOPPY_DRIVE_ADD("floppy0", mds_ad_floppies, "525dd", floppy_image_device::default_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD("floppy1", mds_ad_floppies, "525dd", floppy_image_device::default_floppy_formats)
+MACHINE_CONFIG_END
@@ -77,7 +76,8 @@ void s100_mds_ad_device::device_add_mconfig(machine_config &config)
s100_mds_ad_device::s100_mds_ad_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, S100_MDS_AD, tag, owner, clock),
device_s100_card_interface(mconfig, *this),
- m_floppy(*this, "floppy%u", 0U),
+ m_floppy0(*this, "floppy0"),
+ m_floppy1(*this, "floppy1"),
m_dsel_rom(*this, "dsel"),
m_dpgm_rom(*this, "dpgm"),
m_dwe_rom(*this, "dwe")
@@ -107,7 +107,7 @@ void s100_mds_ad_device::device_reset()
// s100_smemr_r - memory read
//-------------------------------------------------
-uint8_t s100_mds_ad_device::s100_smemr_r(offs_t offset)
+uint8_t s100_mds_ad_device::s100_smemr_r(address_space &space, offs_t offset)
{
return 0xff;
}
diff --git a/src/devices/bus/s100/nsmdsad.h b/src/devices/bus/s100/nsmdsad.h
index ce5a248d553..f10d3c0af23 100644
--- a/src/devices/bus/s100/nsmdsad.h
+++ b/src/devices/bus/s100/nsmdsad.h
@@ -39,10 +39,11 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_s100_card_interface overrides
- virtual uint8_t s100_smemr_r(offs_t offset) override;
+ virtual uint8_t s100_smemr_r(address_space &space, offs_t offset) override;
private:
- required_device_array<floppy_connector, 2> m_floppy;
+ required_device<floppy_connector> m_floppy0;
+ required_device<floppy_connector> m_floppy1;
required_memory_region m_dsel_rom;
required_memory_region m_dpgm_rom;
required_memory_region m_dwe_rom;
diff --git a/src/devices/bus/s100/s100.cpp b/src/devices/bus/s100/s100.cpp
index 23333ce500f..dd28ca385d3 100644
--- a/src/devices/bus/s100/s100.cpp
+++ b/src/devices/bus/s100/s100.cpp
@@ -135,7 +135,7 @@ void s100_bus_device::add_card(device_s100_card_interface *card)
// smemr_r - memory read
//-------------------------------------------------
-uint8_t s100_bus_device::smemr_r(offs_t offset)
+READ8_MEMBER( s100_bus_device::smemr_r )
{
uint8_t data = 0xff;
@@ -143,7 +143,7 @@ uint8_t s100_bus_device::smemr_r(offs_t offset)
while (entry)
{
- data &= entry->s100_smemr_r(offset);
+ data &= entry->s100_smemr_r(space, offset);
entry = entry->next();
}
@@ -155,13 +155,13 @@ uint8_t s100_bus_device::smemr_r(offs_t offset)
// mwrt_w - memory write
//-------------------------------------------------
-void s100_bus_device::mwrt_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( s100_bus_device::mwrt_w )
{
device_s100_card_interface *entry = m_device_list.first();
while (entry)
{
- entry->s100_mwrt_w(offset, data);
+ entry->s100_mwrt_w(space, offset, data);
entry = entry->next();
}
}
@@ -171,7 +171,7 @@ void s100_bus_device::mwrt_w(offs_t offset, uint8_t data)
// sinp_r - I/O read
//-------------------------------------------------
-uint8_t s100_bus_device::sinp_r(offs_t offset)
+READ8_MEMBER( s100_bus_device::sinp_r )
{
uint8_t data = 0xff;
@@ -179,7 +179,7 @@ uint8_t s100_bus_device::sinp_r(offs_t offset)
while (entry)
{
- data &= entry->s100_sinp_r(offset);
+ data &= entry->s100_sinp_r(space, offset);
entry = entry->next();
}
@@ -191,13 +191,13 @@ uint8_t s100_bus_device::sinp_r(offs_t offset)
// sout_w - I/O write
//-------------------------------------------------
-void s100_bus_device::sout_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( s100_bus_device::sout_w )
{
device_s100_card_interface *entry = m_device_list.first();
while (entry)
{
- entry->s100_sout_w(offset, data);
+ entry->s100_sout_w(space, offset, data);
entry = entry->next();
}
}
diff --git a/src/devices/bus/s100/s100.h b/src/devices/bus/s100/s100.h
index f231520f694..6336be291e4 100644
--- a/src/devices/bus/s100/s100.h
+++ b/src/devices/bus/s100/s100.h
@@ -68,6 +68,68 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_S100_SLOT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, S100_SLOT, DERIVED_CLOCK(1, 1)) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+#define MCFG_S100_IRQ_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_NMI_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_nmi_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_VI0_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_vi0_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_VI1_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_vi1_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_VI2_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_vi2_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_VI3_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_vi3_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_VI4_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_vi4_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_VI5_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_vi5_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_VI6_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_vi6_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_VI7_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_vi7_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_DMA0_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_dma0_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_DMA1_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_dma1_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_DMA2_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_dma2_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_DMA3_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_dma3_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_RDY_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_rdy_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_HOLD_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_hold_wr_callback(DEVCB_##_write);
+
+#define MCFG_S100_ERROR_CALLBACK(_write) \
+ downcast<s100_bus_device &>(*device).set_error_wr_callback(DEVCB_##_write);
+
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -99,12 +161,12 @@ public:
virtual void s100_vi7_w(int state) { }
// memory access
- virtual uint8_t s100_smemr_r(offs_t offset) { return 0xff; }
- virtual void s100_mwrt_w(offs_t offset, uint8_t data) { }
+ virtual uint8_t s100_smemr_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void s100_mwrt_w(address_space &space, offs_t offset, uint8_t data) { }
// I/O access
- virtual uint8_t s100_sinp_r(offs_t offset) { return 0xff; }
- virtual void s100_sout_w(offs_t offset, uint8_t data) { }
+ virtual uint8_t s100_sinp_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void s100_sout_w(address_space &space, offs_t offset, uint8_t data) { }
// configuration access
virtual void s100_phlda_w(int state) { }
@@ -139,31 +201,31 @@ public:
s100_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
~s100_bus_device() { m_device_list.detach_all(); }
- auto irq() { return m_write_irq.bind(); }
- auto nmi() { return m_write_nmi.bind(); }
- auto vi0() { return m_write_vi0.bind(); }
- auto vi1() { return m_write_vi1.bind(); }
- auto vi2() { return m_write_vi2.bind(); }
- auto vi3() { return m_write_vi3.bind(); }
- auto vi4() { return m_write_vi4.bind(); }
- auto vi5() { return m_write_vi5.bind(); }
- auto vi6() { return m_write_vi6.bind(); }
- auto vi7() { return m_write_vi7.bind(); }
- auto dma0() { return m_write_dma0.bind(); }
- auto dma1() { return m_write_dma1.bind(); }
- auto dma2() { return m_write_dma2.bind(); }
- auto dma3() { return m_write_dma3.bind(); }
- auto rdy() { return m_write_rdy.bind(); }
- auto hold() { return m_write_hold.bind(); }
- auto error() { return m_write_error.bind(); }
+ template <class Object> devcb_base &set_irq_wr_callback(Object &&cb) { return m_write_irq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_nmi_wr_callback(Object &&cb) { return m_write_nmi.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vi0_wr_callback(Object &&cb) { return m_write_vi0.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vi1_wr_callback(Object &&cb) { return m_write_vi1.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vi2_wr_callback(Object &&cb) { return m_write_vi2.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vi3_wr_callback(Object &&cb) { return m_write_vi3.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vi4_wr_callback(Object &&cb) { return m_write_vi4.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vi5_wr_callback(Object &&cb) { return m_write_vi5.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vi6_wr_callback(Object &&cb) { return m_write_vi6.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vi7_wr_callback(Object &&cb) { return m_write_vi7.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_dma0_wr_callback(Object &&cb) { return m_write_dma0.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_dma1_wr_callback(Object &&cb) { return m_write_dma1.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_dma2_wr_callback(Object &&cb) { return m_write_dma2.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_dma3_wr_callback(Object &&cb) { return m_write_dma3.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_rdy_wr_callback(Object &&cb) { return m_write_rdy.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_hold_wr_callback(Object &&cb) { return m_write_hold.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_error_wr_callback(Object &&cb) { return m_write_error.set_callback(std::forward<Object>(cb)); }
void add_card(device_s100_card_interface *card);
- uint8_t smemr_r(offs_t offset);
- void mwrt_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( smemr_r );
+ DECLARE_WRITE8_MEMBER( mwrt_w );
- uint8_t sinp_r(offs_t offset);
- void sout_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( sinp_r );
+ DECLARE_WRITE8_MEMBER( sout_w );
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_write_irq(state); }
DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_write_nmi(state); }
@@ -217,15 +279,6 @@ class s100_slot_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- template <typename T>
- s100_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : s100_slot_device(mconfig, tag, owner, DERIVED_CLOCK(1, 1))
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
s100_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
diff --git a/src/devices/bus/s100/seals8k.cpp b/src/devices/bus/s100/seals8k.cpp
index 949c7d6d2c5..9191f8566df 100644
--- a/src/devices/bus/s100/seals8k.cpp
+++ b/src/devices/bus/s100/seals8k.cpp
@@ -51,8 +51,8 @@ protected:
virtual void device_start() override;
// S-100 memory access handlers
- virtual u8 s100_smemr_r(offs_t offset) override;
- virtual void s100_mwrt_w(offs_t offset, u8 data) override;
+ virtual u8 s100_smemr_r(address_space &space, offs_t offset) override;
+ virtual void s100_mwrt_w(address_space &space, offs_t offset, u8 data) override;
// internal state
std::unique_ptr<u8[]> m_ram;
@@ -203,7 +203,7 @@ bool s100_8k_sc_device::board_selected(offs_t offset) const
// s100_smemr_r - memory read
//-------------------------------------------------
-u8 s100_8k_sc_device::s100_smemr_r(offs_t offset)
+u8 s100_8k_sc_device::s100_smemr_r(address_space &space, offs_t offset)
{
if (board_selected(offset))
return m_ram[offset & 0x1fff];
@@ -216,7 +216,7 @@ u8 s100_8k_sc_device::s100_smemr_r(offs_t offset)
// s100_mwrt_w - memory write
//-------------------------------------------------
-void s100_8k_sc_device::s100_mwrt_w(offs_t offset, u8 data)
+void s100_8k_sc_device::s100_mwrt_w(address_space &space, offs_t offset, u8 data)
{
if (board_selected(offset))
m_ram[offset & 0x1fff] = data;
diff --git a/src/devices/bus/s100/wunderbus.cpp b/src/devices/bus/s100/wunderbus.cpp
index c7db4417dcb..9d307d9053b 100644
--- a/src/devices/bus/s100/wunderbus.cpp
+++ b/src/devices/bus/s100/wunderbus.cpp
@@ -300,7 +300,7 @@ void s100_wunderbus_device::s100_vi2_w(int state)
// s100_sinp_r - I/O read
//-------------------------------------------------
-uint8_t s100_wunderbus_device::s100_sinp_r(offs_t offset)
+uint8_t s100_wunderbus_device::s100_sinp_r(address_space &space, offs_t offset)
{
uint8_t address = (m_7c->read() & 0x3e) << 2;
if ((offset & 0xf8) != address) return 0xff;
@@ -388,15 +388,15 @@ uint8_t s100_wunderbus_device::s100_sinp_r(offs_t offset)
break;
case 1:
- data = m_ace1->ins8250_r(machine().dummy_space(), offset & 0x07);
+ data = m_ace1->ins8250_r(space, offset & 0x07);
break;
case 2:
- data = m_ace2->ins8250_r(machine().dummy_space(), offset & 0x07);
+ data = m_ace2->ins8250_r(space, offset & 0x07);
break;
case 3:
- data = m_ace3->ins8250_r(machine().dummy_space(), offset & 0x07);
+ data = m_ace3->ins8250_r(space, offset & 0x07);
break;
}
}
@@ -409,7 +409,7 @@ uint8_t s100_wunderbus_device::s100_sinp_r(offs_t offset)
// s100_sout_w - I/O write
//-------------------------------------------------
-void s100_wunderbus_device::s100_sout_w(offs_t offset, uint8_t data)
+void s100_wunderbus_device::s100_sout_w(address_space &space, offs_t offset, uint8_t data)
{
uint8_t address = (m_7c->read() & 0x3e) << 2;
if ((offset & 0xf8) != address) return;
@@ -511,15 +511,15 @@ void s100_wunderbus_device::s100_sout_w(offs_t offset, uint8_t data)
break;
case 1:
- m_ace1->ins8250_w(machine().dummy_space(), offset & 0x07, data);
+ m_ace1->ins8250_w(space, offset & 0x07, data);
break;
case 2:
- m_ace2->ins8250_w(machine().dummy_space(), offset & 0x07, data);
+ m_ace2->ins8250_w(space, offset & 0x07, data);
break;
case 3:
- m_ace3->ins8250_w(machine().dummy_space(), offset & 0x07, data);
+ m_ace3->ins8250_w(space, offset & 0x07, data);
break;
}
}
diff --git a/src/devices/bus/s100/wunderbus.h b/src/devices/bus/s100/wunderbus.h
index ca9a6d0e641..540c5cd8b6c 100644
--- a/src/devices/bus/s100/wunderbus.h
+++ b/src/devices/bus/s100/wunderbus.h
@@ -44,8 +44,8 @@ protected:
virtual void s100_vi0_w(int state) override;
virtual void s100_vi1_w(int state) override;
virtual void s100_vi2_w(int state) override;
- virtual uint8_t s100_sinp_r(offs_t offset) override;
- virtual void s100_sout_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t s100_sinp_r(address_space &space, offs_t offset) override;
+ virtual void s100_sout_w(address_space &space, offs_t offset, uint8_t data) override;
private:
DECLARE_WRITE_LINE_MEMBER( pic_int_w );
diff --git a/src/devices/bus/saturn/sat_slot.h b/src/devices/bus/saturn/sat_slot.h
index 63a9ae0dbca..4d94ea472d6 100644
--- a/src/devices/bus/saturn/sat_slot.h
+++ b/src/devices/bus/saturn/sat_slot.h
@@ -67,16 +67,7 @@ class sat_cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- sat_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : sat_cart_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- sat_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ sat_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~sat_cart_slot_device();
// image-level overrides
@@ -126,4 +117,9 @@ DECLARE_DEVICE_TYPE(SATURN_CART_SLOT, sat_cart_slot_device)
#define SATSLOT_ROM_REGION_TAG ":cart:rom"
+#define MCFG_SATURN_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, SATURN_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
#endif // MAME_BUS_SATURN_SAT_SLOT_H
diff --git a/src/devices/bus/sbus/cgthree.cpp b/src/devices/bus/sbus/cgthree.cpp
index 091efef3b21..02ddaba688f 100644
--- a/src/devices/bus/sbus/cgthree.cpp
+++ b/src/devices/bus/sbus/cgthree.cpp
@@ -36,7 +36,9 @@ void sbus_cgthree_device::device_add_mconfig(machine_config &config)
{
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_screen_update(FUNC(sbus_cgthree_device::screen_update));
- m_screen->set_raw(92.9405_MHz_XTAL, 1504, 0, 1152, 937, 0, 900);
+ m_screen->set_size(1152, 900);
+ m_screen->set_visarea(0, 1152-1, 0, 900-1);
+ m_screen->set_refresh_hz(72);
BT458(config, m_ramdac, 0);
}
diff --git a/src/devices/bus/scsi/omti5100.cpp b/src/devices/bus/scsi/omti5100.cpp
index 519aa723a0b..415b68bb4ed 100644
--- a/src/devices/bus/scsi/omti5100.cpp
+++ b/src/devices/bus/scsi/omti5100.cpp
@@ -176,8 +176,7 @@ void omti5100_device::WriteData( uint8_t *data, int dataLength )
}
}
-void omti5100_device::device_add_mconfig(machine_config &config)
-{
- HARDDISK(config, m_image0);
- HARDDISK(config, m_image1);
-}
+MACHINE_CONFIG_START(omti5100_device::device_add_mconfig)
+ MCFG_HARDDISK_ADD("image0")
+ MCFG_HARDDISK_ADD("image1")
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/scsi/s1410.cpp b/src/devices/bus/scsi/s1410.cpp
index 5416089fd9d..e05cfe73014 100644
--- a/src/devices/bus/scsi/s1410.cpp
+++ b/src/devices/bus/scsi/s1410.cpp
@@ -165,15 +165,14 @@ void s1410_device::s1410_io(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void s1410_device::device_add_mconfig(machine_config &config)
-{
- z80_device &z8400a(Z80(config, Z8400A_TAG, XTAL(16'000'000)/4));
- z8400a.set_addrmap(AS_PROGRAM, &s1410_device::s1410_mem);
- z8400a.set_addrmap(AS_IO, &s1410_device::s1410_io);
- z8400a.set_disable();
-
- HARDDISK(config, "image");
-}
+MACHINE_CONFIG_START(s1410_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(Z8400A_TAG, Z80, XTAL(16'000'000)/4)
+ MCFG_DEVICE_PROGRAM_MAP(s1410_mem)
+ MCFG_DEVICE_IO_MAP(s1410_io)
+ MCFG_DEVICE_DISABLE()
+
+ MCFG_HARDDISK_ADD("image")
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/scsi/sa1403d.cpp b/src/devices/bus/scsi/sa1403d.cpp
index 5ab22288835..902b69f5b63 100644
--- a/src/devices/bus/scsi/sa1403d.cpp
+++ b/src/devices/bus/scsi/sa1403d.cpp
@@ -57,10 +57,9 @@ const tiny_rom_entry *sa1403d_device::device_rom_region() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void sa1403d_device::device_add_mconfig(machine_config &config)
-{
- HARDDISK(config, "image");
-}
+MACHINE_CONFIG_START(sa1403d_device::device_add_mconfig)
+ MCFG_HARDDISK_ADD("image")
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/scsi/scsi.h b/src/devices/bus/scsi/scsi.h
index 66ddae370d6..e5995f970ab 100644
--- a/src/devices/bus/scsi/scsi.h
+++ b/src/devices/bus/scsi/scsi.h
@@ -17,6 +17,77 @@
#define SCSI_PORT_DEVICE6 "6"
#define SCSI_PORT_DEVICE7 "7"
+#define MCFG_SCSI_BSY_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_bsy_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_SEL_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_sel_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_CD_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_cd_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_IO_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_io_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_MSG_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_msg_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_REQ_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_req_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_ACK_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_ack_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_ATN_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_atn_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_RST_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_rst_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_DATA0_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_data0_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_DATA1_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_data1_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_DATA2_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_data2_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_DATA3_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_data3_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_DATA4_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_data4_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_DATA5_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_data5_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_DATA6_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_data6_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_DATA7_HANDLER(_devcb) \
+ downcast<scsi_port_device &>(*device).set_data7_handler(DEVCB_##_devcb);
+
+#define MCFG_SCSI_OUTPUT_LATCH_ADD(_tag, scsi_port_tag) \
+ MCFG_DEVICE_ADD(_tag, OUTPUT_LATCH, 0) \
+ MCFG_OUTPUT_LATCH_BIT0_HANDLER(WRITELINE(scsi_port_tag, scsi_port_device, write_data0)) \
+ MCFG_OUTPUT_LATCH_BIT1_HANDLER(WRITELINE(scsi_port_tag, scsi_port_device, write_data1)) \
+ MCFG_OUTPUT_LATCH_BIT2_HANDLER(WRITELINE(scsi_port_tag, scsi_port_device, write_data2)) \
+ MCFG_OUTPUT_LATCH_BIT3_HANDLER(WRITELINE(scsi_port_tag, scsi_port_device, write_data3)) \
+ MCFG_OUTPUT_LATCH_BIT4_HANDLER(WRITELINE(scsi_port_tag, scsi_port_device, write_data4)) \
+ MCFG_OUTPUT_LATCH_BIT5_HANDLER(WRITELINE(scsi_port_tag, scsi_port_device, write_data5)) \
+ MCFG_OUTPUT_LATCH_BIT6_HANDLER(WRITELINE(scsi_port_tag, scsi_port_device, write_data6)) \
+ MCFG_OUTPUT_LATCH_BIT7_HANDLER(WRITELINE(scsi_port_tag, scsi_port_device, write_data7))
+
+#define MCFG_SCSI_DATA_INPUT_BUFFER(_tag) \
+ MCFG_SCSI_DATA0_HANDLER(WRITELINE(_tag, input_buffer_device, write_bit0)) \
+ MCFG_SCSI_DATA1_HANDLER(WRITELINE(_tag, input_buffer_device, write_bit1)) \
+ MCFG_SCSI_DATA2_HANDLER(WRITELINE(_tag, input_buffer_device, write_bit2)) \
+ MCFG_SCSI_DATA3_HANDLER(WRITELINE(_tag, input_buffer_device, write_bit3)) \
+ MCFG_SCSI_DATA4_HANDLER(WRITELINE(_tag, input_buffer_device, write_bit4)) \
+ MCFG_SCSI_DATA5_HANDLER(WRITELINE(_tag, input_buffer_device, write_bit5)) \
+ MCFG_SCSI_DATA6_HANDLER(WRITELINE(_tag, input_buffer_device, write_bit6)) \
+ MCFG_SCSI_DATA7_HANDLER(WRITELINE(_tag, input_buffer_device, write_bit7))
class scsi_port_slot_device;
class scsi_port_interface;
@@ -29,6 +100,23 @@ public:
// construction/destruction
scsi_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ template <class Object> devcb_base &set_bsy_handler(Object &&cb) { return m_bsy_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_sel_handler(Object &&cb) { return m_sel_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_cd_handler(Object &&cb) { return m_cd_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_io_handler(Object &&cb) { return m_io_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_msg_handler(Object &&cb) { return m_msg_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_req_handler(Object &&cb) { return m_req_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ack_handler(Object &&cb) { return m_ack_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_atn_handler(Object &&cb) { return m_atn_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_rst_handler(Object &&cb) { return m_rst_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data0_handler(Object &&cb) { return m_data0_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data1_handler(Object &&cb) { return m_data1_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data2_handler(Object &&cb) { return m_data2_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data3_handler(Object &&cb) { return m_data3_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data4_handler(Object &&cb) { return m_data4_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data5_handler(Object &&cb) { return m_data5_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data6_handler(Object &&cb) { return m_data6_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_data7_handler(Object &&cb) { return m_data7_handler.set_callback(std::forward<Object>(cb)); }
auto bsy_handler() { return m_bsy_handler.bind(); }
auto sel_handler() { return m_sel_handler.bind(); }
auto cd_handler() { return m_cd_handler.bind(); }
diff --git a/src/devices/bus/scsi/scsicd.cpp b/src/devices/bus/scsi/scsicd.cpp
index 0f577ea44d3..1a5e6f8002d 100644
--- a/src/devices/bus/scsi/scsicd.cpp
+++ b/src/devices/bus/scsi/scsicd.cpp
@@ -30,8 +30,8 @@ void scsicd_device::device_start()
scsihle_device::device_start();
}
-void scsicd_device::device_add_mconfig(machine_config &config)
-{
- CDROM(config, "image").set_interface("cdrom");
- CDDA(config, "cdda");
-}
+MACHINE_CONFIG_START(scsicd_device::device_add_mconfig)
+ MCFG_CDROM_ADD("image")
+ MCFG_CDROM_INTERFACE("cdrom")
+ MCFG_DEVICE_ADD("cdda", CDDA)
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/scsi/scsihd.cpp b/src/devices/bus/scsi/scsihd.cpp
index 4fb01e02130..b63bafeb098 100644
--- a/src/devices/bus/scsi/scsihd.cpp
+++ b/src/devices/bus/scsi/scsihd.cpp
@@ -29,7 +29,7 @@ void scsihd_device::device_start()
scsihle_device::device_start();
}
-void scsihd_device::device_add_mconfig(machine_config &config)
-{
- HARDDISK(config, "image", "scsi_hdd");
-}
+MACHINE_CONFIG_START(scsihd_device::device_add_mconfig)
+ MCFG_HARDDISK_ADD("image")
+ MCFG_HARDDISK_INTERFACE("scsi_hdd")
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/scsi/scsihle.h b/src/devices/bus/scsi/scsihle.h
index e98e38122e7..bce047ae474 100644
--- a/src/devices/bus/scsi/scsihle.h
+++ b/src/devices/bus/scsi/scsihle.h
@@ -84,4 +84,10 @@ extern const input_device_default DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_5)[];
extern const input_device_default DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_6)[];
extern const input_device_default DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_7)[];
+#define MCFG_SCSIDEV_ADD(_tag, _option, _type, _id) \
+ MCFG_DEVICE_MODIFY(_tag ) \
+ MCFG_SLOT_OPTION_ADD( _option, _type ) \
+ MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS( _option, _id ) \
+ MCFG_SLOT_DEFAULT_OPTION( _option )
+
#endif // MAME_BUS_SCSI_SCSIHLE_H
diff --git a/src/devices/bus/scv/slot.h b/src/devices/bus/scv/slot.h
index 357c593c404..5dc3ec6e5b7 100644
--- a/src/devices/bus/scv/slot.h
+++ b/src/devices/bus/scv/slot.h
@@ -66,17 +66,7 @@ class scv_cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- scv_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : scv_cart_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- scv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ scv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~scv_cart_slot_device();
// image-level overrides
@@ -126,4 +116,8 @@ DECLARE_DEVICE_TYPE(SCV_CART_SLOT, scv_cart_slot_device)
#define SCVSLOT_ROM_REGION_TAG ":cart:rom"
+#define MCFG_SCV_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, SCV_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
#endif // MAME_BUS_SCV_SLOT_H
diff --git a/src/devices/bus/sega8/ccatch.cpp b/src/devices/bus/sega8/ccatch.cpp
index 1180e7a793b..cbe9840bae7 100644
--- a/src/devices/bus/sega8/ccatch.cpp
+++ b/src/devices/bus/sega8/ccatch.cpp
@@ -53,7 +53,6 @@ static void sg1000_card(device_slot_interface &device)
device.option_add_internal("rom", SEGA8_ROM_STD);
}
-void sega8_cardcatch_device::device_add_mconfig(machine_config &config)
-{
- SG1000_CARD_SLOT(config, "cardslot", sg1000_card, nullptr);
-}
+MACHINE_CONFIG_START(sega8_cardcatch_device::device_add_mconfig)
+ MCFG_SG1000_CARD_ADD("cardslot", sg1000_card, nullptr)
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/sega8/mgear.cpp b/src/devices/bus/sega8/mgear.cpp
index 46fb6a4ad52..977ea1f18e7 100644
--- a/src/devices/bus/sega8/mgear.cpp
+++ b/src/devices/bus/sega8/mgear.cpp
@@ -38,8 +38,7 @@ void sega8_mgear_device::device_reset()
}
-void sega8_mgear_device::device_add_mconfig(machine_config &config)
-{
- SMS_CART_SLOT(config, "subslot", sms_cart, nullptr);
- SOFTWARE_LIST(config, "cart_list").set_original("sms");
-}
+MACHINE_CONFIG_START(sega8_mgear_device::device_add_mconfig)
+ MCFG_SMS_CARTRIDGE_ADD("subslot", sms_cart, nullptr)
+ MCFG_SOFTWARE_LIST_ADD("cart_list","sms")
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/sega8/rom.cpp b/src/devices/bus/sega8/rom.cpp
index 1f039361a12..72017b5c795 100644
--- a/src/devices/bus/sega8/rom.cpp
+++ b/src/devices/bus/sega8/rom.cpp
@@ -42,9 +42,6 @@ DEFINE_DEVICE_TYPE(SEGA8_ROM_KOREAN, sega8_korean_device, "sega8_kor
DEFINE_DEVICE_TYPE(SEGA8_ROM_KOREAN_NB, sega8_korean_nb_device, "sega8_korean_nb", "SMS Korean No-Bank Mapper Carts")
DEFINE_DEVICE_TYPE(SEGA8_ROM_SEOJIN, sega8_seojin_device, "sega8_seojin", "SMS Seo Jin Multi-cart")
-// Specific SC-3000 cart types
-DEFINE_DEVICE_TYPE(SEGA8_ROM_MULTICART, sega8_multicart_device, "sega8_multicart", "SC-3000 MkII Multicart Cart")
-DEFINE_DEVICE_TYPE(SEGA8_ROM_MEGACART, sega8_megacart_device, "sega8_megacart", "SC-3000 Megacart Cart")
sega8_rom_device::sega8_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
@@ -188,18 +185,6 @@ sega8_seojin_device::sega8_seojin_device(const machine_config &mconfig, const ch
}
-sega8_multicart_device::sega8_multicart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega8_rom_device(mconfig, SEGA8_ROM_MULTICART, tag, owner, clock)
-{
-}
-
-
-sega8_megacart_device::sega8_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega8_rom_device(mconfig, SEGA8_ROM_MEGACART, tag, owner, clock)
-{
-}
-
-
void sega8_rom_device::device_start()
{
save_item(NAME(m_rom_bank_base));
@@ -283,28 +268,6 @@ void sega8_zemina_device::device_reset()
}
-void sega8_multicart_device::device_start()
-{
- save_item(NAME(m_block));
-}
-
-void sega8_multicart_device::device_reset()
-{
- m_block = 0xff;
-}
-
-
-void sega8_megacart_device::device_start()
-{
- save_item(NAME(m_block));
-}
-
-void sega8_megacart_device::device_reset()
-{
- m_block = 0xff;
-}
-
-
// initial bank setup needs to know how many 16K banks are available, so it needs to be called during cart loading...
void sega8_rom_device::late_bank_setup()
@@ -1060,78 +1023,3 @@ READ8_MEMBER(sega8_seojin_device::read_ram)
return m_ram[offset & 0x3fff];
}
-/*-------------------------------------------------
-
- SC-3000 Survivors MkII Multicart
-
--------------------------------------------------*/
-
-READ8_MEMBER(sega8_multicart_device::read_cart)
-{
- // 16K of RAM sits in 0x8000-0xbfff
- if (offset >= 0x8000)
- return m_ram[offset & 0x3fff];
-
- return m_rom[(offset & 0x7fff) | (m_block << 15) % m_rom_size];
-}
-
-WRITE8_MEMBER(sega8_multicart_device::write_cart)
-{
- // 16K of RAM sits in 0x8000-0xbfff
- if (offset >= 0x8000)
- m_ram[offset & 0x3fff] = data;
-}
-
-READ8_MEMBER(sega8_multicart_device::read_ram)
-{
- return m_ram[0x4000 + (offset & 0x3fff)];
-}
-
-WRITE8_MEMBER(sega8_multicart_device::write_ram)
-{
- m_ram[0x4000 + (offset & 0x3fff)] = data;
-}
-
-WRITE8_MEMBER(sega8_multicart_device::write_io)
-{
- if ((offset & 0xe0) == 0xe0)
- m_block = (data & 0x80) ? ((data & 0x1f) | ((data & 0x40) ? 0x20 : 0x00)) : 0x3f;
-}
-
-/*-------------------------------------------------
-
- SC-3000 Survivors Megacart
-
--------------------------------------------------*/
-
-READ8_MEMBER(sega8_megacart_device::read_cart)
-{
- // 16K of RAM sits in 0x8000-0xbfff
- if (offset >= 0x8000)
- return m_ram[offset & 0x3fff];
-
- return m_rom[(offset & 0x7fff) | (m_block << 15) % m_rom_size];
-}
-
-WRITE8_MEMBER(sega8_megacart_device::write_cart)
-{
- // 16K of RAM sits in 0x8000-0xbfff
- if (offset >= 0x8000)
- m_ram[offset & 0x3fff] = data;
-}
-
-READ8_MEMBER(sega8_megacart_device::read_ram)
-{
- return m_ram[0x4000 + (offset & 0x3fff)];
-}
-
-WRITE8_MEMBER(sega8_megacart_device::write_ram)
-{
- m_ram[0x4000 + (offset & 0x3fff)] = data;
-}
-
-WRITE8_MEMBER(sega8_megacart_device::write_io)
-{
- if ((offset & 0xe0) == 0xe0)
- m_block = (data & 0x1f) | (data & 0xc0) >> 1;
-}
diff --git a/src/devices/bus/sega8/rom.h b/src/devices/bus/sega8/rom.h
index 4f9dc80d967..c299ff261c5 100644
--- a/src/devices/bus/sega8/rom.h
+++ b/src/devices/bus/sega8/rom.h
@@ -397,60 +397,6 @@ protected:
};
-// ======================> sega8_multicart_device
-
-class sega8_multicart_device : public sega8_rom_device
-{
-public:
- // construction/destruction
- sega8_multicart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- // reading and writing
- virtual DECLARE_READ8_MEMBER(read_cart) override;
- virtual DECLARE_WRITE8_MEMBER(write_cart) override;
- virtual DECLARE_WRITE8_MEMBER(write_io) override;
-
- // has internal RAM which overwrites the system one!
- virtual DECLARE_READ8_MEMBER(read_ram) override;
- virtual DECLARE_WRITE8_MEMBER(write_ram) override;
-
-protected:
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
-private:
- uint8_t m_block;
-};
-
-
-// ======================> sega8_megacart_device
-
-class sega8_megacart_device : public sega8_rom_device
-{
-public:
- // construction/destruction
- sega8_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- // reading and writing
- virtual DECLARE_READ8_MEMBER(read_cart) override;
- virtual DECLARE_WRITE8_MEMBER(write_cart) override;
- virtual DECLARE_WRITE8_MEMBER(write_io) override;
-
- // has internal RAM which overwrites the system one!
- virtual DECLARE_READ8_MEMBER(read_ram) override;
- virtual DECLARE_WRITE8_MEMBER(write_ram) override;
-
-protected:
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
-private:
- uint8_t m_block;
-};
-
-
// device type definition
DECLARE_DEVICE_TYPE(SEGA8_ROM_STD, sega8_rom_device)
DECLARE_DEVICE_TYPE(SEGA8_ROM_OTHELLO, sega8_othello_device)
@@ -470,7 +416,5 @@ DECLARE_DEVICE_TYPE(SEGA8_ROM_HICOM, sega8_hicom_device)
DECLARE_DEVICE_TYPE(SEGA8_ROM_KOREAN, sega8_korean_device)
DECLARE_DEVICE_TYPE(SEGA8_ROM_KOREAN_NB, sega8_korean_nb_device)
DECLARE_DEVICE_TYPE(SEGA8_ROM_SEOJIN, sega8_seojin_device)
-DECLARE_DEVICE_TYPE(SEGA8_ROM_MULTICART, sega8_multicart_device)
-DECLARE_DEVICE_TYPE(SEGA8_ROM_MEGACART, sega8_megacart_device)
#endif // MAME_BUS_SEGA8_ROM_H
diff --git a/src/devices/bus/sega8/sega8_slot.cpp b/src/devices/bus/sega8/sega8_slot.cpp
index e897f6c53e8..3242654b829 100644
--- a/src/devices/bus/sega8/sega8_slot.cpp
+++ b/src/devices/bus/sega8/sega8_slot.cpp
@@ -40,16 +40,6 @@
DEFINE_DEVICE_TYPE(SEGA8_CART_SLOT, sega8_cart_slot_device, "sega8_cart_slot", "Sega Master System / Game Gear / SG-1000 Cartridge Slot")
DEFINE_DEVICE_TYPE(SEGA8_CARD_SLOT, sega8_card_slot_device, "sega8_card_slot", "Sega Master System / Game Gear / SG-1000 Card Slot")
-DEFINE_DEVICE_TYPE(SG1000_CART_SLOT, sg1000_cart_slot_device, "sg1000_cart_slot", "Sega SG-1000 Cartridge Slot")
-DEFINE_DEVICE_TYPE(OMV_CART_SLOT, omv_cart_slot_device, "omv_cart_slot", "Tsukuda Original Othello Multivision FG-1000 / FG-2000 Cartridge Slot")
-DEFINE_DEVICE_TYPE(SC3000_CART_SLOT, sc3000_cart_slot_device, "sc3000_cart_slot", "Sega SC-3000 Cartridge Slot")
-DEFINE_DEVICE_TYPE(SG1000MK3_CART_SLOT, sg1000mk3_cart_slot_device, "sg1000mk3_cart_slot", "Sega SG-1000 Mark III Cartridge Slot")
-DEFINE_DEVICE_TYPE(SMS_CART_SLOT, sms_cart_slot_device, "sms_cart_slot", "Sega Master System Cartridge Slot")
-DEFINE_DEVICE_TYPE(GAMEGEAR_CART_SLOT, gamegear_cart_slot_device, "gamegear_cart_slot", "Sega Game Gear Cartridge Slot")
-
-DEFINE_DEVICE_TYPE(SMS_CARD_SLOT, sms_card_slot_device, "sms_card_slot", "Sega Master System Card Slot")
-DEFINE_DEVICE_TYPE(SG1000_CARD_SLOT, sg1000_card_slot_device, "sg1000_card_slot", "Sega SG-1000 Card Slot")
-
//**************************************************************************
// SMS cartridges Interface
@@ -122,7 +112,10 @@ sega8_cart_slot_device::sega8_cart_slot_device(const machine_config &mconfig, de
, device_image_interface(mconfig, *this)
, device_slot_interface(mconfig, *this)
, m_type(SEGA8_BASE_ROM)
+ , m_must_be_loaded(false)
, m_is_card(is_card)
+ , m_interface("sms_cart")
+ , m_extensions("bin")
, m_cart(nullptr)
{
}
@@ -132,57 +125,11 @@ sega8_cart_slot_device::sega8_cart_slot_device(const machine_config &mconfig, co
{
}
-sega8_card_slot_device::sega8_card_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
- : sega8_cart_slot_device(mconfig, type, tag, owner, clock, true)
-{
-}
-
sega8_card_slot_device::sega8_card_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega8_card_slot_device(mconfig, SEGA8_CARD_SLOT, tag, owner, clock)
-{
-}
-
-
-sg1000_cart_slot_device::sg1000_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega8_cart_slot_device(mconfig, SG1000_CART_SLOT, tag, owner, clock)
-{
-}
-
-omv_cart_slot_device::omv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega8_cart_slot_device(mconfig, OMV_CART_SLOT, tag, owner, clock)
-{
-}
-
-sc3000_cart_slot_device::sc3000_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega8_cart_slot_device(mconfig, SC3000_CART_SLOT, tag, owner, clock)
-{
-}
-
-sg1000mk3_cart_slot_device::sg1000mk3_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega8_cart_slot_device(mconfig, SG1000MK3_CART_SLOT, tag, owner, clock)
-{
-}
-
-sms_cart_slot_device::sms_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega8_cart_slot_device(mconfig, SMS_CART_SLOT, tag, owner, clock)
+ : sega8_cart_slot_device(mconfig, SEGA8_CARD_SLOT, tag, owner, clock, true)
{
}
-gamegear_cart_slot_device::gamegear_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega8_cart_slot_device(mconfig, GAMEGEAR_CART_SLOT, tag, owner, clock)
-{
-}
-
-
-sms_card_slot_device::sms_card_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega8_card_slot_device(mconfig, SMS_CARD_SLOT, tag, owner, clock)
-{
-}
-
-sg1000_card_slot_device::sg1000_card_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega8_card_slot_device(mconfig, SG1000_CARD_SLOT, tag, owner, clock)
-{
-}
//-------------------------------------------------
// sega8_cart_slot_device - destructor
@@ -231,9 +178,7 @@ static const sega8_slot slot_list[] =
{ SEGA8_MUSIC_EDITOR, "music_editor" },
{ SEGA8_DAHJEE_TYPEA, "dahjee_typea" },
{ SEGA8_DAHJEE_TYPEB, "dahjee_typeb" },
- { SEGA8_SEOJIN, "seojin" },
- { SEGA8_MULTICART, "multicart" },
- { SEGA8_MEGACART, "megacart" }
+ { SEGA8_SEOJIN, "seojin" }
};
static int sega8_get_pcb_id(const char *slot)
@@ -332,7 +277,7 @@ void sega8_cart_slot_device::setup_ram()
m_cart->ram_alloc(0x800);
m_cart->set_has_battery(false);
}
- else if (m_type == SEGA8_BASIC_L3 || m_type == SEGA8_MULTICART || m_type == SEGA8_MEGACART)
+ else if (m_type == SEGA8_BASIC_L3)
{
m_cart->ram_alloc(0x8000);
m_cart->set_has_battery(false);
@@ -639,14 +584,6 @@ int sega8_cart_slot_device::get_cart_type(const uint8_t *ROM, uint32_t len) cons
type = SEGA8_MUSIC_EDITOR;
}
- // SC-3000 Survivors Multicart
- if (len == 0x200000)
- type = SEGA8_MULTICART;
-
- // SC-3000 Survivors Megacart
- if (len == 0x400000)
- type = SEGA8_MEGACART;
-
return type;
}
@@ -701,14 +638,6 @@ READ8_MEMBER(sega8_cart_slot_device::read_ram)
return 0xff;
}
-READ8_MEMBER(sega8_cart_slot_device::read_io)
-{
- if (m_cart)
- return m_cart->read_io(space, offset);
- else
- return 0xff;
-}
-
/*-------------------------------------------------
write
@@ -732,12 +661,6 @@ WRITE8_MEMBER(sega8_cart_slot_device::write_ram)
m_cart->write_ram(space, offset, data);
}
-WRITE8_MEMBER(sega8_cart_slot_device::write_io)
-{
- if (m_cart)
- m_cart->write_io(space, offset, data);
-}
-
/*-------------------------------------------------
Internal header logging
@@ -894,8 +817,6 @@ void sg1000_cart(device_slot_interface &device)
device.option_add_internal("dahjee_typea", SEGA8_ROM_DAHJEE_TYPEA);
device.option_add_internal("dahjee_typeb", SEGA8_ROM_DAHJEE_TYPEB);
device.option_add_internal("cardcatcher", SEGA8_ROM_CARDCATCH);
- device.option_add_internal("multicart", SEGA8_ROM_MULTICART);
- device.option_add_internal("megacart", SEGA8_ROM_MEGACART);
}
void sg1000mk3_cart(device_slot_interface &device)
diff --git a/src/devices/bus/sega8/sega8_slot.h b/src/devices/bus/sega8/sega8_slot.h
index ca3ebdc6172..9b653d4887b 100644
--- a/src/devices/bus/sega8/sega8_slot.h
+++ b/src/devices/bus/sega8/sega8_slot.h
@@ -32,9 +32,7 @@ enum
SEGA8_MUSIC_EDITOR,
SEGA8_DAHJEE_TYPEA,
SEGA8_DAHJEE_TYPEB,
- SEGA8_SEOJIN,
- SEGA8_MULTICART,
- SEGA8_MEGACART
+ SEGA8_SEOJIN
};
@@ -58,9 +56,6 @@ public:
// a few carts (for SG1000) acts as a RAM expansion, taking control of the system RAM in 0xc000-0xffff
virtual DECLARE_READ8_MEMBER(read_ram) { return 0xff; }
virtual DECLARE_WRITE8_MEMBER(write_ram) { }
- // the SC3000 has I/OR, I/OW lines connected
- virtual DECLARE_READ8_MEMBER(read_io) { return 0xff; }
- virtual DECLARE_WRITE8_MEMBER(write_io) { }
void rom_alloc(uint32_t size, const char *tag);
void ram_alloc(uint32_t size);
@@ -131,14 +126,18 @@ public:
void save_ram() { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); }
+ void set_mandatory(bool val) { m_must_be_loaded = val; }
+ void set_intf(const char * interface) { m_interface = interface; }
+ void set_ext(const char * extensions) { m_extensions = extensions; }
+
virtual iodevice_t image_type() const override { return IO_CARTSLOT; }
virtual bool is_readable() const override { return 1; }
virtual bool is_writeable() const override { return 0; }
virtual bool is_creatable() const override { return 0; }
+ virtual bool must_be_loaded() const override { return m_must_be_loaded; }
virtual bool is_reset_on_load() const override { return 1; }
- virtual bool must_be_loaded() const override { return false; }
- virtual const char *image_interface() const override { return "sms_cart"; }
- virtual const char *file_extensions() const override { return "bin"; }
+ virtual const char *image_interface() const override { return m_interface; }
+ virtual const char *file_extensions() const override { return m_extensions; }
// slot interface overrides
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
@@ -149,20 +148,20 @@ public:
virtual DECLARE_WRITE8_MEMBER(write_mapper);
virtual DECLARE_READ8_MEMBER(read_ram);
virtual DECLARE_WRITE8_MEMBER(write_ram);
- virtual DECLARE_READ8_MEMBER(read_io);
- virtual DECLARE_WRITE8_MEMBER(write_io);
int get_lphaser_xoffs() { return m_cart ? m_cart->get_lphaser_xoffs() : -1; }
int get_sms_mode() { return m_cart->get_sms_mode(); }
protected:
- sega8_cart_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool is_card = false);
+ sega8_cart_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool is_card);
// device-level overrides
virtual void device_start() override;
int m_type;
- bool m_is_card;
+ bool m_must_be_loaded, m_is_card;
+ const char *m_interface;
+ const char *m_extensions;
device_sega8_cart_interface* m_cart;
};
@@ -176,188 +175,8 @@ public:
virtual const char *custom_instance_name() const override { return "card"; }
virtual const char *custom_brief_instance_name() const override { return "card"; }
-
-protected:
- // construction/destruction
- sega8_card_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-};
-
-// ======================> sg1000_cart_slot_device
-
-class sg1000_cart_slot_device : public sega8_cart_slot_device
-{
-public:
- // construction/destruction
- template <typename T>
- sg1000_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
- : sg1000_cart_slot_device(mconfig, tag, owner, u32(0))
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- sg1000_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual bool must_be_loaded() const override { return true; }
- virtual const char *image_interface() const override { return "sg1000_cart"; }
- virtual const char *file_extensions() const override { return "bin,sg"; }
-};
-
-// ======================> omv_cart_slot_device
-
-class omv_cart_slot_device : public sega8_cart_slot_device
-{
-public:
- // construction/destruction
- template <typename T>
- omv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
- : omv_cart_slot_device(mconfig, tag, owner, u32(0))
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- omv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual bool must_be_loaded() const override { return false; }
- virtual const char *image_interface() const override { return "sg1000_cart"; }
- virtual const char *file_extensions() const override { return "bin,sg"; }
-};
-
-// ======================> sc3000_cart_slot_device
-
-class sc3000_cart_slot_device : public sega8_cart_slot_device
-{
-public:
- // construction/destruction
- template <typename T>
- sc3000_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
- : sc3000_cart_slot_device(mconfig, tag, owner, u32(0))
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- sc3000_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual bool must_be_loaded() const override { return true; }
- virtual const char *image_interface() const override { return "sg1000_cart"; }
- virtual const char *file_extensions() const override { return "bin,sg,sc"; }
-};
-
-// ======================> sg1000mk3_cart_slot_device
-
-class sg1000mk3_cart_slot_device : public sega8_cart_slot_device
-{
-public:
- // construction/destruction
- template <typename T>
- sg1000mk3_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
- : sg1000mk3_cart_slot_device(mconfig, tag, owner, u32(0))
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- sg1000mk3_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual bool must_be_loaded() const override { return false; }
- virtual const char *image_interface() const override { return "sms_cart,sg1000_cart"; }
- virtual const char *file_extensions() const override { return "bin,sms,sg"; }
};
-// ======================> sms_cart_slot_device
-
-class sms_cart_slot_device : public sega8_cart_slot_device
-{
-public:
- // construction/destruction
- template <typename T>
- sms_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
- : sms_cart_slot_device(mconfig, tag, owner, u32(0))
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- sms_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual bool must_be_loaded() const override { return false; }
- virtual const char *image_interface() const override { return "sms_cart"; }
- virtual const char *file_extensions() const override { return "bin,sms"; }
-};
-
-// ======================> gamegear_cart_slot_device
-
-class gamegear_cart_slot_device : public sega8_cart_slot_device
-{
-public:
- // construction/destruction
- template <typename T>
- gamegear_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
- : gamegear_cart_slot_device(mconfig, tag, owner, u32(0))
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- gamegear_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual bool must_be_loaded() const override { return true; }
- virtual const char *image_interface() const override { return "gamegear_cart"; }
- virtual const char *file_extensions() const override { return "bin,gg"; }
-};
-
-
-// ======================> sms_card_slot_device
-
-class sms_card_slot_device : public sega8_card_slot_device
-{
-public:
- // construction/destruction
- template <typename T>
- sms_card_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
- : sms_card_slot_device(mconfig, tag, owner, u32(0))
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- sms_card_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual bool must_be_loaded() const override { return false; }
- virtual const char *image_interface() const override { return "sms_card"; }
- virtual const char *file_extensions() const override { return "bin"; }
-};
-
-// ======================> sg1000_card_slot_device
-
-class sg1000_card_slot_device : public sega8_card_slot_device
-{
-public:
- // construction/destruction
- template <typename T>
- sg1000_card_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
- : sg1000_card_slot_device(mconfig, tag, owner, u32(0))
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- sg1000_card_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual const char *image_interface() const override { return "sg1000_cart"; }
- virtual const char *file_extensions() const override { return "bin,sg"; }
-};
-
-DECLARE_DEVICE_TYPE(SG1000_CART_SLOT, sg1000_cart_slot_device)
-DECLARE_DEVICE_TYPE(OMV_CART_SLOT, omv_cart_slot_device)
-DECLARE_DEVICE_TYPE(SC3000_CART_SLOT, sc3000_cart_slot_device)
-DECLARE_DEVICE_TYPE(SG1000MK3_CART_SLOT, sg1000mk3_cart_slot_device)
-DECLARE_DEVICE_TYPE(SMS_CART_SLOT, sms_cart_slot_device)
-DECLARE_DEVICE_TYPE(GAMEGEAR_CART_SLOT, gamegear_cart_slot_device)
-DECLARE_DEVICE_TYPE(SMS_CARD_SLOT, sms_card_slot_device)
-DECLARE_DEVICE_TYPE(SG1000_CARD_SLOT, sg1000_card_slot_device)
/***************************************************************************
DEVICE CONFIGURATION MACROS
@@ -366,6 +185,63 @@ DECLARE_DEVICE_TYPE(SG1000_CARD_SLOT, sg1000_card_slot_device)
#define S8SLOT_ROM_REGION_TAG ":cart:rom"
+#define MCFG_SG1000_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, SEGA8_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ static_cast<sega8_cart_slot_device *>(device)->set_mandatory(true); \
+ static_cast<sega8_cart_slot_device *>(device)->set_intf("sg1000_cart"); \
+ static_cast<sega8_cart_slot_device *>(device)->set_ext("bin,sg");
+
+#define MCFG_OMV_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, SEGA8_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ static_cast<sega8_cart_slot_device *>(device)->set_mandatory(false); \
+ static_cast<sega8_cart_slot_device *>(device)->set_intf("sg1000_cart"); \
+ static_cast<sega8_cart_slot_device *>(device)->set_ext("bin,sg");
+
+#define MCFG_SC3000_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, SEGA8_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ static_cast<sega8_cart_slot_device *>(device)->set_mandatory(true); \
+ static_cast<sega8_cart_slot_device *>(device)->set_intf("sg1000_cart"); \
+ static_cast<sega8_cart_slot_device *>(device)->set_ext("bin,sg,sc");
+
+#define MCFG_SG1000MK3_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, SEGA8_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ static_cast<sega8_cart_slot_device *>(device)->set_mandatory(false); \
+ static_cast<sega8_cart_slot_device *>(device)->set_intf("sms_cart,sg1000_cart"); \
+ static_cast<sega8_cart_slot_device *>(device)->set_ext("bin,sms,sg");
+
+#define MCFG_SMS_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, SEGA8_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ static_cast<sega8_cart_slot_device *>(device)->set_mandatory(false); \
+ static_cast<sega8_cart_slot_device *>(device)->set_intf("sms_cart"); \
+ static_cast<sega8_cart_slot_device *>(device)->set_ext("bin,sms");
+
+#define MCFG_GG_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, SEGA8_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ static_cast<sega8_cart_slot_device *>(device)->set_mandatory(true); \
+ static_cast<sega8_cart_slot_device *>(device)->set_intf("gamegear_cart"); \
+ static_cast<sega8_cart_slot_device *>(device)->set_ext("bin,gg");
+
+
+
+#define MCFG_SMS_CARD_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, SEGA8_CARD_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ static_cast<sega8_card_slot_device *>(device)->set_mandatory(false); \
+ static_cast<sega8_card_slot_device *>(device)->set_intf("sms_card"); \
+ static_cast<sega8_card_slot_device *>(device)->set_ext("bin");
+#define MCFG_SG1000_CARD_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, SEGA8_CARD_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ static_cast<sega8_card_slot_device *>(device)->set_intf("sg1000_cart"); \
+ static_cast<sega8_card_slot_device *>(device)->set_ext("bin,sg");
+
+
// slot interfaces
void sg1000_cart(device_slot_interface &device);
void sg1000mk3_cart(device_slot_interface &device);
diff --git a/src/devices/bus/sg1000_exp/fm_unit.cpp b/src/devices/bus/sg1000_exp/fm_unit.cpp
index a7bdc4bcc5d..ab759994f30 100644
--- a/src/devices/bus/sg1000_exp/fm_unit.cpp
+++ b/src/devices/bus/sg1000_exp/fm_unit.cpp
@@ -50,13 +50,12 @@ SMS version is not playing PSG sound on his Mark III with the FM unit.
DEFINE_DEVICE_TYPE(SEGA_FM_UNIT, sega_fm_unit_device, "sega_fm_unit", "SG-1000 FM Sound Unit")
-void sega_fm_unit_device::device_add_mconfig(machine_config &config)
-{
- YM2413(config, m_ym, XTAL(10'738'635)/3);
+MACHINE_CONFIG_START(sega_fm_unit_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("ym2413", YM2413, XTAL(10'738'635)/3)
// if this output gain is changed, the gain set when unmute the output need
// to be changed too, probably along the gain set for SMSJ/SMSKRFM drivers.
- m_ym->add_route(ALL_OUTPUTS, ":mono", 1.00);
-}
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":mono", 1.00)
+MACHINE_CONFIG_END
//**************************************************************************
@@ -123,10 +122,10 @@ WRITE8_MEMBER(sega_fm_unit_device::peripheral_w)
switch (offset)
{
case 0: // register port
- m_ym->write(0, data & 0x3f);
+ m_ym->write(space, 0, data & 0x3f);
break;
case 1: // data port
- m_ym->write(1, data);
+ m_ym->write(space, 1, data);
break;
case 2: // control port
case 3: // mirror
diff --git a/src/devices/bus/sg1000_exp/kblink.cpp b/src/devices/bus/sg1000_exp/kblink.cpp
deleted file mode 100644
index 039c7f91196..00000000000
--- a/src/devices/bus/sg1000_exp/kblink.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Enik Land
-/**********************************************************************
-
- Sega SK-1100 keyboard link cable emulation
-
-The cable is used only to link two Mark III's through keyboard, what
-is supported by the game F-16 Fighting Falcon for its 2 players mode.
-
-Keyboard link cable info (originally from http://homepage3.nifty.com/st-2/,
-but taken from http://www.smspower.org/Games/F16FightingFalcon-SMS-Talk):
-
-- Cable is 7-pin DIN.
-- Crossover scheme of the cable to connect pins
-
- From To
- 1 1
- 2 6
- 3 3
- 4 5
- 5 4
- 6 2
- 7 7
-
-Pinout of the printer port (from Charles MacDonald's sc3000h-20040729.txt
-document, with the function of pin 6 corrected to /FAULT).
-Numbering in counterclockwise/anticlockwise direction:
-
- 1 : Unused (not connected to anything)
- 2 : PPI PC5 (DATA output)
- 3 : PPI PC7 (/FEED output)
- 4 : PPI PB6 (BUSY input)
- 5 : PPI PC6 (/RESET output)
- 6 : PPI PB5 (/FAULT input)
- 7 : GND
-
-**********************************************************************/
-
-#include "emu.h"
-#include "kblink.h"
-
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(SK1100_LINK_CABLE, sk1100_link_cable_device, "sk1100_link_cable", "SK-1100 Link Cable")
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// sk1100_link_cable_device - constructor
-//-------------------------------------------------
-
-sk1100_link_cable_device::sk1100_link_cable_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- device_t(mconfig, SK1100_LINK_CABLE, tag, owner, clock),
- device_sk1100_printer_port_interface(mconfig, *this),
- m_stream(*this, "stream"),
- m_input_count(0),
- m_input_index(0),
- m_timer_poll(nullptr),
- m_timer_send(nullptr),
- m_timer_read(nullptr),
- m_update_received_data(true),
- m_data(0),
- m_reset(0),
- m_feed(0),
- m_busy(0),
- m_fault(0)
-{
-}
-
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void sk1100_link_cable_device::device_start()
-{
- m_timer_poll = timer_alloc(TIMER_POLL);
- m_timer_send = timer_alloc(TIMER_SEND);
- m_timer_read = timer_alloc(TIMER_READ);
-
- /* register for state saving */
- save_item(NAME(m_data));
- save_item(NAME(m_reset));
- save_item(NAME(m_feed));
- save_item(NAME(m_busy));
- save_item(NAME(m_fault));
- save_item(NAME(m_update_received_data));
- save_item(NAME(m_input_count));
- save_item(NAME(m_input_index));
- save_pointer(NAME(m_input_buffer), sizeof(m_input_buffer));
-}
-
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void sk1100_link_cable_device::device_reset()
-{
- queue();
-}
-
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void sk1100_link_cable_device::device_add_mconfig(machine_config &config)
-{
- BITBANGER(config, m_stream, 0);
-}
-
-
-void sk1100_link_cable_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- switch (id)
- {
- case TIMER_POLL:
- queue();
- break;
-
- case TIMER_SEND:
- m_stream->output(u8(param));
- break;
-
- case TIMER_READ:
- m_update_received_data = true;
- break;
-
- default:
- break;
- }
-}
-
-void sk1100_link_cable_device::queue()
-{
- if (m_input_index == m_input_count)
- {
- m_input_index = 0;
- m_input_count = m_stream->input(m_input_buffer, sizeof(m_input_buffer));
- if (!m_input_count)
- {
- m_timer_poll->adjust(attotime::from_hz(XTAL(10'738'635)/3));
- }
- }
-}
-
-void sk1100_link_cable_device::set_data_read()
-{
- // Check if a new byte from the input buffer was read for this timeslice.
- if (m_update_received_data == true)
- {
- if (m_input_count != 0)
- {
- u8 byte = m_input_buffer[m_input_index++];
- // there is no way to read what was sent from peer as feed bit.
- m_fault = BIT(byte, 0); // sent from peer as data bit
- m_busy = BIT(byte, 1); // sent from peer as reset bit
- queue();
- }
- // Set to read next byte only after the end of this timeslice.
- m_update_received_data = false;
- m_timer_read->adjust(attotime::zero);
- }
-}
-
-void sk1100_link_cable_device::set_data_transfer()
-{
- u8 byte = (m_feed << 2) | (m_reset << 1) | m_data;
- m_timer_send->adjust(attotime::zero, byte);
-}
-
-
diff --git a/src/devices/bus/sg1000_exp/kblink.h b/src/devices/bus/sg1000_exp/kblink.h
deleted file mode 100644
index 65e5782f4a2..00000000000
--- a/src/devices/bus/sg1000_exp/kblink.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Enik Land
-/**********************************************************************
-
- Sega SK-1100 keyboard link cable emulation
-
-The cable is used only to link two Mark III's through keyboard, what
-is supported by the game F-16 Fighting Falcon for its 2 players mode.
-
-**********************************************************************/
-
-#ifndef MAME_BUS_SG1000_EXP_SK1100_KBLINK_H
-#define MAME_BUS_SG1000_EXP_SK1100_KBLINK_H
-
-#pragma once
-
-
-#include "sk1100prn.h"
-#include "imagedev/bitbngr.h"
-
-
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> sk1100_link_cable_device
-
-class sk1100_link_cable_device : public device_t,
- public device_sk1100_printer_port_interface
-{
-public:
- // construction/destruction
- sk1100_link_cable_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- virtual void device_add_mconfig(machine_config &config) override;
-
- // device_sk1100_link_cable_interface overrides
-
- virtual DECLARE_WRITE_LINE_MEMBER( input_data ) override { m_data = state; set_data_transfer(); }
- virtual DECLARE_WRITE_LINE_MEMBER( input_reset ) override { m_reset = state; set_data_transfer(); }
- virtual DECLARE_WRITE_LINE_MEMBER( input_feed ) override { m_feed = state; set_data_transfer(); }
-
- virtual DECLARE_READ_LINE_MEMBER( output_fault ) override { set_data_read(); return m_fault; }
- virtual DECLARE_READ_LINE_MEMBER( output_busy ) override { set_data_read(); return m_busy; }
-
-private:
- static constexpr int TIMER_POLL = 1;
- static constexpr int TIMER_SEND = 2;
- static constexpr int TIMER_READ = 3;
-
- void queue();
- void set_data_transfer();
- void set_data_read();
-
- required_device<bitbanger_device> m_stream;
-
- u8 m_input_buffer[1000];
- u32 m_input_count;
- u32 m_input_index;
- emu_timer *m_timer_poll;
- emu_timer *m_timer_send;
- emu_timer *m_timer_read;
- bool m_update_received_data;
- int m_data;
- int m_reset;
- int m_feed;
- int m_busy;
- int m_fault;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(SK1100_LINK_CABLE, sk1100_link_cable_device)
-
-
-#endif // MAME_BUS_SG1000_EXP_SK1100_KBLINK_H
diff --git a/src/devices/bus/sg1000_exp/sg1000exp.h b/src/devices/bus/sg1000_exp/sg1000exp.h
index c132b48d9dd..9a21c263407 100644
--- a/src/devices/bus/sg1000_exp/sg1000exp.h
+++ b/src/devices/bus/sg1000_exp/sg1000exp.h
@@ -15,6 +15,20 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_SG1000_EXPANSION_ADD(_tag, _slot_intf, _def_slot, _fixed) \
+ MCFG_DEVICE_ADD(_tag, SG1000_EXPANSION_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed)
+#define MCFG_SG1000_EXPANSION_MODIFY(_tag) \
+ MCFG_DEVICE_MODIFY(_tag)
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -27,17 +41,7 @@ class sg1000_expansion_slot_device : public device_t, public device_slot_interfa
{
public:
// construction/destruction
- template <typename T>
- sg1000_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt, bool const fixed)
- : sg1000_expansion_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(fixed);
- }
-
- sg1000_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ sg1000_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~sg1000_expansion_slot_device();
DECLARE_READ8_MEMBER(read);
diff --git a/src/devices/bus/sg1000_exp/sk1100.cpp b/src/devices/bus/sg1000_exp/sk1100.cpp
index 1bb0a01adfd..e23fe34caed 100644
--- a/src/devices/bus/sg1000_exp/sk1100.cpp
+++ b/src/devices/bus/sg1000_exp/sk1100.cpp
@@ -12,6 +12,7 @@ Release data from the Sega Retro project:
TODO:
- SP-400 serial printer
+- Link between two Mark III's through keyboard, supported by F-16 Fighting Falcon
**********************************************************************/
@@ -109,23 +110,23 @@ static INPUT_PORTS_START( sk1100_keys )
PORT_START("PB0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
- PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("PB1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
- PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("PB2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
- PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("PB3")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
- PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("PB4")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('^')
- PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("PB5")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xa5") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x00a5)
@@ -153,25 +154,24 @@ ioport_constructor sega_sk1100_device::device_input_ports() const
}
-void sega_sk1100_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(sega_sk1100_device::device_add_mconfig)
/* devices */
I8255(config, m_ppi);
m_ppi->in_pa_callback().set(FUNC(sega_sk1100_device::ppi_pa_r));
m_ppi->in_pb_callback().set(FUNC(sega_sk1100_device::ppi_pb_r));
m_ppi->out_pc_callback().set(FUNC(sega_sk1100_device::ppi_pc_w));
- CASSETTE(config, m_cassette);
- m_cassette->set_formats(sc3000_cassette_formats);
- m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED);
- m_cassette->set_interface("sc3000_cass");
+// MCFG_PRINTER_ADD("sp400") /* serial printer */
- SK1100_PRINTER_PORT(config, m_printer_port, sk1100_printer_port_devices, nullptr);
+ MCFG_CASSETTE_ADD("cassette")
+ MCFG_CASSETTE_FORMATS(sc3000_cassette_formats)
+ MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
+ MCFG_CASSETTE_INTERFACE("sc3000_cass")
/* software lists */
- SOFTWARE_LIST(config, "sc3k_cart_list").set_original("sc3000_cart");
- SOFTWARE_LIST(config, "cass_list").set_original("sc3000_cass");
-}
+ MCFG_SOFTWARE_LIST_ADD("sc3k_cart_list","sc3000_cart")
+ MCFG_SOFTWARE_LIST_ADD("cass_list","sc3000_cass")
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
@@ -186,7 +186,6 @@ sega_sk1100_device::sega_sk1100_device(const machine_config &mconfig, const char
device_sg1000_expansion_slot_interface(mconfig, *this),
m_cassette(*this, "cassette"),
m_ppi(*this, UPD9255_0_TAG),
- m_printer_port(*this, "printer"),
m_pa(*this, {"PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7"}),
m_pb(*this, {"PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7"}),
m_keylatch(0)
@@ -263,7 +262,7 @@ READ8_MEMBER( sega_sk1100_device::ppi_pb_r )
PB2 Keyboard input
PB3 Keyboard input
PB4 /CONT input from cartridge terminal B-11
- PB5 /FAULT input from printer
+ PB5 FAULT input from printer
PB6 BUSY input from printer
PB7 Cassette tape input
*/
@@ -274,9 +273,8 @@ READ8_MEMBER( sega_sk1100_device::ppi_pb_r )
/* cartridge contact */
data |= 0x10;
- /* printer port */
- data |= m_printer_port->fault_r() << 5;
- data |= m_printer_port->busy_r() << 6;
+ /* printer */
+ data |= 0x60;
/* tape input */
if (m_cassette->input() > +0.0) data |= 0x80;
@@ -303,10 +301,7 @@ WRITE8_MEMBER( sega_sk1100_device::ppi_pc_w )
m_keylatch = data & 0x07;
/* cassette */
- m_cassette->output(BIT(data, 4) ? +1.0 : -1.0);
+ m_cassette->output( BIT(data, 4) ? +1.0 : -1.0);
- /* printer port */
- m_printer_port->data_w(BIT(data, 5));
- m_printer_port->reset_w(BIT(data, 6));
- m_printer_port->feed_w(BIT(data, 7));
+ /* TODO printer */
}
diff --git a/src/devices/bus/sg1000_exp/sk1100.h b/src/devices/bus/sg1000_exp/sk1100.h
index 13ff5780f64..4845fe09e1c 100644
--- a/src/devices/bus/sg1000_exp/sk1100.h
+++ b/src/devices/bus/sg1000_exp/sk1100.h
@@ -13,9 +13,9 @@
#include "sg1000exp.h"
-#include "sk1100prn.h"
#include "formats/sc3000_bit.h"
#include "imagedev/cassette.h"
+#include "imagedev/printer.h"
#include "machine/i8255.h"
@@ -55,7 +55,6 @@ private:
required_device<cassette_image_device> m_cassette;
required_device<i8255_device> m_ppi;
- required_device<sk1100_printer_port_device> m_printer_port;
required_ioport_array<8> m_pa;
required_ioport_array<8> m_pb;
diff --git a/src/devices/bus/sg1000_exp/sk1100prn.cpp b/src/devices/bus/sg1000_exp/sk1100prn.cpp
deleted file mode 100644
index b902ce3992f..00000000000
--- a/src/devices/bus/sg1000_exp/sk1100prn.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Enik Land
-/**********************************************************************
-
- Sega SK-1100 keyboard printer port emulation
-
-**********************************************************************/
-
-#include "emu.h"
-#include "sk1100prn.h"
-// slot devices
-//#include "sp400.h"
-#include "kblink.h"
-
-
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(SK1100_PRINTER_PORT, sk1100_printer_port_device, "sk1100_printer_port", "Sega SK-1100 Printer Port")
-
-
-
-//**************************************************************************
-// CARD INTERFACE
-//**************************************************************************
-
-//-------------------------------------------------
-// device_sk1100_printer_port_interface - constructor
-//-------------------------------------------------
-
-device_sk1100_printer_port_interface::device_sk1100_printer_port_interface(const machine_config &mconfig, device_t &device)
- : device_slot_card_interface(mconfig,device)
-{
-}
-
-
-//-------------------------------------------------
-// ~device_sk1100_printer_port_interface - destructor
-//-------------------------------------------------
-
-device_sk1100_printer_port_interface::~device_sk1100_printer_port_interface()
-{
-}
-
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// sk1100_printer_port_device - constructor
-//-------------------------------------------------
-
-sk1100_printer_port_device::sk1100_printer_port_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- device_t(mconfig, SK1100_PRINTER_PORT, tag, owner, clock),
- device_slot_interface(mconfig, *this),
- m_device(nullptr)
-{
-}
-
-
-//-------------------------------------------------
-// sk1100_printer_port_device - destructor
-//-------------------------------------------------
-
-sk1100_printer_port_device::~sk1100_printer_port_device()
-{
-}
-
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void sk1100_printer_port_device::device_start()
-{
- m_device = dynamic_cast<device_sk1100_printer_port_interface *>(get_card_device());
-}
-
-WRITE_LINE_MEMBER(sk1100_printer_port_device::data_w)
-{
- if (m_device)
- m_device->input_data(state);
-}
-
-WRITE_LINE_MEMBER(sk1100_printer_port_device::reset_w)
-{
- if (m_device)
- m_device->input_reset(state);
-}
-
-WRITE_LINE_MEMBER(sk1100_printer_port_device::feed_w)
-{
- if (m_device)
- m_device->input_feed(state);
-}
-
-READ_LINE_MEMBER(sk1100_printer_port_device::fault_r)
-{
- if (m_device)
- return m_device->output_fault();
- else
- return 1;
-}
-
-READ_LINE_MEMBER(sk1100_printer_port_device::busy_r)
-{
- if (m_device)
- return m_device->output_busy();
- else
- return 1;
-}
-
-//-------------------------------------------------
-// SLOT_INTERFACE( sk1100_printer_port_devices )
-//-------------------------------------------------
-
-void sk1100_printer_port_devices(device_slot_interface &device)
-{
- //device.option_add("sp400", SP400_PRINTER); /* serial printer */
- device.option_add("kblink", SK1100_LINK_CABLE);
-}
diff --git a/src/devices/bus/sg1000_exp/sk1100prn.h b/src/devices/bus/sg1000_exp/sk1100prn.h
deleted file mode 100644
index b926f311f29..00000000000
--- a/src/devices/bus/sg1000_exp/sk1100prn.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Enik Land
-/**********************************************************************
-
- Sega SK-1100 keyboard printer port emulation
-
-**********************************************************************
-
-
-**********************************************************************/
-
-#ifndef MAME_BUS_SG1000_EXP_SK1100_PRN_H
-#define MAME_BUS_SG1000_EXP_SK1100_PRN_H
-
-#pragma once
-
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> sk1100_printer_port_device
-
-class device_sk1100_printer_port_interface;
-
-class sk1100_printer_port_device : public device_t, public device_slot_interface
-{
-public:
- // construction/destruction
- template <typename T>
- sk1100_printer_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : sk1100_printer_port_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- sk1100_printer_port_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
- virtual ~sk1100_printer_port_device();
-
- DECLARE_READ_LINE_MEMBER(fault_r);
- DECLARE_READ_LINE_MEMBER(busy_r);
-
- DECLARE_WRITE_LINE_MEMBER(data_w);
- DECLARE_WRITE_LINE_MEMBER(reset_w);
- DECLARE_WRITE_LINE_MEMBER(feed_w);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
-
-private:
- device_sk1100_printer_port_interface *m_device;
-};
-
-
-// ======================> device_sk1100_printer_port_interface
-
-// class representing interface-specific live sk1100_printer_port peripheral
-class device_sk1100_printer_port_interface : public device_slot_card_interface
-{
- friend class sk1100_printer_port_device;
-public:
- // construction/destruction
- virtual ~device_sk1100_printer_port_interface();
-
-protected:
- device_sk1100_printer_port_interface(const machine_config &mconfig, device_t &device);
-
- virtual DECLARE_WRITE_LINE_MEMBER( input_data ) { }
- virtual DECLARE_WRITE_LINE_MEMBER( input_reset ) { }
- virtual DECLARE_WRITE_LINE_MEMBER( input_feed ) { }
-
- virtual DECLARE_READ_LINE_MEMBER( output_fault ) { return 1; }
- virtual DECLARE_READ_LINE_MEMBER( output_busy ) { return 1; }
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(SK1100_PRINTER_PORT, sk1100_printer_port_device)
-
-
-void sk1100_printer_port_devices(device_slot_interface &device);
-
-
-#endif // MAME_BUS_SG1000_EXP_SK1100_PRN_H
diff --git a/src/devices/bus/sms_ctrl/multitap.cpp b/src/devices/bus/sms_ctrl/multitap.cpp
index 88dbe01acf4..56e7144cbd5 100644
--- a/src/devices/bus/sms_ctrl/multitap.cpp
+++ b/src/devices/bus/sms_ctrl/multitap.cpp
@@ -129,16 +129,15 @@ READ32_MEMBER( sms_multitap_device::pixel_r )
}
-void sms_multitap_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(sms_multitap_device::device_add_mconfig)
// Controller subports setup, without the TH callback declaration,
// because the circuit scheme shows TH of subports without connection.
- SMS_CONTROL_PORT(config, m_subctrl1_port, sms_control_port_devices, "joypad");
- m_subctrl1_port->pixel_handler().set(FUNC(sms_multitap_device::pixel_r));
- SMS_CONTROL_PORT(config, m_subctrl2_port, sms_control_port_devices, "joypad");
- m_subctrl2_port->pixel_handler().set(FUNC(sms_multitap_device::pixel_r));
- SMS_CONTROL_PORT(config, m_subctrl3_port, sms_control_port_devices, "joypad");
- m_subctrl3_port->pixel_handler().set(FUNC(sms_multitap_device::pixel_r));
- SMS_CONTROL_PORT(config, m_subctrl4_port, sms_control_port_devices, "joypad");
- m_subctrl4_port->pixel_handler().set(FUNC(sms_multitap_device::pixel_r));
-}
+ MCFG_SMS_CONTROL_PORT_ADD("ctrl1", sms_control_port_devices, "joypad")
+ MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_multitap_device, pixel_r))
+ MCFG_SMS_CONTROL_PORT_ADD("ctrl2", sms_control_port_devices, "joypad")
+ MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_multitap_device, pixel_r))
+ MCFG_SMS_CONTROL_PORT_ADD("ctrl3", sms_control_port_devices, "joypad")
+ MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_multitap_device, pixel_r))
+ MCFG_SMS_CONTROL_PORT_ADD("ctrl4", sms_control_port_devices, "joypad")
+ MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_multitap_device, pixel_r))
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/sms_ctrl/rfu.cpp b/src/devices/bus/sms_ctrl/rfu.cpp
index 36a081abcd1..7b51da5983a 100644
--- a/src/devices/bus/sms_ctrl/rfu.cpp
+++ b/src/devices/bus/sms_ctrl/rfu.cpp
@@ -138,9 +138,8 @@ READ32_MEMBER( sms_rapid_fire_device::pixel_r )
}
-void sms_rapid_fire_device::device_add_mconfig(machine_config &config)
-{
- SMS_CONTROL_PORT(config, m_subctrl_port, sms_control_port_devices, "joypad");
- m_subctrl_port->th_input_handler().set(FUNC(sms_rapid_fire_device::th_pin_w));
- m_subctrl_port->pixel_handler().set(FUNC(sms_rapid_fire_device::pixel_r));
-}
+MACHINE_CONFIG_START(sms_rapid_fire_device::device_add_mconfig)
+ MCFG_SMS_CONTROL_PORT_ADD("ctrl", sms_control_port_devices, "joypad")
+ MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(*this, sms_rapid_fire_device, th_pin_w))
+ MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_rapid_fire_device, pixel_r))
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/sms_ctrl/smsctrl.h b/src/devices/bus/sms_ctrl/smsctrl.h
index 3d11b4e60bd..d116f2c769d 100644
--- a/src/devices/bus/sms_ctrl/smsctrl.h
+++ b/src/devices/bus/sms_ctrl/smsctrl.h
@@ -16,6 +16,26 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_SMS_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, SMS_CONTROL_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+#define MCFG_SMS_CONTROL_PORT_MODIFY(_tag) \
+ MCFG_DEVICE_MODIFY(_tag)
+
+
+#define MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(_devcb) \
+ downcast<sms_control_port_device &>(*device).set_th_input_handler(DEVCB_##_devcb);
+
+
+#define MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(_devcb) \
+ downcast<sms_control_port_device &>(*device).set_pixel_handler(DEVCB_##_devcb);
+
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -28,23 +48,13 @@ class sms_control_port_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- sms_control_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : sms_control_port_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
sms_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~sms_control_port_device();
// static configuration helpers
- auto th_input_handler() { return m_th_pin_handler.bind(); }
+ template <class Object> devcb_base &set_th_input_handler(Object &&cb) { return m_th_pin_handler.set_callback(std::forward<Object>(cb)); }
- auto pixel_handler() { return m_pixel_handler.bind(); }
+ template <class Object> devcb_base &set_pixel_handler(Object &&cb) { return m_pixel_handler.set_callback(std::forward<Object>(cb)); }
// Physical DE-9 connector interface
diff --git a/src/devices/bus/sms_exp/gender.cpp b/src/devices/bus/sms_exp/gender.cpp
index 227aae8a1da..b6279fb8dff 100644
--- a/src/devices/bus/sms_exp/gender.cpp
+++ b/src/devices/bus/sms_exp/gender.cpp
@@ -95,7 +95,6 @@ WRITE8_MEMBER(sms_gender_adapter_device::write_ram)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void sms_gender_adapter_device::device_add_mconfig(machine_config &config)
-{
- SMS_CART_SLOT(config, "subslot", sms_cart, nullptr);
-}
+MACHINE_CONFIG_START(sms_gender_adapter_device::device_add_mconfig)
+ MCFG_SMS_CARTRIDGE_ADD("subslot", sms_cart, nullptr)
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/sms_exp/smsexp.h b/src/devices/bus/sms_exp/smsexp.h
index 6933b9a9df8..b53027af51e 100644
--- a/src/devices/bus/sms_exp/smsexp.h
+++ b/src/devices/bus/sms_exp/smsexp.h
@@ -15,6 +15,18 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_SMS_EXPANSION_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, SMS_EXPANSION_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -49,16 +61,7 @@ class sms_expansion_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- sms_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : sms_expansion_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- sms_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ sms_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~sms_expansion_slot_device();
// reading and writing
diff --git a/src/devices/bus/snes/bsx.cpp b/src/devices/bus/snes/bsx.cpp
index 6aacaa3ed2c..1f6efc1af6c 100644
--- a/src/devices/bus/snes/bsx.cpp
+++ b/src/devices/bus/snes/bsx.cpp
@@ -283,13 +283,13 @@ void sns_rom_bsx_device::access_update()
}
}
-uint8_t sns_rom_bsx_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom_bsx_device::read_l)
{
if (offset < 0x200000 && access_00_1f)
{
// 0x00-0x1f:0x8000-0xffff -> CART
if (m_slot->m_cart && m_slot->m_cart->get_rom_size())
- return m_slot->m_cart->read_l(offset);
+ return m_slot->m_cart->read_l(space, offset);
}
if (offset >= 0x200000 && offset < 0x400000)
{
@@ -334,13 +334,13 @@ uint8_t sns_rom_bsx_device::read_l(offs_t offset)
}
-uint8_t sns_rom_bsx_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom_bsx_device::read_h)
{
if (offset < 0x200000 && access_80_9f)
{
// 0x80-0x9f:0x8000-0xffff -> CART
if (m_slot->m_cart && m_slot->m_cart->get_rom_size())
- return m_slot->m_cart->read_l(offset);
+ return m_slot->m_cart->read_l(space, offset);
}
// if not in any of the cases above...
@@ -358,7 +358,7 @@ uint8_t sns_rom_bsx_device::read_h(offs_t offset)
//return 0x00;
}
-void sns_rom_bsx_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_rom_bsx_device::write_l)
{
if (offset < 0x200000 && access_00_1f)
{
@@ -400,7 +400,7 @@ void sns_rom_bsx_device::write_l(offs_t offset, uint8_t data)
}
-void sns_rom_bsx_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_rom_bsx_device::write_h)
{
if (offset < 0x200000 && access_80_9f)
{
@@ -416,7 +416,7 @@ void sns_rom_bsx_device::write_h(offs_t offset, uint8_t data)
}
-uint8_t sns_rom_bsx_device::chip_read(offs_t offset)
+READ8_MEMBER(sns_rom_bsx_device::chip_read)
{
if ((offset & 0xffff) >= 0x2188 && (offset & 0xffff) < 0x21a0)
return m_base_unit->read(offset & 0xffff);
@@ -435,7 +435,7 @@ uint8_t sns_rom_bsx_device::chip_read(offs_t offset)
return 0x00;
}
-void sns_rom_bsx_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_rom_bsx_device::chip_write)
{
if ((offset & 0xffff) >= 0x2188 && (offset & 0xffff) < 0x21a0)
m_base_unit->write(offset & 0xffff, data);
@@ -457,7 +457,7 @@ void sns_rom_bsx_device::chip_write(offs_t offset, uint8_t data)
// LoROM cart w/BS-X slot
-uint8_t sns_rom_bsxlo_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom_bsxlo_device::read_l)
{
if (offset < 0x400000)
{
@@ -469,7 +469,7 @@ uint8_t sns_rom_bsxlo_device::read_l(offs_t offset)
return 0x00;
}
-uint8_t sns_rom_bsxlo_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom_bsxlo_device::read_h)
{
if (offset < 0x400000)
{
@@ -481,7 +481,7 @@ uint8_t sns_rom_bsxlo_device::read_h(offs_t offset)
else if (offset < 0x700000)
{
if (m_slot->m_cart && m_slot->m_cart->get_rom_size())
- return m_slot->m_cart->read_h(offset);
+ return m_slot->m_cart->read_h(space, offset);
}
// RAM [70-7f]
return 0x00;
@@ -490,12 +490,12 @@ uint8_t sns_rom_bsxlo_device::read_h(offs_t offset)
// HiROM cart w/BS-X slot
-uint8_t sns_rom_bsxhi_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom_bsxhi_device::read_l)
{
- return read_h(offset);
+ return read_h(space, offset);
}
-uint8_t sns_rom_bsxhi_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom_bsxhi_device::read_h)
{
if (offset < 0x200000 && (offset & 0xffff) >= 0x8000)
{
@@ -505,7 +505,7 @@ uint8_t sns_rom_bsxhi_device::read_h(offs_t offset)
if (offset >= 0x200000 && offset < 0x400000)
{
if (m_slot->m_cart && m_slot->m_cart->get_rom_size() && (offset & 0xffff) >= 0x8000)
- return m_slot->m_cart->read_h(offset);
+ return m_slot->m_cart->read_h(space, offset);
}
if (offset >= 0x400000 && offset < 0x600000)
{
@@ -516,7 +516,7 @@ uint8_t sns_rom_bsxhi_device::read_h(offs_t offset)
if (offset >= 0x600000)
{
if (m_slot->m_cart && m_slot->m_cart->get_rom_size())
- return m_slot->m_cart->read_h(offset);
+ return m_slot->m_cart->read_h(space, offset);
}
return 0xff;
}
@@ -530,18 +530,18 @@ uint8_t sns_rom_bsxhi_device::read_h(offs_t offset)
// Hence, we use low read handler for ROM access in the 0x8000-0xffff range (i.e. mempack mapped as LoROM) and
// hi read handler for ROM access in the 0x0000-0xffff range (i.e. mempack mapped as HiROM)...
-uint8_t sns_rom_bsmempak_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom_bsmempak_device::read_l)
{
int bank = offset / 0x10000;
return m_rom[rom_bank_map[bank] * 0x8000 + (offset & 0x7fff)];
}
-uint8_t sns_rom_bsmempak_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom_bsmempak_device::read_h)
{
int bank = offset / 0x8000;
return m_rom[rom_bank_map[bank] * 0x8000 + (offset & 0x7fff)];
}
-void sns_rom_bsmempak_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_rom_bsmempak_device::write_l)
{
}
diff --git a/src/devices/bus/snes/bsx.h b/src/devices/bus/snes/bsx.h
index e144ff118ff..24ce7b9f691 100644
--- a/src/devices/bus/snes/bsx.h
+++ b/src/devices/bus/snes/bsx.h
@@ -18,12 +18,12 @@ public:
sns_rom_bsx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// additional reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
+ virtual DECLARE_READ8_MEMBER(chip_read) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override;
protected:
class bsx_base
@@ -84,8 +84,8 @@ public:
sns_rom_bsxlo_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// additional reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
protected:
// device-level overrides
@@ -106,8 +106,8 @@ public:
sns_rom_bsxhi_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// additional reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
protected:
// device-level overrides
@@ -129,12 +129,12 @@ public:
sns_rom_bsmempak_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// additional reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
-// virtual void write_h(offs_t offset, uint8_t data) override;
-// virtual uint8_t chip_read(offs_t offset) override;
-// virtual void chip_write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+// virtual DECLARE_WRITE8_MEMBER(write_h);
+// virtual DECLARE_READ8_MEMBER(chip_read);
+// virtual DECLARE_WRITE8_MEMBER(chip_write);
protected:
// device-level overrides
diff --git a/src/devices/bus/snes/event.cpp b/src/devices/bus/snes/event.cpp
index 3591a2a679a..7131807edab 100644
--- a/src/devices/bus/snes/event.cpp
+++ b/src/devices/bus/snes/event.cpp
@@ -60,7 +60,7 @@ void sns_pfest94_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-uint8_t sns_pfest94_device::read_l(offs_t offset)
+READ8_MEMBER(sns_pfest94_device::read_l)
{
// menu
if ((offset & 0x208000) == 0x208000)
@@ -77,7 +77,7 @@ uint8_t sns_pfest94_device::read_l(offs_t offset)
}
}
-uint8_t sns_pfest94_device::read_h(offs_t offset)
+READ8_MEMBER(sns_pfest94_device::read_h)
{
// menu
if ((offset & 0x208000) == 0x208000)
@@ -103,7 +103,7 @@ uint8_t sns_pfest94_device::read_h(offs_t offset)
// these are used for two diff effects: both to select game from menu and to access the DSP when running SMK!
-uint8_t sns_pfest94_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_pfest94_device::chip_read )
{
if (offset & 0x8000)
{
@@ -119,7 +119,7 @@ uint8_t sns_pfest94_device::chip_read(offs_t offset)
}
-void sns_pfest94_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_pfest94_device::chip_write )
{
if (offset & 0x8000)
{
@@ -186,12 +186,12 @@ void sns_pfest94_device::speedup_addon_bios_access()
// DSP dump contains prg at offset 0 and data at offset 0x2000
-uint32_t sns_pfest94_device::necdsp_prg_r(offs_t offset)
+READ32_MEMBER( sns_pfest94_device::necdsp_prg_r )
{
return get_prg(&m_bios[0], offset);
}
-uint16_t sns_pfest94_device::necdsp_data_r(offs_t offset)
+READ16_MEMBER( sns_pfest94_device::necdsp_data_r )
{
return get_data(&m_bios[0], offset + 0x2000/2);
}
@@ -221,12 +221,11 @@ void sns_pfest94_device::dsp_data_map_lorom(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void sns_pfest94_device::device_add_mconfig(machine_config &config)
-{
- UPD7725(config, m_upd7725, 8000000);
- m_upd7725->set_addrmap(AS_PROGRAM, &sns_pfest94_device::dsp_prg_map_lorom);
- m_upd7725->set_addrmap(AS_DATA, &sns_pfest94_device::dsp_data_map_lorom);
-}
+MACHINE_CONFIG_START(sns_pfest94_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dsp", UPD7725, 8000000)
+ MCFG_DEVICE_PROGRAM_MAP(dsp_prg_map_lorom)
+ MCFG_DEVICE_DATA_MAP(dsp_data_map_lorom)
+MACHINE_CONFIG_END
//-------------------------------------------------
// Dipswitch
diff --git a/src/devices/bus/snes/event.h b/src/devices/bus/snes/event.h
index dedd18f921a..812022b3799 100644
--- a/src/devices/bus/snes/event.h
+++ b/src/devices/bus/snes/event.h
@@ -32,13 +32,13 @@ protected:
virtual void speedup_addon_bios_access() override;
// reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_READ8_MEMBER(chip_read) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override;
- virtual uint32_t necdsp_prg_r(offs_t offset);
- virtual uint16_t necdsp_data_r(offs_t offset);
+ virtual DECLARE_READ32_MEMBER(necdsp_prg_r);
+ virtual DECLARE_READ16_MEMBER(necdsp_data_r);
private:
required_device<upd7725_device> m_upd7725;
diff --git a/src/devices/bus/snes/rom.cpp b/src/devices/bus/snes/rom.cpp
index 3308808a008..bae27f21fad 100644
--- a/src/devices/bus/snes/rom.cpp
+++ b/src/devices/bus/snes/rom.cpp
@@ -174,12 +174,12 @@ void sns_rom_20col_device::device_start()
mapper specific handlers
-------------------------------------------------*/
-uint8_t sns_rom_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom_device::read_l)
{
- return read_h(offset);
+ return read_h(space, offset);
}
-uint8_t sns_rom_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom_device::read_h)
{
int bank = offset / 0x10000;
return m_rom[rom_bank_map[bank] * 0x8000 + (offset & 0x7fff)];
@@ -200,7 +200,7 @@ uint8_t sns_rom_device::read_h(offs_t offset)
***********************************************************************************************************/
-uint8_t sns_rom_obc1_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_rom_obc1_device::chip_read )
{
uint16_t address = offset & 0x1fff;
uint8_t value;
@@ -236,7 +236,7 @@ uint8_t sns_rom_obc1_device::chip_read(offs_t offset)
}
-void sns_rom_obc1_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_obc1_device::chip_write )
{
uint16_t address = offset & 0x1fff;
uint8_t temp;
@@ -289,12 +289,12 @@ void sns_rom_obc1_device::chip_write(offs_t offset, uint8_t data)
// Pokemon (and many others): a byte is written and a permutation of its bits must be returned.
// Address range for read/write depends on the game (check snes.xml)
-uint8_t sns_rom_pokemon_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_rom_pokemon_device::chip_read )
{
return bitswap<8>(m_latch,0,6,7,1,2,3,4,5);
}
-void sns_rom_pokemon_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_pokemon_device::chip_write )
{
m_latch = data;
}
@@ -340,7 +340,7 @@ void sns_rom_tekken2_device::update_prot(uint32_t offset)
}
}
-uint8_t sns_rom_tekken2_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_rom_tekken2_device::chip_read )
{
update_prot(offset);
@@ -362,10 +362,10 @@ uint8_t sns_rom_tekken2_device::chip_read(offs_t offset)
}
}
- return read_open_bus();
+ return 0xff; // should be open_bus
}
-void sns_rom_tekken2_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_tekken2_device::chip_write )
{
update_prot(offset);
}
@@ -373,7 +373,7 @@ void sns_rom_tekken2_device::chip_write(offs_t offset, uint8_t data)
// Soul Blade: Adresses $xxx0-$xxx3 in banks $80-$bf always read $55, $0f, $aa, $f0.
// Banks $c0-$ff return open bus.
-uint8_t sns_rom_soulblad_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_rom_soulblad_device::chip_read )
{
uint8_t value;
offset &= 3;
@@ -401,36 +401,36 @@ uint8_t sns_rom_soulblad_device::chip_read(offs_t offset)
// The actual banks depends on the last 8bits of the address accessed.
// Type 1: bits0-4 of the address are used as base bank (256KB chunks)
-uint8_t sns_rom_mcpirate1_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom_mcpirate1_device::read_l)
{
- return read_h(offset);
+ return read_h(space, offset);
}
-uint8_t sns_rom_mcpirate1_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom_mcpirate1_device::read_h)
{
int bank = (offset / 0x10000) + (m_base_bank * 8);
return m_rom[rom_bank_map[bank] * 0x8000 + (offset & 0x7fff)];
}
-void sns_rom_mcpirate1_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_mcpirate1_device::chip_write )
{
m_base_bank = offset & 0x1f;
// printf("offset %X data %X bank %X\n", offset, data, m_base_bank);
}
// Type 2: bits0-3 & bit5 of the address are used as base bank (256KB chunks)
-uint8_t sns_rom_mcpirate2_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom_mcpirate2_device::read_l)
{
- return read_h(offset);
+ return read_h(space, offset);
}
-uint8_t sns_rom_mcpirate2_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom_mcpirate2_device::read_h)
{
int bank = (offset / 0x10000) + (m_base_bank * 8);
return m_rom[rom_bank_map[bank] * 0x8000 + (offset & 0x7fff)];
}
-void sns_rom_mcpirate2_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_mcpirate2_device::chip_write )
{
m_base_bank = (offset & 0x0f) | ((offset & 0x20) >> 1);
// printf("offset %X data %X bank %X\n", offset, data, m_base_bank);
@@ -443,19 +443,19 @@ void sns_rom_mcpirate2_device::chip_write(offs_t offset, uint8_t data)
// accesses in [01-3f] don't go to the only 32KB bank)
// - bit 5 is always 0
// it's worth to notice that for FC games size of bank is twice the size of original FC PRG
-uint8_t sns_rom_20col_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom_20col_device::read_l)
{
- return read_h(offset);
+ return read_h(space, offset);
}
-uint8_t sns_rom_20col_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom_20col_device::read_h)
{
int prg32k = (!BIT(m_base_bank, 6) && BIT(m_base_bank, 7));
int bank = prg32k ? 0 : (offset / 0x10000);
return m_rom[((m_base_bank & 0x1f) + bank) * 0x8000 + (offset & 0x7fff)];
}
-void sns_rom_20col_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_20col_device::chip_write )
{
// [#] game - written bank value
// [01] spartan x - c6
@@ -486,23 +486,23 @@ void sns_rom_20col_device::chip_write(offs_t offset, uint8_t data)
// Work in progress (probably very wrong)
-uint8_t sns_rom_banana_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_rom_banana_device::chip_read )
{
return bitswap<8>(m_latch[0xf],0,6,7,1,2,3,4,5);
}
-void sns_rom_banana_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_banana_device::chip_write )
{
// printf("write addr %X data %X\n", offset, data);
m_latch[0xf] = data;
}
-uint8_t sns_rom_bugs_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_rom_bugs_device::chip_read )
{
return bitswap<8>(m_latch[offset & 0xff],0,6,7,1,2,3,4,5);
}
-void sns_rom_bugs_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_bugs_device::chip_write )
{
m_latch[offset & 0xff] = data;
}
diff --git a/src/devices/bus/snes/rom.h b/src/devices/bus/snes/rom.h
index d2a09b774c1..9e95e4b8e00 100644
--- a/src/devices/bus/snes/rom.h
+++ b/src/devices/bus/snes/rom.h
@@ -17,8 +17,8 @@ public:
sns_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
protected:
sns_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -36,8 +36,8 @@ public:
sns_rom_obc1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// additional reading and writing
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(chip_read) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override;
protected:
// device-level overrides
@@ -60,9 +60,9 @@ public:
// construction/destruction
sns_rom_pokemon_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // reading and writing (protection device)
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ // reading and writing
+ virtual DECLARE_READ8_MEMBER(chip_read) override; // protection device
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override; // protection device
protected:
// device-level overrides
@@ -80,9 +80,9 @@ public:
// construction/destruction
sns_rom_tekken2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // reading and writing (protection device)
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ // reading and writing
+ virtual DECLARE_READ8_MEMBER(chip_read) override; // protection device
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override; // protection device
protected:
// device-level overrides
@@ -104,8 +104,8 @@ public:
// construction/destruction
sns_rom_soulblad_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // reading and writing (protection device)
- virtual uint8_t chip_read(offs_t offset) override;
+ // reading and writing
+ virtual DECLARE_READ8_MEMBER(chip_read) override; // protection device
};
// ======================> sns_rom_mcpirate1_device
@@ -117,9 +117,9 @@ public:
sns_rom_mcpirate1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override; // bankswitch device
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override; // bankswitch device
protected:
// device-level overrides
@@ -138,9 +138,9 @@ public:
sns_rom_mcpirate2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override; // bankswitch device
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override; // bankswitch device
protected:
// device-level overrides
@@ -159,9 +159,9 @@ public:
sns_rom_20col_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override; // bankswitch device
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override; // bankswitch device
protected:
// device-level overrides
@@ -178,9 +178,9 @@ public:
// construction/destruction
sns_rom_banana_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // reading and writing (protection device)
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ // reading and writing
+ virtual DECLARE_READ8_MEMBER(chip_read) override; // protection device
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override; // protection device
protected:
// device-level overrides
@@ -198,9 +198,9 @@ public:
// construction/destruction
sns_rom_bugs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // reading and writing (protection device)
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ // reading and writing
+ virtual DECLARE_READ8_MEMBER(chip_read) override; // protection device
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override; // protection device
protected:
// device-level overrides
diff --git a/src/devices/bus/snes/rom21.cpp b/src/devices/bus/snes/rom21.cpp
index 8cc1f6fddb6..91c61394688 100644
--- a/src/devices/bus/snes/rom21.cpp
+++ b/src/devices/bus/snes/rom21.cpp
@@ -66,14 +66,14 @@ void sns_rom21_srtc_device::device_reset()
// low and hi reads are not the same! (different ROM banks are accessed)
-uint8_t sns_rom21_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom21_device::read_l)
{
// here ROM banks from 128 to 255, mirrored twice
int bank = (offset & 0x3fffff) / 0x8000;
return m_rom[rom_bank_map[bank + 0x80] * 0x8000 + (offset & 0x7fff)];
}
-uint8_t sns_rom21_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom21_device::read_h)
{
// here ROM banks from 0 to 127, mirrored twice
int bank = (offset & 0x3fffff) / 0x8000;
@@ -173,7 +173,7 @@ uint8_t sns_rom21_srtc_device::srtc_weekday( uint32_t year, uint32_t month, uint
// this gets called only for accesses at 0x2800,
// because for 0x2801 open bus gets returned...
-uint8_t sns_rom21_srtc_device::chip_read(offs_t offset)
+READ8_MEMBER(sns_rom21_srtc_device::chip_read)
{
if (m_mode != RTCM_Read)
return 0x00;
@@ -194,7 +194,7 @@ uint8_t sns_rom21_srtc_device::chip_read(offs_t offset)
}
// this gets called only for accesses at 0x2801
-void sns_rom21_srtc_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_rom21_srtc_device::chip_write)
{
data &= 0x0f; // Only the low four bits are used
diff --git a/src/devices/bus/snes/rom21.h b/src/devices/bus/snes/rom21.h
index fb9b0b6c65a..545e2457ef3 100644
--- a/src/devices/bus/snes/rom21.h
+++ b/src/devices/bus/snes/rom21.h
@@ -18,8 +18,8 @@ public:
sns_rom21_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
protected:
sns_rom21_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -38,8 +38,8 @@ public:
sns_rom21_srtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(chip_read) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override;
protected:
// S-RTC specific variables
diff --git a/src/devices/bus/snes/sa1.cpp b/src/devices/bus/snes/sa1.cpp
index 487f176fd86..aaf7024ce5f 100644
--- a/src/devices/bus/snes/sa1.cpp
+++ b/src/devices/bus/snes/sa1.cpp
@@ -204,7 +204,7 @@ void sns_sa1_device::recalc_irqs()
// handle this separately to avoid accessing recursively the regs?
-uint8_t sns_sa1_device::var_length_read(uint32_t offset)
+uint8_t sns_sa1_device::var_length_read(address_space &space, uint32_t offset)
{
// handle 0xffea/0xffeb/0xffee/0xffef
if ((offset & 0xffffe0) == 0x00ffe0)
@@ -216,13 +216,13 @@ uint8_t sns_sa1_device::var_length_read(uint32_t offset)
}
if ((offset & 0xc08000) == 0x008000) //$00-3f:8000-ffff
- return read_l(offset & 0x7fffff);
+ return read_l(space, (offset & 0x7fffff));
if ((offset & 0xc08000) == 0x808000) //$80-bf:8000-ffff
- return read_h(offset & 0x7fffff);
+ return read_h(space, (offset & 0x7fffff));
if ((offset & 0xc00000) == 0xc00000) //$c0-ff:0000-ffff
- return read_h(offset & 0x7fffff);
+ return read_h(space, (offset & 0x7fffff));
if ((offset & 0x40e000) == 0x006000) //$00-3f|80-bf:6000-7fff
return read_bwram((m_bwram_snes * 0x2000) + (offset & 0x1fff));
@@ -239,7 +239,7 @@ uint8_t sns_sa1_device::var_length_read(uint32_t offset)
return 0;
}
-void sns_sa1_device::dma_transfer()
+void sns_sa1_device::dma_transfer(address_space &space)
{
// printf("DMA src %08x (%d), dst %08x (%d) cnt %d\n", m_src_addr, m_dma_ctrl & 3, m_dst_addr, m_dma_ctrl & 4, m_dma_cnt);
@@ -260,15 +260,15 @@ void sns_sa1_device::dma_transfer()
case 0: // ROM
if ((dma_src & 0x408000) == 0x008000 && (dma_src & 0x800000) == 0x000000)
{
- data = read_l(dma_src & 0x7fffff);
+ data = read_l(space, (dma_src & 0x7fffff));
}
if ((dma_src & 0x408000) == 0x008000 && (dma_src & 0x800000) == 0x800000)
{
- data = read_h(dma_src & 0x7fffff);
+ data = read_h(space, (dma_src & 0x7fffff));
}
if ((dma_src & 0xc00000) == 0xc00000)
{
- data = read_h(dma_src & 0x7fffff);
+ data = read_h(space, (dma_src & 0x7fffff));
}
break;
@@ -311,17 +311,17 @@ void sns_sa1_device::dma_transfer()
recalc_irqs();
}
-void sns_sa1_device::dma_cctype1_transfer()
+void sns_sa1_device::dma_cctype1_transfer(address_space &space)
{
m_scpu_flags |= SCPU_IRQ_CHARCONV;
recalc_irqs();
}
-void sns_sa1_device::dma_cctype2_transfer()
+void sns_sa1_device::dma_cctype2_transfer(address_space &space)
{
}
-uint8_t sns_sa1_device::read_regs(uint32_t offset)
+uint8_t sns_sa1_device::read_regs(address_space &space, uint32_t offset)
{
uint8_t value = 0xff;
offset &= 0x1ff; // $2200 + offset gives the reg value to compare with docs
@@ -383,8 +383,8 @@ uint8_t sns_sa1_device::read_regs(uint32_t offset)
case 0x10c:
// Var-Length Read Port Low
{
- uint32_t data = (var_length_read(m_vda + 0) << 0) | (var_length_read(m_vda + 1) << 8)
- | (var_length_read(m_vda + 2) << 16);
+ uint32_t data = (var_length_read(space, m_vda + 0) << 0) | (var_length_read(space, m_vda + 1) << 8)
+ | (var_length_read(space, m_vda + 2) << 16);
data >>= m_vbit;
value = (data >> 0) & 0xff;
}
@@ -392,8 +392,8 @@ uint8_t sns_sa1_device::read_regs(uint32_t offset)
case 0x10d:
// Var-Length Read Port High
{
- uint32_t data = (var_length_read(m_vda + 0) << 0) | (var_length_read(m_vda + 1) << 8)
- | (var_length_read(m_vda + 2) << 16);
+ uint32_t data = (var_length_read(space, m_vda + 0) << 0) | (var_length_read(space, m_vda + 1) << 8)
+ | (var_length_read(space, m_vda + 2) << 16);
data >>= m_vbit;
if (m_drm == 1)
@@ -417,7 +417,7 @@ uint8_t sns_sa1_device::read_regs(uint32_t offset)
return value;
}
-void sns_sa1_device::write_regs(uint32_t offset, uint8_t data)
+void sns_sa1_device::write_regs(address_space &space, uint32_t offset, uint8_t data)
{
offset &= 0x1ff; // $2200 + offset gives the reg value to compare with docs
@@ -669,14 +669,14 @@ void sns_sa1_device::write_regs(uint32_t offset, uint8_t data)
{
if (!(m_dma_ctrl & 0x20) && !(m_dma_ctrl & 0x04)) // Normal DMA to IRAM
{
- dma_transfer();
+ dma_transfer(space);
// printf("SA-1: normal DMA to IRAM\n");
}
if (m_dma_ctrl & 0x20 && m_dma_ctrl & 0x10) // CC DMA Type 1
{
// printf("SA-1: CC DMA type 1\n");
- dma_cctype1_transfer();
+ dma_cctype1_transfer(space);
}
}
break;
@@ -688,7 +688,7 @@ void sns_sa1_device::write_regs(uint32_t offset, uint8_t data)
if (!(m_dma_ctrl & 0x20) && m_dma_ctrl & 0x04) // Normal DMA to BWRAM
{
// printf("SA-1: normal DMA to BWRAM\n");
- dma_transfer();
+ dma_transfer(space);
}
}
break;
@@ -729,7 +729,7 @@ void sns_sa1_device::write_regs(uint32_t offset, uint8_t data)
if (m_dma_ctrl & 0x20 && !(m_dma_ctrl & 0x10)) // CC DMA Type 2
{
// printf("SA-1: CC DMA type 2\n");
- dma_cctype2_transfer();
+ dma_cctype2_transfer(space);
}
}
break;
@@ -901,7 +901,7 @@ void sns_sa1_device::write_bwram(uint32_t offset, uint8_t data)
-------------------------------------------------*/
-uint8_t sns_sa1_device::read_l(offs_t offset)
+READ8_MEMBER(sns_sa1_device::read_l)
{
int bank;
@@ -936,7 +936,7 @@ uint8_t sns_sa1_device::read_l(offs_t offset)
return 0; // this should not happen (the driver should only call read_l in the above case)
}
-uint8_t sns_sa1_device::read_h(offs_t offset)
+READ8_MEMBER(sns_sa1_device::read_h)
{
int bank;
@@ -972,20 +972,20 @@ uint8_t sns_sa1_device::read_h(offs_t offset)
return m_rom[rom_bank_map[(m_bank_f_rom * 0x20) + ((offset - 0x700000) / 0x8000)] * 0x8000 + (offset & 0x7fff)];
}
-void sns_sa1_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_sa1_device::write_l)
{
}
-void sns_sa1_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_sa1_device::write_h)
{
}
-uint8_t sns_sa1_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_sa1_device::chip_read )
{
uint16_t address = offset & 0xffff;
if (offset < 0x400000 && address >= 0x2200 && address < 0x2400)
- return read_regs(address & 0x1ff); // SA-1 Regs
+ return read_regs(space, address & 0x1ff); // SA-1 Regs
if (offset < 0x400000 && address >= 0x3000 && address < 0x3800)
return read_iram(address & 0x7ff); // Internal SA-1 RAM (2K)
@@ -1000,12 +1000,12 @@ uint8_t sns_sa1_device::chip_read(offs_t offset)
}
-void sns_sa1_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_sa1_device::chip_write )
{
uint16_t address = offset & 0xffff;
if (offset < 0x400000 && address >= 0x2200 && address < 0x2400)
- write_regs(address & 0x1ff, data); // SA-1 Regs
+ write_regs(space, address & 0x1ff, data); // SA-1 Regs
if (offset < 0x400000 && address >= 0x3000 && address < 0x3800)
write_iram(address & 0x7ff, data); // Internal SA-1 RAM (2K)
@@ -1026,7 +1026,7 @@ void sns_sa1_device::chip_write(offs_t offset, uint8_t data)
// I/O regs or WRAM, and there are a few additional accesses to IRAM (in [00-3f][0000-07ff])
// and to BWRAM (in [60-6f][0000-ffff], so-called bitmap mode)
-uint8_t sns_sa1_device::sa1_hi_r(offs_t offset)
+READ8_MEMBER( sns_sa1_device::sa1_hi_r )
{
uint16_t address = offset & 0xffff;
@@ -1037,22 +1037,22 @@ uint8_t sns_sa1_device::sa1_hi_r(offs_t offset)
if (address < 0x0800)
return read_iram(offset); // Internal SA-1 RAM (2K)
else if (address >= 0x2200 && address < 0x2400)
- return read_regs(offset & 0x1ff); // SA-1 Regs
+ return read_regs(space, offset & 0x1ff); // SA-1 Regs
else if (address >= 0x3000 && address < 0x3800)
return read_iram(offset); // Internal SA-1 RAM (2K)
}
else if (address < 0x8000)
return read_bwram((m_bwram_sa1 * 0x2000) + (offset & 0x1fff) + (m_bwram_sa1_source * 0x100000)); // SA-1 BWRAM
else
- return read_h(offset); // ROM
+ return read_h(space, offset); // ROM
return 0xff; // maybe open bus? same as the main system one or diff? (currently not accessible from carts anyway...)
}
else
- return read_h(offset); // ROM
+ return read_h(space, offset); // ROM
}
-uint8_t sns_sa1_device::sa1_lo_r(offs_t offset)
+READ8_MEMBER( sns_sa1_device::sa1_lo_r )
{
uint16_t address = offset & 0xffff;
@@ -1063,7 +1063,7 @@ uint8_t sns_sa1_device::sa1_lo_r(offs_t offset)
if (address < 0x0800)
return read_iram(offset); // Internal SA-1 RAM (2K)
else if (address >= 0x2200 && address < 0x2400)
- return read_regs(offset & 0x1ff); // SA-1 Regs
+ return read_regs(space, offset & 0x1ff); // SA-1 Regs
else if (address >= 0x3000 && address < 0x3800)
return read_iram(offset); // Internal SA-1 RAM (2K)
}
@@ -1094,7 +1094,7 @@ uint8_t sns_sa1_device::sa1_lo_r(offs_t offset)
return m_sa1_reset>>8;
}
else
- return read_l(offset); // ROM
+ return read_l(space, offset); // ROM
return 0xff; // maybe open bus? same as the main system one or diff? (currently not accessible from carts anyway...)
}
@@ -1106,7 +1106,7 @@ uint8_t sns_sa1_device::sa1_lo_r(offs_t offset)
return 0xff; // nothing should be mapped here, so maybe open bus?
}
-void sns_sa1_device::sa1_hi_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_sa1_device::sa1_hi_w )
{
uint16_t address = offset & 0xffff;
if (offset < 0x400000)
@@ -1116,7 +1116,7 @@ void sns_sa1_device::sa1_hi_w(offs_t offset, uint8_t data)
if (address < 0x0800)
write_iram(offset, data); // Internal SA-1 RAM (2K)
else if (address >= 0x2200 && address < 0x2400)
- write_regs(offset & 0x1ff, data); // SA-1 Regs
+ write_regs(space, offset & 0x1ff, data); // SA-1 Regs
else if (address >= 0x3000 && address < 0x3800)
write_iram(offset, data); // Internal SA-1 RAM (2K)
}
@@ -1125,14 +1125,14 @@ void sns_sa1_device::sa1_hi_w(offs_t offset, uint8_t data)
}
}
-void sns_sa1_device::sa1_lo_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_sa1_device::sa1_lo_w )
{
if (offset >= 0x400000 && offset < 0x500000)
write_bwram(offset & 0xfffff, data); // SA-1 BWRAM (not mirrored above!)
else if (offset >= 0x600000 && offset < 0x700000)
write_bwram((offset & 0xfffff) + 0x100000, data); // SA-1 BWRAM Bitmap mode
else
- sa1_hi_w(offset, data);
+ sa1_hi_w(space, offset, data);
}
void sns_sa1_device::sa1_map(address_map &map)
@@ -1143,8 +1143,7 @@ void sns_sa1_device::sa1_map(address_map &map)
}
-void sns_sa1_device::device_add_mconfig(machine_config &config)
-{
- G65816(config, m_sa1, 10000000);
- m_sa1->set_addrmap(AS_PROGRAM, &sns_sa1_device::sa1_map);
-}
+MACHINE_CONFIG_START(sns_sa1_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("sa1cpu", G65816, 10000000)
+ MCFG_DEVICE_PROGRAM_MAP(sa1_map)
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/snes/sa1.h b/src/devices/bus/snes/sa1.h
index e4fb646385a..6ea8ae9b15a 100644
--- a/src/devices/bus/snes/sa1.h
+++ b/src/devices/bus/snes/sa1.h
@@ -26,25 +26,25 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
// additional reading and writing
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(chip_read) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override;
private:
- uint8_t var_length_read(uint32_t offset);
- void dma_transfer();
- void dma_cctype1_transfer();
- void dma_cctype2_transfer();
+ uint8_t var_length_read(address_space &space, uint32_t offset);
+ void dma_transfer(address_space &space);
+ void dma_cctype1_transfer(address_space &space);
+ void dma_cctype2_transfer(address_space &space);
- uint8_t read_regs(uint32_t offset);
+ uint8_t read_regs(address_space &space, uint32_t offset);
uint8_t read_iram(uint32_t offset);
uint8_t read_bwram(uint32_t offset);
- void write_regs(uint32_t offset, uint8_t data);
+ void write_regs(address_space &space, uint32_t offset, uint8_t data);
void write_iram(uint32_t offset, uint8_t data);
void write_bwram(uint32_t offset, uint8_t data);
void recalc_irqs();
@@ -103,10 +103,10 @@ private:
// $2302-$2305
uint16_t m_hcr, m_vcr;
- uint8_t sa1_lo_r(offs_t offset);
- uint8_t sa1_hi_r(offs_t offset);
- void sa1_lo_w(offs_t offset, uint8_t data);
- void sa1_hi_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(sa1_lo_r);
+ DECLARE_READ8_MEMBER(sa1_hi_r);
+ DECLARE_WRITE8_MEMBER(sa1_lo_w);
+ DECLARE_WRITE8_MEMBER(sa1_hi_w);
void sa1_map(address_map &map);
};
diff --git a/src/devices/bus/snes/sdd1.cpp b/src/devices/bus/snes/sdd1.cpp
index 94374d07681..6d13fcd97a8 100644
--- a/src/devices/bus/snes/sdd1.cpp
+++ b/src/devices/bus/snes/sdd1.cpp
@@ -470,7 +470,7 @@ void sns_rom_sdd1_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
-uint8_t sns_rom_sdd1_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_rom_sdd1_device::chip_read )
{
uint16_t addr = offset & 0xffff;
@@ -491,7 +491,7 @@ uint8_t sns_rom_sdd1_device::chip_read(offs_t offset)
}
-void sns_rom_sdd1_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_sdd1_device::chip_write )
{
uint16_t addr = offset & 0xffff;
@@ -589,7 +589,7 @@ uint8_t sns_rom_sdd1_device::read_helper(uint32_t addr)
return m_rom[m_mmc[(addr >> 20) & 3] + (addr & 0x0fffff)];
}
-uint8_t sns_rom_sdd1_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom_sdd1_device::read_l)
{
if (offset < 0x400000)
return m_rom[rom_bank_map[offset / 0x10000] * 0x8000 + (offset & 0x7fff)];
@@ -597,21 +597,21 @@ uint8_t sns_rom_sdd1_device::read_l(offs_t offset)
return m_rom[rom_bank_map[(offset - 0x400000) / 0x8000] * 0x8000 + (offset & 0x7fff)];
}
-uint8_t sns_rom_sdd1_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom_sdd1_device::read_h)
{
if (offset >= 0x400000)
return read_helper(offset - 0x400000);
else
- return read_l(offset);
+ return read_l(space, offset);
}
-uint8_t sns_rom_sdd1_device::read_ram(offs_t offset)
+READ8_MEMBER( sns_rom_sdd1_device::read_ram )
{
return m_nvram[offset & 0x1fff];
}
-void sns_rom_sdd1_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_sdd1_device::write_ram )
{
m_nvram[offset & 0x1fff] = data;
}
diff --git a/src/devices/bus/snes/sdd1.h b/src/devices/bus/snes/sdd1.h
index 5164a169f65..6265e630bdc 100644
--- a/src/devices/bus/snes/sdd1.h
+++ b/src/devices/bus/snes/sdd1.h
@@ -19,12 +19,12 @@ public:
sns_rom_sdd1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
+ virtual DECLARE_READ8_MEMBER(chip_read) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override;
protected:
sns_rom_sdd1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/bus/snes/sfx.cpp b/src/devices/bus/snes/sfx.cpp
index 59908b9b06e..cf9942ada4d 100644
--- a/src/devices/bus/snes/sfx.cpp
+++ b/src/devices/bus/snes/sfx.cpp
@@ -40,30 +40,30 @@ void sns_rom_superfx_device::device_reset()
// LoROM + SuperFX (GSU-1,2)
// TODO: mask sfx_ram based on the actual RAM...
-uint8_t sns_rom_superfx_device::superfx_r_bank1(offs_t offset)
+READ8_MEMBER( sns_rom_superfx_device::superfx_r_bank1 )
{
return m_rom[rom_bank_map[offset / 0x10000] * 0x8000 + (offset & 0x7fff)];
}
-uint8_t sns_rom_superfx_device::superfx_r_bank2(offs_t offset)
+READ8_MEMBER( sns_rom_superfx_device::superfx_r_bank2 )
{
return m_rom[rom_bank_map[offset / 0x8000] * 0x8000 + (offset & 0x7fff)];
}
-uint8_t sns_rom_superfx_device::superfx_r_bank3(offs_t offset)
+READ8_MEMBER( sns_rom_superfx_device::superfx_r_bank3 )
{
return sfx_ram[offset & 0xfffff];
}
-void sns_rom_superfx_device::superfx_w_bank1(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_superfx_device::superfx_w_bank1 )
{
}
-void sns_rom_superfx_device::superfx_w_bank2(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_superfx_device::superfx_w_bank2 )
{
}
-void sns_rom_superfx_device::superfx_w_bank3(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_superfx_device::superfx_w_bank3 )
{
sfx_ram[offset & 0xfffff] = data;
}
@@ -92,23 +92,23 @@ void sns_rom_superfx_device::device_add_mconfig(machine_config &config)
m_superfx->irq().set(FUNC(sns_rom_superfx_device::snes_extern_irq_w)); /* IRQ line from cart */
}
-uint8_t sns_rom_superfx_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_rom_superfx_device::chip_read )
{
return m_superfx->mmio_read(offset);
}
-void sns_rom_superfx_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_superfx_device::chip_write )
{
m_superfx->mmio_write(offset, data);
}
-uint8_t sns_rom_superfx_device::read_l(offs_t offset)
+READ8_MEMBER( sns_rom_superfx_device::read_l )
{
- return read_h(offset);
+ return read_h(space, offset);
}
-uint8_t sns_rom_superfx_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom_superfx_device::read_h)
{
if (offset < 0x400000)
return m_rom[rom_bank_map[offset / 0x10000] * 0x8000 + (offset & 0x7fff)];
@@ -130,14 +130,14 @@ uint8_t sns_rom_superfx_device::read_h(offs_t offset)
return 0xff; // this handler should never be called for [60-7f]/[e0-ff] ranges
}
-uint8_t sns_rom_superfx_device::read_ram(offs_t offset)
+READ8_MEMBER( sns_rom_superfx_device::read_ram )
{
if (m_superfx->access_ram())
return sfx_ram[offset & 0xfffff];
return 0xff; // should be open bus...
}
-void sns_rom_superfx_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_superfx_device::write_ram )
{
if (m_superfx->access_ram())
sfx_ram[offset & 0xfffff] = data;
diff --git a/src/devices/bus/snes/sfx.h b/src/devices/bus/snes/sfx.h
index 7c92e411749..253084be139 100644
--- a/src/devices/bus/snes/sfx.h
+++ b/src/devices/bus/snes/sfx.h
@@ -26,19 +26,19 @@ protected:
virtual DECLARE_WRITE_LINE_MEMBER(snes_extern_irq_w);
// additional reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
-
- uint8_t superfx_r_bank1(offs_t offset);
- uint8_t superfx_r_bank2(offs_t offset);
- uint8_t superfx_r_bank3(offs_t offset);
- void superfx_w_bank1(offs_t offset, uint8_t data);
- void superfx_w_bank2(offs_t offset, uint8_t data);
- void superfx_w_bank3(offs_t offset, uint8_t data);
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
+ virtual DECLARE_READ8_MEMBER(chip_read) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override;
+
+ virtual DECLARE_READ8_MEMBER(superfx_r_bank1);
+ virtual DECLARE_READ8_MEMBER(superfx_r_bank2);
+ virtual DECLARE_READ8_MEMBER(superfx_r_bank3);
+ virtual DECLARE_WRITE8_MEMBER(superfx_w_bank1);
+ virtual DECLARE_WRITE8_MEMBER(superfx_w_bank2);
+ virtual DECLARE_WRITE8_MEMBER(superfx_w_bank3);
private:
required_device<superfx_device> m_superfx;
diff --git a/src/devices/bus/snes/sgb.cpp b/src/devices/bus/snes/sgb.cpp
index 6c790a1c773..1a50f504f01 100644
--- a/src/devices/bus/snes/sgb.cpp
+++ b/src/devices/bus/snes/sgb.cpp
@@ -74,55 +74,55 @@ void sns_rom_sgb_device::device_reset()
// ADDRESS_MAP( supergb_map )
//-------------------------------------------------
-uint8_t sns_rom_sgb_device::gb_cart_r(offs_t offset)
+READ8_MEMBER(sns_rom_sgb_device::gb_cart_r)
{
if (offset < 0x100 && !m_bios_disabled)
{
return m_region_bios->base()[offset];
}
- return m_cartslot->read_rom(offset);
+ return m_cartslot->read_rom(space, offset);
}
-void sns_rom_sgb_device::gb_bank_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_rom_sgb_device::gb_bank_w)
{
- m_cartslot->write_bank(offset, data);
+ m_cartslot->write_bank(space, offset, data);
}
-uint8_t sns_rom_sgb_device::gb_ram_r(offs_t offset)
+READ8_MEMBER(sns_rom_sgb_device::gb_ram_r)
{
- return m_cartslot->read_ram(offset);
+ return m_cartslot->read_ram(space, offset);
}
-void sns_rom_sgb_device::gb_ram_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_rom_sgb_device::gb_ram_w)
{
- m_cartslot->write_ram(offset, data);
+ m_cartslot->write_ram(space, offset, data);
}
-uint8_t sns_rom_sgb_device::gb_echo_r(offs_t offset)
+READ8_MEMBER(sns_rom_sgb_device::gb_echo_r)
{
- return m_sgb_cpu->space(AS_PROGRAM).read_byte(0xc000 + offset);
+ return space.read_byte(0xc000 + offset);
}
-void sns_rom_sgb_device::gb_echo_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_rom_sgb_device::gb_echo_w)
{
- return m_sgb_cpu->space(AS_PROGRAM).write_byte(0xc000 + offset, data);
+ return space.write_byte(0xc000 + offset, data);
}
-uint8_t sns_rom_sgb_device::gb_io_r(offs_t offset)
+READ8_MEMBER(sns_rom_sgb_device::gb_io_r)
{
return 0;
}
-void sns_rom_sgb_device::gb_io_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_rom_sgb_device::gb_io_w)
{
}
-uint8_t sns_rom_sgb_device::gb_ie_r(offs_t offset)
+READ8_MEMBER(sns_rom_sgb_device::gb_ie_r)
{
return m_sgb_cpu->get_ie();
}
-void sns_rom_sgb_device::gb_ie_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_rom_sgb_device::gb_ie_w)
{
m_sgb_cpu->set_ie(data);
}
@@ -149,7 +149,7 @@ void sns_rom_sgb_device::supergb_map(address_map &map)
-void sns_rom_sgb_device::gb_timer_callback(uint8_t data)
+WRITE8_MEMBER( sns_rom_sgb_device::gb_timer_callback )
{
}
@@ -220,18 +220,18 @@ const tiny_rom_entry *sns_rom_sgb2_device::device_rom_region() const
-------------------------------------------------*/
-uint8_t sns_rom_sgb_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom_sgb_device::read_l)
{
- return read_h(offset);
+ return read_h(space, offset);
}
-uint8_t sns_rom_sgb_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom_sgb_device::read_h)
{
int bank = offset / 0x10000;
return m_rom[rom_bank_map[bank] * 0x8000 + (offset & 0x7fff)];
}
-uint8_t sns_rom_sgb_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_rom_sgb_device::chip_read )
{
uint16_t address = offset & 0xffff;
@@ -299,7 +299,7 @@ void sns_rom_sgb_device::lcd_render(uint32_t *source)
}
}
-void sns_rom_sgb_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_sgb_device::chip_write )
{
uint16_t address = offset & 0xffff;
diff --git a/src/devices/bus/snes/sgb.h b/src/devices/bus/snes/sgb.h
index db6782ddb98..c49ebaa44e3 100644
--- a/src/devices/bus/snes/sgb.h
+++ b/src/devices/bus/snes/sgb.h
@@ -21,7 +21,8 @@
class sns_rom_sgb_device : public sns_rom_device
{
public:
- void gb_timer_callback(uint8_t data);
+
+ virtual DECLARE_WRITE8_MEMBER(gb_timer_callback);
protected:
// construction/destruction
@@ -32,21 +33,21 @@ protected:
virtual void device_reset() override;
// reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
-
- uint8_t gb_cart_r(offs_t offset);
- void gb_bank_w(offs_t offset, uint8_t data);
- uint8_t gb_ram_r(offs_t offset);
- void gb_ram_w(offs_t offset, uint8_t data);
- uint8_t gb_echo_r(offs_t offset);
- void gb_echo_w(offs_t offset, uint8_t data);
- uint8_t gb_io_r(offs_t offset);
- void gb_io_w(offs_t offset, uint8_t data);
- uint8_t gb_ie_r(offs_t offset);
- void gb_ie_w(offs_t offset, uint8_t data);
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_READ8_MEMBER(chip_read) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override;
+
+ virtual DECLARE_READ8_MEMBER(gb_cart_r);
+ virtual DECLARE_WRITE8_MEMBER(gb_bank_w);
+ virtual DECLARE_READ8_MEMBER(gb_ram_r);
+ virtual DECLARE_WRITE8_MEMBER(gb_ram_w);
+ virtual DECLARE_READ8_MEMBER(gb_echo_r);
+ virtual DECLARE_WRITE8_MEMBER(gb_echo_w);
+ virtual DECLARE_READ8_MEMBER(gb_io_r);
+ virtual DECLARE_WRITE8_MEMBER(gb_io_w);
+ virtual DECLARE_READ8_MEMBER(gb_ie_r);
+ virtual DECLARE_WRITE8_MEMBER(gb_ie_w);
void supergb_map(address_map &map);
diff --git a/src/devices/bus/snes/snes_slot.cpp b/src/devices/bus/snes/snes_slot.cpp
index 7af674e9f6d..f85f198f257 100644
--- a/src/devices/bus/snes/snes_slot.cpp
+++ b/src/devices/bus/snes/snes_slot.cpp
@@ -177,18 +177,6 @@ WRITE_LINE_MEMBER(device_sns_cart_interface::write_irq)
m_slot->write_irq(state);
}
-//-------------------------------------------------
-// read_open_bus - read from the open bus
-//-------------------------------------------------
-
-uint8_t device_sns_cart_interface::read_open_bus()
-{
- if (m_slot != nullptr)
- return m_slot->read_open_bus();
-
- return 0xff;
-}
-
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
@@ -203,8 +191,7 @@ base_sns_cart_slot_device::base_sns_cart_slot_device(const machine_config &mconf
m_addon(ADDON_NONE),
m_type(SNES_MODE20),
m_cart(nullptr),
- m_irq_callback(*this),
- m_open_bus_callback(*this)
+ m_irq_callback(*this)
{
}
@@ -238,11 +225,9 @@ base_sns_cart_slot_device::~base_sns_cart_slot_device()
void base_sns_cart_slot_device::device_start()
{
m_cart = dynamic_cast<device_sns_cart_interface *>(get_card_device());
- if (m_cart != nullptr)
- m_cart->m_slot = this;
+ m_cart->m_slot = this;
m_irq_callback.resolve_safe();
- m_open_bus_callback.resolve_safe(0xff);
}
@@ -1075,34 +1060,34 @@ std::string base_sns_cart_slot_device::get_default_card_software(get_default_car
read
-------------------------------------------------*/
-uint8_t base_sns_cart_slot_device::read_l(offs_t offset)
+READ8_MEMBER(base_sns_cart_slot_device::read_l)
{
if (m_cart)
- return m_cart->read_l(offset);
+ return m_cart->read_l(space, offset);
else
return 0xff;
}
-uint8_t base_sns_cart_slot_device::read_h(offs_t offset)
+READ8_MEMBER(base_sns_cart_slot_device::read_h)
{
if (m_cart)
- return m_cart->read_h(offset);
+ return m_cart->read_h(space, offset);
else
return 0xff;
}
-uint8_t base_sns_cart_slot_device::read_ram(offs_t offset)
+READ8_MEMBER(base_sns_cart_slot_device::read_ram)
{
if (m_cart)
- return m_cart->read_ram(offset);
+ return m_cart->read_ram(space, offset);
else
return 0xff;
}
-uint8_t base_sns_cart_slot_device::chip_read(offs_t offset)
+READ8_MEMBER(base_sns_cart_slot_device::chip_read)
{
if (m_cart)
- return m_cart->chip_read(offset);
+ return m_cart->chip_read(space, offset);
else
return 0xff;
}
@@ -1111,28 +1096,28 @@ uint8_t base_sns_cart_slot_device::chip_read(offs_t offset)
write
-------------------------------------------------*/
-void base_sns_cart_slot_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(base_sns_cart_slot_device::write_l)
{
if (m_cart)
- m_cart->write_l(offset, data);
+ m_cart->write_l(space, offset, data);
}
-void base_sns_cart_slot_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(base_sns_cart_slot_device::write_h)
{
if (m_cart)
- m_cart->write_h(offset, data);
+ m_cart->write_h(space, offset, data);
}
-void base_sns_cart_slot_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(base_sns_cart_slot_device::write_ram)
{
if (m_cart)
- m_cart->write_ram(offset, data);
+ m_cart->write_ram(space, offset, data);
}
-void base_sns_cart_slot_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(base_sns_cart_slot_device::chip_write)
{
if (m_cart)
- m_cart->chip_write(offset, data);
+ m_cart->chip_write(space, offset, data);
}
diff --git a/src/devices/bus/snes/snes_slot.h b/src/devices/bus/snes/snes_slot.h
index 9d63a1ba9c2..91f61e88f4d 100644
--- a/src/devices/bus/snes/snes_slot.h
+++ b/src/devices/bus/snes/snes_slot.h
@@ -111,14 +111,14 @@ public:
virtual ~device_sns_cart_interface();
// reading and writing
- virtual uint8_t read_l(offs_t offset) { return 0xff; } // ROM access in range [00-7f]
- virtual uint8_t read_h(offs_t offset) { return 0xff; } // ROM access in range [80-ff]
- virtual uint8_t read_ram(offs_t offset) { if (!m_nvram.empty()) return m_nvram[offset & (m_nvram.size()-1)]; else return 0xff; } // NVRAM access
- virtual void write_l(offs_t offset, uint8_t data) { } // used by carts with subslots
- virtual void write_h(offs_t offset, uint8_t data) { } // used by carts with subslots
- virtual void write_ram(offs_t offset, uint8_t data) { if (!m_nvram.empty()) m_nvram[offset & (m_nvram.size()-1)] = data; } // NVRAM access
- virtual uint8_t chip_read(offs_t offset) { return 0xff; }
- virtual void chip_write(offs_t offset, uint8_t data) { }
+ virtual DECLARE_READ8_MEMBER(read_l) { return 0xff; } // ROM access in range [00-7f]
+ virtual DECLARE_READ8_MEMBER(read_h) { return 0xff; } // ROM access in range [80-ff]
+ virtual DECLARE_READ8_MEMBER(read_ram) { if (!m_nvram.empty()) return m_nvram[offset & (m_nvram.size()-1)]; else return 0xff; } // NVRAM access
+ virtual DECLARE_WRITE8_MEMBER(write_l) { } // used by carts with subslots
+ virtual DECLARE_WRITE8_MEMBER(write_h) { } // used by carts with subslots
+ virtual DECLARE_WRITE8_MEMBER(write_ram) { if (!m_nvram.empty()) m_nvram[offset & (m_nvram.size()-1)] = data; } // NVRAM access
+ virtual DECLARE_READ8_MEMBER(chip_read) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(chip_write) { }
virtual void speedup_addon_bios_access() {}
void rom_alloc(uint32_t size, const char *tag);
@@ -142,7 +142,6 @@ protected:
device_sns_cart_interface(const machine_config &mconfig, device_t &device);
DECLARE_WRITE_LINE_MEMBER(write_irq);
- uint8_t read_open_bus();
// internal state
uint8_t *m_rom;
@@ -169,7 +168,6 @@ public:
// configuration
auto irq_callback() { return m_irq_callback.bind(); }
- auto open_bus_callback() { return m_open_bus_callback.bind(); }
// device-level overrides
virtual void device_start() override;
@@ -200,17 +198,16 @@ public:
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
// reading and writing
- uint8_t read_l(offs_t offset);
- uint8_t read_h(offs_t offset);
- uint8_t read_ram(offs_t offset);
- void write_l(offs_t offset, uint8_t data);
- void write_h(offs_t offset, uint8_t data);
- void write_ram(offs_t offset, uint8_t data);
- uint8_t chip_read(offs_t offset);
- void chip_write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(read_l);
+ DECLARE_READ8_MEMBER(read_h);
+ DECLARE_READ8_MEMBER(read_ram);
+ DECLARE_WRITE8_MEMBER(write_l);
+ DECLARE_WRITE8_MEMBER(write_h);
+ DECLARE_WRITE8_MEMBER(write_ram);
+ DECLARE_READ8_MEMBER(chip_read);
+ DECLARE_WRITE8_MEMBER(chip_write);
DECLARE_WRITE_LINE_MEMBER(write_irq) { m_irq_callback(state); }
- uint8_t read_open_bus() { return m_open_bus_callback(); }
// in order to support legacy dumps + add-on CPU dump appended at the end of the file, we
// check if the required data is present and update bank map accordingly
@@ -233,7 +230,6 @@ protected:
private:
devcb_write_line m_irq_callback;
- devcb_read8 m_open_bus_callback;
};
// ======================> sns_cart_slot_device
diff --git a/src/devices/bus/snes/spc7110.cpp b/src/devices/bus/snes/spc7110.cpp
index 20d59dc681a..a88c06e9250 100644
--- a/src/devices/bus/snes/spc7110.cpp
+++ b/src/devices/bus/snes/spc7110.cpp
@@ -1076,7 +1076,7 @@ void sns_rom_spc7110_device::spc7110_update_time(uint8_t offset)
}
}
-uint8_t sns_rom_spc7110_device::chip_read(offs_t offset)
+READ8_MEMBER(sns_rom_spc7110_device::chip_read)
{
uint8_t *ROM = get_rom_base();
uint32_t len = get_rom_size();
@@ -1262,7 +1262,7 @@ uint8_t sns_rom_spc7110_device::chip_read(offs_t offset)
return 0xff;
}
-void sns_rom_spc7110_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_rom_spc7110_device::chip_write)
{
uint8_t *ROM = get_rom_base();
uint32_t len = get_rom_size();
@@ -1648,7 +1648,7 @@ void sns_rom_spc7110_device::chip_write(offs_t offset, uint8_t data)
}
}
-uint8_t sns_rom_spc7110_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom_spc7110_device::read_l)
{
if (offset < 0x400000)
return m_rom[rom_bank_map[offset / 0x8000] * 0x8000 + (offset & 0x7fff)];
@@ -1656,7 +1656,7 @@ uint8_t sns_rom_spc7110_device::read_l(offs_t offset)
return 0xff;
}
-uint8_t sns_rom_spc7110_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom_spc7110_device::read_h)
{
uint16_t address = offset & 0xfffff;
@@ -1683,12 +1683,12 @@ uint8_t sns_rom_spc7110_device::read_h(offs_t offset)
}
-uint8_t sns_rom_spc7110_device::read_ram(offs_t offset)
+READ8_MEMBER( sns_rom_spc7110_device::read_ram )
{
return m_nvram[offset & 0x1fff];
}
-void sns_rom_spc7110_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_spc7110_device::write_ram )
{
m_nvram[offset & 0x1fff] = data;
}
diff --git a/src/devices/bus/snes/spc7110.h b/src/devices/bus/snes/spc7110.h
index a7c798244c1..249944c8ae7 100644
--- a/src/devices/bus/snes/spc7110.h
+++ b/src/devices/bus/snes/spc7110.h
@@ -18,13 +18,13 @@ public:
sns_rom_spc7110_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(chip_read) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override;
protected:
sns_rom_spc7110_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -199,11 +199,11 @@ public:
// reading and writing
// we just use the spc7110 ones for the moment, pending the split of regs 0x4840-0x4842 (RTC) from the base add-on
-// virtual uint8_t read_l(offs_t offset);
-// virtual uint8_t read_h(offs_t offset);
+// virtual DECLARE_READ8_MEMBER(read_l);
+// virtual DECLARE_READ8_MEMBER(read_h);
-// virtual uint8_t chip_read(offs_t offset);
-// virtual void chip_write(offs_t offset, uint8_t data);
+// virtual DECLARE_READ8_MEMBER(chip_read);
+// virtual DECLARE_WRITE8_MEMBER(chip_write);
protected:
// device-level overrides
diff --git a/src/devices/bus/snes/sufami.cpp b/src/devices/bus/snes/sufami.cpp
index 7589fb84fa4..3e163e150e5 100644
--- a/src/devices/bus/snes/sufami.cpp
+++ b/src/devices/bus/snes/sufami.cpp
@@ -66,12 +66,12 @@ void sns_rom_sufami_device::device_add_mconfig(machine_config &config)
mapper specific handlers
-------------------------------------------------*/
-uint8_t sns_rom_sufami_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom_sufami_device::read_l)
{
- return read_h(offset);
+ return read_h(space, offset);
}
-uint8_t sns_rom_sufami_device::read_h(offs_t offset)
+READ8_MEMBER(sns_rom_sufami_device::read_h)
{
int bank;
@@ -82,11 +82,11 @@ uint8_t sns_rom_sufami_device::read_h(offs_t offset)
}
if (offset >= 0x200000 && offset < 0x400000) // SLOT1 STROM
{
- return m_slot1->read_l(offset - 0x200000);
+ return m_slot1->read_l(space, offset - 0x200000);
}
if (offset >= 0x400000 && offset < 0x600000) // SLOT2 STROM
{
- return m_slot2->read_l(offset - 0x400000);
+ return m_slot2->read_l(space, offset - 0x400000);
}
if (offset >= 0x600000 && offset < 0x640000) // SLOT1 RAM
{
@@ -94,7 +94,7 @@ uint8_t sns_rom_sufami_device::read_h(offs_t offset)
{
offset -= 0x600000;
bank = offset / 0x10000;
- return m_slot1->read_ram(bank * 0x8000 + (offset & 0x7fff));
+ return m_slot1->read_ram(space, bank * 0x8000 + (offset & 0x7fff));
}
}
if (offset >= 0x700000 && offset < 0x740000) // SLOT2 RAM
@@ -103,19 +103,19 @@ uint8_t sns_rom_sufami_device::read_h(offs_t offset)
{
offset -= 0x700000;
bank = offset / 0x10000;
- return m_slot2->read_ram(bank * 0x8000 + (offset & 0x7fff));
+ return m_slot2->read_ram(space, bank * 0x8000 + (offset & 0x7fff));
}
}
return 0xff;
}
-void sns_rom_sufami_device::write_l(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_rom_sufami_device::write_l)
{
- write_h(offset, data);
+ write_h(space, offset, data);
}
-void sns_rom_sufami_device::write_h(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sns_rom_sufami_device::write_h)
{
int bank;
if (offset >= 0x600000 && offset < 0x640000) // SLOT1 RAM
@@ -124,7 +124,7 @@ void sns_rom_sufami_device::write_h(offs_t offset, uint8_t data)
{
offset -= 0x600000;
bank = offset / 0x10000;
- m_slot1->write_ram(bank * 0x8000 + (offset & 0x7fff), data);
+ m_slot1->write_ram(space, bank * 0x8000 + (offset & 0x7fff), data);
}
}
@@ -134,7 +134,7 @@ void sns_rom_sufami_device::write_h(offs_t offset, uint8_t data)
{
offset -= 0x700000;
bank = offset / 0x10000;
- m_slot2->write_ram(bank * 0x8000 + (offset & 0x7fff), data);
+ m_slot2->write_ram(space, bank * 0x8000 + (offset & 0x7fff), data);
}
}
@@ -144,7 +144,7 @@ void sns_rom_sufami_device::write_h(offs_t offset, uint8_t data)
Sufami Turbo 'minicart' emulation
-------------------------------------------------*/
-uint8_t sns_rom_strom_device::read_l(offs_t offset)
+READ8_MEMBER(sns_rom_strom_device::read_l)
{
if (offset < 0x200000)
{
diff --git a/src/devices/bus/snes/sufami.h b/src/devices/bus/snes/sufami.h
index 1b231131a2b..6b4b3df3bea 100644
--- a/src/devices/bus/snes/sufami.h
+++ b/src/devices/bus/snes/sufami.h
@@ -18,10 +18,10 @@ public:
sns_rom_sufami_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// additional reading and writing
- virtual uint8_t read_l(offs_t offset) override;
- virtual uint8_t read_h(offs_t offset) override;
- virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void write_h(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
+ virtual DECLARE_READ8_MEMBER(read_h) override;
+ virtual DECLARE_WRITE8_MEMBER(write_l) override;
+ virtual DECLARE_WRITE8_MEMBER(write_h) override;
protected:
// device-level overrides
@@ -43,7 +43,7 @@ public:
sns_rom_strom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// additional reading and writing
- virtual uint8_t read_l(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_l) override;
protected:
// device-level overrides
diff --git a/src/devices/bus/snes/upd.cpp b/src/devices/bus/snes/upd.cpp
index 70396938e89..462ab0faf98 100644
--- a/src/devices/bus/snes/upd.cpp
+++ b/src/devices/bus/snes/upd.cpp
@@ -97,12 +97,12 @@ void sns_rom_setadsp_device::device_start()
// Lo-ROM
// DSP dump contains prg at offset 0 and data at offset 0x2000
-uint32_t sns_rom20_necdsp_device::necdsp_prg_r(offs_t offset)
+READ32_MEMBER( sns_rom20_necdsp_device::necdsp_prg_r )
{
return get_prg(&m_bios[0], offset);
}
-uint16_t sns_rom20_necdsp_device::necdsp_data_r(offs_t offset)
+READ16_MEMBER( sns_rom20_necdsp_device::necdsp_data_r )
{
return get_data(&m_bios[0], offset + 0x2000/2);
}
@@ -132,21 +132,20 @@ void sns_rom20_necdsp_device::dsp_data_map_lorom(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void sns_rom20_necdsp_device::device_add_mconfig(machine_config &config)
-{
- UPD7725(config, m_upd7725, 8000000);
- m_upd7725->set_addrmap(AS_PROGRAM, &sns_rom20_necdsp_device::dsp_prg_map_lorom);
- m_upd7725->set_addrmap(AS_DATA, &sns_rom20_necdsp_device::dsp_data_map_lorom);
-}
+MACHINE_CONFIG_START(sns_rom20_necdsp_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dsp", UPD7725, 8000000)
+ MCFG_DEVICE_PROGRAM_MAP(dsp_prg_map_lorom)
+ MCFG_DEVICE_DATA_MAP(dsp_data_map_lorom)
+MACHINE_CONFIG_END
-uint8_t sns_rom20_necdsp_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_rom20_necdsp_device::chip_read )
{
offset &= 0x7fff;
return m_upd7725->snesdsp_read(offset < 0x4000);
}
-void sns_rom20_necdsp_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom20_necdsp_device::chip_write )
{
offset &= 0x7fff;
m_upd7725->snesdsp_write(offset < 0x4000, data);
@@ -156,12 +155,12 @@ void sns_rom20_necdsp_device::chip_write(offs_t offset, uint8_t data)
// Hi-ROM
// DSP dump contains prg at offset 0 and data at offset 0x2000
-uint32_t sns_rom21_necdsp_device::necdsp_prg_r(offs_t offset)
+READ32_MEMBER( sns_rom21_necdsp_device::necdsp_prg_r )
{
return get_prg(&m_bios[0], offset);
}
-uint16_t sns_rom21_necdsp_device::necdsp_data_r(offs_t offset)
+READ16_MEMBER( sns_rom21_necdsp_device::necdsp_data_r )
{
return get_data(&m_bios[0], offset + 0x2000/2);
}
@@ -190,21 +189,20 @@ void sns_rom21_necdsp_device::dsp_data_map_hirom(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void sns_rom21_necdsp_device::device_add_mconfig(machine_config &config)
-{
- UPD7725(config, m_upd7725, 8000000);
- m_upd7725->set_addrmap(AS_PROGRAM, &sns_rom21_necdsp_device::dsp_prg_map_hirom);
- m_upd7725->set_addrmap(AS_DATA, &sns_rom21_necdsp_device::dsp_data_map_hirom);
-}
+MACHINE_CONFIG_START(sns_rom21_necdsp_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dsp", UPD7725, 8000000)
+ MCFG_DEVICE_PROGRAM_MAP(dsp_prg_map_hirom)
+ MCFG_DEVICE_DATA_MAP(dsp_data_map_hirom)
+MACHINE_CONFIG_END
-uint8_t sns_rom21_necdsp_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_rom21_necdsp_device::chip_read )
{
offset &= 0x1fff;
return m_upd7725->snesdsp_read(offset < 0x1000);
}
-void sns_rom21_necdsp_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom21_necdsp_device::chip_write )
{
offset &= 0x1fff;
m_upd7725->snesdsp_write(offset < 0x1000, data);
@@ -217,7 +215,7 @@ void sns_rom21_necdsp_device::chip_write(offs_t offset, uint8_t data)
// same as above but additional read/write handling for the add-on chip
-uint8_t sns_rom_setadsp_device::chip_read(offs_t offset)
+READ8_MEMBER( sns_rom_setadsp_device::chip_read )
{
if (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)
m_upd96050->snesdsp_read((offset & 0x01) ? false : true);
@@ -236,7 +234,7 @@ uint8_t sns_rom_setadsp_device::chip_read(offs_t offset)
}
-void sns_rom_setadsp_device::chip_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sns_rom_setadsp_device::chip_write )
{
if (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)
{
@@ -267,12 +265,12 @@ void sns_rom_setadsp_device::chip_write(offs_t offset, uint8_t data)
// DSP dump contains prg at offset 0 and data at offset 0x10000
-uint32_t sns_rom_setadsp_device::setadsp_prg_r(offs_t offset)
+READ32_MEMBER( sns_rom_setadsp_device::setadsp_prg_r )
{
return get_prg(&m_bios[0], offset);
}
-uint16_t sns_rom_setadsp_device::setadsp_data_r(offs_t offset)
+READ16_MEMBER( sns_rom_setadsp_device::setadsp_data_r )
{
return get_data(&m_bios[0], offset + 0x10000/2);
}
@@ -302,20 +300,18 @@ void sns_rom_setadsp_device::st01x_data_map(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void sns_rom_seta10dsp_device::device_add_mconfig(machine_config &config)
-{
- UPD96050(config, m_upd96050, 10000000);
- m_upd96050->set_addrmap(AS_PROGRAM, &sns_rom_seta10dsp_device::st01x_prg_map);
- m_upd96050->set_addrmap(AS_DATA, &sns_rom_seta10dsp_device::st01x_data_map);
-}
+MACHINE_CONFIG_START(sns_rom_seta10dsp_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dsp", UPD96050, 10000000)
+ MCFG_DEVICE_PROGRAM_MAP(st01x_prg_map)
+ MCFG_DEVICE_DATA_MAP(st01x_data_map)
+MACHINE_CONFIG_END
-void sns_rom_seta11dsp_device::device_add_mconfig(machine_config &config)
-{
- UPD96050(config, m_upd96050, 15000000);
- m_upd96050->set_addrmap(AS_PROGRAM, &sns_rom_seta11dsp_device::st01x_prg_map);
- m_upd96050->set_addrmap(AS_DATA, &sns_rom_seta11dsp_device::st01x_data_map);
-}
+MACHINE_CONFIG_START(sns_rom_seta11dsp_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dsp", UPD96050, 15000000)
+ MCFG_DEVICE_PROGRAM_MAP(st01x_prg_map)
+ MCFG_DEVICE_DATA_MAP(st01x_data_map)
+MACHINE_CONFIG_END
// To make faster DSP access to its internal rom, let's install read banks and map m_bios there with correct byte order
@@ -415,61 +411,53 @@ sns_rom_seta11dsp_legacy_device::sns_rom_seta11dsp_legacy_device(const machine_c
}
-void sns_rom20_necdsp1_legacy_device::device_add_mconfig(machine_config &config)
-{
- UPD7725(config, m_upd7725, 8000000);
- m_upd7725->set_addrmap(AS_PROGRAM, &sns_rom20_necdsp1_legacy_device::dsp_prg_map_lorom);
- m_upd7725->set_addrmap(AS_DATA, &sns_rom20_necdsp1_legacy_device::dsp_data_map_lorom);
-}
-
-void sns_rom20_necdsp1b_legacy_device::device_add_mconfig(machine_config &config)
-{
- UPD7725(config, m_upd7725, 8000000);
- m_upd7725->set_addrmap(AS_PROGRAM, &sns_rom20_necdsp1b_legacy_device::dsp_prg_map_lorom);
- m_upd7725->set_addrmap(AS_DATA, &sns_rom20_necdsp1b_legacy_device::dsp_data_map_lorom);
-}
-
-void sns_rom20_necdsp2_legacy_device::device_add_mconfig(machine_config &config)
-{
- UPD7725(config, m_upd7725, 8000000);
- m_upd7725->set_addrmap(AS_PROGRAM, &sns_rom20_necdsp2_legacy_device::dsp_prg_map_lorom);
- m_upd7725->set_addrmap(AS_DATA, &sns_rom20_necdsp2_legacy_device::dsp_data_map_lorom);
-}
-
-void sns_rom20_necdsp3_legacy_device::device_add_mconfig(machine_config &config)
-{
- UPD7725(config, m_upd7725, 8000000);
- m_upd7725->set_addrmap(AS_PROGRAM, &sns_rom20_necdsp3_legacy_device::dsp_prg_map_lorom);
- m_upd7725->set_addrmap(AS_DATA, &sns_rom20_necdsp3_legacy_device::dsp_data_map_lorom);
-}
-
-void sns_rom20_necdsp4_legacy_device::device_add_mconfig(machine_config &config)
-{
- UPD7725(config, m_upd7725, 8000000);
- m_upd7725->set_addrmap(AS_PROGRAM, &sns_rom20_necdsp4_legacy_device::dsp_prg_map_lorom);
- m_upd7725->set_addrmap(AS_DATA, &sns_rom20_necdsp4_legacy_device::dsp_data_map_lorom);
-}
-
-void sns_rom21_necdsp1_legacy_device::device_add_mconfig(machine_config &config)
-{
- UPD7725(config, m_upd7725, 8000000);
- m_upd7725->set_addrmap(AS_PROGRAM, &sns_rom21_necdsp1_legacy_device::dsp_prg_map_hirom);
- m_upd7725->set_addrmap(AS_DATA, &sns_rom21_necdsp1_legacy_device::dsp_data_map_hirom);
-}
-
-void sns_rom_seta10dsp_legacy_device::device_add_mconfig(machine_config &config)
-{
- UPD96050(config, m_upd96050, 10000000);
- m_upd96050->set_addrmap(AS_PROGRAM, &sns_rom_seta10dsp_legacy_device::st01x_prg_map);
- m_upd96050->set_addrmap(AS_DATA, &sns_rom_seta10dsp_legacy_device::st01x_data_map);
-}
-
-void sns_rom_seta11dsp_legacy_device::device_add_mconfig(machine_config &config)
-{
- UPD96050(config, m_upd96050, 15000000);
- m_upd96050->set_addrmap(AS_PROGRAM, &sns_rom_seta11dsp_legacy_device::st01x_prg_map);
- m_upd96050->set_addrmap(AS_DATA, &sns_rom_seta11dsp_legacy_device::st01x_data_map);
-}
+MACHINE_CONFIG_START(sns_rom20_necdsp1_legacy_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dsp", UPD7725, 8000000)
+ MCFG_DEVICE_PROGRAM_MAP(dsp_prg_map_lorom)
+ MCFG_DEVICE_DATA_MAP(dsp_data_map_lorom)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(sns_rom20_necdsp1b_legacy_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dsp", UPD7725, 8000000)
+ MCFG_DEVICE_PROGRAM_MAP(dsp_prg_map_lorom)
+ MCFG_DEVICE_DATA_MAP(dsp_data_map_lorom)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(sns_rom20_necdsp2_legacy_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dsp", UPD7725, 8000000)
+ MCFG_DEVICE_PROGRAM_MAP(dsp_prg_map_lorom)
+ MCFG_DEVICE_DATA_MAP(dsp_data_map_lorom)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(sns_rom20_necdsp3_legacy_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dsp", UPD7725, 8000000)
+ MCFG_DEVICE_PROGRAM_MAP(dsp_prg_map_lorom)
+ MCFG_DEVICE_DATA_MAP(dsp_data_map_lorom)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(sns_rom20_necdsp4_legacy_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dsp", UPD7725, 8000000)
+ MCFG_DEVICE_PROGRAM_MAP(dsp_prg_map_lorom)
+ MCFG_DEVICE_DATA_MAP(dsp_data_map_lorom)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(sns_rom21_necdsp1_legacy_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dsp", UPD7725, 8000000)
+ MCFG_DEVICE_PROGRAM_MAP(dsp_prg_map_hirom)
+ MCFG_DEVICE_DATA_MAP(dsp_data_map_hirom)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(sns_rom_seta10dsp_legacy_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dsp", UPD96050, 10000000)
+ MCFG_DEVICE_PROGRAM_MAP(st01x_prg_map)
+ MCFG_DEVICE_DATA_MAP(st01x_data_map)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(sns_rom_seta11dsp_legacy_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dsp", UPD96050, 15000000)
+ MCFG_DEVICE_PROGRAM_MAP(st01x_prg_map)
+ MCFG_DEVICE_DATA_MAP(st01x_data_map)
+MACHINE_CONFIG_END
ROM_START( snes_dsp1 )
diff --git a/src/devices/bus/snes/upd.h b/src/devices/bus/snes/upd.h
index 65dd780c725..dfc55466225 100644
--- a/src/devices/bus/snes/upd.h
+++ b/src/devices/bus/snes/upd.h
@@ -28,18 +28,18 @@ protected:
virtual void speedup_addon_bios_access() override;
// additional reading and writing
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(chip_read) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override;
- uint32_t necdsp_prg_r(offs_t offset);
- uint16_t necdsp_data_r(offs_t offset);
+ virtual DECLARE_READ32_MEMBER(necdsp_prg_r);
+ virtual DECLARE_READ16_MEMBER(necdsp_data_r);
void dsp_data_map_lorom(address_map &map);
void dsp_prg_map_lorom(address_map &map);
+private:
required_device<upd7725_device> m_upd7725;
-private:
std::vector<uint32_t> m_dsp_prg;
std::vector<uint16_t> m_dsp_data;
};
@@ -62,18 +62,18 @@ protected:
virtual void speedup_addon_bios_access() override;
// additional reading and writing
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(chip_read) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override;
- uint32_t necdsp_prg_r(offs_t offset);
- uint16_t necdsp_data_r(offs_t offset);
+ virtual DECLARE_READ32_MEMBER(necdsp_prg_r);
+ virtual DECLARE_READ16_MEMBER(necdsp_data_r);
void dsp_data_map_hirom(address_map &map);
void dsp_prg_map_hirom(address_map &map);
+private:
required_device<upd7725_device> m_upd7725;
-private:
std::vector<uint32_t> m_dsp_prg;
std::vector<uint16_t> m_dsp_data;
};
@@ -93,18 +93,18 @@ protected:
virtual void device_start() override;
// additional reading and writing
- virtual uint8_t chip_read(offs_t offset) override;
- virtual void chip_write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(chip_read) override;
+ virtual DECLARE_WRITE8_MEMBER(chip_write) override;
- virtual uint32_t setadsp_prg_r(offs_t offset);
- virtual uint16_t setadsp_data_r(offs_t offset);
+ virtual DECLARE_READ32_MEMBER(setadsp_prg_r);
+ virtual DECLARE_READ16_MEMBER(setadsp_data_r);
void st01x_data_map(address_map &map);
void st01x_prg_map(address_map &map);
+private:
required_device<upd96050_device> m_upd96050;
-private:
std::vector<uint32_t> m_dsp_prg;
std::vector<uint16_t> m_dsp_data;
};
diff --git a/src/devices/bus/snes_ctrl/ctrl.h b/src/devices/bus/snes_ctrl/ctrl.h
index 37db69537cc..686db2f29e2 100644
--- a/src/devices/bus/snes_ctrl/ctrl.h
+++ b/src/devices/bus/snes_ctrl/ctrl.h
@@ -51,7 +51,7 @@ public:
// construction/destruction
template <typename T>
snes_control_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : snes_control_port_device(mconfig, tag, owner, 0)
+ : snes_control_port_device(mconfig, tag, owner, (uint32_t)0)
{
option_reset();
opts(*this);
@@ -61,8 +61,8 @@ public:
snes_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
virtual ~snes_control_port_device();
- template <typename... T> void set_onscreen_callback(T &&... args) { m_onscreen_cb = snesctrl_onscreen_delegate(std::forward<T>(args)...); }
- template <typename... T> void set_gunlatch_callback(T &&... args) { m_gunlatch_cb = snesctrl_gunlatch_delegate(std::forward<T>(args)...); }
+ template <typename Object> void set_onscreen_callback(Object &&cb) { m_onscreen_cb = std::forward<Object>(cb); }
+ template <typename Object> void set_gunlatch_callback(Object &&cb) { m_gunlatch_cb = std::forward<Object>(cb); }
uint8_t read_pin4();
uint8_t read_pin5();
@@ -87,6 +87,22 @@ protected:
// device type definition
DECLARE_DEVICE_TYPE(SNES_CONTROL_PORT, snes_control_port_device)
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_SNES_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, SNES_CONTROL_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+#define MCFG_SNESCTRL_ONSCREEN_CB(_class, _method) \
+ downcast<snes_control_port_device &>(*device).set_onscreen_callback(snesctrl_onscreen_delegate(&_class::_method, #_class "::" #_method, this));
+
+#define MCFG_SNESCTRL_GUNLATCH_CB(_class, _method) \
+ downcast<snes_control_port_device &>(*device).set_gunlatch_callback(snesctrl_gunlatch_delegate(&_class::_method, #_class "::" #_method, this));
+
+
void snes_control_port_devices(device_slot_interface &device);
diff --git a/src/devices/bus/snes_ctrl/miracle.cpp b/src/devices/bus/snes_ctrl/miracle.cpp
index a0d9c70874c..a20a6743709 100644
--- a/src/devices/bus/snes_ctrl/miracle.cpp
+++ b/src/devices/bus/snes_ctrl/miracle.cpp
@@ -23,12 +23,12 @@
DEFINE_DEVICE_TYPE(SNES_MIRACLE, snes_miracle_device, "snes_miracle", "Miracle Piano SNES Cable")
-void snes_miracle_device::device_add_mconfig(machine_config &config)
-{
- MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(FUNC(snes_miracle_device::rx_w));
+MACHINE_CONFIG_START(snes_miracle_device::device_add_mconfig)
+ MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
+ MCFG_MIDI_RX_HANDLER(WRITELINE(*this, snes_miracle_device, rx_w))
- MIDI_PORT(config, "mdout", midiout_slot, "midiout");
-}
+ MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/bus/snes_ctrl/multitap.cpp b/src/devices/bus/snes_ctrl/multitap.cpp
index ef630439276..262ef56fd26 100644
--- a/src/devices/bus/snes_ctrl/multitap.cpp
+++ b/src/devices/bus/snes_ctrl/multitap.cpp
@@ -47,13 +47,12 @@ static void snes_multitap(device_slot_interface &device)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void snes_multitap_device::device_add_mconfig(machine_config &config)
-{
- SNES_CONTROL_PORT(config, m_port1, snes_multitap, "joypad");
- SNES_CONTROL_PORT(config, m_port2, snes_multitap, "joypad");
- SNES_CONTROL_PORT(config, m_port3, snes_multitap, "joypad");
- SNES_CONTROL_PORT(config, m_port4, snes_multitap, "joypad");
-}
+MACHINE_CONFIG_START(snes_multitap_device::device_add_mconfig)
+ MCFG_SNES_CONTROL_PORT_ADD("port1", snes_multitap, "joypad")
+ MCFG_SNES_CONTROL_PORT_ADD("port2", snes_multitap, "joypad")
+ MCFG_SNES_CONTROL_PORT_ADD("port3", snes_multitap, "joypad")
+ MCFG_SNES_CONTROL_PORT_ADD("port4", snes_multitap, "joypad")
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/spc1000/exp.h b/src/devices/bus/spc1000/exp.h
index d10fe516401..b281e7a560c 100644
--- a/src/devices/bus/spc1000/exp.h
+++ b/src/devices/bus/spc1000/exp.h
@@ -28,15 +28,6 @@ class spc1000_exp_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- template <typename T>
- spc1000_exp_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts)
- : spc1000_exp_device(mconfig, tag, owner, (uint32_t)0)
- {
- opts(*this);
- set_default_option(nullptr);
- set_fixed(false);
- }
-
spc1000_exp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~spc1000_exp_device();
diff --git a/src/devices/bus/spectrum/beta.cpp b/src/devices/bus/spectrum/beta.cpp
deleted file mode 100644
index e48bed34e52..00000000000
--- a/src/devices/bus/spectrum/beta.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/*********************************************************************
-
- Technology Research Beta 128 Disk interface
-
-*********************************************************************/
-
-#include "emu.h"
-#include "beta.h"
-
-
-/***************************************************************************
- DEVICE DEFINITIONS
-***************************************************************************/
-
-DEFINE_DEVICE_TYPE(SPECTRUM_BETA128, spectrum_beta128_device, "spectrum_beta128", "TR Beta 128 Disk Interface")
-
-
-//-------------------------------------------------
-// INPUT_PORTS( beta128 )
-//-------------------------------------------------
-
-INPUT_PORTS_START(beta128)
- PORT_START("BUTTON")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Magic Button") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, spectrum_beta128_device, magic_button, nullptr)
-
- PORT_START("SWITCH")
- PORT_CONFNAME(0x03, 0x01, "System Switch") //PORT_CHANGED_MEMBER(DEVICE_SELF, spectrum_beta128_device, switch_changed, 0)
- PORT_CONFSETTING(0x00, "Off (128)")
- PORT_CONFSETTING(0x01, "Normal (auto-boot)")
- //PORT_CONFSETTING(0x02, "Reset") // TODO: implement RESET callback
-INPUT_PORTS_END
-
-//-------------------------------------------------
-// input_ports - device-specific input ports
-//-------------------------------------------------
-
-ioport_constructor spectrum_beta128_device::device_input_ports() const
-{
- return INPUT_PORTS_NAME(beta128);
-}
-
-//-------------------------------------------------
-// SLOT_INTERFACE( beta_floppies )
-//-------------------------------------------------
-
-static void beta_floppies(device_slot_interface &device)
-{
- device.option_add("525qd", FLOPPY_525_QD);
-}
-
-//-------------------------------------------------
-// floppy_format_type floppy_formats
-//-------------------------------------------------
-
-FLOPPY_FORMATS_MEMBER(spectrum_beta128_device::floppy_formats)
- FLOPPY_TRD_FORMAT
-FLOPPY_FORMATS_END
-
-//-------------------------------------------------
-// ROM( beta )
-//-------------------------------------------------
-
-ROM_START(beta128)
- ROM_REGION(0x4000, "rom", 0)
- ROM_DEFAULT_BIOS("trd504")
- ROM_SYSTEM_BIOS(0, "trd501", "TR-DOS v5.01")
- ROMX_LOAD("trd501.rom", 0x0000, 0x4000, CRC(3e3cdd4c) SHA1(8303ba0cc79daa6c04cd1e6ce27e8b6886a3f0de), ROM_BIOS(0))
- ROM_SYSTEM_BIOS(1, "trd503", "TR-DOS v5.03")
- ROMX_LOAD("trd503.rom", 0x0000, 0x4000, CRC(10751aba) SHA1(21695e3f2a8f796386ce66eea8a246b0ac44810c), ROM_BIOS(1))
- ROM_SYSTEM_BIOS(2, "trd504", "TR-DOS v5.04")
- ROMX_LOAD("trd504.rom", 0x0000, 0x4000, CRC(ba310874) SHA1(05e55e37df8eee6c68601ba9cf6c92195852ce3f), ROM_BIOS(2))
-ROM_END
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void spectrum_beta128_device::device_add_mconfig(machine_config &config)
-{
- FD1793(config, m_fdc, 4_MHz_XTAL / 4);
- FLOPPY_CONNECTOR(config, "fdc:0", beta_floppies, "525qd", spectrum_beta128_device::floppy_formats).enable_sound(true);
- FLOPPY_CONNECTOR(config, "fdc:1", beta_floppies, "525qd", spectrum_beta128_device::floppy_formats).enable_sound(true);
- FLOPPY_CONNECTOR(config, "fdc:2", beta_floppies, nullptr, spectrum_beta128_device::floppy_formats).enable_sound(true);
- FLOPPY_CONNECTOR(config, "fdc:3", beta_floppies, nullptr, spectrum_beta128_device::floppy_formats).enable_sound(true);
-
- // passthru
- SPECTRUM_EXPANSION_SLOT(config, m_exp, spectrum_expansion_devices, nullptr);
- m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::irq_w));
- m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::nmi_w));
-}
-
-const tiny_rom_entry *spectrum_beta128_device::device_rom_region() const
-{
- return ROM_NAME(beta128);
-}
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// spectrum_beta128_device - constructor
-//-------------------------------------------------
-
-spectrum_beta128_device::spectrum_beta128_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, SPECTRUM_BETA128, tag, owner, clock)
- , device_spectrum_expansion_interface(mconfig, *this)
- , m_rom(*this, "rom")
- , m_fdc(*this, "fdc")
- , m_floppy(*this, "fdc:%u", 0)
- , m_exp(*this, "exp")
- , m_switch(*this, "SWITCH")
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void spectrum_beta128_device::device_start()
-{
- save_item(NAME(m_romcs));
-}
-
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void spectrum_beta128_device::device_reset()
-{
- // Page in the ROM if auto-boot is selected
- if (m_switch->read() == 0x01)
- m_romcs = 1;
- else
- m_romcs = 0;
-}
-
-//**************************************************************************
-// IMPLEMENTATION
-//**************************************************************************
-
-READ_LINE_MEMBER(spectrum_beta128_device::romcs)
-{
- return m_romcs | m_exp->romcs();
-}
-
-
-void spectrum_beta128_device::opcode_fetch(offs_t offset)
-{
- m_exp->opcode_fetch(offset);
-
- if (!machine().side_effects_disabled())
- {
- if ((offset == 0x0066) || (offset & 0xff00) == 0x3d00)
- m_romcs = 1;
- else if (offset >= 0x4000)
- m_romcs = 0;
- }
-}
-
-uint8_t spectrum_beta128_device::iorq_r(offs_t offset)
-{
- uint8_t data = m_exp->iorq_r(offset);
-
- if (m_romcs)
- {
- switch (offset & 0xff)
- {
- case 0x1f: case 0x3f: case 0x5f: case 0x7f:
- data = m_fdc->read((offset >> 5) & 0x03);
- break;
-
- case 0xff:
- data &= 0x3f; // actually open bus
- data |= m_fdc->drq_r() ? 0x40 : 0;
- data |= m_fdc->intrq_r() ? 0x80 : 0;
- break;
- }
- }
- return data;
-}
-
-void spectrum_beta128_device::iorq_w(offs_t offset, uint8_t data)
-{
- if (m_romcs)
- {
- switch (offset & 0xff)
- {
- case 0x1f: case 0x3f: case 0x5f: case 0x7f:
- m_fdc->write((offset >> 5) & 0x03, data);
- break;
-
- case 0xff:
- floppy_image_device* floppy = m_floppy[data & 3]->get_device();
-
- m_fdc->set_floppy(floppy);
- if (floppy)
- floppy->ss_w(BIT(data, 4) ? 0 : 1);
- m_fdc->dden_w(BIT(data, 6));
-
- // bit 3 connected to pin 23 "HLT" of FDC and via diode to INDEX
- //m_fdc->hlt_w(BIT(data, 3)); // not handled in current wd_fdc
-
- if (BIT(data, 2) == 0) // reset
- {
- m_fdc->reset();
- if (floppy)
- floppy->mon_w(ASSERT_LINE);
- }
- else
- {
- // TODO: implement correct motor control, FDD motor and RDY FDC pin controlled by HLD pin of FDC
- if (floppy)
- floppy->mon_w(CLEAR_LINE);
- }
- break;
- }
- }
- m_exp->iorq_w(offset, data);
-}
-
-uint8_t spectrum_beta128_device::mreq_r(offs_t offset)
-{
- uint8_t data = 0xff;
-
- if (m_romcs)
- {
- data = m_rom->base()[offset & 0x3fff];
- }
-
- if (m_exp->romcs())
- data &= m_exp->mreq_r(offset);
-
- return data;
-}
-
-void spectrum_beta128_device::mreq_w(offs_t offset, uint8_t data)
-{
- if (m_exp->romcs())
- m_exp->mreq_w(offset, data);
-}
-
-INPUT_CHANGED_MEMBER(spectrum_beta128_device::magic_button)
-{
- if (newval && !oldval)
- {
- m_slot->nmi_w(ASSERT_LINE);
- }
- else
- {
- m_slot->nmi_w(CLEAR_LINE);
- }
-}
diff --git a/src/devices/bus/spectrum/beta.h b/src/devices/bus/spectrum/beta.h
deleted file mode 100644
index b759201d35d..00000000000
--- a/src/devices/bus/spectrum/beta.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/*********************************************************************
-
- Technology Research Beta 128 Disk interface
-
-*********************************************************************/
-#ifndef MAME_BUS_SPECTRUM_BETA_H
-#define MAME_BUS_SPECTRUM_BETA_H
-
-#include "exp.h"
-#include "softlist.h"
-#include "imagedev/floppy.h"
-#include "machine/wd_fdc.h"
-#include "formats/trd_dsk.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-class spectrum_beta128_device :
- public device_t,
- public device_spectrum_expansion_interface
-
-{
-public:
- // construction/destruction
- spectrum_beta128_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- DECLARE_FLOPPY_FORMATS(floppy_formats);
- DECLARE_INPUT_CHANGED_MEMBER(magic_button);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
- // optional information overrides
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
- virtual ioport_constructor device_input_ports() const override;
-
- virtual void opcode_fetch(offs_t offset) override;
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
- virtual DECLARE_READ_LINE_MEMBER(romcs) override;
-
- required_memory_region m_rom;
- required_device<fd1793_device> m_fdc;
- required_device_array<floppy_connector, 4> m_floppy;
- required_device<spectrum_expansion_slot_device> m_exp;
- required_ioport m_switch;
-
- int m_romcs;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(SPECTRUM_BETA128, spectrum_beta128_device)
-
-
-#endif // MAME_BUS_SPECTRUM_BETA_H
diff --git a/src/devices/bus/spectrum/exp.cpp b/src/devices/bus/spectrum/exp.cpp
index 850b9f88384..73e1d4a3a9a 100644
--- a/src/devices/bus/spectrum/exp.cpp
+++ b/src/devices/bus/spectrum/exp.cpp
@@ -43,6 +43,7 @@ device_spectrum_expansion_interface::device_spectrum_expansion_interface(const m
spectrum_expansion_slot_device::spectrum_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, SPECTRUM_EXPANSION_SLOT, tag, owner, clock),
device_slot_interface(mconfig, *this),
+ m_io(nullptr),
m_card(nullptr),
m_irq_handler(*this),
m_nmi_handler(*this)
@@ -86,57 +87,46 @@ void spectrum_expansion_slot_device::device_reset()
}
//-------------------------------------------------
-// romcs
-//-------------------------------------------------
-
-READ_LINE_MEMBER(spectrum_expansion_slot_device::romcs)
-{
- if (m_card)
- return m_card->romcs();
- else
- return 0;
-}
-
-//-------------------------------------------------
-// fetch_r
+// set_io_space - set address space we are attached to
//-------------------------------------------------
-void spectrum_expansion_slot_device::opcode_fetch(offs_t offset)
+void spectrum_expansion_slot_device::set_io_space(address_space *io)
{
- if (m_card)
- m_card->opcode_fetch(offset);
+ m_io = io;
}
//-------------------------------------------------
-// iorq_r
+// port_fe_r
//-------------------------------------------------
-uint8_t spectrum_expansion_slot_device::iorq_r(offs_t offset)
+READ8_MEMBER(spectrum_expansion_slot_device::port_fe_r)
{
if (m_card)
- return m_card->iorq_r(offset);
+ return m_card->port_fe_r(space, offset);
else
return 0xff;
}
//-------------------------------------------------
-// iorq_w
+// romcs
//-------------------------------------------------
-void spectrum_expansion_slot_device::iorq_w(offs_t offset, uint8_t data)
+READ_LINE_MEMBER(spectrum_expansion_slot_device::romcs)
{
if (m_card)
- m_card->iorq_w(offset, data);
+ return m_card->romcs();
+ else
+ return 0;
}
//-------------------------------------------------
// mreq_r
//-------------------------------------------------
-uint8_t spectrum_expansion_slot_device::mreq_r(offs_t offset)
+READ8_MEMBER(spectrum_expansion_slot_device::mreq_r)
{
if (m_card)
- return m_card->mreq_r(offset);
+ return m_card->mreq_r(space, offset);
else
return 0xff;
}
@@ -145,10 +135,10 @@ uint8_t spectrum_expansion_slot_device::mreq_r(offs_t offset)
// mreq_w
//-------------------------------------------------
-void spectrum_expansion_slot_device::mreq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(spectrum_expansion_slot_device::mreq_w)
{
if (m_card)
- m_card->mreq_w(offset, data);
+ m_card->mreq_w(space, offset, data);
}
@@ -158,20 +148,14 @@ void spectrum_expansion_slot_device::mreq_w(offs_t offset, uint8_t data)
// slot devices
-#include "beta.h"
-//#include "disciple.h"
#include "intf1.h"
#include "intf2.h"
#include "fuller.h"
#include "kempjoy.h"
#include "melodik.h"
-#include "mface.h"
#include "mikroplus.h"
-#include "opus.h"
#include "plus2test.h"
-//#include "plusd.h"
#include "protek.h"
-#include "specdrum.h"
#include "uslot.h"
#include "usource.h"
#include "uspeech.h"
@@ -179,21 +163,13 @@ void spectrum_expansion_slot_device::mreq_w(offs_t offset, uint8_t data)
void spectrum_expansion_devices(device_slot_interface &device)
{
- device.option_add("beta128", SPECTRUM_BETA128);
- //device.option_add("disciple", SPECTRUM_DISCIPLE);
device.option_add("intf1", SPECTRUM_INTF1);
device.option_add("intf2", SPECTRUM_INTF2);
device.option_add("fuller", SPECTRUM_FULLER);
device.option_add("kempjoy", SPECTRUM_KEMPJOY);
device.option_add("melodik", SPECTRUM_MELODIK);
- device.option_add("mface1", SPECTRUM_MFACE1);
- device.option_add("mface128", SPECTRUM_MFACE128);
device.option_add("mikroplus", SPECTRUM_MIKROPLUS);
- device.option_add("mprint", SPECTRUM_MPRINT);
- device.option_add("opus", SPECTRUM_OPUS);
- //device.option_add("plusd", SPECTRUM_PLUSD);
device.option_add("protek", SPECTRUM_PROTEK);
- device.option_add("specdrum", SPECTRUM_SPECDRUM);
device.option_add("uslot", SPECTRUM_USLOT);
device.option_add("usource", SPECTRUM_USOURCE);
device.option_add("uspeech", SPECTRUM_USPEECH);
@@ -201,22 +177,15 @@ void spectrum_expansion_devices(device_slot_interface &device)
void spec128_expansion_devices(device_slot_interface &device)
{
- device.option_add("beta128", SPECTRUM_BETA128);
- //device.option_add("disciple", SPECTRUM_DISCIPLE);
device.option_add("intf1", SPECTRUM_INTF1);
device.option_add("intf2", SPECTRUM_INTF2);
device.option_add("kempjoy", SPECTRUM_KEMPJOY);
- device.option_add("mface128", SPECTRUM_MFACE128);
device.option_add("mikroplus", SPECTRUM_MIKROPLUS);
- device.option_add("mprint", SPECTRUM_MPRINT);
- device.option_add("opus", SPECTRUM_OPUS);
device.option_add("plus2test", SPECTRUM_PLUS2TEST);
device.option_add("protek", SPECTRUM_PROTEK);
- device.option_add("specdrum", SPECTRUM_SPECDRUM);
}
void specpls3_expansion_devices(device_slot_interface &device)
{
- device.option_add("mface3", SPECTRUM_MFACE3);
}
diff --git a/src/devices/bus/spectrum/exp.h b/src/devices/bus/spectrum/exp.h
index aee398d1ab4..1d8eb5f21f2 100644
--- a/src/devices/bus/spectrum/exp.h
+++ b/src/devices/bus/spectrum/exp.h
@@ -69,20 +69,22 @@ public:
spectrum_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0);
+ void set_io_space(address_space *io);
+
// callbacks
auto irq_handler() { return m_irq_handler.bind(); }
auto nmi_handler() { return m_nmi_handler.bind(); }
- void opcode_fetch(offs_t offset);
- uint8_t mreq_r(offs_t offset);
- void mreq_w(offs_t offset, uint8_t data);
- uint8_t iorq_r(offs_t offset);
- void iorq_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( mreq_r );
+ DECLARE_WRITE8_MEMBER( mreq_w );
+ DECLARE_READ8_MEMBER( port_fe_r );
DECLARE_READ_LINE_MEMBER( romcs );
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_handler(state); }
DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); }
+ address_space *m_io;
+
protected:
// device-level overrides
virtual void device_validity_check(validity_checker &valid) const override;
@@ -106,14 +108,14 @@ public:
device_spectrum_expansion_interface(const machine_config &mconfig, device_t &device);
// reading and writing
- virtual void opcode_fetch(offs_t offset) { };
- virtual uint8_t mreq_r(offs_t offset) { return 0xff; }
- virtual void mreq_w(offs_t offset, uint8_t data) { }
- virtual uint8_t iorq_r(offs_t offset) { return 0xff; }
- virtual void iorq_w(offs_t offset, uint8_t data) { }
+ virtual DECLARE_READ8_MEMBER(mreq_r) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(mreq_w) { }
+ virtual DECLARE_READ8_MEMBER(port_fe_r) { return 0xff; }
virtual DECLARE_READ_LINE_MEMBER(romcs) { return 0; }
protected:
+ address_space &io_space() { return *m_slot->m_io; }
+
spectrum_expansion_slot_device *m_slot;
};
diff --git a/src/devices/bus/spectrum/fuller.cpp b/src/devices/bus/spectrum/fuller.cpp
index 636967cbdd6..36275ccc4cd 100644
--- a/src/devices/bus/spectrum/fuller.cpp
+++ b/src/devices/bus/spectrum/fuller.cpp
@@ -84,62 +84,51 @@ void spectrum_fuller_device::device_start()
}
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void spectrum_fuller_device::device_reset()
+{
+ m_exp->set_io_space(&io_space());
+
+ io_space().install_write_handler(0x3f, 0x3f, 0, 0xff00, 0, write8_delegate(FUNC(ay8910_device::address_w), m_psg.target()));
+ io_space().install_readwrite_handler(0x5f, 0x5f, 0, 0xff00, 0, read8_delegate(FUNC(ay8910_device::data_r), m_psg.target()), write8_delegate(FUNC(ay8910_device::data_w), m_psg.target()));
+ io_space().install_read_handler(0x7f, 0x7f, 0, 0xff00, 0, read8_delegate(FUNC(spectrum_fuller_device::joystick_r), this));
+}
+
+
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
+READ8_MEMBER(spectrum_fuller_device::joystick_r)
+{
+ return m_joy->read() | (0xff ^ 0x8f);
+}
+
READ_LINE_MEMBER(spectrum_fuller_device::romcs)
{
return m_exp->romcs();
}
-void spectrum_fuller_device::opcode_fetch(offs_t offset)
+READ8_MEMBER(spectrum_fuller_device::mreq_r)
{
- m_exp->opcode_fetch(offset);
+ return m_exp->mreq_r(space, offset);
}
-uint8_t spectrum_fuller_device::mreq_r(offs_t offset)
+WRITE8_MEMBER(spectrum_fuller_device::mreq_w)
{
- uint8_t data = 0xff;
-
if (m_exp->romcs())
- data &= m_exp->mreq_r(offset);
-
- return data;
+ m_exp->mreq_w(space, offset, data);
}
-void spectrum_fuller_device::mreq_w(offs_t offset, uint8_t data)
+READ8_MEMBER(spectrum_fuller_device::port_fe_r)
{
+ uint8_t data = 0xff;
+
if (m_exp->romcs())
- m_exp->mreq_w(offset, data);
-}
+ data &= m_exp->port_fe_r(space, offset);
-uint8_t spectrum_fuller_device::iorq_r(offs_t offset)
-{
- uint8_t data = m_exp->iorq_r(offset);
-
- switch (offset & 0xff)
- {
- case 0x5f:
- data &= m_psg->data_r();
- break;
- case 0x7f:
- data &= m_joy->read() | (0xff ^ 0x8f);
- break;
- }
return data;
}
-
-void spectrum_fuller_device::iorq_w(offs_t offset, uint8_t data)
-{
- switch (offset & 0xff)
- {
- case 0x3f:
- m_psg->address_w(data);
- break;
- case 0x5f:
- m_psg->data_w(data);
- break;
- }
- m_exp->iorq_w(offset, data);
-}
diff --git a/src/devices/bus/spectrum/fuller.h b/src/devices/bus/spectrum/fuller.h
index 12f7805eff0..b0431121424 100644
--- a/src/devices/bus/spectrum/fuller.h
+++ b/src/devices/bus/spectrum/fuller.h
@@ -32,19 +32,20 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
+ virtual void device_reset() override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
- virtual void opcode_fetch(offs_t offset) override;
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(mreq_r) override;
+ virtual DECLARE_WRITE8_MEMBER(mreq_w) override;
+ virtual DECLARE_READ8_MEMBER(port_fe_r) override;
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
private:
+ DECLARE_READ8_MEMBER(joystick_r);
+
required_device<spectrum_expansion_slot_device> m_exp;
required_device<ay8910_device> m_psg;
required_ioport m_joy;
diff --git a/src/devices/bus/spectrum/intf1.cpp b/src/devices/bus/spectrum/intf1.cpp
index 344aaf61841..d324e931e2c 100644
--- a/src/devices/bus/spectrum/intf1.cpp
+++ b/src/devices/bus/spectrum/intf1.cpp
@@ -85,7 +85,6 @@ spectrum_intf1_device::spectrum_intf1_device(const machine_config &mconfig, cons
void spectrum_intf1_device::device_start()
{
- save_item(NAME(m_romcs));
}
//-------------------------------------------------
@@ -94,6 +93,8 @@ void spectrum_intf1_device::device_start()
void spectrum_intf1_device::device_reset()
{
+ m_exp->set_io_space(&io_space());
+
m_romcs = 0;
}
@@ -106,49 +107,45 @@ READ_LINE_MEMBER(spectrum_intf1_device::romcs)
return m_romcs | m_exp->romcs();
}
-void spectrum_intf1_device::opcode_fetch(offs_t offset)
+READ8_MEMBER(spectrum_intf1_device::mreq_r)
{
- m_exp->opcode_fetch(offset);
+ uint8_t temp;
+ uint8_t data = 0xff;
if (!machine().side_effects_disabled())
{
- switch (offset)
- {
- case 0x0008: case 0x1708:
+ if (offset == 0x0008 || offset == 0x1708)
m_romcs = 1;
- break;
- case 0x0700:
- m_romcs = 0;
- break;
- }
}
-}
-uint8_t spectrum_intf1_device::mreq_r(offs_t offset)
-{
- uint8_t data = 0xff;
+ temp = m_exp->mreq_r(space, offset);
+ if (m_exp->romcs())
+ data &= temp;
if (m_romcs)
data &= m_rom->base()[offset & 0x1fff];
- if (m_exp->romcs())
- data &= m_exp->mreq_r(offset);
+ if (!machine().side_effects_disabled())
+ {
+ if (offset == 0x0700)
+ m_romcs = 0;
+ }
return data;
}
-void spectrum_intf1_device::mreq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(spectrum_intf1_device::mreq_w)
{
if (m_exp->romcs())
- m_exp->mreq_w(offset, data);
+ m_exp->mreq_w(space, offset, data);
}
-uint8_t spectrum_intf1_device::iorq_r(offs_t offset)
+READ8_MEMBER(spectrum_intf1_device::port_fe_r)
{
- return m_exp->iorq_r(offset);
-}
+ uint8_t data = 0xff;
-void spectrum_intf1_device::iorq_w(offs_t offset, uint8_t data)
-{
- m_exp->iorq_w(offset, data);
+ if (m_exp->romcs())
+ data &= m_exp->port_fe_r(space, offset);
+
+ return data;
}
diff --git a/src/devices/bus/spectrum/intf1.h b/src/devices/bus/spectrum/intf1.h
index 6b0ddb32804..5a21cd9927d 100644
--- a/src/devices/bus/spectrum/intf1.h
+++ b/src/devices/bus/spectrum/intf1.h
@@ -36,11 +36,9 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual void opcode_fetch(offs_t offset) override;
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(mreq_r) override;
+ virtual DECLARE_WRITE8_MEMBER(mreq_w) override;
+ virtual DECLARE_READ8_MEMBER(port_fe_r) override;
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
private:
diff --git a/src/devices/bus/spectrum/intf2.cpp b/src/devices/bus/spectrum/intf2.cpp
index 789be29717d..2700c2787d0 100644
--- a/src/devices/bus/spectrum/intf2.cpp
+++ b/src/devices/bus/spectrum/intf2.cpp
@@ -117,7 +117,7 @@ READ_LINE_MEMBER(spectrum_intf2_device::romcs)
return 0;
}
-uint8_t spectrum_intf2_device::mreq_r(offs_t offset)
+READ8_MEMBER(spectrum_intf2_device::mreq_r)
{
if (m_cart && m_cart->exists())
return m_cart->get_rom_base()[offset & 0x3fff];
@@ -125,20 +125,17 @@ uint8_t spectrum_intf2_device::mreq_r(offs_t offset)
return 0xff;
}
-uint8_t spectrum_intf2_device::iorq_r(offs_t offset)
+READ8_MEMBER(spectrum_intf2_device::port_fe_r)
{
uint8_t data = 0xff;
- switch (offset & 0xff)
- {
- case 0xfe:
- if (((offset >> 8) & 8) == 0)
- data = m_exp_line3->read() | (0xff ^ 0x1f);
+ uint8_t lines = offset >> 8;
- if (((offset >> 8) & 16) == 0)
- data = m_exp_line4->read() | (0xff ^ 0x1f);
- break;
- }
+ if ((lines & 8) == 0)
+ data = m_exp_line3->read() | (0xff ^ 0x1f);
+
+ if ((lines & 16) == 0)
+ data = m_exp_line4->read() | (0xff ^ 0x1f);
return data;
}
diff --git a/src/devices/bus/spectrum/intf2.h b/src/devices/bus/spectrum/intf2.h
index fd131112a3c..826e4b8fb3e 100644
--- a/src/devices/bus/spectrum/intf2.h
+++ b/src/devices/bus/spectrum/intf2.h
@@ -35,8 +35,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual uint8_t iorq_r(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(mreq_r) override;
+ virtual DECLARE_READ8_MEMBER(port_fe_r) override;
private:
image_init_result load_cart(device_image_interface &image, generic_slot_device *slot);
diff --git a/src/devices/bus/spectrum/kempjoy.cpp b/src/devices/bus/spectrum/kempjoy.cpp
index a433d615e8c..ac7d5698bd7 100644
--- a/src/devices/bus/spectrum/kempjoy.cpp
+++ b/src/devices/bus/spectrum/kempjoy.cpp
@@ -65,17 +65,21 @@ void spectrum_kempjoy_device::device_start()
}
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void spectrum_kempjoy_device::device_reset()
+{
+ io_space().install_read_handler(0x1f, 0x1f, 0, 0xff00, 0, read8_delegate(FUNC(spectrum_kempjoy_device::joystick_r), this));
+}
+
+
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
-uint8_t spectrum_kempjoy_device::iorq_r(offs_t offset)
+READ8_MEMBER(spectrum_kempjoy_device::joystick_r)
{
- uint8_t data = 0xff;
-
- if (offset == 0x1f)
- {
- data = m_joy->read() & 0x1f;
- }
- return data;
+ return m_joy->read() & 0x1f;
}
diff --git a/src/devices/bus/spectrum/kempjoy.h b/src/devices/bus/spectrum/kempjoy.h
index 466dceb7517..555fb67643a 100644
--- a/src/devices/bus/spectrum/kempjoy.h
+++ b/src/devices/bus/spectrum/kempjoy.h
@@ -31,13 +31,14 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
+ virtual void device_reset() override;
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t iorq_r(offs_t offset) override;
-
private:
+ DECLARE_READ8_MEMBER(joystick_r);
+
required_ioport m_joy;
};
diff --git a/src/devices/bus/spectrum/melodik.cpp b/src/devices/bus/spectrum/melodik.cpp
index f6abc0f98d6..8303d4c436c 100644
--- a/src/devices/bus/spectrum/melodik.cpp
+++ b/src/devices/bus/spectrum/melodik.cpp
@@ -60,6 +60,18 @@ void spectrum_melodik_device::device_start()
}
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void spectrum_melodik_device::device_reset()
+{
+ m_exp->set_io_space(&io_space());
+
+ io_space().install_write_handler(0x8000, 0x8000, 0, 0x3ffd, 0, write8_delegate(FUNC(ay8910_device::address_w), m_psg.target()));
+ io_space().install_readwrite_handler(0xc000, 0xc000, 0, 0x3ffd, 0, read8_delegate(FUNC(ay8910_device::data_r), m_psg.target()), write8_delegate(FUNC(ay8910_device::data_w), m_psg.target()));
+}
+
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
@@ -69,50 +81,23 @@ READ_LINE_MEMBER(spectrum_melodik_device::romcs)
return m_exp->romcs();
}
-void spectrum_melodik_device::opcode_fetch(offs_t offset)
+READ8_MEMBER(spectrum_melodik_device::mreq_r)
{
- m_exp->opcode_fetch(offset);
+ return m_exp->mreq_r(space, offset);
}
-uint8_t spectrum_melodik_device::mreq_r(offs_t offset)
+WRITE8_MEMBER(spectrum_melodik_device::mreq_w)
{
- uint8_t data = 0xff;
-
if (m_exp->romcs())
- data &= m_exp->mreq_r(offset);
-
- return data;
+ m_exp->mreq_w(space, offset, data);
}
-void spectrum_melodik_device::mreq_w(offs_t offset, uint8_t data)
+READ8_MEMBER(spectrum_melodik_device::port_fe_r)
{
+ uint8_t data = 0xff;
+
if (m_exp->romcs())
- m_exp->mreq_w(offset, data);
-}
+ data &= m_exp->port_fe_r(space, offset);
-uint8_t spectrum_melodik_device::iorq_r(offs_t offset)
-{
- uint8_t data = m_exp->iorq_r(offset);
-
- switch (offset & 0xc002)
- {
- case 0xc000:
- data &= m_psg->data_r();
- break;
- }
return data;
}
-
-void spectrum_melodik_device::iorq_w(offs_t offset, uint8_t data)
-{
- switch (offset & 0xc002)
- {
- case 0x8000:
- m_psg->address_w(data);
- break;
- case 0xc000:
- m_psg->data_w(data);
- break;
- }
- m_exp->iorq_w(offset, data);
-}
diff --git a/src/devices/bus/spectrum/melodik.h b/src/devices/bus/spectrum/melodik.h
index 4300d946cd4..2dc3c547836 100644
--- a/src/devices/bus/spectrum/melodik.h
+++ b/src/devices/bus/spectrum/melodik.h
@@ -32,15 +32,14 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
+ virtual void device_reset() override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
- virtual void opcode_fetch(offs_t offset) override;
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(mreq_r) override;
+ virtual DECLARE_WRITE8_MEMBER(mreq_w) override;
+ virtual DECLARE_READ8_MEMBER(port_fe_r) override;
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
private:
diff --git a/src/devices/bus/spectrum/mface.cpp b/src/devices/bus/spectrum/mface.cpp
deleted file mode 100644
index 559dd9ae1e6..00000000000
--- a/src/devices/bus/spectrum/mface.cpp
+++ /dev/null
@@ -1,321 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/*********************************************************************
-
- Romantic Robot Multiface One/128/3
-
-*********************************************************************/
-
-#include "emu.h"
-#include "mface.h"
-
-
-/***************************************************************************
- DEVICE DEFINITIONS
-***************************************************************************/
-
-DEFINE_DEVICE_TYPE(SPECTRUM_MFACE1, spectrum_mface1_device, "spectrum_mface1", "Multiface One")
-DEFINE_DEVICE_TYPE(SPECTRUM_MFACE128, spectrum_mface128_device, "spectrum_mface128", "Multiface 128")
-DEFINE_DEVICE_TYPE(SPECTRUM_MFACE3, spectrum_mface3_device, "spectrum_mface3", "Multiface 3")
-DEFINE_DEVICE_TYPE(SPECTRUM_MPRINT, spectrum_mprint_device, "spectrum_mprint", "MultiPrint")
-
-
-//-------------------------------------------------
-// INPUT_PORTS( mface )
-//-------------------------------------------------
-
-INPUT_PORTS_START(mface)
- PORT_START("BUTTON")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Multiface") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, spectrum_mface1_device, magic_button, nullptr)
-INPUT_PORTS_END
-
-//-------------------------------------------------
-// input_ports - device-specific input ports
-//-------------------------------------------------
-
-ioport_constructor spectrum_mface1_device::device_input_ports() const
-{
- return INPUT_PORTS_NAME(mface);
-}
-
-//-------------------------------------------------
-// ROM( mface1 )
-//-------------------------------------------------
-
-ROM_START(mface1)
- ROM_REGION(0x2000, "rom", 0)
- ROM_DEFAULT_BIOS("mu21e7")
- ROM_SYSTEM_BIOS(0, "mu20fe", "MU 2.0 FE")
- ROMX_LOAD("mf1_20_fe.rom", 0x0000, 0x2000, CRC(fa1b8b0d) SHA1(20cd508b0143166558a7238c7a9ccfbe37b90b0d), ROM_BIOS(0))
- ROM_SYSTEM_BIOS(1, "mu2167", "MU 2.1 67")
- ROMX_LOAD("mf1_21_67.rom", 0x0000, 0x2000, CRC(d720ec1b) SHA1(91a40d8f503ef825df3e2ed712897dbf4ca3671d), ROM_BIOS(1))
- ROM_SYSTEM_BIOS(2, "mu21e4", "MU 2.1 E4")
- ROMX_LOAD("mf1_21_e4.rom", 0x0000, 0x2000, CRC(4b31a971) SHA1(ba28754a3cc31a4ca579829ed4310c313409cf5d), ROM_BIOS(2))
- ROM_SYSTEM_BIOS(3, "mu21e7", "MU 2.1 E7")
- ROMX_LOAD("mf1_21_e7.rom", 0x0000, 0x2000, CRC(670f0ec2) SHA1(50fba2d628f3a2e9219f72980e4efd62fc9ec1f8), ROM_BIOS(3))
-ROM_END
-
-ROM_START(mface128)
- ROM_REGION(0x2000, "rom", 0)
- ROM_DEFAULT_BIOS("v363c")
- ROM_SYSTEM_BIOS(0, "v363c", "87.2 V36 3C")
- ROMX_LOAD("mf128_36_3c.rom", 0x0000, 0x2000, CRC(78ec8cfd) SHA1(8df204ab490b87c389971ce0c7fb5f9cbd281f14), ROM_BIOS(0))
-ROM_END
-
-ROM_START(mface3)
- ROM_REGION(0x2000, "rom", 0)
- ROM_DEFAULT_BIOS("v50fe")
- ROM_SYSTEM_BIOS(0, "v5013", "V50 13")
- ROMX_LOAD("mf3_50_13.rom", 0x0000, 0x2000, CRC(2d594640) SHA1(5d74d2e2e5a537639da92ff120f8a6d86f474495), ROM_BIOS(0))
- ROM_SYSTEM_BIOS(1, "v50fe", "V50 FE")
- ROMX_LOAD("mf3_50_fe.rom", 0x0000, 0x2000, CRC(b5c00f28) SHA1(983699a07665186f498f5827f9b35c442c2178ba), ROM_BIOS(1))
-ROM_END
-
-ROM_START(mprint)
- ROM_REGION(0x2000, "rom", 0)
- ROM_DEFAULT_BIOS("mpa8")
- ROM_SYSTEM_BIOS(0, "mp5a", "MP 5A")
- ROMX_LOAD("mprint_5a.rom", 0x0000, 0x2000, CRC(3a26e84b) SHA1(4714469bf25f69291f61188f52bfb11fbb8d0b33), ROM_BIOS(0))
- ROM_SYSTEM_BIOS(1, "mpa8", "MP A8")
- ROMX_LOAD("mprint_a8.rom", 0x0000, 0x2000, CRC(a5c58022) SHA1(1356bfae3264b952f83a33e25af536c0f13f50e7), ROM_BIOS(1))
-ROM_END
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void spectrum_mface1_device::device_add_mconfig(machine_config &config)
-{
- /* passthru */
- SPECTRUM_EXPANSION_SLOT(config, m_exp, spectrum_expansion_devices, nullptr);
- m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::irq_w));
- m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::nmi_w));
-}
-
-const tiny_rom_entry *spectrum_mface1_device::device_rom_region() const
-{
- return ROM_NAME(mface1);
-}
-
-const tiny_rom_entry *spectrum_mface128_device::device_rom_region() const
-{
- return ROM_NAME(mface128);
-}
-
-const tiny_rom_entry *spectrum_mface3_device::device_rom_region() const
-{
- return ROM_NAME(mface3);
-}
-
-const tiny_rom_entry *spectrum_mprint_device::device_rom_region() const
-{
- return ROM_NAME(mprint);
-}
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// spectrum_opus_device - constructor
-//-------------------------------------------------
-
-spectrum_mface1_device::spectrum_mface1_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_spectrum_expansion_interface(mconfig, *this)
- , m_rom(*this, "rom")
- , m_exp(*this, "exp")
-{
-}
-
-spectrum_mface1_device::spectrum_mface1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : spectrum_mface1_device(mconfig, SPECTRUM_MFACE1, tag, owner, clock)
-{
-}
-
-spectrum_mface128_device::spectrum_mface128_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : spectrum_mface1_device(mconfig, SPECTRUM_MFACE128, tag, owner, clock)
-{
-}
-
-spectrum_mface3_device::spectrum_mface3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : spectrum_mface1_device(mconfig, SPECTRUM_MFACE3, tag, owner, clock)
-{
-}
-
-spectrum_mprint_device::spectrum_mprint_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : spectrum_mface1_device(mconfig, SPECTRUM_MPRINT, tag, owner, clock)
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void spectrum_mface1_device::device_start()
-{
- save_item(NAME(m_romcs));
-}
-
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void spectrum_mface1_device::device_reset()
-{
- m_romcs = 0;
-}
-
-
-//**************************************************************************
-// IMPLEMENTATION
-//**************************************************************************
-
-READ_LINE_MEMBER(spectrum_mface1_device::romcs)
-{
- return m_romcs | m_exp->romcs();
-}
-
-void spectrum_mface1_device::opcode_fetch(offs_t offset)
-{
- m_exp->opcode_fetch(offset);
-
- if (!machine().side_effects_disabled())
- {
- if (offset == 0x0066)
- m_romcs = 1;
- }
-}
-
-uint8_t spectrum_mface1_device::iorq_r(offs_t offset)
-{
- uint8_t data = m_exp->iorq_r(offset);
-
- if (!machine().side_effects_disabled())
- {
- switch (offset & 0xff)
- {
- case 0x1f:
- m_romcs = 0;
- break;
- case 0x9f:
- m_romcs = 1;
- break;
- }
- }
- return data;
-}
-
-uint8_t spectrum_mface128_device::iorq_r(offs_t offset)
-{
- uint8_t data = m_exp->iorq_r(offset);
-
- if (!machine().side_effects_disabled())
- {
- switch (offset & 0xff)
- {
- case 0xbf:
- m_romcs = 1;
- break;
- case 0x3f:
- m_romcs = 0;
- break;
- }
- }
- return data;
-}
-
-uint8_t spectrum_mface3_device::iorq_r(offs_t offset)
-{
- uint8_t data = m_exp->iorq_r(offset);
-
- if (!machine().side_effects_disabled())
- {
- switch (offset & 0xff)
- {
- case 0x3f:
- m_romcs = 1;
- break;
- case 0xbf:
- m_romcs = 0;
- break;
- }
- }
- return data;
-}
-
-uint8_t spectrum_mprint_device::iorq_r(offs_t offset)
-{
- uint8_t data = m_exp->iorq_r(offset);
-
- if (!machine().side_effects_disabled())
- {
- switch (offset & 0xff)
- {
- case 0xbb:
- m_romcs = 1;
- break;
- case 0xbf:
- m_romcs = 0;
- break;
- }
- }
- return data;
-}
-
-void spectrum_mface1_device::iorq_w(offs_t offset, uint8_t data)
-{
- m_exp->iorq_w(offset, data);
-}
-
-uint8_t spectrum_mface1_device::mreq_r(offs_t offset)
-{
- uint8_t data = 0xff;
-
- if (m_romcs)
- {
- switch (offset & 0xe000)
- {
- case 0x0000:
- data = m_rom->base()[offset & 0x1fff];
- break;
- case 0x2000:
- data = m_ram[offset & 0x1fff];
- break;
- }
- }
-
- if (m_exp->romcs())
- data &= m_exp->mreq_r(offset);
-
- return data;
-}
-
-void spectrum_mface1_device::mreq_w(offs_t offset, uint8_t data)
-{
- if (m_romcs)
- {
- switch (offset & 0xe000)
- {
- case 0x2000:
- m_ram[offset & 0x1fff] = data;
- break;
- }
- }
-
- if (m_exp->romcs())
- m_exp->mreq_w(offset, data);
-}
-
-INPUT_CHANGED_MEMBER(spectrum_mface1_device::magic_button)
-{
- if (newval && !oldval)
- {
- m_slot->nmi_w(ASSERT_LINE);
- }
- else
- {
- m_slot->nmi_w(CLEAR_LINE);
- }
-}
diff --git a/src/devices/bus/spectrum/mface.h b/src/devices/bus/spectrum/mface.h
deleted file mode 100644
index bbe8311808c..00000000000
--- a/src/devices/bus/spectrum/mface.h
+++ /dev/null
@@ -1,100 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/*********************************************************************
-
- Romantic Robot Multiface One/128/3
-
-*********************************************************************/
-#ifndef MAME_BUS_SPECTRUM_MFACE_H
-#define MAME_BUS_SPECTRUM_MFACE_H
-
-#include "exp.h"
-
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-class spectrum_mface1_device :
- public device_t,
- public device_spectrum_expansion_interface
-
-{
-public:
- // construction/destruction
- spectrum_mface1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- DECLARE_INPUT_CHANGED_MEMBER(magic_button);
-
-protected:
- spectrum_mface1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
- // optional information overrides
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
- virtual ioport_constructor device_input_ports() const override;
-
- virtual void opcode_fetch(offs_t offset) override;
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
- virtual DECLARE_READ_LINE_MEMBER(romcs) override;
-
- required_memory_region m_rom;
- required_device<spectrum_expansion_slot_device> m_exp;
-
- uint8_t m_ram[8 * 1024];
- int m_romcs;
-};
-
-class spectrum_mface128_device : public spectrum_mface1_device
-{
-public:
- spectrum_mface128_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // optional information overrides
- virtual const tiny_rom_entry *device_rom_region() const override;
-
- virtual uint8_t iorq_r(offs_t offset) override;
-};
-
-class spectrum_mface3_device : public spectrum_mface1_device
-{
-public:
- spectrum_mface3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // optional information overrides
- virtual const tiny_rom_entry *device_rom_region() const override;
-
- virtual uint8_t iorq_r(offs_t offset) override;
-};
-
-class spectrum_mprint_device : public spectrum_mface1_device
-{
-public:
- spectrum_mprint_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // optional information overrides
- virtual const tiny_rom_entry *device_rom_region() const override;
-
- virtual uint8_t iorq_r(offs_t offset) override;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(SPECTRUM_MFACE1, spectrum_mface1_device)
-DECLARE_DEVICE_TYPE(SPECTRUM_MFACE128, spectrum_mface128_device)
-DECLARE_DEVICE_TYPE(SPECTRUM_MFACE3, spectrum_mface3_device)
-DECLARE_DEVICE_TYPE(SPECTRUM_MPRINT, spectrum_mprint_device)
-
-
-
-#endif // MAME_BUS_SPECTRUM_MFACE_H
diff --git a/src/devices/bus/spectrum/mikroplus.cpp b/src/devices/bus/spectrum/mikroplus.cpp
index 87552f79bf3..b0f0676aaee 100644
--- a/src/devices/bus/spectrum/mikroplus.cpp
+++ b/src/devices/bus/spectrum/mikroplus.cpp
@@ -85,19 +85,23 @@ void spectrum_mikroplus_device::device_start()
}
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void spectrum_mikroplus_device::device_reset()
+{
+ io_space().install_read_handler(0xdf, 0xdf, 0, 0xff00, 0, read8_delegate(FUNC(spectrum_mikroplus_device::joystick_r), this));
+}
+
+
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
-uint8_t spectrum_mikroplus_device::iorq_r(offs_t offset)
+READ8_MEMBER(spectrum_mikroplus_device::joystick_r)
{
- uint8_t data = 0xff;
-
- if (offset == 0xdf)
- {
- data = m_joy->read() | (0xff ^ 0x1f);
- }
- return data;
+ return m_joy->read() | (0xff ^ 0x1f);
}
READ_LINE_MEMBER(spectrum_mikroplus_device::romcs)
@@ -105,7 +109,7 @@ READ_LINE_MEMBER(spectrum_mikroplus_device::romcs)
return 1;
}
-uint8_t spectrum_mikroplus_device::mreq_r(offs_t offset)
+READ8_MEMBER(spectrum_mikroplus_device::mreq_r)
{
return m_rom->base()[offset & 0x3fff];
}
diff --git a/src/devices/bus/spectrum/mikroplus.h b/src/devices/bus/spectrum/mikroplus.h
index e06cb38bb2c..927cff5f56a 100644
--- a/src/devices/bus/spectrum/mikroplus.h
+++ b/src/devices/bus/spectrum/mikroplus.h
@@ -31,16 +31,18 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
+ virtual void device_reset() override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual uint8_t iorq_r(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(mreq_r) override;
private:
+ DECLARE_READ8_MEMBER(joystick_r);
+
required_memory_region m_rom;
required_ioport m_joy;
};
diff --git a/src/devices/bus/spectrum/opus.cpp b/src/devices/bus/spectrum/opus.cpp
deleted file mode 100644
index be73ef01e92..00000000000
--- a/src/devices/bus/spectrum/opus.cpp
+++ /dev/null
@@ -1,289 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- Opus Discovery disc system
-
-**********************************************************************/
-
-
-#include "emu.h"
-#include "opus.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(SPECTRUM_OPUS, spectrum_opus_device, "spectrum_opus", "Opus Discovery")
-
-
-//-------------------------------------------------
-// INPUT_PORTS( opus )
-//-------------------------------------------------
-
-static INPUT_PORTS_START( opus )
- PORT_START("JOY")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_8WAY
- PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_8WAY
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_8WAY
- PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_8WAY
- PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)
-INPUT_PORTS_END
-
-//-------------------------------------------------
-// input_ports - device-specific input ports
-//-------------------------------------------------
-
-ioport_constructor spectrum_opus_device::device_input_ports() const
-{
- return INPUT_PORTS_NAME( opus );
-}
-
-//-------------------------------------------------
-// MACHINE_DRIVER( opus )
-//-------------------------------------------------
-
-FLOPPY_FORMATS_MEMBER( spectrum_opus_device::floppy_formats )
- FLOPPY_OPD_FORMAT
-FLOPPY_FORMATS_END
-
-static void spectrum_floppies(device_slot_interface &device)
-{
- device.option_add("35ssdd", FLOPPY_35_SSDD);
- device.option_add("35dd", FLOPPY_35_DD);
-}
-
-ROM_START(opus)
- ROM_REGION(0x2000, "rom", 0)
- ROM_DEFAULT_BIOS("opus22")
- ROM_SYSTEM_BIOS(0, "opus22", "Opus v2.2")
- ROMX_LOAD("opus-22.rom", 0x0000, 0x2000, CRC(50f0eae0) SHA1(0eee1c503f71709fce8b7560dadc2d07d15edb80), ROM_BIOS(0))
- ROM_SYSTEM_BIOS(1, "opus21", "Opus v2.1")
- ROMX_LOAD("opus-21.rom", 0x0000, 0x2000, CRC(619973f9) SHA1(31999a68901392bba907cf5a15e264b6759f1a29), ROM_BIOS(1))
- ROM_SYSTEM_BIOS(2, "opus222", "Opus v2.22")
- ROMX_LOAD("opus-222.rom", 0x0000, 0x2000, CRC(08ce9949) SHA1(71f1c8a8b923f7751d1ff48d30b8e18a15b92591), ROM_BIOS(2))
- ROM_SYSTEM_BIOS(3, "quickdos", "QuickDOS v2.31") // MegaSoft
- ROMX_LOAD("quickdos-231.rom", 0x0000, 0x2000, CRC(d042b32a) SHA1(2975f7eb61d44e898cdd6e3196893e95637f17ff), ROM_BIOS(3))
- ROM_SYSTEM_BIOS(4, "excom", "EXCOM v2.28") // Paul Cheffings
- ROMX_LOAD("excom-228.rom", 0x0000, 0x2000, CRC(29257418) SHA1(098a812c4707251f647553a2abc1436afa38f43c), ROM_BIOS(4))
-ROM_END
-
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void spectrum_opus_device::device_add_mconfig(machine_config &config)
-{
- WD1770(config, m_fdc, 16_MHz_XTAL / 2);
- m_fdc->drq_wr_callback().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::nmi_w));
-
- FLOPPY_CONNECTOR(config, "fdc:0", spectrum_floppies, "35dd", spectrum_opus_device::floppy_formats).enable_sound(true);
- FLOPPY_CONNECTOR(config, "fdc:1", spectrum_floppies, "35dd", spectrum_opus_device::floppy_formats).enable_sound(true);
-
- /* parallel printer port */
- CENTRONICS(config, m_centronics, centronics_devices, "printer");
- m_centronics->ack_handler().set(m_pia, FUNC(pia6821_device::ca2_w));
- m_centronics->busy_handler().set(FUNC(spectrum_opus_device::busy_w));
-
- /* pia */
- PIA6821(config, m_pia, 0);
- m_pia->writepa_handler().set(FUNC(spectrum_opus_device::pia_out_a));
- m_pia->writepb_handler().set(FUNC(spectrum_opus_device::pia_out_b));
- m_pia->cb2_handler().set("centronics", FUNC(centronics_device::write_strobe));
-
- /* software list */
- SOFTWARE_LIST(config, "flop_list").set_original("spectrum_flop_opus");
-
- /* passthru without NMI */
- SPECTRUM_EXPANSION_SLOT(config, m_exp, spectrum_expansion_devices, nullptr);
- m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::irq_w));
-}
-
-const tiny_rom_entry *spectrum_opus_device::device_rom_region() const
-{
- return ROM_NAME( opus );
-}
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// spectrum_opus_device - constructor
-//-------------------------------------------------
-
-spectrum_opus_device::spectrum_opus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, SPECTRUM_OPUS, tag, owner, clock)
- , device_spectrum_expansion_interface(mconfig, *this)
- , m_joy(*this, "JOY")
- , m_rom(*this, "rom")
- , m_pia(*this, "pia")
- , m_fdc(*this, "fdc")
- , m_floppy0(*this, "fdc:0")
- , m_floppy1(*this, "fdc:1")
- , m_centronics(*this, "centronics")
- , m_exp(*this, "exp")
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void spectrum_opus_device::device_start()
-{
- memset(m_ram, 0, sizeof(m_ram));
-
- save_item(NAME(m_romcs));
- save_item(NAME(m_ram));
- save_item(NAME(m_last_pc));
-}
-
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void spectrum_opus_device::device_reset()
-{
- m_romcs = 0;
- m_last_pc = 0x0000;
-}
-
-
-//**************************************************************************
-// IMPLEMENTATION
-//**************************************************************************
-
-READ_LINE_MEMBER(spectrum_opus_device::romcs)
-{
- return m_romcs | m_exp->romcs();
-}
-
-void spectrum_opus_device::opcode_fetch(offs_t offset)
-{
- m_exp->opcode_fetch(offset);
-
- if (!machine().side_effects_disabled())
- {
- switch (m_last_pc)
- {
- case 0x0008: case 0x0048: case 0x1708:
- m_romcs = 1;
- break;
- case 0x1748:
- m_romcs = 0;
- break;
- }
- }
- m_last_pc = offset;
-}
-
-uint8_t spectrum_opus_device::iorq_r(offs_t offset)
-{
- uint8_t data = m_exp->iorq_r(offset);
-
- // PIA bit 7 is enable joystick and selected on A5 only
- if (!BIT(m_pia->a_output(), 7) && (~offset & 0x20))
- {
- data &= m_joy->read() & 0x1f;
- }
- return data;
-}
-
-void spectrum_opus_device::iorq_w(offs_t offset, uint8_t data)
-{
- m_exp->iorq_w(offset, data);
-}
-
-uint8_t spectrum_opus_device::mreq_r(offs_t offset)
-{
- uint8_t data = 0xff;
-
- if (m_romcs)
- {
- switch (offset & 0xf800)
- {
- case 0x0000: case 0x0800: case 0x1000: case 0x1800:
- data = m_rom->base()[offset & 0x1fff];
- break;
- case 0x2000:
- data = m_ram[offset & 0x7ff];
- break;
- case 0x2800:
- data = m_fdc->read(offset & 0x03);
- break;
- case 0x3000:
- data = m_pia->read(offset & 0x03);
- break;
- case 0x3800: // Extra 2K described in QuickDOS manual - not used
- data = m_ram[offset & 0xfff];
- break;
- }
- }
-
- if (m_exp->romcs())
- data &= m_exp->mreq_r(offset);
-
- return data;
-}
-
-void spectrum_opus_device::mreq_w(offs_t offset, uint8_t data)
-{
- if (m_romcs)
- {
- switch (offset & 0xf800)
- {
- case 0x2000:
- m_ram[offset & 0x7ff] = data;
- break;
- case 0x2800:
- m_fdc->write(offset & 0x03, data);
- break;
- case 0x3000:
- m_pia->write(offset & 0x03, data);
- break;
- case 0x3800: // Extra 2K described in QuickDOS manual - not used
- m_ram[offset & 0xfff] = data;
- break;
- }
- }
-
- if (m_exp->romcs())
- m_exp->mreq_w(offset, data);
-}
-
-WRITE8_MEMBER(spectrum_opus_device::pia_out_a)
-{
- floppy_image_device *floppy = nullptr;
-
- // bit 0, 1: drive select
- if (!BIT(data, 0)) floppy = m_floppy1->get_device();
- if (!BIT(data, 1)) floppy = m_floppy0->get_device();
- m_fdc->set_floppy(floppy);
-
- // bit 4: side select
- if (floppy)
- floppy->ss_w(BIT(data, 4));
-
- // bit 5: density
- m_fdc->dden_w(BIT(data, 5));
-}
-
-WRITE8_MEMBER(spectrum_opus_device::pia_out_b)
-{
- m_centronics->write_data1(BIT(data, 1));
- m_centronics->write_data2(BIT(data, 2));
- m_centronics->write_data3(BIT(data, 3));
- m_centronics->write_data4(BIT(data, 4));
- m_centronics->write_data5(BIT(data, 5));
- m_centronics->write_data6(BIT(data, 6));
- m_centronics->write_data7(BIT(data, 7));
-}
-
-WRITE_LINE_MEMBER(spectrum_opus_device::busy_w)
-{
- m_pia->set_a_input(state << 6, 0xbf);
-}
diff --git a/src/devices/bus/spectrum/opus.h b/src/devices/bus/spectrum/opus.h
deleted file mode 100644
index 8d72d8be94b..00000000000
--- a/src/devices/bus/spectrum/opus.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- Opus Discovery disc system
-
-**********************************************************************/
-
-#ifndef MAME_BUS_SPECTRUM_OPUS_H
-#define MAME_BUS_SPECTRUM_OPUS_H
-
-#include "exp.h"
-#include "softlist.h"
-#include "imagedev/floppy.h"
-#include "machine/wd_fdc.h"
-#include "machine/6821pia.h"
-#include "bus/centronics/ctronics.h"
-#include "formats/opd_dsk.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-class spectrum_opus_device:
- public device_t,
- public device_spectrum_expansion_interface
-
-{
-public:
- // construction/destruction
- spectrum_opus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- DECLARE_FLOPPY_FORMATS(floppy_formats);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
- // optional information overrides
- virtual void device_add_mconfig(machine_config &config) override;
- virtual ioport_constructor device_input_ports() const override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-
- virtual void opcode_fetch(offs_t offset) override;
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
- virtual DECLARE_READ_LINE_MEMBER(romcs) override;
-
-private:
- DECLARE_WRITE8_MEMBER(pia_out_a);
- DECLARE_WRITE8_MEMBER(pia_out_b);
- DECLARE_WRITE_LINE_MEMBER(busy_w);
-
- required_ioport m_joy;
- required_memory_region m_rom;
- required_device<pia6821_device> m_pia;
- required_device<wd_fdc_device_base> m_fdc;
- required_device<floppy_connector> m_floppy0;
- required_device<floppy_connector> m_floppy1;
- required_device<centronics_device> m_centronics;
- required_device<spectrum_expansion_slot_device> m_exp;
-
- int m_romcs;
- uint8_t m_ram[4 * 1024];
- offs_t m_last_pc;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(SPECTRUM_OPUS, spectrum_opus_device)
-
-#endif // MAME_BUS_SPECTRUM_OPUS_H
diff --git a/src/devices/bus/spectrum/plus2test.cpp b/src/devices/bus/spectrum/plus2test.cpp
index 3d90ed4dee3..a734a76f775 100644
--- a/src/devices/bus/spectrum/plus2test.cpp
+++ b/src/devices/bus/spectrum/plus2test.cpp
@@ -68,7 +68,7 @@ READ_LINE_MEMBER(spectrum_plus2test_device::romcs)
return 1;
}
-uint8_t spectrum_plus2test_device::mreq_r(offs_t offset)
+READ8_MEMBER(spectrum_plus2test_device::mreq_r)
{
return m_rom->base()[offset & 0x3fff];
}
diff --git a/src/devices/bus/spectrum/plus2test.h b/src/devices/bus/spectrum/plus2test.h
index f8caad2fa26..234e82a95f0 100644
--- a/src/devices/bus/spectrum/plus2test.h
+++ b/src/devices/bus/spectrum/plus2test.h
@@ -36,7 +36,7 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override;
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
- virtual uint8_t mreq_r(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(mreq_r) override;
private:
required_memory_region m_rom;
diff --git a/src/devices/bus/spectrum/protek.cpp b/src/devices/bus/spectrum/protek.cpp
index d1e122d8dbb..a3f3a1838f8 100644
--- a/src/devices/bus/spectrum/protek.cpp
+++ b/src/devices/bus/spectrum/protek.cpp
@@ -72,20 +72,17 @@ void spectrum_protek_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t spectrum_protek_device::iorq_r(offs_t offset)
+READ8_MEMBER(spectrum_protek_device::port_fe_r)
{
uint8_t data = 0xff;
- switch (offset & 0xff)
- {
- case 0xfe:
- if (((offset >> 8) & 8) == 0)
- data = m_exp_line3->read() | (0xff ^ 0x10);
+ uint8_t lines = offset >> 8;
- if (((offset >> 8) & 16) == 0)
- data = m_exp_line4->read() | (0xff ^ 0x1d);
- break;
- }
+ if ((lines & 8) == 0)
+ data = m_exp_line3->read() | (0xff ^ 0x10);
+
+ if ((lines & 16) == 0)
+ data = m_exp_line4->read() | (0xff ^ 0x1d);
return data;
}
diff --git a/src/devices/bus/spectrum/protek.h b/src/devices/bus/spectrum/protek.h
index 9edd5a82f29..503a041a0d3 100644
--- a/src/devices/bus/spectrum/protek.h
+++ b/src/devices/bus/spectrum/protek.h
@@ -35,7 +35,7 @@ protected:
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t iorq_r(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(port_fe_r) override;
private:
required_ioport m_exp_line3;
diff --git a/src/devices/bus/spectrum/specdrum.cpp b/src/devices/bus/spectrum/specdrum.cpp
deleted file mode 100644
index 9c809a1b36a..00000000000
--- a/src/devices/bus/spectrum/specdrum.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- Cheetah Marketing SpecDrum emulation
-
-**********************************************************************/
-
-#include "emu.h"
-#include "specdrum.h"
-#include "sound/volt_reg.h"
-#include "speaker.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(SPECTRUM_SPECDRUM, spectrum_specdrum_device, "spectrum_specdrum", "SpecDrum")
-
-
-//-------------------------------------------------
-// device_add_mconfig - add device configuration
-//-------------------------------------------------
-
-void spectrum_specdrum_device::device_add_mconfig(machine_config &config)
-{
- SPEAKER(config, "speaker").front_center();
- ZN428E(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5);
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
-}
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// spectrum_specdrum_device - constructor
-//-------------------------------------------------
-
-spectrum_specdrum_device::spectrum_specdrum_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, SPECTRUM_SPECDRUM, tag, owner, clock)
- , device_spectrum_expansion_interface(mconfig, *this)
- , m_dac(*this, "dac")
-{
-}
-
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void spectrum_specdrum_device::device_start()
-{
-}
-
-
-//**************************************************************************
-// IMPLEMENTATION
-//**************************************************************************
-
-void spectrum_specdrum_device::iorq_w(offs_t offset, uint8_t data)
-{
- switch (offset & 0x00ff)
- {
- case 0xdf:
- m_dac->write(data);
- break;
- }
-}
diff --git a/src/devices/bus/spectrum/specdrum.h b/src/devices/bus/spectrum/specdrum.h
deleted file mode 100644
index 7412a8509c0..00000000000
--- a/src/devices/bus/spectrum/specdrum.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/**********************************************************************
-
- Cheetah Marketing SpecDrum emulation
-
-**********************************************************************/
-
-#ifndef MAME_BUS_SPECTRUM_SPECDRUM_H
-#define MAME_BUS_SPECTRUM_SPECDRUM_H
-
-#pragma once
-
-
-#include "exp.h"
-#include "sound/dac.h"
-
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> spectrum_specdrum_device
-
-class spectrum_specdrum_device :
- public device_t,
- public device_spectrum_expansion_interface
-{
-public:
- // construction/destruction
- spectrum_specdrum_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
-
- // optional information overrides
- virtual void device_add_mconfig(machine_config &config) override;
-
- virtual void iorq_w(offs_t offset, uint8_t data) override;
-
-private:
- required_device<dac_byte_interface> m_dac;
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(SPECTRUM_SPECDRUM, spectrum_specdrum_device)
-
-
-#endif // MAME_BUS_SPECTRUM_SPECDRUM_H
diff --git a/src/devices/bus/spectrum/uslot.cpp b/src/devices/bus/spectrum/uslot.cpp
index d27f1ec572d..d2d75d6a72c 100644
--- a/src/devices/bus/spectrum/uslot.cpp
+++ b/src/devices/bus/spectrum/uslot.cpp
@@ -64,6 +64,8 @@ void spectrum_uslot_device::device_start()
void spectrum_uslot_device::device_reset()
{
+ m_exp1->set_io_space(&io_space());
+ m_exp2->set_io_space(&io_space());
}
@@ -76,41 +78,41 @@ READ_LINE_MEMBER(spectrum_uslot_device::romcs)
return m_exp1->romcs() | m_exp2->romcs();
}
-void spectrum_uslot_device::opcode_fetch(offs_t offset)
-{
- m_exp1->opcode_fetch(offset);
- m_exp2->opcode_fetch(offset);
-}
-uint8_t spectrum_uslot_device::mreq_r(offs_t offset)
+READ8_MEMBER(spectrum_uslot_device::mreq_r)
{
+ uint8_t temp;
uint8_t data = 0xff;
+ temp = m_exp1->mreq_r(space, offset);
if (m_exp1->romcs())
- data &= m_exp1->mreq_r(offset);
+ data &= temp;
+ temp = m_exp2->mreq_r(space, offset);
if (m_exp2->romcs())
- data &= m_exp2->mreq_r(offset);
+ data &= temp;
return data;
}
-void spectrum_uslot_device::mreq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(spectrum_uslot_device::mreq_w)
{
if (m_exp1->romcs())
- m_exp1->mreq_w(offset, data);
+ m_exp1->mreq_w(space, offset, data);
if (m_exp2->romcs())
- m_exp2->mreq_w(offset, data);
+ m_exp2->mreq_w(space, offset, data);
}
-uint8_t spectrum_uslot_device::iorq_r(offs_t offset)
+READ8_MEMBER(spectrum_uslot_device::port_fe_r)
{
- return m_exp1->iorq_r(offset) & m_exp2->iorq_r(offset);
-}
+ uint8_t data = 0xff;
-void spectrum_uslot_device::iorq_w(offs_t offset, uint8_t data)
-{
- m_exp1->iorq_w(offset, data);
- m_exp2->iorq_w(offset, data);
+ if (m_exp1->romcs())
+ data &= m_exp1->port_fe_r(space, offset);
+
+ if (m_exp2->romcs())
+ data &= m_exp2->port_fe_r(space, offset);
+
+ return data;
}
diff --git a/src/devices/bus/spectrum/uslot.h b/src/devices/bus/spectrum/uslot.h
index 6cfa90c45e9..536f7c75bc4 100644
--- a/src/devices/bus/spectrum/uslot.h
+++ b/src/devices/bus/spectrum/uslot.h
@@ -36,11 +36,9 @@ protected:
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
- virtual void opcode_fetch(offs_t offset) override;
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(mreq_r) override;
+ virtual DECLARE_WRITE8_MEMBER(mreq_w) override;
+ virtual DECLARE_READ8_MEMBER(port_fe_r) override;
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
private:
diff --git a/src/devices/bus/spectrum/usource.cpp b/src/devices/bus/spectrum/usource.cpp
index 13f302b14c5..b4fb9c5797a 100644
--- a/src/devices/bus/spectrum/usource.cpp
+++ b/src/devices/bus/spectrum/usource.cpp
@@ -60,7 +60,6 @@ spectrum_usource_device::spectrum_usource_device(const machine_config &mconfig,
void spectrum_usource_device::device_start()
{
- save_item(NAME(m_romcs));
}
@@ -83,15 +82,17 @@ READ_LINE_MEMBER(spectrum_usource_device::romcs)
return m_romcs;
}
-void spectrum_usource_device::opcode_fetch(offs_t offset)
+
+READ8_MEMBER(spectrum_usource_device::mreq_r)
{
+ uint8_t data;
+
if (!machine().side_effects_disabled() && (offset == 0x2bae))
{
m_romcs = !m_romcs;
}
-}
-uint8_t spectrum_usource_device::mreq_r(offs_t offset)
-{
- return m_rom->base()[offset & 0x1fff];
+ data = m_rom->base()[offset & 0x1fff];
+
+ return data;
}
diff --git a/src/devices/bus/spectrum/usource.h b/src/devices/bus/spectrum/usource.h
index daf792f076f..607cf0737a6 100644
--- a/src/devices/bus/spectrum/usource.h
+++ b/src/devices/bus/spectrum/usource.h
@@ -38,9 +38,8 @@ protected:
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual void opcode_fetch(offs_t offset) override;
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
- virtual uint8_t mreq_r(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(mreq_r) override;
private:
required_memory_region m_rom;
diff --git a/src/devices/bus/spectrum/uspeech.cpp b/src/devices/bus/spectrum/uspeech.cpp
index 60374fd3c2c..87f66ca0182 100644
--- a/src/devices/bus/spectrum/uspeech.cpp
+++ b/src/devices/bus/spectrum/uspeech.cpp
@@ -76,7 +76,6 @@ spectrum_uspeech_device::spectrum_uspeech_device(const machine_config &mconfig,
void spectrum_uspeech_device::device_start()
{
- save_item(NAME(m_romcs));
}
@@ -99,59 +98,46 @@ READ_LINE_MEMBER(spectrum_uspeech_device::romcs)
return m_romcs;
}
-void spectrum_uspeech_device::opcode_fetch(offs_t offset)
-{
- if (!machine().side_effects_disabled() && (offset == 0x0038))
- {
- m_romcs = !m_romcs;
- }
-}
-uint8_t spectrum_uspeech_device::iorq_r(offs_t offset)
+READ8_MEMBER(spectrum_uspeech_device::mreq_r)
{
- if (!machine().side_effects_disabled() && (offset == 0x0038))
+ uint8_t data;
+
+ if (!machine().side_effects_disabled() && (offset == 0x38))
{
m_romcs = !m_romcs;
}
- return 0xff;
-}
-
-uint8_t spectrum_uspeech_device::mreq_r(offs_t offset)
-{
- uint8_t data = 0xff;
-
- switch (offset & 0xf000)
+ switch (offset)
{
- case 0x0000:
- data = m_rom->base()[offset & 0x7ff];
- break;
case 0x1000:
- data = !m_nsp->lrq_r();
+ data = !m_nsp->lrq_r(); // (m_nsp->lrq_r() && (m_nsp->sby_r() != 0)) ? 0x00 : 0x01;
+ break;
+ default:
+ data = m_rom->base()[offset & 0x7ff];
break;
}
return data;
}
-void spectrum_uspeech_device::mreq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(spectrum_uspeech_device::mreq_w)
{
- switch (offset & 0xf001)
+ switch (offset)
{
case 0x1000:
- case 0x1001:
// allophone
m_nsp->ald_w(data & 0x3f);
break;
case 0x3000:
// intonation low
- m_nsp->set_clock(3050000); // oscillator frequency read from hardware
+ m_nsp->set_clock(3500000); // CK / 4 ??
break;
case 0x3001:
// intonation high
- m_nsp->set_clock(3260000); // oscillator frequency read from hardware
+ m_nsp->set_clock(3800000); // TODO: the exact frequency is unknown
break;
}
}
diff --git a/src/devices/bus/spectrum/uspeech.h b/src/devices/bus/spectrum/uspeech.h
index 8013abf9222..b3209f80331 100644
--- a/src/devices/bus/spectrum/uspeech.h
+++ b/src/devices/bus/spectrum/uspeech.h
@@ -40,11 +40,9 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void opcode_fetch(offs_t offset) override;
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
- virtual uint8_t iorq_r(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(mreq_r) override;
+ virtual DECLARE_WRITE8_MEMBER(mreq_w) override;
private:
required_device<sp0256_device> m_nsp;
diff --git a/src/devices/bus/ss50/interface.cpp b/src/devices/bus/ss50/interface.cpp
index a811c790ef9..b17f54f9c68 100644
--- a/src/devices/bus/ss50/interface.cpp
+++ b/src/devices/bus/ss50/interface.cpp
@@ -139,22 +139,22 @@ void ss50_interface_port_device::device_start()
// read - interface read access (pre-decoded)
//-------------------------------------------------
-u8 ss50_interface_port_device::read(offs_t offset)
+READ8_MEMBER(ss50_interface_port_device::read)
{
if (m_card == nullptr)
{
logerror("%s: Read from unspecified interface (RS = %X)\n", machine().describe_context(), offset);
- return 0xff;
+ return space.unmap();
}
- return m_card->register_read(offset);
+ return m_card->register_read(space, offset);
}
//-------------------------------------------------
// write - interface write access (pre-decoded)
//-------------------------------------------------
-void ss50_interface_port_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER(ss50_interface_port_device::write)
{
if (m_card == nullptr)
{
@@ -162,7 +162,7 @@ void ss50_interface_port_device::write(offs_t offset, u8 data)
return;
}
- m_card->register_write(offset, data);
+ m_card->register_write(space, offset, data);
}
//-------------------------------------------------
diff --git a/src/devices/bus/ss50/interface.h b/src/devices/bus/ss50/interface.h
index 0be5f422c98..1865eda6324 100644
--- a/src/devices/bus/ss50/interface.h
+++ b/src/devices/bus/ss50/interface.h
@@ -11,6 +11,19 @@
#ifndef MAME_DEVICES_BUS_SS50_INTERFACE_H
#define MAME_DEVICES_BUS_SS50_INTERFACE_H
+//**************************************************************************
+// CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_SS50_INTERFACE_PORT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, SS50_INTERFACE, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(ss50_##_slot_intf, _def_slot, false)
+
+#define MCFG_SS50_INTERFACE_IRQ_CALLBACK(_devcb) \
+ downcast<ss50_interface_port_device &>(*device).set_irq_cb(DEVCB_##_devcb);
+
+#define MCFG_SS50_INTERFACE_FIRQ_CALLBACK(_devcb) \
+ downcast<ss50_interface_port_device &>(*device).set_firq_cb(DEVCB_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
@@ -27,25 +40,15 @@ class ss50_interface_port_device : public device_t, public device_slot_interface
public:
// construction/destruction
- template <typename T>
- ss50_interface_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : ss50_interface_port_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- ss50_interface_port_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
+ ss50_interface_port_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// static configuration
- auto irq_cb() { return m_irq_cb.bind(); }
- auto firq_cb() { return m_firq_cb.bind(); }
+ template<class Object> devcb_base &set_irq_cb(Object &&object) { return m_irq_cb.set_callback(std::forward<Object>(object)); }
+ template<class Object> devcb_base &set_firq_cb(Object &&object) { return m_firq_cb.set_callback(std::forward<Object>(object)); }
// memory accesses
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
// baud rates
DECLARE_WRITE_LINE_MEMBER(f110_w);
@@ -79,8 +82,8 @@ protected:
ss50_card_interface(const machine_config &mconfig, device_t &device);
// required overrides
- virtual u8 register_read(offs_t offset) = 0;
- virtual void register_write(offs_t offset, u8 data) = 0;
+ virtual DECLARE_READ8_MEMBER(register_read) = 0;
+ virtual DECLARE_WRITE8_MEMBER(register_write) = 0;
// optional overrides
virtual DECLARE_WRITE_LINE_MEMBER(f110_w) { }
diff --git a/src/devices/bus/ss50/mpc.cpp b/src/devices/bus/ss50/mpc.cpp
index ba05d80e8e3..eeff1928e92 100644
--- a/src/devices/bus/ss50/mpc.cpp
+++ b/src/devices/bus/ss50/mpc.cpp
@@ -42,8 +42,8 @@ protected:
virtual void device_start() override;
// interface-specific overrides
- virtual u8 register_read(offs_t offset) override;
- virtual void register_write(offs_t offset, u8 data) override;
+ virtual DECLARE_READ8_MEMBER(register_read) override;
+ virtual DECLARE_WRITE8_MEMBER(register_write) override;
virtual DECLARE_WRITE_LINE_MEMBER(f110_w) override;
virtual DECLARE_WRITE_LINE_MEMBER(f300_w) override;
@@ -100,8 +100,7 @@ DEVICE_INPUT_DEFAULTS_END
// machine configuration
//-------------------------------------------------
-void ss50_mpc_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(ss50_mpc_device::device_add_mconfig)
PIA6821(config, m_pia, 0); // actually MC6820
m_pia->writepa_handler().set("outgate", FUNC(input_merger_device::in_w<0>)).bit(0);
m_pia->cb2_handler().set(FUNC(ss50_mpc_device::reader_control_w));
@@ -116,13 +115,15 @@ void ss50_mpc_device::device_add_mconfig(machine_config &config)
rs232.rxd_handler().set(FUNC(ss50_mpc_device::serial_input_w));
rs232.set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal));
- INPUT_MERGER_ALL_HIGH(config, "outgate").output_handler().set("rs232", FUNC(rs232_port_device::write_txd));
+ MCFG_INPUT_MERGER_ALL_HIGH("outgate")
+ MCFG_INPUT_MERGER_OUTPUT_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd))
- INPUT_MERGER_ANY_HIGH(config, m_loopback).output_handler().set("outgate", FUNC(input_merger_device::in_w<1>));
+ MCFG_INPUT_MERGER_ANY_HIGH("loopback")
+ MCFG_INPUT_MERGER_OUTPUT_HANDLER(WRITELINE("outgate", input_merger_device, in_w<1>))
RIPPLE_COUNTER(config, m_counter); // CD4024AE (IC3)
m_counter->set_stages(7); // only Q5 (÷32) and Q4 (÷16) are actually used
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
@@ -161,18 +162,18 @@ WRITE_LINE_MEMBER(ss50_mpc_device::count_select_w)
// register_read - read from a port register
//-------------------------------------------------
-u8 ss50_mpc_device::register_read(offs_t offset)
+READ8_MEMBER(ss50_mpc_device::register_read)
{
- return m_pia->read(offset & 3);
+ return m_pia->read(space, offset & 3, 0);
}
//-------------------------------------------------
// register_write - write to a port register
//-------------------------------------------------
-void ss50_mpc_device::register_write(offs_t offset, u8 data)
+WRITE8_MEMBER(ss50_mpc_device::register_write)
{
- m_pia->write(offset & 3, data);
+ m_pia->write(space, offset & 3, data);
}
WRITE_LINE_MEMBER(ss50_mpc_device::f110_w)
diff --git a/src/devices/bus/ss50/mps.cpp b/src/devices/bus/ss50/mps.cpp
index d66dd3b767e..dab93db2cd3 100644
--- a/src/devices/bus/ss50/mps.cpp
+++ b/src/devices/bus/ss50/mps.cpp
@@ -38,8 +38,8 @@ protected:
virtual void device_start() override { }
// interface-specific overrides
- virtual u8 register_read(offs_t offset) override;
- virtual void register_write(offs_t offset, u8 data) override;
+ virtual DECLARE_READ8_MEMBER(register_read) override;
+ virtual DECLARE_WRITE8_MEMBER(register_write) override;
virtual DECLARE_WRITE_LINE_MEMBER(f110_w) override;
virtual DECLARE_WRITE_LINE_MEMBER(f150_9600_w) override;
virtual DECLARE_WRITE_LINE_MEMBER(f300_w) override;
@@ -113,18 +113,18 @@ void ss50_mps_device::device_add_mconfig(machine_config &config)
// register_read - read from a port register
//-------------------------------------------------
-u8 ss50_mps_device::register_read(offs_t offset)
+READ8_MEMBER(ss50_mps_device::register_read)
{
- return m_acia->read(offset & 1);
+ return m_acia->read(space, offset & 1, 0);
}
//-------------------------------------------------
// register_write - write to a port register
//-------------------------------------------------
-void ss50_mps_device::register_write(offs_t offset, u8 data)
+WRITE8_MEMBER(ss50_mps_device::register_write)
{
- m_acia->write(offset & 1, data);
+ m_acia->write(space, offset & 1, data);
}
WRITE_LINE_MEMBER(ss50_mps_device::f110_w)
diff --git a/src/devices/bus/sunkbd/hlekbd.cpp b/src/devices/bus/sunkbd/hlekbd.cpp
index 21f4de349ed..2cb5547947e 100644
--- a/src/devices/bus/sunkbd/hlekbd.cpp
+++ b/src/devices/bus/sunkbd/hlekbd.cpp
@@ -789,11 +789,11 @@ WRITE_LINE_MEMBER( hle_device_base::input_txd )
add machine configuration
--------------------------------------------------*/
-void hle_device_base::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(hle_device_base::device_add_mconfig)
SPEAKER(config, "bell").front_center();
- BEEP(config, m_beeper, ATTOSECONDS_TO_HZ(480 * ATTOSECONDS_PER_MICROSECOND)).add_route(ALL_OUTPUTS, "bell", 1.0);
-}
+ MCFG_DEVICE_ADD("beeper", BEEP, ATTOSECONDS_TO_HZ(480 * ATTOSECONDS_PER_MICROSECOND))
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "bell", 1.0)
+MACHINE_CONFIG_END
/*--------------------------------------------------
diff --git a/src/devices/bus/svi3x8/expander/expander.cpp b/src/devices/bus/svi3x8/expander/expander.cpp
index e9653827fcf..481789516ff 100644
--- a/src/devices/bus/svi3x8/expander/expander.cpp
+++ b/src/devices/bus/svi3x8/expander/expander.cpp
@@ -80,38 +80,38 @@ void svi_expander_device::device_reset()
// host to module interface
//-------------------------------------------------
-uint8_t svi_expander_device::mreq_r(offs_t offset)
+READ8_MEMBER( svi_expander_device::mreq_r )
{
romdis_w(1);
ramdis_w(1);
if (m_module)
- return m_module->mreq_r(offset);
+ return m_module->mreq_r(space, offset);
return 0xff;
}
-void svi_expander_device::mreq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( svi_expander_device::mreq_w )
{
romdis_w(1);
ramdis_w(1);
if (m_module)
- m_module->mreq_w(offset, data);
+ m_module->mreq_w(space, offset, data);
}
-uint8_t svi_expander_device::iorq_r(offs_t offset)
+READ8_MEMBER( svi_expander_device::iorq_r )
{
if (m_module)
- return m_module->iorq_r(offset);
+ return m_module->iorq_r(space, offset);
return 0xff;
}
-void svi_expander_device::iorq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( svi_expander_device::iorq_w )
{
if (m_module)
- m_module->iorq_w(offset, data);
+ m_module->iorq_w(space, offset, data);
}
WRITE_LINE_MEMBER( svi_expander_device::bk21_w )
diff --git a/src/devices/bus/svi3x8/expander/expander.h b/src/devices/bus/svi3x8/expander/expander.h
index cc7e75f6332..549a17c5970 100644
--- a/src/devices/bus/svi3x8/expander/expander.h
+++ b/src/devices/bus/svi3x8/expander/expander.h
@@ -40,6 +40,36 @@
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_SVI_EXPANDER_BUS_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, SVI_EXPANDER, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(svi_expander_modules, nullptr, false)
+#define MCFG_SVI_EXPANDER_INT_HANDLER(_devcb) \
+ downcast<svi_expander_device &>(*device).set_int_handler(DEVCB_##_devcb);
+
+#define MCFG_SVI_EXPANDER_ROMDIS_HANDLER(_devcb) \
+ downcast<svi_expander_device &>(*device).set_romdis_handler(DEVCB_##_devcb);
+
+#define MCFG_SVI_EXPANDER_RAMDIS_HANDLER(_devcb) \
+ downcast<svi_expander_device &>(*device).set_ramdis_handler(DEVCB_##_devcb);
+
+#define MCFG_SVI_EXPANDER_CTRL1_HANDLER(_devcb) \
+ downcast<svi_expander_device &>(*device).set_ctrl1_handler(DEVCB_##_devcb);
+
+#define MCFG_SVI_EXPANDER_CTRL2_HANDLER(_devcb) \
+ downcast<svi_expander_device &>(*device).set_ctrl2_handler(DEVCB_##_devcb);
+
+#define MCFG_SVI_EXPANDER_EXCSR_HANDLER(_devcb) \
+ downcast<svi_expander_device &>(*device).set_excsr_handler(DEVCB_##_devcb);
+
+#define MCFG_SVI_EXPANDER_EXCSW_HANDLER(_devcb) \
+ downcast<svi_expander_device &>(*device).set_excsw_handler(DEVCB_##_devcb);
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -52,27 +82,17 @@ class svi_expander_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- template <typename T>
- svi_expander_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts)
- : svi_expander_device(mconfig, tag, owner, uint32_t(0))
- {
- option_reset();
- opts(*this);
- set_default_option(nullptr);
- set_fixed(false);
- }
-
svi_expander_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~svi_expander_device();
// callbacks
- auto int_handler() { return m_int_handler.bind(); }
- auto romdis_handler() { return m_romdis_handler.bind(); }
- auto ramdis_handler() { return m_ramdis_handler.bind(); }
- auto ctrl1_handler() { return m_ctrl1_handler.bind(); }
- auto ctrl2_handler() { return m_ctrl2_handler.bind(); }
- auto excsr_handler() { return m_excsr_handler.bind(); }
- auto excsw_handler() { return m_excsw_handler.bind(); }
+ template <class Object> devcb_base &set_int_handler(Object &&cb) { return m_int_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_romdis_handler(Object &&cb) { return m_romdis_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ramdis_handler(Object &&cb) { return m_ramdis_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ctrl1_handler(Object &&cb) { return m_ctrl1_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ctrl2_handler(Object &&cb) { return m_ctrl2_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_excsr_handler(Object &&cb) { return m_excsr_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_excsw_handler(Object &&cb) { return m_excsw_handler.set_callback(std::forward<Object>(cb)); }
// called from cart device
DECLARE_WRITE_LINE_MEMBER( int_w ) { m_int_handler(state); }
@@ -81,14 +101,14 @@ public:
DECLARE_WRITE_LINE_MEMBER( ctrl1_w ) { m_ctrl1_handler(state); }
DECLARE_WRITE_LINE_MEMBER( ctrl2_w ) { m_ctrl2_handler(state); }
- uint8_t excs_r(offs_t offset) { return m_excsr_handler(offset); }
- void excs_w(offs_t offset, uint8_t data) { m_excsw_handler(offset, data); }
+ DECLARE_READ8_MEMBER( excs_r ) { return m_excsr_handler(space, offset); }
+ DECLARE_WRITE8_MEMBER( excs_w ) { m_excsw_handler(space, offset, data); }
// called from host
- uint8_t mreq_r(offs_t offset);
- void mreq_w(offs_t offset, uint8_t data);
- uint8_t iorq_r(offs_t offset);
- void iorq_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( mreq_r );
+ DECLARE_WRITE8_MEMBER( mreq_w );
+ DECLARE_READ8_MEMBER( iorq_r );
+ DECLARE_WRITE8_MEMBER( iorq_w );
DECLARE_WRITE_LINE_MEMBER( bk21_w );
DECLARE_WRITE_LINE_MEMBER( bk22_w );
@@ -121,10 +141,10 @@ public:
// construction/destruction
virtual ~device_svi_expander_interface();
- virtual uint8_t mreq_r(offs_t offset) { return 0xff; }
- virtual void mreq_w(offs_t offset, uint8_t data) { }
- virtual uint8_t iorq_r(offs_t offset) { return 0xff; }
- virtual void iorq_w(offs_t offset, uint8_t data) { }
+ virtual DECLARE_READ8_MEMBER( mreq_r ) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER( mreq_w ) { }
+ virtual DECLARE_READ8_MEMBER( iorq_r ) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER( iorq_w ) { }
virtual void bk21_w(int state) { }
virtual void bk22_w(int state) { }
diff --git a/src/devices/bus/svi3x8/expander/sv601.cpp b/src/devices/bus/svi3x8/expander/sv601.cpp
index aec81c79ae6..51a51241897 100644
--- a/src/devices/bus/svi3x8/expander/sv601.cpp
+++ b/src/devices/bus/svi3x8/expander/sv601.cpp
@@ -20,20 +20,19 @@ DEFINE_DEVICE_TYPE(SV601, sv601_device, "sv601", "SV-601 Super Expander")
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void sv601_device::device_add_mconfig(machine_config &config)
-{
- SVI_SLOT_BUS(config, m_slotbus, 0);
- m_slotbus->int_handler().set(FUNC(sv601_device::int_w));
- m_slotbus->romdis_handler().set(FUNC(sv601_device::romdis_w));
- m_slotbus->ramdis_handler().set(FUNC(sv601_device::ramdis_w));
- SVI_SLOT(config, "0", svi_slot_cards, nullptr);
- SVI_SLOT(config, "1", svi_slot_cards, nullptr);
- SVI_SLOT(config, "2", svi_slot_cards, nullptr);
- SVI_SLOT(config, "3", svi_slot_cards, nullptr);
- SVI_SLOT(config, "4", svi_slot_cards, nullptr);
- SVI_SLOT(config, "5", svi_slot_cards, nullptr);
- SVI_SLOT(config, "6", svi_slot_cards, nullptr);
-}
+MACHINE_CONFIG_START(sv601_device::device_add_mconfig)
+ MCFG_SVI_SLOT_BUS_ADD
+ MCFG_SVI_SLOT_INT_HANDLER(WRITELINE(*this, sv601_device, int_w))
+ MCFG_SVI_SLOT_ROMDIS_HANDLER(WRITELINE(*this, sv601_device, romdis_w))
+ MCFG_SVI_SLOT_RAMDIS_HANDLER(WRITELINE(*this, sv601_device, ramdis_w))
+ MCFG_SVI_SLOT_ADD("0", svi_slot_cards, nullptr)
+ MCFG_SVI_SLOT_ADD("1", svi_slot_cards, nullptr)
+ MCFG_SVI_SLOT_ADD("2", svi_slot_cards, nullptr)
+ MCFG_SVI_SLOT_ADD("3", svi_slot_cards, nullptr)
+ MCFG_SVI_SLOT_ADD("4", svi_slot_cards, nullptr)
+ MCFG_SVI_SLOT_ADD("5", svi_slot_cards, nullptr)
+ MCFG_SVI_SLOT_ADD("6", svi_slot_cards, nullptr)
+MACHINE_CONFIG_END
//**************************************************************************
@@ -68,10 +67,10 @@ WRITE_LINE_MEMBER( sv601_device::int_w ) { m_expander->int_w(state); }
WRITE_LINE_MEMBER( sv601_device::romdis_w ) { m_expander->romdis_w(state); }
WRITE_LINE_MEMBER( sv601_device::ramdis_w ) { m_expander->ramdis_w(state); }
-uint8_t sv601_device::mreq_r(offs_t offset) { return m_slotbus->mreq_r(offset); }
-void sv601_device::mreq_w(offs_t offset, uint8_t data) { m_slotbus->mreq_w(offset, data); }
-uint8_t sv601_device::iorq_r(offs_t offset) { return m_slotbus->iorq_r(offset); }
-void sv601_device::iorq_w(offs_t offset, uint8_t data) { m_slotbus->iorq_w(offset, data); }
+READ8_MEMBER( sv601_device::mreq_r ) { return m_slotbus->mreq_r(space, offset); }
+WRITE8_MEMBER( sv601_device::mreq_w ) { m_slotbus->mreq_w(space, offset, data); }
+READ8_MEMBER( sv601_device::iorq_r ) { return m_slotbus->iorq_r(space, offset); }
+WRITE8_MEMBER( sv601_device::iorq_w ) { m_slotbus->iorq_w(space, offset, data); }
void sv601_device::bk21_w(int state) { m_slotbus->bk21_w(state); }
void sv601_device::bk22_w(int state) { m_slotbus->bk22_w(state); }
diff --git a/src/devices/bus/svi3x8/expander/sv601.h b/src/devices/bus/svi3x8/expander/sv601.h
index 692191a7ea9..7918bc82441 100644
--- a/src/devices/bus/svi3x8/expander/sv601.h
+++ b/src/devices/bus/svi3x8/expander/sv601.h
@@ -33,10 +33,10 @@ public:
WRITE_LINE_MEMBER( ramdis_w );
// from host
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( mreq_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( mreq_w ) override;
+ virtual DECLARE_READ8_MEMBER( iorq_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( iorq_w ) override;
virtual void bk21_w(int state) override;
virtual void bk22_w(int state) override;
diff --git a/src/devices/bus/svi3x8/expander/sv602.cpp b/src/devices/bus/svi3x8/expander/sv602.cpp
index 25624a83e9a..b7c657bddce 100644
--- a/src/devices/bus/svi3x8/expander/sv602.cpp
+++ b/src/devices/bus/svi3x8/expander/sv602.cpp
@@ -20,14 +20,13 @@ DEFINE_DEVICE_TYPE(SV602, sv602_device, "sv602", "SV-602 Single Slot Expander")
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void sv602_device::device_add_mconfig(machine_config &config)
-{
- SVI_SLOT_BUS(config, m_slotbus, 0);
- m_slotbus->int_handler().set(FUNC(sv602_device::int_w));
- m_slotbus->romdis_handler().set(FUNC(sv602_device::romdis_w));
- m_slotbus->ramdis_handler().set(FUNC(sv602_device::ramdis_w));
- SVI_SLOT(config, "0", sv602_slot_cards, nullptr);
-}
+MACHINE_CONFIG_START(sv602_device::device_add_mconfig)
+ MCFG_SVI_SLOT_BUS_ADD
+ MCFG_SVI_SLOT_INT_HANDLER(WRITELINE(*this, sv602_device, int_w))
+ MCFG_SVI_SLOT_ROMDIS_HANDLER(WRITELINE(*this, sv602_device, romdis_w))
+ MCFG_SVI_SLOT_RAMDIS_HANDLER(WRITELINE(*this, sv602_device, ramdis_w))
+ MCFG_SVI_SLOT_ADD("0", sv602_slot_cards, nullptr)
+MACHINE_CONFIG_END
//**************************************************************************
@@ -62,10 +61,10 @@ WRITE_LINE_MEMBER( sv602_device::int_w ) { m_expander->int_w(state); }
WRITE_LINE_MEMBER( sv602_device::romdis_w ) { m_expander->romdis_w(state); }
WRITE_LINE_MEMBER( sv602_device::ramdis_w ) { m_expander->ramdis_w(state); }
-uint8_t sv602_device::mreq_r(offs_t offset) { return m_slotbus->mreq_r(offset); }
-void sv602_device::mreq_w(offs_t offset, uint8_t data) { m_slotbus->mreq_w(offset, data); }
-uint8_t sv602_device::iorq_r(offs_t offset) { return m_slotbus->iorq_r(offset); }
-void sv602_device::iorq_w(offs_t offset, uint8_t data) { m_slotbus->iorq_w(offset, data); }
+READ8_MEMBER( sv602_device::mreq_r ) { return m_slotbus->mreq_r(space, offset); }
+WRITE8_MEMBER( sv602_device::mreq_w ) { m_slotbus->mreq_w(space, offset, data); }
+READ8_MEMBER( sv602_device::iorq_r ) { return m_slotbus->iorq_r(space, offset); }
+WRITE8_MEMBER( sv602_device::iorq_w ) { m_slotbus->iorq_w(space, offset, data); }
void sv602_device::bk21_w(int state) { m_slotbus->bk21_w(state); }
void sv602_device::bk22_w(int state) { m_slotbus->bk22_w(state); }
diff --git a/src/devices/bus/svi3x8/expander/sv602.h b/src/devices/bus/svi3x8/expander/sv602.h
index 607d1cf6c17..bb59b93c7ee 100644
--- a/src/devices/bus/svi3x8/expander/sv602.h
+++ b/src/devices/bus/svi3x8/expander/sv602.h
@@ -28,10 +28,10 @@ public:
sv602_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// from host
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( mreq_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( mreq_w ) override;
+ virtual DECLARE_READ8_MEMBER( iorq_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( iorq_w ) override;
virtual void bk21_w(int state) override;
virtual void bk22_w(int state) override;
diff --git a/src/devices/bus/svi3x8/expander/sv603.cpp b/src/devices/bus/svi3x8/expander/sv603.cpp
index fc8e8c86d96..a35b46e3f84 100644
--- a/src/devices/bus/svi3x8/expander/sv603.cpp
+++ b/src/devices/bus/svi3x8/expander/sv603.cpp
@@ -8,6 +8,7 @@
#include "emu.h"
#include "sv603.h"
+
#include "softlist.h"
#include "speaker.h"
@@ -36,20 +37,31 @@ const tiny_rom_entry *sv603_device::device_rom_region() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void sv603_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(sv603_device::device_add_mconfig)
SPEAKER(config, "mono").front_center();
- SN76489A(config, m_snd, XTAL(10'738'635) / 3).add_route(ALL_OUTPUTS, "mono", 1.00);
-
- // controller ports
- COLECOVISION_CONTROL_PORT(config, m_joy[0], colecovision_control_port_devices, "hand");
- m_joy[0]->irq().set(FUNC(sv603_device::joy_irq_w<0>));
- COLECOVISION_CONTROL_PORT(config, m_joy[1], colecovision_control_port_devices, nullptr);
- m_joy[1]->irq().set(FUNC(sv603_device::joy_irq_w<1>));
+ MCFG_DEVICE_ADD("snd", SN76489A, XTAL(10'738'635) / 3)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
// cartridge slot
- COLECOVISION_CARTRIDGE_SLOT(config, m_cart, colecovision_cartridges, nullptr);
- SOFTWARE_LIST(config, "cart_list").set_original("coleco");
+ MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "coleco_cart")
+ MCFG_GENERIC_EXTENSIONS("bin,rom,col")
+ MCFG_GENERIC_LOAD(sv603_device, cartridge)
+ MCFG_SOFTWARE_LIST_ADD("cart_list", "coleco")
+MACHINE_CONFIG_END
+
+
+//**************************************************************************
+// CARTRIDGE
+//**************************************************************************
+
+DEVICE_IMAGE_LOAD_MEMBER( sv603_device, cartridge )
+{
+ uint32_t size = m_cart_rom->common_get_size("rom");
+
+ m_cart_rom->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
+ m_cart_rom->common_load_rom(m_cart_rom->get_rom_base(), size, "rom");
+
+ return image_init_result::PASS;
}
@@ -66,8 +78,7 @@ sv603_device::sv603_device(const machine_config &mconfig, const char *tag, devic
device_svi_expander_interface(mconfig, *this),
m_bios(*this, "bios"),
m_snd(*this, "snd"),
- m_joy{ {*this, "joy1"}, {*this, "joy2"} },
- m_cart(*this, COLECOVISION_CARTRIDGE_SLOT_TAG)
+ m_cart_rom(*this, "cartslot")
{
}
@@ -93,84 +104,40 @@ void sv603_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-template<int N>
-WRITE_LINE_MEMBER( sv603_device::joy_irq_w )
+READ8_MEMBER( sv603_device::mreq_r )
{
- m_expander->int_w(state);
-}
-
-uint8_t sv603_device::mreq_r(offs_t offset)
-{
- uint8_t data = 0xff;
-
- // ls138 (active low)
- int ccs1 = ((offset >> 13) == 0) ? 0 : 1;
- int ccs2 = ((offset >> 13) == 1) ? 0 : 1;
- int ccs3 = ((offset >> 13) == 2) ? 0 : 1;
- int ccs4 = ((offset >> 13) == 3) ? 0 : 1;
- int bios = ((offset >> 13) == 4) ? 0 : 1;
- // 5, 6, 7: not connected
-
m_expander->romdis_w(0);
- m_expander->ramdis_w(bios);
- data &= m_cart->bd_r(offset, data, ccs1, ccs2, ccs3, ccs4);
+ if (offset < 0x8000)
+ return m_cart_rom->read_rom(space, offset);
- if (bios == 0)
- data &= m_bios->as_u8(offset & 0x1fff);
+ if (offset >= 0x8000 && offset < 0xa000)
+ {
+ m_expander->ramdis_w(0);
+ return m_bios->as_u8(offset & 0x1fff);
+ }
- return data;
+ return 0xff;
}
-void sv603_device::mreq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sv603_device::mreq_w )
{
m_expander->romdis_w(0);
}
-uint8_t sv603_device::iorq_r(offs_t offset)
+READ8_MEMBER( sv603_device::iorq_r )
{
- uint8_t data = 0xff;
-
- switch (offset & 0xe0)
- {
- case 0xa0:
- data = m_expander->excs_r(offset);
- break;
-
- case 0xe0:
- data = m_joy[BIT(offset, 1)]->read();
- break;
- }
+ if (offset >= 0xa0 && offset <= 0xbf)
+ return m_expander->excs_r(space, offset);
- return data;
+ return 0xff;
}
-void sv603_device::iorq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sv603_device::iorq_w )
{
- switch (offset & 0xe0)
- {
- case 0x80:
- // keypad mode
- m_joy[0]->common0_w(1);
- m_joy[0]->common1_w(0);
- m_joy[1]->common0_w(1);
- m_joy[1]->common1_w(0);
- break;
-
- case 0xa0:
- m_expander->excs_w(offset, data);
- break;
-
- case 0xc0:
- // joystick mode
- m_joy[0]->common0_w(0);
- m_joy[0]->common1_w(1);
- m_joy[1]->common0_w(0);
- m_joy[1]->common1_w(1);
- break;
-
- case 0xe0:
+ if (offset >= 0xa0 && offset <= 0xbf)
+ m_expander->excs_w(space, offset, data);
+
+ if (offset >= 0xe0 && offset <= 0xff)
m_snd->write(data);
- break;
- }
}
diff --git a/src/devices/bus/svi3x8/expander/sv603.h b/src/devices/bus/svi3x8/expander/sv603.h
index a6b3fde21b8..57d16521c17 100644
--- a/src/devices/bus/svi3x8/expander/sv603.h
+++ b/src/devices/bus/svi3x8/expander/sv603.h
@@ -13,8 +13,8 @@
#include "expander.h"
#include "sound/sn76496.h"
-#include "bus/coleco/cartridge/exp.h"
-#include "bus/coleco/controller/ctrl.h"
+#include "bus/generic/slot.h"
+#include "bus/generic/carts.h"
//**************************************************************************
@@ -30,12 +30,12 @@ public:
sv603_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// from host
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( mreq_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( mreq_w ) override;
+ virtual DECLARE_READ8_MEMBER( iorq_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( iorq_w ) override;
- template<int N> DECLARE_WRITE_LINE_MEMBER( joy_irq_w );
+ DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cartridge);
protected:
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -46,8 +46,7 @@ protected:
private:
required_memory_region m_bios;
required_device<sn76489a_device> m_snd;
- required_device<colecovision_control_port_device> m_joy[2];
- required_device<colecovision_cartridge_slot_device> m_cart;
+ required_device<generic_slot_device> m_cart_rom;
};
// device type definition
diff --git a/src/devices/bus/svi3x8/slot/slot.cpp b/src/devices/bus/svi3x8/slot/slot.cpp
index eb2137ce629..c345d864f4b 100644
--- a/src/devices/bus/svi3x8/slot/slot.cpp
+++ b/src/devices/bus/svi3x8/slot/slot.cpp
@@ -20,11 +20,11 @@ DEFINE_DEVICE_TYPE(SVI_SLOT_BUS, svi_slot_bus_device, "svislotbus", "SVI Slot Bu
// svi_slot_bus_device - constructor
//-------------------------------------------------
-svi_slot_bus_device::svi_slot_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, SVI_SLOT_BUS, tag, owner, clock)
- , m_int_handler(*this)
- , m_romdis_handler(*this)
- , m_ramdis_handler(*this)
+svi_slot_bus_device::svi_slot_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, SVI_SLOT_BUS, tag, owner, clock),
+ m_int_handler(*this),
+ m_romdis_handler(*this),
+ m_ramdis_handler(*this)
{
}
@@ -71,14 +71,14 @@ void svi_slot_bus_device::add_card(device_svi_slot_interface *card)
// mreq_r - memory read from slot
//-------------------------------------------------
-uint8_t svi_slot_bus_device::mreq_r(offs_t offset)
+READ8_MEMBER( svi_slot_bus_device::mreq_r )
{
device_svi_slot_interface *entry = m_dev.first();
uint8_t data = 0xff;
while (entry)
{
- data &= entry->mreq_r(offset);
+ data &= entry->mreq_r(space, offset);
entry = entry->next();
}
@@ -89,13 +89,13 @@ uint8_t svi_slot_bus_device::mreq_r(offs_t offset)
// mreq_w - memory write to slot
//-------------------------------------------------
-void svi_slot_bus_device::mreq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( svi_slot_bus_device::mreq_w )
{
device_svi_slot_interface *entry = m_dev.first();
while (entry)
{
- entry->mreq_w(offset, data);
+ entry->mreq_w(space, offset, data);
entry = entry->next();
}
}
@@ -104,14 +104,14 @@ void svi_slot_bus_device::mreq_w(offs_t offset, uint8_t data)
// iorq_r - memory read from slot
//-------------------------------------------------
-uint8_t svi_slot_bus_device::iorq_r(offs_t offset)
+READ8_MEMBER( svi_slot_bus_device::iorq_r )
{
device_svi_slot_interface *entry = m_dev.first();
uint8_t data = 0xff;
while (entry)
{
- data &= entry->iorq_r(offset);
+ data &= entry->iorq_r(space, offset);
entry = entry->next();
}
@@ -122,13 +122,13 @@ uint8_t svi_slot_bus_device::iorq_r(offs_t offset)
// iorq_w - memory write to slot
//-------------------------------------------------
-void svi_slot_bus_device::iorq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( svi_slot_bus_device::iorq_w )
{
device_svi_slot_interface *entry = m_dev.first();
while (entry)
{
- entry->iorq_w(offset, data);
+ entry->iorq_w(space, offset, data);
entry = entry->next();
}
}
@@ -204,9 +204,10 @@ DEFINE_DEVICE_TYPE(SVI_SLOT, svi_slot_device, "svislot", "SVI Slot")
// svi_slot_device - constructor
//-------------------------------------------------
-svi_slot_device::svi_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, SVI_SLOT, tag, owner, clock)
- , device_slot_interface(mconfig, *this)
+svi_slot_device::svi_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, SVI_SLOT, tag, owner, clock),
+ device_slot_interface(mconfig, *this),
+ m_bus_tag(nullptr)
{
}
@@ -220,7 +221,7 @@ void svi_slot_device::device_start()
if (dev)
{
- svi_slot_bus_device *bus = downcast<svi_slot_bus_device *>(owner()->subdevice(SVIBUS_TAG));
+ svi_slot_bus_device *bus = downcast<svi_slot_bus_device *>(m_owner->subdevice(m_bus_tag));
bus->add_card(dev);
}
}
diff --git a/src/devices/bus/svi3x8/slot/slot.h b/src/devices/bus/svi3x8/slot/slot.h
index 756f17658fd..702c005b770 100644
--- a/src/devices/bus/svi3x8/slot/slot.h
+++ b/src/devices/bus/svi3x8/slot/slot.h
@@ -40,11 +40,27 @@
#pragma once
+
//**************************************************************************
-// CONSTANTS / MACROS
+// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define SVIBUS_TAG "slot_bux"
+#define MCFG_SVI_SLOT_BUS_ADD \
+ MCFG_DEVICE_ADD("slotbus", SVI_SLOT_BUS, 0)
+
+#define MCFG_SVI_SLOT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, SVI_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<svi_slot_device &>(*device).set_bus(this, "slotbus");
+
+#define MCFG_SVI_SLOT_INT_HANDLER(_devcb) \
+ downcast<svi_slot_bus_device &>(*device).set_int_handler(DEVCB_##_devcb);
+
+#define MCFG_SVI_SLOT_ROMDIS_HANDLER(_devcb) \
+ downcast<svi_slot_bus_device &>(*device).set_romdis_handler(DEVCB_##_devcb);
+
+#define MCFG_SVI_SLOT_RAMDIS_HANDLER(_devcb) \
+ downcast<svi_slot_bus_device &>(*device).set_ramdis_handler(DEVCB_##_devcb);
//**************************************************************************
@@ -63,9 +79,9 @@ public:
virtual ~svi_slot_bus_device();
// callbacks
- auto int_handler() { return m_int_handler.bind(); }
- auto romdis_handler() { return m_romdis_handler.bind(); }
- auto ramdis_handler() { return m_ramdis_handler.bind(); }
+ template <class Object> devcb_base &set_int_handler(Object &&cb) { return m_int_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_romdis_handler(Object &&cb) { return m_romdis_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ramdis_handler(Object &&cb) { return m_ramdis_handler.set_callback(std::forward<Object>(cb)); }
void add_card(device_svi_slot_interface *card);
@@ -75,10 +91,10 @@ public:
DECLARE_WRITE_LINE_MEMBER( ramdis_w ) { m_ramdis_handler(state); };
// from host
- uint8_t mreq_r(offs_t offset);
- void mreq_w(offs_t offset, uint8_t data);
- uint8_t iorq_r(offs_t offset);
- void iorq_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( mreq_r );
+ DECLARE_WRITE8_MEMBER( mreq_w );
+ DECLARE_READ8_MEMBER( iorq_r );
+ DECLARE_WRITE8_MEMBER( iorq_w );
DECLARE_WRITE_LINE_MEMBER( bk21_w );
DECLARE_WRITE_LINE_MEMBER( bk22_w );
@@ -106,18 +122,11 @@ class svi_slot_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- template <typename T>
- svi_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : svi_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
svi_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ // inline configuration
+ void set_bus(device_t *owner, const char *bus_tag) { m_owner = owner; m_bus_tag = bus_tag; }
+
protected:
// device-level overrides
virtual void device_start() override;
@@ -143,10 +152,10 @@ public:
device_svi_slot_interface *next() const { return m_next; }
- virtual uint8_t mreq_r(offs_t offset) { return 0xff; }
- virtual void mreq_w(offs_t offset, uint8_t data) { }
- virtual uint8_t iorq_r(offs_t offset) { return 0xff; }
- virtual void iorq_w(offs_t offset, uint8_t data) { }
+ virtual DECLARE_READ8_MEMBER( mreq_r ) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER( mreq_w ) { }
+ virtual DECLARE_READ8_MEMBER( iorq_r ) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER( iorq_w ) { }
virtual DECLARE_WRITE_LINE_MEMBER( bk21_w ) { }
virtual DECLARE_WRITE_LINE_MEMBER( bk22_w ) { }
diff --git a/src/devices/bus/svi3x8/slot/sv801.cpp b/src/devices/bus/svi3x8/slot/sv801.cpp
index 9d73b62aec1..48881ffc9e1 100644
--- a/src/devices/bus/svi3x8/slot/sv801.cpp
+++ b/src/devices/bus/svi3x8/slot/sv801.cpp
@@ -97,7 +97,7 @@ WRITE_LINE_MEMBER( sv801_device::drq_w )
m_drq = state;
}
-void sv801_device::motor_w(uint8_t data)
+WRITE8_MEMBER( sv801_device::motor_w )
{
m_floppy = nullptr;
@@ -112,7 +112,7 @@ void sv801_device::motor_w(uint8_t data)
m_floppy1->get_device()->mon_w(!BIT(data, 3));
}
-uint8_t sv801_device::iorq_r(offs_t offset)
+READ8_MEMBER( sv801_device::iorq_r )
{
switch (offset)
{
@@ -126,7 +126,7 @@ uint8_t sv801_device::iorq_r(offs_t offset)
return 0xff;
}
-void sv801_device::iorq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sv801_device::iorq_w )
{
switch (offset)
{
@@ -134,7 +134,7 @@ void sv801_device::iorq_w(offs_t offset, uint8_t data)
case 0x31: m_fdc->track_w(data); break;
case 0x32: m_fdc->sector_w(data); break;
case 0x33: m_fdc->data_w(data); break;
- case 0x34: motor_w(data); break;
+ case 0x34: motor_w(space, 0, data); break;
case 0x38:
m_fdc->dden_w(BIT(data, 0));
if (m_floppy)
diff --git a/src/devices/bus/svi3x8/slot/sv801.h b/src/devices/bus/svi3x8/slot/sv801.h
index 29c2014b872..38dea1e55d0 100644
--- a/src/devices/bus/svi3x8/slot/sv801.h
+++ b/src/devices/bus/svi3x8/slot/sv801.h
@@ -28,8 +28,8 @@ public:
// construction/destruction
sv801_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( iorq_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( iorq_w ) override;
protected:
virtual void device_add_mconfig(machine_config &config) override;
@@ -37,7 +37,7 @@ protected:
virtual void device_reset() override;
private:
- void motor_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( motor_w );
DECLARE_WRITE_LINE_MEMBER( intrq_w );
DECLARE_WRITE_LINE_MEMBER( drq_w );
diff --git a/src/devices/bus/svi3x8/slot/sv802.cpp b/src/devices/bus/svi3x8/slot/sv802.cpp
index 909ed2fa712..2cc905d472c 100644
--- a/src/devices/bus/svi3x8/slot/sv802.cpp
+++ b/src/devices/bus/svi3x8/slot/sv802.cpp
@@ -20,14 +20,12 @@ DEFINE_DEVICE_TYPE(SV802, sv802_device, "sv802", "SV-802 Centronics Printer Inte
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void sv802_device::device_add_mconfig(machine_config &config)
-{
- CENTRONICS(config, m_centronics, centronics_devices, "printer");
- m_centronics->busy_handler().set(FUNC(sv802_device::busy_w));
+MACHINE_CONFIG_START(sv802_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer")
+ MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, sv802_device, busy_w))
- OUTPUT_LATCH(config, m_cent_data_out);
- m_centronics->set_output_latch(*m_cent_data_out);
-}
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
+MACHINE_CONFIG_END
//**************************************************************************
@@ -62,7 +60,7 @@ void sv802_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t sv802_device::iorq_r(offs_t offset)
+READ8_MEMBER( sv802_device::iorq_r )
{
if (offset == 0x12)
return 0xfe | m_busy;
@@ -70,7 +68,7 @@ uint8_t sv802_device::iorq_r(offs_t offset)
return 0xff;
}
-void sv802_device::iorq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sv802_device::iorq_w )
{
switch (offset)
{
diff --git a/src/devices/bus/svi3x8/slot/sv802.h b/src/devices/bus/svi3x8/slot/sv802.h
index aabea33bbaf..2a06329c966 100644
--- a/src/devices/bus/svi3x8/slot/sv802.h
+++ b/src/devices/bus/svi3x8/slot/sv802.h
@@ -28,8 +28,8 @@ public:
// construction/destruction
sv802_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( iorq_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( iorq_w ) override;
protected:
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/bus/svi3x8/slot/sv803.cpp b/src/devices/bus/svi3x8/slot/sv803.cpp
index 6adc07fd193..db79801530c 100644
--- a/src/devices/bus/svi3x8/slot/sv803.cpp
+++ b/src/devices/bus/svi3x8/slot/sv803.cpp
@@ -56,7 +56,7 @@ void sv803_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-uint8_t sv803_device::mreq_r(offs_t offset)
+READ8_MEMBER( sv803_device::mreq_r )
{
if (offset >= 0x8000 && offset <= 0xbfff)
return m_ram[offset - 0x8000];
@@ -64,7 +64,7 @@ uint8_t sv803_device::mreq_r(offs_t offset)
return 0xff;
}
-void sv803_device::mreq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sv803_device::mreq_w )
{
if (offset >= 0x8000 && offset <= 0xbfff)
m_ram[offset - 0x8000] = data;
diff --git a/src/devices/bus/svi3x8/slot/sv803.h b/src/devices/bus/svi3x8/slot/sv803.h
index 8cae18acf64..6fd1d2b635a 100644
--- a/src/devices/bus/svi3x8/slot/sv803.h
+++ b/src/devices/bus/svi3x8/slot/sv803.h
@@ -26,8 +26,8 @@ public:
// construction/destruction
sv803_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( mreq_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( mreq_w ) override;
protected:
virtual void device_start() override;
diff --git a/src/devices/bus/svi3x8/slot/sv805.cpp b/src/devices/bus/svi3x8/slot/sv805.cpp
index cdcaee6f167..bc4dc77c19f 100644
--- a/src/devices/bus/svi3x8/slot/sv805.cpp
+++ b/src/devices/bus/svi3x8/slot/sv805.cpp
@@ -65,7 +65,7 @@ void sv805_device::device_start()
// IMPLEMENTATION
//**************************************************************************
-uint8_t sv805_device::iorq_r(offs_t offset)
+READ8_MEMBER( sv805_device::iorq_r )
{
switch (offset)
{
@@ -77,13 +77,13 @@ uint8_t sv805_device::iorq_r(offs_t offset)
case 0x2d:
case 0x2e:
case 0x2f:
- return m_uart->ins8250_r(machine().dummy_space(), offset & 0x07);
+ return m_uart->ins8250_r(space, offset & 0x07);
}
return 0xff;
}
-void sv805_device::iorq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sv805_device::iorq_w )
{
switch (offset)
{
@@ -95,7 +95,7 @@ void sv805_device::iorq_w(offs_t offset, uint8_t data)
case 0x2d:
case 0x2e:
case 0x2f:
- m_uart->ins8250_w(machine().dummy_space(), offset & 0x07, data);
+ m_uart->ins8250_w(space, offset & 0x07, data);
}
}
diff --git a/src/devices/bus/svi3x8/slot/sv805.h b/src/devices/bus/svi3x8/slot/sv805.h
index 892dc23b432..3a6f350a490 100644
--- a/src/devices/bus/svi3x8/slot/sv805.h
+++ b/src/devices/bus/svi3x8/slot/sv805.h
@@ -28,8 +28,8 @@ public:
// construction/destruction
sv805_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( iorq_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( iorq_w ) override;
protected:
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/bus/svi3x8/slot/sv806.cpp b/src/devices/bus/svi3x8/slot/sv806.cpp
index aed4fb80bda..5408aa8738c 100644
--- a/src/devices/bus/svi3x8/slot/sv806.cpp
+++ b/src/devices/bus/svi3x8/slot/sv806.cpp
@@ -114,7 +114,7 @@ MC6845_UPDATE_ROW( sv806_device::crtc_update_row )
}
}
-uint8_t sv806_device::mreq_r(offs_t offset)
+READ8_MEMBER( sv806_device::mreq_r )
{
if (offset >= 0xf000 && m_ram_enabled)
{
@@ -125,7 +125,7 @@ uint8_t sv806_device::mreq_r(offs_t offset)
return 0xff;
}
-void sv806_device::mreq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sv806_device::mreq_w )
{
if (offset >= 0xf000 && m_ram_enabled)
{
@@ -134,20 +134,20 @@ void sv806_device::mreq_w(offs_t offset, uint8_t data)
}
}
-uint8_t sv806_device::iorq_r(offs_t offset)
+READ8_MEMBER( sv806_device::iorq_r )
{
if (offset == 0x51)
- return m_crtc->register_r();
+ return m_crtc->register_r(space, 0);
return 0xff;
}
-void sv806_device::iorq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sv806_device::iorq_w )
{
switch (offset)
{
- case 0x50: m_crtc->address_w(data); break;
- case 0x51: m_crtc->register_w(data); break;
+ case 0x50: m_crtc->address_w(space, 0, data); break;
+ case 0x51: m_crtc->register_w(space, 0, data); break;
case 0x58: m_ram_enabled = data; break;
}
}
diff --git a/src/devices/bus/svi3x8/slot/sv806.h b/src/devices/bus/svi3x8/slot/sv806.h
index e6af5071c56..868117b8565 100644
--- a/src/devices/bus/svi3x8/slot/sv806.h
+++ b/src/devices/bus/svi3x8/slot/sv806.h
@@ -28,10 +28,10 @@ public:
// construction/destruction
sv806_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
- virtual uint8_t iorq_r(offs_t offset) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( mreq_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( mreq_w ) override;
+ virtual DECLARE_READ8_MEMBER( iorq_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( iorq_w ) override;
protected:
virtual const tiny_rom_entry *device_rom_region() const override;
diff --git a/src/devices/bus/svi3x8/slot/sv807.cpp b/src/devices/bus/svi3x8/slot/sv807.cpp
index 281b7845c64..6ea6a77a6bc 100644
--- a/src/devices/bus/svi3x8/slot/sv807.cpp
+++ b/src/devices/bus/svi3x8/slot/sv807.cpp
@@ -118,7 +118,7 @@ void sv807_device::device_reset()
// test setup: S2 = enabled (22), S3 = enabled (31)
-uint8_t sv807_device::mreq_r(offs_t offset)
+READ8_MEMBER( sv807_device::mreq_r )
{
if ((BK21_ACTIVE || BK31_ACTIVE) && offset < 0x8000)
{
@@ -135,7 +135,7 @@ uint8_t sv807_device::mreq_r(offs_t offset)
return 0xff;
}
-void sv807_device::mreq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( sv807_device::mreq_w )
{
if ((BK21_ACTIVE || BK31_ACTIVE) && offset < 0x8000)
{
diff --git a/src/devices/bus/svi3x8/slot/sv807.h b/src/devices/bus/svi3x8/slot/sv807.h
index 8d12befff79..e3f12201d37 100644
--- a/src/devices/bus/svi3x8/slot/sv807.h
+++ b/src/devices/bus/svi3x8/slot/sv807.h
@@ -29,8 +29,8 @@ public:
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t mreq_r(offs_t offset) override;
- virtual void mreq_w(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( mreq_r ) override;
+ virtual DECLARE_WRITE8_MEMBER( mreq_w ) override;
virtual void bk21_w(int state) override;
virtual void bk22_w(int state) override;
diff --git a/src/devices/bus/ti8x/bitsocket.cpp b/src/devices/bus/ti8x/bitsocket.cpp
index bfe7849aa40..e9394788d94 100644
--- a/src/devices/bus/ti8x/bitsocket.cpp
+++ b/src/devices/bus/ti8x/bitsocket.cpp
@@ -25,10 +25,9 @@ bit_socket_device::bit_socket_device(
}
-void bit_socket_device::device_add_mconfig(machine_config &config)
-{
- BITBANGER(config, m_stream, 0);
-}
+MACHINE_CONFIG_START(bit_socket_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("stream", BITBANGER, 0)
+MACHINE_CONFIG_END
void bit_socket_device::device_start()
diff --git a/src/devices/bus/ti8x/teeconn.cpp b/src/devices/bus/ti8x/teeconn.cpp
index 7277d4af93e..a251ee1ca4b 100644
--- a/src/devices/bus/ti8x/teeconn.cpp
+++ b/src/devices/bus/ti8x/teeconn.cpp
@@ -61,16 +61,15 @@ WRITE_LINE_MEMBER(tee_connector_device::ring_b_w)
}
-void tee_connector_device::device_add_mconfig(machine_config &config)
-{
- TI8X_LINK_PORT(config, m_port_a, default_ti8x_link_devices, nullptr);
- m_port_a->tip_handler().set(FUNC(tee_connector_device::tip_a_w));
- m_port_a->ring_handler().set(FUNC(tee_connector_device::ring_a_w));
-
- TI8X_LINK_PORT(config, m_port_b, default_ti8x_link_devices, nullptr);
- m_port_b->tip_handler().set(FUNC(tee_connector_device::tip_b_w));
- m_port_b->ring_handler().set(FUNC(tee_connector_device::ring_b_w));
-}
+MACHINE_CONFIG_START(tee_connector_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(m_port_a, TI8X_LINK_PORT, default_ti8x_link_devices, nullptr)
+ MCFG_TI8X_LINK_TIP_HANDLER(WRITELINE(*this, tee_connector_device, tip_a_w))
+ MCFG_TI8X_LINK_RING_HANDLER(WRITELINE(*this, tee_connector_device, ring_a_w))
+
+ MCFG_DEVICE_ADD(m_port_b, TI8X_LINK_PORT, default_ti8x_link_devices, nullptr)
+ MCFG_TI8X_LINK_TIP_HANDLER(WRITELINE(*this, tee_connector_device, tip_b_w))
+ MCFG_TI8X_LINK_RING_HANDLER(WRITELINE(*this, tee_connector_device, ring_b_w))
+MACHINE_CONFIG_END
void tee_connector_device::device_start()
diff --git a/src/devices/bus/ti8x/ti8x.h b/src/devices/bus/ti8x/ti8x.h
index e81a4fc5a9e..1a01aeda2e3 100644
--- a/src/devices/bus/ti8x/ti8x.h
+++ b/src/devices/bus/ti8x/ti8x.h
@@ -42,6 +42,13 @@
DECLARE_DEVICE_TYPE(TI8X_LINK_PORT, ti8x_link_port_device)
+#define MCFG_TI8X_LINK_TIP_HANDLER(cb) \
+ downcast<ti8x_link_port_device &>(*device).set_tip_handler(DEVCB_##cb);
+
+#define MCFG_TI8X_LINK_RING_HANDLER(cb) \
+ downcast<ti8x_link_port_device &>(*device).set_ring_handler(DEVCB_##cb);
+
+
class device_ti8x_link_port_interface;
@@ -60,8 +67,8 @@ public:
ti8x_link_port_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = 0);
// static configuration helpers
- auto tip_handler() { return m_tip_handler.bind(); }
- auto ring_handler() { return m_ring_handler.bind(); }
+ template <class Object> devcb_base &set_tip_handler(Object &&cb) { return m_tip_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ring_handler(Object &&cb) { return m_ring_handler.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE_LINE_MEMBER(tip_w);
DECLARE_WRITE_LINE_MEMBER(ring_w);
diff --git a/src/devices/bus/ti8x/tispeaker.cpp b/src/devices/bus/ti8x/tispeaker.cpp
index ed9ec36a5ec..17d81fe10b9 100644
--- a/src/devices/bus/ti8x/tispeaker.cpp
+++ b/src/devices/bus/ti8x/tispeaker.cpp
@@ -26,15 +26,16 @@ stereo_speaker_device::stereo_speaker_device(
}
-void stereo_speaker_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(stereo_speaker_device::device_add_mconfig)
SPEAKER(config, "outl").front_left();
SPEAKER(config, "outr").front_right();
- SPEAKER_SOUND(config, m_left_speaker, 0).add_route(ALL_OUTPUTS, "outl", 0.50);
+ MCFG_DEVICE_ADD("lspkr", SPEAKER_SOUND, 0)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "outl", 0.50)
- SPEAKER_SOUND(config, m_right_speaker, 0).add_route(ALL_OUTPUTS, "outr", 0.50);
-}
+ MCFG_DEVICE_ADD("rspkr", SPEAKER_SOUND, 0)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "outr", 0.50)
+MACHINE_CONFIG_END
void stereo_speaker_device::device_start()
@@ -69,12 +70,12 @@ mono_speaker_device::mono_speaker_device(
}
-void mono_speaker_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(mono_speaker_device::device_add_mconfig)
SPEAKER(config, "mono").front_center();
- SPEAKER_SOUND(config, m_speaker, 0).add_route(ALL_OUTPUTS, "mono", 0.50);
-}
+ MCFG_DEVICE_ADD("spkr", SPEAKER_SOUND, 0)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
+MACHINE_CONFIG_END
void mono_speaker_device::device_start()
diff --git a/src/devices/bus/ti99/gromport/cartridges.cpp b/src/devices/bus/ti99/gromport/cartridges.cpp
index d3f3f75a10a..7e93029f97f 100644
--- a/src/devices/bus/ti99/gromport/cartridges.cpp
+++ b/src/devices/bus/ti99/gromport/cartridges.cpp
@@ -341,23 +341,23 @@ void ti99_cartridge_device::set_slot(int i)
READ8Z_MEMBER(ti99_cartridge_device::readz)
{
if (m_pcb != nullptr)
- m_pcb->readz(offset, value);
+ m_pcb->readz(space, offset, value);
}
-void ti99_cartridge_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_cartridge_device::write)
{
if (m_pcb != nullptr)
- m_pcb->write(offset, data);
+ m_pcb->write(space, offset, data);
}
READ8Z_MEMBER(ti99_cartridge_device::crureadz)
{
- if (m_pcb != nullptr) m_pcb->crureadz(offset, value);
+ if (m_pcb != nullptr) m_pcb->crureadz(space, offset, value);
}
-void ti99_cartridge_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_cartridge_device::cruwrite)
{
- if (m_pcb != nullptr) m_pcb->cruwrite(offset, data);
+ if (m_pcb != nullptr) m_pcb->cruwrite(space, offset, data);
}
WRITE_LINE_MEMBER( ti99_cartridge_device::ready_line )
@@ -509,7 +509,7 @@ READ8Z_MEMBER(ti99_cartridge_pcb::readz)
}
}
-void ti99_cartridge_pcb::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_cartridge_pcb::write)
{
if (m_romspace_selected)
{
@@ -526,7 +526,7 @@ READ8Z_MEMBER(ti99_cartridge_pcb::crureadz)
{
}
-void ti99_cartridge_pcb::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_cartridge_pcb::cruwrite)
{
}
@@ -614,7 +614,7 @@ READ8Z_MEMBER(ti99_paged12k_cartridge::readz)
}
}
-void ti99_paged12k_cartridge::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_paged12k_cartridge::write)
{
if (m_romspace_selected)
{
@@ -663,7 +663,7 @@ READ8Z_MEMBER(ti99_paged16k_cartridge::readz)
}
}
-void ti99_paged16k_cartridge::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_paged16k_cartridge::write)
{
if (m_romspace_selected)
{
@@ -720,7 +720,7 @@ READ8Z_MEMBER(ti99_minimem_cartridge::readz)
}
/* Write function for the minimem cartridge. */
-void ti99_minimem_cartridge::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_minimem_cartridge::write)
{
if (m_romspace_selected)
{
@@ -788,7 +788,7 @@ READ8Z_MEMBER(ti99_super_cartridge::readz)
}
/* Write function for the super cartridge. */
-void ti99_super_cartridge::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_super_cartridge::write)
{
if (m_romspace_selected)
{
@@ -826,15 +826,19 @@ READ8Z_MEMBER(ti99_super_cartridge::crureadz)
// SRL R0,1 Restore Bank Number (optional)
// RT
+ // Our implementation in MESS always gets 8 bits in one go. Also, the address
+ // is twice the bit number. That is, the offset value is always a multiple
+ // of 0x10.
+
if ((offset & 0xfff0) == 0x0800)
{
LOGMASKED(LOG_CRU, "CRU accessed at %04x\n", offset);
uint8_t val = 0x02 << (m_ram_page << 1);
- *value = BIT(val, (offset & 0x000e) >> 1);
+ *value = (val >> ((offset - 0x0800)>>1)) & 0xff;
}
}
-void ti99_super_cartridge::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_super_cartridge::cruwrite)
{
if ((offset & 0xfff0) == 0x0800)
{
@@ -919,7 +923,7 @@ READ8Z_MEMBER(ti99_mbx_cartridge::readz)
}
/* Write function for the mbx cartridge. */
-void ti99_mbx_cartridge::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_mbx_cartridge::write)
{
if (m_romspace_selected)
{
@@ -995,7 +999,7 @@ READ8Z_MEMBER(ti99_paged7_cartridge::readz)
}
/* Write function for the paged7 cartridge. */
-void ti99_paged7_cartridge::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_paged7_cartridge::write)
{
if (m_romspace_selected)
{
@@ -1067,7 +1071,7 @@ READ8Z_MEMBER(ti99_paged379i_cartridge::readz)
}
/* Write function for the paged379i cartridge. Only used to set the bank. */
-void ti99_paged379i_cartridge::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_paged379i_cartridge::write)
{
// Bits: 011x xxxx xxxb bbbx
// x = don't care, bbbb = bank
@@ -1118,7 +1122,7 @@ READ8Z_MEMBER(ti99_paged378_cartridge::readz)
}
/* Write function for the paged378 cartridge. Only used to set the bank. */
-void ti99_paged378_cartridge::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_paged378_cartridge::write)
{
// Bits: 011x xxxx xbbb bbbx
// x = don't care, bbbb = bank
@@ -1158,7 +1162,7 @@ READ8Z_MEMBER(ti99_paged377_cartridge::readz)
}
/* Write function for the paged377 cartridge. Only used to set the bank. */
-void ti99_paged377_cartridge::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_paged377_cartridge::write)
{
// Bits: 011x xxxb bbbb bbbx
// x = don't care, bbbb = bank
@@ -1212,7 +1216,7 @@ READ8Z_MEMBER(ti99_pagedcru_cartridge::readz)
}
/* Write function for the pagedcru cartridge. No effect. */
-void ti99_pagedcru_cartridge::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_pagedcru_cartridge::write)
{
return;
}
@@ -1227,11 +1231,11 @@ READ8Z_MEMBER(ti99_pagedcru_cartridge::crureadz)
{
page = page-(bit/2); // 4 page flags per 8 bits
}
- *value = (offset & 0x000e) == (page * 4 + 2) ? 1 : 0;
+ *value = 1 << (page*2+1);
}
}
-void ti99_pagedcru_cartridge::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_pagedcru_cartridge::cruwrite)
{
if ((offset & 0xf800)==0x0800)
{
@@ -1303,7 +1307,7 @@ READ8Z_MEMBER(ti99_gromemu_cartridge::readz)
{
if (m_grom_selected)
{
- if (m_grom_read_mode) gromemureadz(offset, value);
+ if (m_grom_read_mode) gromemureadz(space, offset, value, mem_mask);
}
else
{
@@ -1323,7 +1327,7 @@ READ8Z_MEMBER(ti99_gromemu_cartridge::readz)
}
}
-void ti99_gromemu_cartridge::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_gromemu_cartridge::write)
{
if (m_romspace_selected)
{
@@ -1344,7 +1348,7 @@ void ti99_gromemu_cartridge::write(offs_t offset, uint8_t data)
// Will not change anything when not selected (preceding gsq=ASSERT)
if (m_grom_selected)
{
- if (!m_grom_read_mode) gromemuwrite(offset, data);
+ if (!m_grom_read_mode) gromemuwrite(space, offset, data, mem_mask);
}
}
}
@@ -1369,7 +1373,7 @@ READ8Z_MEMBER(ti99_gromemu_cartridge::gromemureadz)
m_waddr_LSB = false;
}
-void ti99_gromemu_cartridge::gromemuwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_gromemu_cartridge::gromemuwrite)
{
// Set GROM address
if (m_grom_address_mode)
diff --git a/src/devices/bus/ti99/gromport/cartridges.h b/src/devices/bus/ti99/gromport/cartridges.h
index e2e729f2d59..b969e65eccf 100644
--- a/src/devices/bus/ti99/gromport/cartridges.h
+++ b/src/devices/bus/ti99/gromport/cartridges.h
@@ -66,9 +66,9 @@ public:
ti99_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz);
- void write(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER(write);
DECLARE_READ8Z_MEMBER(crureadz);
- void cruwrite(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER(cruwrite);
DECLARE_WRITE_LINE_MEMBER(ready_line);
DECLARE_WRITE_LINE_MEMBER(romgq_line);
@@ -213,9 +213,9 @@ public:
protected:
virtual DECLARE_READ8Z_MEMBER(readz);
- virtual void write(offs_t offset, uint8_t data);
+ virtual DECLARE_WRITE8_MEMBER(write);
virtual DECLARE_READ8Z_MEMBER(crureadz);
- virtual void cruwrite(offs_t offset, uint8_t data);
+ virtual DECLARE_WRITE8_MEMBER(cruwrite);
DECLARE_WRITE_LINE_MEMBER(romgq_line);
virtual void set_gromlines(line_state mline, line_state moline, line_state gsq);
@@ -263,7 +263,7 @@ class ti99_paged12k_cartridge : public ti99_cartridge_pcb
{
public:
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
};
/*********** Paged cartridge (others) ********************/
@@ -272,7 +272,7 @@ class ti99_paged16k_cartridge : public ti99_cartridge_pcb
{
public:
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
};
/*********** Paged7 cartridge (late carts) ********************/
@@ -281,7 +281,7 @@ class ti99_paged7_cartridge : public ti99_cartridge_pcb
{
public:
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
};
/********************** Mini Memory ***********************************/
@@ -290,7 +290,7 @@ class ti99_minimem_cartridge : public ti99_cartridge_pcb
{
public:
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
};
/********************* Super Space II *********************************/
@@ -299,9 +299,9 @@ class ti99_super_cartridge : public ti99_cartridge_pcb
{
public:
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
};
/************************* MBX ***************************************/
@@ -310,7 +310,7 @@ class ti99_mbx_cartridge : public ti99_cartridge_pcb
{
public:
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
};
/********************** Paged 379i ************************************/
@@ -319,7 +319,7 @@ class ti99_paged379i_cartridge : public ti99_cartridge_pcb
{
public:
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
private:
int get_paged379i_bank(int rompage);
};
@@ -330,7 +330,7 @@ class ti99_paged378_cartridge : public ti99_cartridge_pcb
{
public:
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
};
/********************** Paged 377 ************************************/
@@ -339,7 +339,7 @@ class ti99_paged377_cartridge : public ti99_cartridge_pcb
{
public:
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
};
/********************** Paged CRU ************************************/
@@ -348,9 +348,9 @@ class ti99_pagedcru_cartridge : public ti99_cartridge_pcb
{
public:
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
};
/********************** GROM emulation cartridge ************************************/
@@ -361,9 +361,9 @@ public:
ti99_gromemu_cartridge(): m_waddr_LSB(false), m_grom_selected(false), m_grom_read_mode(false), m_grom_address_mode(false)
{ m_grom_address = 0; }
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(gromemureadz);
- void gromemuwrite(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER(gromemuwrite);
void set_gromlines(line_state mline, line_state moline, line_state gsq) override;
private:
diff --git a/src/devices/bus/ti99/gromport/gkracker.cpp b/src/devices/bus/ti99/gromport/gkracker.cpp
index 57ccfbc87e1..d9de20949b2 100644
--- a/src/devices/bus/ti99/gromport/gkracker.cpp
+++ b/src/devices/bus/ti99/gromport/gkracker.cpp
@@ -227,18 +227,18 @@ READ8Z_MEMBER(ti99_gkracker_device::readz)
uint8_t val1 = *value;
// Read from the guest cartridge.
- m_cartridge->readz(offset, value);
+ m_cartridge->readz(space, offset, value, mem_mask);
if (val1 != *value)
LOGMASKED(LOG_GKRACKER, "Read (from guest) %04x -> %02x\n", offset, *value);
}
}
-void ti99_gkracker_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_gkracker_device::write)
{
// write to the guest cartridge if present
if (m_cartridge != nullptr)
{
- m_cartridge->write(offset, data);
+ m_cartridge->write(space, offset, data, mem_mask);
}
if (m_grom_selected)
@@ -307,12 +307,12 @@ void ti99_gkracker_device::write(offs_t offset, uint8_t data)
READ8Z_MEMBER( ti99_gkracker_device::crureadz )
{
- if (m_cartridge != nullptr) m_cartridge->crureadz(offset, value);
+ if (m_cartridge != nullptr) m_cartridge->crureadz(space, offset, value);
}
-void ti99_gkracker_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER( ti99_gkracker_device::cruwrite )
{
- if (m_cartridge != nullptr) m_cartridge->cruwrite(offset, data);
+ if (m_cartridge != nullptr) m_cartridge->cruwrite(space, offset, data);
}
INPUT_CHANGED_MEMBER( ti99_gkracker_device::gk_changed )
diff --git a/src/devices/bus/ti99/gromport/gkracker.h b/src/devices/bus/ti99/gromport/gkracker.h
index 34b267bf640..bb3d278d57a 100644
--- a/src/devices/bus/ti99/gromport/gkracker.h
+++ b/src/devices/bus/ti99/gromport/gkracker.h
@@ -19,9 +19,9 @@ public:
ti99_gkracker_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
DECLARE_WRITE_LINE_MEMBER(romgq_line) override;
void set_gromlines(line_state mline, line_state moline, line_state gsq) override;
diff --git a/src/devices/bus/ti99/gromport/gromport.cpp b/src/devices/bus/ti99/gromport/gromport.cpp
index 5f893aa4423..b6fa23e1111 100644
--- a/src/devices/bus/ti99/gromport/gromport.cpp
+++ b/src/devices/bus/ti99/gromport/gromport.cpp
@@ -143,7 +143,7 @@ READ8Z_MEMBER(gromport_device::readz)
{
if (m_connector != nullptr)
{
- m_connector->readz(offset & m_mask, value);
+ m_connector->readz(space, offset & m_mask, value);
if (m_romgq) LOGMASKED(LOG_READ, "Read %04x -> %02x\n", offset | 0x6000, *value);
}
}
@@ -152,25 +152,25 @@ READ8Z_MEMBER(gromport_device::readz)
Writing via the GROM port. Only 13 address lines are passed through
on the TI-99/4A, and 14 lines on the TI-99/8.
*/
-void gromport_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gromport_device::write)
{
if (m_connector != nullptr)
{
if (m_romgq) LOGMASKED(LOG_WRITE, "Write %04x <- %02x\n", offset | 0x6000, data);
- m_connector->write(offset & m_mask, data);
+ m_connector->write(space, offset & m_mask, data);
}
}
READ8Z_MEMBER(gromport_device::crureadz)
{
if (m_connector != nullptr)
- m_connector->crureadz(offset, value);
+ m_connector->crureadz(space, offset, value);
}
-void gromport_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(gromport_device::cruwrite)
{
if (m_connector != nullptr)
- m_connector->cruwrite(offset, data);
+ m_connector->cruwrite(space, offset, data);
}
WRITE_LINE_MEMBER(gromport_device::ready_line)
diff --git a/src/devices/bus/ti99/gromport/gromport.h b/src/devices/bus/ti99/gromport/gromport.h
index 9c04ef5a8b8..8d5c61ce78d 100644
--- a/src/devices/bus/ti99/gromport/gromport.h
+++ b/src/devices/bus/ti99/gromport/gromport.h
@@ -39,11 +39,10 @@ public:
}
gromport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
DECLARE_READ8Z_MEMBER(readz);
- void write(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER(write);
DECLARE_READ8Z_MEMBER(crureadz);
- void cruwrite(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER(cruwrite);
DECLARE_WRITE_LINE_MEMBER(ready_line);
DECLARE_WRITE_LINE_MEMBER(romgq_line);
void set_gromlines(line_state mline, line_state moline, line_state gsq);
@@ -77,11 +76,11 @@ class cartridge_connector_device : public device_t
{
public:
virtual DECLARE_READ8Z_MEMBER(readz) = 0;
- virtual void write(offs_t offset, uint8_t data) = 0;
+ virtual DECLARE_WRITE8_MEMBER(write) = 0;
virtual DECLARE_SETADDRESS_DBIN_MEMBER( setaddress_dbin ) { }
virtual DECLARE_READ8Z_MEMBER(crureadz) = 0;
- virtual void cruwrite(offs_t offset, uint8_t data) = 0;
+ virtual DECLARE_WRITE8_MEMBER(cruwrite) = 0;
virtual DECLARE_WRITE_LINE_MEMBER(romgq_line) = 0;
virtual void set_gromlines(line_state mline, line_state moline, line_state gsq) =0;
diff --git a/src/devices/bus/ti99/gromport/multiconn.cpp b/src/devices/bus/ti99/gromport/multiconn.cpp
index 191853f1029..efaf57d649d 100644
--- a/src/devices/bus/ti99/gromport/multiconn.cpp
+++ b/src/devices/bus/ti99/gromport/multiconn.cpp
@@ -195,7 +195,7 @@ READ8Z_MEMBER(ti99_multi_cart_conn_device::readz)
if (m_cartridge[i] != nullptr)
{
uint8_t newval = *value;
- m_cartridge[i]->readz(offset, &newval);
+ m_cartridge[i]->readz(space, offset, &newval, 0xff);
if (i==slot)
{
*value = newval;
@@ -207,12 +207,12 @@ READ8Z_MEMBER(ti99_multi_cart_conn_device::readz)
{
if (slot < NUMBER_OF_CARTRIDGE_SLOTS && m_cartridge[slot] != nullptr)
{
- m_cartridge[slot]->readz(offset, value);
+ m_cartridge[slot]->readz(space, offset, value, 0xff);
}
}
}
-void ti99_multi_cart_conn_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_multi_cart_conn_device::write)
{
// Same issue as above (read)
// We don't have GRAM cartridges, anyway, so it's just used for setting the address.
@@ -222,7 +222,7 @@ void ti99_multi_cart_conn_device::write(offs_t offset, uint8_t data)
{
if (elem != nullptr)
{
- elem->write(offset, data);
+ elem->write(space, offset, data, 0xff);
}
}
}
@@ -232,7 +232,7 @@ void ti99_multi_cart_conn_device::write(offs_t offset, uint8_t data)
if (slot < NUMBER_OF_CARTRIDGE_SLOTS && m_cartridge[slot] != nullptr)
{
// logerror("writing %04x (slot %d) <- %02x\n", offset, slot, data);
- m_cartridge[slot]->write(offset, data);
+ m_cartridge[slot]->write(space, offset, data, 0xff);
}
}
}
@@ -246,11 +246,11 @@ READ8Z_MEMBER(ti99_multi_cart_conn_device::crureadz)
if (m_cartridge[slot] != nullptr)
{
- m_cartridge[slot]->crureadz(offset, value);
+ m_cartridge[slot]->crureadz(space, offset, value);
}
}
-void ti99_multi_cart_conn_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_multi_cart_conn_device::cruwrite)
{
int slot = get_active_slot(true, offset);
@@ -260,7 +260,7 @@ void ti99_multi_cart_conn_device::cruwrite(offs_t offset, uint8_t data)
if (m_cartridge[slot] != nullptr)
{
- m_cartridge[slot]->cruwrite(offset, data);
+ m_cartridge[slot]->cruwrite(space, offset, data);
}
}
diff --git a/src/devices/bus/ti99/gromport/multiconn.h b/src/devices/bus/ti99/gromport/multiconn.h
index 56a5915cfb2..97b9308eb36 100644
--- a/src/devices/bus/ti99/gromport/multiconn.h
+++ b/src/devices/bus/ti99/gromport/multiconn.h
@@ -24,9 +24,9 @@ public:
ti99_multi_cart_conn_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
DECLARE_WRITE_LINE_MEMBER(romgq_line) override;
void set_gromlines(line_state mline, line_state moline, line_state gsq) override;
DECLARE_WRITE_LINE_MEMBER(gclock_in) override;
diff --git a/src/devices/bus/ti99/gromport/singleconn.cpp b/src/devices/bus/ti99/gromport/singleconn.cpp
index 9a0b905a9e7..c967cf503f2 100644
--- a/src/devices/bus/ti99/gromport/singleconn.cpp
+++ b/src/devices/bus/ti99/gromport/singleconn.cpp
@@ -22,25 +22,25 @@ ti99_single_cart_conn_device::ti99_single_cart_conn_device(const machine_config
READ8Z_MEMBER(ti99_single_cart_conn_device::readz)
{
// Pass through
- m_cartridge->readz(offset, value);
+ m_cartridge->readz(space, offset, value);
}
-void ti99_single_cart_conn_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_single_cart_conn_device::write)
{
// Pass through
- m_cartridge->write(offset, data);
+ m_cartridge->write(space, offset, data);
}
READ8Z_MEMBER(ti99_single_cart_conn_device::crureadz)
{
// Pass through
- m_cartridge->crureadz(offset, value);
+ m_cartridge->crureadz(space, offset, value);
}
-void ti99_single_cart_conn_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti99_single_cart_conn_device::cruwrite)
{
// Pass through
- m_cartridge->cruwrite(offset, data);
+ m_cartridge->cruwrite(space, offset, data);
}
WRITE_LINE_MEMBER(ti99_single_cart_conn_device::romgq_line)
diff --git a/src/devices/bus/ti99/gromport/singleconn.h b/src/devices/bus/ti99/gromport/singleconn.h
index 831d70ffb18..10f1062f223 100644
--- a/src/devices/bus/ti99/gromport/singleconn.h
+++ b/src/devices/bus/ti99/gromport/singleconn.h
@@ -20,9 +20,9 @@ public:
ti99_single_cart_conn_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
DECLARE_WRITE_LINE_MEMBER(romgq_line) override;
void set_gromlines(line_state mline, line_state moline, line_state gsq) override;
DECLARE_WRITE_LINE_MEMBER(gclock_in) override;
diff --git a/src/devices/bus/ti99/internal/992board.cpp b/src/devices/bus/ti99/internal/992board.cpp
index 071526016f2..330bcee4566 100644
--- a/src/devices/bus/ti99/internal/992board.cpp
+++ b/src/devices/bus/ti99/internal/992board.cpp
@@ -456,15 +456,15 @@ void io992_device::device_start()
m_set_rom_bank.resolve();
}
-uint8_t io992_device::cruread(offs_t offset)
+READ8_MEMBER(io992_device::cruread)
{
- int address = offset << 1;
+ int address = offset << 4;
uint8_t value = 0x7f; // All Hexbus lines high
double inp = 0;
int i;
uint8_t bit = 1;
- switch (address & 0xf800)
+ switch (address)
{
case 0xe000:
// CRU E000-E7fE: Keyboard
@@ -494,10 +494,10 @@ uint8_t io992_device::cruread(offs_t offset)
LOGMASKED(LOG_CRU, "CRU %04x -> %02x\n", address, value);
- return BIT(value, offset & 7);
+ return value;
}
-void io992_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(io992_device::cruwrite)
{
int address = (offset << 1) & 0xf80e;
diff --git a/src/devices/bus/ti99/internal/992board.h b/src/devices/bus/ti99/internal/992board.h
index 5b99519f81f..b9946ebe9c4 100644
--- a/src/devices/bus/ti99/internal/992board.h
+++ b/src/devices/bus/ti99/internal/992board.h
@@ -107,8 +107,8 @@ class io992_device : public bus::hexbus::hexbus_chained_device
public:
io992_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- uint8_t cruread(offs_t offset);
- void cruwrite(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( cruread );
+ DECLARE_WRITE8_MEMBER( cruwrite );
void device_start() override;
ioport_constructor device_input_ports() const override;
auto rombank_cb() { return m_set_rom_bank.bind(); }
diff --git a/src/devices/bus/ti99/internal/998board.cpp b/src/devices/bus/ti99/internal/998board.cpp
index 96f1c3d07f3..b81eeb01c59 100644
--- a/src/devices/bus/ti99/internal/998board.cpp
+++ b/src/devices/bus/ti99/internal/998board.cpp
@@ -198,7 +198,7 @@ mainboard8_device::mainboard8_device(const machine_config &mconfig, const char *
// Debugger support
// The memory accesses by the debugger are routed around the custom chip logic
-uint8_t mainboard8_device::debugger_read(offs_t offset)
+READ8_MEMBER( mainboard8_device::debugger_read )
{
int logical_address = offset;
bool compat_mode = (m_crus_debug==ASSERT_LINE);
@@ -243,7 +243,7 @@ uint8_t mainboard8_device::debugger_read(offs_t offset)
if (m_mofetta->hexbus_access_debug()) return m_rom1[(physical_address & 0x1fff) | 0x6000];
if (m_mofetta->intdsr_access_debug()) return m_rom1[(physical_address & 0x1fff) | 0x4000];
m_ioport->memen_in(ASSERT_LINE);
- m_ioport->readz(physical_address & 0xffff, &value);
+ m_ioport->readz(space, physical_address & 0xffff, &value);
m_ioport->memen_in(CLEAR_LINE);
return value;
}
@@ -251,7 +251,7 @@ uint8_t mainboard8_device::debugger_read(offs_t offset)
{
// Cartridge space lower 8
m_gromport->romgq_line(ASSERT_LINE);
- m_gromport->readz(physical_address & 0x1fff, &value);
+ m_gromport->readz(space, physical_address & 0x1fff, &value);
m_gromport->romgq_line(CLEAR_LINE);
return value;
}
@@ -259,7 +259,7 @@ uint8_t mainboard8_device::debugger_read(offs_t offset)
{
// Cartridge space upper 8
m_gromport->romgq_line(ASSERT_LINE);
- m_gromport->readz((physical_address & 0x1fff) | 0x2000, &value);
+ m_gromport->readz(space, (physical_address & 0x1fff) | 0x2000, &value);
m_gromport->romgq_line(CLEAR_LINE);
return value;
}
@@ -276,7 +276,7 @@ uint8_t mainboard8_device::debugger_read(offs_t offset)
return 0;
}
-void mainboard8_device::debugger_write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mainboard8_device::debugger_write )
{
int logical_address = offset;
bool compat_mode = (m_crus_debug==ASSERT_LINE);
@@ -324,14 +324,14 @@ void mainboard8_device::debugger_write(offs_t offset, uint8_t data)
if (m_mofetta->hexbus_access_debug()) return;
if (m_mofetta->intdsr_access_debug()) return;
m_ioport->memen_in(ASSERT_LINE);
- m_ioport->write(physical_address & 0xffff, data & 0xff);
+ m_ioport->write(space, physical_address & 0xffff, data & 0xff);
m_ioport->memen_in(CLEAR_LINE); return;
}
if ((physical_address & 0x00ffe000)==0x00ff6000)
{
// Cartridge space lower 8
m_gromport->romgq_line(ASSERT_LINE);
- m_gromport->write(physical_address & 0x1fff, data & 0xff);
+ m_gromport->write(space, physical_address & 0x1fff, data & 0xff);
m_gromport->romgq_line(CLEAR_LINE);
return;
}
@@ -339,7 +339,7 @@ void mainboard8_device::debugger_write(offs_t offset, uint8_t data)
{
// Cartridge space upper 8
m_gromport->romgq_line(ASSERT_LINE);
- m_gromport->write((physical_address & 0x1fff) | 0x2000, data & 0xff);
+ m_gromport->write(space, (physical_address & 0x1fff) | 0x2000, data & 0xff);
m_gromport->romgq_line(CLEAR_LINE);
return;
}
@@ -352,16 +352,16 @@ void mainboard8_device::debugger_write(offs_t offset, uint8_t data)
READ8Z_MEMBER(mainboard8_device::crureadz)
{
- m_ioport->crureadz(offset, value);
+ m_ioport->crureadz(space, offset, value);
}
/*
CRU handling. Mofetta is the only chip that bothers to handle it, beside the PEB
*/
-void mainboard8_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(mainboard8_device::cruwrite)
{
- m_mofetta->cruwrite(offset, data);
- m_ioport->cruwrite(offset, data);
+ m_mofetta->cruwrite(space, offset, data);
+ m_ioport->cruwrite(space, offset, data);
}
// =============== Memory bus access ==================
@@ -371,7 +371,7 @@ WRITE_LINE_MEMBER( mainboard8_device::dbin_in )
m_dbin_level = (line_state)state;
}
-uint8_t mainboard8_device::setoffset(offs_t offset)
+READ8_MEMBER( mainboard8_device::setoffset )
{
LOGMASKED(LOG_ADDRESS, "set %s %04x\n", (m_dbin_level==ASSERT_LINE)? "R" : "W", offset);
@@ -390,7 +390,7 @@ uint8_t mainboard8_device::setoffset(offs_t offset)
m_A14_set = ((m_logical_address & 2)!=0); // Needed for clock_in
// Check for match in logical space
- m_vaquerro->set_address(m_logical_address, m_dbin_level);
+ m_vaquerro->set_address(space, m_logical_address, m_dbin_level);
// Select GROMs if addressed
select_groms();
@@ -405,7 +405,7 @@ uint8_t mainboard8_device::setoffset(offs_t offset)
m_mofetta->lascs_in(lasreq);
// Need to set the address in any case so that the lines can be cleared
- m_amigo->set_address(m_logical_address);
+ m_amigo->set_address(space, m_logical_address);
// AMIGO is the one to control the READY line to the CPU
// MOFETTA does not contribute to READY
@@ -539,7 +539,7 @@ WRITE_LINE_MEMBER( mainboard8_device::clock_in )
if (m_mofetta->alccs_out()==ASSERT_LINE)
{
- m_oso->write(m_physical_address>>1, m_latched_data);
+ m_oso->write(*m_space, m_physical_address>>1, m_latched_data);
m_pending_write = false;
LOGMASKED(LOG_MEM, "Write %04x (phys %06x, OSO) <- %02x\n", m_logical_address, m_physical_address, m_latched_data);
}
@@ -547,7 +547,7 @@ WRITE_LINE_MEMBER( mainboard8_device::clock_in )
if (m_mofetta->cmas_out()==ASSERT_LINE)
{
m_gromport->romgq_line(ASSERT_LINE);
- m_gromport->write(m_physical_address & 0x3fff, m_latched_data);
+ m_gromport->write(*m_space, m_physical_address & 0x3fff, m_latched_data);
m_pending_write = false;
LOGMASKED(LOG_MEM, "Write %04x (phys %06x, cartridge) <- %02x\n", m_logical_address, m_physical_address, m_latched_data);
}
@@ -558,7 +558,7 @@ WRITE_LINE_MEMBER( mainboard8_device::clock_in )
if (m_mofetta->dbc_out()==ASSERT_LINE)
{
- m_ioport->write(m_physical_address, m_latched_data);
+ m_ioport->write(*m_space, m_physical_address, m_latched_data);
m_pending_write = false;
LOGMASKED(LOG_MEM, "Write %04x (phys %06x, PEB) <- %02x\n", m_logical_address, m_physical_address, m_latched_data);
}
@@ -635,7 +635,7 @@ void mainboard8_device::select_groms()
m_sgrom1->write(m_latched_data);
m_sgrom2->write(m_latched_data);
LOGMASKED(LOG_MEM, "Write GS <- %02x\n", m_latched_data);
- m_gromport->write(0, m_latched_data);
+ m_gromport->write(*m_space, 0, m_latched_data);
break;
case TSGSEL:
@@ -682,8 +682,8 @@ void mainboard8_device::set_paddress(int address)
m_physical_address = (m_physical_address << 16) | address;
LOGMASKED(LOG_DETAIL, "Setting physical address %06x\n", m_physical_address);
- m_mofetta->set_address(address, m_dbin_level);
- m_ioport->setaddress_dbin(address, m_dbin_level);
+ m_mofetta->set_address(*m_space, address, m_dbin_level);
+ m_ioport->setaddress_dbin(*m_space, address, m_dbin_level);
}
WRITE_LINE_MEMBER( mainboard8_device::msast_in )
@@ -701,14 +701,14 @@ WRITE_LINE_MEMBER( mainboard8_device::msast_in )
}
-uint8_t mainboard8_device::read(offs_t offset)
+READ8_MEMBER( mainboard8_device::read )
{
uint8_t value = 0;
const char* what;
if (machine().side_effects_disabled())
{
- return debugger_read(offset);
+ return debugger_read(space, offset);
}
// =================================================
@@ -716,7 +716,7 @@ uint8_t mainboard8_device::read(offs_t offset)
// =================================================
if (m_amigo->mapper_accessed())
{
- value = m_amigo->read();
+ value = m_amigo->read(space, 0);
what = "mapper";
goto readdone;
}
@@ -762,7 +762,7 @@ uint8_t mainboard8_device::read(offs_t offset)
m_sgrom0->readz(&value);
m_sgrom1->readz(&value);
m_sgrom2->readz(&value);
- m_gromport->readz(0, &value);
+ m_gromport->readz(space, 0, &value);
if (!m_A14_set) LOGMASKED(LOG_GROM, "GS>%04x\n", m_sgrom0->debug_get_address()-1);
what = "system GROM";
goto readdone;
@@ -843,7 +843,7 @@ uint8_t mainboard8_device::read(offs_t offset)
if (m_mofetta->alccs_out()==ASSERT_LINE)
{
- value = m_oso->read(m_physical_address>>1);
+ value = m_oso->read(*m_space, m_physical_address>>1);
what = "OSO";
goto readdonephys;
}
@@ -858,14 +858,14 @@ uint8_t mainboard8_device::read(offs_t offset)
if (m_mofetta->cmas_out()==ASSERT_LINE)
{
m_gromport->romgq_line(ASSERT_LINE);
- m_gromport->readz(m_physical_address & 0x3fff, &value);
+ m_gromport->readz(*m_space, m_physical_address & 0x3fff, &value);
what = "Cartridge";
goto readdonephys;
}
if (m_mofetta->dbc_out()==ASSERT_LINE)
{
- m_ioport->readz(m_physical_address & 0xffff, &value);
+ m_ioport->readz(*m_space, m_physical_address & 0xffff, &value);
what = "PEB";
goto readdonephys;
}
@@ -905,14 +905,14 @@ void mainboard8_device::cycle_end()
If the READY line is pulled down due to the mapping process, we must
store the data bus value until the physical address is available.
*/
-void mainboard8_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mainboard8_device::write )
{
m_latched_data = data;
m_pending_write = true;
if (machine().side_effects_disabled())
{
- return debugger_write(offset, data);
+ return debugger_write(space, offset, data);
}
// Some logical space devices can be written immediately
@@ -920,7 +920,7 @@ void mainboard8_device::write(offs_t offset, uint8_t data)
if (m_amigo->mapper_accessed())
{
LOGMASKED(LOG_MEM, "Write %04x (mapper) <- %02x\n", m_logical_address, data);
- m_amigo->write(data);
+ m_amigo->write(space, 0, data);
m_pending_write = false;
}
@@ -1064,6 +1064,10 @@ void mainboard8_device::device_reset()
m_A14_set = false;
// Configure RAM and AMIGO
m_amigo->connect_sram(m_sram->pointer());
+
+ // Get the pointer to the address space; we need it outside of the
+ // usual memory functions. TODO: Possibly not anymore.
+ m_space = &m_maincpu->space(AS_PROGRAM);
}
void mainboard8_device::device_add_mconfig(machine_config &config)
@@ -1731,7 +1735,7 @@ bool mofetta_device::intdsr_access_debug()
return m_txspg;
}
-void mofetta_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(mofetta_device::cruwrite)
{
if ((offset & 0xff00)==0x2700)
{
@@ -1996,7 +2000,7 @@ WRITE_LINE_MEMBER( amigo_device::lascs_in )
3. Set the physical address bus with the second 16 bits of the physical
address. Clear the MSAST line. Forward any incoming READY=0 to the CPU.
*/
-uint8_t amigo_device::set_address(offs_t offset)
+READ8_MEMBER( amigo_device::set_address )
{
// Check whether the mapper itself is accessed
int mapaddr = (m_crus==ASSERT_LINE)? 0x8810 : 0xf870;
@@ -2049,7 +2053,7 @@ uint8_t amigo_device::set_address(offs_t offset)
/*
Read the mapper status bits
*/
-uint8_t amigo_device::read()
+READ8_MEMBER( amigo_device::read )
{
// Read the protection status bits and reset them
uint8_t value = m_protflag;
@@ -2060,7 +2064,7 @@ uint8_t amigo_device::read()
/*
Configure the mapper. This is the only reason to write to the AMIGO.
*/
-void amigo_device::write(uint8_t data)
+WRITE8_MEMBER( amigo_device::write )
{
// Load or save map file
if ((data & 0xf0)==0x00)
@@ -2291,7 +2295,7 @@ oso_device::oso_device(const machine_config &mconfig, const char *tag, device_t
m_hexbus_outbound = nullptr;
}
-uint8_t oso_device::read(offs_t offset)
+READ8_MEMBER( oso_device::read )
{
int value = 0;
offset &= 0x03;
@@ -2327,7 +2331,7 @@ uint8_t oso_device::read(offs_t offset)
return value;
}
-void oso_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( oso_device::write )
{
offset &= 0x03;
switch (offset)
diff --git a/src/devices/bus/ti99/internal/998board.h b/src/devices/bus/ti99/internal/998board.h
index 227a2dc4a7b..c0baf6589df 100644
--- a/src/devices/bus/ti99/internal/998board.h
+++ b/src/devices/bus/ti99/internal/998board.h
@@ -101,6 +101,7 @@ public:
line_state ready();
void treset();
+ DECLARE_READ8_MEMBER( read );
DECLARE_SETADDRESS_DBIN_MEMBER( set_address );
DECLARE_READ_LINE_MEMBER( sprd_out );
@@ -247,7 +248,7 @@ public:
void device_start() override;
void device_reset() override;
- void cruwrite(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER( cruwrite );
DECLARE_SETADDRESS_DBIN_MEMBER( set_address );
// Debugger support
@@ -260,6 +261,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( pmemen_in );
DECLARE_WRITE_LINE_MEMBER( skdrcs_in );
+ DECLARE_READ8_MEMBER( rom1cs_out );
DECLARE_READ_LINE_MEMBER( gromclk_out );
DECLARE_READ_LINE_MEMBER( alccs_out );
@@ -333,9 +335,9 @@ public:
void device_start() override;
void device_reset() override;
- uint8_t read();
- void write(uint8_t data);
- uint8_t set_address(offs_t offset);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
+ DECLARE_READ8_MEMBER( set_address );
// Debugger support
int get_physical_address_debug(offs_t offset);
@@ -451,8 +453,8 @@ class oso_device : public bus::hexbus::hexbus_chained_device
{
public:
oso_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
void device_start() override;
void hexbus_value_changed(uint8_t data) override;
@@ -539,17 +541,17 @@ public:
mainboard8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// Memory space
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
- uint8_t setoffset(offs_t offset);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
+ DECLARE_READ8_MEMBER( setoffset );
// Memory space for debugger access
- uint8_t debugger_read(offs_t offset);
- void debugger_write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( debugger_read );
+ DECLARE_WRITE8_MEMBER( debugger_write );
// I/O space
DECLARE_READ8Z_MEMBER( crureadz );
- void cruwrite(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER( cruwrite );
// Control lines
DECLARE_WRITE_LINE_MEMBER( clock_in );
@@ -596,6 +598,9 @@ private:
// Mapped physical address.
int m_physical_address;
+ // Hold the address space value so that we can use it in other methods.
+ address_space* m_space;
+
// Indicates that a byte is waiting on the data bus (see m_latched_data)
bool m_pending_write;
diff --git a/src/devices/bus/ti99/internal/datamux.cpp b/src/devices/bus/ti99/internal/datamux.cpp
index f6ba06d99b2..fa1b4de2dad 100644
--- a/src/devices/bus/ti99/internal/datamux.cpp
+++ b/src/devices/bus/ti99/internal/datamux.cpp
@@ -97,6 +97,7 @@ datamux_device::datamux_device(const machine_config &mconfig, const char *tag, d
m_ram16b(*owner, TI99_EXPRAM_TAG),
m_padram(*owner, TI99_PADRAM_TAG),
m_cpu(*owner, "maincpu"),
+ m_spacep(nullptr),
m_ready(*this),
m_addr_buf(0),
m_dbin(CLEAR_LINE),
@@ -117,7 +118,7 @@ datamux_device::datamux_device(const machine_config &mconfig, const char *tag, d
DEVICE ACCESSOR FUNCTIONS
***************************************************************************/
-void datamux_device::read_all(uint16_t addr, uint8_t *value)
+void datamux_device::read_all(address_space& space, uint16_t addr, uint8_t *value)
{
// Valid access
bool validaccess = ((addr & 0x0400)==0);
@@ -135,7 +136,7 @@ void datamux_device::read_all(uint16_t addr, uint8_t *value)
}
}
// GROMport (GROMs)
- m_gromport->readz(addr, value);
+ m_gromport->readz(space, addr, value);
m_grom_idle = false;
}
@@ -143,20 +144,20 @@ void datamux_device::read_all(uint16_t addr, uint8_t *value)
if ((addr & 0xf801)==0x8800)
{
// Forward to VDP unless we have an EVPC
- if (m_video != nullptr) *value = m_video->read(addr>>1); // A14 determines data or register read
+ if (m_video != nullptr) *value = m_video->read(space, addr>>1); // A14 determines data or register read
}
}
// GROMport (ROMs)
- if ((addr & 0xe000)==0x6000) m_gromport->readz(addr, value);
+ if ((addr & 0xe000)==0x6000) m_gromport->readz(space, addr, value);
// I/O port gets all accesses
- m_ioport->readz(addr, value);
+ m_ioport->readz(space, addr, value);
m_ioport->memen_in(CLEAR_LINE);
m_memen_state = CLEAR_LINE;
}
-void datamux_device::write_all(uint16_t addr, uint8_t value)
+void datamux_device::write_all(address_space& space, uint16_t addr, uint8_t value)
{
// GROM access
if ((addr & 0xf801)==0x9800)
@@ -167,12 +168,12 @@ void datamux_device::write_all(uint16_t addr, uint8_t value)
m_grom[i]->write(value);
}
// GROMport
- m_gromport->write(addr, value);
+ m_gromport->write(space, addr, value);
m_grom_idle = false;
}
// Cartridge port and sound
- if ((addr & 0xe000)==0x6000) m_gromport->write(addr, value);
+ if ((addr & 0xe000)==0x6000) m_gromport->write(space, addr, value);
// Only if the sound chip has not been removed
if ((addr & 0xfc01)==0x8400)
@@ -184,16 +185,16 @@ void datamux_device::write_all(uint16_t addr, uint8_t value)
if ((addr & 0xf801)==0x8800)
{
// Forward to VDP unless we have an EVPC
- if (m_video != nullptr) m_video->write(addr>>1, value); // A14 determines data or register write
+ if (m_video != nullptr) m_video->write(space, addr>>1, value); // A14 determines data or register write
}
// I/O port gets all accesses
- m_ioport->write(addr, value);
+ m_ioport->write(space, addr, value);
m_ioport->memen_in(CLEAR_LINE);
m_memen_state = CLEAR_LINE;
}
-void datamux_device::setaddress_all(uint16_t addr)
+void datamux_device::setaddress_all(address_space& space, uint16_t addr)
{
line_state a14 = ((addr & 2)!=0)? ASSERT_LINE : CLEAR_LINE;
@@ -226,7 +227,7 @@ void datamux_device::setaddress_all(uint16_t addr)
// I/O port gets all accesses
m_memen_state = ASSERT_LINE;
m_ioport->memen_in(m_memen_state);
- m_ioport->setaddress_dbin(addr, m_dbin);
+ m_ioport->setaddress_dbin(space, addr, m_dbin);
}
/*
@@ -235,7 +236,7 @@ void datamux_device::setaddress_all(uint16_t addr)
mapped devices are excluded because their state would be changed
unpredictably by the debugger access.
*/
-uint16_t datamux_device::debugger_read(uint16_t addr)
+uint16_t datamux_device::debugger_read(address_space& space, uint16_t addr)
{
uint16_t addrb = addr << 1;
uint16_t value = 0;
@@ -266,13 +267,13 @@ uint16_t datamux_device::debugger_read(uint16_t addr)
if ((addrb & 0xe000)==0x6000)
{
m_gromport->romgq_line(ASSERT_LINE);
- m_gromport->readz(addrb+1, &lval);
- m_gromport->readz(addrb, &hval);
+ m_gromport->readz(space, addrb+1, &lval);
+ m_gromport->readz(space, addrb, &hval);
m_gromport->romgq_line(m_romgq_state); // reset to previous state
}
m_ioport->memen_in(ASSERT_LINE);
- m_ioport->readz(addrb+1, &lval);
- m_ioport->readz(addrb, &hval);
+ m_ioport->readz(space, addrb+1, &lval);
+ m_ioport->readz(space, addrb, &hval);
m_ioport->memen_in(m_memen_state); // reset to previous state
value = ((hval << 8)&0xff00) | (lval & 0xff);
}
@@ -281,7 +282,7 @@ uint16_t datamux_device::debugger_read(uint16_t addr)
return value;
}
-void datamux_device::debugger_write(uint16_t addr, uint16_t data)
+void datamux_device::debugger_write(address_space& space, uint16_t addr, uint16_t data)
{
uint16_t addrb = addr << 1;
@@ -311,14 +312,14 @@ void datamux_device::debugger_write(uint16_t addr, uint16_t data)
if ((addrb & 0xe000)==0x6000)
{
m_gromport->romgq_line(ASSERT_LINE);
- m_gromport->write(addr+1, data & 0xff);
- m_gromport->write(addr, (data>>8) & 0xff);
+ m_gromport->write(space, addr+1, data & 0xff);
+ m_gromport->write(space, addr, (data>>8) & 0xff);
m_gromport->romgq_line(m_romgq_state); // reset to previous state
}
m_ioport->memen_in(ASSERT_LINE);
- m_ioport->write(addr+1, data & 0xff);
- m_ioport->write(addr, (data>>8) & 0xff);
+ m_ioport->write(space, addr+1, data & 0xff);
+ m_ioport->write(space, addr, (data>>8) & 0xff);
m_ioport->memen_in(m_memen_state); // reset to previous state
}
}
@@ -329,16 +330,16 @@ void datamux_device::debugger_write(uint16_t addr, uint16_t data)
accesses must not occur within the loop. So we have one access on the bus,
a delay, and then the second access.
- mem_mask is irrelevant for TMS processors (cannot control bus width)
+ mem_mask is always ffff on TMS processors (cannot control bus width)
*/
-uint16_t datamux_device::read(offs_t offset)
+READ16_MEMBER( datamux_device::read )
{
uint16_t value = 0;
// Care for debugger
if (machine().side_effects_disabled())
{
- return debugger_read(offset);
+ return debugger_read(space, offset);
}
// Addresses below 0x2000 are ROM (no wait states)
@@ -370,7 +371,7 @@ uint16_t datamux_device::read(offs_t offset)
// The byte from the odd address has already been read into the latch
// Reading the even address now (addr)
uint8_t hbyte = 0;
- read_all(m_addr_buf, &hbyte);
+ read_all(space, m_addr_buf, &hbyte);
LOGMASKED(LOG_ACCESS, "Read even byte from address %04x -> %02x\n", m_addr_buf, hbyte);
value = (hbyte<<8) | m_latch;
@@ -383,11 +384,11 @@ uint16_t datamux_device::read(offs_t offset)
/*
Write access.
*/
-void datamux_device::write(offs_t offset, uint16_t data)
+WRITE16_MEMBER( datamux_device::write )
{
if (machine().side_effects_disabled())
{
- debugger_write(offset, data);
+ debugger_write(space, offset, data);
return;
}
@@ -419,7 +420,7 @@ void datamux_device::write(offs_t offset, uint16_t data)
// write odd byte
LOGMASKED(LOG_ACCESS, "Write odd byte to address %04x <- %02x\n", m_addr_buf+1, data & 0xff);
- write_all(m_addr_buf+1, data & 0xff);
+ write_all(space, m_addr_buf+1, data & 0xff);
}
}
@@ -427,7 +428,7 @@ void datamux_device::write(offs_t offset, uint16_t data)
Called when the memory access starts by setting the address bus. From that
point on, we suspend the CPU until all operations are done.
*/
-uint8_t datamux_device::setoffset(offs_t offset)
+READ8_MEMBER( datamux_device::setoffset )
{
m_addr_buf = offset;
m_waitcount = 0;
@@ -463,7 +464,7 @@ uint8_t datamux_device::setoffset(offs_t offset)
{
// propagate the setaddress operation
// First the odd address
- setaddress_all(m_addr_buf+1);
+ setaddress_all(space, m_addr_buf+1);
m_muxready = CLEAR_LINE;
ready_join();
}
@@ -501,10 +502,10 @@ WRITE_LINE_MEMBER( datamux_device::clock_in )
if (m_waitcount==2)
{
// read odd byte
- read_all(m_addr_buf+1, &m_latch);
+ read_all(*m_spacep, m_addr_buf+1, &m_latch);
LOGMASKED(LOG_ACCESS, "Read odd byte from address %04x -> %02x\n", m_addr_buf+1, m_latch);
// do the setaddress for the even address
- setaddress_all(m_addr_buf);
+ setaddress_all(*m_spacep, m_addr_buf);
}
}
}
@@ -523,10 +524,10 @@ WRITE_LINE_MEMBER( datamux_device::clock_in )
if (m_waitcount==2)
{
// do the setaddress for the even address
- setaddress_all(m_addr_buf);
+ setaddress_all(*m_spacep, m_addr_buf);
// write even byte
LOGMASKED(LOG_ACCESS, "Write even byte to address %04x <- %02x\n", m_addr_buf, m_latch);
- write_all(m_addr_buf, m_latch);
+ write_all(*m_spacep, m_addr_buf, m_latch);
}
}
}
@@ -614,6 +615,10 @@ void datamux_device::device_reset(void)
m_latch = 0;
m_dbin = CLEAR_LINE;
+
+ // Get the pointer to the address space already here, because we cannot
+ // save that pointer to a savestate, and we need it on restore
+ m_spacep = &m_cpu->space(AS_PROGRAM);
}
void datamux_device::device_config_complete()
diff --git a/src/devices/bus/ti99/internal/datamux.h b/src/devices/bus/ti99/internal/datamux.h
index 6c36c7f8963..4ddc39e09e6 100644
--- a/src/devices/bus/ti99/internal/datamux.h
+++ b/src/devices/bus/ti99/internal/datamux.h
@@ -33,9 +33,9 @@ class datamux_device : public device_t
{
public:
datamux_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- uint16_t read(offs_t offset);
- void write(offs_t offset, uint16_t data);
- uint8_t setoffset(offs_t offset);
+ DECLARE_READ16_MEMBER( read );
+ DECLARE_WRITE16_MEMBER( write );
+ DECLARE_READ8_MEMBER( setoffset );
DECLARE_WRITE_LINE_MEMBER( clock_in );
DECLARE_WRITE_LINE_MEMBER( dbin_in );
@@ -75,6 +75,9 @@ private:
// Link to the CPU
required_device<cpu_device> m_cpu;
+ // Keeps the address space pointer
+ address_space* m_spacep;
+
// Console ROM
uint16_t* m_consolerom;
@@ -82,17 +85,17 @@ private:
tmc0430_device* m_grom[3];
// Common read routine
- void read_all(uint16_t addr, uint8_t *target);
+ void read_all(address_space& space, uint16_t addr, uint8_t *target);
// Common write routine
- void write_all(uint16_t addr, uint8_t value);
+ void write_all(address_space& space, uint16_t addr, uint8_t value);
// Common set address method
- void setaddress_all(uint16_t addr);
+ void setaddress_all(address_space& space, uint16_t addr);
// Debugger access
- uint16_t debugger_read(uint16_t addr);
- void debugger_write(uint16_t addr, uint16_t data);
+ uint16_t debugger_read(address_space& space, uint16_t addr);
+ void debugger_write(address_space& space, uint16_t addr, uint16_t data);
// Join own READY and external READY
void ready_join();
diff --git a/src/devices/bus/ti99/internal/genboard.cpp b/src/devices/bus/ti99/internal/genboard.cpp
index dd9ab0ee3db..861e0655200 100644
--- a/src/devices/bus/ti99/internal/genboard.cpp
+++ b/src/devices/bus/ti99/internal/genboard.cpp
@@ -329,7 +329,7 @@ INPUT_CHANGED_MEMBER( genmod_mapper_device::setgm_changed )
within the gate array. Unlike with real GROMs, no address wrapping occurs,
and the complete 64K space is available.
*/
-uint8_t geneve_mapper_device::read_grom(offs_t offset)
+READ8_MEMBER( geneve_mapper_device::read_grom )
{
uint8_t reply;
if (offset & 0x0002)
@@ -364,7 +364,7 @@ uint8_t geneve_mapper_device::read_grom(offs_t offset)
Simulates GROM. The real Geneve does not use GROMs but simulates them
within the gate array.
*/
-void geneve_mapper_device::write_grom(offs_t offset, uint8_t data)
+WRITE8_MEMBER( geneve_mapper_device::write_grom )
{
if (offset & 0x0002)
{
@@ -468,7 +468,7 @@ void geneve_mapper_device::set_extra_waitstates(bool wait)
SETOFFSET method, and we re-use the values stored there to quickly
access the appropriate component.
*/
-uint8_t geneve_mapper_device::readm(offs_t offset)
+READ8_MEMBER( geneve_mapper_device::readm )
{
uint8_t value = 0;
@@ -492,7 +492,7 @@ uint8_t geneve_mapper_device::readm(offs_t offset)
if (dec->function == MBOX)
{
m_peribox->memen_in(ASSERT_LINE);
- m_peribox->setaddress_dbin(dec->physaddr, true);
+ m_peribox->setaddress_dbin(space, dec->physaddr, true);
}
}
else
@@ -509,7 +509,7 @@ uint8_t geneve_mapper_device::readm(offs_t offset)
case MLVIDEO:
if (!machine().side_effects_disabled())
{
- value = m_video->read(dec->offset>>1);
+ value = m_video->read(space, dec->offset>>1);
LOGMASKED(LOG_READ, "Read video %04x -> %02x\n", dec->offset, value);
// Video wait states are created *after* the access
// Accordingly, they have no effect when execution is in onchip RAM
@@ -538,7 +538,7 @@ uint8_t geneve_mapper_device::readm(offs_t offset)
// Needs more investigation. We might as well ignore this,
// as the high nibble is obviously undefined and takes some past
// value floating around.
- value = m_clock->read(dec->offset & 0x000f);
+ value = m_clock->read(space, dec->offset & 0x000f);
if (m_geneve_mode) value |= 0xf0;
else value |= ((dec->offset & 0x000f)==0x000f)? 0x20 : 0x10;
LOGMASKED(LOG_READ, "Read clock %04x -> %02x\n", dec->offset, value);
@@ -548,7 +548,7 @@ uint8_t geneve_mapper_device::readm(offs_t offset)
// grom simulation
// ++++ ++-- ---- ---+
// 1001 1000 0000 00x0
- if (!machine().side_effects_disabled()) value = read_grom(dec->offset);
+ if (!machine().side_effects_disabled()) value = read_grom(space, dec->offset, 0xff);
LOGMASKED(LOG_READ, "Read GROM %04x -> %02x\n", dec->offset, value);
break;
@@ -571,7 +571,7 @@ uint8_t geneve_mapper_device::readm(offs_t offset)
case MPEPROM:
// 1 111. ..xx xxxx xxxx xxxx on-board eprom (16K)
// mirrored for f0, f2, f4, ...; f1, f3, f5, ...
- value = boot_rom(dec->physaddr);
+ value = boot_rom(space, dec->physaddr, 0xff);
break;
case MPSRAM:
@@ -593,7 +593,7 @@ uint8_t geneve_mapper_device::readm(offs_t offset)
// 0x000000-0x07ffff for the stock Geneve (AMC,AMB,AMA,A0 ...,A15)
// 0x000000-0x1fffff for the GenMod.(AME,AMD,AMC,AMB,AMA,A0 ...,A15)
- m_peribox->readz(dec->physaddr, &value);
+ m_peribox->readz(space, dec->physaddr, &value, 0xff);
m_peribox->memen_in(CLEAR_LINE);
LOGMASKED(LOG_READ, "Read P-Box %04x (%06x) -> %02x\n", dec->offset, dec->physaddr, value);
break;
@@ -605,7 +605,7 @@ uint8_t geneve_mapper_device::readm(offs_t offset)
return value;
}
-void geneve_mapper_device::writem(offs_t offset, uint8_t data)
+WRITE8_MEMBER( geneve_mapper_device::writem )
{
decdata *dec;
decdata debug;
@@ -627,7 +627,7 @@ void geneve_mapper_device::writem(offs_t offset, uint8_t data)
if (dec->function == MBOX)
{
m_peribox->memen_in(ASSERT_LINE);
- m_peribox->setaddress_dbin(dec->physaddr, false);
+ m_peribox->setaddress_dbin(space, dec->physaddr, false);
}
}
else
@@ -650,7 +650,7 @@ void geneve_mapper_device::writem(offs_t offset, uint8_t data)
if (!machine().side_effects_disabled())
{
- m_video->write(dec->offset>>1, data);
+ m_video->write(space, dec->offset>>1, data);
LOGMASKED(LOG_WRITE, "Write video %04x <- %02x\n", offset, data);
// See above
if (m_video_waitstates) set_video_waitcount(15);
@@ -666,7 +666,7 @@ void geneve_mapper_device::writem(offs_t offset, uint8_t data)
case MLCLOCK:
// clock
// ++++ ++++ ++++ ----
- m_clock->write(dec->offset & 0x000f, data);
+ m_clock->write(space, dec->offset & 0x000f, data);
LOGMASKED(LOG_WRITE, "Write clock %04x <- %02x\n", offset, data);
break;
@@ -679,7 +679,7 @@ void geneve_mapper_device::writem(offs_t offset, uint8_t data)
case MLGROM:
// The GROM simulator is only available in TI Mode
- write_grom(dec->offset, data);
+ write_grom(space, dec->offset, data, 0xff);
LOGMASKED(LOG_WRITE, "Write GROM %04x <- %02x\n", offset, data);
break;
@@ -700,7 +700,7 @@ void geneve_mapper_device::writem(offs_t offset, uint8_t data)
// 1 111. ..xx xxxx xxxx xxxx on-board eprom (16K)
// mirrored for f0, f2, f4, ...; f1, f3, f5, ...
// Ignore EPROM write (unless PFM)
- if (m_boot_rom != GENEVE_EPROM) write_to_pfm(dec->physaddr, data);
+ if (m_boot_rom != GENEVE_EPROM) write_to_pfm(space, dec->physaddr, data, 0xff);
else
LOGMASKED(LOG_WARN, "Write EPROM %04x (%06x) <- %02x, ignored\n", offset, dec->physaddr, data);
break;
@@ -720,7 +720,7 @@ void geneve_mapper_device::writem(offs_t offset, uint8_t data)
case MBOX:
// Route everything else to the P-Box
LOGMASKED(LOG_WRITE, "Write P-Box %04x (%06x) <- %02x\n", offset, dec->physaddr, data);
- m_peribox->write(dec->physaddr, data);
+ m_peribox->write(space, dec->physaddr, data, 0xff);
m_peribox->memen_in(CLEAR_LINE);
break;
@@ -854,7 +854,7 @@ void genmod_mapper_device::decode_mod(geneve_mapper_device::decdata* dec)
/*
Boot ROM handling, from EPROM or PFM.
*/
-uint8_t geneve_mapper_device::boot_rom(offs_t offset)
+READ8_MEMBER( geneve_mapper_device::boot_rom )
{
uint8_t value;
int pfmaddress = (offset & 0x01ffff) | (m_pfm_bank<<17);
@@ -866,10 +866,10 @@ uint8_t geneve_mapper_device::boot_rom(offs_t offset)
LOGMASKED(LOG_READ, "Read EPROM %04x -> %02x\n", offset & 0x003fff, value);
return value;
case GENEVE_PFM512:
- value = m_pfm512->read(pfmaddress);
+ value = m_pfm512->read(space, pfmaddress, mem_mask);
break;
case GENEVE_PFM512A:
- value = m_pfm512a->read(pfmaddress);
+ value = m_pfm512a->read(space, pfmaddress, mem_mask);
break;
default:
LOGMASKED(LOG_WARN, "Illegal mode for reading boot ROM: %d\n", m_boot_rom);
@@ -881,7 +881,7 @@ uint8_t geneve_mapper_device::boot_rom(offs_t offset)
return value;
}
-void geneve_mapper_device::write_to_pfm(offs_t offset, uint8_t data)
+WRITE8_MEMBER( geneve_mapper_device::write_to_pfm )
{
// Nota bene: The PFM must be write protected on startup, or the RESET
// of the 9995 will attempt to write the return vector into the flash EEPROM
@@ -891,10 +891,10 @@ void geneve_mapper_device::write_to_pfm(offs_t offset, uint8_t data)
switch (m_boot_rom)
{
case GENEVE_PFM512:
- m_pfm512->write(address, data);
+ m_pfm512->write(space, address, data, mem_mask);
break;
case GENEVE_PFM512A:
- m_pfm512a->write(address, data);
+ m_pfm512a->write(space, address, data, mem_mask);
break;
default:
LOGMASKED(LOG_WARN, "Illegal mode for writing to PFM: %d\n", m_boot_rom);
@@ -907,7 +907,7 @@ void geneve_mapper_device::write_to_pfm(offs_t offset, uint8_t data)
This decoding will later be used in the READ/WRITE member functions. Also,
we initiate wait state creation here.
*/
-uint8_t geneve_mapper_device::setoffset(offs_t offset)
+READ8_MEMBER( geneve_mapper_device::setoffset )
{
LOGMASKED(LOG_DETAIL, "setoffset = %04x\n", offset);
m_debug_no_ws = false;
@@ -926,7 +926,7 @@ uint8_t geneve_mapper_device::setoffset(offs_t offset)
if (m_decoded.function == MBOX)
{
m_peribox->memen_in(ASSERT_LINE);
- m_peribox->setaddress_dbin(m_decoded.physaddr, m_read_mode);
+ m_peribox->setaddress_dbin(space, m_decoded.physaddr, m_read_mode);
}
return 0;
}
diff --git a/src/devices/bus/ti99/internal/genboard.h b/src/devices/bus/ti99/internal/genboard.h
index baccf7463a9..875f9f8bd51 100644
--- a/src/devices/bus/ti99/internal/genboard.h
+++ b/src/devices/bus/ti99/internal/genboard.h
@@ -121,9 +121,9 @@ public:
void set_video_waitstates(bool wait);
void set_extra_waitstates(bool wait);
- uint8_t readm(offs_t offset);
- void writem(offs_t offset, uint8_t data);
- uint8_t setoffset(offs_t offset);
+ DECLARE_READ8_MEMBER( readm );
+ DECLARE_WRITE8_MEMBER( writem );
+ DECLARE_READ8_MEMBER( setoffset );
DECLARE_INPUT_CHANGED_MEMBER( settings_changed );
@@ -147,8 +147,8 @@ protected:
bool m_gromwaddr_LSB;
bool m_gromraddr_LSB;
int m_grom_address;
- uint8_t read_grom(offs_t offset);
- void write_grom(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read_grom );
+ DECLARE_WRITE8_MEMBER( write_grom );
// wait states
void set_wait(int min);
@@ -256,8 +256,8 @@ protected:
virtual void decode_mod(decdata* dec) { };
// PFM mod (0 = none, 1 = AT29C040, 2 = AT29C040A)
- uint8_t boot_rom(offs_t offset);
- void write_to_pfm(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( boot_rom );
+ DECLARE_WRITE8_MEMBER( write_to_pfm );
int m_boot_rom;
int m_pfm_bank;
bool m_pfm_output_enable;
diff --git a/src/devices/bus/ti99/internal/ioport.cpp b/src/devices/bus/ti99/internal/ioport.cpp
index a855fd3bf41..3e769086141 100644
--- a/src/devices/bus/ti99/internal/ioport.cpp
+++ b/src/devices/bus/ti99/internal/ioport.cpp
@@ -96,31 +96,31 @@ ioport_device::ioport_device(const machine_config &mconfig, const char *tag, dev
READ8Z_MEMBER(ioport_device::readz)
{
if (m_connected != nullptr)
- m_connected->readz(offset, value);
+ m_connected->readz(space, offset, value);
}
-void ioport_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ioport_device::write)
{
if (m_connected != nullptr)
- m_connected->write(offset, data);
+ m_connected->write(space, offset, data);
}
SETADDRESS_DBIN_MEMBER(ioport_device::setaddress_dbin)
{
if (m_connected != nullptr)
- m_connected->setaddress_dbin(offset, state);
+ m_connected->setaddress_dbin(space, offset, state);
}
READ8Z_MEMBER(ioport_device::crureadz)
{
if (m_connected != nullptr)
- m_connected->crureadz(offset, value);
+ m_connected->crureadz(space, offset, value);
}
-void ioport_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ioport_device::cruwrite)
{
if (m_connected != nullptr)
- m_connected->cruwrite(offset, data);
+ m_connected->cruwrite(space, offset, data);
}
WRITE_LINE_MEMBER(ioport_device::memen_in)
diff --git a/src/devices/bus/ti99/internal/ioport.h b/src/devices/bus/ti99/internal/ioport.h
index 6b468007eda..aa30c51da77 100644
--- a/src/devices/bus/ti99/internal/ioport.h
+++ b/src/devices/bus/ti99/internal/ioport.h
@@ -29,14 +29,14 @@ public:
{ }
// Methods called from the console / ioport
- virtual DECLARE_READ8Z_MEMBER( readz ) { }
- virtual void write(offs_t offset, uint8_t data) { }
- virtual DECLARE_SETADDRESS_DBIN_MEMBER( setaddress_dbin ) { }
- virtual DECLARE_READ8Z_MEMBER( crureadz ) { }
- virtual void cruwrite(offs_t offset, uint8_t data) { }
- virtual DECLARE_WRITE_LINE_MEMBER( memen_in ) { }
- virtual DECLARE_WRITE_LINE_MEMBER( msast_in ) { }
- virtual DECLARE_WRITE_LINE_MEMBER( clock_in ) { }
+ virtual DECLARE_READ8Z_MEMBER( readz ) { };
+ virtual DECLARE_WRITE8_MEMBER( write ) { };
+ virtual DECLARE_SETADDRESS_DBIN_MEMBER( setaddress_dbin ) { };
+ virtual DECLARE_READ8Z_MEMBER( crureadz ) { };
+ virtual DECLARE_WRITE8_MEMBER( cruwrite ) { };
+ virtual DECLARE_WRITE_LINE_MEMBER( memen_in ) { };
+ virtual DECLARE_WRITE_LINE_MEMBER( msast_in ) { };
+ virtual DECLARE_WRITE_LINE_MEMBER( clock_in ) { };
void set_ioport(ioport_device* ioport) { m_ioport = ioport; }
@@ -71,10 +71,10 @@ public:
// Methods called from the console
DECLARE_READ8Z_MEMBER( readz );
- void write(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER( write );
DECLARE_SETADDRESS_DBIN_MEMBER( setaddress_dbin );
DECLARE_READ8Z_MEMBER( crureadz );
- void cruwrite(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER( cruwrite );
DECLARE_WRITE_LINE_MEMBER( memen_in );
DECLARE_WRITE_LINE_MEMBER( msast_in );
DECLARE_WRITE_LINE_MEMBER( clock_in );
diff --git a/src/devices/bus/ti99/joyport/handset.cpp b/src/devices/bus/ti99/joyport/handset.cpp
index 829b5bca087..304cdffe239 100644
--- a/src/devices/bus/ti99/joyport/handset.cpp
+++ b/src/devices/bus/ti99/joyport/handset.cpp
@@ -38,6 +38,7 @@
#include "emu.h"
#include "handset.h"
+#include "machine/tms9901.h"
#define LOG_WARN (1U<<1) // Warnings
#define LOG_CONFIG (1U<<2) // Configuration
diff --git a/src/devices/bus/ti99/peb/bwg.cpp b/src/devices/bus/ti99/peb/bwg.cpp
index f2a23fea518..c7aa2c903b7 100644
--- a/src/devices/bus/ti99/peb/bwg.cpp
+++ b/src/devices/bus/ti99/peb/bwg.cpp
@@ -228,7 +228,7 @@ READ8Z_MEMBER(snug_bwg_device::readz)
if (m_RTCsel)
{
// .... ..11 111x xxx0
- *value = m_clock->read((m_address & 0x001e) >> 1);
+ *value = m_clock->read(space, (m_address & 0x001e) >> 1);
LOGMASKED(LOG_RW, "read RTC: %04x -> %02x\n", m_address & 0xffff, *value);
}
else
@@ -275,7 +275,7 @@ READ8Z_MEMBER(snug_bwg_device::readz)
5c00 - 5fdf: RAM
5fe0 - 5fff: Clock (even addr)
*/
-void snug_bwg_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(snug_bwg_device::write)
{
if (machine().side_effects_disabled())
{
@@ -293,7 +293,7 @@ void snug_bwg_device::write(offs_t offset, uint8_t data)
{
// .... ..11 111x xxx0
LOGMASKED(LOG_RW, "write RTC: %04x <- %02x\n", m_address & 0xffff, data);
- m_clock->write((m_address & 0x001e) >> 1, data);
+ m_clock->write(space, (m_address & 0x001e) >> 1, data);
}
else
{
@@ -338,7 +338,7 @@ READ8Z_MEMBER(snug_bwg_device::crureadz)
if ((offset & 0xff00)==m_cru_base)
{
- if ((offset & 0x00f0)==0)
+ if ((offset & 0x00ff)==0)
{
// Check what drives are not connected
reply = ((m_floppy[0] != nullptr)? 0 : 0x02) // DSK1
@@ -355,7 +355,7 @@ READ8Z_MEMBER(snug_bwg_device::crureadz)
reply |= (m_dip34 << 6);
// Invert all
- *value = ~BIT(reply, (offset >> 1) & 7);
+ *value = ~reply;
}
else
*value = 0;
@@ -363,7 +363,7 @@ READ8Z_MEMBER(snug_bwg_device::crureadz)
}
}
-void snug_bwg_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(snug_bwg_device::cruwrite)
{
// int drive, drivebit;
diff --git a/src/devices/bus/ti99/peb/bwg.h b/src/devices/bus/ti99/peb/bwg.h
index 2a53f45c75b..a25d844a563 100644
--- a/src/devices/bus/ti99/peb/bwg.h
+++ b/src/devices/bus/ti99/peb/bwg.h
@@ -30,11 +30,11 @@ public:
snug_bwg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_SETADDRESS_DBIN_MEMBER(setaddress_dbin) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
protected:
void device_start() override;
diff --git a/src/devices/bus/ti99/peb/evpc.cpp b/src/devices/bus/ti99/peb/evpc.cpp
index 6b17d75ef74..fc5591112d5 100644
--- a/src/devices/bus/ti99/peb/evpc.cpp
+++ b/src/devices/bus/ti99/peb/evpc.cpp
@@ -213,7 +213,7 @@ READ8Z_MEMBER(snug_enhanced_video_device::readz)
if (m_video_accessed)
{
- *value = m_video->read(m_address>>1);
+ *value = m_video->read(space, m_address>>1);
}
}
@@ -223,7 +223,7 @@ READ8Z_MEMBER(snug_enhanced_video_device::readz)
0x5f00 - 0x5fef NOVRAM
0x5ff0 - 0x5fff Palette (5ff8, 5ffa, 5ffc, 5ffe)
*/
-void snug_enhanced_video_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(snug_enhanced_video_device::write)
{
if (m_selected && m_inDsrArea)
{
@@ -296,7 +296,7 @@ void snug_enhanced_video_device::write(offs_t offset, uint8_t data)
if (m_video_accessed)
{
- m_video->write(m_address>>1, data);
+ m_video->write(space, m_address>>1, data);
}
if (m_sound_accessed)
@@ -323,9 +323,8 @@ READ8Z_MEMBER(snug_enhanced_video_device::crureadz)
{
if ((offset & 0x00f0)==0) // offset 0 delivers bits 0-7 (address 00-0f)
{
- uint8_t p = ~(ioport("EVPC-SW1")->read() | (ioport("EVPC-SW3")->read()<<2)
+ *value = ~(ioport("EVPC-SW1")->read() | (ioport("EVPC-SW3")->read()<<2)
| (ioport("EVPC-SW4")->read()<<3) | (ioport("EVPC-SW8")->read()<<7));
- *value = BIT(p, (offset >> 1) & 7);
}
}
}
@@ -341,7 +340,7 @@ READ8Z_MEMBER(snug_enhanced_video_device::crureadz)
Bit 6: -
Bit 7: -
*/
-void snug_enhanced_video_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(snug_enhanced_video_device::cruwrite)
{
if ((offset & 0xff00)==EVPC_CRU_BASE)
{
diff --git a/src/devices/bus/ti99/peb/evpc.h b/src/devices/bus/ti99/peb/evpc.h
index 2e89c2fa405..a52e73b963c 100644
--- a/src/devices/bus/ti99/peb/evpc.h
+++ b/src/devices/bus/ti99/peb/evpc.h
@@ -32,11 +32,11 @@ class snug_enhanced_video_device : public device_t, public device_ti99_peribox_c
public:
snug_enhanced_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_SETADDRESS_DBIN_MEMBER(setaddress_dbin) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
TIMER_DEVICE_CALLBACK_MEMBER( hblank_interrupt );
diff --git a/src/devices/bus/ti99/peb/hfdc.cpp b/src/devices/bus/ti99/peb/hfdc.cpp
index 6a9a89726b2..97ac8d403ab 100644
--- a/src/devices/bus/ti99/peb/hfdc.cpp
+++ b/src/devices/bus/ti99/peb/hfdc.cpp
@@ -223,14 +223,14 @@ READ8Z_MEMBER(myarc_hfdc_device::readz)
if (m_HDCsel)
{
- *value = m_hdc9234->read((m_address>>2)&1);
+ *value = m_hdc9234->read(space, (m_address>>2)&1, 0xff);
LOGMASKED(LOG_COMP, "%04x[HDC] -> %02x\n", m_address & 0xffff, *value);
return;
}
if (m_RTCsel)
{
- *value = m_clock->read((m_address & 0x001e) >> 1);
+ *value = m_clock->read(space, (m_address & 0x001e) >> 1);
LOGMASKED(LOG_COMP, "%04x[CLK] -> %02x\n", m_address & 0xffff, *value);
return;
}
@@ -278,7 +278,7 @@ READ8Z_MEMBER(myarc_hfdc_device::readz)
0x5800 - 0x5bff static RAM page any of 32 pages
0x5c00 - 0x5fff static RAM page any of 32 pages
*/
-void myarc_hfdc_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( myarc_hfdc_device::write )
{
if (machine().side_effects_disabled())
{
@@ -297,14 +297,14 @@ void myarc_hfdc_device::write(offs_t offset, uint8_t data)
if (m_HDCsel)
{
LOGMASKED(LOG_COMP, "%04x[HDC] <- %02x\n", m_address & 0xffff, data);
- m_hdc9234->write((m_address>>2)&1, data);
+ m_hdc9234->write(space, (m_address>>2)&1, data, 0xff);
return;
}
if (m_RTCsel)
{
LOGMASKED(LOG_COMP, "%04x[CLK] <- %02x\n", m_address & 0xffff, data);
- m_clock->write((m_address & 0x001e) >> 1, data);
+ m_clock->write(space, (m_address & 0x001e) >> 1, data);
return;
}
@@ -376,7 +376,7 @@ READ8Z_MEMBER(myarc_hfdc_device::crureadz)
uint8_t reply;
if ((offset & 0xff00)==m_cru_base)
{
- if ((offset & 0x00f0)==0) // CRU bits 0-7
+ if ((offset & 0x00ff)==0) // CRU bits 0-7
{
if (m_see_switches)
{
@@ -390,7 +390,7 @@ READ8Z_MEMBER(myarc_hfdc_device::crureadz)
if (!m_motor_running) reply |= 0x04;
if (m_wait_for_hd1) reply |= 0x08;
}
- *value = BIT(reply, (offset >> 1) & 7);
+ *value = reply;
}
else // CRU bits 8+
{
@@ -425,7 +425,7 @@ READ8Z_MEMBER(myarc_hfdc_device::crureadz)
HFDC manual p. 43
*/
-void myarc_hfdc_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(myarc_hfdc_device::cruwrite)
{
if ((offset & 0xff00)==m_cru_base)
{
@@ -627,7 +627,7 @@ void myarc_hfdc_device::signal_drive_status()
(1,0) = OUTPUT1
(1,1) = OUTPUT2
*/
-void myarc_hfdc_device::auxbus_out(offs_t offset, uint8_t data)
+WRITE8_MEMBER( myarc_hfdc_device::auxbus_out )
{
int index;
switch (offset)
@@ -848,7 +848,7 @@ WRITE_LINE_MEMBER( myarc_hfdc_device::dip_w )
/*
Read a byte from the onboard SRAM. This is called from the HDC9234.
*/
-uint8_t myarc_hfdc_device::read_buffer()
+READ8_MEMBER( myarc_hfdc_device::read_buffer )
{
LOGMASKED(LOG_DMA, "Read access to onboard SRAM at %04x\n", m_dma_address);
if (m_dma_address > 0x8000) LOGMASKED(LOG_WARN, "Read access beyond RAM size: %06x\n", m_dma_address);
@@ -860,7 +860,7 @@ uint8_t myarc_hfdc_device::read_buffer()
/*
Write a byte to the onboard SRAM. This is called from the HDC9234.
*/
-void myarc_hfdc_device::write_buffer(uint8_t data)
+WRITE8_MEMBER( myarc_hfdc_device::write_buffer )
{
LOGMASKED(LOG_DMA, "Write access to onboard SRAM at %04x: %02x\n", m_dma_address, data);
if (m_dma_address > 0x8000) LOGMASKED(LOG_WARN, "Write access beyond RAM size: %06x\n", m_dma_address);
diff --git a/src/devices/bus/ti99/peb/hfdc.h b/src/devices/bus/ti99/peb/hfdc.h
index 88648105eb5..1ac9ec925bd 100644
--- a/src/devices/bus/ti99/peb/hfdc.h
+++ b/src/devices/bus/ti99/peb/hfdc.h
@@ -38,10 +38,10 @@ public:
myarc_hfdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_SETADDRESS_DBIN_MEMBER(setaddress_dbin) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
protected:
void device_config_complete() override;
@@ -58,9 +58,9 @@ private:
DECLARE_WRITE_LINE_MEMBER( dmarq_w );
DECLARE_WRITE_LINE_MEMBER( intrq_w );
DECLARE_WRITE_LINE_MEMBER( dip_w );
- void auxbus_out(offs_t offset, uint8_t data);
- uint8_t read_buffer();
- void write_buffer(uint8_t data);
+ DECLARE_WRITE8_MEMBER( auxbus_out );
+ DECLARE_READ8_MEMBER( read_buffer );
+ DECLARE_WRITE8_MEMBER( write_buffer );
DECLARE_FLOPPY_FORMATS( floppy_formats );
diff --git a/src/devices/bus/ti99/peb/horizon.cpp b/src/devices/bus/ti99/peb/horizon.cpp
index fdf4b5f97c1..da5135f70bf 100644
--- a/src/devices/bus/ti99/peb/horizon.cpp
+++ b/src/devices/bus/ti99/peb/horizon.cpp
@@ -219,7 +219,7 @@ READ8Z_MEMBER(horizon_ramdisk_device::readz)
}
}
-void horizon_ramdisk_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(horizon_ramdisk_device::write)
{
// 32K expansion
// According to the manual, "this memory is not affected by the HIDE switch"
@@ -303,7 +303,7 @@ void horizon_ramdisk_device::setbit(int& page, int pattern, bool set)
}
}
-void horizon_ramdisk_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(horizon_ramdisk_device::cruwrite)
{
int size = ioport("HORIZONSIZE")->read();
int split_bit = size + 10;
diff --git a/src/devices/bus/ti99/peb/horizon.h b/src/devices/bus/ti99/peb/horizon.h
index f72e9f109fc..76895f0c586 100644
--- a/src/devices/bus/ti99/peb/horizon.h
+++ b/src/devices/bus/ti99/peb/horizon.h
@@ -26,10 +26,10 @@ class horizon_ramdisk_device : public device_t, public device_ti99_peribox_card_
public:
horizon_ramdisk_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
DECLARE_INPUT_CHANGED_MEMBER( hs_changed );
diff --git a/src/devices/bus/ti99/peb/hsgpl.cpp b/src/devices/bus/ti99/peb/hsgpl.cpp
index 11f40c4d1c8..f9f631726e2 100644
--- a/src/devices/bus/ti99/peb/hsgpl.cpp
+++ b/src/devices/bus/ti99/peb/hsgpl.cpp
@@ -191,7 +191,7 @@ READ8Z_MEMBER(snug_high_speed_gpl_device::crureadz)
/*
Write hsgpl CRU interface
*/
-void snug_high_speed_gpl_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(snug_high_speed_gpl_device::cruwrite)
{
// SuperCart handling - see gromport.c
if (m_supercart_enabled && ((offset & 0xfff0)==SUPERCART_BASE))
@@ -272,46 +272,46 @@ READ8Z_MEMBER(snug_high_speed_gpl_device::readz)
{
if ((offset & 0x7e000)==0x74000)
{
- dsrspace_readz(offset & 0xffff, value);
+ dsrspace_readz(space, offset & 0xffff, value, mem_mask);
}
if ((offset & 0x7e000)==0x76000)
{
- cartspace_readz(offset & 0xffff, value);
+ cartspace_readz(space, offset & 0xffff, value, mem_mask);
}
// 1001 1wbb bbbb bba0
if ((offset & 0x7fc01)==0x79800)
{
- grom_readz(offset & 0xffff, value);
+ grom_readz(space, offset & 0xffff, value, mem_mask);
}
}
/*
Memory write
*/
-void snug_high_speed_gpl_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(snug_high_speed_gpl_device::write)
{
if ((offset & 0x7e000)==0x76000)
{
- cartspace_write(offset & 0xffff, data);
+ cartspace_write(space, offset & 0xffff, data, mem_mask);
}
// 1001 1wbb bbbb bba0
if ((offset & 0x7fc01)==0x79c00)
{
- grom_write(offset & 0xffff, data);
+ grom_write(space, offset & 0xffff, data, mem_mask);
}
}
/*
Specific read access: dsrspace
*/
-void snug_high_speed_gpl_device::dsrspace_readz(offs_t offset, uint8_t* value)
+void snug_high_speed_gpl_device::dsrspace_readz(address_space& space, offs_t offset, uint8_t* value, uint8_t mem_mask)
{
if (m_dsr_enabled)
{
- *value = m_dsr_eeprom->read((offset & 0x1fff) | (m_dsr_page<<13));
+ *value = m_dsr_eeprom->read(space, (offset & 0x1fff) | (m_dsr_page<<13), mem_mask);
LOGMASKED(LOG_READ, "read dsr %04x[%02x] -> %02x\n", offset, m_dsr_page, *value);
}
}
@@ -319,7 +319,7 @@ void snug_high_speed_gpl_device::dsrspace_readz(offs_t offset, uint8_t* value)
/*
Specific read access: cartspace
*/
-void snug_high_speed_gpl_device::cartspace_readz(offs_t offset, uint8_t* value)
+void snug_high_speed_gpl_device::cartspace_readz(address_space& space, offs_t offset, uint8_t* value, uint8_t mem_mask)
{
if (!m_card_enabled || m_flash_mode)
{
@@ -329,7 +329,7 @@ void snug_high_speed_gpl_device::cartspace_readz(offs_t offset, uint8_t* value)
if (m_module_bank < 16)
{
- *value = m_rom6_eeprom->read((offset & 0x1fff) | (m_current_bank<<13) | (m_current_grom_port<<15));
+ *value = m_rom6_eeprom->read(space, (offset & 0x1fff) | (m_current_bank<<13) | (m_current_grom_port<<15), mem_mask);
LOGMASKED(LOG_READ, "cartridge space read %04x -> %02x\n", offset, *value);
}
else
@@ -351,7 +351,7 @@ void snug_high_speed_gpl_device::cartspace_readz(offs_t offset, uint8_t* value)
it here - which is indeed closer to reality, since the real HSGPL also
emulates GROM instead of using proper ones.
*/
-void snug_high_speed_gpl_device::grom_readz(offs_t offset, uint8_t* value)
+void snug_high_speed_gpl_device::grom_readz(address_space& space, offs_t offset, uint8_t* value, uint8_t mem_mask)
{
if (machine().side_effects_disabled()) return;
@@ -397,7 +397,7 @@ void snug_high_speed_gpl_device::grom_readz(offs_t offset, uint8_t* value)
{
if (!m_flash_mode)
{
- *value = m_grom_a_eeprom->read(m_grom_address | (port<<16));
+ *value = m_grom_a_eeprom->read(space, m_grom_address | (port<<16), mem_mask);
m_module_bank = port;
if (bNew) LOGMASKED(LOG_PORT, "GROM read access at %04x - switch to bank %d\n", offset & 0xffff, m_module_bank);
}
@@ -406,7 +406,7 @@ void snug_high_speed_gpl_device::grom_readz(offs_t offset, uint8_t* value)
{
if (port < 16)
{
- *value = m_grom_b_eeprom->read(m_grom_address | ((port-8)<<16));
+ *value = m_grom_b_eeprom->read(space, m_grom_address | ((port-8)<<16), mem_mask);
m_module_bank = port;
if (bNew) LOGMASKED(LOG_PORT, "GROM read access at %04x - switch to bank %d\n", offset & 0xffff, m_module_bank);
}
@@ -416,7 +416,7 @@ void snug_high_speed_gpl_device::grom_readz(offs_t offset, uint8_t* value)
{
// 9840-985c
// DSR banks 0-63 (8 KiB per bank, 8 banks per port)
- *value = m_dsr_eeprom->read(m_grom_address | ((port-16)<<16));
+ *value = m_dsr_eeprom->read(space, m_grom_address | ((port-16)<<16), mem_mask);
// Don't change the module port
if (bNew) LOGMASKED(LOG_DSR, "read access to DSR bank %d-%d (%04x)\n", (port-16)<<3, ((port-16)<<3)+7, offset);
}
@@ -427,7 +427,7 @@ void snug_high_speed_gpl_device::grom_readz(offs_t offset, uint8_t* value)
// 9860-987c (ports 24-31)
// Each ROM6 is available as 4 (sub)banks (switchable via 6000, 6002, 6004, 6006)
// Accordingly, each port has two complete sets
- *value = m_rom6_eeprom->read(m_grom_address | ((port-24)<<16));
+ *value = m_rom6_eeprom->read(space, m_grom_address | ((port-24)<<16), mem_mask);
if (bNew) LOGMASKED(LOG_PORT, "ROM6 read access for module bank %d-%d (%04x)\n", (port-24)<<1, ((port-24)<<1)+1, offset & 0xffff);
}
else
@@ -469,7 +469,7 @@ void snug_high_speed_gpl_device::grom_readz(offs_t offset, uint8_t* value)
/*
Specific write access: cartspace
*/
-void snug_high_speed_gpl_device::cartspace_write(offs_t offset, uint8_t data)
+void snug_high_speed_gpl_device::cartspace_write(address_space& space, offs_t offset, uint8_t data, uint8_t mem_mask)
{
if (!m_card_enabled || m_flash_mode)
{
@@ -537,7 +537,7 @@ void snug_high_speed_gpl_device::cartspace_write(offs_t offset, uint8_t data)
/*
Specific write access: grom_write
*/
-void snug_high_speed_gpl_device::grom_write(offs_t offset, uint8_t data)
+void snug_high_speed_gpl_device::grom_write(address_space& space, offs_t offset, uint8_t data, uint8_t mem_mask)
{
if (machine().side_effects_disabled()) return;
@@ -583,7 +583,7 @@ void snug_high_speed_gpl_device::grom_write(offs_t offset, uint8_t data)
{
if (port < 8)
{
- m_grom_a_eeprom->write(m_grom_address | (port<<16), data);
+ m_grom_a_eeprom->write(space, m_grom_address | (port<<16), data, mem_mask);
m_module_bank = port;
if (bNew) LOGMASKED(LOG_PORT, "GROM write access at %04x - switch to bank %d\n", offset & 0xffff, port);
}
@@ -591,7 +591,7 @@ void snug_high_speed_gpl_device::grom_write(offs_t offset, uint8_t data)
{
if (port < 16)
{
- m_grom_b_eeprom->write(m_grom_address | ((port-8)<<16), data);
+ m_grom_b_eeprom->write(space, m_grom_address | ((port-8)<<16), data, mem_mask);
m_module_bank = port;
if (bNew) LOGMASKED(LOG_PORT, "GROM write access at %04x - switch to bank %d\n", offset & 0xffff, port);
}
@@ -599,14 +599,14 @@ void snug_high_speed_gpl_device::grom_write(offs_t offset, uint8_t data)
{
if (port < 24)
{
- m_dsr_eeprom->write(m_grom_address | ((port-16)<<16), data);
+ m_dsr_eeprom->write(space, m_grom_address | ((port-16)<<16), data, mem_mask);
if (bNew) LOGMASKED(LOG_DSR, "write access to DSR bank %d-%d (%04x)\n", (port-16)<<3, ((port-16)<<3)+7, offset);
}
else
{
if (port < 32)
{
- m_rom6_eeprom->write(m_grom_address | ((port-24)<<16), data);
+ m_rom6_eeprom->write(space, m_grom_address | ((port-24)<<16), data, mem_mask);
if (bNew) LOGMASKED(LOG_PORT, "ROM6 write access for module bank %d-%d (%04x)\n", (port-24)<<1, ((port-24)<<1)+1,offset & 0xffff);
}
else
diff --git a/src/devices/bus/ti99/peb/hsgpl.h b/src/devices/bus/ti99/peb/hsgpl.h
index 7248436963f..65cca91a081 100644
--- a/src/devices/bus/ti99/peb/hsgpl.h
+++ b/src/devices/bus/ti99/peb/hsgpl.h
@@ -29,10 +29,10 @@ class snug_high_speed_gpl_device : public device_t, public device_ti99_peribox_c
public:
snug_high_speed_gpl_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
protected:
virtual void device_start() override;
@@ -51,12 +51,12 @@ private:
required_device<ram_device> m_ram6_memory;
required_device<ram_device> m_gram_memory;
- void dsrspace_readz(offs_t offset, uint8_t* value);
- void cartspace_readz(offs_t offset, uint8_t* value);
- void grom_readz(offs_t offset, uint8_t* value);
+ void dsrspace_readz(address_space& space, offs_t offset, uint8_t* value, uint8_t mem_mask);
+ void cartspace_readz(address_space& space, offs_t offset, uint8_t* value, uint8_t mem_mask);
+ void grom_readz(address_space& space, offs_t offset, uint8_t* value, uint8_t mem_mask);
- void cartspace_write(offs_t offset, uint8_t data);
- void grom_write(offs_t offset, uint8_t data);
+ void cartspace_write(address_space& space, offs_t offset, uint8_t data, uint8_t mem_mask);
+ void grom_write(address_space& space, offs_t offset, uint8_t data, uint8_t mem_mask);
bool m_dsr_enabled;
bool m_gram_enabled;
diff --git a/src/devices/bus/ti99/peb/memex.cpp b/src/devices/bus/ti99/peb/memex.cpp
index 3a3116d262d..1d770a9b224 100644
--- a/src/devices/bus/ti99/peb/memex.cpp
+++ b/src/devices/bus/ti99/peb/memex.cpp
@@ -101,7 +101,7 @@ READ8Z_MEMBER( geneve_memex_device::readz )
/*
Memory write
*/
-void geneve_memex_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( geneve_memex_device::write )
{
/* If not Genmod, add the upper two address bits 10 */
if (!m_genmod) offset |= 0x100000;
@@ -152,12 +152,11 @@ INPUT_PORTS_START( memex )
PORT_DIPSETTING( MDIP8, "Lock out pages FC-FF")
INPUT_PORTS_END
-void geneve_memex_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(geneve_memex_device::device_add_mconfig)
RAM(config, m_ram, 0);
m_ram->set_default_size("2M");
m_ram->set_default_value(0);
-}
+MACHINE_CONFIG_END
ioport_constructor geneve_memex_device::device_input_ports() const
{
diff --git a/src/devices/bus/ti99/peb/memex.h b/src/devices/bus/ti99/peb/memex.h
index fb7ca27a1ad..3aa44429dc0 100644
--- a/src/devices/bus/ti99/peb/memex.h
+++ b/src/devices/bus/ti99/peb/memex.h
@@ -26,10 +26,10 @@ class geneve_memex_device : public device_t, public device_ti99_peribox_card_int
public:
geneve_memex_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override { }
- void cruwrite(offs_t offset, uint8_t data) override { }
+ DECLARE_WRITE8_MEMBER(cruwrite) override { }
protected:
void device_start() override;
diff --git a/src/devices/bus/ti99/peb/myarcmem.cpp b/src/devices/bus/ti99/peb/myarcmem.cpp
index 79add7a6c72..ccb8f0091cf 100644
--- a/src/devices/bus/ti99/peb/myarcmem.cpp
+++ b/src/devices/bus/ti99/peb/myarcmem.cpp
@@ -101,7 +101,7 @@ READ8Z_MEMBER(myarc_memory_expansion_device::readz)
/*
Memory write access. DSRROM does not allow writing.
*/
-void myarc_memory_expansion_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(myarc_memory_expansion_device::write)
{
int base = get_base(offset);
@@ -142,7 +142,7 @@ READ8Z_MEMBER(myarc_memory_expansion_device::crureadz)
1006 = bit 2 of RAM bank value (512K)
1008 = bit 3 of RAM bank value (512K)
*/
-void myarc_memory_expansion_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(myarc_memory_expansion_device::cruwrite)
{
if (((offset & 0xff00)==MYARCMEM_CRU_BASE1)||((offset & 0xff00)==MYARCMEM_CRU_BASE2))
{
diff --git a/src/devices/bus/ti99/peb/myarcmem.h b/src/devices/bus/ti99/peb/myarcmem.h
index 175b8d60344..3ea9d52419a 100644
--- a/src/devices/bus/ti99/peb/myarcmem.h
+++ b/src/devices/bus/ti99/peb/myarcmem.h
@@ -25,10 +25,10 @@ class myarc_memory_expansion_device : public device_t, public device_ti99_peribo
public:
myarc_memory_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
protected:
void device_start() override;
diff --git a/src/devices/bus/ti99/peb/pcode.cpp b/src/devices/bus/ti99/peb/pcode.cpp
index dbdd7c9f1a9..f0a24ad1646 100644
--- a/src/devices/bus/ti99/peb/pcode.cpp
+++ b/src/devices/bus/ti99/peb/pcode.cpp
@@ -142,7 +142,7 @@ SETADDRESS_DBIN_MEMBER( ti_pcode_card_device::setaddress_dbin )
}
}
-void ti_pcode_card_device::debugger_read(uint16_t offset, uint8_t& value)
+void ti_pcode_card_device::debugger_read(address_space& space, uint16_t offset, uint8_t& value)
{
// The debuger does not call setaddress
if (m_active && ((offset & m_select_mask)==m_select_value))
@@ -160,7 +160,7 @@ READ8Z_MEMBER( ti_pcode_card_device::readz )
// Care for debugger
if (machine().side_effects_disabled())
{
- debugger_read(offset, *value);
+ debugger_read(space, offset, *value);
}
if (m_active && m_inDsrArea && m_selected)
@@ -200,7 +200,7 @@ READ8Z_MEMBER( ti_pcode_card_device::readz )
Write a byte in P-Code ROM space. This is only used for setting the
GROM address.
*/
-void ti_pcode_card_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( ti_pcode_card_device::write )
{
if (machine().side_effects_disabled()) return;
if (m_active && m_isgrom && m_selected)
@@ -253,7 +253,7 @@ READ8Z_MEMBER(ti_pcode_card_device::crureadz)
A8, A13, and A14 so bit 0 is at 0x1f00, but bit 4 is at 0x1f80. Accordingly,
bit 7 would be 0x1f86 but it is not used.
*/
-void ti_pcode_card_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti_pcode_card_device::cruwrite)
{
if ((offset & 0xff00)==CRU_BASE)
m_crulatch->write_bit((offset & 0x80) >> 5 | (offset & 0x06) >> 1, data);
diff --git a/src/devices/bus/ti99/peb/pcode.h b/src/devices/bus/ti99/peb/pcode.h
index 5e7a2cb6ce0..96462dba527 100644
--- a/src/devices/bus/ti99/peb/pcode.h
+++ b/src/devices/bus/ti99/peb/pcode.h
@@ -28,9 +28,9 @@ class ti_pcode_card_device : public device_t, public device_ti99_peribox_card_in
public:
ti_pcode_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
DECLARE_SETADDRESS_DBIN_MEMBER(setaddress_dbin) override;
DECLARE_WRITE_LINE_MEMBER(clock_in) override;
@@ -51,7 +51,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(pcpage_w);
DECLARE_WRITE_LINE_MEMBER(ekrpg_w);
- void debugger_read(uint16_t addr, uint8_t& value);
+ void debugger_read(address_space& space, uint16_t addr, uint8_t& value);
required_device_array<tmc0430_device, 8> m_groms;
diff --git a/src/devices/bus/ti99/peb/peribox.cpp b/src/devices/bus/ti99/peb/peribox.cpp
index b75a15a49ed..80da29f6dd4 100644
--- a/src/devices/bus/ti99/peb/peribox.cpp
+++ b/src/devices/bus/ti99/peb/peribox.cpp
@@ -272,15 +272,15 @@ READ8Z_MEMBER(peribox_device::readz)
{
for (int i=2; i <= 8; i++)
{
- if (m_slot[i]!=nullptr) m_slot[i]->readz(offset | m_address_prefix, value);
+ if (m_slot[i]!=nullptr) m_slot[i]->readz(space, offset | m_address_prefix, value, mem_mask);
}
}
-void peribox_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(peribox_device::write)
{
for (int i=2; i <= 8; i++)
{
- if (m_slot[i]!=nullptr) m_slot[i]->write(offset | m_address_prefix, data);
+ if (m_slot[i]!=nullptr) m_slot[i]->write(space, offset | m_address_prefix, data, mem_mask);
}
}
@@ -291,7 +291,7 @@ SETADDRESS_DBIN_MEMBER(peribox_device::setaddress_dbin)
for (int i=2; i <= 8; i++)
{
- if (m_slot[i]!=nullptr) m_slot[i]->setaddress_dbin(offset | m_address_prefix, state);
+ if (m_slot[i]!=nullptr) m_slot[i]->setaddress_dbin(space, offset | m_address_prefix, state);
}
}
@@ -299,15 +299,15 @@ READ8Z_MEMBER(peribox_device::crureadz)
{
for (int i=2; i <= 8; i++)
{
- if (m_slot[i]!=nullptr) m_slot[i]->crureadz(offset, value);
+ if (m_slot[i]!=nullptr) m_slot[i]->crureadz(space, offset, value);
}
}
-void peribox_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(peribox_device::cruwrite)
{
for (int i=2; i <= 8; i++)
{
- if (m_slot[i]!=nullptr) m_slot[i]->cruwrite(offset, data);
+ if (m_slot[i]!=nullptr) m_slot[i]->cruwrite(space, offset, data);
}
}
@@ -647,27 +647,27 @@ peribox_slot_device::peribox_slot_device(const machine_config &mconfig, const ch
READ8Z_MEMBER(peribox_slot_device::readz)
{
- m_card->readz(offset, value);
+ m_card->readz(space, offset, value, mem_mask);
}
-void peribox_slot_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(peribox_slot_device::write)
{
- m_card->write(offset, data);
+ m_card->write(space, offset, data, mem_mask);
}
SETADDRESS_DBIN_MEMBER(peribox_slot_device::setaddress_dbin)
{
- m_card->setaddress_dbin(offset, state);
+ m_card->setaddress_dbin(space, offset, state);
}
READ8Z_MEMBER(peribox_slot_device::crureadz)
{
- m_card->crureadz(offset, value);
+ m_card->crureadz(space, offset, value);
}
-void peribox_slot_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(peribox_slot_device::cruwrite)
{
- m_card->cruwrite(offset, data);
+ m_card->cruwrite(space, offset, data);
}
WRITE_LINE_MEMBER( peribox_slot_device::senila )
diff --git a/src/devices/bus/ti99/peb/peribox.h b/src/devices/bus/ti99/peb/peribox.h
index 405ded3338e..a936a5346ef 100644
--- a/src/devices/bus/ti99/peb/peribox.h
+++ b/src/devices/bus/ti99/peb/peribox.h
@@ -36,11 +36,11 @@ public:
// Next eight methods are called from the console
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_SETADDRESS_DBIN_MEMBER(setaddress_dbin) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
DECLARE_WRITE_LINE_MEMBER(senila);
DECLARE_WRITE_LINE_MEMBER(senilb);
@@ -176,9 +176,9 @@ class device_ti99_peribox_card_interface : public device_slot_card_interface
public:
virtual DECLARE_READ8Z_MEMBER(readz) = 0;
- virtual void write(offs_t offset, uint8_t data) = 0;
+ virtual DECLARE_WRITE8_MEMBER(write) = 0;
virtual DECLARE_READ8Z_MEMBER(crureadz) = 0;
- virtual void cruwrite(offs_t offset, uint8_t data) = 0;
+ virtual DECLARE_WRITE8_MEMBER(cruwrite) = 0;
virtual DECLARE_SETADDRESS_DBIN_MEMBER(setaddress_dbin) { };
virtual DECLARE_WRITE_LINE_MEMBER(clock_in) { }
@@ -231,7 +231,7 @@ public:
// Called from the box (direction to card)
DECLARE_READ8Z_MEMBER(readz);
- void write(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER(write);
DECLARE_SETADDRESS_DBIN_MEMBER(setaddress_dbin);
DECLARE_WRITE_LINE_MEMBER(senila);
@@ -245,7 +245,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( set_ready );
DECLARE_READ8Z_MEMBER(crureadz);
- void cruwrite(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER(cruwrite);
// called from the box itself
void set_genmod(bool set);
diff --git a/src/devices/bus/ti99/peb/samsmem.cpp b/src/devices/bus/ti99/peb/samsmem.cpp
index dff96b57198..1bc315fed1f 100644
--- a/src/devices/bus/ti99/peb/samsmem.cpp
+++ b/src/devices/bus/ti99/peb/samsmem.cpp
@@ -70,7 +70,7 @@ READ8Z_MEMBER(sams_memory_expansion_device::readz)
}
}
-void sams_memory_expansion_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sams_memory_expansion_device::write)
{
int base;
@@ -104,7 +104,7 @@ READ8Z_MEMBER(sams_memory_expansion_device::crureadz)
/*
CRU write. Turns on the mapper and allows to change it.
*/
-void sams_memory_expansion_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(sams_memory_expansion_device::cruwrite)
{
if ((offset & 0xff00)==SAMS_CRU_BASE)
m_crulatch->write_bit((offset & 0x000e) >> 1, data);
diff --git a/src/devices/bus/ti99/peb/samsmem.h b/src/devices/bus/ti99/peb/samsmem.h
index da05b58438e..c002252d773 100644
--- a/src/devices/bus/ti99/peb/samsmem.h
+++ b/src/devices/bus/ti99/peb/samsmem.h
@@ -28,10 +28,10 @@ class sams_memory_expansion_device : public device_t, public device_ti99_peribox
public:
sams_memory_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
protected:
void device_start() override;
diff --git a/src/devices/bus/ti99/peb/spchsyn.cpp b/src/devices/bus/ti99/peb/spchsyn.cpp
index b4bcebf3c94..0f10eea1f33 100644
--- a/src/devices/bus/ti99/peb/spchsyn.cpp
+++ b/src/devices/bus/ti99/peb/spchsyn.cpp
@@ -67,14 +67,14 @@ READ8Z_MEMBER( ti_speech_synthesizer_device::readz )
// lines by setting the address bus to a different value, but the
// Geneve may behave differently. This may not 100% reflect the real
// situation, but it ensures a safe processing.
- m_vsp->combined_rsq_wsq_w(machine().dummy_space(), 0, ~0);
+ m_vsp->combined_rsq_wsq_w(space, 0, ~0);
}
}
/*
Memory write
*/
-void ti_speech_synthesizer_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( ti_speech_synthesizer_device::write )
{
if (machine().side_effects_disabled()) return;
@@ -92,6 +92,7 @@ SETADDRESS_DBIN_MEMBER( ti_speech_synthesizer_device::setaddress_dbin )
// 1001 00xx xxxx xxx0 DBIN=1
// 1001 01xx xxxx xxx0 DBIN=0
// 1111 1000 0000 0001 mask
+ m_space = &space;
m_reading = (state==ASSERT_LINE);
bool valid = (((offset & 0x0400)==0) == m_reading);
@@ -106,11 +107,11 @@ SETADDRESS_DBIN_MEMBER( ti_speech_synthesizer_device::setaddress_dbin )
// both RS* and WS* are active, which is illegal.
// Alternatively, we'll use the combined settings method
- m_vsp->combined_rsq_wsq_w(machine().dummy_space(), 0, m_reading ? ~tms5220_device::RS : ~tms5220_device::WS);
+ m_vsp->combined_rsq_wsq_w(space, 0, m_reading ? ~tms5220_device::RS : ~tms5220_device::WS);
}
else
// If other address, turn off RS* and WS* (negative logic!)
- m_vsp->combined_rsq_wsq_w(machine().dummy_space(), 0, ~0);
+ m_vsp->combined_rsq_wsq_w(space, 0, ~0);
}
/****************************************************************************/
@@ -125,11 +126,13 @@ WRITE_LINE_MEMBER( ti_speech_synthesizer_device::speech_ready )
if ((state==0) && !m_reading)
// Clear the lines only when we are done with writing.
- m_vsp->combined_rsq_wsq_w(machine().dummy_space(), 0, ~0);
+ m_vsp->combined_rsq_wsq_w(*m_space, 0, ~0);
}
void ti_speech_synthesizer_device::device_start()
{
+ // We don't need to save m_space because the calling method
+ // combined_rsq_wsq_w only needs the address space formally.
save_item(NAME(m_reading));
save_item(NAME(m_sbe));
}
diff --git a/src/devices/bus/ti99/peb/spchsyn.h b/src/devices/bus/ti99/peb/spchsyn.h
index 8efee71aed7..35bf0f680e8 100644
--- a/src/devices/bus/ti99/peb/spchsyn.h
+++ b/src/devices/bus/ti99/peb/spchsyn.h
@@ -26,11 +26,11 @@ class ti_speech_synthesizer_device : public device_t, public device_ti99_peribox
public:
ti_speech_synthesizer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_SETADDRESS_DBIN_MEMBER(setaddress_dbin) override;
DECLARE_READ8Z_MEMBER(crureadz) override { }
- void cruwrite(offs_t offset, uint8_t data) override { }
+ DECLARE_WRITE8_MEMBER(cruwrite) override { }
protected:
virtual void device_start() override;
@@ -41,6 +41,7 @@ protected:
private:
DECLARE_WRITE_LINE_MEMBER( speech_ready );
+ address_space* m_space;
required_device<cd2501e_device> m_vsp;
bool m_reading;
bool m_sbe; // Signal "Speech block enable"
diff --git a/src/devices/bus/ti99/peb/ti_32kmem.cpp b/src/devices/bus/ti99/peb/ti_32kmem.cpp
index b25c7d65784..fce434c70d7 100644
--- a/src/devices/bus/ti99/peb/ti_32kmem.cpp
+++ b/src/devices/bus/ti99/peb/ti_32kmem.cpp
@@ -82,7 +82,7 @@ READ8Z_MEMBER(ti_32k_expcard_device::readz)
}
}
-void ti_32k_expcard_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti_32k_expcard_device::write)
{
bool select = ((offset & 0xfc000)==0x7c000) | ((offset & 0xf6000)==0x72000); // PAL output pin 14 [1]
@@ -100,11 +100,10 @@ void ti_32k_expcard_device::device_start()
{
}
-void ti_32k_expcard_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(ti_32k_expcard_device::device_add_mconfig)
RAM(config, m_ram, 0);
m_ram->set_default_size("32k");
m_ram->set_default_value(0);
-}
+MACHINE_CONFIG_END
} } } // end namespace bus::ti99::peb
diff --git a/src/devices/bus/ti99/peb/ti_32kmem.h b/src/devices/bus/ti99/peb/ti_32kmem.h
index 5ed0faac87c..0ff492ca1c7 100644
--- a/src/devices/bus/ti99/peb/ti_32kmem.h
+++ b/src/devices/bus/ti99/peb/ti_32kmem.h
@@ -26,10 +26,10 @@ class ti_32k_expcard_device : public device_t, public device_ti99_peribox_card_i
public:
ti_32k_expcard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override { }
- void cruwrite(offs_t offset, uint8_t data) override { }
+ DECLARE_WRITE8_MEMBER(cruwrite) override { }
protected:
void device_start() override;
diff --git a/src/devices/bus/ti99/peb/ti_fdc.cpp b/src/devices/bus/ti99/peb/ti_fdc.cpp
index 79d27cd5460..530dc71d987 100644
--- a/src/devices/bus/ti99/peb/ti_fdc.cpp
+++ b/src/devices/bus/ti99/peb/ti_fdc.cpp
@@ -160,7 +160,7 @@ READ8Z_MEMBER(ti_fdc_device::readz)
}
}
-void ti_fdc_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti_fdc_device::write)
{
if (machine().side_effects_disabled()) return;
@@ -201,7 +201,7 @@ READ8Z_MEMBER(ti_fdc_device::crureadz)
if ((offset & 0xff00)==m_cru_base)
{
uint8_t reply = 0;
- if ((offset & 0x0070) == 0)
+ if ((offset & 0x07) == 0)
{
// Selected drive
reply |= ((m_DSEL)<<1);
@@ -212,12 +212,12 @@ READ8Z_MEMBER(ti_fdc_device::crureadz)
// Selected side
if (m_SIDSEL==ASSERT_LINE) reply |= 0x80;
}
- *value = BIT(reply, (offset >> 1) & 0x07);
+ *value = reply;
LOGMASKED(LOG_CRU, "Read CRU = %02x\n", *value);
}
}
-void ti_fdc_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti_fdc_device::cruwrite)
{
if ((offset & 0xff00)==m_cru_base)
m_crulatch->write_bit((offset >> 1) & 0x07, BIT(data, 0));
diff --git a/src/devices/bus/ti99/peb/ti_fdc.h b/src/devices/bus/ti99/peb/ti_fdc.h
index 4c07bcb142e..f7312661080 100644
--- a/src/devices/bus/ti99/peb/ti_fdc.h
+++ b/src/devices/bus/ti99/peb/ti_fdc.h
@@ -28,11 +28,11 @@ class ti_fdc_device : public device_t, public device_ti99_peribox_card_interface
public:
ti_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_SETADDRESS_DBIN_MEMBER(setaddress_dbin) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
// bool dvena_r();
diff --git a/src/devices/bus/ti99/peb/ti_rs232.cpp b/src/devices/bus/ti99/peb/ti_rs232.cpp
index cbc164bbcb2..8f2ed3f4c45 100644
--- a/src/devices/bus/ti99/peb/ti_rs232.cpp
+++ b/src/devices/bus/ti99/peb/ti_rs232.cpp
@@ -254,17 +254,17 @@ READ8Z_MEMBER(ti_rs232_pio_device::crureadz)
if ((m_signals[0] & tms9902_device::CTS)!=0) reply |= 0x20;
if ((m_signals[1] & tms9902_device::CTS)!=0) reply |= 0x40;
if (m_led) reply |= 0x80;
- *value = BIT(reply, (offset>>1) & 7);
+ *value = reply;
return;
}
if ((offset & 0x00c0)==0x0040)
{
- *value = m_uart0->cruread(offset>>1);
+ *value = m_uart0->cruread(space, offset>>4, 0xff);
return;
}
if ((offset & 0x00c0)==0x0080)
{
- *value = m_uart1->cruread(offset>>1);
+ *value = m_uart1->cruread(space, offset>>4, 0xff);
return;
}
}
@@ -273,18 +273,18 @@ READ8Z_MEMBER(ti_rs232_pio_device::crureadz)
/*
CRU write
*/
-void ti_rs232_pio_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ti_rs232_pio_device::cruwrite)
{
if ((offset & 0xff00)==m_cru_base)
{
if ((offset & 0x00c0)==0x0040)
{
- m_uart0->cruwrite(offset>>1, data);
+ m_uart0->cruwrite(space, offset>>1, data, 0xff);
return;
}
if ((offset & 0x00c0)==0x0080)
{
- m_uart1->cruwrite(offset>>1, data);
+ m_uart1->cruwrite(space, offset>>1, data, 0xff);
return;
}
@@ -403,7 +403,7 @@ READ8Z_MEMBER( ti_rs232_pio_device::readz )
/*
Memory write
*/
-void ti_rs232_pio_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( ti_rs232_pio_device::write )
{
if (((offset & m_select_mask)==m_select_value) && m_selected)
{
@@ -967,12 +967,12 @@ WRITE_LINE_MEMBER( ti_rs232_pio_device::rcv1_callback )
receive_data_or_line_state(1);
}
-void ti_rs232_pio_device::xmit0_callback(uint8_t data)
+WRITE8_MEMBER( ti_rs232_pio_device::xmit0_callback )
{
transmit_data(0, data);
}
-void ti_rs232_pio_device::xmit1_callback(uint8_t data)
+WRITE8_MEMBER( ti_rs232_pio_device::xmit1_callback )
{
transmit_data(1, data);
}
@@ -998,12 +998,12 @@ void ti_rs232_pio_device::ctrl_callback(int uartind, int offset, uint8_t data)
}
}
-void ti_rs232_pio_device::ctrl0_callback(offs_t offset, uint8_t data)
+WRITE8_MEMBER( ti_rs232_pio_device::ctrl0_callback )
{
ctrl_callback(0, offset, data);
}
-void ti_rs232_pio_device::ctrl1_callback(offs_t offset, uint8_t data)
+WRITE8_MEMBER( ti_rs232_pio_device::ctrl1_callback )
{
ctrl_callback(1, offset, data);
}
@@ -1101,8 +1101,7 @@ INPUT_PORTS_START( ti_rs232 )
PORT_CONFSETTING( 0x02, "5-20" )
INPUT_PORTS_END
-void ti_rs232_pio_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(ti_rs232_pio_device::device_add_mconfig)
TMS9902(config, m_uart0, 3000000);
m_uart0->int_cb().set(FUNC(ti_rs232_pio_device::int0_callback));
m_uart0->rcv_cb().set(FUNC(ti_rs232_pio_device::rcv0_callback));
@@ -1129,7 +1128,7 @@ void ti_rs232_pio_device::device_add_mconfig(machine_config &config)
m_crulatch->q_out_cb<5>().set(FUNC(ti_rs232_pio_device::cts0_w));
m_crulatch->q_out_cb<6>().set(FUNC(ti_rs232_pio_device::cts1_w));
m_crulatch->q_out_cb<7>().set(FUNC(ti_rs232_pio_device::led_w));
-}
+MACHINE_CONFIG_END
const tiny_rom_entry *ti_rs232_pio_device::device_rom_region() const
{
diff --git a/src/devices/bus/ti99/peb/ti_rs232.h b/src/devices/bus/ti99/peb/ti_rs232.h
index 3c3b1e89d4b..75e6ff582df 100644
--- a/src/devices/bus/ti99/peb/ti_rs232.h
+++ b/src/devices/bus/ti99/peb/ti_rs232.h
@@ -32,10 +32,10 @@ class ti_rs232_pio_device : public device_t, public device_ti99_peribox_card_int
public:
ti_rs232_pio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
protected:
void device_start() override;
@@ -50,10 +50,10 @@ private:
DECLARE_WRITE_LINE_MEMBER(int1_callback);
DECLARE_WRITE_LINE_MEMBER(rcv0_callback);
DECLARE_WRITE_LINE_MEMBER(rcv1_callback);
- void xmit0_callback(uint8_t data);
- void xmit1_callback(uint8_t data);
- void ctrl0_callback(offs_t offset, uint8_t data);
- void ctrl1_callback(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER(xmit0_callback);
+ DECLARE_WRITE8_MEMBER(xmit1_callback);
+ DECLARE_WRITE8_MEMBER(ctrl0_callback);
+ DECLARE_WRITE8_MEMBER(ctrl1_callback);
DECLARE_WRITE_LINE_MEMBER(selected_w);
DECLARE_WRITE_LINE_MEMBER(pio_direction_in_w);
diff --git a/src/devices/bus/ti99/peb/tn_ide.cpp b/src/devices/bus/ti99/peb/tn_ide.cpp
index 4654a926791..243450fd34f 100644
--- a/src/devices/bus/ti99/peb/tn_ide.cpp
+++ b/src/devices/bus/ti99/peb/tn_ide.cpp
@@ -71,7 +71,9 @@ READ8Z_MEMBER(nouspikel_ide_interface_device::crureadz)
uint8_t reply = 0;
if ((offset & 0xff00)==m_cru_base)
{
- if ((offset & 0x0070) == 0)
+ int bit = (offset >> 4) & 7;
+
+ if (bit==0)
{
reply = m_cru_register & 0x30;
reply |= 8; /* IDE bus IORDY always set */
@@ -82,14 +84,14 @@ READ8Z_MEMBER(nouspikel_ide_interface_device::crureadz)
if (!m_ata_irq)
reply |= 1;
}
- *value = BIT(reply, (offset >> 1) & 7);
+ *value = reply;
}
}
/*
CRU write
*/
-void nouspikel_ide_interface_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nouspikel_ide_interface_device::cruwrite)
{
if ((offset & 0xff00)==m_cru_base)
{
@@ -144,18 +146,18 @@ READ8Z_MEMBER(nouspikel_ide_interface_device::readz)
case 0: /* RTC RAM */
if (addr & 0x80)
/* RTC RAM page register */
- reply = m_rtc->xram_r((addr & 0x1f) | 0x20);
+ reply = m_rtc->xram_r(machine().dummy_space(), (addr & 0x1f) | 0x20);
else
/* RTC RAM read */
- reply = m_rtc->xram_r(addr);
+ reply = m_rtc->xram_r(machine().dummy_space(), addr);
break;
case 1: /* RTC registers */
if (addr & 0x10)
/* register data */
- reply = m_rtc->rtc_r(1);
+ reply = m_rtc->rtc_r(machine().dummy_space(), 1);
else
/* register select */
- reply = m_rtc->rtc_r(0);
+ reply = m_rtc->rtc_r(machine().dummy_space(), 0);
break;
case 2: /* IDE registers set 1 (CS1Fx) */
if (m_tms9995_mode ? (!(addr & 1)) : (addr & 1))
@@ -195,7 +197,7 @@ READ8Z_MEMBER(nouspikel_ide_interface_device::readz)
/*
Memory write. The controller is 16 bit, so we need to demultiplex again.
*/
-void nouspikel_ide_interface_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nouspikel_ide_interface_device::write)
{
if (machine().side_effects_disabled()) return;
@@ -215,18 +217,18 @@ void nouspikel_ide_interface_device::write(offs_t offset, uint8_t data)
case 0: /* RTC RAM */
if (addr & 0x80)
/* RTC RAM page register */
- m_rtc->xram_w((addr & 0x1f) | 0x20, data);
+ m_rtc->xram_w(machine().dummy_space(), (addr & 0x1f) | 0x20, data);
else
/* RTC RAM write */
- m_rtc->xram_w(addr, data);
+ m_rtc->xram_w(machine().dummy_space(), addr, data);
break;
case 1: /* RTC registers */
if (addr & 0x10)
/* register data */
- m_rtc->rtc_w(1, data);
+ m_rtc->rtc_w(machine().dummy_space(), 1, data);
else
/* register select */
- m_rtc->rtc_w(0, data);
+ m_rtc->rtc_w(machine().dummy_space(), 0, data);
break;
case 2: /* IDE registers set 1 (CS1Fx) */
/*
diff --git a/src/devices/bus/ti99/peb/tn_ide.h b/src/devices/bus/ti99/peb/tn_ide.h
index 51d516d5af0..b4aa66f2fe3 100644
--- a/src/devices/bus/ti99/peb/tn_ide.h
+++ b/src/devices/bus/ti99/peb/tn_ide.h
@@ -28,10 +28,10 @@ class nouspikel_ide_interface_device : public device_t, public device_ti99_perib
public:
nouspikel_ide_interface_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
void do_inta(int state);
bool m_ata_irq;
diff --git a/src/devices/bus/ti99/peb/tn_usbsm.cpp b/src/devices/bus/ti99/peb/tn_usbsm.cpp
index 77f933667e9..813ced0eb0d 100644
--- a/src/devices/bus/ti99/peb/tn_usbsm.cpp
+++ b/src/devices/bus/ti99/peb/tn_usbsm.cpp
@@ -93,8 +93,9 @@ READ8Z_MEMBER(nouspikel_usb_smartmedia_device::crureadz)
if ((offset & 0xff00)==m_cru_base)
{
uint8_t reply = 0;
+ offset &= 3;
- if ((offset & 0x0030) == 0)
+ if (offset == 0)
{
// bit
// 0 >1x00 0: USB Host controller requests interrupt.
@@ -116,14 +117,14 @@ READ8Z_MEMBER(nouspikel_usb_smartmedia_device::crureadz)
else if (!m_smartmedia->is_protected())
reply |= 0x80;
}
- *value = BIT(reply, (offset >> 1) & 7);
+ *value = reply;
}
}
/*
CRU write
*/
-void nouspikel_usb_smartmedia_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nouspikel_usb_smartmedia_device::cruwrite)
{
if ((offset & 0xff00)==m_cru_base)
{
@@ -211,7 +212,7 @@ READ8Z_MEMBER(nouspikel_usb_smartmedia_device::readz)
{
// FEEPROM
if (!m_write_flash)
- m_input_latch = m_flash->read16((offset>>1)&0xffff);
+ m_input_latch = m_flash->read16(space, (offset>>1)&0xffff);
}
}
else
@@ -239,7 +240,7 @@ READ8Z_MEMBER(nouspikel_usb_smartmedia_device::readz)
/*
Memory write. The controller is 16 bit, so we need to demultiplex again.
*/
-void nouspikel_usb_smartmedia_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nouspikel_usb_smartmedia_device::write)
{
if (machine().side_effects_disabled()) return;
@@ -279,7 +280,7 @@ void nouspikel_usb_smartmedia_device::write(offs_t offset, uint8_t data)
else
{ // FEEPROM
if (m_write_flash)
- m_flash->write16((offset>>1)&0xffff, m_output_latch);
+ m_flash->write16(space, (offset>>1)&0xffff, m_output_latch);
}
}
else
@@ -365,13 +366,12 @@ INPUT_PORTS_START( tn_usbsm )
PORT_DIPSETTING( 0x01, "Geneve mode")
INPUT_PORTS_END
-void nouspikel_usb_smartmedia_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(nouspikel_usb_smartmedia_device::device_add_mconfig)
SMARTMEDIA(config, "smartmedia", 0);
STRATAFLASH(config, STRATA_TAG, 0);
RAM(config, RAM1_TAG).set_default_size("512K").set_default_value(0);
RAM(config, RAM2_TAG).set_default_size("512K").set_default_value(0);
-}
+MACHINE_CONFIG_END
ioport_constructor nouspikel_usb_smartmedia_device::device_input_ports() const
{
diff --git a/src/devices/bus/ti99/peb/tn_usbsm.h b/src/devices/bus/ti99/peb/tn_usbsm.h
index 52c2690f3ed..a379d67102c 100644
--- a/src/devices/bus/ti99/peb/tn_usbsm.h
+++ b/src/devices/bus/ti99/peb/tn_usbsm.h
@@ -28,10 +28,10 @@ class nouspikel_usb_smartmedia_device : public device_t, public device_ti99_peri
public:
nouspikel_usb_smartmedia_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz) override;
- void write(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
- void cruwrite(offs_t offset, uint8_t data) override;
+ DECLARE_WRITE8_MEMBER(cruwrite) override;
protected:
virtual void device_start() override;
diff --git a/src/devices/bus/ti99/ti99defs.h b/src/devices/bus/ti99/ti99defs.h
index 46bb67aaae9..32d7c88ed38 100644
--- a/src/devices/bus/ti99/ti99defs.h
+++ b/src/devices/bus/ti99/ti99defs.h
@@ -52,8 +52,8 @@
devices as in the real machine, and only the active device changes the bus lines.
*/
-#define READ8Z_MEMBER(name) void name(ATTR_UNUSED offs_t offset, ATTR_UNUSED uint8_t *value)
-#define DECLARE_READ8Z_MEMBER(name) void name(ATTR_UNUSED offs_t offset, ATTR_UNUSED uint8_t *value)
+#define READ8Z_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint8_t *value, ATTR_UNUSED uint8_t mem_mask)
+#define DECLARE_READ8Z_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint8_t *value, ATTR_UNUSED uint8_t mem_mask = 0xff)
/*
For almost all applications of setoffset, we also need the data bus
@@ -61,7 +61,7 @@
that this is a general rule, we use new macros here which contain the
DBIN setting.
*/
-#define SETADDRESS_DBIN_MEMBER(name) void name(ATTR_UNUSED offs_t offset, ATTR_UNUSED int state)
-#define DECLARE_SETADDRESS_DBIN_MEMBER(name) void name(ATTR_UNUSED offs_t offset, ATTR_UNUSED int state)
+#define SETADDRESS_DBIN_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED int state)
+#define DECLARE_SETADDRESS_DBIN_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED int state)
#endif // MAME_BUS_TI99_TI99DEFS_H
diff --git a/src/devices/bus/ti99x/990_dk.cpp b/src/devices/bus/ti99x/990_dk.cpp
index a634bba7a24..118804ddb2b 100644
--- a/src/devices/bus/ti99x/990_dk.cpp
+++ b/src/devices/bus/ti99x/990_dk.cpp
@@ -709,16 +709,19 @@ READ8_MEMBER( fd800_legacy_device::cru_r )
{
int reply = 0;
- offset &= 31;
- if (offset < 16)
+ switch (offset)
{
+ case 0:
+ case 1:
// receive buffer
- reply = BIT(m_recv_buf, offset);
- }
- else
- {
+ reply = m_recv_buf >> (offset*8);
+ break;
+
+ case 2:
+ case 3:
// status register
- reply = BIT(m_stat_reg, offset - 16);
+ reply = m_stat_reg >> ((offset-2)*8);
+ break;
}
return reply;
diff --git a/src/devices/bus/ti99x/990_hd.cpp b/src/devices/bus/ti99x/990_hd.cpp
index c17f63b807e..9bfef6e075b 100644
--- a/src/devices/bus/ti99x/990_hd.cpp
+++ b/src/devices/bus/ti99x/990_hd.cpp
@@ -463,7 +463,7 @@ void ti990_hdc_device::store_registers()
if (! (m_w[1] & w1_transfer_inhibit))
for (i=0; i<real_word_count; i++)
{
- m_memory_space->write_word(dma_address, buffer[i]);
+ machine().device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, buffer[i]);
dma_address = (dma_address + 2) & 0x1ffffe;
}
@@ -618,7 +618,7 @@ void ti990_hdc_device::read_data()
if (! (m_w[1] & w1_transfer_inhibit))
for (i=0; i<bytes_read; i+=2)
{
- m_memory_space->write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]);
+ machine().device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]);
dma_address = (dma_address + 2) & 0x1ffffe;
}
@@ -714,7 +714,7 @@ void ti990_hdc_device::write_data()
/* DMA */
for (i=0; (i<byte_count) && (i<m_d[dsk_sel].bytes_per_sector); i+=2)
{
- word = m_memory_space->read_word(dma_address);
+ word = machine().device("maincpu")->memory().space(AS_PROGRAM).read_word(dma_address);
buffer[i] = word >> 8;
buffer[i+1] = word & 0xff;
@@ -821,7 +821,7 @@ void ti990_hdc_device::unformatted_read()
if (! (m_w[1] & w1_transfer_inhibit))
for (i=0; i<real_word_count; i++)
{
- m_memory_space->write_word(dma_address, buffer[i]);
+ machine().device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, buffer[i]);
dma_address = (dma_address + 2) & 0x1ffffe;
}
@@ -962,9 +962,7 @@ WRITE16_MEMBER(ti990_hdc_device::write)
DEFINE_DEVICE_TYPE(TI990_HDC, ti990_hdc_device, "ti990_hdc", "Generic TI-990 Hard Disk Controller")
ti990_hdc_device::ti990_hdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TI990_HDC, tag, owner, clock)
- , m_memory_space(*this, finder_base::DUMMY_TAG, -1)
- , m_interrupt_callback(*this)
+ : device_t(mconfig, TI990_HDC, tag, owner, clock), m_interrupt_callback(*this)
{
}
diff --git a/src/devices/bus/ti99x/990_hd.h b/src/devices/bus/ti99x/990_hd.h
index 803e9ca7c79..47fe5d947f6 100644
--- a/src/devices/bus/ti99x/990_hd.h
+++ b/src/devices/bus/ti99x/990_hd.h
@@ -23,7 +23,6 @@ public:
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( ti990_hd );
DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( ti990_hd );
- template <typename T> void set_memory_space(T &&tag, int spacenum) { m_memory_space.set_tag(std::forward<T>(tag), spacenum); }
auto int_cb() { return m_interrupt_callback.bind(); }
protected:
@@ -73,8 +72,6 @@ private:
uint16_t m_w[8];
- required_address_space m_memory_space;
-
devcb_write_line m_interrupt_callback;
hd_unit_t m_d[MAX_DISK_UNIT];
diff --git a/src/devices/bus/ti99x/990_tap.cpp b/src/devices/bus/ti99x/990_tap.cpp
index cafefbffda8..db41dc94c2b 100644
--- a/src/devices/bus/ti99x/990_tap.cpp
+++ b/src/devices/bus/ti99x/990_tap.cpp
@@ -257,7 +257,7 @@ void tap_990_device::cmd_read_binary_forward()
/* DMA */
for (i=0; i<bytes_read; i+=2)
{
- m_memory_space->write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]);
+ machine().device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]);
dma_address = (dma_address + 2) & 0x1ffffe;
}
@@ -956,13 +956,14 @@ void ti990_tape_image_device::call_unload()
tpc->set_tape(tape_get_id(), this, false, false, true);
}
+#define MCFG_TI990_TAPE_ADD(_tag) \
+ MCFG_DEVICE_ADD((_tag), TI990_TAPE, 0)
+
DEFINE_DEVICE_TYPE(TI990_TAPE_CTRL, tap_990_device, "ti990_tap", "Generic TI-900 Tape Controller")
tap_990_device::tap_990_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TI990_TAPE_CTRL, tag, owner, clock)
- , m_memory_space(*this, finder_base::DUMMY_TAG, -1)
- , m_int_line(*this)
+ : device_t(mconfig, TI990_TAPE_CTRL, tag, owner, clock), m_int_line(*this)
{
}
@@ -986,10 +987,9 @@ void tap_990_device::device_start()
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void tap_990_device::device_add_mconfig(machine_config &config)
-{
- TI990_TAPE(config, "tape0", 0);
- TI990_TAPE(config, "tape1", 0);
- TI990_TAPE(config, "tape2", 0);
- TI990_TAPE(config, "tape3", 0);
-}
+MACHINE_CONFIG_START(tap_990_device::device_add_mconfig)
+ MCFG_TI990_TAPE_ADD("tape0")
+ MCFG_TI990_TAPE_ADD("tape1")
+ MCFG_TI990_TAPE_ADD("tape2")
+ MCFG_TI990_TAPE_ADD("tape3")
+MACHINE_CONFIG_END
diff --git a/src/devices/bus/ti99x/990_tap.h b/src/devices/bus/ti99x/990_tap.h
index 3be370a9f5a..a35a09b26a4 100644
--- a/src/devices/bus/ti99x/990_tap.h
+++ b/src/devices/bus/ti99x/990_tap.h
@@ -26,7 +26,6 @@ public:
m_tape[id].wp = wp;
}
- template <typename T> void set_memory_space(T &&tag, int spacenum) { m_memory_space.set_tag(std::forward<T>(tag), spacenum); }
auto int_cb() { return m_int_line.bind(); }
protected:
@@ -55,8 +54,6 @@ private:
void read_transport_status();
void execute_command();
- required_address_space m_memory_space;
-
devcb_write_line m_int_line;
uint16_t m_w[8];
diff --git a/src/devices/bus/tiki100/8088.cpp b/src/devices/bus/tiki100/8088.cpp
index 0a940fcbc2c..f3a0e5d0dfd 100644
--- a/src/devices/bus/tiki100/8088.cpp
+++ b/src/devices/bus/tiki100/8088.cpp
@@ -64,15 +64,14 @@ void tiki100_8088_device::i8088_io(address_map &map)
//-------------------------------------------------
-// device_add_mconfig()
+// MACHINE_CONFIG_START( tiki100_8088 )
//-------------------------------------------------
-void tiki100_8088_device::device_add_mconfig(machine_config &config)
-{
- I8088(config, m_maincpu, 6000000);
- m_maincpu->set_addrmap(AS_PROGRAM, &tiki100_8088_device::i8088_mem);
- m_maincpu->set_addrmap(AS_IO, &tiki100_8088_device::i8088_io);
-}
+MACHINE_CONFIG_START(tiki100_8088_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(I8088_TAG, I8088, 6000000)
+ MCFG_DEVICE_PROGRAM_MAP(i8088_mem)
+ MCFG_DEVICE_IO_MAP(i8088_io)
+MACHINE_CONFIG_END
@@ -118,7 +117,7 @@ void tiki100_8088_device::device_reset()
// tiki100bus_iorq_r - I/O read
//-------------------------------------------------
-uint8_t tiki100_8088_device::iorq_r(offs_t offset, uint8_t data)
+uint8_t tiki100_8088_device::iorq_r(address_space &space, offs_t offset, uint8_t data)
{
if ((offset & 0xff) == 0x7f)
{
@@ -133,7 +132,7 @@ uint8_t tiki100_8088_device::iorq_r(offs_t offset, uint8_t data)
// tiki100bus_iorq_w - I/O write
//-------------------------------------------------
-void tiki100_8088_device::iorq_w(offs_t offset, uint8_t data)
+void tiki100_8088_device::iorq_w(address_space &space, offs_t offset, uint8_t data)
{
if ((offset & 0xff) == 0x7f)
{
diff --git a/src/devices/bus/tiki100/8088.h b/src/devices/bus/tiki100/8088.h
index 2e4e6966172..c9fcca86807 100644
--- a/src/devices/bus/tiki100/8088.h
+++ b/src/devices/bus/tiki100/8088.h
@@ -37,8 +37,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_tiki100bus_card_interface overrides
- virtual uint8_t iorq_r(offs_t offset, uint8_t data) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t iorq_r(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void iorq_w(address_space &space, offs_t offset, uint8_t data) override;
private:
required_device<i8088_cpu_device> m_maincpu;
diff --git a/src/devices/bus/tiki100/exp.cpp b/src/devices/bus/tiki100/exp.cpp
index 2d3dfc22031..95aff70d106 100644
--- a/src/devices/bus/tiki100/exp.cpp
+++ b/src/devices/bus/tiki100/exp.cpp
@@ -99,13 +99,13 @@ void tiki100_bus_device::add_card(device_tiki100bus_card_interface *card)
// mrq_r - memory read
//-------------------------------------------------
-uint8_t tiki100_bus_device::mrq_r(offs_t offset, uint8_t data, bool &mdis)
+uint8_t tiki100_bus_device::mrq_r(address_space &space, offs_t offset, uint8_t data, bool &mdis)
{
device_tiki100bus_card_interface *entry = m_device_list.first();
while (entry)
{
- data &= entry->mrq_r(offset, data, mdis);
+ data &= entry->mrq_r(space, offset, data, mdis);
entry = entry->next();
}
@@ -117,13 +117,13 @@ uint8_t tiki100_bus_device::mrq_r(offs_t offset, uint8_t data, bool &mdis)
// mrq_w - memory write
//-------------------------------------------------
-void tiki100_bus_device::mrq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( tiki100_bus_device::mrq_w )
{
device_tiki100bus_card_interface *entry = m_device_list.first();
while (entry)
{
- entry->mrq_w(offset, data);
+ entry->mrq_w(space, offset, data);
entry = entry->next();
}
}
@@ -133,13 +133,13 @@ void tiki100_bus_device::mrq_w(offs_t offset, uint8_t data)
// iorq_r - I/O read
//-------------------------------------------------
-uint8_t tiki100_bus_device::iorq_r(offs_t offset, uint8_t data)
+uint8_t tiki100_bus_device::iorq_r(address_space &space, offs_t offset, uint8_t data)
{
device_tiki100bus_card_interface *entry = m_device_list.first();
while (entry)
{
- data &= entry->iorq_r(offset, data);
+ data &= entry->iorq_r(space, offset, data);
entry = entry->next();
}
@@ -151,13 +151,13 @@ uint8_t tiki100_bus_device::iorq_r(offs_t offset, uint8_t data)
// iorq_w - I/O write
//-------------------------------------------------
-void tiki100_bus_device::iorq_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( tiki100_bus_device::iorq_w )
{
device_tiki100bus_card_interface *entry = m_device_list.first();
while (entry)
{
- entry->iorq_w(offset, data);
+ entry->iorq_w(space, offset, data);
entry = entry->next();
}
}
diff --git a/src/devices/bus/tiki100/exp.h b/src/devices/bus/tiki100/exp.h
index 9b0375daaa9..fb82a62fdce 100644
--- a/src/devices/bus/tiki100/exp.h
+++ b/src/devices/bus/tiki100/exp.h
@@ -25,6 +25,36 @@
#define TIKI100_BUS_TAG "tiki100bus"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_TIKI100_BUS_ADD() \
+ MCFG_DEVICE_ADD(TIKI100_BUS_TAG, TIKI100_BUS, 0)
+
+#define MCFG_TIKI100_BUS_SLOT_ADD(_tag, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, TIKI100_BUS_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(tiki100_cards, _def_slot, false)
+
+
+#define MCFG_TIKI100_BUS_IRQ_CALLBACK(_write) \
+ downcast<tiki100_bus_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
+
+#define MCFG_TIKI100_BUS_NMI_CALLBACK(_write) \
+ downcast<tiki100_bus_device &>(*device).set_nmi_wr_callback(DEVCB_##_write);
+
+#define MCFG_TIKI100_BUS_BUSRQ_CALLBACK(_write) \
+ downcast<tiki100_bus_device &>(*device).set_busrq_wr_callback(DEVCB_##_write);
+
+#define MCFG_TIKI100_BUS_IN_MREQ_CALLBACK(_read) \
+ downcast<tiki100_bus_device &>(*device).set_mrq_rd_callback(DEVCB_##_read);
+
+#define MCFG_TIKI100_BUS_OUT_MREQ_CALLBACK(_write) \
+ downcast<tiki100_bus_device &>(*device).set_mrq_wr_callback(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -46,12 +76,12 @@ public:
device_tiki100bus_card_interface *next() const { return m_next; }
// memory access
- virtual uint8_t mrq_r(offs_t offset, uint8_t data, bool &mdis) { mdis = 1; return data; }
- virtual void mrq_w(offs_t offset, uint8_t data) { }
+ virtual uint8_t mrq_r(address_space &space, offs_t offset, uint8_t data, bool &mdis) { mdis = 1; return data; }
+ virtual void mrq_w(address_space &space, offs_t offset, uint8_t data) { }
// I/O access
- virtual uint8_t iorq_r(offs_t offset, uint8_t data) { return data; }
- virtual void iorq_w(offs_t offset, uint8_t data) { }
+ virtual uint8_t iorq_r(address_space &space, offs_t offset, uint8_t data) { return data; }
+ virtual void iorq_w(address_space &space, offs_t offset, uint8_t data) { }
virtual void busak_w(int state) { m_busak = state; }
@@ -81,17 +111,7 @@ class tiki100_bus_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- tiki100_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
- : tiki100_bus_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- tiki100_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ tiki100_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
@@ -122,20 +142,20 @@ public:
tiki100_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
~tiki100_bus_device() { m_device_list.detach_all(); }
- auto irq_wr_callback() { return m_irq_cb.bind(); }
- auto nmi_wr_callback() { return m_nmi_cb.bind(); }
- auto busrq_wr_callback() { return m_busrq_cb.bind(); }
- auto mrq_rd_callback() { return m_in_mrq_cb.bind(); }
- auto mrq_wr_callback() { return m_out_mrq_cb.bind(); }
+ template <class Object> devcb_base &set_irq_wr_callback(Object &&cb) { return m_irq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_nmi_wr_callback(Object &&cb) { return m_nmi_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_busrq_wr_callback(Object &&cb) { return m_busrq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_mrq_rd_callback(Object &&cb) { return m_in_mrq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_mrq_wr_callback(Object &&cb) { return m_out_mrq_cb.set_callback(std::forward<Object>(cb)); }
void add_card(device_tiki100bus_card_interface *card);
// computer interface
- uint8_t mrq_r(offs_t offset, uint8_t data, bool &mdis);
- void mrq_w(offs_t offset, uint8_t data);
+ uint8_t mrq_r(address_space &space, offs_t offset, uint8_t data, bool &mdis);
+ DECLARE_WRITE8_MEMBER( mrq_w );
- uint8_t iorq_r(offs_t offset, uint8_t data);
- void iorq_w(offs_t offset, uint8_t data);
+ uint8_t iorq_r(address_space &space, offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER( iorq_w );
DECLARE_WRITE_LINE_MEMBER( busak_w );
@@ -143,8 +163,8 @@ public:
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_cb(state); }
DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_cb(state); }
DECLARE_WRITE_LINE_MEMBER( busrq_w ) { m_busrq_cb(state); }
- uint8_t exin_mrq_r(offs_t offset) { return m_in_mrq_cb(offset); }
- void exin_mrq_w(offs_t offset, uint8_t data) { m_out_mrq_cb(offset, data); }
+ DECLARE_READ8_MEMBER( exin_mrq_r ) { return m_in_mrq_cb(offset); }
+ DECLARE_WRITE8_MEMBER( exin_mrq_w ) { m_out_mrq_cb(offset, data); }
protected:
// device-level overrides
diff --git a/src/devices/bus/tiki100/hdc.cpp b/src/devices/bus/tiki100/hdc.cpp
index a351d83daca..9a997119935 100644
--- a/src/devices/bus/tiki100/hdc.cpp
+++ b/src/devices/bus/tiki100/hdc.cpp
@@ -85,11 +85,11 @@ void tiki100_hdc_device::device_reset()
// tiki100bus_iorq_r - I/O read
//-------------------------------------------------
-uint8_t tiki100_hdc_device::iorq_r(offs_t offset, uint8_t data)
+uint8_t tiki100_hdc_device::iorq_r(address_space &space, offs_t offset, uint8_t data)
{
if ((offset & 0xf8) == 0x20)
{
- data = m_hdc->read(offset & 0x07);
+ data = m_hdc->read(space, offset & 0x07);
}
return data;
@@ -100,10 +100,10 @@ uint8_t tiki100_hdc_device::iorq_r(offs_t offset, uint8_t data)
// tiki100bus_iorq_w - I/O write
//-------------------------------------------------
-void tiki100_hdc_device::iorq_w(offs_t offset, uint8_t data)
+void tiki100_hdc_device::iorq_w(address_space &space, offs_t offset, uint8_t data)
{
if ((offset & 0xf8) == 0x20)
{
- m_hdc->write(offset, data);
+ m_hdc->write(space, offset, data);
}
}
diff --git a/src/devices/bus/tiki100/hdc.h b/src/devices/bus/tiki100/hdc.h
index d38927ff004..1c0447acff5 100644
--- a/src/devices/bus/tiki100/hdc.h
+++ b/src/devices/bus/tiki100/hdc.h
@@ -36,8 +36,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_tiki100bus_card_interface overrides
- virtual uint8_t iorq_r(offs_t offset, uint8_t data) override;
- virtual void iorq_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t iorq_r(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void iorq_w(address_space &space, offs_t offset, uint8_t data) override;
private:
required_device<wd2010_device> m_hdc;
diff --git a/src/devices/bus/tmc600/euro.h b/src/devices/bus/tmc600/euro.h
index 51a4e435f2f..7fe8c3c0ff6 100644
--- a/src/devices/bus/tmc600/euro.h
+++ b/src/devices/bus/tmc600/euro.h
@@ -56,6 +56,17 @@
#define TMC600_EURO_BUS_TAG "bus"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_TMC600_EURO_BUS_SLOT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, TMC600_EURO_BUS_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -85,17 +96,7 @@ class tmc600_euro_bus_slot_t : public device_t,
{
public:
// construction/destruction
- template <typename T>
- tmc600_euro_bus_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
- : tmc600_euro_bus_slot_t(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- tmc600_euro_bus_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ tmc600_euro_bus_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// device-level overrides
diff --git a/src/devices/bus/tvc/tvc.h b/src/devices/bus/tvc/tvc.h
index 09ba7b35ffd..584e121f428 100644
--- a/src/devices/bus/tvc/tvc.h
+++ b/src/devices/bus/tvc/tvc.h
@@ -91,21 +91,11 @@ class tvcexp_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- tvcexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
- : tvcexp_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- tvcexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ tvcexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~tvcexp_slot_device();
- auto out_irq_callback() { return m_out_irq_cb.bind(); }
- auto out_nmi_callback() { return m_out_nmi_cb.bind(); }
+ template <class Object> devcb_base &set_out_irq_callback(Object &&cb) { return m_out_irq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_nmi_callback(Object &&cb) { return m_out_nmi_cb.set_callback(std::forward<Object>(cb)); }
// reading and writing
virtual uint8_t id_r();
@@ -130,4 +120,14 @@ protected:
DECLARE_DEVICE_TYPE(TVCEXP_SLOT, tvcexp_slot_device)
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_TVCEXP_SLOT_OUT_IRQ_CB(_devcb) \
+ downcast<tvcexp_slot_device &>(*device).set_out_irq_callback(DEVCB_##_devcb);
+
+#define MCFG_TVCEXP_SLOT_OUT_NMI_CB(_devcb) \
+ downcast<tvcexp_slot_device &>(*device).set_out_nmi_callback(DEVCB_##_devcb);
+
#endif // MAME_BUS_TVC_TVC_H
diff --git a/src/devices/bus/uts_kbd/400kbd.cpp b/src/devices/bus/uts_kbd/400kbd.cpp
deleted file mode 100644
index 38d35fda607..00000000000
--- a/src/devices/bus/uts_kbd/400kbd.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- Sperry Univac UTS 400-Format Keyboard
-
- This was called the "400-Mode Keyboard" in the 1981 UTS 20 Single
- Station Operator's Guide. The 1983 System Description also describes a
- Katakana/English Keyboard with a similar but not identical layout.
-
- Of this keyboard's 113 keys, several have no function on the UTS 20,
- though all but the modifier keys produce codes. It is totally
- incompatible with the UTS 10, which fails to properly recognize codes
- corresponding to the top two rows of the alphanumeric layout.
-
- The presently dumped unit, a 1984 Keytronic product, was obtained with
- many extra functions labeled (and some incompletely erased) on the tops
- and sides of the keys, and also identifies the punctuation keys in a
- way that disagrees with emulated behavior of the UTS 20. The port names
- are therefore mostly based on those described in UTS 20 manuals, except
- for two keys which are apparently normally blank.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "bus/uts_kbd/400kbd.h"
-
-#include "cpu/mcs48/mcs48.h"
-
-
-DEFINE_DEVICE_TYPE(UTS_400_KEYBOARD, uts_400_keyboard_device, "uts_400kbd", "UTS 400-Format Keyboard (F3621-04-000)")
-
-uts_400_keyboard_device::uts_400_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, UTS_400_KEYBOARD, tag, owner, clock)
- , device_uts_keyboard_interface(mconfig, *this)
- , m_keys(*this, "KEY%X", 0U)
- , m_shift_led(*this, "shift_led")
- , m_p2_output(0xff)
- , m_input_select(0)
- , m_ready_line(true)
- , m_prog_line(true)
-{
-}
-
-void uts_400_keyboard_device::device_start()
-{
- m_shift_led.resolve();
-
- save_item(NAME(m_p2_output));
- save_item(NAME(m_input_select));
- save_item(NAME(m_ready_line));
- save_item(NAME(m_prog_line));
-}
-
-WRITE_LINE_MEMBER(uts_400_keyboard_device::ready_w)
-{
- m_ready_line = bool(state);
-}
-
-u8 uts_400_keyboard_device::bus_r()
-{
- return m_keys[m_input_select]->read();
-}
-
-void uts_400_keyboard_device::p1_w(u8 data)
-{
- write_rxd(BIT(data, 1));
- m_shift_led = BIT(data, 4);
-
- // P10 = hysteresis control?
- // P12 = duplicate of P11?
-}
-
-void uts_400_keyboard_device::p2_w(u8 data)
-{
- // P22 = ? (lowered and strobed with RD after key is transmitted)
- m_p2_output = data;
-}
-
-READ_LINE_MEMBER(uts_400_keyboard_device::t1_r)
-{
- return m_ready_line;
-}
-
-WRITE_LINE_MEMBER(uts_400_keyboard_device::prog_w)
-{
- if (!m_prog_line && state)
- m_input_select = m_p2_output & 0x0f;
-
- m_prog_line = bool(state);
-}
-
-static INPUT_PORTS_START(uts_400kbd)
- PORT_START("KEY0")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CHAR(UCHAR_SHIFT_1) PORT_CODE(KEYCODE_LSHIFT)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_CODE(KEYCODE_CAPSLOCK)
- PORT_BIT(0x78, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Upper Function") PORT_CHAR(UCHAR_SHIFT_2) PORT_CODE(KEYCODE_LCONTROL)
-
- PORT_START("KEY1")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space")
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(';') PORT_CHAR('+') PORT_CODE(KEYCODE_COLON)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(':') PORT_CHAR('*') PORT_CODE(KEYCODE_QUOTE)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('o') PORT_CHAR('O') PORT_CODE(KEYCODE_O)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('p') PORT_CHAR('P') PORT_CODE(KEYCODE_P)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('9') PORT_CHAR(')') PORT_CODE(KEYCODE_9)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('0') PORT_CODE(KEYCODE_0)
-
- PORT_START("KEY2")
- PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(']') PORT_CHAR('}') PORT_CODE(KEYCODE_CLOSEBRACE)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CHAR(0x0d) PORT_CODE(KEYCODE_ENTER)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('`') PORT_CHAR('@') PORT_CODE(KEYCODE_EQUALS)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('[') PORT_CHAR('{') PORT_CODE(KEYCODE_OPENBRACE)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('-') PORT_CHAR('=') PORT_CODE(KEYCODE_MINUS)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('^') PORT_CHAR('~') PORT_CODE(KEYCODE_TILDE)
-
- PORT_START("KEY3")
- PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('_') PORT_CODE(KEYCODE_RCONTROL)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) PORT_CODE(KEYCODE_7_PAD)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('\\') PORT_CHAR('|') PORT_CODE(KEYCODE_BACKSLASH)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Back Space") PORT_CHAR(0x08) PORT_CODE(KEYCODE_BACKSPACE)
-
- PORT_START("KEY4")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_CODE(KEYCODE_1_PAD)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_CODE(KEYCODE_2_PAD)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_CODE(KEYCODE_4_PAD)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) PORT_CODE(KEYCODE_5_PAD)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_CODE(KEYCODE_8_PAD)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) PORT_CODE(KEYCODE_9_PAD)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_CODE(KEYCODE_PLUS_PAD)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) PORT_CODE(KEYCODE_MINUS_PAD)
-
- PORT_START("KEY5")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) PORT_CODE(KEYCODE_3_PAD)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab Back") PORT_CODE(KEYCODE_LALT)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_CODE(KEYCODE_6_PAD)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space Bar") PORT_CHAR(' ') PORT_CODE(KEYCODE_SPACE)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab Fwd") PORT_CHAR(0x09) PORT_CODE(KEYCODE_RALT)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) PORT_CODE(KEYCODE_0_PAD)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) PORT_CODE(KEYCODE_DEL_PAD)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Print")
-
- PORT_START("KEY6")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Xmit")
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keyboard Unlock")
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control Page") PORT_CODE(KEYCODE_F10)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Xfer")
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Msg Wait FCC Generate") PORT_CODE(KEYCODE_F9)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Status FCC Reenable") PORT_CODE(KEYCODE_F8)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Search FCC Clear") PORT_CODE(KEYCODE_F7)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rep Adr FCC Locate") PORT_CODE(KEYCODE_F6)
-
- PORT_START("KEY7")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Help)")
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F13 F22")
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F11 F20")
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F12 F21")
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F10 F19")
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F9 F18")
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F8 F17")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F7 F16")
-
- PORT_START("KEY8")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6 F15")
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5 F14")
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Xchg " UTF8_DOWN " Xchg " UTF8_UP ")")
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Disp 1-2")
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Hang Up")
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ws Mode Sys Mode")
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Insert in Dis Line Dup")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete in Dis Erase Dis")
-
- PORT_START("KEY9")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BOB Clr Chg") PORT_CODE(KEYCODE_F5)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FF F4") PORT_CODE(KEYCODE_F4)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LF F3") PORT_CODE(KEYCODE_F3)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab Set F2") PORT_CODE(KEYCODE_F2)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Erase to EOF F1") PORT_CODE(KEYCODE_F1)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Erase to EOL Erase to EOD")
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Insert in Line Insert Line") PORT_CHAR(UCHAR_MAMEKEY(INSERT))
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete in Line Delete Line") PORT_CHAR(UCHAR_MAMEKEY(DEL))
-
- PORT_START("KEYA")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('z') PORT_CHAR('Z') PORT_CODE(KEYCODE_Z)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('x') PORT_CHAR('X') PORT_CODE(KEYCODE_X)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor to Home") PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CODE(KEYCODE_HOME)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('a') PORT_CHAR('A') PORT_CODE(KEYCODE_A)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Cursor \xe2\x86\x99)") // ↙
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Back Space") PORT_CODE(KEYCODE_TAB)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SOE \xe2\x96\xb6") // â–¶
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Erase Char") PORT_CODE(KEYCODE_ESC)
-
- PORT_START("KEYB")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('c') PORT_CHAR('C') PORT_CODE(KEYCODE_C)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('v') PORT_CHAR('V') PORT_CODE(KEYCODE_V)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('s') PORT_CHAR('S') PORT_CODE(KEYCODE_S)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('d') PORT_CHAR('D') PORT_CODE(KEYCODE_D)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('q') PORT_CHAR('Q') PORT_CODE(KEYCODE_Q)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('w') PORT_CHAR('W') PORT_CODE(KEYCODE_W)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('1') PORT_CHAR('!') PORT_CODE(KEYCODE_1)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('2') PORT_CHAR('"') PORT_CODE(KEYCODE_2)
-
- PORT_START("KEYC")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('b') PORT_CHAR('B') PORT_CODE(KEYCODE_B)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('n') PORT_CHAR('N') PORT_CODE(KEYCODE_N)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('f') PORT_CHAR('F') PORT_CODE(KEYCODE_F)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('g') PORT_CHAR('G') PORT_CODE(KEYCODE_G)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('e') PORT_CHAR('E') PORT_CODE(KEYCODE_E)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('r') PORT_CHAR('R') PORT_CODE(KEYCODE_R)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('3') PORT_CHAR('#') PORT_CODE(KEYCODE_3)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('4') PORT_CHAR('$') PORT_CODE(KEYCODE_4)
-
- PORT_START("KEYD")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('m') PORT_CHAR('M') PORT_CODE(KEYCODE_M)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(',') PORT_CHAR('<') PORT_CODE(KEYCODE_COMMA)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('h') PORT_CHAR('H') PORT_CODE(KEYCODE_H)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('j') PORT_CHAR('J') PORT_CODE(KEYCODE_J)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('t') PORT_CHAR('T') PORT_CODE(KEYCODE_T)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('y') PORT_CHAR('Y') PORT_CODE(KEYCODE_Y)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('5') PORT_CHAR('%') PORT_CODE(KEYCODE_5)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('6') PORT_CHAR('&') PORT_CODE(KEYCODE_6)
-
- PORT_START("KEYE")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('.') PORT_CHAR('>') PORT_CODE(KEYCODE_STOP)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('/') PORT_CHAR('?') PORT_CODE(KEYCODE_SLASH)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('k') PORT_CHAR('K') PORT_CODE(KEYCODE_K)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('l') PORT_CHAR('L') PORT_CODE(KEYCODE_L)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('u') PORT_CHAR('U') PORT_CODE(KEYCODE_U)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('i') PORT_CHAR('I') PORT_CODE(KEYCODE_I)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('7') PORT_CHAR('\'') PORT_CODE(KEYCODE_7)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('8') PORT_CHAR('(') PORT_CODE(KEYCODE_8)
-
- PORT_START("KEYF")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CODE(KEYCODE_RIGHT)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CODE(KEYCODE_LEFT)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CODE(KEYCODE_DOWN)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CODE(KEYCODE_UP)
- PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED)
-INPUT_PORTS_END
-
-ioport_constructor uts_400_keyboard_device::device_input_ports() const
-{
- return INPUT_PORTS_NAME(uts_400kbd);
-}
-
-void uts_400_keyboard_device::ext_map(address_map &map)
-{
- map(0x00, 0xff).noprw(); // read as above; written only at reset time
-}
-
-void uts_400_keyboard_device::device_add_mconfig(machine_config &config)
-{
- mcs48_cpu_device &kbdc(I8048(config, "kbdc", 4.608_MHz_XTAL)); // SCN8048A
- // XTAL is marked "4608 / 300-007 / KSS39"
- kbdc.set_addrmap(AS_IO, &uts_400_keyboard_device::ext_map);
- kbdc.bus_in_cb().set(FUNC(uts_400_keyboard_device::bus_r));
- kbdc.p1_out_cb().set(FUNC(uts_400_keyboard_device::p1_w));
- kbdc.p2_out_cb().set(FUNC(uts_400_keyboard_device::p2_w));
- kbdc.t1_in_cb().set(FUNC(uts_400_keyboard_device::t1_r));
- kbdc.prog_out_cb().set(FUNC(uts_400_keyboard_device::prog_w));
-}
-
-ROM_START(uts_400kbd)
- ROM_REGION(0x400, "kbdc", 0)
- ROM_LOAD("sperry_20-8048-118.bin", 0x000, 0x400, CRC(ae54503e) SHA1(84081e108aa5801047851b435fd4b043922b2f6e))
-ROM_END
-
-const tiny_rom_entry *uts_400_keyboard_device::device_rom_region() const
-{
- return ROM_NAME(uts_400kbd);
-}
diff --git a/src/devices/bus/uts_kbd/400kbd.h b/src/devices/bus/uts_kbd/400kbd.h
deleted file mode 100644
index 8e73bc10dbd..00000000000
--- a/src/devices/bus/uts_kbd/400kbd.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-
-#ifndef MAME_BUS_UTS_KBD_400KBD_H
-#define MAME_BUS_UTS_KBD_400KBD_H
-
-#pragma once
-
-#include "bus/uts_kbd/uts_kbd.h"
-
-class uts_400_keyboard_device : public device_t, public device_uts_keyboard_interface
-{
-public:
- uts_400_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
-protected:
- virtual DECLARE_WRITE_LINE_MEMBER(ready_w) override;
-
- virtual ioport_constructor device_input_ports() const override;
- virtual void device_start() override;
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-
-private:
- u8 bus_r();
- void p1_w(u8 data);
- void p2_w(u8 data);
- DECLARE_READ_LINE_MEMBER(t1_r);
- DECLARE_WRITE_LINE_MEMBER(prog_w);
-
- void ext_map(address_map &map);
-
- required_ioport_array<16> m_keys;
- output_finder<> m_shift_led;
-
- u8 m_p2_output;
- u8 m_input_select;
- bool m_ready_line;
- bool m_prog_line;
-};
-
-DECLARE_DEVICE_TYPE(UTS_400_KEYBOARD, uts_400_keyboard_device)
-
-#endif // MAME_BUS_UTS_KBD_400KBD_H
diff --git a/src/devices/bus/uts_kbd/extw.cpp b/src/devices/bus/uts_kbd/extw.cpp
deleted file mode 100644
index 950d8b244f2..00000000000
--- a/src/devices/bus/uts_kbd/extw.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- Sperry Univac UTS Expanded Typewriter Keyboard
-
- This is the default keyboard for the UTS 10 and UTS 20, though the
- latter's manual claims that "SYS MODE" and "WS MODE" have no function.
-
- User beware: the - and / keys are swapped from their respective
- positions on most keyboards.
-
- The LED is located on the LOCK key, but also responds to either shift
- key being pressed (which also releases the shift lock).
-
- The keyboard controller is a custom 48-pin DIP marked:
-
- P60515
- L7340660
- 20-90039-000
- © INTEL '84
-
- This is likely a hybrid ASIC integrating a high-speed 8035-like core
- with at least one of the custom drivers/receivers present in other
- Keytronic keyboards.
-
- There seems to be a slight timing error in the transmit routine which
- causes data bits to be shifted out one 64th of a bit time too quickly.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "bus/uts_kbd/extw.h"
-
-#include "cpu/mcs48/mcs48.h"
-
-
-DEFINE_DEVICE_TYPE(UTS_EXTW_KEYBOARD, uts_extw_keyboard_device, "uts_extw", "UTS Expanded Typewriter Keyboard (F4725-25)")
-
-uts_extw_keyboard_device::uts_extw_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, UTS_EXTW_KEYBOARD, tag, owner, clock)
- , device_uts_keyboard_interface(mconfig, *this)
- , m_keys(*this, "KEY%X", 0U)
- , m_shift_led(*this, "shift_led")
- , m_p1_output(0xff)
- , m_p2_output(0xff)
- , m_shift_register(0xff)
- , m_ready_line(true)
- , m_prog_line(true)
-{
-}
-
-void uts_extw_keyboard_device::device_start()
-{
- m_shift_led.resolve();
-
- save_item(NAME(m_p1_output));
- save_item(NAME(m_p2_output));
- save_item(NAME(m_shift_register));
- save_item(NAME(m_ready_line));
- save_item(NAME(m_prog_line));
-}
-
-WRITE_LINE_MEMBER(uts_extw_keyboard_device::ready_w)
-{
- m_ready_line = bool(state);
-}
-
-u8 uts_extw_keyboard_device::p1_r()
-{
- return m_ready_line ? 0xf7 : 0xff;
-}
-
-void uts_extw_keyboard_device::p1_w(u8 data)
-{
- write_rxd(!BIT(data, 2));
-
- if (!BIT(m_p1_output, 0) && BIT(data, 0))
- m_shift_register = (m_shift_register >> 1) | (m_shift_register & 0x01) << 7;
-
- // P11 = hysteresis control?
-
- m_p1_output = data;
-}
-
-void uts_extw_keyboard_device::p2_w(u8 data)
-{
- m_shift_led = !BIT(data, 4);
- m_p2_output = data;
-}
-
-void uts_extw_keyboard_device::t0_clock(u32 clk)
-{
-}
-
-READ_LINE_MEMBER(uts_extw_keyboard_device::t1_r)
-{
- return BIT(m_shift_register, 7);
-}
-
-WRITE_LINE_MEMBER(uts_extw_keyboard_device::prog_w)
-{
- if (!m_prog_line && state)
- {
- u8 n = m_p2_output & 0x0f;
- m_shift_register = m_keys[n]->read();
- }
-
- m_prog_line = bool(state);
-}
-
-static INPUT_PORTS_START(uts_extw)
- PORT_START("KEY0")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E F15") PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(UCHAR_MAMEKEY(F15)) PORT_CODE(KEYCODE_E)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CODE(KEYCODE_3)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('2') PORT_CHAR('"') PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CODE(KEYCODE_2)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W F14") PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(UCHAR_MAMEKEY(F14)) PORT_CODE(KEYCODE_W)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CHAR('s') PORT_CHAR('S') PORT_CODE(KEYCODE_S)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CHAR('a') PORT_CHAR('A') PORT_CODE(KEYCODE_A)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CHAR('x') PORT_CHAR('X') PORT_CODE(KEYCODE_X)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CHAR('z') PORT_CHAR('Z') PORT_CODE(KEYCODE_Z)
-
- PORT_START("KEY1")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab Back") PORT_CODE(KEYCODE_RCONTROL) // ⇤
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(0x08) PORT_CODE(KEYCODE_BACKSPACE) // doesn't work on uts10?
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_CODE(KEYCODE_EQUALS)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ { Ws Mode") PORT_CHAR('[') PORT_CHAR('{') PORT_CODE(KEYCODE_CLOSEBRACE)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(']') PORT_CHAR('}') PORT_CODE(KEYCODE_BACKSLASH) // between : and return key
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(':') PORT_CHAR('*') PORT_CODE(KEYCODE_QUOTE)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(0x0d) PORT_CODE(KEYCODE_ENTER) // ↵
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT)
-
- PORT_START("KEY2")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \\ Sys Mode") PORT_CHAR('@') PORT_CHAR('\\') PORT_CODE(KEYCODE_OPENBRACE)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('/') PORT_CHAR('?') PORT_CHAR(UCHAR_MAMEKEY(F11)) PORT_CODE(KEYCODE_MINUS)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('0') PORT_CHAR('=') PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_CODE(KEYCODE_0)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P F22") PORT_CHAR('p') PORT_CHAR('P') PORT_CODE(KEYCODE_P)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(';') PORT_CHAR('+') PORT_CODE(KEYCODE_COLON)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", ,") PORT_CHAR(',') PORT_CODE(KEYCODE_COMMA)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('-') PORT_CHAR('_') PORT_CODE(KEYCODE_SLASH)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". .") PORT_CHAR('.') PORT_CODE(KEYCODE_STOP)
-
- PORT_START("KEY3")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U F19") PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(UCHAR_MAMEKEY(F19)) PORT_CODE(KEYCODE_U)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('7') PORT_CHAR('\'') PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CODE(KEYCODE_7)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('6') PORT_CHAR('&') PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_CODE(KEYCODE_6)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y F18") PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(UCHAR_MAMEKEY(F18)) PORT_CODE(KEYCODE_Y)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CHAR('h') PORT_CHAR('H') PORT_CODE(KEYCODE_H)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CHAR('g') PORT_CHAR('G') PORT_CODE(KEYCODE_G)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CHAR('n') PORT_CHAR('N') PORT_CODE(KEYCODE_N)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CHAR('b') PORT_CHAR('B') PORT_CODE(KEYCODE_B)
-
- PORT_START("KEY4")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SOE \xe2\x96\xb6 Tab Set") PORT_CODE(KEYCODE_LALT) // â–¶
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Insert in Line Insert in Disp") PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CODE(KEYCODE_INSERT)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete in Line Delete in Disp") PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CODE(KEYCODE_DEL)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor to Home") PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CODE(KEYCODE_HOME) // ↖
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CODE(KEYCODE_UP)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CODE(KEYCODE_LEFT)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CODE(KEYCODE_RIGHT)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CODE(KEYCODE_DOWN)
-
- PORT_START("KEY5")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) PORT_CODE(KEYCODE_5_PAD)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_CODE(KEYCODE_4_PAD)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) PORT_CODE(KEYCODE_7_PAD)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_CODE(KEYCODE_1_PAD)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_CODE(KEYCODE_2_PAD)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_CODE(KEYCODE_8_PAD)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) PORT_CODE(KEYCODE_0_PAD)
-
- PORT_START("KEY6")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_CODE(KEYCODE_PLUS_PAD)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_CODE(KEYCODE_6_PAD)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) PORT_CODE(KEYCODE_9_PAD)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) PORT_CODE(KEYCODE_3_PAD)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) PORT_CODE(KEYCODE_MINUS_PAD)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) PORT_CODE(KEYCODE_DEL_PAD)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(TAB_PAD)) PORT_CODE(KEYCODE_ENTER_PAD) // ⇥
-
- PORT_START("KEY7")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q F13") PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(UCHAR_MAMEKEY(F13)) PORT_CODE(KEYCODE_Q)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CODE(KEYCODE_1)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('|') PORT_CHAR('`') PORT_CODE(KEYCODE_TILDE)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab Forward") PORT_CHAR(0x09) PORT_CODE(KEYCODE_TAB) // ⇥
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Fctn") PORT_CHAR(UCHAR_SHIFT_2) PORT_CODE(KEYCODE_LCONTROL)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_CODE(KEYCODE_CAPSLOCK)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('<') PORT_CHAR('>') PORT_CODE(KEYCODE_BACKSLASH2)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CHAR(UCHAR_SHIFT_1) PORT_CODE(KEYCODE_LSHIFT)
-
- PORT_START("KEY8")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FF Disp 1-2") PORT_CODE(KEYCODE_F3)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clr Chg") PORT_CODE(KEYCODE_F4)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FCC Locate") PORT_CODE(KEYCODE_F5)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LF Hang Up") PORT_CODE(KEYCODE_F2)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line Dup") PORT_CODE(KEYCODE_F1)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete Line Insert Line") PORT_CODE(KEYCODE_ESC)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Erase EOL Erase EOD") PORT_CODE(KEYCODE_END)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Erase to EOF Erase Display") PORT_CODE(KEYCODE_PGDN)
-
- PORT_START("KEY9")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T F17") PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(UCHAR_MAMEKEY(F17)) PORT_CODE(KEYCODE_T)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CODE(KEYCODE_5)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CODE(KEYCODE_4)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R F16") PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(UCHAR_MAMEKEY(F16)) PORT_CODE(KEYCODE_R)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CHAR('f') PORT_CHAR('F') PORT_CODE(KEYCODE_F)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CHAR('d') PORT_CHAR('D') PORT_CODE(KEYCODE_D)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CHAR('v') PORT_CHAR('V') PORT_CODE(KEYCODE_V)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CHAR('c') PORT_CHAR('C') PORT_CODE(KEYCODE_C)
-
- PORT_START("KEYA")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Msg Wait Unlock") PORT_CODE(KEYCODE_F11)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FCC Clear") PORT_CODE(KEYCODE_F6)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Xmit") PORT_CODE(KEYCODE_F12)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Print Ctl Page") PORT_CODE(KEYCODE_F10)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FCC Gen") PORT_CODE(KEYCODE_F8)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FCC Enable") PORT_CODE(KEYCODE_F7)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Xfer Char Erase") PORT_CODE(KEYCODE_F9)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(' ') PORT_CODE(KEYCODE_SPACE)
-
- PORT_START("KEYB")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O F21") PORT_CHAR('o') PORT_CHAR('O') PORT_CODE(KEYCODE_O)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('9') PORT_CHAR(')') PORT_CHAR(UCHAR_MAMEKEY(F9)) PORT_CODE(KEYCODE_9)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('8') PORT_CHAR('(') PORT_CHAR(UCHAR_MAMEKEY(F8)) PORT_CODE(KEYCODE_8)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I F20") PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(UCHAR_MAMEKEY(F20)) PORT_CODE(KEYCODE_I)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CHAR('k') PORT_CHAR('K') PORT_CODE(KEYCODE_K)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CHAR('l') PORT_CHAR('L') PORT_CODE(KEYCODE_L)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CHAR('j') PORT_CHAR('J') PORT_CODE(KEYCODE_J)
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CHAR('m') PORT_CHAR('M') PORT_CODE(KEYCODE_M)
-
- PORT_START("KEYC")
- PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("KEYD")
- PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("KEYE")
- PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("KEYF")
- PORT_DIPNAME(0x0f, 0x0f, "National Layout") // stored as a 4-bit value even though only 7 of the first 8 are valid
- PORT_DIPSETTING(0x0f, "USA/UK English")
- PORT_DIPSETTING(0x0d, "German (QWERTZ)")
- PORT_DIPSETTING(0x0c, "European A")
- PORT_DIPSETTING(0x0b, "European B") // Swedish/Finnish?
- PORT_DIPSETTING(0x0a, "European C")
- PORT_DIPSETTING(0x09, "European D") // Spanish?
- PORT_DIPSETTING(0x08, "European E")
- PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED)
-INPUT_PORTS_END
-
-ioport_constructor uts_extw_keyboard_device::device_input_ports() const
-{
- return INPUT_PORTS_NAME(uts_extw);
-}
-
-void uts_extw_keyboard_device::prog_map(address_map &map)
-{
- map(0x000, 0x7ff).rom().region("kbdc", 0);
-}
-
-void uts_extw_keyboard_device::ext_map(address_map &map)
-{
- map(0x00, 0xff).nopr(); // read only once, at reset time
-}
-
-void uts_extw_keyboard_device::device_add_mconfig(machine_config &config)
-{
- mcs48_cpu_device &kbdc(I8035(config, "kbdc", 9.216_MHz_XTAL)); // not a standard 8035; see notes
- kbdc.set_addrmap(AS_PROGRAM, &uts_extw_keyboard_device::prog_map);
- kbdc.set_addrmap(AS_IO, &uts_extw_keyboard_device::ext_map);
- kbdc.p1_in_cb().set(FUNC(uts_extw_keyboard_device::p1_r));
- kbdc.p1_out_cb().set(FUNC(uts_extw_keyboard_device::p1_w));
- kbdc.p2_out_cb().set(FUNC(uts_extw_keyboard_device::p2_w));
- kbdc.set_t0_clk_cb(FUNC(uts_extw_keyboard_device::t0_clock));
- kbdc.t1_in_cb().set(FUNC(uts_extw_keyboard_device::t1_r));
- kbdc.prog_out_cb().set(FUNC(uts_extw_keyboard_device::prog_w));
-}
-
-ROM_START(uts_extw)
- ROM_REGION(0x800, "kbdc", 0)
- ROM_LOAD("2716264.bin", 0x000, 0x800, CRC(75e188aa) SHA1(a6486576525f7eec617fd7f9db469063f8c357fc)) // "© 1985 Keytronic"
-ROM_END
-
-const tiny_rom_entry *uts_extw_keyboard_device::device_rom_region() const
-{
- return ROM_NAME(uts_extw);
-}
diff --git a/src/devices/bus/uts_kbd/extw.h b/src/devices/bus/uts_kbd/extw.h
deleted file mode 100644
index 21599139ec1..00000000000
--- a/src/devices/bus/uts_kbd/extw.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-
-#ifndef MAME_BUS_UTS_KBD_EXTW_H
-#define MAME_BUS_UTS_KBD_EXTW_H
-
-#pragma once
-
-#include "bus/uts_kbd/uts_kbd.h"
-
-class uts_extw_keyboard_device : public device_t, public device_uts_keyboard_interface
-{
-public:
- uts_extw_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
-protected:
- virtual DECLARE_WRITE_LINE_MEMBER(ready_w) override;
-
- virtual ioport_constructor device_input_ports() const override;
- virtual void device_start() override;
- virtual void device_add_mconfig(machine_config &config) override;
- virtual const tiny_rom_entry *device_rom_region() const override;
-
-private:
- u8 p1_r();
- void p1_w(u8 data);
- void p2_w(u8 data);
- void t0_clock(u32 clk);
- DECLARE_READ_LINE_MEMBER(t1_r);
- DECLARE_WRITE_LINE_MEMBER(prog_w);
-
- void prog_map(address_map &map);
- void ext_map(address_map &map);
-
- required_ioport_array<16> m_keys;
- output_finder<> m_shift_led;
-
- u8 m_p1_output;
- u8 m_p2_output;
- u8 m_shift_register;
- bool m_ready_line;
- bool m_prog_line;
-};
-
-DECLARE_DEVICE_TYPE(UTS_EXTW_KEYBOARD, uts_extw_keyboard_device)
-
-#endif // MAME_BUS_UTS_KBD_EXTW_H
diff --git a/src/devices/bus/uts_kbd/uts_kbd.cpp b/src/devices/bus/uts_kbd/uts_kbd.cpp
deleted file mode 100644
index d652dbfca80..00000000000
--- a/src/devices/bus/uts_kbd/uts_kbd.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- Sperry Univac UTS series keyboard port
-
- The UTS 20 System Description presents four types of keyboards that
- may be connected to the terminal as auxiliary input devices:
- - Typewriter Keyboard
- - Expanded Typewriter Keyboard
- - Katakana/English Keyboard
- - UTS 400-Format Keyboard
-
- A Magnetic Stripe Reader which can read ABA or IATA data is another
- device which can be connected to the keyboard input. This apparently
- includes a pass-through keyboard connector.
-
- Keyboard input is transmitted serially at 9600 baud, using 8 data bits,
- 1 stop bit and odd parity. A two-byte sequence is sent for each key,
- with the (non-ASCII) keycode being contained in the second byte. The
- only other active line appears to be a ready signal (assumed to be
- active high), which the terminal drives to synchronize transmissions.
- This might even be a single line driven bidirectionally. There appear
- to be at most four wires attached to the DE-9 connector.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "bus/uts_kbd/uts_kbd.h"
-
-#include "bus/uts_kbd/extw.h"
-#include "bus/uts_kbd/400kbd.h"
-
-//**************************************************************************
-// UTS KEYBOARD PORT DEVICE
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(UTS_KEYBOARD, uts_keyboard_port_device, "uts_kbd", "UTS Keyboard Port")
-
-uts_keyboard_port_device::uts_keyboard_port_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, UTS_KEYBOARD, tag, owner, clock)
- , device_slot_interface(mconfig, *this)
- , m_rxd_callback(*this)
- , m_kbd(nullptr)
-{
-}
-
-void uts_keyboard_port_device::device_config_complete()
-{
- m_kbd = dynamic_cast<device_uts_keyboard_interface *>(get_card_device());
-}
-
-void uts_keyboard_port_device::device_resolve_objects()
-{
- m_rxd_callback.resolve_safe();
-}
-
-void uts_keyboard_port_device::device_start()
-{
-}
-
-//**************************************************************************
-// UTS KEYBOARD INTERFACE
-//**************************************************************************
-
-device_uts_keyboard_interface::device_uts_keyboard_interface(const machine_config &mconfig, device_t &device)
- : device_slot_card_interface(mconfig, device)
- , m_port(device, DEVICE_SELF_OWNER)
-{
-}
-
-device_uts_keyboard_interface::~device_uts_keyboard_interface()
-{
-}
-
-//**************************************************************************
-// KEYBOARD OPTIONS
-//**************************************************************************
-
-void uts10_keyboards(device_slot_interface &slot)
-{
- slot.option_add("extw", UTS_EXTW_KEYBOARD);
-}
-
-void uts20_keyboards(device_slot_interface &slot)
-{
- uts10_keyboards(slot);
- slot.option_add("uts400", UTS_400_KEYBOARD);
-}
diff --git a/src/devices/bus/uts_kbd/uts_kbd.h b/src/devices/bus/uts_kbd/uts_kbd.h
deleted file mode 100644
index 7cfff95c0fe..00000000000
--- a/src/devices/bus/uts_kbd/uts_kbd.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- Sperry Univac UTS series keyboard port
-
-***************************************************************************/
-
-#ifndef MAME_BUS_UTS_KBD_UTS_KBD_H
-#define MAME_BUS_UTS_KBD_UTS_KBD_H
-
-#pragma once
-
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// forward declaration
-class device_uts_keyboard_interface;
-
-// ======================> uts_keyboard_port_device
-
-class uts_keyboard_port_device : public device_t, public device_slot_interface
-{
- friend class device_uts_keyboard_interface;
-
-public:
- // construction/destruction
- uts_keyboard_port_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
- template <typename T>
- uts_keyboard_port_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
- : uts_keyboard_port_device(mconfig, tag, owner, 0U)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- // configuration
- auto rxd_callback() { return m_rxd_callback.bind(); }
-
- // line handler
- inline DECLARE_WRITE_LINE_MEMBER(ready_w);
-
-protected:
- // device-level overrides
- virtual void device_config_complete() override;
- virtual void device_resolve_objects() override;
- virtual void device_start() override;
-
- // called from keyboard
- DECLARE_WRITE_LINE_MEMBER(write_rxd) { m_rxd_callback(state); }
-
-private:
- // user callback
- devcb_write_line m_rxd_callback;
-
- // selected keyboard
- device_uts_keyboard_interface *m_kbd;
-};
-
-// ======================> device_uts_keyboard_interface
-
-class device_uts_keyboard_interface : public device_slot_card_interface
-{
- friend class uts_keyboard_port_device;
-
-protected:
- // construction/destruction
- device_uts_keyboard_interface(const machine_config &mconfig, device_t &device);
- virtual ~device_uts_keyboard_interface();
-
- DECLARE_WRITE_LINE_MEMBER(write_rxd) { m_port->write_rxd(state); }
-
- virtual DECLARE_WRITE_LINE_MEMBER(ready_w) = 0;
-
-private:
- // parent port
- required_device<uts_keyboard_port_device> m_port;
-};
-
-// type definition
-DECLARE_DEVICE_TYPE(UTS_KEYBOARD, uts_keyboard_port_device)
-
-// standard options
-extern void uts20_keyboards(device_slot_interface &slot);
-extern void uts10_keyboards(device_slot_interface &slot);
-
-//**************************************************************************
-// INLINE FUNCTIONS
-//**************************************************************************
-
-WRITE_LINE_MEMBER(uts_keyboard_port_device::ready_w)
-{
- if (m_kbd != nullptr)
- m_kbd->ready_w(state);
-}
-
-#endif // MAME_BUS_UTS_KBD_UTS_KBD_H
diff --git a/src/devices/bus/vboy/slot.h b/src/devices/bus/vboy/slot.h
index 547f09b8523..a81efa07519 100644
--- a/src/devices/bus/vboy/slot.h
+++ b/src/devices/bus/vboy/slot.h
@@ -62,16 +62,7 @@ class vboy_cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- vboy_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : vboy_cart_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- vboy_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ vboy_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~vboy_cart_slot_device();
// image-level overrides
@@ -119,4 +110,8 @@ DECLARE_DEVICE_TYPE(VBOY_CART_SLOT, vboy_cart_slot_device)
#define VBOYSLOT_ROM_REGION_TAG ":cart:rom"
+#define MCFG_VBOY_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, VBOY_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
#endif // MAME_BUS_VBOY_SLOT_H
diff --git a/src/devices/bus/vc4000/rom.cpp b/src/devices/bus/vc4000/rom.cpp
index ffd9a21ffb5..0e41b2638ed 100644
--- a/src/devices/bus/vc4000/rom.cpp
+++ b/src/devices/bus/vc4000/rom.cpp
@@ -228,7 +228,7 @@ vc4000_chess2_device::vc4000_chess2_device(const machine_config &mconfig, const
mapper specific handlers
-------------------------------------------------*/
-uint8_t vc4000_rom_device::read_rom(offs_t offset)
+READ8_MEMBER(vc4000_rom_device::read_rom)
{
if (offset < m_rom_size)
return m_rom[offset];
@@ -237,18 +237,18 @@ uint8_t vc4000_rom_device::read_rom(offs_t offset)
}
-uint8_t vc4000_ram1k_device::read_ram(offs_t offset)
+READ8_MEMBER(vc4000_ram1k_device::read_ram)
{
return m_ram[offset & (m_ram.size() - 1)];
}
-void vc4000_ram1k_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(vc4000_ram1k_device::write_ram)
{
m_ram[offset & (m_ram.size() - 1)] = data;
}
-uint8_t vc4000_chess2_device::extra_rom(offs_t offset)
+READ8_MEMBER(vc4000_chess2_device::extra_rom)
{
if (offset < (m_rom_size - 0x2000))
return m_rom[offset + 0x2000];
@@ -256,12 +256,12 @@ uint8_t vc4000_chess2_device::extra_rom(offs_t offset)
return 0xff;
}
-uint8_t vc4000_chess2_device::read_ram(offs_t offset)
+READ8_MEMBER(vc4000_chess2_device::read_ram)
{
return m_ram[offset & (m_ram.size() - 1)];
}
-void vc4000_chess2_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(vc4000_chess2_device::write_ram)
{
m_ram[offset & (m_ram.size() - 1)] = data;
}
diff --git a/src/devices/bus/vc4000/rom.h b/src/devices/bus/vc4000/rom.h
index 623e4c248c9..a8d524f2989 100644
--- a/src/devices/bus/vc4000/rom.h
+++ b/src/devices/bus/vc4000/rom.h
@@ -16,7 +16,7 @@ public:
vc4000_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_rom) override;
protected:
vc4000_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -44,8 +44,8 @@ public:
vc4000_ram1k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
};
// ======================> vc4000_chess2_device
@@ -57,9 +57,9 @@ public:
vc4000_chess2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t extra_rom(offs_t offset) override;
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(extra_rom) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
};
diff --git a/src/devices/bus/vc4000/slot.cpp b/src/devices/bus/vc4000/slot.cpp
index 892213c5aef..68c7ca15f4b 100644
--- a/src/devices/bus/vc4000/slot.cpp
+++ b/src/devices/bus/vc4000/slot.cpp
@@ -251,10 +251,10 @@ std::string vc4000_cart_slot_device::get_default_card_software(get_default_card_
read
-------------------------------------------------*/
-uint8_t vc4000_cart_slot_device::read_rom(offs_t offset)
+READ8_MEMBER(vc4000_cart_slot_device::read_rom)
{
if (m_cart)
- return m_cart->read_rom(offset);
+ return m_cart->read_rom(space, offset);
else
return 0xff;
}
@@ -263,10 +263,10 @@ uint8_t vc4000_cart_slot_device::read_rom(offs_t offset)
read
-------------------------------------------------*/
-uint8_t vc4000_cart_slot_device::extra_rom(offs_t offset)
+READ8_MEMBER(vc4000_cart_slot_device::extra_rom)
{
if (m_cart)
- return m_cart->extra_rom(offset);
+ return m_cart->extra_rom(space, offset);
else
return 0xff;
}
@@ -275,10 +275,10 @@ uint8_t vc4000_cart_slot_device::extra_rom(offs_t offset)
read
-------------------------------------------------*/
-uint8_t vc4000_cart_slot_device::read_ram(offs_t offset)
+READ8_MEMBER(vc4000_cart_slot_device::read_ram)
{
if (m_cart)
- return m_cart->read_ram(offset);
+ return m_cart->read_ram(space, offset);
else
return 0xff;
}
@@ -287,8 +287,8 @@ uint8_t vc4000_cart_slot_device::read_ram(offs_t offset)
write
-------------------------------------------------*/
-void vc4000_cart_slot_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(vc4000_cart_slot_device::write_ram)
{
if (m_cart)
- m_cart->write_ram(offset, data);
+ m_cart->write_ram(space, offset, data);
}
diff --git a/src/devices/bus/vc4000/slot.h b/src/devices/bus/vc4000/slot.h
index 2ad52b2c7e0..a5015766545 100644
--- a/src/devices/bus/vc4000/slot.h
+++ b/src/devices/bus/vc4000/slot.h
@@ -27,10 +27,10 @@ public:
virtual ~device_vc4000_cart_interface();
// reading and writing
- virtual uint8_t read_rom(offs_t offset) { return 0xff; }
- virtual uint8_t extra_rom(offs_t offset) { return 0xff; }
- virtual uint8_t read_ram(offs_t offset) { return 0xff; }
- virtual void write_ram(offs_t offset, uint8_t data) {}
+ virtual DECLARE_READ8_MEMBER(read_rom) { return 0xff; }
+ virtual DECLARE_READ8_MEMBER(extra_rom) { return 0xff; }
+ virtual DECLARE_READ8_MEMBER(read_ram) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_ram) {}
void rom_alloc(uint32_t size, const char *tag);
void ram_alloc(uint32_t size);
@@ -93,10 +93,10 @@ public:
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
// reading and writing
- virtual uint8_t read_rom(offs_t offset);
- virtual uint8_t extra_rom(offs_t offset);
- virtual uint8_t read_ram(offs_t offset);
- virtual void write_ram(offs_t offset, uint8_t data);
+ virtual DECLARE_READ8_MEMBER(read_rom);
+ virtual DECLARE_READ8_MEMBER(extra_rom);
+ virtual DECLARE_READ8_MEMBER(read_ram);
+ virtual DECLARE_WRITE8_MEMBER(write_ram);
protected:
// device-level overrides
diff --git a/src/devices/bus/vcs/dpc.cpp b/src/devices/bus/vcs/dpc.cpp
index 525f9e77085..aa452ba2957 100644
--- a/src/devices/bus/vcs/dpc.cpp
+++ b/src/devices/bus/vcs/dpc.cpp
@@ -266,10 +266,9 @@ void a26_rom_dpc_device::setup_addon_ptr(uint8_t *ptr)
}
-void a26_rom_dpc_device::device_add_mconfig(machine_config &config)
-{
- ATARI_DPC(config, m_dpc, 0);
-}
+MACHINE_CONFIG_START(a26_rom_dpc_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dpc", ATARI_DPC, 0)
+MACHINE_CONFIG_END
READ8_MEMBER(a26_rom_dpc_device::read_rom)
{
diff --git a/src/devices/bus/vcs/harmony_melody.cpp b/src/devices/bus/vcs/harmony_melody.cpp
index a38d0c74fdc..38f2b92dd94 100644
--- a/src/devices/bus/vcs/harmony_melody.cpp
+++ b/src/devices/bus/vcs/harmony_melody.cpp
@@ -82,11 +82,10 @@ void a26_rom_harmony_device::harmony_arm7_map(address_map &map)
{
}
-void a26_rom_harmony_device::device_add_mconfig(machine_config &config)
-{
- LPC2103(config, m_cpu, 70000000);
- m_cpu->set_addrmap(AS_PROGRAM, &a26_rom_harmony_device::harmony_arm7_map);
-}
+MACHINE_CONFIG_START(a26_rom_harmony_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("arm", LPC2103, 70000000)
+ MCFG_DEVICE_PROGRAM_MAP(harmony_arm7_map)
+MACHINE_CONFIG_END
// actually if the ARM code is doing this and providing every opcode to the main CPU based
// on bus activity then we shouldn't be doing and of this here (if the ROM is actually
diff --git a/src/devices/bus/vcs/scharger.cpp b/src/devices/bus/vcs/scharger.cpp
index 7c42fc9003c..36a9ee65acc 100644
--- a/src/devices/bus/vcs/scharger.cpp
+++ b/src/devices/bus/vcs/scharger.cpp
@@ -87,15 +87,15 @@ void a26_rom_ss_device::device_reset()
}
-void a26_rom_ss_device::device_add_mconfig(machine_config &config)
-{
- CASSETTE(config, m_cassette);
- m_cassette->set_formats(a26_cassette_formats);
- m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED);
- m_cassette->set_interface("a2600_cass");
-
-// WAVE(config, "wave", m_cassette).add_route(ALL_OUTPUTS, "mono", 0.25);
-}
+MACHINE_CONFIG_START(a26_rom_ss_device::device_add_mconfig)
+ MCFG_CASSETTE_ADD("cassette")
+ MCFG_CASSETTE_FORMATS(a26_cassette_formats)
+ MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
+ MCFG_CASSETTE_INTERFACE("a2600_cass")
+
+// MCFG_SOUND_WAVE_ADD("wave", "cassette")
+// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+MACHINE_CONFIG_END
inline uint8_t a26_rom_ss_device::read_byte(uint32_t offset)
{
diff --git a/src/devices/bus/vcs_ctrl/ctrl.h b/src/devices/bus/vcs_ctrl/ctrl.h
index 574a7dc3ae8..31f371d2fa8 100644
--- a/src/devices/bus/vcs_ctrl/ctrl.h
+++ b/src/devices/bus/vcs_ctrl/ctrl.h
@@ -15,6 +15,22 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_VCS_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, VCS_CONTROL_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+#define MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(_write) \
+ downcast<vcs_control_port_device &>(*device).set_trigger_wr_callback(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -63,6 +79,7 @@ public:
vcs_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
// static configuration helpers
+ template <class Object> devcb_base &set_trigger_wr_callback(Object &&cb) { return m_write_trigger.set_callback(std::forward<Object>(cb)); }
auto trigger_wr_callback() { return m_write_trigger.bind(); }
// computer interface
diff --git a/src/devices/bus/vectrex/slot.h b/src/devices/bus/vectrex/slot.h
index f779bf5d514..605e273875f 100644
--- a/src/devices/bus/vectrex/slot.h
+++ b/src/devices/bus/vectrex/slot.h
@@ -112,4 +112,8 @@ DECLARE_DEVICE_TYPE(VECTREX_CART_SLOT, vectrex_cart_slot_device)
#define VECSLOT_ROM_REGION_TAG ":cart:rom"
+#define MCFG_VECTREX_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
+ MCFG_DEVICE_ADD(_tag, VECTREX_CART_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
#endif // MAME_BUS_VECTREX_SLOT_H
diff --git a/src/devices/bus/vic10/exp.cpp b/src/devices/bus/vic10/exp.cpp
index 26ad1980448..e3af1609567 100644
--- a/src/devices/bus/vic10/exp.cpp
+++ b/src/devices/bus/vic10/exp.cpp
@@ -198,11 +198,11 @@ std::string vic10_expansion_slot_device::get_default_card_software(get_default_c
// cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic10_expansion_slot_device::cd_r(offs_t offset, uint8_t data, int lorom, int uprom, int exram)
+uint8_t vic10_expansion_slot_device::cd_r(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram)
{
if (m_card != nullptr)
{
- data = m_card->vic10_cd_r(offset, data, lorom, uprom, exram);
+ data = m_card->vic10_cd_r(space, offset, data, lorom, uprom, exram);
}
return data;
@@ -213,11 +213,11 @@ uint8_t vic10_expansion_slot_device::cd_r(offs_t offset, uint8_t data, int lorom
// cd_w - cartridge data write
//-------------------------------------------------
-void vic10_expansion_slot_device::cd_w(offs_t offset, uint8_t data, int lorom, int uprom, int exram)
+void vic10_expansion_slot_device::cd_w(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram)
{
if (m_card != nullptr)
{
- m_card->vic10_cd_w(offset, data, lorom, uprom, exram);
+ m_card->vic10_cd_w(space, offset, data, lorom, uprom, exram);
}
}
diff --git a/src/devices/bus/vic10/exp.h b/src/devices/bus/vic10/exp.h
index 710b25bbd49..24da3f392dc 100644
--- a/src/devices/bus/vic10/exp.h
+++ b/src/devices/bus/vic10/exp.h
@@ -79,8 +79,8 @@ public:
auto sp_callback() { return m_write_sp.bind(); }
// computer interface
- uint8_t cd_r(offs_t offset, uint8_t data, int lorom, int uprom, int exram);
- void cd_w(offs_t offset, uint8_t data, int lorom, int uprom, int exram);
+ uint8_t cd_r(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram);
+ void cd_w(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram);
DECLARE_READ_LINE_MEMBER( p0_r );
DECLARE_WRITE_LINE_MEMBER( p0_w );
@@ -133,8 +133,8 @@ public:
// construction/destruction
virtual ~device_vic10_expansion_card_interface();
- virtual uint8_t vic10_cd_r(offs_t offset, uint8_t data, int lorom, int uprom, int exram) { return data; }
- virtual void vic10_cd_w(offs_t offset, uint8_t data, int lorom, int uprom, int exram) { }
+ virtual uint8_t vic10_cd_r(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram) { return data; }
+ virtual void vic10_cd_w(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram) { }
virtual int vic10_p0_r() { return 0; }
virtual void vic10_p0_w(int state) { }
virtual void vic10_sp_w(int state) { }
diff --git a/src/devices/bus/vic10/multimax.cpp b/src/devices/bus/vic10/multimax.cpp
index 98f67a48187..f103ad0ce59 100644
--- a/src/devices/bus/vic10/multimax.cpp
+++ b/src/devices/bus/vic10/multimax.cpp
@@ -59,7 +59,7 @@ void vic10_multimax_device::device_reset()
// vic10_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic10_multimax_device::vic10_cd_r(offs_t offset, uint8_t data, int lorom, int uprom, int exram)
+uint8_t vic10_multimax_device::vic10_cd_r(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram)
{
if (!lorom)
{
@@ -85,7 +85,7 @@ uint8_t vic10_multimax_device::vic10_cd_r(offs_t offset, uint8_t data, int lorom
// vic10_cd_w - cartridge data write
//-------------------------------------------------
-void vic10_multimax_device::vic10_cd_w(offs_t offset, uint8_t data, int lorom, int uprom, int exram)
+void vic10_multimax_device::vic10_cd_w(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram)
{
if (!exram)
{
diff --git a/src/devices/bus/vic10/multimax.h b/src/devices/bus/vic10/multimax.h
index 51175fc7bd8..170ed34fb22 100644
--- a/src/devices/bus/vic10/multimax.h
+++ b/src/devices/bus/vic10/multimax.h
@@ -33,8 +33,8 @@ protected:
virtual void device_reset() override;
// device_vic10_expansion_card_interface overrides
- virtual uint8_t vic10_cd_r(offs_t offset, uint8_t data, int lorom, int uprom, int exram) override;
- virtual void vic10_cd_w(offs_t offset, uint8_t data, int lorom, int uprom, int exram) override;
+ virtual uint8_t vic10_cd_r(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram) override;
+ virtual void vic10_cd_w(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram) override;
private:
uint8_t m_latch;
diff --git a/src/devices/bus/vic10/std.cpp b/src/devices/bus/vic10/std.cpp
index de4ba6ff8b6..0257ea11d98 100644
--- a/src/devices/bus/vic10/std.cpp
+++ b/src/devices/bus/vic10/std.cpp
@@ -46,7 +46,7 @@ void vic10_standard_cartridge_device::device_start()
// vic10_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic10_standard_cartridge_device::vic10_cd_r(offs_t offset, uint8_t data, int lorom, int uprom, int exram)
+uint8_t vic10_standard_cartridge_device::vic10_cd_r(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram)
{
if (!lorom && m_lorom.bytes())
{
@@ -69,7 +69,7 @@ uint8_t vic10_standard_cartridge_device::vic10_cd_r(offs_t offset, uint8_t data,
// vic10_cd_w - cartridge data write
//-------------------------------------------------
-void vic10_standard_cartridge_device::vic10_cd_w(offs_t offset, uint8_t data, int lorom, int uprom, int exram)
+void vic10_standard_cartridge_device::vic10_cd_w(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram)
{
if (!exram && m_exram.bytes())
{
diff --git a/src/devices/bus/vic10/std.h b/src/devices/bus/vic10/std.h
index 3279a58333c..1d1ebf7ae33 100644
--- a/src/devices/bus/vic10/std.h
+++ b/src/devices/bus/vic10/std.h
@@ -33,8 +33,8 @@ protected:
virtual void device_start() override;
// device_vic10_expansion_card_interface overrides
- virtual uint8_t vic10_cd_r(offs_t offset, uint8_t data, int lorom, int uprom, int exram) override;
- virtual void vic10_cd_w(offs_t offset, uint8_t data, int lorom, int uprom, int exram) override;
+ virtual uint8_t vic10_cd_r(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram) override;
+ virtual void vic10_cd_w(address_space &space, offs_t offset, uint8_t data, int lorom, int uprom, int exram) override;
};
diff --git a/src/devices/bus/vic20/exp.cpp b/src/devices/bus/vic20/exp.cpp
index c472f7408fd..4bc6136553b 100644
--- a/src/devices/bus/vic20/exp.cpp
+++ b/src/devices/bus/vic20/exp.cpp
@@ -178,11 +178,11 @@ std::string vic20_expansion_slot_device::get_default_card_software(get_default_c
// cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic20_expansion_slot_device::cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+uint8_t vic20_expansion_slot_device::cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (m_card != nullptr)
{
- data = m_card->vic20_cd_r(offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
+ data = m_card->vic20_cd_r(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
}
return data;
@@ -193,11 +193,11 @@ uint8_t vic20_expansion_slot_device::cd_r(offs_t offset, uint8_t data, int ram1,
// cd_w - cartridge data write
//-------------------------------------------------
-void vic20_expansion_slot_device::cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+void vic20_expansion_slot_device::cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (m_card != nullptr)
{
- m_card->vic20_cd_w(offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
+ m_card->vic20_cd_w(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
}
}
diff --git a/src/devices/bus/vic20/exp.h b/src/devices/bus/vic20/exp.h
index f7e51b0ee57..b6b0dbd1346 100644
--- a/src/devices/bus/vic20/exp.h
+++ b/src/devices/bus/vic20/exp.h
@@ -79,8 +79,8 @@ public:
auto res_wr_callback() { return m_write_res.bind(); }
// computer interface
- uint8_t cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
- void cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
+ uint8_t cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
+ void cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
// cartridge interface
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_write_irq(state); }
@@ -129,8 +129,8 @@ public:
// construction/destruction
virtual ~device_vic20_expansion_card_interface();
- virtual uint8_t vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) { return data; };
- virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) { };
+ virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) { return data; };
+ virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) { };
protected:
device_vic20_expansion_card_interface(const machine_config &mconfig, device_t &device);
diff --git a/src/devices/bus/vic20/fe3.cpp b/src/devices/bus/vic20/fe3.cpp
index f008bec3cb8..57b7df49e91 100644
--- a/src/devices/bus/vic20/fe3.cpp
+++ b/src/devices/bus/vic20/fe3.cpp
@@ -140,7 +140,7 @@ void vic20_final_expansion_3_device::device_reset()
// vic20_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic20_final_expansion_3_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+uint8_t vic20_final_expansion_3_device::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
switch (m_reg1 & REG1_MODE_MASK)
{
@@ -148,7 +148,7 @@ uint8_t vic20_final_expansion_3_device::vic20_cd_r(offs_t offset, uint8_t data,
// read from ROM
if (!blk5)
{
- data = m_flash_rom->read(get_address(0, 3, offset));
+ data = m_flash_rom->read(space, get_address(0, 3, offset));
m_lockbit = 1;
}
@@ -170,19 +170,19 @@ uint8_t vic20_final_expansion_3_device::vic20_cd_r(offs_t offset, uint8_t data,
// read from ROM
if (!blk1 && !BLK1_HIDDEN)
{
- data = m_flash_rom->read(get_address(REG1_BANK, 0, offset));
+ data = m_flash_rom->read(space, get_address(REG1_BANK, 0, offset));
}
if (!blk2 && !BLK2_HIDDEN)
{
- data = m_flash_rom->read(get_address(REG1_BANK, 1, offset));
+ data = m_flash_rom->read(space, get_address(REG1_BANK, 1, offset));
}
if (!blk3 && !BLK3_HIDDEN)
{
- data = m_flash_rom->read(get_address(REG1_BANK, 2, offset));
+ data = m_flash_rom->read(space, get_address(REG1_BANK, 2, offset));
}
if (!blk5 && !BLK5_HIDDEN)
{
- data = m_flash_rom->read(get_address(REG1_BANK, 3, offset));
+ data = m_flash_rom->read(space, get_address(REG1_BANK, 3, offset));
}
// read from registers
@@ -298,19 +298,19 @@ uint8_t vic20_final_expansion_3_device::vic20_cd_r(offs_t offset, uint8_t data,
// read from ROM bank 0 or RAM bank 1
if (!blk1 && !BLK1_HIDDEN)
{
- data = (m_reg1 & REG1_BLK1) ? m_flash_rom->read(get_address(0, 0, offset)) : m_ram[get_address(1, 0, offset)];
+ data = (m_reg1 & REG1_BLK1) ? m_flash_rom->read(space, get_address(0, 0, offset)) : m_ram[get_address(1, 0, offset)];
}
if (!blk2 && !BLK2_HIDDEN)
{
- data = (m_reg1 & REG1_BLK2) ? m_flash_rom->read(get_address(0, 1, offset)) : m_ram[get_address(1, 1, offset)];
+ data = (m_reg1 & REG1_BLK2) ? m_flash_rom->read(space, get_address(0, 1, offset)) : m_ram[get_address(1, 1, offset)];
}
if (!blk3 && !BLK3_HIDDEN)
{
- data = (m_reg1 & REG1_BLK3) ? m_flash_rom->read(get_address(0, 2, offset)) : m_ram[get_address(1, 2, offset)];
+ data = (m_reg1 & REG1_BLK3) ? m_flash_rom->read(space, get_address(0, 2, offset)) : m_ram[get_address(1, 2, offset)];
}
if (!blk5 && !BLK5_HIDDEN)
{
- data = (m_reg1 & REG1_BLK5) ? m_flash_rom->read(get_address(0, 3, offset)) : m_ram[get_address(1, 3, offset)];
+ data = (m_reg1 & REG1_BLK5) ? m_flash_rom->read(space, get_address(0, 3, offset)) : m_ram[get_address(1, 3, offset)];
}
// read from registers
@@ -330,19 +330,19 @@ uint8_t vic20_final_expansion_3_device::vic20_cd_r(offs_t offset, uint8_t data,
// read from ROM
if (!blk1 && !BLK1_HIDDEN)
{
- data = m_flash_rom->read(get_address(REG1_BANK, 0, offset));
+ data = m_flash_rom->read(space, get_address(REG1_BANK, 0, offset));
}
if (!blk2 && !BLK2_HIDDEN)
{
- data = m_flash_rom->read(get_address(REG1_BANK, 1, offset));
+ data = m_flash_rom->read(space, get_address(REG1_BANK, 1, offset));
}
if (!blk3 && !BLK3_HIDDEN)
{
- data = m_flash_rom->read(get_address(REG1_BANK, 2, offset));
+ data = m_flash_rom->read(space, get_address(REG1_BANK, 2, offset));
}
if (!blk5 && !BLK5_HIDDEN)
{
- data = m_flash_rom->read(get_address(REG1_BANK, 3, offset));
+ data = m_flash_rom->read(space, get_address(REG1_BANK, 3, offset));
}
// read from registers
@@ -361,7 +361,7 @@ uint8_t vic20_final_expansion_3_device::vic20_cd_r(offs_t offset, uint8_t data,
// vic20_cd_w - cartridge data write
//-------------------------------------------------
-void vic20_final_expansion_3_device::vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+void vic20_final_expansion_3_device::vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
switch (m_reg1 & REG1_MODE_MASK)
{
@@ -551,19 +551,19 @@ void vic20_final_expansion_3_device::vic20_cd_w(offs_t offset, uint8_t data, int
// write to ROM
if (!blk1 && !BLK1_HIDDEN)
{
- m_flash_rom->write(get_address(REG1_BANK, 0, offset), data);
+ m_flash_rom->write(space, get_address(REG1_BANK, 0, offset), data);
}
if (!blk2 && !BLK2_HIDDEN)
{
- m_flash_rom->write(get_address(REG1_BANK, 1, offset), data);
+ m_flash_rom->write(space, get_address(REG1_BANK, 1, offset), data);
}
if (!blk3 && !BLK3_HIDDEN)
{
- m_flash_rom->write(get_address(REG1_BANK, 2, offset), data);
+ m_flash_rom->write(space, get_address(REG1_BANK, 2, offset), data);
}
if (!blk5 && !BLK5_HIDDEN)
{
- m_flash_rom->write(get_address(REG1_BANK, 3, offset), data);
+ m_flash_rom->write(space, get_address(REG1_BANK, 3, offset), data);
}
// write to registers
diff --git a/src/devices/bus/vic20/fe3.h b/src/devices/bus/vic20/fe3.h
index 018ef2617b6..e65a97bfd1f 100644
--- a/src/devices/bus/vic20/fe3.h
+++ b/src/devices/bus/vic20/fe3.h
@@ -39,8 +39,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_vic20_expansion_card_interface overrides
- virtual uint8_t vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
- virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
private:
enum
diff --git a/src/devices/bus/vic20/megacart.cpp b/src/devices/bus/vic20/megacart.cpp
index 8094adfba2b..fea4153457e 100644
--- a/src/devices/bus/vic20/megacart.cpp
+++ b/src/devices/bus/vic20/megacart.cpp
@@ -22,9 +22,10 @@ DEFINE_DEVICE_TYPE(VIC20_MEGACART, vic20_megacart_device, "vic20_megacart", "VIC
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void vic20_megacart_device::device_add_mconfig(machine_config &config)
-{
-}
+MACHINE_CONFIG_START(vic20_megacart_device::device_add_mconfig)
+
+MACHINE_CONFIG_END
+
//**************************************************************************
@@ -70,7 +71,7 @@ void vic20_megacart_device::device_reset()
// vic20_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic20_megacart_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+uint8_t vic20_megacart_device::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (!ram1 || !ram2 || !ram3 || !io2 || !io3)
{
@@ -94,7 +95,7 @@ uint8_t vic20_megacart_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1,
// vic20_cd_w - cartridge data write
//-------------------------------------------------
-void vic20_megacart_device::vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+void vic20_megacart_device::vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (!ram1 || !ram2 || !ram3 || !io2)
{
diff --git a/src/devices/bus/vic20/megacart.h b/src/devices/bus/vic20/megacart.h
index 52f5182fc3c..6e66382b2c7 100644
--- a/src/devices/bus/vic20/megacart.h
+++ b/src/devices/bus/vic20/megacart.h
@@ -43,8 +43,8 @@ protected:
virtual void nvram_write(emu_file &file) override { file.write(m_nvram, m_nvram.bytes()); }
// device_vic20_expansion_card_interface overrides
- virtual uint8_t vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
- virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
private:
int m_nvram_en;
diff --git a/src/devices/bus/vic20/speakeasy.cpp b/src/devices/bus/vic20/speakeasy.cpp
index 6128852d540..4a068b2daaf 100644
--- a/src/devices/bus/vic20/speakeasy.cpp
+++ b/src/devices/bus/vic20/speakeasy.cpp
@@ -33,12 +33,12 @@ DEFINE_DEVICE_TYPE(VIC20_SPEAKEASY, vic20_speakeasy_device, "vic20_speakeasy", "
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void vic20_speakeasy_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(vic20_speakeasy_device::device_add_mconfig)
SPEAKER(config, "mono").front_center();
- VOTRAX_SC01(config, m_votrax, 720000).add_route(ALL_OUTPUTS, "mono", 0.85);
-}
+ MCFG_DEVICE_ADD(SC01A_TAG, VOTRAX_SC01, 720000)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.85)
+MACHINE_CONFIG_END
@@ -71,7 +71,7 @@ void vic20_speakeasy_device::device_start()
// vic20_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic20_speakeasy_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+uint8_t vic20_speakeasy_device::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (!io2)
{
@@ -86,11 +86,11 @@ uint8_t vic20_speakeasy_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1
// vic20_cd_w - cartridge data write
//-------------------------------------------------
-void vic20_speakeasy_device::vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+void vic20_speakeasy_device::vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (!io2)
{
- m_votrax->write(data & 0x3f);
- m_votrax->inflection_w(data >> 6);
+ m_votrax->write(space, 0, data & 0x3f);
+ m_votrax->inflection_w(space, 0, data >> 6);
}
}
diff --git a/src/devices/bus/vic20/speakeasy.h b/src/devices/bus/vic20/speakeasy.h
index 6df3880d2df..823963804be 100644
--- a/src/devices/bus/vic20/speakeasy.h
+++ b/src/devices/bus/vic20/speakeasy.h
@@ -38,8 +38,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_vic20_expansion_card_interface overrides
- virtual uint8_t vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
- virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
private:
required_device<votrax_sc01_device> m_votrax;
diff --git a/src/devices/bus/vic20/std.cpp b/src/devices/bus/vic20/std.cpp
index 988540719d8..7b4823dfcdf 100644
--- a/src/devices/bus/vic20/std.cpp
+++ b/src/devices/bus/vic20/std.cpp
@@ -46,7 +46,7 @@ void vic20_standard_cartridge_device::device_start()
// vic20_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic20_standard_cartridge_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+uint8_t vic20_standard_cartridge_device::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (!blk1 && (m_blk1 != nullptr))
{
diff --git a/src/devices/bus/vic20/std.h b/src/devices/bus/vic20/std.h
index 0318f80aa54..2362a9c1c4c 100644
--- a/src/devices/bus/vic20/std.h
+++ b/src/devices/bus/vic20/std.h
@@ -33,7 +33,7 @@ protected:
virtual void device_start() override;
// device_vic20_expansion_card_interface overrides
- virtual uint8_t vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
};
diff --git a/src/devices/bus/vic20/vic1010.cpp b/src/devices/bus/vic20/vic1010.cpp
index 651ac37156e..3c00365a4bc 100644
--- a/src/devices/bus/vic20/vic1010.cpp
+++ b/src/devices/bus/vic20/vic1010.cpp
@@ -75,11 +75,11 @@ void vic1010_device::device_reset()
// vic20_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic1010_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+uint8_t vic1010_device::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
for (auto elem : m_expansion_slot)
{
- uint8_t slot_data = elem->cd_r(offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
+ uint8_t slot_data = elem->cd_r(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
if (data != slot_data)
{
@@ -95,10 +95,10 @@ uint8_t vic1010_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ra
// vic20_cd_w - cartridge data write
//-------------------------------------------------
-void vic1010_device::vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+void vic1010_device::vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
for (auto & elem : m_expansion_slot)
{
- elem->cd_w(offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
+ elem->cd_w(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
}
}
diff --git a/src/devices/bus/vic20/vic1010.h b/src/devices/bus/vic20/vic1010.h
index af85f4bfc3c..f2014041f94 100644
--- a/src/devices/bus/vic20/vic1010.h
+++ b/src/devices/bus/vic20/vic1010.h
@@ -37,8 +37,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_vic20_expansion_card_interface overrides
- virtual uint8_t vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
- virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
private:
static constexpr unsigned MAX_SLOTS = 6;
diff --git a/src/devices/bus/vic20/vic1110.cpp b/src/devices/bus/vic20/vic1110.cpp
index 9b2d0c192d9..8edd2179bf9 100644
--- a/src/devices/bus/vic20/vic1110.cpp
+++ b/src/devices/bus/vic20/vic1110.cpp
@@ -90,7 +90,7 @@ void vic1110_device::device_start()
// vic20_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic1110_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+uint8_t vic1110_device::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
uint8_t sw = m_sw->read();
@@ -107,7 +107,7 @@ uint8_t vic1110_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ra
// vic20_cd_w - cartridge data write
//-------------------------------------------------
-void vic1110_device::vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+void vic1110_device::vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
uint8_t sw = m_sw->read();
diff --git a/src/devices/bus/vic20/vic1110.h b/src/devices/bus/vic20/vic1110.h
index 9ec1ea2791a..d1467c995bc 100644
--- a/src/devices/bus/vic20/vic1110.h
+++ b/src/devices/bus/vic20/vic1110.h
@@ -36,8 +36,8 @@ protected:
virtual void device_start() override;
// device_vic20_expansion_card_interface overrides
- virtual uint8_t vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
- virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
private:
optional_shared_ptr<uint8_t> m_ram;
diff --git a/src/devices/bus/vic20/vic1111.cpp b/src/devices/bus/vic20/vic1111.cpp
index 1f8fa215078..ccfbabccd48 100644
--- a/src/devices/bus/vic20/vic1111.cpp
+++ b/src/devices/bus/vic20/vic1111.cpp
@@ -50,7 +50,7 @@ void vic1111_device::device_start()
// vic20_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic1111_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+uint8_t vic1111_device::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (!blk1)
{
@@ -69,7 +69,7 @@ uint8_t vic1111_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ra
// vic20_cd_w - cartridge data write
//-------------------------------------------------
-void vic1111_device::vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+void vic1111_device::vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (!blk1)
{
diff --git a/src/devices/bus/vic20/vic1111.h b/src/devices/bus/vic20/vic1111.h
index eb42db2f149..21f439534e9 100644
--- a/src/devices/bus/vic20/vic1111.h
+++ b/src/devices/bus/vic20/vic1111.h
@@ -33,8 +33,8 @@ protected:
virtual void device_start() override;
// device_vic20_expansion_card_interface overrides
- virtual uint8_t vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
- virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
private:
optional_shared_ptr<uint8_t> m_ram;
diff --git a/src/devices/bus/vic20/vic1112.cpp b/src/devices/bus/vic20/vic1112.cpp
index 77b421f51d8..e8d55e1e89b 100644
--- a/src/devices/bus/vic20/vic1112.cpp
+++ b/src/devices/bus/vic20/vic1112.cpp
@@ -164,7 +164,7 @@ void vic1112_device::device_reset()
// vic20_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic1112_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+uint8_t vic1112_device::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (!io2)
{
@@ -184,7 +184,7 @@ uint8_t vic1112_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ra
// vic20_cd_w - cartridge data write
//-------------------------------------------------
-void vic1112_device::vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+void vic1112_device::vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (!io2)
{
diff --git a/src/devices/bus/vic20/vic1112.h b/src/devices/bus/vic20/vic1112.h
index 5c4e05446a0..6108a328ca8 100644
--- a/src/devices/bus/vic20/vic1112.h
+++ b/src/devices/bus/vic20/vic1112.h
@@ -42,8 +42,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_vic20_expansion_card_interface overrides
- virtual uint8_t vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
- virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
private:
DECLARE_WRITE_LINE_MEMBER( via0_irq_w );
diff --git a/src/devices/bus/vic20/vic1210.cpp b/src/devices/bus/vic20/vic1210.cpp
index 6fa2a917254..81e5d75cc1d 100644
--- a/src/devices/bus/vic20/vic1210.cpp
+++ b/src/devices/bus/vic20/vic1210.cpp
@@ -51,7 +51,7 @@ void vic1210_device::device_start()
// vic20_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic1210_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+uint8_t vic1210_device::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (!ram1 || !ram2 || !ram3)
{
@@ -70,7 +70,7 @@ uint8_t vic1210_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ra
// vic20_cd_w - cartridge data write
//-------------------------------------------------
-void vic1210_device::vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+void vic1210_device::vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (!ram1 || !ram2 || !ram3)
{
diff --git a/src/devices/bus/vic20/vic1210.h b/src/devices/bus/vic20/vic1210.h
index f890d5ad61e..9fa0ea48a99 100644
--- a/src/devices/bus/vic20/vic1210.h
+++ b/src/devices/bus/vic20/vic1210.h
@@ -34,8 +34,8 @@ protected:
virtual void device_start() override;
// device_vic20_expansion_card_interface overrides
- virtual uint8_t vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
- virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
private:
optional_shared_ptr<uint8_t> m_ram;
diff --git a/src/devices/bus/vic20/videopak.cpp b/src/devices/bus/vic20/videopak.cpp
index 849f9a00a3b..841d4265a1b 100644
--- a/src/devices/bus/vic20/videopak.cpp
+++ b/src/devices/bus/vic20/videopak.cpp
@@ -97,15 +97,14 @@ GFXDECODE_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void vic20_video_pak_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, MC6845_SCREEN_TAG, SCREEN_TYPE_RASTER, rgb_t::white()));
- screen.set_screen_update(MC6845_TAG, FUNC(h46505_device::screen_update));
- screen.set_size(80*8, 24*8);
- screen.set_visarea(0, 80*8-1, 0, 24*8-1);
- screen.set_refresh_hz(50);
-
- GFXDECODE(config, "gfxdecode", m_palette, gfx_vic20_video_pak);
+MACHINE_CONFIG_START(vic20_video_pak_device::device_add_mconfig)
+ MCFG_SCREEN_ADD_MONOCHROME(MC6845_SCREEN_TAG, RASTER, rgb_t::white())
+ MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, h46505_device, screen_update)
+ MCFG_SCREEN_SIZE(80*8, 24*8)
+ MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*8-1)
+ MCFG_SCREEN_REFRESH_RATE(50)
+
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_vic20_video_pak)
PALETTE(config, m_palette, palette_device::MONOCHROME);
H46505(config, m_crtc, XTAL(14'318'181) / 8);
@@ -113,7 +112,7 @@ void vic20_video_pak_device::device_add_mconfig(machine_config &config)
m_crtc->set_show_border_area(true);
m_crtc->set_char_width(8);
m_crtc->set_update_row_callback(FUNC(vic20_video_pak_device::crtc_update_row), this);
-}
+MACHINE_CONFIG_END
@@ -162,7 +161,7 @@ void vic20_video_pak_device::device_reset()
// vic20_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t vic20_video_pak_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+uint8_t vic20_video_pak_device::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (!m_ram_enable)
{
@@ -221,7 +220,7 @@ uint8_t vic20_video_pak_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1
{
if (offset == 0x1bf9)
{
- data = m_crtc->register_r();
+ data = m_crtc->register_r(space, 0);
}
}
@@ -233,7 +232,7 @@ uint8_t vic20_video_pak_device::vic20_cd_r(offs_t offset, uint8_t data, int ram1
// vic20_cd_w - cartridge data write
//-------------------------------------------------
-void vic20_video_pak_device::vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+void vic20_video_pak_device::vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
if (!m_ram_enable)
{
@@ -293,11 +292,11 @@ void vic20_video_pak_device::vic20_cd_w(offs_t offset, uint8_t data, int ram1, i
switch (offset)
{
case 0x1bf8:
- m_crtc->address_w(data);
+ m_crtc->address_w(space, 0, data);
break;
case 0x1bf9:
- m_crtc->register_w(data);
+ m_crtc->register_w(space, 0, data);
break;
case 0x1bfc:
diff --git a/src/devices/bus/vic20/videopak.h b/src/devices/bus/vic20/videopak.h
index 084e57689dc..def121f2c55 100644
--- a/src/devices/bus/vic20/videopak.h
+++ b/src/devices/bus/vic20/videopak.h
@@ -42,8 +42,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_vic20_expansion_card_interface overrides
- virtual uint8_t vic20_cd_r(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
- virtual void vic20_cd_w(offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
private:
MC6845_UPDATE_ROW( crtc_update_row );
diff --git a/src/devices/bus/vidbrain/exp.cpp b/src/devices/bus/vidbrain/exp.cpp
index 808907678cc..c490c0605b2 100644
--- a/src/devices/bus/vidbrain/exp.cpp
+++ b/src/devices/bus/vidbrain/exp.cpp
@@ -153,13 +153,13 @@ std::string videobrain_expansion_slot_device::get_default_card_software(get_defa
// bo_r - cartridge data read
//-------------------------------------------------
-uint8_t videobrain_expansion_slot_device::bo_r(offs_t offset, int cs1, int cs2)
+uint8_t videobrain_expansion_slot_device::bo_r(address_space &space, offs_t offset, int cs1, int cs2)
{
uint8_t data = 0;
if (m_cart != nullptr)
{
- data = m_cart->videobrain_bo_r(offset, cs1, cs2);
+ data = m_cart->videobrain_bo_r(space, offset, cs1, cs2);
}
return data;
@@ -170,11 +170,11 @@ uint8_t videobrain_expansion_slot_device::bo_r(offs_t offset, int cs1, int cs2)
// bo_w - cartridge data write
//-------------------------------------------------
-void videobrain_expansion_slot_device::bo_w(offs_t offset, uint8_t data, int cs1, int cs2)
+void videobrain_expansion_slot_device::bo_w(address_space &space, offs_t offset, uint8_t data, int cs1, int cs2)
{
if (m_cart != nullptr)
{
- m_cart->videobrain_bo_w(offset, data, cs1, cs2);
+ m_cart->videobrain_bo_w(space, offset, data, cs1, cs2);
}
}
diff --git a/src/devices/bus/vidbrain/exp.h b/src/devices/bus/vidbrain/exp.h
index e841df6c32c..fdb4b6a6ac7 100644
--- a/src/devices/bus/vidbrain/exp.h
+++ b/src/devices/bus/vidbrain/exp.h
@@ -49,6 +49,21 @@
#define VIDEOBRAIN_EXPANSION_SLOT_TAG "exp"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_VIDEOBRAIN_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, VIDEOBRAIN_EXPANSION_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+#define MCFG_VIDEOBRAIN_EXPANSION_SLOT_EXTRES_CALLBACK(_write) \
+ downcast<videobrain_expansion_slot_device &>(*device).set_extres_wr_callback(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -73,8 +88,8 @@ protected:
virtual uint8_t* videobrain_ram_pointer(running_machine &machine, size_t size);
// runtime
- virtual uint8_t videobrain_bo_r(offs_t offset, int cs1, int cs2) { return 0; }
- virtual void videobrain_bo_w(offs_t offset, uint8_t data, int cs1, int cs2) { }
+ virtual uint8_t videobrain_bo_r(address_space &space, offs_t offset, int cs1, int cs2) { return 0; }
+ virtual void videobrain_bo_w(address_space &space, offs_t offset, uint8_t data, int cs1, int cs2) { }
virtual void videobrain_extres_w() { }
videobrain_expansion_slot_device *m_slot;
@@ -95,29 +110,20 @@ class videobrain_expansion_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- videobrain_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, char const* dflt)
- : videobrain_expansion_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- videobrain_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
-
- auto extres_wr_callback() { return m_write_extres.bind(); }
+ videobrain_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ template <class Object> devcb_base &set_extres_wr_callback(Object &&cb) { return m_write_extres.set_callback(std::forward<Object>(cb)); }
// computer interface
- uint8_t bo_r(offs_t offset, int cs1, int cs2);
- void bo_w(offs_t offset, uint8_t data, int cs1, int cs2);
-
- uint8_t cs1_r(offs_t offset) { return bo_r(offset + 0x1000, 0, 1); }
- void cs1_w(offs_t offset, uint8_t data) { bo_w(offset + 0x1000, data, 0, 1); }
- uint8_t cs2_r(offs_t offset) { return bo_r(offset + 0x1800, 1, 0); }
- void cs2_w(offs_t offset, uint8_t data) { bo_w(offset + 0x1800, data, 1, 0); }
- uint8_t unmap_r(offs_t offset) { return bo_r(offset + 0x3000, 1, 0); }
- void unmap_w(offs_t offset, uint8_t data) { bo_w(offset + 0x3000, data, 1, 0); }
+ uint8_t bo_r(address_space &space, offs_t offset, int cs1, int cs2);
+ void bo_w(address_space &space, offs_t offset, uint8_t data, int cs1, int cs2);
+
+ DECLARE_READ8_MEMBER( cs1_r ) { return bo_r(space, offset + 0x1000, 0, 1); }
+ DECLARE_WRITE8_MEMBER( cs1_w ) { bo_w(space, offset + 0x1000, data, 0, 1); }
+ DECLARE_READ8_MEMBER( cs2_r ) { return bo_r(space, offset + 0x1800, 1, 0); }
+ DECLARE_WRITE8_MEMBER( cs2_w ) { bo_w(space, offset + 0x1800, data, 1, 0); }
+ DECLARE_READ8_MEMBER( unmap_r ) { return bo_r(space, offset + 0x3000, 1, 0); }
+ DECLARE_WRITE8_MEMBER( unmap_w ) { bo_w(space, offset + 0x3000, data, 1, 0); }
// cartridge interface
DECLARE_WRITE_LINE_MEMBER( extres_w ) { m_write_extres(state); }
diff --git a/src/devices/bus/vidbrain/money_minder.cpp b/src/devices/bus/vidbrain/money_minder.cpp
index b0f4826ca5d..81220a499b6 100644
--- a/src/devices/bus/vidbrain/money_minder.cpp
+++ b/src/devices/bus/vidbrain/money_minder.cpp
@@ -47,7 +47,7 @@ void videobrain_money_minder_cartridge_device::device_start()
// videobrain_cd_r - cartridge data read
//-------------------------------------------------
-uint8_t videobrain_money_minder_cartridge_device::videobrain_bo_r(offs_t offset, int cs1, int cs2)
+uint8_t videobrain_money_minder_cartridge_device::videobrain_bo_r(address_space &space, offs_t offset, int cs1, int cs2)
{
uint8_t data = 0;
@@ -68,7 +68,7 @@ uint8_t videobrain_money_minder_cartridge_device::videobrain_bo_r(offs_t offset,
// videobrain_bo_w - cartridge data write
//-------------------------------------------------
-void videobrain_money_minder_cartridge_device::videobrain_bo_w(offs_t offset, uint8_t data, int cs1, int cs2)
+void videobrain_money_minder_cartridge_device::videobrain_bo_w(address_space &space, offs_t offset, uint8_t data, int cs1, int cs2)
{
if (offset >= 0x3800)
{
diff --git a/src/devices/bus/vidbrain/money_minder.h b/src/devices/bus/vidbrain/money_minder.h
index 23f219c4962..20ead06960e 100644
--- a/src/devices/bus/vidbrain/money_minder.h
+++ b/src/devices/bus/vidbrain/money_minder.h
@@ -33,8 +33,8 @@ protected:
virtual void device_start() override;
// device_videobrain_expansion_card_interface overrides
- virtual uint8_t videobrain_bo_r(offs_t offset, int cs1, int cs2) override;
- virtual void videobrain_bo_w(offs_t offset, uint8_t data, int cs1, int cs2) override;
+ virtual uint8_t videobrain_bo_r(address_space &space, offs_t offset, int cs1, int cs2) override;
+ virtual void videobrain_bo_w(address_space &space, offs_t offset, uint8_t data, int cs1, int cs2) override;
};
diff --git a/src/devices/bus/vidbrain/std.cpp b/src/devices/bus/vidbrain/std.cpp
index 55b5c3ce22d..82a6fc2761e 100644
--- a/src/devices/bus/vidbrain/std.cpp
+++ b/src/devices/bus/vidbrain/std.cpp
@@ -47,7 +47,7 @@ void videobrain_standard_cartridge_device::device_start()
// videobrain_bo_r - cartridge data read
//-------------------------------------------------
-uint8_t videobrain_standard_cartridge_device::videobrain_bo_r(offs_t offset, int cs1, int cs2)
+uint8_t videobrain_standard_cartridge_device::videobrain_bo_r(address_space &space, offs_t offset, int cs1, int cs2)
{
uint8_t data = 0;
diff --git a/src/devices/bus/vidbrain/std.h b/src/devices/bus/vidbrain/std.h
index 7939501909f..2dbbde3231f 100644
--- a/src/devices/bus/vidbrain/std.h
+++ b/src/devices/bus/vidbrain/std.h
@@ -33,7 +33,7 @@ protected:
virtual void device_start() override;
// device_videobrain_expansion_card_interface overrides
- virtual uint8_t videobrain_bo_r(offs_t offset, int cs1, int cs2) override;
+ virtual uint8_t videobrain_bo_r(address_space &space, offs_t offset, int cs1, int cs2) override;
};
diff --git a/src/devices/bus/vidbrain/timeshare.cpp b/src/devices/bus/vidbrain/timeshare.cpp
index 709f16f5c74..f4997a55ddc 100644
--- a/src/devices/bus/vidbrain/timeshare.cpp
+++ b/src/devices/bus/vidbrain/timeshare.cpp
@@ -47,7 +47,7 @@ void videobrain_timeshare_cartridge_device::device_start()
// videobrain_bo_r - cartridge data read
//-------------------------------------------------
-uint8_t videobrain_timeshare_cartridge_device::videobrain_bo_r(offs_t offset, int cs1, int cs2)
+uint8_t videobrain_timeshare_cartridge_device::videobrain_bo_r(address_space &space, offs_t offset, int cs1, int cs2)
{
uint8_t data = 0;
@@ -67,7 +67,7 @@ uint8_t videobrain_timeshare_cartridge_device::videobrain_bo_r(offs_t offset, in
// videobrain_bo_w - cartridge data write
//-------------------------------------------------
-void videobrain_timeshare_cartridge_device::videobrain_bo_w(offs_t offset, uint8_t data, int cs1, int cs2)
+void videobrain_timeshare_cartridge_device::videobrain_bo_w(address_space &space, offs_t offset, uint8_t data, int cs1, int cs2)
{
if (!cs2)
{
diff --git a/src/devices/bus/vidbrain/timeshare.h b/src/devices/bus/vidbrain/timeshare.h
index 7885772149d..971c5674320 100644
--- a/src/devices/bus/vidbrain/timeshare.h
+++ b/src/devices/bus/vidbrain/timeshare.h
@@ -33,8 +33,8 @@ protected:
virtual void device_start() override;
// device_videobrain_expansion_card_interface overrides
- virtual uint8_t videobrain_bo_r(offs_t offset, int cs1, int cs2) override;
- virtual void videobrain_bo_w(offs_t offset, uint8_t data, int cs1, int cs2) override;
+ virtual uint8_t videobrain_bo_r(address_space &space, offs_t offset, int cs1, int cs2) override;
+ virtual void videobrain_bo_w(address_space &space, offs_t offset, uint8_t data, int cs1, int cs2) override;
};
diff --git a/src/devices/bus/vip/byteio.h b/src/devices/bus/vip/byteio.h
index f2b12ca49f2..d2190214a2d 100644
--- a/src/devices/bus/vip/byteio.h
+++ b/src/devices/bus/vip/byteio.h
@@ -45,6 +45,18 @@
#define VIP_BYTEIO_PORT_TAG "byteio"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_VIP_BYTEIO_PORT_ADD(_tag, _slot_intf, _def_slot, _inst) \
+ MCFG_DEVICE_ADD(_tag, VIP_BYTEIO_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<vip_byteio_port_device *>(device)->set_inst_callback(DEVCB_##_inst);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -58,19 +70,9 @@ class vip_byteio_port_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- vip_byteio_port_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
- : vip_byteio_port_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
-
- vip_byteio_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
-
- auto inst_callback() { return m_write_inst.bind(); }
+ vip_byteio_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ template <class Object> void set_inst_callback(Object &&inst) { m_write_inst.set_callback(std::forward<Object>(inst)); }
// computer interface
uint8_t in_r();
diff --git a/src/devices/bus/vip/exp.cpp b/src/devices/bus/vip/exp.cpp
index 132a4d753ef..70467c57839 100644
--- a/src/devices/bus/vip/exp.cpp
+++ b/src/devices/bus/vip/exp.cpp
@@ -80,13 +80,13 @@ void vip_expansion_slot_device::device_start()
// program_r - program read
//-------------------------------------------------
-uint8_t vip_expansion_slot_device::program_r(offs_t offset, int cs, int cdef, int *minh)
+uint8_t vip_expansion_slot_device::program_r(address_space &space, offs_t offset, int cs, int cdef, int *minh)
{
uint8_t data = 0;
if (m_card != nullptr)
{
- data = m_card->vip_program_r(offset, cs, cdef, minh);
+ data = m_card->vip_program_r(space, offset, cs, cdef, minh);
}
return data;
@@ -97,11 +97,11 @@ uint8_t vip_expansion_slot_device::program_r(offs_t offset, int cs, int cdef, in
// program_w - program write
//-------------------------------------------------
-void vip_expansion_slot_device::program_w(offs_t offset, uint8_t data, int cdef, int *minh)
+void vip_expansion_slot_device::program_w(address_space &space, offs_t offset, uint8_t data, int cdef, int *minh)
{
if (m_card != nullptr)
{
- m_card->vip_program_w(offset, data, cdef, minh);
+ m_card->vip_program_w(space, offset, data, cdef, minh);
}
}
@@ -110,13 +110,13 @@ void vip_expansion_slot_device::program_w(offs_t offset, uint8_t data, int cdef,
// io_r - io read
//-------------------------------------------------
-uint8_t vip_expansion_slot_device::io_r(offs_t offset)
+uint8_t vip_expansion_slot_device::io_r(address_space &space, offs_t offset)
{
uint8_t data = 0;
if (m_card != nullptr)
{
- data = m_card->vip_io_r(offset);
+ data = m_card->vip_io_r(space, offset);
}
return data;
@@ -127,11 +127,11 @@ uint8_t vip_expansion_slot_device::io_r(offs_t offset)
// io_w - io write
//-------------------------------------------------
-void vip_expansion_slot_device::io_w(offs_t offset, uint8_t data)
+void vip_expansion_slot_device::io_w(address_space &space, offs_t offset, uint8_t data)
{
if (m_card != nullptr)
{
- m_card->vip_io_w(offset, data);
+ m_card->vip_io_w(space, offset, data);
}
}
@@ -140,13 +140,13 @@ void vip_expansion_slot_device::io_w(offs_t offset, uint8_t data)
// dma_r - dma read
//-------------------------------------------------
-uint8_t vip_expansion_slot_device::dma_r(offs_t offset)
+READ8_MEMBER(vip_expansion_slot_device::dma_r)
{
uint8_t data = 0;
if (m_card != nullptr)
{
- data = m_card->vip_dma_r(offset);
+ data = m_card->vip_dma_r(space, offset);
}
return data;
@@ -157,11 +157,11 @@ uint8_t vip_expansion_slot_device::dma_r(offs_t offset)
// dma_w - dma write
//-------------------------------------------------
-void vip_expansion_slot_device::dma_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(vip_expansion_slot_device::dma_w)
{
if (m_card != nullptr)
{
- m_card->vip_dma_w(offset, data);
+ m_card->vip_dma_w(space, offset, data);
}
}
@@ -206,7 +206,7 @@ READ_LINE_MEMBER(vip_expansion_slot_device::ef4_r)
return state;
}
-void vip_expansion_slot_device::sc_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(vip_expansion_slot_device::sc_w)
{
if (m_card != nullptr)
m_card->vip_sc_w(offset, data);
diff --git a/src/devices/bus/vip/exp.h b/src/devices/bus/vip/exp.h
index 9073dafee0d..dfca23fc038 100644
--- a/src/devices/bus/vip/exp.h
+++ b/src/devices/bus/vip/exp.h
@@ -46,6 +46,27 @@
#define VIP_EXPANSION_SLOT_TAG "exp"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_VIP_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, VIP_EXPANSION_SLOT, _clock) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+#define MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(_write) \
+ downcast<vip_expansion_slot_device &>(*device).set_int_wr_callback(DEVCB_##_write);
+
+#define MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(_write) \
+ downcast<vip_expansion_slot_device &>(*device).set_dma_out_wr_callback(DEVCB_##_write);
+
+#define MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(_write) \
+ downcast<vip_expansion_slot_device &>(*device).set_dma_in_wr_callback(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -59,33 +80,24 @@ class vip_expansion_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- vip_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock, T &&opts, char const *dflt)
- : vip_expansion_slot_device(mconfig, tag, owner, clock)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
vip_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto int_wr_callback() { return m_write_int.bind(); }
- auto dma_out_wr_callback() { return m_write_dma_out.bind(); }
- auto dma_in_wr_callback() { return m_write_dma_in.bind(); }
+ template <class Object> devcb_base &set_int_wr_callback(Object &&cb) { return m_write_int.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_dma_out_wr_callback(Object &&cb) { return m_write_dma_out.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_dma_in_wr_callback(Object &&cb) { return m_write_dma_in.set_callback(std::forward<Object>(cb)); }
// computer interface
- uint8_t program_r(offs_t offset, int cs, int cdef, int *minh);
- void program_w(offs_t offset, uint8_t data, int cdef, int *minh);
- uint8_t io_r(offs_t offset);
- void io_w(offs_t offset, uint8_t data);
- uint8_t dma_r(offs_t offset);
- void dma_w(offs_t offset, uint8_t data);
+ uint8_t program_r(address_space &space, offs_t offset, int cs, int cdef, int *minh);
+ void program_w(address_space &space, offs_t offset, uint8_t data, int cdef, int *minh);
+ uint8_t io_r(address_space &space, offs_t offset);
+ void io_w(address_space &space, offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(dma_r);
+ DECLARE_WRITE8_MEMBER(dma_w);
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_READ_LINE_MEMBER(ef1_r);
DECLARE_READ_LINE_MEMBER(ef3_r);
DECLARE_READ_LINE_MEMBER(ef4_r);
- void sc_w(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER(sc_w);
DECLARE_WRITE_LINE_MEMBER(q_w);
DECLARE_WRITE_LINE_MEMBER(tpb_w);
DECLARE_WRITE_LINE_MEMBER(run_w);
@@ -118,14 +130,14 @@ protected:
device_vip_expansion_card_interface(const machine_config &mconfig, device_t &device);
// runtime
- virtual uint8_t vip_program_r(offs_t offset, int cs, int cdef, int *minh) { return 0xff; }
- virtual void vip_program_w(offs_t offset, uint8_t data, int cdef, int *minh) { }
+ virtual uint8_t vip_program_r(address_space &space, offs_t offset, int cs, int cdef, int *minh) { return 0xff; }
+ virtual void vip_program_w(address_space &space, offs_t offset, uint8_t data, int cdef, int *minh) { }
- virtual uint8_t vip_io_r(offs_t offset) { return 0xff; }
- virtual void vip_io_w(offs_t offset, uint8_t data) { }
+ virtual uint8_t vip_io_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void vip_io_w(address_space &space, offs_t offset, uint8_t data) { }
- virtual uint8_t vip_dma_r(offs_t offset) { return 0xff; }
- virtual void vip_dma_w(offs_t offset, uint8_t data) { }
+ virtual uint8_t vip_dma_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void vip_dma_w(address_space &space, offs_t offset, uint8_t data) { }
virtual uint32_t vip_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { return 0; }
diff --git a/src/devices/bus/vip/vp550.cpp b/src/devices/bus/vip/vp550.cpp
index 6d1e36f57d7..a8285c53adc 100644
--- a/src/devices/bus/vip/vp550.cpp
+++ b/src/devices/bus/vip/vp550.cpp
@@ -47,7 +47,7 @@ DEFINE_DEVICE_TYPE(VP550, vp550_device, "vp550", "VP-550 Super Sound")
//-------------------------------------------------
-// machine_config( vp550 )
+// MACHINE_CONFIG_START( vp550 )
//-------------------------------------------------
void vp550_device::device_add_mconfig(machine_config &config)
@@ -112,7 +112,7 @@ void vp550_device::device_timer(emu_timer &timer, device_timer_id id, int param,
// vip_program_w - program write
//-------------------------------------------------
-void vp550_device::vip_program_w(offs_t offset, uint8_t data, int cdef, int *minh)
+void vp550_device::vip_program_w(address_space &space, offs_t offset, uint8_t data, int cdef, int *minh)
{
if (BIT(offset, 15))
{
@@ -122,14 +122,14 @@ void vp550_device::vip_program_w(offs_t offset, uint8_t data, int cdef, int *min
{
case 1: m_pfg_a->write_str(data); break;
case 2: m_pfg_b->write_str(data); break;
- case 3: octave_w(data); break;
+ case 3: octave_w(space, offset, data); break;
}
switch ((offset >> 4) & 0x03)
{
- case 1: vlmna_w(data); break;
- case 2: vlmnb_w(data); break;
- case 3: sync_w(data); break;
+ case 1: vlmna_w(space, offset, data); break;
+ case 2: vlmnb_w(space, offset, data); break;
+ case 3: sync_w(space, offset, data); break;
}
}
}
@@ -179,7 +179,7 @@ void vp550_device::vip_run_w(int state)
// octave_w - octave select write
//-------------------------------------------------
-void vp550_device::octave_w(uint8_t data)
+WRITE8_MEMBER( vp550_device::octave_w )
{
int channel = (data >> 2) & 0x03;
int clock2 = 0;
@@ -209,7 +209,7 @@ void vp550_device::octave_w(uint8_t data)
// vlmna_w - channel A amplitude write
//-------------------------------------------------
-void vp550_device::vlmna_w(uint8_t data)
+WRITE8_MEMBER( vp550_device::vlmna_w )
{
if (LOG) logerror("VP550 '%s' A Volume: %u\n", tag(), data & 0x0f);
@@ -223,7 +223,7 @@ void vp550_device::vlmna_w(uint8_t data)
// vlmnb_w - channel B amplitude write
//-------------------------------------------------
-void vp550_device::vlmnb_w(uint8_t data)
+WRITE8_MEMBER( vp550_device::vlmnb_w )
{
if (LOG) logerror("VP550 '%s' B Volume: %u\n", tag(), data & 0x0f);
@@ -237,7 +237,7 @@ void vp550_device::vlmnb_w(uint8_t data)
// sync_w - interrupt enable write
//-------------------------------------------------
-void vp550_device::sync_w(uint8_t data)
+WRITE8_MEMBER( vp550_device::sync_w )
{
if (LOG) logerror("VP550 '%s' Interrupt Enable: %u\n", tag(), BIT(data, 0));
diff --git a/src/devices/bus/vip/vp550.h b/src/devices/bus/vip/vp550.h
index d881063ba2c..20b2cf8e8de 100644
--- a/src/devices/bus/vip/vp550.h
+++ b/src/devices/bus/vip/vp550.h
@@ -36,16 +36,16 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_vip_expansion_card_interface overrides
- virtual void vip_program_w(offs_t offset, uint8_t data, int cdef, int *minh) override;
+ virtual void vip_program_w(address_space &space, offs_t offset, uint8_t data, int cdef, int *minh) override;
virtual void vip_sc_w(int n, int sc) override;
virtual void vip_q_w(int state) override;
virtual void vip_run_w(int state) override;
private:
- void octave_w(uint8_t data);
- void vlmna_w(uint8_t data);
- void vlmnb_w(uint8_t data);
- void sync_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( octave_w );
+ DECLARE_WRITE8_MEMBER( vlmna_w );
+ DECLARE_WRITE8_MEMBER( vlmnb_w );
+ DECLARE_WRITE8_MEMBER( sync_w );
required_device<cdp1863_device> m_pfg_a;
required_device<cdp1863_device> m_pfg_b;
diff --git a/src/devices/bus/vip/vp570.cpp b/src/devices/bus/vip/vp570.cpp
index f9473bd2f87..e01d427649b 100644
--- a/src/devices/bus/vip/vp570.cpp
+++ b/src/devices/bus/vip/vp570.cpp
@@ -84,7 +84,7 @@ void vp570_device::device_start()
// vip_program_r - program read
//-------------------------------------------------
-uint8_t vp570_device::vip_program_r(offs_t offset, int cs, int cdef, int *minh)
+uint8_t vp570_device::vip_program_r(address_space &space, offs_t offset, int cs, int cdef, int *minh)
{
uint8_t data = 0xff;
@@ -105,7 +105,7 @@ uint8_t vp570_device::vip_program_r(offs_t offset, int cs, int cdef, int *minh)
// vip_program_w - program write
//-------------------------------------------------
-void vp570_device::vip_program_w(offs_t offset, uint8_t data, int cdef, int *minh)
+void vp570_device::vip_program_w(address_space &space, offs_t offset, uint8_t data, int cdef, int *minh)
{
offs_t base = m_base->read() << 12;
diff --git a/src/devices/bus/vip/vp570.h b/src/devices/bus/vip/vp570.h
index 04ad752d804..004be88a8bf 100644
--- a/src/devices/bus/vip/vp570.h
+++ b/src/devices/bus/vip/vp570.h
@@ -36,8 +36,8 @@ protected:
virtual void device_start() override;
// device_vip_expansion_card_interface overrides
- virtual uint8_t vip_program_r(offs_t offset, int cs, int cdef, int *minh) override;
- virtual void vip_program_w(offs_t offset, uint8_t data, int cdef, int *minh) override;
+ virtual uint8_t vip_program_r(address_space &space, offs_t offset, int cs, int cdef, int *minh) override;
+ virtual void vip_program_w(address_space &space, offs_t offset, uint8_t data, int cdef, int *minh) override;
private:
optional_shared_ptr<uint8_t> m_ram;
diff --git a/src/devices/bus/vip/vp575.cpp b/src/devices/bus/vip/vp575.cpp
index 685c05be7c6..c69ccc5bade 100644
--- a/src/devices/bus/vip/vp575.cpp
+++ b/src/devices/bus/vip/vp575.cpp
@@ -42,36 +42,35 @@ void vp575_device::update_interrupts()
//-------------------------------------------------
-// machine_config( vp575 )
+// MACHINE_CONFIG_START( vp575 )
//-------------------------------------------------
-void vp575_device::device_add_mconfig(machine_config &config)
-{
- VIP_EXPANSION_SLOT(config, m_expansion_slot[0], XTAL(3'521'280)/2, vip_expansion_cards, nullptr);
- m_expansion_slot[0]->int_wr_callback().set(FUNC(vp575_device::exp1_int_w));
- m_expansion_slot[0]->dma_out_wr_callback().set(FUNC(vp575_device::exp1_dma_out_w));
- m_expansion_slot[0]->dma_in_wr_callback().set(FUNC(vp575_device::exp1_dma_in_w));
-
- VIP_EXPANSION_SLOT(config, m_expansion_slot[1], XTAL(3'521'280)/2, vip_expansion_cards, nullptr);
- m_expansion_slot[1]->int_wr_callback().set(FUNC(vp575_device::exp2_int_w));
- m_expansion_slot[1]->dma_out_wr_callback().set(FUNC(vp575_device::exp2_dma_out_w));
- m_expansion_slot[1]->dma_in_wr_callback().set(FUNC(vp575_device::exp2_dma_in_w));
-
- VIP_EXPANSION_SLOT(config, m_expansion_slot[2], XTAL(3'521'280)/2, vip_expansion_cards, nullptr);
- m_expansion_slot[2]->int_wr_callback().set(FUNC(vp575_device::exp3_int_w));
- m_expansion_slot[2]->dma_out_wr_callback().set(FUNC(vp575_device::exp3_dma_out_w));
- m_expansion_slot[2]->dma_in_wr_callback().set(FUNC(vp575_device::exp3_dma_in_w));
-
- VIP_EXPANSION_SLOT(config, m_expansion_slot[3], XTAL(3'521'280)/2, vip_expansion_cards, nullptr);
- m_expansion_slot[3]->int_wr_callback().set(FUNC(vp575_device::exp4_int_w));
- m_expansion_slot[3]->dma_out_wr_callback().set(FUNC(vp575_device::exp4_dma_out_w));
- m_expansion_slot[3]->dma_in_wr_callback().set(FUNC(vp575_device::exp4_dma_in_w));
-
- VIP_EXPANSION_SLOT(config, m_expansion_slot[4], XTAL(3'521'280)/2, vip_expansion_cards, nullptr);
- m_expansion_slot[4]->int_wr_callback().set(FUNC(vp575_device::exp5_int_w));
- m_expansion_slot[4]->dma_out_wr_callback().set(FUNC(vp575_device::exp5_dma_out_w));
- m_expansion_slot[4]->dma_in_wr_callback().set(FUNC(vp575_device::exp5_dma_in_w));
-}
+MACHINE_CONFIG_START(vp575_device::device_add_mconfig)
+ MCFG_VIP_EXPANSION_SLOT_ADD("exp1", XTAL(3'521'280)/2, vip_expansion_cards, nullptr)
+ MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(WRITELINE(*this, vp575_device, exp1_int_w))
+ MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(WRITELINE(*this, vp575_device, exp1_dma_out_w))
+ MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(WRITELINE(*this, vp575_device, exp1_dma_in_w))
+
+ MCFG_VIP_EXPANSION_SLOT_ADD("exp2", XTAL(3'521'280)/2, vip_expansion_cards, nullptr)
+ MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(WRITELINE(*this, vp575_device, exp2_int_w))
+ MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(WRITELINE(*this, vp575_device, exp2_dma_out_w))
+ MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(WRITELINE(*this, vp575_device, exp2_dma_in_w))
+
+ MCFG_VIP_EXPANSION_SLOT_ADD("exp3", XTAL(3'521'280)/2, vip_expansion_cards, nullptr)
+ MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(WRITELINE(*this, vp575_device, exp3_int_w))
+ MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(WRITELINE(*this, vp575_device, exp3_dma_out_w))
+ MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(WRITELINE(*this, vp575_device, exp3_dma_in_w))
+
+ MCFG_VIP_EXPANSION_SLOT_ADD("exp4", XTAL(3'521'280)/2, vip_expansion_cards, nullptr)
+ MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(WRITELINE(*this, vp575_device, exp4_int_w))
+ MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(WRITELINE(*this, vp575_device, exp4_dma_out_w))
+ MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(WRITELINE(*this, vp575_device, exp4_dma_in_w))
+
+ MCFG_VIP_EXPANSION_SLOT_ADD("exp5", XTAL(3'521'280)/2, vip_expansion_cards, nullptr)
+ MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(WRITELINE(*this, vp575_device, exp5_int_w))
+ MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(WRITELINE(*this, vp575_device, exp5_dma_out_w))
+ MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(WRITELINE(*this, vp575_device, exp5_dma_in_w))
+MACHINE_CONFIG_END
@@ -110,13 +109,13 @@ void vp575_device::device_start()
// vip_program_r - program read
//-------------------------------------------------
-uint8_t vp575_device::vip_program_r(offs_t offset, int cs, int cdef, int *minh)
+uint8_t vp575_device::vip_program_r(address_space &space, offs_t offset, int cs, int cdef, int *minh)
{
uint8_t data = 0xff;
for (auto & elem : m_expansion_slot)
{
- data &= elem->program_r(offset, cs, cdef, minh);
+ data &= elem->program_r(space, offset, cs, cdef, minh);
}
return data;
@@ -127,11 +126,11 @@ uint8_t vp575_device::vip_program_r(offs_t offset, int cs, int cdef, int *minh)
// vip_program_w - program write
//-------------------------------------------------
-void vp575_device::vip_program_w(offs_t offset, uint8_t data, int cdef, int *minh)
+void vp575_device::vip_program_w(address_space &space, offs_t offset, uint8_t data, int cdef, int *minh)
{
for (auto & elem : m_expansion_slot)
{
- elem->program_w(offset, data, cdef, minh);
+ elem->program_w(space, offset, data, cdef, minh);
}
}
@@ -140,13 +139,13 @@ void vp575_device::vip_program_w(offs_t offset, uint8_t data, int cdef, int *min
// vip_io_r - I/O read
//-------------------------------------------------
-uint8_t vp575_device::vip_io_r(offs_t offset)
+uint8_t vp575_device::vip_io_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
for (auto & elem : m_expansion_slot)
{
- data &= elem->io_r(offset);
+ data &= elem->io_r(space, offset);
}
return data;
@@ -157,11 +156,11 @@ uint8_t vp575_device::vip_io_r(offs_t offset)
// vip_io_w - I/O write
//-------------------------------------------------
-void vp575_device::vip_io_w(offs_t offset, uint8_t data)
+void vp575_device::vip_io_w(address_space &space, offs_t offset, uint8_t data)
{
for (auto & elem : m_expansion_slot)
{
- elem->io_w(offset, data);
+ elem->io_w(space, offset, data);
}
}
@@ -170,13 +169,13 @@ void vp575_device::vip_io_w(offs_t offset, uint8_t data)
// vip_dma_r - DMA read
//-------------------------------------------------
-uint8_t vp575_device::vip_dma_r(offs_t offset)
+uint8_t vp575_device::vip_dma_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
for (auto & elem : m_expansion_slot)
{
- data &= elem->dma_r(offset);
+ data &= elem->dma_r(space, offset);
}
return data;
@@ -187,11 +186,11 @@ uint8_t vp575_device::vip_dma_r(offs_t offset)
// vip_dma_w - DMA write
//-------------------------------------------------
-void vp575_device::vip_dma_w(offs_t offset, uint8_t data)
+void vp575_device::vip_dma_w(address_space &space, offs_t offset, uint8_t data)
{
for (auto & elem : m_expansion_slot)
{
- elem->dma_w(offset, data);
+ elem->dma_w(space, offset, data);
}
}
@@ -270,9 +269,10 @@ int vp575_device::vip_ef4_r()
void vp575_device::vip_sc_w(int n, int sc)
{
+ address_space &space = machine().dummy_space();
for (auto & elem : m_expansion_slot)
{
- elem->sc_w(n, sc);
+ elem->sc_w(space, n, sc);
}
}
diff --git a/src/devices/bus/vip/vp575.h b/src/devices/bus/vip/vp575.h
index fb5c22f5628..41a18053276 100644
--- a/src/devices/bus/vip/vp575.h
+++ b/src/devices/bus/vip/vp575.h
@@ -34,12 +34,12 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_vip_expansion_card_interface overrides
- virtual uint8_t vip_program_r(offs_t offset, int cs, int cdef, int *minh) override;
- virtual void vip_program_w(offs_t offset, uint8_t data, int cdef, int *minh) override;
- virtual uint8_t vip_io_r(offs_t offset) override;
- virtual void vip_io_w(offs_t offset, uint8_t data) override;
- virtual uint8_t vip_dma_r(offs_t offset) override;
- virtual void vip_dma_w(offs_t offset, uint8_t data) override;
+ virtual uint8_t vip_program_r(address_space &space, offs_t offset, int cs, int cdef, int *minh) override;
+ virtual void vip_program_w(address_space &space, offs_t offset, uint8_t data, int cdef, int *minh) override;
+ virtual uint8_t vip_io_r(address_space &space, offs_t offset) override;
+ virtual void vip_io_w(address_space &space, offs_t offset, uint8_t data) override;
+ virtual uint8_t vip_dma_r(address_space &space, offs_t offset) override;
+ virtual void vip_dma_w(address_space &space, offs_t offset, uint8_t data) override;
virtual uint32_t vip_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) override;
virtual int vip_ef1_r() override;
virtual int vip_ef3_r() override;
diff --git a/src/devices/bus/vip/vp585.cpp b/src/devices/bus/vip/vp585.cpp
index 2112637ae6b..47a1115097a 100644
--- a/src/devices/bus/vip/vp585.cpp
+++ b/src/devices/bus/vip/vp585.cpp
@@ -105,7 +105,7 @@ void vp585_device::device_start()
// vip_io_w - I/O write
//-------------------------------------------------
-void vp585_device::vip_io_w(offs_t offset, uint8_t data)
+void vp585_device::vip_io_w(address_space &space, offs_t offset, uint8_t data)
{
if (offset == 0x02)
{
diff --git a/src/devices/bus/vip/vp585.h b/src/devices/bus/vip/vp585.h
index f32bf055e91..a3511def5d0 100644
--- a/src/devices/bus/vip/vp585.h
+++ b/src/devices/bus/vip/vp585.h
@@ -36,7 +36,7 @@ protected:
virtual void device_start() override;
// device_vip_expansion_card_interface overrides
- virtual void vip_io_w(offs_t offset, uint8_t data) override;
+ virtual void vip_io_w(address_space &space, offs_t offset, uint8_t data) override;
virtual int vip_ef3_r() override;
virtual int vip_ef4_r() override;
diff --git a/src/devices/bus/vip/vp590.cpp b/src/devices/bus/vip/vp590.cpp
index 3fd9185c5d1..0f7599f6f99 100644
--- a/src/devices/bus/vip/vp590.cpp
+++ b/src/devices/bus/vip/vp590.cpp
@@ -50,11 +50,10 @@ READ_LINE_MEMBER( vp590_device::gd_r )
//-------------------------------------------------
-// machine_config( vp590 )
+// MACHINE_CONFIG_START( vp590 )
//-------------------------------------------------
-void vp590_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(vp590_device::device_add_mconfig)
CDP1862(config, m_cgc, 7.15909_MHz_XTAL);
m_cgc->rdata_cb().set(FUNC(vp590_device::rd_r));
m_cgc->bdata_cb().set(FUNC(vp590_device::bd_r));
@@ -62,7 +61,7 @@ void vp590_device::device_add_mconfig(machine_config &config)
m_cgc->set_luminance(RES_R(510), RES_R(360), RES_K(1), RES_K(1.5)); // R3, R4, R5, R6
m_cgc->set_chrominance(RES_K(3.9), RES_K(10), RES_K(2), RES_K(3.3)); // R7, R8, R9, R10
m_cgc->set_screen(SCREEN_TAG);
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
@@ -159,7 +158,7 @@ void vp590_device::device_start()
// vip_program_w - program write
//-------------------------------------------------
-void vp590_device::vip_program_w(offs_t offset, uint8_t data, int cdef, int *minh)
+void vp590_device::vip_program_w(address_space &space, offs_t offset, uint8_t data, int cdef, int *minh)
{
if (offset >= 0xc000 && offset < 0xe000)
{
@@ -185,7 +184,7 @@ void vp590_device::vip_program_w(offs_t offset, uint8_t data, int cdef, int *min
// vip_io_w - I/O write
//-------------------------------------------------
-void vp590_device::vip_io_w(offs_t offset, uint8_t data)
+void vp590_device::vip_io_w(address_space &space, offs_t offset, uint8_t data)
{
switch (offset)
{
@@ -205,7 +204,7 @@ void vp590_device::vip_io_w(offs_t offset, uint8_t data)
// vip_dma_w - DMA write
//-------------------------------------------------
-void vp590_device::vip_dma_w(offs_t offset, uint8_t data)
+void vp590_device::vip_dma_w(address_space &space, offs_t offset, uint8_t data)
{
uint8_t mask = 0xff;
@@ -217,7 +216,7 @@ void vp590_device::vip_dma_w(offs_t offset, uint8_t data)
m_color = m_color_ram[offset & mask];
- m_cgc->dma_w(data);
+ m_cgc->dma_w(space, offset, data);
}
diff --git a/src/devices/bus/vip/vp590.h b/src/devices/bus/vip/vp590.h
index 230b7d8d02d..2dfdece5ab7 100644
--- a/src/devices/bus/vip/vp590.h
+++ b/src/devices/bus/vip/vp590.h
@@ -37,9 +37,9 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_vip_expansion_card_interface overrides
- virtual void vip_program_w(offs_t offset, uint8_t data, int cdef, int *minh) override;
- virtual void vip_io_w(offs_t offset, uint8_t data) override;
- virtual void vip_dma_w(offs_t offset, uint8_t data) override;
+ virtual void vip_program_w(address_space &space, offs_t offset, uint8_t data, int cdef, int *minh) override;
+ virtual void vip_io_w(address_space &space, offs_t offset, uint8_t data) override;
+ virtual void vip_dma_w(address_space &space, offs_t offset, uint8_t data) override;
virtual uint32_t vip_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) override;
virtual int vip_ef3_r() override;
virtual int vip_ef4_r() override;
diff --git a/src/devices/bus/vip/vp595.cpp b/src/devices/bus/vip/vp595.cpp
index 1dab7f4a49f..0d8e2306182 100644
--- a/src/devices/bus/vip/vp595.cpp
+++ b/src/devices/bus/vip/vp595.cpp
@@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(VP595, vp595_device, "vp595", "VP-595 Simple Sound")
//-------------------------------------------------
-// machine_config( vp595 )
+// MACHINE_CONFIG_START( vp595 )
//-------------------------------------------------
void vp595_device::device_add_mconfig(machine_config &config)
@@ -73,7 +73,7 @@ void vp595_device::device_start()
// vip_io_w - I/O write
//-------------------------------------------------
-void vp595_device::vip_io_w(offs_t offset, uint8_t data)
+void vp595_device::vip_io_w(address_space &space, offs_t offset, uint8_t data)
{
if (offset == 0x03)
{
diff --git a/src/devices/bus/vip/vp595.h b/src/devices/bus/vip/vp595.h
index 5c98b33fe7c..9de9c8a6071 100644
--- a/src/devices/bus/vip/vp595.h
+++ b/src/devices/bus/vip/vp595.h
@@ -35,7 +35,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_vip_expansion_card_interface overrides
- virtual void vip_io_w(offs_t offset, uint8_t data) override;
+ virtual void vip_io_w(address_space &space, offs_t offset, uint8_t data) override;
virtual void vip_q_w(int state) override;
private:
diff --git a/src/devices/bus/vip/vp620.cpp b/src/devices/bus/vip/vp620.cpp
index ba6a938f660..643a8856481 100644
--- a/src/devices/bus/vip/vp620.cpp
+++ b/src/devices/bus/vip/vp620.cpp
@@ -33,7 +33,7 @@ void vp620_device::kb_w(uint8_t data)
}
//-------------------------------------------------
-// machine_config( vp620 )
+// MACHINE_CONFIG_START( vp620 )
//-------------------------------------------------
void vp620_device::device_add_mconfig(machine_config &config)
diff --git a/src/devices/bus/vip/vp700.cpp b/src/devices/bus/vip/vp700.cpp
index f64574a23fc..4b7dbab2839 100644
--- a/src/devices/bus/vip/vp700.cpp
+++ b/src/devices/bus/vip/vp700.cpp
@@ -67,7 +67,7 @@ void vp700_device::device_start()
// vip_program_r - program read
//-------------------------------------------------
-uint8_t vp700_device::vip_program_r(offs_t offset, int cs, int cdef, int *minh)
+uint8_t vp700_device::vip_program_r(address_space &space, offs_t offset, int cs, int cdef, int *minh)
{
uint8_t data = 0xff;
diff --git a/src/devices/bus/vip/vp700.h b/src/devices/bus/vip/vp700.h
index 4927005742e..16e7cd2f78e 100644
--- a/src/devices/bus/vip/vp700.h
+++ b/src/devices/bus/vip/vp700.h
@@ -37,7 +37,7 @@ protected:
virtual void device_start() override;
// device_vip_expansion_card_interface overrides
- virtual uint8_t vip_program_r(offs_t offset, int cs, int cdef, int *minh) override;
+ virtual uint8_t vip_program_r(address_space &space, offs_t offset, int cs, int cdef, int *minh) override;
private:
required_memory_region m_rom;
diff --git a/src/devices/bus/vme/vme.cpp b/src/devices/bus/vme/vme.cpp
index 757874abae2..f6254e32366 100644
--- a/src/devices/bus/vme/vme.cpp
+++ b/src/devices/bus/vme/vme.cpp
@@ -329,36 +329,6 @@ void vme_device::install_device(vme_amod_t amod, offs_t start, offs_t end, read8
}
}
-void vme_device::install_device(vme_amod_t amod, offs_t start, offs_t end, read8sm_delegate rhandler, write8sm_delegate whandler, uint32_t mask)
-{
- LOG("%s %s AM%d D%02x\n", tag(), FUNCNAME, amod, m_prgwidth);
-
- LOG(" - width:%d\n", m_prgwidth);
-
- // TODO: support address modifiers and buscycles other than single access cycles
- switch(amod)
- {
- case A16_SC: break;
- case A24_SC: break;
- case A32_SC: break;
- default: fatalerror("VME D8: Non supported Address modifier: AM%02x\n", amod);
- }
-
- switch(m_prgwidth)
- {
- case 16:
- m_prgspace->install_readwrite_handler(start, end, rhandler, whandler, (uint16_t)(mask & 0x0000ffff));
- break;
- case 24:
- m_prgspace->install_readwrite_handler(start, end, rhandler, whandler, (uint32_t)(mask & 0x00ffffff));
- break;
- case 32:
- m_prgspace->install_readwrite_handler(start, end, rhandler, whandler, mask);
- break;
- default: fatalerror("VME D8: Bus width %d not supported\n", m_prgwidth);
- }
-}
-
// D16 bit devices in A16, A24 and A32
void vme_device::install_device(vme_amod_t amod, offs_t start, offs_t end, read16_delegate rhandler, write16_delegate whandler, uint32_t mask)
{
diff --git a/src/devices/bus/vme/vme.h b/src/devices/bus/vme/vme.h
index 755330f7689..a2b2ab944eb 100644
--- a/src/devices/bus/vme/vme.h
+++ b/src/devices/bus/vme/vme.h
@@ -57,6 +57,10 @@
#define VME_BUS_TAG "vme"
+// Callbacks to the board from the VME bus comes through here
+#define MCFG_VME_J1_CB(_devcb) \
+ downcast<vme_slot_device &>(*device).set_vme_j1_callback(DEVCB_##_devcb);
+
//void vme_slot1(device_slot_interface &device); // Disabled until we know how to combine a board driver and a slot device.
void vme_slots(device_slot_interface &device);
@@ -85,22 +89,9 @@ public:
};
// construction/destruction
- template <typename T>
- vme_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt, uint32_t slot_nbr, char const *bus_tag)
- : vme_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- set_vme_slot(bus_tag, tag);
- update_vme_chains(slot_nbr);
- }
-
vme_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // Callbacks to the board from the VME bus comes through here
- auto vme_j1_callback() { return m_vme_j1_callback.bind(); }
+ template <class Object> devcb_base &set_vme_j1_callback(Object &&cb) { return m_vme_j1_callback.set_callback(std::forward<Object>(cb)); }
void set_vme_slot(const char *tag, const char *slottag);
void update_vme_chains(uint32_t slot_nbr);
@@ -125,6 +116,18 @@ protected:
DECLARE_DEVICE_TYPE(VME, vme_device)
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_VME_DEVICE_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, VME, 0)
+
+#define MCFG_VME_CPU(_cputag) \
+ downcast<vme_device &>(*device).set_cputag(_cputag);
+
+#define MCFG_VME_BUS_OWNER_SPACES() \
+ downcast<vme_device &>(*device).use_owner_spaces();
class vme_card_interface;
@@ -182,7 +185,6 @@ public:
AMOD_STANDARD_SUPERVIS_BLK = 0x3F
};
void install_device(vme_amod_t amod, offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler, uint32_t mask);
- void install_device(vme_amod_t amod, offs_t start, offs_t end, read8sm_delegate rhandler, write8sm_delegate whandler, uint32_t mask);
// void install_device(vme_amod_t amod, offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler);
void install_device(vme_amod_t amod, offs_t start, offs_t end, read16_delegate rhandler, write16_delegate whandler, uint32_t mask);
void install_device(vme_amod_t amod, offs_t start, offs_t end, read32_delegate rhandler, write32_delegate whandler, uint32_t mask);
@@ -239,4 +241,15 @@ private:
device_vme_card_interface *m_next;
};
+#define MCFG_VME_SLOT_ADD(_tag, _slotnbr, _slot_intf,_def_slot) \
+ { std::string stag = "slot" + std::to_string(_slotnbr); \
+ MCFG_DEVICE_ADD(stag.c_str(), VME_SLOT, 0); \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false); \
+ downcast<vme_slot_device &>(*device).set_vme_slot(_tag, stag.c_str()); \
+ downcast<vme_slot_device &>(*device).update_vme_chains(_slotnbr); \
+ }
+
+#define MCFG_VME_SLOT_REMOVE(_tag) \
+ MCFG_DEVICE_REMOVE(_tag)
+
#endif // MAME_BUS_VME_VME_H
diff --git a/src/devices/bus/vme/vme_fccpu20.cpp b/src/devices/bus/vme/vme_fccpu20.cpp
index d6f5ab56d30..d6e6f075fe8 100644
--- a/src/devices/bus/vme/vme_fccpu20.cpp
+++ b/src/devices/bus/vme/vme_fccpu20.cpp
@@ -252,12 +252,11 @@ static DEVICE_INPUT_DEFAULTS_START( terminal )
DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_2 )
DEVICE_INPUT_DEFAULTS_END
-void vme_fccpu20_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(vme_fccpu20_device::device_add_mconfig)
/* basic machine hardware */
- M68020(config, m_maincpu, CLOCK50 / 3); /* Crytstal verified from picture HCI */
- m_maincpu->set_addrmap(AS_PROGRAM, &vme_fccpu20_device::cpu20_mem);
- m_maincpu->set_irq_acknowledge_callback("bim", FUNC(bim68153_device::iack));
+ MCFG_DEVICE_ADD("maincpu", M68020, CLOCK50 / 3) /* Crytstal verified from picture HCI */
+ MCFG_DEVICE_PROGRAM_MAP (cpu20_mem)
+ MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("bim", bim68153_device, iack)
/* PIT Parallel Interface and Timer device, assumed strapped for on board clock */
PIT68230(config, m_pit, CLOCK32 / 4); /* Crystal not verified */
@@ -313,60 +312,59 @@ void vme_fccpu20_device::device_add_mconfig(machine_config &config)
rs232_port_device &rs232p3(RS232_PORT(config, RS232P3_TAG, default_rs232_devices, nullptr));
rs232p3.rxd_handler().set(m_mpcc3, FUNC(mpcc68561_device::write_rx));
rs232p3.cts_handler().set(m_mpcc3, FUNC(mpcc68561_device::cts_w));
-}
+MACHINE_CONFIG_END
-void vme_fccpu20_card_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(vme_fccpu20_card_device::device_add_mconfig)
vme_fccpu20_device::device_add_mconfig(config);
-}
+MACHINE_CONFIG_END
// SYS68K/CPU-21S Part No.1 01 041 - 68020 CPU board + FPU 68881 at 12.5 MHz, 512 KB RAM
-void vme_fccpu21s_card_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(vme_fccpu21s_card_device::device_add_mconfig)
vme_fccpu20_device::device_add_mconfig(config);
- m_maincpu->set_clock(CLOCK50 / 4);
-}
+ MCFG_DEVICE_MODIFY("maincpu")
+ MCFG_DEVICE_CLOCK(CLOCK50 / 4)
+MACHINE_CONFIG_END
// SYS68K/CPU-21 Part No.1 01 001 - 68020 CPU board (CPU-20) + FPU 68881 at 16.7 MHz, 512 KB RAM
-void vme_fccpu21_card_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(vme_fccpu21_card_device::device_add_mconfig)
vme_fccpu20_device::device_add_mconfig(config);
- m_maincpu->set_clock(CLOCK50 / 3);
-}
+ MCFG_DEVICE_MODIFY("maincpu")
+ MCFG_DEVICE_CLOCK(CLOCK50 / 3)
+MACHINE_CONFIG_END
// SYS68K/CPU-21A Part No.1 01 011 - 68020 CPU board + FPU 68881 at 20 MHz, 512 KB RAM
-void vme_fccpu21a_card_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(vme_fccpu21a_card_device::device_add_mconfig)
vme_fccpu20_device::device_add_mconfig(config);
- m_maincpu->set_clock(CLOCK40 / 2);
-}
+ MCFG_DEVICE_MODIFY("maincpu")
+ MCFG_DEVICE_CLOCK(CLOCK40 / 2)
+MACHINE_CONFIG_END
// SYS68K/CPU-21YA Part No.1 01 061 - 68020 CPU board + FPU 68881 at 20 MHz, 2048 KB RAM
-void vme_fccpu21ya_card_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(vme_fccpu21ya_card_device::device_add_mconfig)
vme_fccpu20_device::device_add_mconfig(config);
- m_maincpu->set_clock(CLOCK40 / 2);
-}
+ MCFG_DEVICE_MODIFY("maincpu")
+ MCFG_DEVICE_CLOCK(CLOCK40 / 2)
+MACHINE_CONFIG_END
// SYS68K/CPU-21B Part No.1 01 021 - 68020 CPU board + FPU 68881 at 25 MHz, 512 KB RAM
-void vme_fccpu21b_card_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(vme_fccpu21b_card_device::device_add_mconfig)
vme_fccpu20_device::device_add_mconfig(config);
- m_maincpu->set_clock(CLOCK50 / 2);
-}
+ MCFG_DEVICE_MODIFY("maincpu")
+ MCFG_DEVICE_CLOCK(CLOCK50 / 2)
+MACHINE_CONFIG_END
// SYS68K/CPU-21YB Part No.1 01 071 - 68020 CPU board + FPU 68881 at 25 MHz, 2048 KB RAM
-void vme_fccpu21yb_card_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(vme_fccpu21yb_card_device::device_add_mconfig)
vme_fccpu20_device::device_add_mconfig(config);
- m_maincpu->set_clock(CLOCK50 / 2);
-}
+ MCFG_DEVICE_MODIFY("maincpu")
+ MCFG_DEVICE_CLOCK(CLOCK50 / 2)
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/vme/vme_fccpu20.h b/src/devices/bus/vme/vme_fccpu20.h
index 4be52d07477..bab05fd987f 100644
--- a/src/devices/bus/vme/vme_fccpu20.h
+++ b/src/devices/bus/vme/vme_fccpu20.h
@@ -54,8 +54,6 @@ protected:
emu_timer *m_arbiter_start; // Need a startup delay because it is hooked up to the sense inputs of the PIT
- required_device<cpu_device> m_maincpu;
-
private:
DECLARE_WRITE_LINE_MEMBER(bim_irq_callback);
@@ -70,6 +68,7 @@ private:
void cpu20_mem(address_map &map);
+ required_device<cpu_device> m_maincpu;
required_device<pit68230_device> m_pit;
required_device<bim68153_device> m_bim;
required_device<mpcc68561_device> m_mpcc;
diff --git a/src/devices/bus/vme/vme_hcpu30.h b/src/devices/bus/vme/vme_hcpu30.h
index b4e387ace22..98e0691b6fe 100644
--- a/src/devices/bus/vme/vme_hcpu30.h
+++ b/src/devices/bus/vme/vme_hcpu30.h
@@ -11,7 +11,7 @@
#include "machine/68230pit.h"
#include "machine/scnxx562.h"
#include "machine/terminal.h"
-#include "machine/wd33c9x.h"
+#include "machine/wd33c93.h"
DECLARE_DEVICE_TYPE(VME_HCPU30, vme_hcpu30_card_device)
diff --git a/src/devices/bus/vme/vme_mvme350.cpp b/src/devices/bus/vme/vme_mvme350.cpp
index b433620b6fe..f1bb9d5dc46 100644
--- a/src/devices/bus/vme/vme_mvme350.cpp
+++ b/src/devices/bus/vme/vme_mvme350.cpp
@@ -189,14 +189,13 @@ ROM_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void vme_mvme350_card_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(vme_mvme350_card_device::device_add_mconfig)
/* basic machine hardware */
- m68010_device &cpu(M68010(config, MVME350_CPU_TAG, XTAL(10'000'000)));
- cpu.set_addrmap(AS_PROGRAM, &vme_mvme350_card_device::mvme350_mem);
+ MCFG_DEVICE_ADD (MVME350_CPU_TAG, M68010, XTAL(10'000'000))
+ MCFG_DEVICE_PROGRAM_MAP (mvme350_mem)
/* PIT Parallel Interface and Timer device, assuming strapped for on board clock */
- PIT68230(config, "pit", XTAL(16'000'000) / 2);
-}
+ MCFG_DEVICE_ADD("pit", PIT68230, XTAL(16'000'000) / 2)
+MACHINE_CONFIG_END
const tiny_rom_entry *vme_mvme350_card_device::device_rom_region() const
{
diff --git a/src/devices/bus/vme/vme_mzr8105.cpp b/src/devices/bus/vme/vme_mzr8105.cpp
index fe63e92ee28..985f6bad905 100644
--- a/src/devices/bus/vme/vme_mzr8105.cpp
+++ b/src/devices/bus/vme/vme_mzr8105.cpp
@@ -36,13 +36,13 @@ DEFINE_DEVICE_TYPE(VME_MZR8105, vme_mzr8105_card_device, "mzr8105", "Mizar 8105
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void vme_mzr8105_card_device::device_add_mconfig(machine_config &config)
+MACHINE_CONFIG_START(vme_mzr8105_card_device::device_add_mconfig)
{
- M68000(config, m_maincpu, XTAL(10'000'000))
- m_maincpu->set_addrmap(AS_PROGRAM, &vme_mzr8105_card_device::mzr8105_mem);
-
- VME(config, "vme", 0).use_owner_spaces();
- VME_SLOT(config, "slot1", mzr8105_vme_cards, "mzr8300", 1, "vme");
+ MCFG_DEVICE_ADD ("maincpu", M68000, XTAL(10'000'000))
+ MCFG_DEVICE_PROGRAM_MAP (mzr8105_mem)
+ MCFG_VME_DEVICE_ADD("vme")
+ MCFG_VME_BUS_OWNER_SPACES()
+ MCFG_VME_SLOT_ADD ("vme", 1, mzr8105_vme_cards, "mzr8300")
}
vme_mzr8105_card_device::vme_mzr8105_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
diff --git a/src/devices/bus/vme/vme_mzr8300.cpp b/src/devices/bus/vme/vme_mzr8300.cpp
index 362beef2546..ca00a00a674 100644
--- a/src/devices/bus/vme/vme_mzr8300.cpp
+++ b/src/devices/bus/vme/vme_mzr8300.cpp
@@ -187,8 +187,8 @@ void vme_mzr8300_card_device::device_start()
read8_delegate(FUNC(z80sio_device::ca_r), subdevice<z80sio_device>("sio0")),
write8_delegate(FUNC(z80sio_device::ca_w), subdevice<z80sio_device>("sio0")), 0x00ff);
m_vme->install_device(vme_device::A16_SC, base + 0x10, base + 0x13, // Am9513
- read8sm_delegate(FUNC(am9513_device::read8), subdevice<am9513_device>("stc")),
- write8sm_delegate(FUNC(am9513_device::write8), subdevice<am9513_device>("stc")), 0x00ff);
+ read8_delegate(FUNC(am9513_device::read8), subdevice<am9513_device>("stc")),
+ write8_delegate(FUNC(am9513_device::write8), subdevice<am9513_device>("stc")), 0x00ff);
}
void vme_mzr8300_card_device::device_reset()
diff --git a/src/devices/bus/vsmile/pad.cpp b/src/devices/bus/vsmile/pad.cpp
deleted file mode 100644
index a301c65b9e2..00000000000
--- a/src/devices/bus/vsmile/pad.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz, Vas Crabb
-
-#include "emu.h"
-#include "pad.h"
-
-#include <algorithm>
-
-//#define VERBOSE 1
-#include "logmacro.h"
-
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(VSMILE_PAD, vsmile_pad_device, "vsmile_pad", "V.Smile Joystick")
-
-
-//**************************************************************************
-// V.Smile control pad
-//**************************************************************************
-
-DECLARE_ENUM_BITWISE_OPERATORS(vsmile_pad_device::stale_inputs)
-ALLOW_SAVE_TYPE(vsmile_pad_device::stale_inputs);
-
-vsmile_pad_device::vsmile_pad_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
- : vsmile_ctrl_device_base(mconfig, VSMILE_PAD, tag, owner, clock)
- , m_io_joy(*this, "JOY")
- , m_io_colors(*this, "COLORS")
- , m_io_buttons(*this, "BUTTONS")
- , m_idle_timer(nullptr)
- , m_sent_joy(0x00U)
- , m_sent_colors(0x00U)
- , m_sent_buttons(0x00U)
- , m_stale(STALE_ALL)
- , m_active(false)
-{
- std::fill(std::begin(m_ctrl_probe_history), std::end(m_ctrl_probe_history), 0U);
-}
-
-vsmile_pad_device::~vsmile_pad_device()
-{
-}
-
-void vsmile_pad_device::device_start()
-{
- vsmile_ctrl_device_base::device_start();
-
- m_idle_timer = machine().scheduler().timer_alloc(
- timer_expired_delegate(FUNC(vsmile_pad_device::handle_idle), this));
- m_idle_timer->adjust(attotime::from_seconds(1));
-
- m_sent_joy = 0x00U;
- m_sent_colors = 0x00U;
- m_sent_buttons = 0x00U;
- m_stale = STALE_ALL;
- m_active = false;
-
- save_item(NAME(m_sent_joy));
- save_item(NAME(m_sent_colors));
- save_item(NAME(m_sent_buttons));
- save_item(NAME(m_stale));
- save_item(NAME(m_active));
- save_item(NAME(m_ctrl_probe_history));
-}
-
-void vsmile_pad_device::tx_complete()
-{
- // update joystick
- if ((m_stale & STALE_JOY) != STALE_NONE)
- {
- m_sent_joy = m_io_joy->read();
- if ((m_stale & STALE_UP_DOWN) != STALE_NONE)
- {
- if (BIT(m_sent_joy, 0))
- uart_tx_fifo_push(0x87); // up
- else if (BIT(m_sent_joy, 1))
- uart_tx_fifo_push(0x8f); // down
- else
- uart_tx_fifo_push(0x80);
- }
- if ((m_stale & STALE_LEFT_RIGHT) != STALE_NONE)
- {
- if (BIT(m_sent_joy, 2))
- uart_tx_fifo_push(0xcf); // left
- else if (BIT(m_sent_joy, 3))
- uart_tx_fifo_push(0xc7); // right
- else
- uart_tx_fifo_push(0xc0);
- }
- }
-
- // update colors
- if ((m_stale & STALE_COLORS) != STALE_NONE)
- {
- m_sent_colors = m_io_colors->read();
- uart_tx_fifo_push(0x90 | m_sent_colors);
- }
-
- // update buttons
- if ((m_stale & STALE_BUTTONS) != STALE_NONE)
- {
- m_sent_buttons = m_io_buttons->read();
- if (((m_stale & STALE_OK) != STALE_NONE) && BIT(m_sent_buttons, 0))
- uart_tx_fifo_push(0xa1);
- if (((m_stale & STALE_QUIT) != STALE_NONE) && BIT(m_sent_buttons, 1))
- uart_tx_fifo_push(0xa2);
- if (((m_stale & STALE_HELP) != STALE_NONE) && BIT(m_sent_buttons, 2))
- uart_tx_fifo_push(0xa3);
- if (((m_stale & STALE_ABC) != STALE_NONE) && BIT(m_sent_buttons, 3))
- uart_tx_fifo_push(0xa4);
- if (!m_sent_buttons)
- uart_tx_fifo_push(0xa0);
- }
-
- // if nothing happens in the next second we'll queue a keep-alive
- if (!m_active)
- LOG("entered active state\n");
- m_idle_timer->adjust(attotime::from_seconds(1));
- m_active = true;
- m_stale = STALE_NONE;
-}
-
-void vsmile_pad_device::tx_timeout()
-{
- if (m_active)
- {
- m_idle_timer->reset();
- m_active = false;
- m_stale = STALE_ALL;
- std::fill(std::begin(m_ctrl_probe_history), std::end(m_ctrl_probe_history), 0U);
- LOG("left active state\n");
- }
- uart_tx_fifo_push(0x55);
-}
-
-void vsmile_pad_device::rx_complete(uint8_t data, bool select)
-{
- if (select)
- {
- if (((data & 0xf0) == 0x70) || ((data & 0xf0) == 0xb0))
- {
- m_ctrl_probe_history[0] = ((data & 0xf0) == 0x70) ? 0 : m_ctrl_probe_history[1];
- m_ctrl_probe_history[1] = data;
- uint8_t const response = ((m_ctrl_probe_history[0] + m_ctrl_probe_history[1] + 0x0f) & 0x0f) ^ 0x05;
- LOG(
- "%s: received probe %02X, %02X, sending response %02X\n",
- machine().describe_context(),
- m_ctrl_probe_history[0],
- m_ctrl_probe_history[1],
- 0xb0 | response);
- uart_tx_fifo_push(0xb0 | response);
- }
- }
-}
-
-void vsmile_pad_device::uart_tx_fifo_push(uint8_t data)
-{
- m_idle_timer->reset();
- queue_tx(data);
-}
-
-TIMER_CALLBACK_MEMBER(vsmile_pad_device::handle_idle)
-{
- LOG("idle timer expired, sending keep-alive 55\n");
- queue_tx(0x55);
-}
-
-INPUT_CHANGED_MEMBER(vsmile_pad_device::pad_joy_changed)
-{
- if (m_active)
- {
- if (!is_tx_empty())
- {
- LOG("joy changed while transmission in progress, marking stale\n");
- m_stale |= stale_inputs(uintptr_t(param));
- }
- else
- {
- uint8_t const joy = m_io_joy->read();
- if ((joy ^ m_sent_joy) & 0x03)
- {
- if (BIT(joy, 0))
- uart_tx_fifo_push(0x87); // up
- else if (BIT(joy, 1))
- uart_tx_fifo_push(0x8f); // down
- else
- uart_tx_fifo_push(0x80);
- }
- if ((joy ^ m_sent_joy) & 0x0c)
- {
- if (BIT(joy, 2))
- uart_tx_fifo_push(0xcf); // left
- else if (BIT(joy, 3))
- uart_tx_fifo_push(0xc7); // right
- else
- uart_tx_fifo_push(0xc0);
- }
- m_sent_joy = joy;
- }
- }
-}
-
-INPUT_CHANGED_MEMBER(vsmile_pad_device::pad_color_changed)
-{
- if (m_active)
- {
- if (!is_tx_empty())
- {
- LOG("colors changed while transmission in progress, marking stale\n");
- m_stale |= STALE_COLORS;
- }
- else
- {
- m_sent_colors = m_io_colors->read();
- uart_tx_fifo_push(0x90 | m_sent_colors);
- }
- }
-}
-
-INPUT_CHANGED_MEMBER(vsmile_pad_device::pad_button_changed)
-{
- if (m_active)
- {
- if (!is_tx_empty())
- {
- LOG("buttons changed while transmission in progress, marking stale\n");
- m_stale |= stale_inputs(uintptr_t(param));
- }
- else
- {
- uint8_t const buttons = m_io_buttons->read();
- if (BIT((m_sent_buttons ^ buttons) & buttons, 0))
- uart_tx_fifo_push(0xa1);
- if (BIT((m_sent_buttons ^ buttons) & buttons, 1))
- uart_tx_fifo_push(0xa2);
- if (BIT((m_sent_buttons ^ buttons) & buttons, 2))
- uart_tx_fifo_push(0xa3);
- if (BIT((m_sent_buttons ^ buttons) & buttons, 3))
- uart_tx_fifo_push(0xa4);
- if (!buttons)
- uart_tx_fifo_push(0xa0);
- m_sent_buttons = buttons;
- }
- }
-}
-
-static INPUT_PORTS_START( vsmile_pad )
- PORT_START("JOY")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_pad_device, pad_joy_changed, vsmile_pad_device::STALE_UP_DOWN) PORT_NAME("Joypad Up")
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_pad_device, pad_joy_changed, vsmile_pad_device::STALE_UP_DOWN) PORT_NAME("Joypad Down")
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_pad_device, pad_joy_changed, vsmile_pad_device::STALE_LEFT_RIGHT) PORT_NAME("Joypad Left")
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_pad_device, pad_joy_changed, vsmile_pad_device::STALE_LEFT_RIGHT) PORT_NAME("Joypad Right")
- PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
-
- PORT_START("COLORS")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_pad_device, pad_color_changed, vsmile_pad_device::STALE_COLORS) PORT_NAME("Green")
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_pad_device, pad_color_changed, vsmile_pad_device::STALE_COLORS) PORT_NAME("Blue")
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_pad_device, pad_color_changed, vsmile_pad_device::STALE_COLORS) PORT_NAME("Yellow")
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_pad_device, pad_color_changed, vsmile_pad_device::STALE_COLORS) PORT_NAME("Red")
- PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
-
- PORT_START("BUTTONS")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_pad_device, pad_button_changed, vsmile_pad_device::STALE_OK) PORT_NAME("OK")
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_pad_device, pad_button_changed, vsmile_pad_device::STALE_QUIT) PORT_NAME("Quit")
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_pad_device, pad_button_changed, vsmile_pad_device::STALE_HELP) PORT_NAME("Help")
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_pad_device, pad_button_changed, vsmile_pad_device::STALE_ABC) PORT_NAME("ABC")
- PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
-INPUT_PORTS_END
-
-ioport_constructor vsmile_pad_device::device_input_ports() const
-{
- return INPUT_PORTS_NAME( vsmile_pad );
-}
diff --git a/src/devices/bus/vsmile/pad.h b/src/devices/bus/vsmile/pad.h
deleted file mode 100644
index 5e2515c2b58..00000000000
--- a/src/devices/bus/vsmile/pad.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz, Vas Crabb
-#ifndef MAME_BUS_VSMILE_PAD_H
-#define MAME_BUS_VSMILE_PAD_H
-
-#pragma once
-
-#include "vsmile_ctrl.h"
-
-/***************************************************************************
- TYPE DEFINITIONS
- ***************************************************************************/
-
-// ======================> vsmile_pad_device
-
-class vsmile_pad_device : public vsmile_ctrl_device_base
-{
-public:
- enum stale_inputs : uint8_t
- {
- STALE_NONE = 0U,
- STALE_LEFT_RIGHT = 1U << 0,
- STALE_UP_DOWN = 1U << 1,
- STALE_COLORS = 1U << 2,
- STALE_OK = 1U << 3,
- STALE_QUIT = 1U << 4,
- STALE_HELP = 1U << 5,
- STALE_ABC = 1U << 6,
-
- STALE_JOY = STALE_LEFT_RIGHT | STALE_UP_DOWN,
- STALE_BUTTONS = STALE_OK | STALE_QUIT | STALE_HELP | STALE_ABC,
- STALE_ALL = STALE_JOY | STALE_COLORS | STALE_BUTTONS
- };
-
- // construction/destruction
- vsmile_pad_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U);
- virtual ~vsmile_pad_device();
-
- // input handlers
- DECLARE_INPUT_CHANGED_MEMBER(pad_joy_changed);
- DECLARE_INPUT_CHANGED_MEMBER(pad_color_changed);
- DECLARE_INPUT_CHANGED_MEMBER(pad_button_changed);
-
-protected:
- // device_t implementation
- virtual ioport_constructor device_input_ports() const override;
- virtual void device_start() override;
-
- // vsmile_ctrl_device_base implementation
- virtual void tx_complete() override;
- virtual void tx_timeout() override;
- virtual void rx_complete(uint8_t data, bool cts) override;
-
-private:
- void uart_tx_fifo_push(uint8_t data);
-
- TIMER_CALLBACK_MEMBER(handle_idle);
-
- required_ioport m_io_joy;
- required_ioport m_io_colors;
- required_ioport m_io_buttons;
-
- emu_timer *m_idle_timer;
-
- uint8_t m_sent_joy, m_sent_colors, m_sent_buttons;
- stale_inputs m_stale;
- bool m_active;
- uint8_t m_ctrl_probe_history[2];
-};
-
-
-/***************************************************************************
- DEVICE TYPES
- ***************************************************************************/
-
-DECLARE_DEVICE_TYPE(VSMILE_PAD, vsmile_pad_device)
-
-#endif // MAME_BUS_VSMILE_PAD_H
diff --git a/src/devices/bus/vsmile/rom.cpp b/src/devices/bus/vsmile/rom.cpp
deleted file mode 100644
index 584a8cfe058..00000000000
--- a/src/devices/bus/vsmile/rom.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-/***********************************************************************************************************
-
- V.Smile cart emulation
-
- We support standard carts and one with on-board NVRAM
-
- ***********************************************************************************************************/
-
-
-#include "emu.h"
-#include "rom.h"
-
-
-//-------------------------------------------------
-// vsmile_rom_device - constructor
-//-------------------------------------------------
-
-DEFINE_DEVICE_TYPE(VSMILE_ROM_STD, vsmile_rom_device, "vsmile_rom", "V.Smile Cart")
-DEFINE_DEVICE_TYPE(VSMILE_ROM_NVRAM, vsmile_rom_nvram_device, "vsmile_rom_nvram", "V.Smile Cart + NVRAM")
-
-
-vsmile_rom_device::vsmile_rom_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_vsmile_cart_interface(mconfig, *this)
-{
-}
-
-vsmile_rom_device::vsmile_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : vsmile_rom_device(mconfig, VSMILE_ROM_STD, tag, owner, clock)
-{
-}
-
-vsmile_rom_nvram_device::vsmile_rom_nvram_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
- : vsmile_rom_device(mconfig, type, tag, owner, clock)
-{
-}
-
-vsmile_rom_nvram_device::vsmile_rom_nvram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : vsmile_rom_nvram_device(mconfig, VSMILE_ROM_NVRAM, tag, owner, clock)
-{
-}
-
-
-//-------------------------------------------------
-// mapper specific start/reset
-//-------------------------------------------------
-
-void vsmile_rom_device::device_start()
-{
- save_item(NAME(m_bank_offset));
-}
-
-void vsmile_rom_device::device_reset()
-{
- m_bank_offset = 0;
-}
-
-
-/*-------------------------------------------------
- Cart with NVRAM
- -------------------------------------------------*/
-
-READ16_MEMBER(vsmile_rom_nvram_device::bank2_r)
-{
- if (!m_nvram.empty() && offset < m_nvram.size())
- return m_nvram[offset];
- else // this cannot actually happen...
- return 0;
-}
-
-WRITE16_MEMBER(vsmile_rom_nvram_device::bank2_w)
-{
- if (!m_nvram.empty() && offset < m_nvram.size())
- COMBINE_DATA(&m_nvram[offset]);
-}
-
-/*-------------------------------------------------
- CS2 bankswitching
- -------------------------------------------------*/
-
-void vsmile_rom_device::set_cs2(bool cs2)
-{
- m_bank_offset = cs2 ? 0x400000 : 0x000000;
-}
diff --git a/src/devices/bus/vsmile/rom.h b/src/devices/bus/vsmile/rom.h
deleted file mode 100644
index ec39f1f743e..00000000000
--- a/src/devices/bus/vsmile/rom.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-#ifndef MAME_BUS_VSMILE_ROM_H
-#define MAME_BUS_VSMILE_ROM_H
-
-#pragma once
-
-#include "vsmile_slot.h"
-
-// ======================> vsmile_rom_device
-
-class vsmile_rom_device : public device_t, public device_vsmile_cart_interface
-{
-public:
- // construction/destruction
- vsmile_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- // reading and writing
- virtual DECLARE_READ16_MEMBER(bank0_r) override { return m_rom[m_bank_offset + 0x000000 + offset]; }
- virtual DECLARE_READ16_MEMBER(bank1_r) override { return m_rom[m_bank_offset + 0x100000 + offset]; }
- virtual DECLARE_READ16_MEMBER(bank2_r) override { return m_rom[m_bank_offset + 0x200000 + offset]; }
- virtual DECLARE_READ16_MEMBER(bank3_r) override { return m_rom[m_bank_offset + 0x300000 + offset]; }
-
- // banking
- virtual void set_cs2(bool cs2) override;
-
-protected:
- vsmile_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
- uint32_t m_bank_offset;
-};
-
-
-// ======================> vsmile_rom_nvram_device
-
-class vsmile_rom_nvram_device : public vsmile_rom_device
-{
-public:
- // construction/destruction
- vsmile_rom_nvram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- virtual DECLARE_READ16_MEMBER(bank2_r) override;
- virtual DECLARE_WRITE16_MEMBER(bank2_w) override;
-
-protected:
- vsmile_rom_nvram_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-};
-
-
-// device type definition
-DECLARE_DEVICE_TYPE(VSMILE_ROM_STD, vsmile_rom_device)
-DECLARE_DEVICE_TYPE(VSMILE_ROM_NVRAM, vsmile_rom_nvram_device)
-
-
-#endif // MAME_BUS_VSMILE_ROM_H
diff --git a/src/devices/bus/vsmile/vsmile_ctrl.cpp b/src/devices/bus/vsmile/vsmile_ctrl.cpp
deleted file mode 100644
index a8cbf25278b..00000000000
--- a/src/devices/bus/vsmile/vsmile_ctrl.cpp
+++ /dev/null
@@ -1,315 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Vas Crabb
-
-#include "emu.h"
-#include "vsmile_ctrl.h"
-
-#include <algorithm>
-#include <cassert>
-
-//#define VERBOSE 1
-#include "logmacro.h"
-
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(VSMILE_CTRL_PORT, vsmile_ctrl_port_device, "vsmile_ctrl_port", "V.Smile Controller Port")
-
-
-//**************************************************************************
-// V.Smile controller interface
-//**************************************************************************
-
-device_vsmile_ctrl_interface::device_vsmile_ctrl_interface(const machine_config &mconfig, device_t &device)
- : device_slot_card_interface(mconfig, device)
- , m_port(dynamic_cast<vsmile_ctrl_port_device *>(device.owner()))
-{
-}
-
-device_vsmile_ctrl_interface::~device_vsmile_ctrl_interface()
-{
-}
-
-void device_vsmile_ctrl_interface::interface_validity_check(validity_checker &valid) const
-{
- device_slot_card_interface::interface_validity_check(valid);
-
- if (device().owner() && !m_port)
- {
- osd_printf_error(
- "Owner device %s (%s) is not a vsmile_ctrl_port_device\n",
- device().owner()->tag(),
- device().owner()->name());
- }
-}
-
-void device_vsmile_ctrl_interface::interface_pre_start()
-{
- device_slot_card_interface::interface_pre_start();
-
- if (m_port && !m_port->started())
- throw device_missing_dependencies();
-}
-
-
-//**************************************************************************
-// V.Smile controller port
-//**************************************************************************
-
-vsmile_ctrl_port_device::vsmile_ctrl_port_device(
- machine_config const &mconfig,
- char const *tag,
- device_t *owner,
- uint32_t clock)
- : device_t(mconfig, VSMILE_CTRL_PORT, tag, owner, clock)
- , device_slot_interface(mconfig, *this)
- , m_rts_cb(*this)
- , m_data_cb(*this)
-{
-}
-
-vsmile_ctrl_port_device::~vsmile_ctrl_port_device()
-{
-}
-
-void vsmile_ctrl_port_device::device_validity_check(validity_checker &valid) const
-{
- device_t *const card(get_card_device());
- if (card && !dynamic_cast<device_vsmile_ctrl_interface *>(card))
- {
- osd_printf_error(
- "Card device %s (%s) does not implement device_vsmile_ctrl_interface\n",
- card->tag(),
- card->name());
- }
-}
-
-void vsmile_ctrl_port_device::device_resolve_objects()
-{
- device_vsmile_ctrl_interface *const card(dynamic_cast<device_vsmile_ctrl_interface *>(get_card_device()));
- if (card)
- m_device = card;
-
- m_rts_cb.resolve_safe();
- m_data_cb.resolve_safe();
-}
-
-void vsmile_ctrl_port_device::device_start()
-{
- device_t *const card(get_card_device());
- if (card)
- {
- if (!m_device)
- {
- throw emu_fatalerror(
- "vsmile_ctrl_port_device: card device %s (%s) does not implement device_vsmile_ctrl_interface\n",
- card->tag(),
- card->name());
- }
- else
- {
- m_device->select_w(0);
- }
- }
-}
-
-
-//**************************************************************************
-// V.Smile controller HLE base
-//**************************************************************************
-
-vsmile_ctrl_device_base::vsmile_ctrl_device_base(
- machine_config const &mconfig,
- device_type type,
- char const *tag,
- device_t *owner,
- uint32_t clock)
- : device_t(mconfig, type, tag, owner, clock)
- , device_vsmile_ctrl_interface(mconfig, *this)
- , m_tx_timer(nullptr)
- , m_rts_timer(nullptr)
- , m_tx_fifo_head(0U)
- , m_tx_fifo_tail(0U)
- , m_tx_fifo_empty(true)
- , m_tx_active(false)
- , m_select(false)
-{
- std::fill(std::begin(m_tx_fifo), std::end(m_tx_fifo), 0);
-}
-
-vsmile_ctrl_device_base::~vsmile_ctrl_device_base()
-{
-}
-
-void vsmile_ctrl_device_base::device_start()
-{
- // allocate a timer to limit transmit rate to something realistic
- m_tx_timer = machine().scheduler().timer_alloc(
- timer_expired_delegate(FUNC(vsmile_ctrl_device_base::tx_timer_expired), this));
-
- // allocate a timer for RTS timeouts
- m_rts_timer = machine().scheduler().timer_alloc(
- timer_expired_delegate(FUNC(vsmile_ctrl_device_base::rts_timer_expired), this));
-
- // start with transmit queue empty
- m_tx_fifo_head = m_tx_fifo_tail = 0U;
- m_tx_fifo_empty = true;
- m_tx_active = false;
-
- // register for save states
- save_item(NAME(m_tx_fifo));
- save_item(NAME(m_tx_fifo_head));
- save_item(NAME(m_tx_fifo_tail));
- save_item(NAME(m_tx_fifo_empty));
- save_item(NAME(m_select));
-}
-
-bool vsmile_ctrl_device_base::queue_tx(uint8_t data)
-{
- // return false on overrun and drop byte
- bool const was_empty(m_tx_fifo_empty);
- if (!was_empty && (m_tx_fifo_head == m_tx_fifo_tail))
- {
- LOG(
- "%s: discarding byte %02X because FIFO is full (length %u, Tx %sactive)\n",
- machine().describe_context(),
- data,
- ARRAY_LENGTH(m_tx_fifo),
- m_tx_active ? "" : "in");
- return false;
- }
-
- // queue the byte
- m_tx_fifo[m_tx_fifo_tail] = data;
- m_tx_fifo_tail = (m_tx_fifo_tail + 1) % ARRAY_LENGTH(m_tx_fifo);
- m_tx_fifo_empty = false;
-
- // assert RTS and start transmitting if necessary
- if (was_empty)
- {
- rts_out(1);
- if (m_select)
- {
- LOG("%s: transmitting byte %02X immediately (Tx was %sactive)\n", machine().describe_context(), data, m_tx_active ? "" : "in");
- m_tx_active = true;
- m_tx_timer->adjust(attotime::from_hz(9600 / 10));
- }
- else
- {
- LOG("%s: asserting RTS to transmit byte %02X\n", machine().describe_context(), data);
- m_rts_timer->adjust(attotime::from_msec(500));
- }
- }
- else
- {
- unsigned const fifo_used((m_tx_fifo_tail + ARRAY_LENGTH(m_tx_fifo) - m_tx_fifo_head) % ARRAY_LENGTH(m_tx_fifo));
- LOG("%s: queued byte %02X (%u bytes queued, Tx %sactive)\n", machine().describe_context(), data, fifo_used, m_tx_active ? "" : "in");
- }
-
- // data was queued
- return true;
-}
-
-void vsmile_ctrl_device_base::select_w(int state)
-{
- if (bool(state) != m_select)
- {
- if (state && !m_tx_fifo_empty && !m_tx_active)
- {
- m_rts_timer->reset();
- unsigned const fifo_used((m_tx_fifo_tail + ARRAY_LENGTH(m_tx_fifo) - m_tx_fifo_head) % ARRAY_LENGTH(m_tx_fifo));
- LOG("%s: select asserted, starting transmission (%u bytes queued)\n", machine().describe_context(), fifo_used);
- m_tx_active = true;
- m_tx_timer->adjust(attotime::from_hz(9600 / 10));
- }
- else
- {
- LOG("%s: select %sasserted (Tx %sactive)\n", machine().describe_context(), state ? "" : "de", m_tx_active ? "" : "in");
- }
- m_select = bool(state);
- }
-}
-
-void vsmile_ctrl_device_base::data_w(uint8_t data)
-{
- LOG(
- "%s: received byte %02X (select %sasserted, Tx %sactive)\n",
- machine().describe_context(),
- data,
- m_select ? "" : "de",
- m_tx_active ? "" : "in");
- rx_complete(data, m_select);
-}
-
-TIMER_CALLBACK_MEMBER(vsmile_ctrl_device_base::tx_timer_expired)
-{
- assert(!m_tx_fifo_empty);
- assert(m_tx_active);
-
- // deliver the byte to the host (bits have shifted out now)
- uint8_t const data(m_tx_fifo[m_tx_fifo_head]);
- m_tx_fifo_head = (m_tx_fifo_head + 1) % ARRAY_LENGTH(m_tx_fifo);
- if (m_tx_fifo_head == m_tx_fifo_tail)
- m_tx_fifo_empty = true;
- data_out(data);
-
- // if queue is drained give implmentation a chance to queue more before dropping RTS
- if (m_tx_fifo_empty)
- {
- LOG("transmitted byte %02X, queue empty (select %sasserted)\n", data, m_select ? "" : "de");
- tx_complete();
- }
- else
- {
- unsigned const fifo_used((m_tx_fifo_tail + ARRAY_LENGTH(m_tx_fifo) - m_tx_fifo_head) % ARRAY_LENGTH(m_tx_fifo));
- LOG("transmitted byte %02X (%u bytes queued, select %sasserted)\n", data, fifo_used, m_select ? "" : "de");
- }
-
- // drop RTS if no more data, otherwise keep transmitting if CTS is still high
- if (m_tx_fifo_empty)
- {
- LOG("nothing to transmit, deasserting RTS\n");
- m_tx_active = false;
- rts_out(0);
- }
- else if (m_select)
- {
- LOG("select asserted, transmitting next byte %02X\n", m_tx_fifo[m_tx_fifo_head]);
- m_tx_timer->adjust(attotime::from_hz(9600 / 10));
- }
- else
- {
- LOG("select deasserted, waiting to transmit\n");
- m_tx_active = false;
- m_rts_timer->adjust(attotime::from_msec(500));
- }
-}
-
-
-TIMER_CALLBACK_MEMBER(vsmile_ctrl_device_base::rts_timer_expired)
-{
- assert(!m_tx_fifo_empty);
- assert(!m_tx_active);
-
- // clear out anything queued and let the implementation deal with it
- if (!m_tx_fifo_empty)
- {
- unsigned const fifo_used((m_tx_fifo_tail + ARRAY_LENGTH(m_tx_fifo) - m_tx_fifo_head) % ARRAY_LENGTH(m_tx_fifo));
- LOG("timeout waiting for select after asserting RTS (%u bytes queued)\n", fifo_used);
- m_tx_fifo_head = m_tx_fifo_tail = 0U;
- m_tx_fifo_empty = true;
- tx_timeout();
- if (m_tx_fifo_empty)
- rts_out(0);
- }
-}
-
-
-#include "pad.h"
-
-void vsmile_controllers(device_slot_interface &device)
-{
- device.option_add("joy", VSMILE_PAD);
-}
diff --git a/src/devices/bus/vsmile/vsmile_ctrl.h b/src/devices/bus/vsmile/vsmile_ctrl.h
deleted file mode 100644
index 66921ce817a..00000000000
--- a/src/devices/bus/vsmile/vsmile_ctrl.h
+++ /dev/null
@@ -1,153 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Vas Crabb
-#ifndef MAME_BUS_VSMILE_VSMILE_CTRL_H
-#define MAME_BUS_VSMILE_VSMILE_CTRL_H
-
-#pragma once
-
-
-/***************************************************************************
- FORWARD DECLARATIONS
- ***************************************************************************/
-
-class vsmile_ctrl_port_device;
-
-
-/***************************************************************************
- TYPE DEFINITIONS
- ***************************************************************************/
-
-// ======================> device_vsmile_ctrl_interface
-
-class device_vsmile_ctrl_interface : public device_slot_card_interface
-{
-public:
- virtual ~device_vsmile_ctrl_interface();
-
-protected:
- device_vsmile_ctrl_interface(machine_config const &mconfig, device_t &device);
-
- // device_interface implementation
- virtual void interface_validity_check(validity_checker &valid) const override ATTR_COLD;
- virtual void interface_pre_start() override;
-
- // otuput signals
- void rts_out(int state);
- void data_out(uint8_t data);
-
-private:
- // input signal handlers for implementataions to override
- virtual void select_w(int state) = 0;
- virtual void data_w(uint8_t data) = 0;
-
- vsmile_ctrl_port_device *const m_port;
-
- friend class vsmile_ctrl_port_device;
-};
-
-
-// ======================> vsmile_ctrl_port_device
-
-class vsmile_ctrl_port_device : public device_t, public device_slot_interface
-{
-public:
- // configuration
- auto rts_cb() { return m_rts_cb.bind(); }
- auto data_cb() { return m_data_cb.bind(); }
-
- // construction/destruction
- template <typename T>
- vsmile_ctrl_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : vsmile_ctrl_port_device(mconfig, tag, owner, 0U)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- vsmile_ctrl_port_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U);
- virtual ~vsmile_ctrl_port_device();
-
- // input signals
- void select_w(int state) { if (m_device) m_device->select_w(state); }
- void data_w(uint8_t data) { if (m_device) m_device->data_w(data); }
-
-protected:
- // device_t implementation
- virtual void device_validity_check(validity_checker &valid) const override ATTR_COLD;
- virtual void device_resolve_objects() override;
- virtual void device_start() override;
-
-private:
- device_vsmile_ctrl_interface *m_device;
- devcb_write_line m_rts_cb;
- devcb_write8 m_data_cb;
-
- friend class device_vsmile_ctrl_interface;
-};
-
-
-// ======================> vsmile_ctrl_device_base
-
-class vsmile_ctrl_device_base : public device_t, public device_vsmile_ctrl_interface
-{
-public:
- // destruction
- virtual ~vsmile_ctrl_device_base();
-
-protected:
- // construction
- vsmile_ctrl_device_base(machine_config const &mconfig, device_type type, char const *tag, device_t *owner, uint32_t clock);
-
- // device_t implementation
- virtual void device_start() override;
-
- // UART simulation helpers
- bool is_tx_empty() const { return m_tx_fifo_empty; }
- bool queue_tx(uint8_t data);
-
-private:
- // device_vsmile_ctrl_interfaceA implementation
- virtual void select_w(int state) override;
- virtual void data_w(uint8_t data) override;
-
- // UART simulation handlers
- virtual void tx_complete() = 0;
- virtual void tx_timeout() = 0;
- virtual void rx_complete(uint8_t data, bool select) = 0;
-
- // internal helpers
- TIMER_CALLBACK_MEMBER(tx_timer_expired);
- TIMER_CALLBACK_MEMBER(rts_timer_expired);
-
- emu_timer *m_tx_timer, *m_rts_timer;
-
- uint8_t m_tx_fifo[32];
- uint8_t m_tx_fifo_head, m_tx_fifo_tail;
- bool m_tx_fifo_empty, m_tx_active;
- bool m_select;
-};
-
-
-/***************************************************************************
- INLINE FUNCTIONS
- ***************************************************************************/
-
-inline void device_vsmile_ctrl_interface::rts_out(int state) { m_port->m_rts_cb(state); }
-inline void device_vsmile_ctrl_interface::data_out(uint8_t data) { m_port->m_data_cb(data); }
-
-
-/***************************************************************************
- FUNCTIONS
- ***************************************************************************/
-
-void vsmile_controllers(device_slot_interface &device);
-
-
-/***************************************************************************
- DEVICE TYPES
- ***************************************************************************/
-
-DECLARE_DEVICE_TYPE(VSMILE_CTRL_PORT, vsmile_ctrl_port_device)
-
-#endif // MAME_BUS_VSMILE_VSMILE_CTRL_H
diff --git a/src/devices/bus/vsmile/vsmile_slot.cpp b/src/devices/bus/vsmile/vsmile_slot.cpp
deleted file mode 100644
index 61d7873b63f..00000000000
--- a/src/devices/bus/vsmile/vsmile_slot.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-/***********************************************************************************************************
-
- V.Smile cart emulation
- (through slot devices)
-
- ***********************************************************************************************************/
-
-
-#include "emu.h"
-#include "vsmile_slot.h"
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(VSMILE_CART_SLOT, vsmile_cart_slot_device, "vsmile_cart_slot", "V.Smile Cartridge Slot")
-
-//**************************************************************************
-// V.Smile cartridge interface
-//**************************************************************************
-
-//-------------------------------------------------
-// device_vsmile_cart_interface - constructor
-//-------------------------------------------------
-
-device_vsmile_cart_interface::device_vsmile_cart_interface(const machine_config &mconfig, device_t &device)
- : device_slot_card_interface(mconfig, device)
- , m_rom(nullptr)
- , m_rom_size(0)
-{
-}
-
-
-//-------------------------------------------------
-// ~device_vsmile_cart_interface - destructor
-//-------------------------------------------------
-
-device_vsmile_cart_interface::~device_vsmile_cart_interface()
-{
-}
-
-//-------------------------------------------------
-// rom_alloc - alloc the space for the cart
-//-------------------------------------------------
-
-void device_vsmile_cart_interface::rom_alloc(uint32_t size, const char *tag)
-{
- if (m_rom == nullptr)
- {
- // We always alloc 8MB of ROM region
- m_rom = (uint16_t *)device().machine().memory().region_alloc(std::string(tag).append(VSMILE_SLOT_ROM_REGION_TAG).c_str(), size, 2, ENDIANNESS_BIG)->base();
- m_rom_size = size;
- }
-}
-
-
-//-------------------------------------------------
-// nvram_alloc - alloc the space for the nvram
-//-------------------------------------------------
-
-void device_vsmile_cart_interface::nvram_alloc(uint32_t size)
-{
- m_nvram.resize(size / sizeof(uint16_t));
-}
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// vsmile_cart_slot_device - constructor
-//-------------------------------------------------
-vsmile_cart_slot_device::vsmile_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, VSMILE_CART_SLOT, tag, owner, clock),
- device_image_interface(mconfig, *this),
- device_slot_interface(mconfig, *this),
- m_type(VSMILE_STD),
- m_cart(nullptr)
-{
-}
-
-
-//-------------------------------------------------
-// vsmile_cart_slot_device - destructor
-//-------------------------------------------------
-
-vsmile_cart_slot_device::~vsmile_cart_slot_device()
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void vsmile_cart_slot_device::device_start()
-{
- m_cart = dynamic_cast<device_vsmile_cart_interface *>(get_card_device());
-}
-
-
-//-------------------------------------------------
-// V.Smile PCB
-//-------------------------------------------------
-
-struct vsmile_slot
-{
- int pcb_id;
- const char *slot_option;
-};
-
-// Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it
-static const vsmile_slot slot_list[] =
-{
- { VSMILE_STD, "vsmile_rom" },
- { VSMILE_NVRAM, "vsmile_nvram" },
-};
-
-static int vsmile_get_pcb_id(const char *slot)
-{
- for (auto & elem : slot_list)
- {
- if (!core_stricmp(elem.slot_option, slot))
- return elem.pcb_id;
- }
-
- return 0;
-}
-
-/*-------------------------------------------------
- call load
- -------------------------------------------------*/
-
-image_init_result vsmile_cart_slot_device::call_load()
-{
- if (m_cart)
- {
- uint32_t size = loaded_through_softlist() ? get_software_region_length("rom") : length();
- if (size > 0x1000000)
- {
- seterror(IMAGE_ERROR_UNSPECIFIED, "Attempted loading a cart larger than 16MB");
- return image_init_result::FAIL;
- }
-
- m_cart->rom_alloc(size, tag());
- uint8_t *rom = (uint8_t *)m_cart->get_rom_base();
-
- if (!loaded_through_softlist())
- {
- fread(rom, size);
- m_type = VSMILE_STD;
- }
- else
- {
- const char *pcb_name = get_feature("slot");
-
- memcpy(rom, get_software_region("rom"), size);
-
- if (pcb_name)
- m_type = vsmile_get_pcb_id(pcb_name);
-
- osd_printf_info("V.Smile: Detected (XML) %s\n", pcb_name ? pcb_name : "NONE");
- }
-
- if (m_type == VSMILE_NVRAM)
- {
- m_cart->nvram_alloc(0x200000);
- }
-
- if (m_cart->get_nvram_size())
- {
- battery_load(m_cart->get_nvram_base(), m_cart->get_nvram_size(), 0x00);
- }
-
- return image_init_result::PASS;
- }
-
- return image_init_result::PASS;
-}
-
-
-/*-------------------------------------------------
- call_unload
- -------------------------------------------------*/
-
-void vsmile_cart_slot_device::call_unload()
-{
- if (m_cart && m_cart->get_nvram_size())
- {
- battery_save(m_cart->get_nvram_base(), m_cart->get_nvram_size());
- }
-}
-
-
-/*-------------------------------------------------
- get default card software
- -------------------------------------------------*/
-
-std::string vsmile_cart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const
-{
- return software_get_default_slot("vsmile_rom");
-}
-
-
-/*-------------------------------------------------
- cart accessors
- -------------------------------------------------*/
-
-READ16_MEMBER(vsmile_cart_slot_device::bank0_r)
-{
- return m_cart->bank0_r(space, offset, mem_mask);
-}
-
-READ16_MEMBER(vsmile_cart_slot_device::bank1_r)
-{
- return m_cart->bank1_r(space, offset, mem_mask);
-}
-
-READ16_MEMBER(vsmile_cart_slot_device::bank2_r)
-{
- return m_cart->bank2_r(space, offset, mem_mask);
-}
-
-READ16_MEMBER(vsmile_cart_slot_device::bank3_r)
-{
- return m_cart->bank3_r(space, offset, mem_mask);
-}
-
-WRITE16_MEMBER(vsmile_cart_slot_device::bank0_w)
-{
- m_cart->bank0_w(space, offset, data, mem_mask);
-}
-
-WRITE16_MEMBER(vsmile_cart_slot_device::bank1_w)
-{
- m_cart->bank1_w(space, offset, data, mem_mask);
-}
-
-WRITE16_MEMBER(vsmile_cart_slot_device::bank2_w)
-{
- m_cart->bank2_w(space, offset, data, mem_mask);
-}
-
-WRITE16_MEMBER(vsmile_cart_slot_device::bank3_w)
-{
- m_cart->bank3_w(space, offset, data, mem_mask);
-}
-
-void vsmile_cart_slot_device::set_cs2(bool cs2)
-{
- m_cart->set_cs2(cs2);
-}
diff --git a/src/devices/bus/vsmile/vsmile_slot.h b/src/devices/bus/vsmile/vsmile_slot.h
deleted file mode 100644
index 7d800677214..00000000000
--- a/src/devices/bus/vsmile/vsmile_slot.h
+++ /dev/null
@@ -1,128 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-#ifndef MAME_BUS_VSMILE_VSMILE_SLOT_H
-#define MAME_BUS_VSMILE_VSMILE_SLOT_H
-
-#pragma once
-
-#include "softlist_dev.h"
-
-
-/***************************************************************************
- TYPE DEFINITIONS
- ***************************************************************************/
-
-#define VSMILE_SLOT_ROM_REGION_TAG ":cart:rom"
-
-enum
-{
- VSMILE_STD = 0,
- VSMILE_NVRAM
-};
-
-// ======================> device_vsmile_cart_interface
-
-class device_vsmile_cart_interface : public device_slot_card_interface
-{
-public:
- // construction/destruction
- virtual ~device_vsmile_cart_interface();
-
- // reading and writing
- virtual DECLARE_READ16_MEMBER(bank0_r) { return 0; }
- virtual DECLARE_READ16_MEMBER(bank1_r) { return 0; }
- virtual DECLARE_READ16_MEMBER(bank2_r) { return 0; }
- virtual DECLARE_READ16_MEMBER(bank3_r) { return 0; }
- virtual DECLARE_WRITE16_MEMBER(bank0_w) { }
- virtual DECLARE_WRITE16_MEMBER(bank1_w) { }
- virtual DECLARE_WRITE16_MEMBER(bank2_w) { }
- virtual DECLARE_WRITE16_MEMBER(bank3_w) { }
-
- // banking
- virtual void set_cs2(bool cs2) = 0;
-
- void rom_alloc(uint32_t size, const char *tag);
- void nvram_alloc(uint32_t size);
- uint16_t* get_rom_base() { return m_rom; }
- uint16_t* get_nvram_base() { return &m_nvram[0]; }
- uint32_t get_rom_size() { return m_rom_size; }
- uint32_t get_nvram_size() { return m_nvram.size() * sizeof(uint16_t); }
- void set_rom_size(uint32_t val) { m_rom_size = val; }
-
- void save_nvram() { device().save_item(NAME(m_nvram)); }
-
-protected:
- device_vsmile_cart_interface(const machine_config &mconfig, device_t &device);
-
- // internal state
- uint16_t *m_rom; // this points to the cart rom region
- uint32_t m_rom_size; // this is the actual game size, not the rom region size!
- std::vector<uint16_t> m_nvram;
-};
-
-
-// ======================> vsmile_cart_slot_device
-
-class vsmile_cart_slot_device : public device_t,
- public device_image_interface,
- public device_slot_interface
-{
-public:
- // construction/destruction
- template <typename T>
- vsmile_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : vsmile_cart_slot_device(mconfig, tag, owner, (uint32_t)0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- vsmile_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual ~vsmile_cart_slot_device();
-
- // device-level overrides
- virtual void device_start() override;
-
- // image-level overrides
- virtual image_init_result call_load() override;
- virtual void call_unload() override;
- virtual const software_list_loader &get_software_list_loader() const override { return rom_software_list_loader::instance(); }
-
- void save_nvram() { if (m_cart && m_cart->get_nvram_size()) m_cart->save_nvram(); }
- uint32_t get_rom_size() { if (m_cart) return m_cart->get_rom_size(); return 0; }
-
- virtual iodevice_t image_type() const override { return IO_CARTSLOT; }
- virtual bool is_readable() const override { return 1; }
- virtual bool is_writeable() const override { return 0; }
- virtual bool is_creatable() const override { return 0; }
- virtual bool must_be_loaded() const override { return 0; }
- virtual bool is_reset_on_load() const override { return 1; }
- virtual const char *image_interface() const override { return "vsmile_cart"; }
- virtual const char *file_extensions() const override { return "u1,u3,bin"; }
-
- // slot interface overrides
- virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
-
- // reading and writing
- virtual DECLARE_READ16_MEMBER(bank0_r);
- virtual DECLARE_READ16_MEMBER(bank1_r);
- virtual DECLARE_READ16_MEMBER(bank2_r);
- virtual DECLARE_READ16_MEMBER(bank3_r);
- virtual DECLARE_WRITE16_MEMBER(bank0_w);
- virtual DECLARE_WRITE16_MEMBER(bank1_w);
- virtual DECLARE_WRITE16_MEMBER(bank2_w);
- virtual DECLARE_WRITE16_MEMBER(bank3_w);
-
- // banking
- void set_cs2(bool cs2);
-
-protected:
- int m_type;
- device_vsmile_cart_interface* m_cart;
-};
-
-// device type definition
-DECLARE_DEVICE_TYPE(VSMILE_CART_SLOT, vsmile_cart_slot_device)
-
-#endif // MAME_BUS_VSMILE_VSMILE_SLOT_H
diff --git a/src/devices/bus/vtech/ioexp/ioexp.cpp b/src/devices/bus/vtech/ioexp/ioexp.cpp
index 897b0dba95b..c2916a0ba14 100644
--- a/src/devices/bus/vtech/ioexp/ioexp.cpp
+++ b/src/devices/bus/vtech/ioexp/ioexp.cpp
@@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(VTECH_IOEXP_SLOT, vtech_ioexp_slot_device, "vtech_ioexp_slot"
vtech_ioexp_slot_device::vtech_ioexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, VTECH_IOEXP_SLOT, tag, owner, clock),
device_slot_interface(mconfig, *this),
- m_io(*this, finder_base::DUMMY_TAG, -1),
+ m_io(nullptr),
m_cart(nullptr)
{
}
@@ -59,6 +59,15 @@ void vtech_ioexp_slot_device::device_reset()
{
}
+//-------------------------------------------------
+// set_io_space - set address space we are attached to
+//-------------------------------------------------
+
+void vtech_ioexp_slot_device::set_io_space(address_space *io)
+{
+ m_io = io;
+}
+
//**************************************************************************
// CARTRIDGE INTERFACE
diff --git a/src/devices/bus/vtech/ioexp/ioexp.h b/src/devices/bus/vtech/ioexp/ioexp.h
index 9a78f861478..0c2a3d2d431 100644
--- a/src/devices/bus/vtech/ioexp/ioexp.h
+++ b/src/devices/bus/vtech/ioexp/ioexp.h
@@ -54,14 +54,14 @@ public:
vtech_ioexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~vtech_ioexp_slot_device();
- template <typename T> void set_io_space(T &&tag, int spacenum) { m_io.set_tag(std::forward<T>(tag), spacenum); }
+ void set_io_space(address_space *io);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- required_address_space m_io;
+ address_space *m_io;
device_vtech_ioexp_interface *m_cart;
};
diff --git a/src/devices/bus/vtech/ioexp/printer.cpp b/src/devices/bus/vtech/ioexp/printer.cpp
index b927f41d3c4..66967668703 100644
--- a/src/devices/bus/vtech/ioexp/printer.cpp
+++ b/src/devices/bus/vtech/ioexp/printer.cpp
@@ -23,14 +23,11 @@ DEFINE_DEVICE_TYPE(VTECH_PRINTER_INTERFACE, vtech_printer_interface_device, "vte
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void vtech_printer_interface_device::device_add_mconfig(machine_config &config)
-{
- CENTRONICS(config, m_centronics, centronics_devices, "printer");
- m_centronics->busy_handler().set(FUNC(vtech_printer_interface_device::busy_w));
-
- OUTPUT_LATCH(config, m_latch);
- m_centronics->set_output_latch(*m_latch);
-}
+MACHINE_CONFIG_START(vtech_printer_interface_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer")
+ MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, vtech_printer_interface_device, busy_w))
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("latch", "centronics")
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/bus/vtech/memexp/floppy.cpp b/src/devices/bus/vtech/memexp/floppy.cpp
index 5807588ec27..bf7a3175594 100644
--- a/src/devices/bus/vtech/memexp/floppy.cpp
+++ b/src/devices/bus/vtech/memexp/floppy.cpp
@@ -107,6 +107,9 @@ void vtech_floppy_controller_device::device_start()
void vtech_floppy_controller_device::device_reset()
{
+ m_memexp->set_io_space(&io_space());
+ m_memexp->set_program_space(&program_space());
+
program_space().install_rom(0x4000, 0x5fff, memregion("software")->base());
io_space().install_device(0x10, 0x1f, *this, &vtech_floppy_controller_device::map);
diff --git a/src/devices/bus/vtech/memexp/memexp.cpp b/src/devices/bus/vtech/memexp/memexp.cpp
index 90f51da7345..e7f61e5d048 100644
--- a/src/devices/bus/vtech/memexp/memexp.cpp
+++ b/src/devices/bus/vtech/memexp/memexp.cpp
@@ -30,8 +30,8 @@ DEFINE_DEVICE_TYPE(VTECH_MEMEXP_SLOT, vtech_memexp_slot_device, "vtech_memexp_sl
vtech_memexp_slot_device::vtech_memexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, VTECH_MEMEXP_SLOT, tag, owner, clock),
device_slot_interface(mconfig, *this),
- m_program(*this, finder_base::DUMMY_TAG, -1),
- m_io(*this, finder_base::DUMMY_TAG, -1),
+ m_program(nullptr),
+ m_io(nullptr),
m_cart(nullptr),
m_int_handler(*this),
m_nmi_handler(*this),
@@ -48,28 +48,6 @@ vtech_memexp_slot_device::~vtech_memexp_slot_device()
}
//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void vtech_memexp_slot_device::device_config_complete()
-{
- // for passthrough connectors, use the parent slot's spaces
- if (dynamic_cast<device_vtech_memexp_interface *>(owner()) != nullptr)
- {
- auto parent = dynamic_cast<vtech_memexp_slot_device *>(owner()->owner());
- if (parent != nullptr)
- {
- if (m_program.finder_tag() == finder_base::DUMMY_TAG)
- m_program.set_tag(parent->m_program, parent->m_program.spacenum());
- if (m_io.finder_tag() == finder_base::DUMMY_TAG)
- m_io.set_tag(parent->m_io, parent->m_io.spacenum());
- }
- }
-}
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -89,6 +67,24 @@ void vtech_memexp_slot_device::device_reset()
{
}
+//-------------------------------------------------
+// set_program_space - set address space we are attached to
+//-------------------------------------------------
+
+void vtech_memexp_slot_device::set_program_space(address_space *program)
+{
+ m_program = program;
+}
+
+//-------------------------------------------------
+// set_io_space - set address space we are attached to
+//-------------------------------------------------
+
+void vtech_memexp_slot_device::set_io_space(address_space *io)
+{
+ m_io = io;
+}
+
//**************************************************************************
// CARTRIDGE INTERFACE
diff --git a/src/devices/bus/vtech/memexp/memexp.h b/src/devices/bus/vtech/memexp/memexp.h
index ca096075e90..097036bfd92 100644
--- a/src/devices/bus/vtech/memexp/memexp.h
+++ b/src/devices/bus/vtech/memexp/memexp.h
@@ -61,8 +61,8 @@ public:
vtech_memexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~vtech_memexp_slot_device();
- template <typename T> void set_program_space(T &&tag, int spacenum) { m_program.set_tag(std::forward<T>(tag), spacenum); }
- template <typename T> void set_io_space(T &&tag, int spacenum) { m_io.set_tag(std::forward<T>(tag), spacenum); }
+ void set_program_space(address_space *program);
+ void set_io_space(address_space *io);
// callbacks
auto int_handler() { return m_int_handler.bind(); }
@@ -76,12 +76,11 @@ public:
protected:
// device-level overrides
- virtual void device_config_complete() override;
virtual void device_start() override;
virtual void device_reset() override;
- required_address_space m_program;
- required_address_space m_io;
+ address_space *m_program;
+ address_space *m_io;
device_vtech_memexp_interface *m_cart;
diff --git a/src/devices/bus/wangpc/emb.cpp b/src/devices/bus/wangpc/emb.cpp
index 8a1817d1666..8f555391bea 100644
--- a/src/devices/bus/wangpc/emb.cpp
+++ b/src/devices/bus/wangpc/emb.cpp
@@ -85,7 +85,7 @@ void wangpc_emb_device::device_reset()
// wangpcbus_mrdc_r - memory read
//-------------------------------------------------
-uint16_t wangpc_emb_device::wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_emb_device::wangpcbus_mrdc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -105,7 +105,7 @@ uint16_t wangpc_emb_device::wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_amwc_w - memory write
//-------------------------------------------------
-void wangpc_emb_device::wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_emb_device::wangpcbus_amwc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
for (int bank = 0; bank < 4; bank++)
{
@@ -121,7 +121,7 @@ void wangpc_emb_device::wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint1
// wangpcbus_iorc_r - I/O read
//-------------------------------------------------
-uint16_t wangpc_emb_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_emb_device::wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -149,7 +149,7 @@ uint16_t wangpc_emb_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_aiowc_w - I/O write
//-------------------------------------------------
-void wangpc_emb_device::wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_emb_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
if (sad(offset))
{
diff --git a/src/devices/bus/wangpc/emb.h b/src/devices/bus/wangpc/emb.h
index 1e175ae6867..bdaa7698b51 100644
--- a/src/devices/bus/wangpc/emb.h
+++ b/src/devices/bus/wangpc/emb.h
@@ -34,10 +34,10 @@ protected:
virtual void device_reset() override;
// device_wangpcbus_card_interface overrides
- virtual uint16_t wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
- virtual uint16_t wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint16_t wangpcbus_mrdc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_amwc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint16_t wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
private:
optional_shared_ptr<uint16_t> m_ram;
diff --git a/src/devices/bus/wangpc/lic.cpp b/src/devices/bus/wangpc/lic.cpp
index f56c673fd26..30694d7d7c8 100644
--- a/src/devices/bus/wangpc/lic.cpp
+++ b/src/devices/bus/wangpc/lic.cpp
@@ -50,9 +50,9 @@ const tiny_rom_entry *wangpc_lic_device::device_rom_region() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void wangpc_lic_device::device_add_mconfig(machine_config &config)
-{
-}
+MACHINE_CONFIG_START(wangpc_lic_device::device_add_mconfig)
+MACHINE_CONFIG_END
+
//**************************************************************************
@@ -92,7 +92,7 @@ void wangpc_lic_device::device_reset()
// wangpcbus_mrdc_r - memory read
//-------------------------------------------------
-uint16_t wangpc_lic_device::wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_lic_device::wangpcbus_mrdc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -104,7 +104,7 @@ uint16_t wangpc_lic_device::wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_amwc_w - memory write
//-------------------------------------------------
-void wangpc_lic_device::wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_lic_device::wangpcbus_amwc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
}
@@ -113,7 +113,7 @@ void wangpc_lic_device::wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint1
// wangpcbus_iorc_r - I/O read
//-------------------------------------------------
-uint16_t wangpc_lic_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_lic_device::wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -135,7 +135,7 @@ uint16_t wangpc_lic_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_aiowc_w - I/O write
//-------------------------------------------------
-void wangpc_lic_device::wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_lic_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
if (sad(offset))
{
diff --git a/src/devices/bus/wangpc/lic.h b/src/devices/bus/wangpc/lic.h
index 8ead2c65f0a..f3a27f0bc77 100644
--- a/src/devices/bus/wangpc/lic.h
+++ b/src/devices/bus/wangpc/lic.h
@@ -36,10 +36,10 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_wangpcbus_card_interface overrides
- virtual uint16_t wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
- virtual uint16_t wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint16_t wangpcbus_mrdc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_amwc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint16_t wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
};
diff --git a/src/devices/bus/wangpc/lvc.cpp b/src/devices/bus/wangpc/lvc.cpp
index 0d316e5b15b..f4d05b8827d 100644
--- a/src/devices/bus/wangpc/lvc.cpp
+++ b/src/devices/bus/wangpc/lvc.cpp
@@ -113,17 +113,16 @@ WRITE_LINE_MEMBER( wangpc_lvc_device::vsync_w )
}
//-------------------------------------------------
-// machine_config( wangpc_lvc )
+// MACHINE_CONFIG_START( wangpc_lvc )
//-------------------------------------------------
-void wangpc_lvc_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER));
- screen.set_screen_update(MC6845_TAG, FUNC(mc6845_device::screen_update));
- screen.set_size(80*8, 25*9);
- screen.set_visarea(0, 80*8-1, 0, 25*9-1);
- screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500));
- screen.set_refresh_hz(60);
+MACHINE_CONFIG_START(wangpc_lvc_device::device_add_mconfig)
+ MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update)
+ MCFG_SCREEN_SIZE(80*8, 25*9)
+ MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 25*9-1)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
+ MCFG_SCREEN_REFRESH_RATE(60)
MC6845_1(config, m_crtc, XTAL(14'318'181)/16);
m_crtc->set_screen(SCREEN_TAG);
@@ -131,7 +130,7 @@ void wangpc_lvc_device::device_add_mconfig(machine_config &config)
m_crtc->set_char_width(8);
m_crtc->set_update_row_callback(FUNC(wangpc_lvc_device::crtc_update_row), this);
m_crtc->out_vsync_callback().set(FUNC(wangpc_lvc_device::vsync_w));
-}
+MACHINE_CONFIG_END
@@ -203,7 +202,7 @@ void wangpc_lvc_device::device_reset()
// wangpcbus_mrdc_r - memory read
//-------------------------------------------------
-uint16_t wangpc_lvc_device::wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_lvc_device::wangpcbus_mrdc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -222,7 +221,7 @@ uint16_t wangpc_lvc_device::wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_amwc_w - memory write
//-------------------------------------------------
-void wangpc_lvc_device::wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_lvc_device::wangpcbus_amwc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
if (OPTION_VRAM && (offset >= 0xe0000/2) && (offset < 0xf0000/2))
{
@@ -237,7 +236,7 @@ void wangpc_lvc_device::wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint1
// wangpcbus_iorc_r - I/O read
//-------------------------------------------------
-uint16_t wangpc_lvc_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_lvc_device::wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -246,7 +245,7 @@ uint16_t wangpc_lvc_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
switch (offset & 0x7f)
{
case 0x02/2:
- data = 0xff00 | m_crtc->register_r();
+ data = 0xff00 | m_crtc->register_r(space, 0);
break;
case 0x30/2:
@@ -270,7 +269,7 @@ uint16_t wangpc_lvc_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_aiowc_w - I/O write
//-------------------------------------------------
-void wangpc_lvc_device::wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_lvc_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
if (sad(offset))
{
@@ -279,14 +278,14 @@ void wangpc_lvc_device::wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint
case 0x00/2:
if (ACCESSING_BITS_0_7)
{
- m_crtc->address_w(data & 0xff);
+ m_crtc->address_w(space, 0, data & 0xff);
}
break;
case 0x02/2:
if (ACCESSING_BITS_0_7)
{
- m_crtc->register_w(data & 0xff);
+ m_crtc->register_w(space, 0, data & 0xff);
}
break;
diff --git a/src/devices/bus/wangpc/lvc.h b/src/devices/bus/wangpc/lvc.h
index 3fa858adf1c..7b4f9203007 100644
--- a/src/devices/bus/wangpc/lvc.h
+++ b/src/devices/bus/wangpc/lvc.h
@@ -36,10 +36,10 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_wangpcbus_card_interface overrides
- virtual uint16_t wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
- virtual uint16_t wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint16_t wangpcbus_mrdc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_amwc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint16_t wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
private:
MC6845_UPDATE_ROW( crtc_update_row );
diff --git a/src/devices/bus/wangpc/mcc.cpp b/src/devices/bus/wangpc/mcc.cpp
index 5b029ed38d2..d5c8bf4b941 100644
--- a/src/devices/bus/wangpc/mcc.cpp
+++ b/src/devices/bus/wangpc/mcc.cpp
@@ -52,7 +52,7 @@ DEFINE_DEVICE_TYPE(WANGPC_MCC, wangpc_mcc_device, "wangpc_mcc", "Wang PC-PM043 M
//-------------------------------------------------
-// machine_config( wangpc_mcc )
+// MACHINE_CONFIG_START( wangpc_mcc )
//-------------------------------------------------
void wangpc_mcc_device::device_add_mconfig(machine_config &config)
@@ -129,7 +129,7 @@ void wangpc_mcc_device::device_reset()
// wangpcbus_iorc_r - I/O read
//-------------------------------------------------
-uint16_t wangpc_mcc_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_mcc_device::wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -143,7 +143,7 @@ uint16_t wangpc_mcc_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
case 0x06/2:
if (ACCESSING_BITS_0_7)
{
- data = 0xff00 | m_sio->cd_ba_r(machine().dummy_space(), offset >> 1);
+ data = 0xff00 | m_sio->cd_ba_r(space, offset >> 1);
}
break;
@@ -153,7 +153,7 @@ uint16_t wangpc_mcc_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
case 0x0e/2:
if (ACCESSING_BITS_0_7)
{
- data = 0xff00 | m_dart->cd_ba_r(machine().dummy_space(), offset >> 1);
+ data = 0xff00 | m_dart->cd_ba_r(space, offset >> 1);
}
break;
@@ -198,7 +198,7 @@ uint16_t wangpc_mcc_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_aiowc_w - I/O write
//-------------------------------------------------
-void wangpc_mcc_device::wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_mcc_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
if (sad(offset) && ACCESSING_BITS_0_7)
{
@@ -208,14 +208,14 @@ void wangpc_mcc_device::wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint
case 0x02/2:
case 0x04/2:
case 0x06/2:
- m_sio->cd_ba_w(machine().dummy_space(), offset >> 1, data & 0xff);
+ m_sio->cd_ba_w(space, offset >> 1, data & 0xff);
break;
case 0x08/2:
case 0x0a/2:
case 0x0c/2:
case 0x0e/2:
- m_dart->cd_ba_w(machine().dummy_space(), offset >> 1, data & 0xff);
+ m_dart->cd_ba_w(space, offset >> 1, data & 0xff);
break;
case 0x12/2:
diff --git a/src/devices/bus/wangpc/mcc.h b/src/devices/bus/wangpc/mcc.h
index 58b8931f5fa..d09f2e23cba 100644
--- a/src/devices/bus/wangpc/mcc.h
+++ b/src/devices/bus/wangpc/mcc.h
@@ -36,8 +36,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_wangpcbus_card_interface overrides
- virtual uint16_t wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint16_t wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
private:
inline void set_irq(int state);
diff --git a/src/devices/bus/wangpc/mvc.cpp b/src/devices/bus/wangpc/mvc.cpp
index af78d16cc29..79999d72ade 100644
--- a/src/devices/bus/wangpc/mvc.cpp
+++ b/src/devices/bus/wangpc/mvc.cpp
@@ -133,17 +133,16 @@ WRITE_LINE_MEMBER( wangpc_mvc_device::vsync_w )
}
//-------------------------------------------------
-// machine_config( wangpc_mvc )
+// MACHINE_CONFIG_START( wangpc_mvc )
//-------------------------------------------------
-void wangpc_mvc_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER));
- screen.set_screen_update(MC6845_TAG, FUNC(mc6845_device::screen_update));
- screen.set_size(80*10, 25*12);
- screen.set_visarea(0, 80*10-1, 0, 25*12-1);
- screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500));
- screen.set_refresh_hz(60);
+MACHINE_CONFIG_START(wangpc_mvc_device::device_add_mconfig)
+ MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update)
+ MCFG_SCREEN_SIZE(80*10, 25*12)
+ MCFG_SCREEN_VISIBLE_AREA(0, 80*10-1, 0, 25*12-1)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
+ MCFG_SCREEN_REFRESH_RATE(60)
MC6845_1(config, m_crtc, XTAL(14'318'181)/16);
m_crtc->set_screen(SCREEN_TAG);
@@ -151,7 +150,7 @@ void wangpc_mvc_device::device_add_mconfig(machine_config &config)
m_crtc->set_char_width(10);
m_crtc->set_update_row_callback(FUNC(wangpc_mvc_device::crtc_update_row), this);
m_crtc->out_vsync_callback().set(FUNC(wangpc_mvc_device::vsync_w));
-}
+MACHINE_CONFIG_END
@@ -226,7 +225,7 @@ void wangpc_mvc_device::device_reset()
// wangpcbus_mrdc_r - memory read
//-------------------------------------------------
-uint16_t wangpc_mvc_device::wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_mvc_device::wangpcbus_mrdc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -254,7 +253,7 @@ uint16_t wangpc_mvc_device::wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_amwc_w - memory write
//-------------------------------------------------
-void wangpc_mvc_device::wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_mvc_device::wangpcbus_amwc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
if (OPTION_VRAM)
{
@@ -278,7 +277,7 @@ void wangpc_mvc_device::wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint1
// wangpcbus_iorc_r - I/O read
//-------------------------------------------------
-uint16_t wangpc_mvc_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_mvc_device::wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -302,18 +301,18 @@ uint16_t wangpc_mvc_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_aiowc_w - I/O write
//-------------------------------------------------
-void wangpc_mvc_device::wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_mvc_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
if (sad(offset) && ACCESSING_BITS_0_7)
{
switch (offset & 0x7f)
{
case 0x00/2:
- m_crtc->address_w(data & 0xff);
+ m_crtc->address_w(space, 0, data & 0xff);
break;
case 0x02/2:
- m_crtc->register_w(data & 0xff);
+ m_crtc->register_w(space, 0, data & 0xff);
break;
case 0x10/2:
diff --git a/src/devices/bus/wangpc/mvc.h b/src/devices/bus/wangpc/mvc.h
index aee0cdf51b2..4620126c04e 100644
--- a/src/devices/bus/wangpc/mvc.h
+++ b/src/devices/bus/wangpc/mvc.h
@@ -36,10 +36,10 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_wangpcbus_card_interface overrides
- virtual uint16_t wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
- virtual uint16_t wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint16_t wangpcbus_mrdc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_amwc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint16_t wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
private:
MC6845_UPDATE_ROW( crtc_update_row );
diff --git a/src/devices/bus/wangpc/rtc.cpp b/src/devices/bus/wangpc/rtc.cpp
index 4512939003f..bdf392f9bed 100644
--- a/src/devices/bus/wangpc/rtc.cpp
+++ b/src/devices/bus/wangpc/rtc.cpp
@@ -214,7 +214,7 @@ void wangpc_rtc_device::device_reset()
// wangpcbus_mrdc_r - memory read
//-------------------------------------------------
-uint16_t wangpc_rtc_device::wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_rtc_device::wangpcbus_mrdc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -226,7 +226,7 @@ uint16_t wangpc_rtc_device::wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_amwc_w - memory write
//-------------------------------------------------
-void wangpc_rtc_device::wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_rtc_device::wangpcbus_amwc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
}
@@ -235,7 +235,7 @@ void wangpc_rtc_device::wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint1
// wangpcbus_iorc_r - I/O read
//-------------------------------------------------
-uint16_t wangpc_rtc_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_rtc_device::wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -257,7 +257,7 @@ uint16_t wangpc_rtc_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_aiowc_w - I/O write
//-------------------------------------------------
-void wangpc_rtc_device::wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_rtc_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
if (sad(offset))
{
diff --git a/src/devices/bus/wangpc/rtc.h b/src/devices/bus/wangpc/rtc.h
index 9233222a4f9..4f0b22372f2 100644
--- a/src/devices/bus/wangpc/rtc.h
+++ b/src/devices/bus/wangpc/rtc.h
@@ -41,10 +41,10 @@ protected:
virtual ioport_constructor device_input_ports() const override;
// device_wangpcbus_card_interface overrides
- virtual uint16_t wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
- virtual uint16_t wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint16_t wangpcbus_mrdc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_amwc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint16_t wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
private:
required_device<z80_device> m_maincpu;
diff --git a/src/devices/bus/wangpc/tig.cpp b/src/devices/bus/wangpc/tig.cpp
index f0c00ed3cc3..e9170b420cc 100644
--- a/src/devices/bus/wangpc/tig.cpp
+++ b/src/devices/bus/wangpc/tig.cpp
@@ -111,30 +111,29 @@ UPD7220_DISPLAY_PIXELS_MEMBER( wangpc_tig_device::hgdc_display_pixels )
//-------------------------------------------------
-// machine_config( wangpc_tig )
+// MACHINE_CONFIG_START( wangpc_tig )
//-------------------------------------------------
-void wangpc_tig_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER, rgb_t::green()));
- screen.set_screen_update(FUNC(wangpc_tig_device::screen_update));
- screen.set_size(80*10, 25*12);
- screen.set_visarea(0, 80*10-1, 0, 25*12-1);
- screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500));
- screen.set_refresh_hz(60);
+MACHINE_CONFIG_START(wangpc_tig_device::device_add_mconfig)
+ MCFG_SCREEN_ADD_MONOCHROME(SCREEN_TAG, RASTER, rgb_t::green())
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, wangpc_tig_device, screen_update)
+ MCFG_SCREEN_SIZE(80*10, 25*12)
+ MCFG_SCREEN_VISIBLE_AREA(0, 80*10-1, 0, 25*12-1)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
+ MCFG_SCREEN_REFRESH_RATE(60)
PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
UPD7220(config, m_hgdc0, XTAL(52'832'000)/28);
m_hgdc0->set_addrmap(0, &wangpc_tig_device::upd7220_0_map);
- m_hgdc0->set_draw_text(FUNC(wangpc_tig_device::hgdc_draw_text));
+ m_hgdc0->set_draw_text_callback(FUNC(wangpc_tig_device::hgdc_draw_text), this);
m_hgdc0->set_screen(SCREEN_TAG);
UPD7220(config, m_hgdc1, XTAL(52'832'000)/28);
m_hgdc1->set_addrmap(0, &wangpc_tig_device::upd7220_1_map);
- m_hgdc1->set_display_pixels(FUNC(wangpc_tig_device::hgdc_display_pixels));
+ m_hgdc1->set_display_pixels_callback(FUNC(wangpc_tig_device::hgdc_display_pixels), this);
m_hgdc1->set_screen(SCREEN_TAG);
-}
+MACHINE_CONFIG_END
//**************************************************************************
@@ -196,7 +195,7 @@ uint32_t wangpc_tig_device::screen_update(screen_device &screen, bitmap_rgb32 &b
// wangpcbus_iorc_r - I/O read
//-------------------------------------------------
-uint16_t wangpc_tig_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_tig_device::wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -206,12 +205,12 @@ uint16_t wangpc_tig_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
{
case 0x20/2:
case 0x22/2:
- data = m_hgdc0->read(offset);
+ data = m_hgdc0->read(space, offset);
break;
case 0x24/2:
case 0x26/2:
- data = m_hgdc1->read(offset);
+ data = m_hgdc1->read(space, offset);
break;
case 0xfe/2:
@@ -228,7 +227,7 @@ uint16_t wangpc_tig_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_aiowc_w - I/O write
//-------------------------------------------------
-void wangpc_tig_device::wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_tig_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
if (sad(offset) && ACCESSING_BITS_0_7)
{
@@ -243,12 +242,12 @@ void wangpc_tig_device::wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint
case 0x20/2:
case 0x22/2:
- m_hgdc0->write(offset, data);
+ m_hgdc0->write(space, offset, data);
break;
case 0x24/2:
case 0x26/2:
- m_hgdc1->write(offset, data);
+ m_hgdc1->write(space, offset, data);
break;
case 0x28/2:
@@ -275,17 +274,17 @@ void wangpc_tig_device::wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint
// wangpcbus_dack_r - DMA read
//-------------------------------------------------
-uint8_t wangpc_tig_device::wangpcbus_dack_r(int line)
+uint8_t wangpc_tig_device::wangpcbus_dack_r(address_space &space, int line)
{
uint8_t data;
if (DMA_GRAPHICS)
{
- data = m_hgdc1->dack_r();
+ data = m_hgdc1->dack_r(space, 0);
}
else
{
- data = m_hgdc0->dack_r();
+ data = m_hgdc0->dack_r(space, 0);
}
return data;
@@ -296,15 +295,15 @@ uint8_t wangpc_tig_device::wangpcbus_dack_r(int line)
// wangpcbus_dack_w - DMA write
//-------------------------------------------------
-void wangpc_tig_device::wangpcbus_dack_w(int line, uint8_t data)
+void wangpc_tig_device::wangpcbus_dack_w(address_space &space, int line, uint8_t data)
{
if (DMA_GRAPHICS)
{
- m_hgdc1->dack_w(data);
+ m_hgdc1->dack_w(space, 0, data);
}
else
{
- m_hgdc0->dack_w(data);
+ m_hgdc0->dack_w(space, 0, data);
}
}
diff --git a/src/devices/bus/wangpc/tig.h b/src/devices/bus/wangpc/tig.h
index 0e95eb42676..4a86f6ecb40 100644
--- a/src/devices/bus/wangpc/tig.h
+++ b/src/devices/bus/wangpc/tig.h
@@ -38,10 +38,10 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_wangpcbus_card_interface overrides
- virtual uint16_t wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
- virtual uint8_t wangpcbus_dack_r(int line) override;
- virtual void wangpcbus_dack_w(int line, uint8_t data) override;
+ virtual uint16_t wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint8_t wangpcbus_dack_r(address_space &space, int line) override;
+ virtual void wangpcbus_dack_w(address_space &space, int line, uint8_t data) override;
virtual bool wangpcbus_have_dack(int line) override;
private:
diff --git a/src/devices/bus/wangpc/wangpc.cpp b/src/devices/bus/wangpc/wangpc.cpp
index 540ed94c1b3..36ed25bfdff 100644
--- a/src/devices/bus/wangpc/wangpc.cpp
+++ b/src/devices/bus/wangpc/wangpc.cpp
@@ -104,7 +104,7 @@ void wangpcbus_device::add_card(device_wangpcbus_card_interface *card, int sid)
// mrdc_r - memory read
//-------------------------------------------------
-uint16_t wangpcbus_device::mrdc_r(offs_t offset, uint16_t mem_mask)
+READ16_MEMBER( wangpcbus_device::mrdc_r )
{
uint16_t data = 0xffff;
@@ -112,7 +112,7 @@ uint16_t wangpcbus_device::mrdc_r(offs_t offset, uint16_t mem_mask)
while (entry)
{
- data &= entry->wangpcbus_mrdc_r(offset + 0x40000/2, mem_mask);
+ data &= entry->wangpcbus_mrdc_r(space, offset + 0x40000/2, mem_mask);
entry = entry->next();
}
@@ -124,13 +124,13 @@ uint16_t wangpcbus_device::mrdc_r(offs_t offset, uint16_t mem_mask)
// amwc_w - memory write
//-------------------------------------------------
-void wangpcbus_device::amwc_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+WRITE16_MEMBER( wangpcbus_device::amwc_w )
{
device_wangpcbus_card_interface *entry = m_device_list.first();
while (entry)
{
- entry->wangpcbus_amwc_w(offset + 0x40000/2, mem_mask, data);
+ entry->wangpcbus_amwc_w(space, offset + 0x40000/2, mem_mask, data);
entry = entry->next();
}
}
@@ -140,7 +140,7 @@ void wangpcbus_device::amwc_w(offs_t offset, uint16_t data, uint16_t mem_mask)
// sad_r - I/O read
//-------------------------------------------------
-uint16_t wangpcbus_device::sad_r(offs_t offset, uint16_t mem_mask)
+READ16_MEMBER( wangpcbus_device::sad_r )
{
uint16_t data = 0xffff;
@@ -148,7 +148,7 @@ uint16_t wangpcbus_device::sad_r(offs_t offset, uint16_t mem_mask)
while (entry)
{
- data &= entry->wangpcbus_iorc_r(offset + 0x1100/2, mem_mask);
+ data &= entry->wangpcbus_iorc_r(space, offset + 0x1100/2, mem_mask);
entry = entry->next();
}
@@ -160,13 +160,13 @@ uint16_t wangpcbus_device::sad_r(offs_t offset, uint16_t mem_mask)
// sad_w - I/O write
//-------------------------------------------------
-void wangpcbus_device::sad_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+WRITE16_MEMBER( wangpcbus_device::sad_w )
{
device_wangpcbus_card_interface *entry = m_device_list.first();
while (entry)
{
- entry->wangpcbus_aiowc_w(offset + 0x1100/2, mem_mask, data);
+ entry->wangpcbus_aiowc_w(space, offset + 0x1100/2, mem_mask, data);
entry = entry->next();
}
}
@@ -176,7 +176,7 @@ void wangpcbus_device::sad_w(offs_t offset, uint16_t data, uint16_t mem_mask)
// dack_r - DMA read
//-------------------------------------------------
-uint8_t wangpcbus_device::dack_r(int line)
+uint8_t wangpcbus_device::dack_r(address_space &space, int line)
{
uint8_t retVal = 0xff;
device_wangpcbus_card_interface *entry = m_device_list.first();
@@ -185,7 +185,7 @@ uint8_t wangpcbus_device::dack_r(int line)
{
if (entry->wangpcbus_have_dack(line))
{
- retVal = entry->wangpcbus_dack_r(line);
+ retVal = entry->wangpcbus_dack_r(space, line);
break;
}
@@ -200,7 +200,7 @@ uint8_t wangpcbus_device::dack_r(int line)
// dack_w - DMA write
//-------------------------------------------------
-void wangpcbus_device::dack_w(int line, uint8_t data)
+void wangpcbus_device::dack_w(address_space &space, int line, uint8_t data)
{
device_wangpcbus_card_interface *entry = m_device_list.first();
@@ -208,7 +208,7 @@ void wangpcbus_device::dack_w(int line, uint8_t data)
{
if (entry->wangpcbus_have_dack(line))
{
- entry->wangpcbus_dack_w(line, data);
+ entry->wangpcbus_dack_w(space, line, data);
}
entry = entry->next();
diff --git a/src/devices/bus/wangpc/wangpc.h b/src/devices/bus/wangpc/wangpc.h
index bb8c7a3c4ac..1f10892f7fc 100644
--- a/src/devices/bus/wangpc/wangpc.h
+++ b/src/devices/bus/wangpc/wangpc.h
@@ -24,6 +24,51 @@
#define WANGPC_BUS_TAG "wangpcbus"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_WANGPC_BUS_ADD() \
+ MCFG_DEVICE_ADD(WANGPC_BUS_TAG, WANGPC_BUS, 0)
+
+#define MCFG_WANGPC_BUS_SLOT_ADD(_tag, _sid, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, WANGPC_BUS_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ downcast<wangpcbus_slot_device &>(*device).set_wangpcbus_slot(_sid);
+
+
+#define MCFG_WANGPC_BUS_IRQ2_CALLBACK(_write) \
+ downcast<wangpcbus_device &>(*device).set_irq2_wr_callback(DEVCB_##_write);
+
+#define MCFG_WANGPC_BUS_IRQ3_CALLBACK(_write) \
+ downcast<wangpcbus_device &>(*device).set_irq3_wr_callback(DEVCB_##_write);
+
+#define MCFG_WANGPC_BUS_IRQ4_CALLBACK(_write) \
+ downcast<wangpcbus_device &>(*device).set_irq4_wr_callback(DEVCB_##_write);
+
+#define MCFG_WANGPC_BUS_IRQ5_CALLBACK(_write) \
+ downcast<wangpcbus_device &>(*device).set_irq5_wr_callback(DEVCB_##_write);
+
+#define MCFG_WANGPC_BUS_IRQ6_CALLBACK(_write) \
+ downcast<wangpcbus_device &>(*device).set_irq6_wr_callback(DEVCB_##_write);
+
+#define MCFG_WANGPC_BUS_IRQ7_CALLBACK(_write) \
+ downcast<wangpcbus_device &>(*device).set_irq7_wr_callback(DEVCB_##_write);
+
+#define MCFG_WANGPC_BUS_DRQ1_CALLBACK(_write) \
+ downcast<wangpcbus_device &>(*device).set_drq1_wr_callback(DEVCB_##_write);
+
+#define MCFG_WANGPC_BUS_DRQ2_CALLBACK(_write) \
+ downcast<wangpcbus_device &>(*device).set_drq2_wr_callback(DEVCB_##_write);
+
+#define MCFG_WANGPC_BUS_DRQ3_CALLBACK(_write) \
+ downcast<wangpcbus_device &>(*device).set_drq3_wr_callback(DEVCB_##_write);
+
+#define MCFG_WANGPC_BUS_IOERROR_CALLBACK(_write) \
+ downcast<wangpcbus_device &>(*device).set_ioerror_wr_callback(DEVCB_##_write);
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -36,17 +81,7 @@ class wangpcbus_slot_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- template <typename T>
- wangpcbus_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt, int sid)
- : wangpcbus_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- set_wangpcbus_slot(sid);
- }
- wangpcbus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ wangpcbus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration
void set_wangpcbus_slot(int sid) { m_sid = sid; }
@@ -78,37 +113,37 @@ public:
wangpcbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
~wangpcbus_device() { m_device_list.detach_all(); }
- auto irq2_wr_callback() { return m_write_irq2.bind(); }
- auto irq3_wr_callback() { return m_write_irq3.bind(); }
- auto irq4_wr_callback() { return m_write_irq4.bind(); }
- auto irq5_wr_callback() { return m_write_irq5.bind(); }
- auto irq6_wr_callback() { return m_write_irq6.bind(); }
- auto irq7_wr_callback() { return m_write_irq7.bind(); }
- auto drq1_wr_callback() { return m_write_drq1.bind(); }
- auto drq2_wr_callback() { return m_write_drq2.bind(); }
- auto drq3_wr_callback() { return m_write_drq3.bind(); }
- auto ioerror_wr_callback() { return m_write_ioerror.bind(); }
+ template <class Object> devcb_base &set_irq2_wr_callback(Object &&cb) { return m_write_irq2.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_irq3_wr_callback(Object &&cb) { return m_write_irq3.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_irq4_wr_callback(Object &&cb) { return m_write_irq4.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_irq5_wr_callback(Object &&cb) { return m_write_irq5.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_irq6_wr_callback(Object &&cb) { return m_write_irq6.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_irq7_wr_callback(Object &&cb) { return m_write_irq7.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_drq1_wr_callback(Object &&cb) { return m_write_drq1.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_drq2_wr_callback(Object &&cb) { return m_write_drq2.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_drq3_wr_callback(Object &&cb) { return m_write_drq3.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_ioerror_wr_callback(Object &&cb) { return m_write_ioerror.set_callback(std::forward<Object>(cb)); }
void add_card(device_wangpcbus_card_interface *card, int sid);
// computer interface
- uint16_t mrdc_r(offs_t offset, uint16_t mem_mask = 0xffff);
- void amwc_w(offs_t offset, uint16_t data, uint16_t mem_mask = 0xffff);
+ DECLARE_READ16_MEMBER( mrdc_r );
+ DECLARE_WRITE16_MEMBER( amwc_w );
- uint16_t sad_r(offs_t offset, uint16_t mem_mask = 0xffff);
- void sad_w(offs_t offset, uint16_t data, uint16_t mem_mask = 0xffff);
+ DECLARE_READ16_MEMBER( sad_r );
+ DECLARE_WRITE16_MEMBER( sad_w );
- uint8_t dack_r(int line);
- void dack_w(int line, uint8_t data);
+ uint8_t dack_r(address_space &space, int line);
+ void dack_w(address_space &space, int line, uint8_t data);
- uint8_t dack0_r() { return dack_r(0); }
- void dack0_w(uint8_t data) { dack_w(0, data); }
- uint8_t dack1_r() { return dack_r(1); }
- void dack1_w(uint8_t data) { dack_w(1, data); }
- uint8_t dack2_r() { return dack_r(2); }
- void dack2_w(uint8_t data) { dack_w(2, data); }
- uint8_t dack3_r() { return dack_r(3); }
- void dack3_w(uint8_t data) { dack_w(3, data); }
+ DECLARE_READ8_MEMBER( dack0_r ) { return dack_r(space, 0); }
+ DECLARE_WRITE8_MEMBER( dack0_w ) { dack_w(space, 0, data); }
+ DECLARE_READ8_MEMBER( dack1_r ) { return dack_r(space, 1); }
+ DECLARE_WRITE8_MEMBER( dack1_w ) { dack_w(space, 1, data); }
+ DECLARE_READ8_MEMBER( dack2_r ) { return dack_r(space, 2); }
+ DECLARE_WRITE8_MEMBER( dack2_w ) { dack_w(space, 2, data); }
+ DECLARE_READ8_MEMBER( dack3_r ) { return dack_r(space, 3); }
+ DECLARE_WRITE8_MEMBER( dack3_w ) { dack_w(space, 3, data); }
DECLARE_WRITE_LINE_MEMBER( tc_w );
@@ -160,17 +195,17 @@ public:
device_wangpcbus_card_interface *next() const { return m_next; }
// memory access
- virtual uint16_t wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask) { return 0; }
- virtual void wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data) { }
+ virtual uint16_t wangpcbus_mrdc_r(address_space &space, offs_t offset, uint16_t mem_mask) { return 0; }
+ virtual void wangpcbus_amwc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) { }
// I/O access
- virtual uint16_t wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask) { return 0; }
- virtual void wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data) { }
+ virtual uint16_t wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask) { return 0; }
+ virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) { }
bool sad(offs_t offset) const { return (offset & 0xf80) == (0x800 | (m_sid << 7)); }
// DMA
- virtual uint8_t wangpcbus_dack_r(int line) { return 0; }
- virtual void wangpcbus_dack_w(int line, uint8_t data) { }
+ virtual uint8_t wangpcbus_dack_r(address_space &space, int line) { return 0; }
+ virtual void wangpcbus_dack_w(address_space &space, int line, uint8_t data) { }
virtual void wangpcbus_tc_w(int state) { }
virtual bool wangpcbus_have_dack(int line) { return false; }
diff --git a/src/devices/bus/wangpc/wdc.cpp b/src/devices/bus/wangpc/wdc.cpp
index 2ad74d8c8fd..6dd36b7d545 100644
--- a/src/devices/bus/wangpc/wdc.cpp
+++ b/src/devices/bus/wangpc/wdc.cpp
@@ -89,7 +89,7 @@ void wangpc_wdc_device::wangpc_wdc_io(address_map &map)
//-------------------------------------------------
-// machine_config( wangpc_wdc )
+// MACHINE_CONFIG_START( wangpc_wdc )
//-------------------------------------------------
void wangpc_wdc_device::device_add_mconfig(machine_config &config)
@@ -173,7 +173,7 @@ void wangpc_wdc_device::device_reset()
// wangpcbus_mrdc_r - memory read
//-------------------------------------------------
-uint16_t wangpc_wdc_device::wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_wdc_device::wangpcbus_mrdc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -185,7 +185,7 @@ uint16_t wangpc_wdc_device::wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_amwc_w - memory write
//-------------------------------------------------
-void wangpc_wdc_device::wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_wdc_device::wangpcbus_amwc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
}
@@ -194,7 +194,7 @@ void wangpc_wdc_device::wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint1
// wangpcbus_iorc_r - I/O read
//-------------------------------------------------
-uint16_t wangpc_wdc_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
+uint16_t wangpc_wdc_device::wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask)
{
uint16_t data = 0xffff;
@@ -228,7 +228,7 @@ uint16_t wangpc_wdc_device::wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask)
// wangpcbus_aiowc_w - I/O write
//-------------------------------------------------
-void wangpc_wdc_device::wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data)
+void wangpc_wdc_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data)
{
if (sad(offset) && ACCESSING_BITS_0_7)
{
@@ -263,7 +263,7 @@ void wangpc_wdc_device::wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint
// wangpcbus_dack_r - DMA acknowledge read
//-------------------------------------------------
-uint8_t wangpc_wdc_device::wangpcbus_dack_r(int line)
+uint8_t wangpc_wdc_device::wangpcbus_dack_r(address_space &space, int line)
{
return 0;
}
@@ -273,7 +273,7 @@ uint8_t wangpc_wdc_device::wangpcbus_dack_r(int line)
// wangpcbus_dack_r - DMA acknowledge write
//-------------------------------------------------
-void wangpc_wdc_device::wangpcbus_dack_w(int line, uint8_t data)
+void wangpc_wdc_device::wangpcbus_dack_w(address_space &space, int line, uint8_t data)
{
}
@@ -325,11 +325,11 @@ WRITE8_MEMBER( wangpc_wdc_device::status_w )
}
-READ8_MEMBER( wangpc_wdc_device::ctc_ch0_r ) { return m_ctc->read(machine().dummy_space(), 0); }
-WRITE8_MEMBER( wangpc_wdc_device::ctc_ch0_w ) { m_ctc->write(machine().dummy_space(), 0, data); }
-READ8_MEMBER( wangpc_wdc_device::ctc_ch1_r ) { return m_ctc->read(machine().dummy_space(), 1); }
-WRITE8_MEMBER( wangpc_wdc_device::ctc_ch1_w ) { m_ctc->write(machine().dummy_space(), 1, data); }
-READ8_MEMBER( wangpc_wdc_device::ctc_ch2_r ) { return m_ctc->read(machine().dummy_space(), 2); }
-WRITE8_MEMBER( wangpc_wdc_device::ctc_ch2_w ) { m_ctc->write(machine().dummy_space(), 2, data); }
-READ8_MEMBER( wangpc_wdc_device::ctc_ch3_r ) { return m_ctc->read(machine().dummy_space(), 3); }
-WRITE8_MEMBER( wangpc_wdc_device::ctc_ch3_w ) { m_ctc->write(machine().dummy_space(), 3, data); }
+READ8_MEMBER( wangpc_wdc_device::ctc_ch0_r ) { return m_ctc->read(space, 0); }
+WRITE8_MEMBER( wangpc_wdc_device::ctc_ch0_w ) { m_ctc->write(space, 0, data); }
+READ8_MEMBER( wangpc_wdc_device::ctc_ch1_r ) { return m_ctc->read(space, 1); }
+WRITE8_MEMBER( wangpc_wdc_device::ctc_ch1_w ) { m_ctc->write(space, 1, data); }
+READ8_MEMBER( wangpc_wdc_device::ctc_ch2_r ) { return m_ctc->read(space, 2); }
+WRITE8_MEMBER( wangpc_wdc_device::ctc_ch2_w ) { m_ctc->write(space, 2, data); }
+READ8_MEMBER( wangpc_wdc_device::ctc_ch3_r ) { return m_ctc->read(space, 3); }
+WRITE8_MEMBER( wangpc_wdc_device::ctc_ch3_w ) { m_ctc->write(space, 3, data); }
diff --git a/src/devices/bus/wangpc/wdc.h b/src/devices/bus/wangpc/wdc.h
index c945ba6707d..e270a961750 100644
--- a/src/devices/bus/wangpc/wdc.h
+++ b/src/devices/bus/wangpc/wdc.h
@@ -39,12 +39,12 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_wangpcbus_card_interface overrides
- virtual uint16_t wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
- virtual uint16_t wangpcbus_iorc_r(offs_t offset, uint16_t mem_mask) override;
- virtual void wangpcbus_aiowc_w(offs_t offset, uint16_t mem_mask, uint16_t data) override;
- virtual uint8_t wangpcbus_dack_r(int line) override;
- virtual void wangpcbus_dack_w(int line, uint8_t data) override;
+ virtual uint16_t wangpcbus_mrdc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_amwc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint16_t wangpcbus_iorc_r(address_space &space, offs_t offset, uint16_t mem_mask) override;
+ virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, uint16_t mem_mask, uint16_t data) override;
+ virtual uint8_t wangpcbus_dack_r(address_space &space, int line) override;
+ virtual void wangpcbus_dack_w(address_space &space, int line, uint8_t data) override;
virtual bool wangpcbus_have_dack(int line) override;
private:
diff --git a/src/devices/bus/wswan/rom.cpp b/src/devices/bus/wswan/rom.cpp
index c4c991212b6..4ba57a44fe4 100644
--- a/src/devices/bus/wswan/rom.cpp
+++ b/src/devices/bus/wswan/rom.cpp
@@ -205,26 +205,26 @@ void ws_rom_device::device_timer(emu_timer &timer, device_timer_id id, int param
mapper specific handlers
-------------------------------------------------*/
-uint8_t ws_rom_device::read_rom20(offs_t offset)
+READ8_MEMBER(ws_rom_device::read_rom20)
{
return m_rom[offset + m_base20];
}
-uint8_t ws_rom_device::read_rom30(offs_t offset)
+READ8_MEMBER(ws_rom_device::read_rom30)
{
return m_rom[offset + m_base30];
}
-uint8_t ws_rom_device::read_rom40(offs_t offset)
+READ8_MEMBER(ws_rom_device::read_rom40)
{
// we still need to mask in some cases, e.g. when game is 512K
return m_rom[(offset + m_base40) & (m_rom_size - 1)];
}
-uint8_t ws_rom_device::read_io(offs_t offset)
+READ8_MEMBER(ws_rom_device::read_io)
{
uint8_t value = m_io_regs[offset];
@@ -254,7 +254,7 @@ uint8_t ws_rom_device::read_io(offs_t offset)
return value;
}
-void ws_rom_device::write_io(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ws_rom_device::write_io)
{
switch (offset)
{
@@ -344,30 +344,30 @@ void ws_rom_device::write_io(offs_t offset, uint8_t data)
m_io_regs[offset] = data;
}
-uint8_t ws_rom_sram_device::read_ram(offs_t offset)
+READ8_MEMBER(ws_rom_sram_device::read_ram)
{
return m_nvram[m_nvram_base + offset];
}
-void ws_rom_sram_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ws_rom_sram_device::write_ram)
{
m_nvram[m_nvram_base + offset] = data;
}
-void ws_rom_sram_device::write_io(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ws_rom_sram_device::write_io)
{
switch (offset)
{
case 0x01: // SRAM bank to select
m_nvram_base = (data * 0x10000) & (m_nvram.size() - 1);
default:
- ws_rom_device::write_io(offset, data);
+ ws_rom_device::write_io(space, offset, data);
break;
}
}
-uint8_t ws_rom_eeprom_device::read_io(offs_t offset)
+READ8_MEMBER(ws_rom_eeprom_device::read_io)
{
uint8_t value = m_io_regs[offset];
@@ -381,14 +381,14 @@ uint8_t ws_rom_eeprom_device::read_io(offs_t offset)
// EEPROM reads, taken from regs
break;
default:
- value = ws_rom_device::read_io(offset);
+ value = ws_rom_device::read_io(space, offset);
break;
}
return value;
}
-void ws_rom_eeprom_device::write_io(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ws_rom_eeprom_device::write_io)
{
switch (offset)
{
@@ -530,7 +530,7 @@ void ws_rom_eeprom_device::write_io(offs_t offset, uint8_t data)
break;
default:
- ws_rom_device::write_io(offset, data);
+ ws_rom_device::write_io(space, offset, data);
break;
}
diff --git a/src/devices/bus/wswan/rom.h b/src/devices/bus/wswan/rom.h
index 916562ab6e2..ae420667c8f 100644
--- a/src/devices/bus/wswan/rom.h
+++ b/src/devices/bus/wswan/rom.h
@@ -16,11 +16,11 @@ public:
ws_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_rom20(offs_t offset) override;
- virtual uint8_t read_rom30(offs_t offset) override;
- virtual uint8_t read_rom40(offs_t offset) override;
- virtual uint8_t read_io(offs_t offset) override;
- virtual void write_io(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_rom20) override;
+ virtual DECLARE_READ8_MEMBER(read_rom30) override;
+ virtual DECLARE_READ8_MEMBER(read_rom40) override;
+ virtual DECLARE_READ8_MEMBER(read_io) override;
+ virtual DECLARE_WRITE8_MEMBER(write_io) override;
protected:
static constexpr device_timer_id TIMER_RTC = 0;
@@ -59,9 +59,9 @@ public:
ws_rom_sram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
- virtual void write_io(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_ram) override;
+ virtual DECLARE_WRITE8_MEMBER(write_io) override;
protected:
// device-level overrides
@@ -82,8 +82,8 @@ public:
ws_rom_eeprom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// reading and writing
- virtual uint8_t read_io(offs_t offset) override;
- virtual void write_io(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_io) override;
+ virtual DECLARE_WRITE8_MEMBER(write_io) override;
protected:
// device-level overrides
diff --git a/src/devices/bus/wswan/slot.cpp b/src/devices/bus/wswan/slot.cpp
index 731c0967e1e..45df7c195bf 100644
--- a/src/devices/bus/wswan/slot.cpp
+++ b/src/devices/bus/wswan/slot.cpp
@@ -312,10 +312,10 @@ std::string ws_cart_slot_device::get_default_card_software(get_default_card_soft
read_rom20
-------------------------------------------------*/
-uint8_t ws_cart_slot_device::read_rom20(offs_t offset)
+READ8_MEMBER(ws_cart_slot_device::read_rom20)
{
if (m_cart)
- return m_cart->read_rom20(offset);
+ return m_cart->read_rom20(space, offset);
else
return 0xff;
}
@@ -324,10 +324,10 @@ uint8_t ws_cart_slot_device::read_rom20(offs_t offset)
read_rom30
-------------------------------------------------*/
-uint8_t ws_cart_slot_device::read_rom30(offs_t offset)
+READ8_MEMBER(ws_cart_slot_device::read_rom30)
{
if (m_cart)
- return m_cart->read_rom30(offset);
+ return m_cart->read_rom30(space, offset);
else
return 0xff;
}
@@ -336,10 +336,10 @@ uint8_t ws_cart_slot_device::read_rom30(offs_t offset)
read_rom40
-------------------------------------------------*/
-uint8_t ws_cart_slot_device::read_rom40(offs_t offset)
+READ8_MEMBER(ws_cart_slot_device::read_rom40)
{
if (m_cart)
- return m_cart->read_rom40(offset);
+ return m_cart->read_rom40(space, offset);
else
return 0xff;
}
@@ -348,10 +348,10 @@ uint8_t ws_cart_slot_device::read_rom40(offs_t offset)
read_ram
-------------------------------------------------*/
-uint8_t ws_cart_slot_device::read_ram(offs_t offset)
+READ8_MEMBER(ws_cart_slot_device::read_ram)
{
if (m_cart)
- return m_cart->read_ram(offset);
+ return m_cart->read_ram(space, offset);
else
return 0xff;
}
@@ -360,20 +360,20 @@ uint8_t ws_cart_slot_device::read_ram(offs_t offset)
write_ram
-------------------------------------------------*/
-void ws_cart_slot_device::write_ram(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ws_cart_slot_device::write_ram)
{
if (m_cart)
- m_cart->write_ram(offset, data);
+ m_cart->write_ram(space, offset, data);
}
/*-------------------------------------------------
read_io
-------------------------------------------------*/
-uint8_t ws_cart_slot_device::read_io(offs_t offset)
+READ8_MEMBER(ws_cart_slot_device::read_io)
{
if (m_cart)
- return m_cart->read_io(offset);
+ return m_cart->read_io(space, offset);
else
return 0xff;
}
@@ -382,10 +382,10 @@ uint8_t ws_cart_slot_device::read_io(offs_t offset)
write_io
-------------------------------------------------*/
-void ws_cart_slot_device::write_io(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ws_cart_slot_device::write_io)
{
if (m_cart)
- m_cart->write_io(offset, data);
+ m_cart->write_io(space, offset, data);
}
diff --git a/src/devices/bus/wswan/slot.h b/src/devices/bus/wswan/slot.h
index 219a4bb3fe8..1992d858553 100644
--- a/src/devices/bus/wswan/slot.h
+++ b/src/devices/bus/wswan/slot.h
@@ -31,13 +31,13 @@ public:
virtual ~device_ws_cart_interface();
// reading and writing
- virtual uint8_t read_rom20(offs_t offset) { return 0xff; }
- virtual uint8_t read_rom30(offs_t offset) { return 0xff; }
- virtual uint8_t read_rom40(offs_t offset) { return 0xff; }
- virtual uint8_t read_ram(offs_t offset) { return 0xff; }
- virtual void write_ram(offs_t offset, uint8_t data) {}
- virtual uint8_t read_io(offs_t offset) { return 0xff; }
- virtual void write_io(offs_t offset, uint8_t data) { }
+ virtual DECLARE_READ8_MEMBER(read_rom20) { return 0xff; }
+ virtual DECLARE_READ8_MEMBER(read_rom30) { return 0xff; }
+ virtual DECLARE_READ8_MEMBER(read_rom40) { return 0xff; }
+ virtual DECLARE_READ8_MEMBER(read_ram) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_ram) {}
+ virtual DECLARE_READ8_MEMBER(read_io) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_io) { }
void rom_alloc(uint32_t size, const char *tag);
void nvram_alloc(uint32_t size);
@@ -109,13 +109,13 @@ public:
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
// reading and writing
- virtual uint8_t read_rom20(offs_t offset);
- virtual uint8_t read_rom30(offs_t offset);
- virtual uint8_t read_rom40(offs_t offset);
- virtual uint8_t read_ram(offs_t offset);
- virtual void write_ram(offs_t offset, uint8_t data);
- virtual uint8_t read_io(offs_t offset);
- virtual void write_io(offs_t offset, uint8_t data);
+ virtual DECLARE_READ8_MEMBER(read_rom20);
+ virtual DECLARE_READ8_MEMBER(read_rom30);
+ virtual DECLARE_READ8_MEMBER(read_rom40);
+ virtual DECLARE_READ8_MEMBER(read_ram);
+ virtual DECLARE_WRITE8_MEMBER(write_ram);
+ virtual DECLARE_READ8_MEMBER(read_io);
+ virtual DECLARE_WRITE8_MEMBER(write_io);
protected:
// device-level overrides
diff --git a/src/devices/bus/x68k/x68k_midi.cpp b/src/devices/bus/x68k/x68k_midi.cpp
index abcc0b34955..b4f27554b70 100644
--- a/src/devices/bus/x68k/x68k_midi.cpp
+++ b/src/devices/bus/x68k/x68k_midi.cpp
@@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:Barry Rodewald
/*
- * x68k_midi.cpp
+ * x68k_midi.c
*
* X68000 MIDI interface - YM3802
*
@@ -17,16 +17,16 @@
DEFINE_DEVICE_TYPE(X68K_MIDI, x68k_midi_device, "x68k_midi", "X68000 MIDI Interface")
-void x68k_midi_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(x68k_midi_device::device_add_mconfig)
YM3802(config, m_midi, XTAL(1'000'000)); // clock is unknown
m_midi->txd_handler().set("mdout", FUNC(midi_port_device::write_txd));
m_midi->irq_handler().set(FUNC(x68k_midi_device::irq_w));
- MIDI_PORT(config, "mdin", midiin_slot, "midiin");
- MIDI_PORT(config, "mdout", midiout_slot, "midiout");
-// MIDI_PORT(config, "mdthru", midiout_slot, "midiout");
+ MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
+ MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
+// MCFG_MIDI_PORT_ADD("mdthru", midiout_slot, "midiout")
// TODO: Add serial data handlers
-}
+
+MACHINE_CONFIG_END
x68k_midi_device::x68k_midi_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
@@ -39,8 +39,10 @@ x68k_midi_device::x68k_midi_device(const machine_config &mconfig, const char *ta
void x68k_midi_device::device_start()
{
+ device_t* cpu = machine().device("maincpu");
+ address_space& space = cpu->memory().space(AS_PROGRAM);
m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner());
- m_slot->space().install_readwrite_handler(0xeafa00,0xeafa0f,read8_delegate(FUNC(x68k_midi_device::x68k_midi_reg_r),this),write8_delegate(FUNC(x68k_midi_device::x68k_midi_reg_w),this),0x00ff00ff);
+ space.install_readwrite_handler(0xeafa00,0xeafa0f,read8_delegate(FUNC(x68k_midi_device::x68k_midi_reg_r),this),write8_delegate(FUNC(x68k_midi_device::x68k_midi_reg_w),this),0x00ff00ff);
}
void x68k_midi_device::device_reset()
diff --git a/src/devices/bus/x68k/x68k_neptunex.cpp b/src/devices/bus/x68k/x68k_neptunex.cpp
index 7a7b7c3aaab..4c77c32061c 100644
--- a/src/devices/bus/x68k/x68k_neptunex.cpp
+++ b/src/devices/bus/x68k/x68k_neptunex.cpp
@@ -17,13 +17,12 @@
DEFINE_DEVICE_TYPE(X68K_NEPTUNEX, x68k_neptune_device, "x68k_neptunex", "Neptune-X")
// device machine config
-void x68k_neptune_device::device_add_mconfig(machine_config &config)
-{
- DP8390D(config, m_dp8390, 0);
- m_dp8390->irq_callback().set(FUNC(x68k_neptune_device::x68k_neptune_irq_w));
- m_dp8390->mem_read_callback().set(FUNC(x68k_neptune_device::x68k_neptune_mem_read));
- m_dp8390->mem_write_callback().set(FUNC(x68k_neptune_device::x68k_neptune_mem_write));
-}
+MACHINE_CONFIG_START(x68k_neptune_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("dp8390d", DP8390D, 0)
+ MCFG_DP8390D_IRQ_CB(WRITELINE(*this, x68k_neptune_device, x68k_neptune_irq_w))
+ MCFG_DP8390D_MEM_READ_CB(READ8(*this, x68k_neptune_device, x68k_neptune_mem_read))
+ MCFG_DP8390D_MEM_WRITE_CB(WRITE8(*this, x68k_neptune_device, x68k_neptune_mem_write))
+MACHINE_CONFIG_END
x68k_neptune_device::x68k_neptune_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, X68K_NEPTUNEX, tag, owner, clock)
@@ -39,15 +38,17 @@ x68k_neptune_device::x68k_neptune_device(const machine_config &mconfig, const ch
void x68k_neptune_device::device_start()
{
+ device_t* cpu = machine().device("maincpu");
char mac[7];
uint32_t num = machine().rand();
+ address_space& space = cpu->memory().space(AS_PROGRAM);
m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner());
memset(m_prom, 0x57, 16);
sprintf(mac+2, "\x1b%c%c%c", (num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff);
mac[0] = 0; mac[1] = 0; // avoid gcc warning
memcpy(m_prom, mac, 6);
m_dp8390->set_mac(mac);
- m_slot->space().install_readwrite_handler(0xece000,0xece3ff,read16_delegate(FUNC(x68k_neptune_device::x68k_neptune_port_r),this),write16_delegate(FUNC(x68k_neptune_device::x68k_neptune_port_w),this),0xffffffff);
+ space.install_readwrite_handler(0xece000,0xece3ff,read16_delegate(FUNC(x68k_neptune_device::x68k_neptune_port_r),this),write16_delegate(FUNC(x68k_neptune_device::x68k_neptune_port_w),this),0xffffffff);
}
void x68k_neptune_device::device_reset() {
diff --git a/src/devices/bus/x68k/x68k_scsiext.cpp b/src/devices/bus/x68k/x68k_scsiext.cpp
index 3cf18f9d2ee..557d70d3f36 100644
--- a/src/devices/bus/x68k/x68k_scsiext.cpp
+++ b/src/devices/bus/x68k/x68k_scsiext.cpp
@@ -37,8 +37,7 @@ const tiny_rom_entry *x68k_scsiext_device::device_rom_region() const
}
// device machine config
-void x68k_scsiext_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(x68k_scsiext_device::device_add_mconfig)
SCSI_PORT(config, m_scsibus);
m_scsibus->set_slot_device(1, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_0));
m_scsibus->set_slot_device(2, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_1));
@@ -49,10 +48,10 @@ void x68k_scsiext_device::device_add_mconfig(machine_config &config)
m_scsibus->set_slot_device(7, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_6));
MB89352A(config, m_spc);
- m_spc->set_scsi_port(m_scsibus);
+ m_spc->set_scsi_port("scsi");
m_spc->irq_cb().set(FUNC(x68k_scsiext_device::irq_w));
m_spc->drq_cb().set(FUNC(x68k_scsiext_device::drq_w));
-}
+MACHINE_CONFIG_END
x68k_scsiext_device::x68k_scsiext_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, X68K_SCSIEXT, tag, owner, clock)
@@ -65,14 +64,15 @@ x68k_scsiext_device::x68k_scsiext_device(const machine_config &mconfig, const ch
void x68k_scsiext_device::device_start()
{
+ device_t* cpu = machine().device("maincpu");
+ uint8_t* ROM;
+ address_space& space = cpu->memory().space(AS_PROGRAM);
m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner());
- m_slot->space().install_read_bank(0xea0020,0xea1fff,"scsi_ext");
- m_slot->space().unmap_write(0xea0020,0xea1fff);
-
- uint8_t *ROM = machine().root_device().memregion(subtag("scsiexrom").c_str())->base();
+ space.install_read_bank(0xea0020,0xea1fff,"scsi_ext");
+ space.unmap_write(0xea0020,0xea1fff);
+ ROM = machine().root_device().memregion(subtag("scsiexrom").c_str())->base();
machine().root_device().membank("scsi_ext")->set_base(ROM);
-
-m_slot->space().install_readwrite_handler(0xea0000,0xea001f,read8_delegate(FUNC(x68k_scsiext_device::register_r),this),write8_delegate(FUNC(x68k_scsiext_device::register_w),this),0x00ff00ff);
+ space.install_readwrite_handler(0xea0000,0xea001f,read8_delegate(FUNC(x68k_scsiext_device::register_r),this),write8_delegate(FUNC(x68k_scsiext_device::register_w),this),0x00ff00ff);
}
void x68k_scsiext_device::device_reset()
diff --git a/src/devices/bus/x68k/x68kexp.cpp b/src/devices/bus/x68k/x68kexp.cpp
index dc51559d632..9d9cded5bd8 100644
--- a/src/devices/bus/x68k/x68kexp.cpp
+++ b/src/devices/bus/x68k/x68kexp.cpp
@@ -36,7 +36,6 @@ device_x68k_expansion_card_interface::~device_x68k_expansion_card_interface()
x68k_expansion_slot_device::x68k_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, X68K_EXPANSION_SLOT, tag, owner, clock),
device_slot_interface(mconfig, *this),
- m_space(*this, finder_base::DUMMY_TAG, -1),
m_out_irq2_cb(*this),
m_out_irq4_cb(*this),
m_out_nmi_cb(*this),
diff --git a/src/devices/bus/x68k/x68kexp.h b/src/devices/bus/x68k/x68kexp.h
index 26b3ba06ad6..56f9feea8a5 100644
--- a/src/devices/bus/x68k/x68kexp.h
+++ b/src/devices/bus/x68k/x68kexp.h
@@ -73,6 +73,22 @@
#define X68K_EXP_SLOT_TAG "x68kexp"
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_X68K_EXPANSION_SLOT_OUT_IRQ2_CB(_devcb) \
+ downcast<x68k_expansion_slot_device &>(*device).set_out_irq2_callback(DEVCB_##_devcb);
+
+#define MCFG_X68K_EXPANSION_SLOT_OUT_IRQ4_CB(_devcb) \
+ downcast<x68k_expansion_slot_device &>(*device).set_out_irq4_callback(DEVCB_##_devcb);
+
+#define MCFG_X68K_EXPANSION_SLOT_OUT_NMI_CB(_devcb) \
+ downcast<x68k_expansion_slot_device &>(*device).set_out_nmi_callback(DEVCB_##_devcb);
+
+#define MCFG_X68K_EXPANSION_SLOT_OUT_RESET_CB(_devcb) \
+ downcast<x68k_expansion_slot_device &>(*device).set_out_reset_callback(DEVCB_##_devcb);
+
//**************************************************************************
// TYPE DEFINITIONS
@@ -107,26 +123,14 @@ class x68k_expansion_slot_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
- template <typename T>
- x68k_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : x68k_expansion_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
- x68k_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ x68k_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~x68k_expansion_slot_device();
- template <typename T> void set_space(T &&tag, int spacenum) { m_space.set_tag(std::forward<T>(tag), spacenum); }
+ template <class Object> devcb_base &set_out_irq2_callback(Object &&cb) { return m_out_irq2_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_irq4_callback(Object &&cb) { return m_out_irq4_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_nmi_callback(Object &&cb) { return m_out_nmi_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_reset_callback(Object &&cb) { return m_out_reset_cb.set_callback(std::forward<Object>(cb)); }
- auto out_irq2_callback() { return m_out_irq2_cb.bind(); }
- auto out_irq4_callback() { return m_out_irq4_cb.bind(); }
- auto out_nmi_callback() { return m_out_nmi_cb.bind(); }
- auto out_reset_callback() { return m_out_reset_cb.bind(); }
-
- address_space &space() { return *m_space; }
DECLARE_WRITE_LINE_MEMBER( irq2_w );
DECLARE_WRITE_LINE_MEMBER( irq4_w );
@@ -140,8 +144,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- required_address_space m_space;
-
devcb_write_line m_out_irq2_cb;
devcb_write_line m_out_irq4_cb;
devcb_write_line m_out_nmi_cb;
diff --git a/src/devices/bus/z88/flash.cpp b/src/devices/bus/z88/flash.cpp
index ee92f351ec7..1fb8f9b6420 100644
--- a/src/devices/bus/z88/flash.cpp
+++ b/src/devices/bus/z88/flash.cpp
@@ -73,7 +73,7 @@ uint8_t* z88_1024k_flash_device::get_cart_base()
READ8_MEMBER(z88_1024k_flash_device::read)
{
- return m_flash->read(offset & (get_cart_size() - 1));
+ return m_flash->read(space, offset & (get_cart_size() - 1));
}
/*-------------------------------------------------
@@ -82,5 +82,5 @@ READ8_MEMBER(z88_1024k_flash_device::read)
WRITE8_MEMBER(z88_1024k_flash_device::write)
{
- m_flash->write(offset & (get_cart_size() - 1), data);
+ m_flash->write(space, offset & (get_cart_size() - 1), data);
}
diff --git a/src/devices/bus/z88/z88.h b/src/devices/bus/z88/z88.h
index 444eeb3c111..de8ecdc883f 100644
--- a/src/devices/bus/z88/z88.h
+++ b/src/devices/bus/z88/z88.h
@@ -90,18 +90,9 @@ class z88cart_slot_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- z88cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
- : z88cart_slot_device(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(false);
- }
z88cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
- auto out_flp_callback() { return m_out_flp_cb.bind(); }
+ template <class Object> devcb_base &set_out_flp_callback(Object &&cb) { return m_out_flp_cb.set_callback(std::forward<Object>(cb)); }
// image-level overrides
virtual image_init_result call_load() override;
@@ -142,4 +133,12 @@ private:
// device type definition
DECLARE_DEVICE_TYPE(Z88CART_SLOT, z88cart_slot_device)
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_Z88CART_SLOT_OUT_FLP_CB(_devcb) \
+ downcast<z88cart_slot_device &>(*device).set_out_flp_callback(DEVCB_##_devcb);
+
#endif // MAME_BUS_Z88_Z88_H
diff --git a/src/devices/cpu/8x300/8x300.cpp b/src/devices/cpu/8x300/8x300.cpp
index a8a9b9dcdad..130df2dd7e3 100644
--- a/src/devices/cpu/8x300/8x300.cpp
+++ b/src/devices/cpu/8x300/8x300.cpp
@@ -34,29 +34,17 @@
// for XEC intruction, which sets the AR, but not PC, so that after the instruction at the relative address is done, execution
// returns back to next instruction after XEC, unless a JMP or successful NZT is there.
#define SET_AR(x) do { m_AR = (x); m_increment_pc = false; } while (0)
-#define SRC_LATCH do { if(SRC_IS_RIGHT_BANK) m_IV_latch = READPORT(m_IVR+0x100); else m_IV_latch = READPORT(m_IVL); } while (0)
-#define DST_LATCH do { if(DST_IS_RIGHT_BANK) m_IV_latch = READPORT(m_IVR+0x100); else m_IV_latch = READPORT(m_IVL); } while (0)
+#define SRC_LATCH do { if(SRC_IS_RIGHT_BANK) m_right_IV = READPORT(m_IVR+0x100); else m_left_IV = READPORT(m_IVL); } while (0)
+#define DST_LATCH do { if(DST_IS_RIGHT_BANK) m_right_IV = READPORT(m_IVR+0x100); else m_left_IV = READPORT(m_IVL); } while (0)
#define SET_OVF do { if(result & 0xff00) m_OVF = 1; else m_OVF = 0; } while (0)
DEFINE_DEVICE_TYPE(N8X300, n8x300_cpu_device, "8x300", "Signetics 8X300")
-DEFINE_DEVICE_TYPE(N8X305, n8x305_cpu_device, "8x305", "Signetics 8X305")
-n8x300_cpu_device::n8x300_cpu_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_BIG, 16, 13, -1)
- , m_io_config("io", ENDIANNESS_BIG, 8, 9, 0)
- , m_sc_callback(*this)
-{
-}
-
n8x300_cpu_device::n8x300_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : n8x300_cpu_device(mconfig, N8X300, tag, owner, clock)
-{
-}
-
-n8x305_cpu_device::n8x305_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : n8x300_cpu_device(mconfig, N8X305, tag, owner, clock)
+ : cpu_device(mconfig, N8X300, tag, owner, clock)
+ , m_program_config("program", ENDIANNESS_BIG, 16, 14, 0)
+ , m_io_config("io", ENDIANNESS_BIG, 8, 9, 0)
{
}
@@ -68,21 +56,9 @@ device_memory_interface::space_config_vector n8x300_cpu_device::memory_space_con
};
}
-void n8x300_cpu_device::xmit_lb(uint8_t dst, uint8_t mask)
+void n8x300_cpu_device::set_reg(uint8_t reg, uint8_t val)
{
- m_IV_latch = (m_IV_latch & ~mask) | (dst & mask);
- WRITEPORT(m_IVL, m_IV_latch);
-}
-
-void n8x300_cpu_device::xmit_rb(uint8_t dst, uint8_t mask)
-{
- m_IV_latch = (m_IV_latch & ~mask) | (dst & mask);
- WRITEPORT(m_IVR + 0x100, m_IV_latch);
-}
-
-void n8x300_cpu_device::set_reg(uint8_t reg, uint8_t val, bool xmit)
-{
- switch (reg)
+ switch(reg)
{
case 0x00: m_AUX = val; break;
case 0x01: m_R1 = val; break;
@@ -91,30 +67,17 @@ void n8x300_cpu_device::set_reg(uint8_t reg, uint8_t val, bool xmit)
case 0x04: m_R4 = val; break;
case 0x05: m_R5 = val; break;
case 0x06: m_R6 = val; break;
- case 0x07: m_IVL = val; m_sc_callback(0, val); break;
+ case 0x07: m_IVL = val; break;
// OVF is read-only
case 0x09: m_R11 = val; break;
- case 0x0f: m_IVR = val; m_sc_callback(1, val); break;
+ case 0x0f: m_IVR = val; break;
default: logerror("8X300: Invalid register %02x written to.\n",reg); break;
}
}
-void n8x305_cpu_device::set_reg(uint8_t reg, uint8_t val, bool xmit)
-{
- switch (reg)
- {
- case 0x0a: if (xmit) xmit_lb(val, 0xff); else m_R12 = val; break;
- case 0x0b: if (xmit) xmit_rb(val, 0xff); else m_R13 = val; break;
- case 0x0c: m_R14 = val; break;
- case 0x0d: m_R15 = val; break;
- case 0x0e: m_R16 = val; break;
- default: n8x300_cpu_device::set_reg(reg, val, xmit); break;
- }
-}
-
uint8_t n8x300_cpu_device::get_reg(uint8_t reg)
{
- switch (reg)
+ switch(reg)
{
case 0x00: return m_AUX;
case 0x01: return m_R1;
@@ -123,38 +86,18 @@ uint8_t n8x300_cpu_device::get_reg(uint8_t reg)
case 0x04: return m_R4;
case 0x05: return m_R5;
case 0x06: return m_R6;
-// IVL is write-only on the 8X300
+// IVL is write-only
case 0x08: return m_OVF;
case 0x09: return m_R11;
-// IVR is write-only on the 8X300
+// IVR is write-only
default: logerror("8X300: Invalid register %02x read.\n",reg); return 0;
}
}
-uint8_t n8x305_cpu_device::get_reg(uint8_t reg)
-{
- switch (reg)
- {
- case 0x07: return m_IVL;
- case 0x0a: return m_R12;
- case 0x0b: return m_R13;
- case 0x0c: return m_R14;
- case 0x0d: return m_R15;
- case 0x0e: return m_R16;
- case 0x0f: return m_IVR;
- default: return n8x300_cpu_device::get_reg(reg);
- }
-}
-
-void n8x300_cpu_device::device_resolve_objects()
-{
- m_sc_callback.resolve_safe();
-}
-
void n8x300_cpu_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<1, -1, ENDIANNESS_BIG>();
+ m_cache = m_program->cache<1, 0, ENDIANNESS_BIG>();
m_io = &space(AS_IO);
save_item(NAME(m_PC));
@@ -167,19 +110,12 @@ void n8x300_cpu_device::device_start()
save_item(NAME(m_R5));
save_item(NAME(m_R6));
save_item(NAME(m_R11));
- if (type() == N8X305)
- {
- save_item(NAME(m_R12));
- save_item(NAME(m_R13));
- save_item(NAME(m_R14));
- save_item(NAME(m_R15));
- save_item(NAME(m_R16));
- }
save_item(NAME(m_AUX));
save_item(NAME(m_IVL));
save_item(NAME(m_IVR));
save_item(NAME(m_OVF));
- save_item(NAME(m_IV_latch));
+ save_item(NAME(m_left_IV));
+ save_item(NAME(m_right_IV));
save_item(NAME(m_genPC));
save_item(NAME(m_increment_pc));
@@ -191,14 +127,6 @@ void n8x300_cpu_device::device_start()
m_R5 = 0;
m_R6 = 0;
m_R11 = 0;
- if (type() == N8X305)
- {
- m_R12 = 0;
- m_R13 = 0;
- m_R14 = 0;
- m_R15 = 0;
- m_R16 = 0;
- }
m_IVL = 0;
m_IVR = 0;
m_AUX = 0;
@@ -218,19 +146,11 @@ void n8x300_cpu_device::device_start()
state_add( _8X300_R5, "R5", m_R5).mask(0xff).formatstr("%02X");
state_add( _8X300_R6, "R6", m_R6).mask(0xff).formatstr("%02X");
state_add( _8X300_R11, "R11", m_R11).mask(0xff).formatstr("%02X");
- if (type() == N8X305)
- {
- state_add( _8X300_R12, "R12", m_R12).mask(0xff).formatstr("%02X");
- state_add( _8X300_R13, "R13", m_R13).mask(0xff).formatstr("%02X");
- state_add( _8X300_R14, "R14", m_R14).mask(0xff).formatstr("%02X");
- state_add( _8X300_R15, "R15", m_R15).mask(0xff).formatstr("%02X");
- state_add( _8X300_R16, "R16", m_R16).mask(0xff).formatstr("%02X");
- }
state_add( _8X300_OVF, "OVF", m_OVF).mask(0x01).formatstr("%01X");
state_add( _8X300_IVL, "IVL", m_IVL).mask(0xff).formatstr("%02X");
state_add( _8X300_IVR, "IVR", m_IVR).mask(0xff).formatstr("%02X");
- state_add(STATE_GENPC, "GENPC", m_genPC).mask(0x1fff).callimport().noshow();
- state_add(STATE_GENPCBASE, "CURPC", m_genPC).mask(0x1fff).callimport().noshow();
+ state_add(STATE_GENPC, "GENPC", m_genPC).mask(0x3ffe).callimport().noshow();
+ state_add(STATE_GENPCBASE, "CURPC", m_genPC).mask(0x3ffe).callimport().noshow();
set_icountptr(m_icount);
}
@@ -246,12 +166,12 @@ void n8x300_cpu_device::state_import(const device_state_entry &entry)
{
case _8X300_PC:
m_AR = m_PC;
- m_genPC = m_AR;
+ m_genPC = m_AR << 1;
m_increment_pc = true;
break;
case _8X300_AR:
- m_genPC = m_AR;
+ m_genPC = m_AR << 1;
m_increment_pc = false;
break;
@@ -282,9 +202,10 @@ void n8x300_cpu_device::execute_run()
uint8_t dst;
uint8_t rotlen; // rotate amount or I/O field length
uint8_t mask;
+ uint16_t result;
/* fetch the opcode */
- m_genPC = m_AR;
+ m_genPC = m_AR << 1;
debugger_instruction_hook(m_genPC);
opcode = FETCHOP(m_genPC);
@@ -309,7 +230,7 @@ void n8x300_cpu_device::execute_run()
{
src = get_reg(SRC);
dst = rotate(src,rotlen);
- set_reg(DST,dst,false);
+ set_reg(DST,dst);
}
else
{
@@ -322,42 +243,62 @@ void n8x300_cpu_device::execute_run()
src = (get_reg(SRC)) << (7-DST_LSB);
mask <<= (7-DST_LSB);
if(DST_IS_RIGHT_BANK)
- xmit_rb(src, mask);
+ {
+ dst = (m_right_IV & ~mask) | (src & mask);
+ m_right_IV = dst;
+ WRITEPORT(m_IVR+0x100,m_right_IV);
+ }
else
- xmit_lb(src, mask);
+ {
+ dst = (m_left_IV & ~mask) | (src & mask);
+ m_left_IV = dst;
+ WRITEPORT(m_IVL,m_left_IV);
+ }
}
else if(!(is_src_reg(opcode)) && is_dst_reg(opcode))
{ // MOVE IV,reg
SRC_LATCH;
- src = rotate(m_IV_latch,7-SRC_LSB);
+ if(SRC_IS_RIGHT_BANK)
+ src = rotate(m_right_IV,7-SRC_LSB);
+ else
+ src = rotate(m_left_IV,7-SRC_LSB);
mask = ((1 << rotlen)-1);
dst = src & mask;
- set_reg(DST,dst,false);
+ set_reg(DST,dst);
}
else if(!(is_src_reg(opcode)) && !(is_dst_reg(opcode)))
{ // MOVE IV,IV
SRC_LATCH;
- src = rotate(m_IV_latch,7-SRC_LSB);
+ if(SRC_IS_RIGHT_BANK)
+ src = rotate(m_right_IV,7-SRC_LSB);
+ else
+ src = rotate(m_left_IV,7-SRC_LSB);
mask = ((1 << rotlen)-1);
dst = src & mask;
dst <<= (7-DST_LSB);
mask <<= (7-DST_LSB);
- if(DST_IS_RIGHT_BANK) // untouched source IV bits are preserved and sent to destination IV
- xmit_rb(dst, mask);
+ if(SRC_IS_RIGHT_BANK) // untouched source IV bits are preserved and sent to destination IV
+ {
+ dst = (m_right_IV & ~mask) | (dst & mask);
+ m_right_IV = dst;
+ WRITEPORT(m_IVR+0x100,m_right_IV);
+ }
else
- xmit_lb(dst, mask);
+ {
+ dst = (m_left_IV & ~mask) | (dst & mask);
+ m_left_IV = dst;
+ WRITEPORT(m_IVL,m_left_IV);
+ }
}
}
break;
case 0x01: // ADD
- {
- uint16_t result;
rotlen = ROTLEN;
if(is_rot(opcode))
{ // ADD reg,reg
src = rotate(get_reg(SRC),rotlen);
result = src + m_AUX;
- set_reg(DST,result & 0xff,false);
+ set_reg(DST,result & 0xff);
SET_OVF;
}
else
@@ -373,43 +314,65 @@ void n8x300_cpu_device::execute_run()
mask <<= DST_LSB;
SET_OVF;
if(DST_IS_RIGHT_BANK)
- xmit_rb(dst, mask);
+ {
+ dst = (m_right_IV & ~mask) | (dst & mask);
+ m_right_IV = dst;
+ WRITEPORT(m_IVR+0x100,m_right_IV);
+ }
else
- xmit_lb(dst, mask);
+ {
+ dst = (m_left_IV & ~mask) | (dst & mask);
+ m_left_IV = dst;
+ WRITEPORT(m_IVL,m_left_IV);
+ }
}
else if(!(is_src_reg(opcode)) && is_dst_reg(opcode))
{ // ADD IV,reg
SRC_LATCH;
mask = ((1 << rotlen)-1);
- src = rotate(m_IV_latch,7-SRC_LSB) & mask;
+ if(SRC_IS_RIGHT_BANK)
+ src = rotate(m_right_IV,7-SRC_LSB) & mask;
+ else
+ src = rotate(m_left_IV,7-SRC_LSB) & mask;
result = src + m_AUX;
SET_OVF;
- set_reg(DST,result & 0xff,false);
+ set_reg(DST,result & 0xff);
}
else if(!(is_src_reg(opcode)) && !(is_dst_reg(opcode)))
{ // ADD IV,IV
SRC_LATCH;
+ DST_LATCH;
mask = ((1 << rotlen)-1);
- src = rotate(m_IV_latch,7-SRC_LSB) & mask;
+ if(SRC_IS_RIGHT_BANK)
+ src = rotate(m_right_IV,7-SRC_LSB) & mask;
+ else
+ src = rotate(m_left_IV,7-SRC_LSB) & mask;
result = src + m_AUX;
SET_OVF;
dst = (result << (7-DST_LSB)) & 0xff;
mask <<= (7-DST_LSB);
- if(DST_IS_RIGHT_BANK) // unused destination IV data is not preserved, is merged with input IV data
- xmit_rb(dst, mask);
+ if(SRC_IS_RIGHT_BANK) // unused destination IV data is not preserved, is merged with input IV data
+ {
+ dst = (m_right_IV & ~mask) | (dst & mask);
+ m_right_IV = dst;
+ WRITEPORT(m_IVR+0x100,m_right_IV);
+ }
else
- xmit_lb(dst, mask);
+ {
+ dst = (m_left_IV & ~mask) | (dst & mask);
+ m_left_IV = dst;
+ WRITEPORT(m_IVL,m_left_IV);
+ }
}
}
break;
- }
case 0x02: // AND
rotlen = ROTLEN;
if(is_rot(opcode))
{ // AND reg,reg
src = rotate(get_reg(SRC),rotlen);
dst = src & m_AUX;
- set_reg(DST,dst,false);
+ set_reg(DST,dst);
}
else
{
@@ -418,36 +381,60 @@ void n8x300_cpu_device::execute_run()
if(is_src_reg(opcode) && !(is_dst_reg(opcode)))
{ // AND reg,IV
DST_LATCH;
- src = get_reg(SRC);
- dst = src & m_AUX;
+ src = get_reg(SRC) & m_AUX;
mask = ((1 << rotlen)-1);
- dst <<= (7-DST_LSB);
+ src <<= (7-DST_LSB);
mask <<= (7-DST_LSB);
if(DST_IS_RIGHT_BANK)
- xmit_rb(dst, mask);
+ {
+ dst = (m_right_IV & ~mask) | (src & mask);
+ m_right_IV = dst;
+ WRITEPORT(m_IVR+0x100,m_right_IV);
+ }
else
- xmit_lb(dst, mask);
+ {
+ dst = (m_left_IV & ~mask) | (src & mask);
+ m_left_IV = dst;
+ WRITEPORT(m_IVL,m_left_IV);
+ }
}
else if(!(is_src_reg(opcode)) && is_dst_reg(opcode))
{ // AND IV,reg
SRC_LATCH;
mask = ((1 << rotlen)-1);
- src = rotate(m_IV_latch,7-SRC_LSB) & mask;
+ if(SRC_IS_RIGHT_BANK)
+ src = rotate(m_right_IV,7-SRC_LSB) & mask;
+ else
+ src = rotate(m_left_IV,7-SRC_LSB) & mask;
+ src &= mask;
dst = src & m_AUX;
- set_reg(DST,dst,false);
+ set_reg(DST,dst);
}
else if(!(is_src_reg(opcode)) && !(is_dst_reg(opcode)))
{ // AND IV,IV
SRC_LATCH;
+ DST_LATCH;
mask = ((1 << rotlen)-1);
- src = rotate(m_IV_latch,7-SRC_LSB) & mask;
+ if(SRC_IS_RIGHT_BANK)
+ src = rotate(m_right_IV,7-SRC_LSB) & mask;
+ else
+ src = rotate(m_left_IV,7-SRC_LSB) & mask;
+ src &= mask;
dst = src & m_AUX;
dst <<= (7-DST_LSB);
mask <<= (7-DST_LSB);
- if(DST_IS_RIGHT_BANK)
- xmit_rb(dst, mask);
+ if(SRC_IS_RIGHT_BANK)
+ {
+ dst = (m_right_IV & ~mask) | (src & mask);
+ m_right_IV = dst;
+ WRITEPORT(m_IVR+0x100,m_right_IV);
+ }
else
- xmit_lb(dst, mask);
+ {
+ dst = (m_left_IV & ~mask) | (src & mask);
+ m_left_IV = dst;
+ WRITEPORT(m_IVL,m_left_IV);
+ }
}
}
break;
@@ -457,45 +444,69 @@ void n8x300_cpu_device::execute_run()
{ // AND reg,reg
src = rotate(get_reg(SRC),rotlen);
dst = src ^ m_AUX;
- set_reg(DST,dst,false);
+ set_reg(DST,dst);
}
else
{
if(rotlen == 0)
rotlen = 8; // 0 = 8-bit I/O field length
if(is_src_reg(opcode) && !(is_dst_reg(opcode)))
- { // XOR reg,IV
+ { // AND reg,IV
DST_LATCH;
- src = get_reg(SRC);
- dst = src ^ m_AUX;
+ src = get_reg(SRC) ^ m_AUX;
mask = ((1 << rotlen)-1);
- dst <<= (7-DST_LSB);
+ src <<= (7-DST_LSB);
mask <<= (7-DST_LSB);
if(DST_IS_RIGHT_BANK)
- xmit_rb(dst, mask);
+ {
+ dst = (m_right_IV & ~mask) | (src & mask);
+ m_right_IV = dst;
+ WRITEPORT(m_IVR+0x100,m_right_IV);
+ }
else
- xmit_lb(dst, mask);
+ {
+ dst = (m_left_IV & ~mask) | (src & mask);
+ m_left_IV = dst;
+ WRITEPORT(m_IVL,m_left_IV);
+ }
}
else if(!(is_src_reg(opcode)) && is_dst_reg(opcode))
- { // XOR IV,reg
+ { // AND IV,reg
SRC_LATCH;
mask = ((1 << rotlen)-1);
- src = rotate(m_IV_latch,7-SRC_LSB) & mask;
+ if(SRC_IS_RIGHT_BANK)
+ src = rotate(m_right_IV,7-SRC_LSB) & mask;
+ else
+ src = rotate(m_left_IV,7-SRC_LSB) & mask;
+ src &= mask;
dst = src ^ m_AUX;
- set_reg(DST,dst,false);
+ set_reg(DST,dst);
}
else if(!(is_src_reg(opcode)) && !(is_dst_reg(opcode)))
- { // XOR IV,IV
+ { // AND IV,IV
SRC_LATCH;
+ DST_LATCH;
mask = ((1 << rotlen)-1);
- src = rotate(m_IV_latch,7-SRC_LSB) & mask;
+ if(SRC_IS_RIGHT_BANK)
+ src = rotate(m_right_IV,7-SRC_LSB) & mask;
+ else
+ src = rotate(m_left_IV,7-SRC_LSB) & mask;
+ src &= mask;
dst = src ^ m_AUX;
dst <<= (7-DST_LSB);
mask <<= (7-DST_LSB);
- if(DST_IS_RIGHT_BANK)
- xmit_rb(dst, mask);
+ if(SRC_IS_RIGHT_BANK)
+ {
+ dst = (m_right_IV & ~mask) | (src & mask);
+ m_right_IV = dst;
+ WRITEPORT(m_IVR+0x100,m_right_IV);
+ }
else
- xmit_lb(dst, mask);
+ {
+ dst = (m_left_IV & ~mask) | (src & mask);
+ m_left_IV = dst;
+ WRITEPORT(m_IVL,m_left_IV);
+ }
}
}
break;
@@ -513,7 +524,10 @@ void n8x300_cpu_device::execute_run()
if(rotlen == 0)
rotlen = 8; // 0 = 8-bit I/O field length
mask = ((1 << rotlen)-1);
- src = rotate(m_IV_latch,7-SRC_LSB);
+ if(SRC_IS_RIGHT_BANK)
+ src = rotate(m_right_IV,7-SRC_LSB);
+ else
+ src = rotate(m_left_IV,7-SRC_LSB);
src &= mask;
src += IMM5;
SET_AR((m_AR & 0x1fe0) | (src & 0x1f));
@@ -533,7 +547,11 @@ void n8x300_cpu_device::execute_run()
if(rotlen == 0)
rotlen = 8; // 0 = 8-bit I/O field length
mask = ((1 << rotlen)-1);
- src = rotate(m_IV_latch,7-SRC_LSB);
+ if(SRC_IS_RIGHT_BANK)
+ src = rotate(m_right_IV,7-SRC_LSB);
+ else
+ src = rotate(m_left_IV,7-SRC_LSB);
+ rotate(src,SRC_LSB);
src &= mask;
if(src != 0)
SET_PC((m_PC & 0x1fe0) | IMM5);
@@ -542,7 +560,7 @@ void n8x300_cpu_device::execute_run()
case 0x06: // XMIT (Transmit)
// the source is actually the destination for this instruction
if(is_src_reg(opcode))
- set_reg(SRC,IMM8,true);
+ set_reg(SRC,IMM8);
else
{
SRC_LATCH;
@@ -554,9 +572,15 @@ void n8x300_cpu_device::execute_run()
mask <<= (7-SRC_LSB);
dst <<= (7-SRC_LSB);
if(SRC_IS_RIGHT_BANK)
- xmit_rb(dst, mask);
+ {
+ m_right_IV = (m_right_IV & ~mask) | (dst & mask);
+ WRITEPORT(m_IVR+0x100,m_right_IV);
+ }
else
- xmit_lb(dst, mask);
+ {
+ m_left_IV = (m_left_IV & ~mask) | (dst & mask);
+ WRITEPORT(m_IVL,m_left_IV);
+ }
}
break;
case 0x07: // JMP
diff --git a/src/devices/cpu/8x300/8x300.h b/src/devices/cpu/8x300/8x300.h
index 155079d225a..e3e3d68e7f6 100644
--- a/src/devices/cpu/8x300/8x300.h
+++ b/src/devices/cpu/8x300/8x300.h
@@ -28,11 +28,11 @@ enum
_8X300_IVL,
_8X300_OVF,
_8X300_R11,
- _8X300_R12,
- _8X300_R13,
- _8X300_R14,
- _8X300_R15,
- _8X300_R16,
+ _8X300_UNUSED12,
+ _8X300_UNUSED13,
+ _8X300_UNUSED14,
+ _8X300_UNUSED15,
+ _8X300_UNUSED16,
_8X300_IVR,
_8X300_LIV,
_8X300_RIV,
@@ -45,13 +45,8 @@ public:
// construction/destruction
n8x300_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto sc_callback() { return m_sc_callback.bind(); }
-
protected:
- n8x300_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
// device-level overrides
- virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
@@ -70,12 +65,6 @@ protected:
// device_disasm_interface overrides
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
- virtual void set_reg(uint8_t reg, uint8_t val, bool xmit);
- virtual uint8_t get_reg(uint8_t reg);
-
- void xmit_lb(uint8_t dst, uint8_t mask);
- void xmit_rb(uint8_t dst, uint8_t mask);
-
address_space_config m_program_config;
address_space_config m_io_config;
@@ -83,11 +72,9 @@ protected:
bool m_increment_pc;
address_space *m_program;
- memory_access_cache<1, -1, ENDIANNESS_BIG> *m_cache;
+ memory_access_cache<1, 0, ENDIANNESS_BIG> *m_cache;
address_space *m_io;
- devcb_write8 m_sc_callback; // Select Command (address latch)
-
uint16_t m_PC; // Program Counter
uint16_t m_AR; // Address Register
uint16_t m_IR; // Instruction Register
@@ -99,17 +86,13 @@ protected:
uint8_t m_R5;
uint8_t m_R6;
uint8_t m_R11;
- uint8_t m_R12;
- uint8_t m_R13;
- uint8_t m_R14;
- uint8_t m_R15;
- uint8_t m_R16;
uint8_t m_IVL; // Interface vector (I/O) left bank (write-only)
uint8_t m_IVR; // Interface vector (I/O) right bank (write-only)
uint8_t m_OVF; // Overflow register (read-only)
uint16_t m_genPC;
- uint8_t m_IV_latch; // IV bank contents, these are latched when IVL or IVR are set
+ uint8_t m_left_IV; // IV bank contents, these are latched when IVL or IVR are set
+ uint8_t m_right_IV;
private:
inline bool is_rot(uint16_t opcode)
@@ -137,20 +120,10 @@ private:
{
return ((s & ((uint8_t)0xff << n)) >> n) | ((s & ((uint8_t)0xff >> (8-n))) << (8-n));
}
-};
-
-class n8x305_cpu_device : public n8x300_cpu_device
-{
-public:
- // construction/destruction
- n8x305_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- virtual void set_reg(uint8_t reg, uint8_t val, bool xmit) override;
- virtual uint8_t get_reg(uint8_t reg) override;
+ void set_reg(uint8_t reg,uint8_t val);
+ uint8_t get_reg(uint8_t reg);
};
DECLARE_DEVICE_TYPE(N8X300, n8x300_cpu_device)
-DECLARE_DEVICE_TYPE(N8X305, n8x305_cpu_device)
#endif // MAME_CPU_8X300_8X300_H
diff --git a/src/devices/cpu/8x300/8x300dasm.cpp b/src/devices/cpu/8x300/8x300dasm.cpp
index 3f03ed19cfd..db231195f04 100644
--- a/src/devices/cpu/8x300/8x300dasm.cpp
+++ b/src/devices/cpu/8x300/8x300dasm.cpp
@@ -19,7 +19,7 @@
const char *const n8x300_disassembler::reg_names[32] =
{
"AUX", "R1", "R2", "R3", "R4", "R5", "R6", "IVL", "OVF", "R11",
- "R12", "R13", "R14", "R15", "R16", "IVR",
+ "Unused12", "Unused13", "Unused14", "Unused15", "Unused16", "IVR",
"LIV0", "LIV1", "LIV2", "LIV3", "LIV4", "LIV5", "LIV6", "LIV7",
"RIV0", "RIV1", "RIV2", "RIV3", "RIV4", "RIV5", "RIV6", "RIV7"
};
@@ -43,7 +43,7 @@ bool n8x300_disassembler::is_src_rot(uint16_t opcode)
u32 n8x300_disassembler::opcode_alignment() const
{
- return 1;
+ return 2;
}
offs_t n8x300_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params)
@@ -51,7 +51,7 @@ offs_t n8x300_disassembler::disassemble(std::ostream &stream, offs_t pc, const d
unsigned startpc = pc;
uint16_t opcode = opcodes.r16(pc);
uint8_t inst = opcode >> 13;
- pc+=1;
+ pc+=2;
// determine instruction
switch (inst)
@@ -127,7 +127,7 @@ offs_t n8x300_disassembler::disassemble(std::ostream &stream, offs_t pc, const d
}
break;
case 0x07:
- util::stream_format(stream, "JMP %04XH", (opcode & 0x1fff));
+ util::stream_format(stream, "JMP %04XH", (opcode & 0x1fff) << 1);
break;
}
diff --git a/src/devices/cpu/alpha/alpha.cpp b/src/devices/cpu/alpha/alpha.cpp
deleted file mode 100644
index 9ebfc6dd09e..00000000000
--- a/src/devices/cpu/alpha/alpha.cpp
+++ /dev/null
@@ -1,995 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Patrick Mackinlay
-
-/*
- * An implementation of the Digital Alpha CPU family.
- *
- * Sources:
- *
- * http://bitsavers.org/pdf/dec/alpha/21064-aa-RISC%20Microprocessor%20Preliminary%20Data%20Sheet-apr92.pdf
- * http://bitsavers.org/pdf/dec/alpha/Sites_AlphaAXPArchitectureReferenceManual_2ed_1995.pdf
- * https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob_plain;f=opcodes/alpha-opc.c;hb=HEAD
- * http://ftp.twaren.net/NetBSD/misc/dec-docs/
- *
- * TODO
- * - interrupts and exceptions
- * - address translation
- * - ibox/abox registers
- * - floating point instructions
- * - primary caches
- * - later cpu implementations
- * - instruction set extensions
- * - big-endian mode
- */
-
-#include "emu.h"
-#include "alpha.h"
-#include "common.h"
-
-#include "debugger.h"
-
-#include "softfloat3/source/include/softfloat.h"
-
-#define LOG_GENERAL (1U << 0)
-#define LOG_EXCEPTION (1U << 1)
-#define LOG_SYSCALLS (1U << 2)
-
-//#define VERBOSE (LOG_GENERAL | LOG_EXCEPTION)
-
-#include "logmacro.h"
-
-DEFINE_DEVICE_TYPE(DEC_21064, dec_21064_device, "21064", "DEC Alpha 21064")
-
-dec_21064_device::dec_21064_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : alpha_ev4_device(mconfig, DEC_21064, tag, owner, clock)
-{
-}
-
-alpha_ev4_device::alpha_ev4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
- : alpha_device(mconfig, type, tag, owner, clock)
-{
-}
-
-alpha_device::alpha_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
- : cpu_device(mconfig, type, tag, owner, clock)
- , m_dasm_type(alpha_disassembler::dasm_type::TYPE_UNKNOWN)
- , m_as_config
- {
- address_space_config("0", ENDIANNESS_LITTLE, 64, 32, 0),
- address_space_config("1", ENDIANNESS_LITTLE, 64, 32, 0),
- address_space_config("2", ENDIANNESS_LITTLE, 64, 32, 0),
- address_space_config("3", ENDIANNESS_LITTLE, 64, 32, 0)
- }
- , m_srom_oe_cb(*this)
- , m_srom_data_cb(*this)
- , m_icount(0)
-{
-}
-
-void alpha_device::device_start()
-{
- set_icountptr(m_icount);
-
- save_item(NAME(m_pc));
- save_item(NAME(m_r));
- save_item(NAME(m_f));
-
- save_item(NAME(m_pal_mode));
-
- state_add(STATE_GENPC, "GENPC", m_pc).noshow();
- state_add(STATE_GENPCBASE, "CURPC", m_pc).noshow();
-
- state_add(64, "PC", m_pc);
-
- // integer registers
- for (unsigned i = 0; i < 32; i++)
- state_add(i, util::string_format("R%d", i).c_str(), m_r[i]);
-
- // floating point registers
- for (unsigned i = 0; i < 32; i++)
- state_add(i + 32, util::string_format("F%d", i).c_str(), m_f[i]);
-
- m_srom_oe_cb.resolve_safe();
- m_srom_data_cb.resolve_safe(0);
-}
-
-void alpha_device::device_reset()
-{
- m_pc = 0;
- m_pal_mode = true;
-}
-
-void alpha_device::execute_run()
-{
- while (m_icount > 0)
- {
- debugger_instruction_hook(m_pc);
-
- fetch(m_pc,
- [this](u32 const op)
- {
- // update the program counter
- m_pc += 4;
-
- // execute an instruction
- cpu_execute(op);
-
- // reset always-zero registers
- m_r[31] = 0;
- m_f[31] = 0;
- });
-
- m_icount--;
- }
-}
-
-void alpha_device::execute_set_input(int inputnum, int state)
-{
-}
-
-device_memory_interface::space_config_vector alpha_device::memory_space_config() const
-{
- /*
- * EV4 devices have a 34-bit physical address space. This is mapped using
- * the top two bits to select one of four memory spaces with the other 32
- * bits giving the offset within each space. This approach works out quite
- * well for the jensen hardware, which uses the first space for memory, and
- * the others for a variety of I/O memory mapping.
- *
- * Note: space numbers are multiplied by two to avoid the special handling
- * applied to the decrypted opcode space (number 3).
- */
- return space_config_vector {
- std::make_pair(0, &m_as_config[0]),
- std::make_pair(2, &m_as_config[1]),
- std::make_pair(4, &m_as_config[2]),
- std::make_pair(6, &m_as_config[3])
- };
-}
-
-bool alpha_device::memory_translate(int spacenum, int intention, offs_t &address)
-{
- u64 placeholder = s64(s32(address));
-
- if (cpu_translate(placeholder, intention))
- {
- address = placeholder;
-
- return true;
- }
-
- return false;
-}
-
-std::unique_ptr<util::disasm_interface> alpha_device::create_disassembler()
-{
- return std::make_unique<alpha_disassembler>(m_dasm_type);
-}
-
-void alpha_device::cpu_execute(u32 const op)
-{
- switch ((op >> 26) & 0x3f)
- {
- case 0x08: m_r[Ra(op)] = m_r[Rb(op)] + Disp_M(op); break; // lda
- case 0x09: m_r[Ra(op)] = m_r[Rb(op)] + (Disp_M(op) << 16); break; // ldah
- case 0x0b: load<u64>((m_r[Rb(op)] + Disp_M(op)) & ~7, [this, op](u64 data) { m_r[Ra(op)] = data; }); break; // ldq_u
- case 0x0f: store<u64>((m_r[Rb(op)] + Disp_M(op)) & ~7, m_r[Ra(op)]); break; // stq_u
-
- case 0x10: // INTA* (integer arithmetic)
- switch ((op >> 5) & 0xff)
- {
- // register variants
- case 0x00: m_r[Rc(op)] = s64(s32(m_r[Ra(op)]) + s32(m_r[Rb(op)])); break; // addl
- case 0x02: m_r[Rc(op)] = s64(s32(m_r[Ra(op)] << 2) + s32(m_r[Rb(op)])); break; // s4addl
- case 0x09: m_r[Rc(op)] = s64(s32(m_r[Ra(op)]) - s32(m_r[Rb(op)])); break; // subl
- case 0x0b: m_r[Rc(op)] = s64(s32(m_r[Ra(op)] << 2) - s32(m_r[Rb(op)])); break; // s4subl
- case 0x0f: // cmpbge
- {
- u8 temp = 0;
- for (unsigned i = 0; i < 8; i++)
- if (u8(m_r[Ra(op)] >> (i * 8)) >= u8(m_r[Rb(op)] >> (i * 8)))
- temp |= (1U << i);
-
- m_r[Rc(op)] = u64(temp);
- }
- break;
- case 0x12: m_r[Rc(op)] = s64(s32(m_r[Ra(op)] << 3) + s32(m_r[Rb(op)])); break; // s8addl
- case 0x1b: m_r[Rc(op)] = s64(s32(m_r[Ra(op)] << 3) - s32(m_r[Rb(op)])); break; // s8subl
- case 0x1d: m_r[Rc(op)] = m_r[Ra(op)] < m_r[Rb(op)]; break; // cmpult
- case 0x20: m_r[Rc(op)] = m_r[Ra(op)] + m_r[Rb(op)]; break; // addq
- case 0x22: m_r[Rc(op)] = (m_r[Ra(op)] << 2) + m_r[Rb(op)]; break; // s4addq
- case 0x29: m_r[Rc(op)] = m_r[Ra(op)] - m_r[Rb(op)]; break; // subq
- case 0x2b: m_r[Rc(op)] = (m_r[Ra(op)] << 2) - m_r[Rb(op)]; break; // s4subq
- case 0x2d: m_r[Rc(op)] = m_r[Ra(op)] == m_r[Rb(op)]; break; // cmpeq
- case 0x32: m_r[Rc(op)] = (m_r[Ra(op)] << 3) + m_r[Rb(op)]; break; // s8addq
- case 0x3b: m_r[Rc(op)] = (m_r[Ra(op)] << 3) - m_r[Rb(op)]; break; // s8subq
- case 0x3d: m_r[Rc(op)] = m_r[Ra(op)] <= m_r[Rb(op)]; break; // cmpule
- case 0x40: m_r[Rc(op)] = s64(s32(m_r[Ra(op)]) + s32(m_r[Rb(op)])); break; // addl/v
- case 0x49: m_r[Rc(op)] = s64(s32(m_r[Ra(op)]) - s32(m_r[Rb(op)])); break; // subl/v
- case 0x4d: m_r[Rc(op)] = s64(m_r[Ra(op)]) < s64(m_r[Rb(op)]); break; // cmplt
- case 0x60: m_r[Rc(op)] = m_r[Ra(op)] + m_r[Rb(op)]; break; // addq/v
- case 0x69: m_r[Rc(op)] = m_r[Ra(op)] - m_r[Rb(op)]; break; // subq/v
- case 0x6d: m_r[Rc(op)] = s64(m_r[Ra(op)]) <= s64(m_r[Rb(op)]); break; // cmple
-
- // immediate variants
- case 0x80: m_r[Rc(op)] = s64(s32(m_r[Ra(op)]) + s32(Im(op))); break; // addl
- case 0x82: m_r[Rc(op)] = s64(s32(m_r[Ra(op)] << 2) + s32(Im(op))); break; // s4addl
- case 0x89: m_r[Rc(op)] = s64(s32(m_r[Ra(op)]) - s32(Im(op))); break; // subl
- case 0x8b: m_r[Rc(op)] = s64(s32(m_r[Ra(op)] << 2) - s32(Im(op))); break; // s4subl
- case 0x8f: // cmpbge
- {
- u8 temp = 0;
- for (unsigned i = 0; i < 8; i++)
- if (u8(m_r[Ra(op)] >> (i * 8)) >= u8(Im(op)))
- temp |= (1U << i);
-
- m_r[Rc(op)] = u64(temp);
- }
- break;
- case 0x92: m_r[Rc(op)] = s64(s32(m_r[Ra(op)] << 3) + s32(Im(op))); break; // s4addl
- case 0x9b: m_r[Rc(op)] = s64(s32(m_r[Ra(op)] << 3) - s32(Im(op))); break; // s8subl
- case 0x9d: m_r[Rc(op)] = m_r[Ra(op)] < Im(op); break; // cmpult
- case 0xa0: m_r[Rc(op)] = m_r[Ra(op)] + Im(op); break; // addq
- case 0xa2: m_r[Rc(op)] = (m_r[Ra(op)] << 2) + Im(op); break; // s4addq
- case 0xa9: m_r[Rc(op)] = m_r[Ra(op)] - Im(op); break; // subq
- case 0xab: m_r[Rc(op)] = (m_r[Ra(op)] << 2) - Im(op); break; // s4subq
- case 0xad: m_r[Rc(op)] = m_r[Ra(op)] == Im(op); break; // cmpeq
- case 0xb2: m_r[Rc(op)] = (m_r[Ra(op)] << 3) + Im(op); break; // s8addq
- case 0xbb: m_r[Rc(op)] = (m_r[Ra(op)] << 3) - Im(op); break; // s8subq
- case 0xbd: m_r[Rc(op)] = m_r[Ra(op)] <= Im(op); break; // cmpule
- case 0xc0: m_r[Rc(op)] = s64(s32(m_r[Ra(op)]) + s32(Im(op))); break; // addl/v
- case 0xc9: m_r[Rc(op)] = s64(s32(m_r[Ra(op)]) - s32(Im(op))); break; // subl/v
- case 0xcd: m_r[Rc(op)] = s64(m_r[Ra(op)]) < s64(Im(op)); break; // cmplt
- case 0xe0: m_r[Rc(op)] = m_r[Ra(op)] + Im(op); break; // addq/v
- case 0xe9: m_r[Rc(op)] = m_r[Ra(op)] - Im(op); break; // subq/v
- case 0xed: m_r[Rc(op)] = s64(m_r[Ra(op)]) <= s64(Im(op)); break; // cmple
- }
- break;
- case 0x11: // INTL* (integer logical)
- switch ((op >> 5) & 0xff)
- {
- // register variants
- case 0x00: m_r[Rc(op)] = m_r[Ra(op)] & m_r[Rb(op)]; break; // and
- case 0x08: m_r[Rc(op)] = m_r[Ra(op)] & ~m_r[Rb(op)]; break; // bic
- case 0x14: // cmovlbs
- if (BIT(m_r[Ra(op)], 0))
- m_r[Rc(op)] = m_r[Rb(op)];
- break;
- case 0x16: // cmovlbc
- if (!BIT(m_r[Ra(op)], 0))
- m_r[Rc(op)] = m_r[Rb(op)];
- break;
- case 0x20: m_r[Rc(op)] = m_r[Ra(op)] | m_r[Rb(op)]; break; // bis
- case 0x24: // cmoveq
- if (m_r[Ra(op)] == 0)
- m_r[Rc(op)] = m_r[Rb(op)];
- break;
- case 0x26: // cmovne
- if (m_r[Ra(op)] != 0)
- m_r[Rc(op)] = m_r[Rb(op)];
- break;
- case 0x28: m_r[Rc(op)] = m_r[Ra(op)] | ~m_r[Rb(op)]; break; // ornot
- case 0x40: m_r[Rc(op)] = m_r[Ra(op)] ^ m_r[Rb(op)]; break; // xor
- case 0x44: // cmovlt
- if (s64(m_r[Ra(op)]) < 0)
- m_r[Rc(op)] = m_r[Rb(op)];
- break;
- case 0x46: // cmovge
- if (s64(m_r[Ra(op)]) >= 0)
- m_r[Rc(op)] = m_r[Rb(op)];
- break;
- case 0x48: m_r[Rc(op)] = m_r[Ra(op)] ^ ~m_r[Rb(op)]; break; // eqv
- case 0x61: m_r[Rc(op)] = m_r[Rb(op)]; break; // amask
- case 0x64: // cmovle
- if (s64(m_r[Ra(op)]) <= 0)
- m_r[Rc(op)] = m_r[Rb(op)];
- break;
- case 0x66: // cmovgt
- if (s64(m_r[Ra(op)]) > 0)
- m_r[Rc(op)] = m_r[Rb(op)];
- break;
-
- // immediate variants
- case 0x80: m_r[Rc(op)] = m_r[Ra(op)] & Im(op); break; // and
- case 0x88: m_r[Rc(op)] = m_r[Ra(op)] & ~Im(op); break; // bic
- case 0x94: // cmovlbs
- if (BIT(m_r[Ra(op)], 0))
- m_r[Rc(op)] = Im(op);
- break;
- case 0x96: // cmovlbc
- if (!BIT(m_r[Ra(op)], 0))
- m_r[Rc(op)] = Im(op);
- break;
- case 0xa0: m_r[Rc(op)] = m_r[Ra(op)] | Im(op); break; // bis
- case 0xa4: // cmoveq
- if (m_r[Ra(op)] == 0)
- m_r[Rc(op)] = Im(op);
- break;
- case 0xa6: // cmovne
- if (m_r[Ra(op)] != 0)
- m_r[Rc(op)] = Im(op);
- break;
- case 0xa8: m_r[Rc(op)] = m_r[Ra(op)] | ~Im(op); break; // ornot
- case 0xc0: m_r[Rc(op)] = m_r[Ra(op)] ^ Im(op); break; // xor
- case 0xc4: // cmovlt
- if (s64(m_r[Ra(op)]) < 0)
- m_r[Rc(op)] = Im(op);
- break;
- case 0xc6: // cmovge
- if (s64(m_r[Ra(op)]) >= 0)
- m_r[Rc(op)] = Im(op);
- break;
- case 0xc8: m_r[Rc(op)] = m_r[Ra(op)] ^ ~Im(op); break; // eqv
- case 0xe1: m_r[Rc(op)] = Im(op); break; // amask
- case 0xe4: // cmovle
- if (s64(m_r[Ra(op)]) <= 0)
- m_r[Rc(op)] = Im(op);
- break;
- case 0xe6: // cmovgt
- if (s64(m_r[Ra(op)]) > 0)
- m_r[Rc(op)] = Im(op);
- break;
- case 0xec: m_r[Rc(op)] = 0; break; // implver
- }
- break;
- case 0x12: // INTS* (integer shift)
- switch ((op >> 5) & 0xff)
- {
- // register variants
- case 0x02: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0x01) << (m_r[Rb(op)] & 7)); break; // mskbl
- case 0x06: m_r[Rc(op)] = (m_r[Ra(op)] >> ((m_r[Rb(op)] & 7) * 8)) & zap_mask(~u8(0x01)); break; // extbl
- case 0x0b: m_r[Rc(op)] = (m_r[Ra(op)] << ((m_r[Rb(op)] & 7) * 8)) & zap_mask(~(u8(0x01) << (m_r[Rb(op)] & 7))); break; // insbl
- case 0x12: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0x03) << (m_r[Rb(op)] & 7)); break; // mskwl
- case 0x16: m_r[Rc(op)] = (m_r[Ra(op)] >> ((m_r[Rb(op)] & 7) * 8)) & zap_mask(~u8(0x03)); break; // extwl
- case 0x1b: m_r[Rc(op)] = (m_r[Ra(op)] << ((m_r[Rb(op)] & 7) * 8)) & zap_mask(~(u8(0x03) << (m_r[Rb(op)] & 7))); break; // inswl
- case 0x22: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0x0f) << (m_r[Rb(op)] & 7)); break; // mskll
- case 0x26: m_r[Rc(op)] = (m_r[Ra(op)] >> ((m_r[Rb(op)] & 7) * 8)) & zap_mask(~u8(0x0f)); break; // extll
- case 0x2b: m_r[Rc(op)] = (m_r[Ra(op)] << ((m_r[Rb(op)] & 7) * 8)) & zap_mask(~(u8(0x0f) << (m_r[Rb(op)] & 7))); break; // insll
- case 0x30: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(m_r[Rb(op)]); break; // zap
- case 0x31: m_r[Rc(op)] = m_r[Ra(op)] & ~zap_mask(m_r[Rb(op)]); break; // zapnot
- case 0x32: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0xff) << (m_r[Rb(op)] & 7)); break; // mskql
- case 0x34: m_r[Rc(op)] = m_r[Ra(op)] >> (m_r[Rb(op)] & 63); break; // srl
- case 0x36: m_r[Rc(op)] = (m_r[Ra(op)] >> ((m_r[Rb(op)] & 7) * 8)) & zap_mask(u8(~u8(0xff))); break; // extql
- case 0x39: m_r[Rc(op)] = m_r[Ra(op)] << (m_r[Rb(op)] & 63); break; // sll
- case 0x3b: m_r[Rc(op)] = (m_r[Ra(op)] << ((m_r[Rb(op)] & 7) * 8)) & zap_mask(~(u8(0xff) << (m_r[Rb(op)] & 7))); break; // insql
- case 0x3c: m_r[Rc(op)] = s64(m_r[Ra(op)]) >> (m_r[Rb(op)] & 63); break; // sra
- case 0x52: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0x03) >> (8 - (m_r[Rb(op)] & 7))); break; // mskwh
- case 0x57: m_r[Rc(op)] = (m_r[Ra(op)] >> (64 - ((m_r[Rb(op)] & 7) * 8))) & zap_mask(~(u8(0x03) >> (8 - (m_r[Rb(op)] & 7)))); break; // inswh
- case 0x5a: m_r[Rc(op)] = (m_r[Ra(op)] << (64 - ((m_r[Rb(op)] & 7) * 8))) & zap_mask(~u8(0x03)); break; // extwh
- case 0x62: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0x0f) >> (8 - (m_r[Rb(op)] & 7))); break; // msklh
- case 0x67: m_r[Rc(op)] = (m_r[Ra(op)] >> (64 - ((m_r[Rb(op)] & 7) * 8))) & zap_mask(~(u8(0x0f) >> (8 - (m_r[Rb(op)] & 7)))); break; // inslh
- case 0x6a: m_r[Rc(op)] = (m_r[Ra(op)] << (64 - ((m_r[Rb(op)] & 7) * 8))) & zap_mask(~u8(0x0f)); break; // extlh
- case 0x72: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0xff) >> (8 - (m_r[Rb(op)] & 7))); break; // mskqh
- case 0x77: m_r[Rc(op)] = (m_r[Ra(op)] >> (64 - ((m_r[Rb(op)] & 7) * 8))) & zap_mask(~(u8(0xff) >> (8 - (m_r[Rb(op)] & 7)))); break; // insqh
- case 0x7a: m_r[Rc(op)] = (m_r[Ra(op)] << (64 - ((m_r[Rb(op)] & 7) * 8))) & zap_mask(u8(~u8(0xff))); break; // extqh
-
- // immediate variants
- case 0x82: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0x01) << (Im(op) & 7)); break; // mskbl
- case 0x86: m_r[Rc(op)] = (m_r[Ra(op)] >> ((Im(op) & 7) * 8)) & zap_mask(~u8(0x01)); break; // extbl
- case 0x8b: m_r[Rc(op)] = (m_r[Ra(op)] << ((Im(op) & 7) * 8)) & zap_mask(~(u8(0x01) << (Im(op) & 7))); break; // insbl
- case 0x92: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0x03) << (Im(op) & 7)); break; // mskwl
- case 0x96: m_r[Rc(op)] = (m_r[Ra(op)] >> ((Im(op) & 7) * 8)) & zap_mask(~u8(0x03)); break; // extwl
- case 0x9b: m_r[Rc(op)] = (m_r[Ra(op)] << ((Im(op) & 7) * 8)) & zap_mask(~(u8(0x03) << (Im(op) & 7))); break; // inswl
- case 0xa2: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0x0f) << (Im(op) & 7)); break; // mskll
- case 0xa6: m_r[Rc(op)] = (m_r[Ra(op)] >> ((Im(op) & 7) * 8)) & zap_mask(~u8(0x0f)); break; // extll
- case 0xab: m_r[Rc(op)] = (m_r[Ra(op)] << ((Im(op) & 7) * 8)) & zap_mask(~(u8(0x0f) << (Im(op) & 7))); break; // insll
- case 0xb0: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(Im(op)); break; // zap
- case 0xb1: m_r[Rc(op)] = m_r[Ra(op)] & ~zap_mask(Im(op)); break; // zapnot
- case 0xb2: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0xff) << (Im(op) & 7)); break; // mskql
- case 0xb4: m_r[Rc(op)] = m_r[Ra(op)] >> (Im(op) & 63); break; // srl
- case 0xb6: m_r[Rc(op)] = (m_r[Ra(op)] >> ((Im(op) & 7) * 8)) & zap_mask(u8(~u8(0xff))); break; // extql
- case 0xb9: m_r[Rc(op)] = m_r[Ra(op)] << (Im(op) & 63); break; // sll
- case 0xbb: m_r[Rc(op)] = (m_r[Ra(op)] << ((Im(op) & 7) * 8)) & zap_mask(~(u8(0xff) << (Im(op) & 7))); break; // insql
- case 0xbc: m_r[Rc(op)] = s64(m_r[Ra(op)]) >> (Im(op) & 63); break; // sra
- case 0xd2: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0x03) >> (8 - (Im(op) & 7))); break; // mskwh
- case 0xd7: m_r[Rc(op)] = (m_r[Ra(op)] >> (64 - ((Im(op) & 7) * 8))) & zap_mask(~(u8(0x03) >> (8 - (Im(op) & 7)))); break; // inswh
- case 0xda: m_r[Rc(op)] = (m_r[Ra(op)] << (64 - ((Im(op) & 7) * 8))) & zap_mask(~u8(0x03)); break; // extwh
- case 0xe2: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0x0f) >> (8 - (Im(op) & 7))); break; // msklh
- case 0xe7: m_r[Rc(op)] = (m_r[Ra(op)] >> (64 - ((Im(op) & 7) * 8))) & zap_mask(~(u8(0x0f) >> (8 - (Im(op) & 7)))); break; // inslh
- case 0xea: m_r[Rc(op)] = (m_r[Ra(op)] << (64 - ((Im(op) & 7) * 8))) & zap_mask(~u8(0x0f)); break; // extlh
- case 0xf2: m_r[Rc(op)] = m_r[Ra(op)] & zap_mask(u8(0xff) >> (8 - (Im(op) & 7))); break; // mskqh
- case 0xf7: m_r[Rc(op)] = (m_r[Ra(op)] >> (64 - ((Im(op) & 7) * 8))) & zap_mask(~(u8(0xff) >> (8 - (Im(op) & 7)))); break; // insqh
- case 0xfa: m_r[Rc(op)] = (m_r[Ra(op)] << (64 - ((Im(op) & 7) * 8))) & zap_mask(u8(~u8(0xff))); break; // extqh
- }
- break;
- case 0x13: // INTM* (integer multiply)
- switch ((op >> 5) & 0xff)
- {
- // register variants
- case 0x00: m_r[Rc(op)] = s64(s32(u32(m_r[Ra(op)]) * u32(m_r[Rb(op)]))); break; // mull
- case 0x20: m_r[Rc(op)] = m_r[Ra(op)] * m_r[Rb(op)]; break; // mulq
- case 0x30: mulu_64x64(m_r[Ra(op)], m_r[Rb(op)], &m_r[Rc(op)]); break; // umulh
- case 0x40: m_r[Rc(op)] = s64(s32(u32(m_r[Ra(op)]) * u32(m_r[Rb(op)]))); break; // mull/v
- case 0x60: m_r[Rc(op)] = m_r[Ra(op)] * m_r[Rb(op)]; break; // mulq/v
-
- // immediate variants
- case 0x80: m_r[Rc(op)] = s64(s32(u32(m_r[Ra(op)]) * u32(Im(op)))); break; // mull
- case 0xa0: m_r[Rc(op)] = m_r[Ra(op)] * Im(op); break; // mulq
- case 0xb0: mulu_64x64(m_r[Ra(op)], Im(op), &m_r[Rc(op)]); break; // umulh
- case 0xc0: m_r[Rc(op)] = s64(s32(u32(m_r[Ra(op)]) * u32(Im(op)))); break; // mull/v
- case 0xe0: m_r[Rc(op)] = m_r[Ra(op)] * Im(op); break; // mulq/v
- }
- break;
- //case 0x14: // ITFP* (integer to floating)
- //case 0x15: // FLTV* (vax floating)
- //case 0x16: // FLTI* (ieee floating)
- //case 0x17: // FLTL* (floating)
-
- case 0x18: // MISC* (miscellaneous)
- // TODO: all of these are effectively no-ops for now
- switch (u16(op))
- {
- case 0x0000: break; // trapb
- case 0x0400: break; // excb
- case 0x4000: break; // mb
- case 0x4400: break; // wmb
- case 0x8000: break; // fetch
- case 0xa000: break; // fetch_m
- case 0xc000: break; // rpcc
- case 0xe000: break; // rc
- case 0xe800: break; // ecb
- case 0xf000: break; // rs
- case 0xf800: break; // wh64
- }
- break;
-
- case 0x1a: // JSR*
- m_r[Ra(op)] = m_pc;
- m_pc = m_r[Rb(op)] & ~3;
- break;
-
- case 0x20: load<u32>(m_r[Rb(op)] + Disp_M(op), [this, op](u32 data) { m_f[Ra(op)] = u32_to_f_floating(data); }); break; // ldf
- case 0x21: load<u64>(m_r[Rb(op)] + Disp_M(op), [this, op](u64 data) { m_f[Ra(op)] = u64_to_g_floating(data); }); break; // ldg
- case 0x22: load<u32>(m_r[Rb(op)] + Disp_M(op), [this, op](u32 data) { m_f[Ra(op)] = f32_to_f64(float32_t{ data }).v; }); break; // lds
- case 0x23: load<u64>(m_r[Rb(op)] + Disp_M(op), [this, op](u64 data) { m_f[Ra(op)] = data; }); break; // ldt
- case 0x24: store<u32>(m_r[Rb(op)] + Disp_M(op), f_floating_to_u32(m_f[Ra(op)])); break; // stf
- case 0x25: store<u64>(m_r[Rb(op)] + Disp_M(op), u64_to_g_floating(m_f[Ra(op)])); break; // stg
- case 0x26: store<u32>(m_r[Rb(op)] + Disp_M(op), f64_to_f32(float64_t{ m_f[Ra(op)] }).v); break; // sts
- case 0x27: store<u64>(m_r[Rb(op)] + Disp_M(op), m_f[Ra(op)]); break; // stt
- case 0x28: load<u32>(m_r[Rb(op)] + Disp_M(op), [this, op](s32 data) { m_r[Ra(op)] = s64(data); }); break; // ldl
- case 0x29: load<u64>(m_r[Rb(op)] + Disp_M(op), [this, op](u64 data) { m_r[Ra(op)] = data; }); break; // ldq
- case 0x2a: // ldl_l
- load_l<u32>(m_r[Rb(op)] + Disp_M(op),
- [this, op](address_space &space, u64 address, s32 data)
- {
- if (m_lock_watch)
- m_lock_watch->remove();
-
- m_r[Ra(op)] = s64(data);
-
- space.install_write_tap(offs_t(address & ~15), offs_t(address | 15), "ldl_l",
- [this](offs_t offset, u64 &data, u64 mem_mask)
- {
- m_lock_watch->remove();
- m_lock_watch = nullptr;
- });
- });
- break;
- case 0x2b: // ldq_l
- load_l<u64>(m_r[Rb(op)] + Disp_M(op),
- [this, op](address_space &space, u64 address, u64 data)
- {
- if (m_lock_watch)
- m_lock_watch->remove();
-
- m_r[Ra(op)] = data;
-
- space.install_write_tap(offs_t(address & ~15), offs_t(address | 15), "ldq_l",
- [this](offs_t offset, u64 &data, u64 mem_mask)
- {
- m_lock_watch->remove();
- m_lock_watch = nullptr;
- });
- });
- break;
- case 0x2c: store<u32>(m_r[Rb(op)] + Disp_M(op), u32(m_r[Ra(op)])); break; // stl
- case 0x2d: store<u64>(m_r[Rb(op)] + Disp_M(op), m_r[Ra(op)]); break; // stq
- case 0x2e: // stl_c
- if (m_lock_watch)
- {
- store<u32>(m_r[Rb(op)] + Disp_M(op), u32(m_r[Ra(op)]));
- m_r[Ra(op)] = 1;
-
- m_lock_watch->remove();
- m_lock_watch = nullptr;
- }
- else
- m_r[Ra(op)] = 0;
- break;
- case 0x2f: // stq_c
- if (m_lock_watch)
- {
- store<u64>(m_r[Rb(op)] + Disp_M(op), m_r[Ra(op)]);
- m_r[Ra(op)] = 1;
-
- m_lock_watch->remove();
- m_lock_watch = nullptr;
- }
- else
- m_r[Ra(op)] = 0;
- break;
-
- // branch format
- case 0x30: // br
- m_r[Ra(op)] = m_pc;
- m_pc += Disp_B(op);
- break;
- case 0x31: // fbeq
- if (!(m_f[Ra(op)] & 0x7fffffff'ffffffffULL))
- m_pc += Disp_B(op);
- break;
- case 0x32: // fblt
- if (BIT(m_f[Ra(op)], 63) && (m_f[Ra(op)] & 0x7fffffff'ffffffffULL))
- m_pc += Disp_B(op);
- break;
- case 0x33: // fble
- if (BIT(m_f[Ra(op)], 63) || !(m_f[Ra(op)] & 0x7fffffff'ffffffffULL))
- m_pc += Disp_B(op);
- break;
- case 0x34: // bsr
- m_r[Ra(op)] = m_pc;
- m_pc += Disp_B(op);
- break;
- case 0x35: // fbne
- if (m_f[Ra(op)] & 0x7fffffff'ffffffffULL)
- m_pc += Disp_B(op);
- break;
- case 0x36: // fbge
- if (!BIT(m_f[Ra(op)], 63) || !(m_f[Ra(op)] & 0x7fffffff'ffffffffULL))
- m_pc += Disp_B(op);
- break;
- case 0x37: // fbgt
- if (!BIT(m_f[Ra(op)], 63) && (m_f[Ra(op)] & 0x7fffffff'ffffffffULL))
- m_pc += Disp_B(op);
- break;
- case 0x38: // blbc
- if (!BIT(m_r[Ra(op)], 0))
- m_pc += Disp_B(op);
- break;
- case 0x39: // beq
- if (m_r[Ra(op)] == 0)
- m_pc += Disp_B(op);
- break;
- case 0x3a: // blt
- if (s64(m_r[Ra(op)]) < 0)
- m_pc += Disp_B(op);
- break;
- case 0x3b: // ble
- if (s64(m_r[Ra(op)]) <= 0)
- m_pc += Disp_B(op);
- break;
- case 0x3c: // blbs
- if (BIT(m_r[Ra(op)], 0))
- m_pc += Disp_B(op);
- break;
- case 0x3d: // bne
- if (m_r[Ra(op)] != 0)
- m_pc += Disp_B(op);
- break;
- case 0x3e: // bge
- if (s64(m_r[Ra(op)]) >= 0)
- m_pc += Disp_B(op);
- break;
- case 0x3f: // bgt
- if (s64(m_r[Ra(op)]) > 0)
- m_pc += Disp_B(op);
- break;
- }
-}
-
-u64 alpha_device::zap_mask(u8 const zap_bits)
-{
- u64 mask = 0;
-
- for (unsigned i = 0; i < 8; i++)
- if (!BIT(zap_bits, i))
- mask |= (0xffULL << (i << 3));
-
- return mask;
-}
-
-// transform from f_floating memory to register format
-u64 alpha_device::u32_to_f_floating(u32 const data)
-{
- if (!BIT(data, 14) && (data & 0x00003f80UL))
- return
- (u64(data & 0x0000c000UL) << 48) |
- (u64(7) << 61) |
- (u64(data & 0x00003fffUL) << 45) |
- (u64(data & 0xffff0000UL) << 13);
- else
- return
- (u64(data & 0x0000c000UL) << 48) |
- (u64(data & 0x00003fffUL) << 45) |
- (u64(data & 0xffff0000UL) << 13);
-}
-
-// transform from f_floating register to memory format
-u32 alpha_device::f_floating_to_u32(u64 const data)
-{
- return
- (u32(data >> 48) & 0x0000c000UL) |
- (u32(data >> 45) & 0x00003fffUL) |
- (u32(data >> 13) & 0xffff0000UL);
-}
-
-// transform between g_floating register and memory format
-u64 alpha_device::u64_to_g_floating(u64 const data)
-{
- return
- ((data & 0x00000000'0000ffffULL) << 48) |
- ((data & 0x00000000'ffff0000ULL) << 16) |
- ((data & 0x0000ffff'00000000ULL) >> 16) |
- ((data & 0xffff0000'00000000ULL) >> 48);
-}
-
-bool alpha_ev4_device::cpu_translate(u64 &address, int intention)
-{
- // trim virtual address to 43 bits
- address &= 0x7ff'ffffffff;
-
- if (intention & TRANSLATE_FETCH)
- {
- // instruction superpage mapping
- if ((m_ibx[IBX_ICCSR] & IBX_ICCSR_R_MAP) && !(m_ibx[IBX_PS] & IBX_PS_R_CM) && (address >> 41) == 2)
- {
- address &= 0x3'ffffffff;
-
- return true;
- }
- }
- else
- {
- // data superpage 1 mapping
- if ((m_abx[ABX_ABOX_CTL] & ABX_ABOX_CTL_SPE_1) && !(m_ibx[IBX_PS] & IBX_PS_R_CM) && (address >> 30) == 0x1ffe)
- {
- address &= 0x3fffffff;
-
- return true;
- }
-
- // data superpage 2 mapping
- if ((m_abx[ABX_ABOX_CTL] & ABX_ABOX_CTL_SPE_2) && !(m_ibx[IBX_PS] & IBX_PS_R_CM) && (address >> 41) == 2)
- {
- address &= 0x3'ffffffff;
-
- return true;
- }
- }
-
- return true;
-}
-
-template <typename T, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(T)>>::value, void> alpha_device::load(u64 address, U &&apply)
-{
- cpu_translate(address, TRANSLATE_READ);
-
- unsigned const s = (address >> 31) & 6;
-
- switch (sizeof(T))
- {
- case 1: apply(T(space(s).read_byte(address))); break;
- case 2: apply(T(space(s).read_word(address))); break;
- case 4: apply(T(space(s).read_dword(address))); break;
- case 8: apply(T(space(s).read_qword(address))); break;
- }
-}
-
-template <typename T, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(address_space &, u64, T)>>::value, void> alpha_device::load_l(u64 address, U &&apply)
-{
- cpu_translate(address, TRANSLATE_READ);
-
- unsigned const s = (address >> 31) & 6;
-
- switch (sizeof(T))
- {
- case 4: apply(space(s), address, T(space(s).read_dword(address))); break;
- case 8: apply(space(s), address, T(space(s).read_qword(address))); break;
- }
-}
-
-template <typename T, typename U> std::enable_if_t<std::is_convertible<U, T>::value, void> alpha_device::store(u64 address, U data, T mem_mask)
-{
- cpu_translate(address, TRANSLATE_WRITE);
-
- unsigned const s = (address >> 31) & 6;
-
- switch (sizeof(T))
- {
- case 1: space(s).write_byte(address, T(data)); break;
- case 2: space(s).write_word(address, T(data), mem_mask); break;
- case 4: space(s).write_dword(address, T(data), mem_mask); break;
- case 8: space(s).write_qword(address, T(data), mem_mask); break;
- }
-}
-
-void alpha_device::fetch(u64 address, std::function<void(u32)> &&apply)
-{
- cpu_translate(address, TRANSLATE_FETCH);
-
- apply(icache_fetch(address));
-}
-
-u32 alpha_device::read_srom(unsigned const bits)
-{
- u32 data = 0;
-
- for (unsigned i = 0; i < bits; i++)
- if (m_srom_data_cb())
- data |= (1U << i);
-
- return data;
-}
-
-void alpha_ev4_device::device_start()
-{
- alpha_device::device_start();
-
- save_item(NAME(m_ibx));
- save_item(NAME(m_abx));
- save_item(NAME(m_pt));
-}
-
-void alpha_ev4_device::device_reset()
-{
- alpha_device::device_reset();
-
- m_ibx[IBX_ICCSR] = IBX_ICCSR_R_PC0 | IBX_ICCSR_R_PC1; // FIXME: ASN
- m_ibx[IBX_PAL_BASE] = 0;
-
- m_abx[ABX_ABOX_CTL] = 0;
- m_abx[ABX_BIU_CTL] = 0;
-}
-
-void alpha_ev4_device::cpu_execute(u32 const op)
-{
- switch (op >> 26)
- {
- case 0x00: // call_pal
- {
- u16 offset = CALL_PAL | ((op & 0x3f) << 6);
- if (op & 0x80)
- {
- // unprivileged
- if (op & CALL_PAL_MASK)
- offset = OPCDEC;
- else
- offset |= 0x1000;
- }
- else
- {
- // privileged
- if ((op & CALL_PAL_MASK) || (m_ibx[IBX_PS] & IBX_PS_R_CM))
- offset = OPCDEC;
- }
-
- m_ibx[IBX_EXC_ADDR] = m_pc;
- if (m_pal_mode)
- m_ibx[IBX_EXC_ADDR] |= 1;
-
- m_pal_mode = true;
- m_pc = m_ibx[IBX_PAL_BASE] | offset;
- }
- break;
-
- case 0x19: // hw_mfpr
- if (op & 0x20)
- m_r[Ra(op)] = ibx_get(Rc(op));
- if (op & 0x40)
- m_r[Ra(op)] = abx_get(Rc(op));
- if (op & 0x80)
- m_r[Ra(op)] = m_pt[Rc(op)];
- break;
-
- case 0x1d: // hw_mtpr
- if (op & 0x20)
- ibx_set(Rc(op), m_r[Ra(op)]);
- if (op & 0x40)
- abx_set(Rc(op), m_r[Ra(op)]);
- if (op & 0x80)
- m_pt[Rc(op)] = m_r[Ra(op)];
- break;
- case 0x1e: // hw_rei
- m_pc = m_ibx[IBX_EXC_ADDR] & ~3;
- m_pal_mode = BIT(m_ibx[IBX_EXC_ADDR], 0);
-
- if (m_lock_watch)
- {
- m_lock_watch->remove();
- m_lock_watch = nullptr;
- }
- break;
-
- default:
- alpha_device::cpu_execute(op);
- break;
- }
-}
-
-u64 alpha_ev4_device::ibx_get(u8 reg)
-{
- switch (ibx_reg(reg))
- {
- // PALmode only
- case IBX_ITB_PTE:
- case IBX_ITB_PTE_TEMP:
- if (m_pal_mode)
- return m_ibx[reg];
- else
- return 0;
-
- case IBX_ICCSR:
- case IBX_EXC_ADDR:
- case IBX_SL_RCV:
- case IBX_PS:
- case IBX_EXC_SUM:
- case IBX_PAL_BASE:
- case IBX_HIRR:
- case IBX_SIRR:
- case IBX_ASTRR:
- case IBX_HIER:
- case IBX_SIER:
- case IBX_ASTER:
- return m_ibx[reg];
-
- default:
- logerror("invalid mfpr/i register %d (%s)\n", reg, machine().describe_context());
- return 0;
- }
-}
-
-#define IBX_SET(Reg, Field) if (data & IBX_##Reg##_W_##Field) m_ibx[reg] |= IBX_##Reg##_R_##Field
-#define IBX_SHL(Reg, Field, Shift) m_ibx[reg] |= (data & IBX_##Reg##_W_##Field) << Shift
-#define IBX_SHR(Reg, Field, Shift) m_ibx[reg] |= (data & IBX_##Reg##_W_##Field) >> Shift
-
-void alpha_ev4_device::ibx_set(u8 reg, u64 data)
-{
- switch (ibx_reg(reg))
- {
- // PALmode only
- case IBX_TB_TAG:
- case IBX_ITB_PTE:
- case IBX_ITBZAP:
- case IBX_ITBASM:
- case IBX_ITBIS:
- if (m_pal_mode)
- {
- m_ibx[reg] = data;
- return;
- }
- break;
-
- case IBX_EXC_ADDR:
- case IBX_EXC_SUM:
- case IBX_SIRR:
- case IBX_ASTRR:
- case IBX_HIER:
- case IBX_SIER:
- case IBX_ASTER:
- case IBX_SL_CLR:
- case IBX_SL_XMIT:
- m_ibx[reg] = data;
- return;
-
- case IBX_ICCSR:
- m_ibx[reg] = data & IBX_ICCSR_R_PCE;
- IBX_SET(ICCSR, PC1);
- IBX_SET(ICCSR, PC0);
- IBX_SHL(ICCSR, PCMUX0, 1);
- IBX_SHR(ICCSR, GRP1, 19);
- IBX_SHR(ICCSR, ASN, 19);
- return;
-
- case IBX_PS:
- m_ibx[reg] = 0;
- IBX_SET(PS, CM0);
- IBX_SET(PS, CM1);
- return;
-
- case IBX_PAL_BASE:
- m_ibx[reg] = data & IBX_PAL_BASE_W;
- return;
-
- default:
- logerror("invalid mtpr/i register %d (%s)\n", reg, machine().describe_context());
- break;
- }
-}
-
-u64 alpha_ev4_device::abx_get(u8 reg)
-{
- switch (abx_reg(reg))
- {
- case ABX_DTB_PTE:
- case ABX_DTB_PTE_TEMP:
- case ABX_MM_CSR:
- case ABX_VA:
- case ABX_BIU_ADDR:
- case ABX_BIU_STAT:
- case ABX_DC_STAT:
- case ABX_FILL_ADDR:
- return m_abx[reg];
-
- default:
- logerror("invalid mfpr/a register %d (%s)\n", reg, machine().describe_context());
- return 0;
- }
-}
-
-void alpha_ev4_device::abx_set(u8 reg, u64 data)
-{
- switch (abx_reg(reg))
- {
- case ABX_TB_CTL:
- case ABX_DTB_PTE:
- case ABX_DTBZAP:
- case ABX_DTBASM:
- case ABX_DTBIS:
- case ABX_ABOX_CTL:
- case ABX_ALT_MODE:
- case ABX_CC:
- case ABX_CC_CTL:
- case ABX_BIU_CTL:
- case ABX_FILL_SYNDROME:
- case ABX_BC_TAG:
- case ABX_FLUSH_IC:
- case ABX_FLUSH_IC_ASM:
- m_abx[reg] = data;
- return;
-
- default:
- logerror("invalid mtpr/a register %d (%s)\n", reg, machine().describe_context());
- break;
- }
-}
-
-void dec_21064_device::device_reset()
-{
- alpha_ev4_device::device_reset();
-
- m_srom_oe_cb(0);
-
- // load icache from srom
- for (icache_block &block : m_icache)
- {
- block.lw[0] = read_srom(32);
- block.lw[2] = read_srom(32);
- block.lw[4] = read_srom(32);
- block.lw[6] = read_srom(32);
-
- block.tag = read_srom(21);
- block.aav = read_srom(8);
-
- block.lw[1] = read_srom(32);
- block.lw[3] = read_srom(32);
- block.lw[5] = read_srom(32);
- block.lw[7] = read_srom(32);
-
- block.bht = read_srom(8);
- }
-
- m_srom_oe_cb(1);
-}
-
-u32 dec_21064_device::icache_fetch(u64 const address)
-{
- icache_block &block = m_icache[(address >> 5) & 0xff];
-
- // check tag, valid, and asm or asn
- if ((block.tag != (address >> 13)) || !(block.aav & AAV_V) || (!(block.aav & AAV_ASM) && ((block.aav & AAV_ASN) != (((m_ibx[IBX_ICCSR] & IBX_ICCSR_R_ASN) >> 28)))))
- {
- // fetch a new block
- block.tag = address >> 13;
- block.aav = AAV_V | ((m_ibx[IBX_ICCSR] & IBX_ICCSR_R_ASN) >> 28); // TODO: set ASM depending on PTE
-
- // always set ASM if istream superpage mapping is enabled
- if (m_ibx[IBX_ICCSR] & IBX_ICCSR_R_MAP)
- block.aav |= AAV_ASM;
-
- address_space &s = space((address >> 31) & 6);
- for (unsigned i = 0; i < 8; i++)
- block.lw[i] = s.read_dword(address | (i << 2));
- }
-
- return block.lw[(address >> 2) & 7];
-}
diff --git a/src/devices/cpu/alpha/alpha.h b/src/devices/cpu/alpha/alpha.h
deleted file mode 100644
index ac1f5e60e2f..00000000000
--- a/src/devices/cpu/alpha/alpha.h
+++ /dev/null
@@ -1,284 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Patrick Mackinlay
-
-#ifndef MAME_CPU_ALPHA_ALPHA_H
-#define MAME_CPU_ALPHA_ALPHA_H
-
-#pragma once
-
-#include "alphad.h"
-
-class alpha_device : public cpu_device
-{
-public:
- void set_dasm_type(alpha_disassembler::dasm_type type) { m_dasm_type = type; }
-
- // input/output lines
- auto srom_oe_w() { return m_srom_oe_cb.bind(); }
- auto srom_data_r() { return m_srom_data_cb.bind(); }
-
-protected:
- alpha_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
-
- // device_t overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
- // device_execute_interface overrides
- virtual u32 execute_min_cycles() const override { return 1; }
- virtual u32 execute_max_cycles() const override { return 1; }
- virtual void execute_run() override;
- virtual void execute_set_input(int inputnum, int state) override;
-
- // device_memory_interface overrides
- virtual space_config_vector memory_space_config() const override;
- virtual bool memory_translate(int spacenum, int intention, offs_t &address) override;
-
- // device_disasm_interface overrides
- virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
-
- virtual void cpu_execute(u32 const op);
- virtual bool cpu_translate(u64 &address, int intention) { return false; }
-
- // execution helpers
- static u64 zap_mask(u8 const zap_bits);
- static u64 u64_to_g_floating(u64 const data);
- static u64 u32_to_f_floating(u32 const data);
- static u32 f_floating_to_u32(u64 const data);
-
- // memory access helpers
- template <typename T, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(T)>>::value, void> load(u64 address, U &&apply);
- template <typename T, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(address_space &, u64, T)>>::value, void> load_l(u64 address, U &&apply);
- template <typename T, typename U> std::enable_if_t<std::is_convertible<U, T>::value, void> store(u64 address, U data, T mem_mask = ~T(0));
- void fetch(u64 address, std::function<void(u32)> &&apply);
-
- // cache helpers
- u32 read_srom(unsigned const bits);
- virtual u32 icache_fetch(u64 const address) = 0;
-
- // configuration
- alpha_disassembler::dasm_type m_dasm_type;
- address_space_config m_as_config[4];
- devcb_write_line m_srom_oe_cb;
- devcb_read_line m_srom_data_cb;
-
- // emulation state
- int m_icount;
-
- u64 m_pc;
- u64 m_r[32];
- u64 m_f[32];
-
- bool m_pal_mode;
- memory_passthrough_handler *m_lock_watch;
-};
-
-class alpha_ev4_device : public alpha_device
-{
-public:
- alpha_ev4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
- // device_execute_interface overrides
- virtual u32 execute_input_lines() const override { return 6; }
-
- virtual void cpu_execute(u32 const op) override;
- virtual bool cpu_translate(u64 &address, int intention) override;
-
- enum ibx_reg : unsigned
- {
- IBX_TB_TAG = 0, // w, PALmode only
- IBX_ITB_PTE = 1, // r/w, PALmode only
- IBX_ICCSR = 2, // r/w
- IBX_ITB_PTE_TEMP = 3, // r, PALmode only
- IBX_EXC_ADDR = 4, // r/w
- IBX_SL_RCV = 5, // r
- IBX_ITBZAP = 6, // w, PALmode only
- IBX_ITBASM = 7, // w, PALmode only
- IBX_ITBIS = 8, // w, PALmode only
- IBX_PS = 9, // r/w
- IBX_EXC_SUM = 10, // r/w
- IBX_PAL_BASE = 11, // r/w
- IBX_HIRR = 12, // r
- IBX_SIRR = 13, // r/w
- IBX_ASTRR = 14, // r/w
- IBX_HIER = 16, // r/w
- IBX_SIER = 17, // r/w
- IBX_ASTER = 18, // r/w
- IBX_SL_CLR = 19, // w
- IBX_SL_XMIT = 22, // w
- };
-
- enum ibx_itb_pte_mask : u64
- {
- IBX_ITB_PTE_W_ASM = 0x00000000'00000010, // address space match
- IBX_ITB_PTE_W_KRE = 0x00000000'00000100, // kernel read-enable
- IBX_ITB_PTE_W_ERE = 0x00000000'00000200, // executive read-enable
- IBX_ITB_PTE_W_SRE = 0x00000000'00000400, // supervisor read-enable
- IBX_ITB_PTE_W_URE = 0x00000000'00000800, // user read-enable
- IBX_ITB_PTE_W_PFN = 0x001fffff'00000000, // page frame number
-
- IBX_ITB_PTE_R_KRE = 0x00000000'00000200, // kernel read-enable
- IBX_ITB_PTE_R_ERE = 0x00000000'00000400, // executive read-enable
- IBX_ITB_PTE_R_SRE = 0x00000000'00000800, // supervisor read-enable
- IBX_ITB_PTE_R_URE = 0x00000000'00001000, // user read-enable
- IBX_ITB_PTE_R_PFN = 0x00000003'ffffe000, // page frame number
- IBX_ITB_PTE_R_ASM = 0x00000004'00000000, // address space match
- };
- enum ibx_iccsr_mask : u64
- {
- IBX_ICCSR_W_PC1 = 0x00000000'00000001, // performance counter 1 interrupt enable
- IBX_ICCSR_W_PC0 = 0x00000000'00000008, // performance counter 0 interrupt enable
- IBX_ICCSR_W_PCMUX0 = 0x00000000'00000f00,
- IBX_ICCSR_W_PCMUX1 = 0x00000007'00000000,
- IBX_ICCSR_W_PIPE = 0x00000008'00000000, // pipeline enable
- IBX_ICCSR_W_BPE = 0x00000010'00000000,
- IBX_ICCSR_W_JSE = 0x00000020'00000000, // jsr stack enable
- IBX_ICCSR_W_BHE = 0x00000040'00000000,
- IBX_ICCSR_W_DI = 0x00000080'00000000, // dual issue enable
- IBX_ICCSR_W_HWE = 0x00000100'00000000, // hardware mode enable
- IBX_ICCSR_W_MAP = 0x00000200'00000000, // i-stream superpage enable
- IBX_ICCSR_W_FPE = 0x00000400'00000000, // floating-point enable
- IBX_ICCSR_W_PCE = 0x00003000'00000000, // performance counter enable
- IBX_ICCSR_W_ASN = 0x001f8000'00000000, // address space number
-
- IBX_ICCSR_R_PC0 = 0x00000000'00000002, // performance counter 0 interrupt enable
- IBX_ICCSR_R_PC1 = 0x00000000'00000004, // performance counter 1 interrupt enable
- IBX_ICCSR_R_PCMUX0 = 0x00000000'00001e00,
- IBX_ICCSR_R_PCMUX1 = 0x00000000'0000e000,
- IBX_ICCSR_R_PIPE = 0x00000000'00010000, // pipeline enable
- IBX_ICCSR_R_BPE = 0x00000000'00020000,
- IBX_ICCSR_R_JSE = 0x00000000'00040000, // jsr stack enable
- IBX_ICCSR_R_BHE = 0x00000000'00080000,
- IBX_ICCSR_R_DI = 0x00000000'00100000, // dual issue enable
- IBX_ICCSR_R_HWE = 0x00000000'00200000, // hardware mode enable
- IBX_ICCSR_R_MAP = 0x00000000'00400000, // i-stream superpage enable
- IBX_ICCSR_R_FPE = 0x00000000'00800000, // floating-point enable
- IBX_ICCSR_R_ASN = 0x00000003'f0000000, // address space number
- IBX_ICCSR_R_PCE = 0x00003000'00000000, // performance counter enable
-
- IBX_ICCSR_W_GRP1 = 0x000007ff'00000000,
- };
- enum ibx_ps_mask : u64
- {
- IBX_PS_R_CM0 = 0x00000000'00000001,
- IBX_PS_R_CM1 = 0x00000004'00000000,
- IBX_PS_R_CM = 0x00000004'00000001,
-
- IBX_PS_W_CM0 = 0x00000000'00000008,
- IBX_PS_W_CM1 = 0x00000000'00000010,
- };
- enum ibx_pal_base_mask : u64
- {
- IBX_PAL_BASE_W = 0x00000003'ffffc000,
- };
-
- enum abx_reg : unsigned
- {
- ABX_TB_CTL = 0, // w
- ABX_DTB_PTE = 2, // r/w
- ABX_DTB_PTE_TEMP = 3, // r
- ABX_MM_CSR = 4, // r
- ABX_VA = 5, // r
- ABX_DTBZAP = 6, // w
- ABX_DTBASM = 7, // w
- ABX_DTBIS = 8, // w
- ABX_BIU_ADDR = 9, // r
- ABX_BIU_STAT = 10, // r
- ABX_DC_STAT = 12, // r
- ABX_FILL_ADDR = 13, // r
- ABX_ABOX_CTL = 14, // w
- ABX_ALT_MODE = 15, // w
- ABX_CC = 16, // w
- ABX_CC_CTL = 17, // w
- ABX_BIU_CTL = 18, // w
- ABX_FILL_SYNDROME = 19, // w
- ABX_BC_TAG = 20, // w
- ABX_FLUSH_IC = 21, // w
- ABX_FLUSH_IC_ASM = 23, // w
- };
-
- enum abx_abox_ctl_mask : u64
- {
- ABX_ABOX_CTL_WB_DIS = 0x0001, // write buffer unload disable
- ABX_ABOX_CTL_MCHK_EN = 0x0002, // machine check enable
- ABX_ABOX_CTL_CRD_EN = 0x0004, // corrected read data interrupt enable
- ABX_ABOX_CTL_IC_SBUF_EN = 0x0008, // icache stream buffer enable
- ABX_ABOX_CTL_SPE_1 = 0x0010, // super page enable 1
- ABX_ABOX_CTL_SPE_2 = 0x0020, // super page enable 2
- ABX_ABOX_CTL_EMD_EN = 0x0040, // big-endian mode enable
- ABX_ABOX_CTL_STC_NORESULT = 0x0080, //
- ABX_ABOX_CTL_NCACHE_NDISTURB = 0x0100, //
- ABX_ABOX_CTL_DTB_RR = 0x0200, // dtb round-robin replacement
- ABX_ABOX_CTL_DC_ENA = 0x0400, // dcache enable
- ABX_ABOX_CTL_DC_FHIT = 0x0800, // dcache force hit
- ABX_ABOX_CTL_DC_16K = 0x1000, // select 16K dcache (21064A only)
- ABX_ABOX_CTL_F_TAG_ERR = 0x2000, // generate bad dcache tag parity (21064A only)
- ABX_ABOX_CTL_NOCHK_PAR = 0x4000, // disable cache parity checks (21064A only)
- ABX_ABOX_CTL_DOUBLE_INVAL = 0x8000, // (21064A only)
- };
-
- enum palcode_entry : u16
- {
- RESET = 0x0000,
- MCHK = 0x0020,
- ARITH = 0x0060,
- INTERRUPT = 0x00e0,
- D_FAULT = 0x01e0,
- ITB_MISS = 0x03e0,
- ITB_ACV = 0x07e0,
- DTB_MISS_NATIVE = 0x08e0,
- DTB_MISS_PAL = 0x09e0,
- UNALIGN = 0x11e0,
- OPCDEC = 0x13e0,
- FEN = 0x17e0,
- CALL_PAL = 0x2000,
- };
- static constexpr u32 CALL_PAL_MASK = 0x03ffff40;
-
- u64 ibx_get(u8 reg);
- void ibx_set(u8 reg, u64 data);
- u64 abx_get(u8 reg);
- void abx_set(u8 reg, u64 data);
-
- u64 m_ibx[32];
- u64 m_abx[32];
- u64 m_pt[32];
-};
-
-class dec_21064_device : public alpha_ev4_device
-{
-public:
- dec_21064_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
-protected:
- virtual void device_reset() override;
-
- virtual u32 icache_fetch(u64 const address) override;
-
-private:
- struct icache_block
- {
- u32 lw[8]; // instruction longwords
- u32 tag; // cache tag
- u8 aav; // asn, asm and v fields
- u8 bht; // branch history table
- };
-
- enum aav_mask : u8
- {
- AAV_ASN = 0x3f, // address space number
- AAV_ASM = 0x40, // address space match
- AAV_V = 0x80, // valid
- };
-
- icache_block m_icache[256];
-};
-
-DECLARE_DEVICE_TYPE(DEC_21064, dec_21064_device)
-
-#endif // MAME_CPU_ALPHA_ALPHA_H
diff --git a/src/devices/cpu/alpha/alphad.cpp b/src/devices/cpu/alpha/alphad.cpp
deleted file mode 100644
index 4bd759e53c3..00000000000
--- a/src/devices/cpu/alpha/alphad.cpp
+++ /dev/null
@@ -1,1245 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Patrick Mackinlay
-
-/*
- * TODO
- * - enforce "should be zero" fields
- * - enforce "Ra must be R31"
- * - assembly and register naming preferences
- * - implementation-dependent instructions for EV5 and EV6
- */
-
-#include "emu.h"
-#include "alphad.h"
-#include "common.h"
-
- // instruction formats
-#define OPERATE_RRR(opcode, ra, rb, rc) util::stream_format(stream, "%-10s %s, %s, %s", opcode, R[ra], R[rb], R[rc])
-#define OPERATE_FFF(opcode, ra, rb, rc) util::stream_format(stream, "%-10s %s, %s, %s", opcode, F[ra], F[rb], F[rc])
-#define OPERATE_RIR(opcode, ra, im, rc) util::stream_format(stream, "%-10s %s, #%d, %s", opcode, R[ra], im, R[rc])
-#define OPERATE_RR(opcode, rb, rc) util::stream_format(stream, "%-10s %s, %s", opcode, R[rb], R[rc])
-#define OPERATE_FF(opcode, rb, rc) util::stream_format(stream, "%-10s %s, %s", opcode, F[rb], F[rc])
-#define OPERATE_RF(opcode, ra, rc) util::stream_format(stream, "%-10s %s, %s", opcode, R[ra], F[rc])
-#define OPERATE_FR(opcode, ra, rc) util::stream_format(stream, "%-10s %s, %s", opcode, F[ra], R[rc])
-#define OPERATE_IR(opcode, im, rc) util::stream_format(stream, "%-10s #%d, %s", opcode, im, R[rc])
-#define OPERATE_R(opcode, rc) util::stream_format(stream, "%-10s %s", opcode, R[rc])
-#define OPERATE_F(opcode, rc) util::stream_format(stream, "%-10s %s", opcode, F[rc])
-
-// TODO: verify syntax for multiple register formats
-#define OPERATE_RI(opcode, rb, rc) util::stream_format(stream, "%-10s %s, %s", opcode, R[rb], IBX[rc])
-#define OPERATE_RA(opcode, rb, rc) util::stream_format(stream, "%-10s %s, %s", opcode, R[rb], ABX[rc])
-#define OPERATE_RAI(opcode, rb, rc) util::stream_format(stream, "%-10s %s, %s:%s", opcode, R[rb], ABX[rc], IBX[rc])
-#define OPERATE_RP(opcode, rb, rc) util::stream_format(stream, "%-10s %s, %s", opcode, R[rb], PT[rc])
-#define OPERATE_RPI(opcode, rb, rc) util::stream_format(stream, "%-10s %s, %s:%s", opcode, R[rb], PT[rc], IBX[rc])
-#define OPERATE_RPA(opcode, rb, rc) util::stream_format(stream, "%-10s %s, %s:%s", opcode, R[rb], PT[rc], ABX[rc])
-#define OPERATE_RPAI(opcode, rb, rc) util::stream_format(stream, "%-10s %s, %s:%s:%s", opcode, R[rb], PT[rc], ABX[rc], IBX[rc])
-
-#define MEMORY_R(opcode, ra, disp, rb) util::stream_format(stream, "%-10s %s, %d(%s)", opcode, R[ra], disp, R[rb])
-#define MEMORY_F(opcode, ra, disp, rb) util::stream_format(stream, "%-10s %s, %d(%s)", opcode, F[ra], disp, R[rb])
-#define BRANCH_R(opcode, ra, offset) util::stream_format(stream, "%-10s %s, 0x%x", opcode, R[ra], pc + 4 + offset)
-#define BRANCH_F(opcode, ra, offset) util::stream_format(stream, "%-10s %s, 0x%x", opcode, F[ra], pc + 4 + offset)
-#define BRANCH(opcode, offset) util::stream_format(stream, "%-10s 0x%x", opcode, pc + 4 + offset)
-
-#define JUMP(opcode, ra, rb) util::stream_format(stream, "%-10s %s, (%s)", opcode, R[ra], R[rb])
-
-#define MISC(opcode) util::stream_format(stream, "%-10s", opcode)
-#define MISC_R(opcode, ra) util::stream_format(stream, "%-10s %s", opcode, R[ra])
-#define MISC_M(opcode, rb) util::stream_format(stream, "%-10s (%s)", opcode, R[rb])
-
-#define CALL_PAL(fnc) util::stream_format(stream, "%-10s %s", "call_pal", fnc)
-
-#define RESERVED(opcode) util::stream_format(stream, "%-10s", opcode)
-#define UNKNOWN(type) util::stream_format(stream, "unknown %s", type)
-
-// register names
-const char *const alpha_disassembler::R[] =
-{
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"
-};
-
-const char *const alpha_disassembler::F[] =
-{
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
- "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
- "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"
-};
-
-const char *const alpha_disassembler::PT[] =
-{
- "pt0", "pt1", "pt2", "pt3", "pt4", "pt5", "pt6", "pt7",
- "pt8", "pt9", "pt10", "pt11", "pt12", "pt13", "pt14", "pt15",
- "pt16", "pt17", "pt18", "pt19", "pt20", "pt21", "pt22", "pt23",
- "pt24", "pt25", "pt26", "pt27", "pt28", "pt29", "pt30", "pt31"
-};
-
-// NOTE: ABXn and IBXn are placeholders for undefined/unused registers
-const char *const alpha_disassembler::ABX[] =
-{
- "TB_CTL", "ABX1", "DTB_PTE", "DTB_PTE_TEMP", "MM_CSR", "VA", "DTBZAP", "DTBASM",
- "DTBIS", "BIU_ADDR", "BIU_STAT", "ABX12", "DC_STAT", "FILL_ADDR", "ABOX_CTL", "ALT_MODE",
- "CC", "CC_CTL", "BIU_CTL", "FILL_SYNDROME", "BC_TAG", "FLUSH_IC", "ABX22", "FLUSH_IC_ASM",
- "ABX24", "ABX25", "ABX26", "ABX27", "ABX28", "ABX29", "ABX30", "ABX31"
-};
-
-const char *const alpha_disassembler::IBX[] =
-{
- "TB_TAG", "ITB_PTE", "ICCSR", "ITB_PTE_TEMP", "EXC_ADDR", "SL_RCV", "ITBZAP", "ITBASM",
- "ITBIS", "PS", "EXC_SUM", "PAL_BASE", "HIRR", "SIRR", "ASTRR", "IBX15",
- "HIERR", "SIER", "ASTER", "SL_CLR", "IBX20", "IBX21", "SL_XMIT", "IBX23",
- "IBX24", "IBX25", "IBX26", "IBX27", "IBX28", "IBX29", "IBX30", "IBX31"
-};
-
-offs_t alpha_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params)
-{
- offs_t const bytes = 4;
- u32 flags = SUPPORTED;
-
- u32 const instruction = opcodes.r32(pc);
-
- switch (instruction >> 26)
- {
- // pal format
- case 0x00:
- switch (m_dasm_type)
- {
- case TYPE_UNKNOWN:
- switch (instruction & 0x03ffffff)
- {
- case 0x0000: CALL_PAL("halt"); break;
- case 0x0002: CALL_PAL("draina"); break;
- case 0x0086: CALL_PAL("imb"); break;
-
- default: UNKNOWN("call_pal"); break;
- }
- break;
-
- case TYPE_NT:
- switch (instruction & 0x03ffffff)
- {
- // Windows NT unprivileged PALcode
- case 0x0080: CALL_PAL("bpt"); break; // breakpoint trap
- case 0x0083: CALL_PAL("callsys"); break; // call system service
- case 0x0086: CALL_PAL("imb"); break; // instruction memory barrier
- case 0x00aa: CALL_PAL("gentrap"); break; // generate trap
- case 0x00ab: CALL_PAL("rdteb"); break; // read TEB internal processor register
- case 0x00ac: CALL_PAL("kbpt"); break; // kernel breakpoint trap
- case 0x00ad: CALL_PAL("callkd"); break; // call kernel debugger
-
- // Windows NT privileged PALcode
- case 0x0000: CALL_PAL("halt"); break; // trap to illegal instruction
- case 0x0001: CALL_PAL("restart"); break; // restart the processor
- case 0x0002: CALL_PAL("draina"); break; // drain aborts
- case 0x0003: CALL_PAL("reboot"); break; // transfer to console firmware
- case 0x0004: CALL_PAL("initpal"); break; // initialize the PALcode
- case 0x0005: CALL_PAL("wrentry"); break; // write system entry
- case 0x0006: CALL_PAL("swpirql"); break; // swap IRQL
- case 0x0007: CALL_PAL("rdirql"); break; // read current IRQL
- case 0x0008: CALL_PAL("di"); break; // disable interrupts
- case 0x0009: CALL_PAL("ei"); break; // enable interrupts
- case 0x000a: CALL_PAL("swppal"); break; // swap PALcode
- case 0x000c: CALL_PAL("ssir"); break; // set software interrupt request
- case 0x000d: CALL_PAL("csir"); break; // clear software interrupt request
- case 0x000e: CALL_PAL("rfe"); break; // return from exception
- case 0x000f: CALL_PAL("retsys"); break; // return from system service call
- case 0x0010: CALL_PAL("swpctx"); break; // swap privileged thread context
- case 0x0011: CALL_PAL("swpprocess"); break; // swap privileged process context
- case 0x0012: CALL_PAL("rdmces"); break; // read machine check error summary
- case 0x0013: CALL_PAL("wrmces"); break; // write machine check error summary
- case 0x0014: CALL_PAL("tbia"); break; // translation buffer invalidate all
- case 0x0015: CALL_PAL("tbis"); break; // translation buffer invalidate single
- case 0x0016: CALL_PAL("dtbis"); break; // data translation buffer invalidate single
- case 0x0017: CALL_PAL("tbisasn"); break; // translation buffer invalidate single ASN
- case 0x0018: CALL_PAL("rdksp"); break; // read initial kernel stack
- case 0x0019: CALL_PAL("swpksp"); break; // swap initial kernel stack
- case 0x001a: CALL_PAL("rdpsr"); break; // read processor status register
- case 0x001c: CALL_PAL("rdpcr"); break; // read PCR (processor control registers)
- case 0x001e: CALL_PAL("rdthread"); break; // read the current thread value
- case 0x0020: CALL_PAL("wrperfmon"); break; // write performance monitoring values
- case 0x0030: CALL_PAL("rdcounters"); break; // read PALcode event counters
- case 0x0031: CALL_PAL("rdstate"); break; // read internal processor state
-
- default: UNKNOWN("call_pal"); break;
- }
- break;
-
- case TYPE_UNIX:
- switch (instruction & 0x03ffffff)
- {
- // Digital UNIX unprivileged PALcode
- case 0x0080: CALL_PAL("bpt"); break; // breakpoint trap
- case 0x0081: CALL_PAL("bugchk"); break; // bugcheck
- case 0x0083: CALL_PAL("callsys"); break; // system call
- case 0x0086: CALL_PAL("imb"); break; // i-stream memory barrier
- case 0x0092: CALL_PAL("urti"); break; // return from user mode trap
- case 0x009e: CALL_PAL("rdunique"); break; // read unique value
- case 0x009f: CALL_PAL("wrunique"); break; // write unique value
- case 0x00aa: CALL_PAL("gentrap"); break; // generate software trap
- case 0x00ae: CALL_PAL("clrfen"); break; // clear floating-point enable
-
- // Digital UNIX privileged PALcode
- case 0x0000: CALL_PAL("halt"); break; // halt the processor
- case 0x0001: CALL_PAL("cflush"); break; // cache flush
- case 0x0002: CALL_PAL("draina"); break; // drain aborts
- case 0x0009: CALL_PAL("cserve"); break; // console service
- case 0x000a: CALL_PAL("swppal"); break; // swap PALcode image
- case 0x000d: CALL_PAL("wripir"); break; // write interprocessor interrupt request
- case 0x0010: CALL_PAL("rdmces"); break; // read machine check error summary register
- case 0x0011: CALL_PAL("wrmces"); break; // write machine check error summary register
- case 0x002b: CALL_PAL("wrfen"); break; // write floating-point enable
- case 0x002d: CALL_PAL("wrvptptr"); break; // write virtual page table pointer
- case 0x0030: CALL_PAL("swpctx"); break; // swap privileged context
- case 0x0031: CALL_PAL("wrval"); break; // write system value
- case 0x0032: CALL_PAL("rdval"); break; // read system value
- case 0x0033: CALL_PAL("tbi"); break; // translation buffer invalidate
- case 0x0034: CALL_PAL("wrent"); break; // write system entry address
- case 0x0035: CALL_PAL("swpipl"); break; // swap interrupt priority level
- case 0x0036: CALL_PAL("rdps"); break; // read processor status
- case 0x0037: CALL_PAL("wrkgp"); break; // write kernel global pointer
- case 0x0038: CALL_PAL("wrusp"); break; // write user stack pointer
- case 0x0039: CALL_PAL("wrperfmon"); break; // performance monitoring function
- case 0x003a: CALL_PAL("rdusp"); break; // read user stack pointer
- case 0x003c: CALL_PAL("whami"); break; // who am I
- case 0x003d: CALL_PAL("retsys"); break; // return from system call
- case 0x003e: CALL_PAL("wtint"); break; // wait for interrupt
- case 0x003f: CALL_PAL("rti"); break; // return from trap or interrupt
-
- default: UNKNOWN("call_pal"); break;
- }
- break;
-
- case TYPE_VMS:
- switch (instruction & 0x03ffffff)
- {
- // OpenVMS unprivileged PALcode
- case 0x0080: CALL_PAL("bpt"); break; // breakpoint
- case 0x0081: CALL_PAL("bugchk"); break; // bugcheck
- case 0x0082: CALL_PAL("chme"); break; // change mode to executive
- case 0x0083: CALL_PAL("chmk"); break; // change mode to kernel
- case 0x0084: CALL_PAL("chms"); break; // change mode to supervisor
- case 0x0085: CALL_PAL("chmu"); break; // change mode to user
- case 0x0086: CALL_PAL("imb"); break; // i-stream memory barrier
- case 0x0087: CALL_PAL("insqhil"); break; // insert into longword queue at head interlocked
- case 0x0088: CALL_PAL("insqtil"); break; // insert into longword queue at tail interlocked
- case 0x0089: CALL_PAL("insqhiq"); break; // insert into quadword queue at head interlocked
- case 0x008a: CALL_PAL("insqtiq"); break; // insert into quadword queue at tail interlocked
- case 0x008b: CALL_PAL("insquel"); break; // insert entry into longword queue
- case 0x008c: CALL_PAL("insqueq"); break; // insert entry into quadword queue
- case 0x008d: CALL_PAL("insquel/d"); break; // insert entry into longword queue deferred
- case 0x008e: CALL_PAL("insqueq/d"); break; // insert entry into quadword queue deferred
- case 0x008f: CALL_PAL("prober"); break; // probe for read access
- case 0x0090: CALL_PAL("probew"); break; // probe for write access
- case 0x0091: CALL_PAL("rd_ps"); break; // move processor status
- case 0x0092: CALL_PAL("rei"); break; // return from exception or interrupt
- case 0x0093: CALL_PAL("remqhil"); break; // remove from longword queue at head interlocked
- case 0x0094: CALL_PAL("remqtil"); break; // remove from longword queue at tail interlocked
- case 0x0095: CALL_PAL("remqhiq"); break; // remove from quadword queue at head interlocked
- case 0x0096: CALL_PAL("remqtiq"); break; // remove from quadword queue at tail interlocked
- case 0x0097: CALL_PAL("remquel"); break; // remove entry from longword queue
- case 0x0098: CALL_PAL("remqueq"); break; // remove entry from quadword queue
- case 0x0099: CALL_PAL("remquel/d"); break; // remove entry from longword queue deferred
- case 0x009a: CALL_PAL("remqueq/d"); break; // remove entry from quadword queue deferred
- case 0x009b: CALL_PAL("swasten"); break; // swap AST enable for current mode
- case 0x009c: CALL_PAL("wr_ps_sw"); break; // write processor status software field
- case 0x009d: CALL_PAL("rscc"); break; // read system cycle counter
- case 0x009e: CALL_PAL("read_unq"); break; // read unique context
- case 0x009f: CALL_PAL("write_unq"); break; // write unique context
- case 0x00a0: CALL_PAL("amovrr"); break; // atomic move from register to register
- case 0x00a1: CALL_PAL("amovrm"); break; // atomic move from register to memory
- case 0x00a2: CALL_PAL("insqhilr"); break; // insert into longword queue at head interlocked resident
- case 0x00a3: CALL_PAL("insqtilr"); break; // insert into longword queue at tail interlocked resident
- case 0x00a4: CALL_PAL("insqhiqr"); break; // insert into quadword queue at head interlocked resident
- case 0x00a5: CALL_PAL("insqtiqr"); break; // insert into quadword queue at tail interlocked resident
- case 0x00a6: CALL_PAL("remqhilr"); break; // remove from longword queue at head interlocked resident
- case 0x00a7: CALL_PAL("remqtilr"); break; // remove from longword queue at tail interlocked resident
- case 0x00a8: CALL_PAL("remqhiqr"); break; // remove from quadword queue at head interlocked resident
- case 0x00a9: CALL_PAL("remqtiqr"); break; // remove from quadword queue at tail interlocked resident
- case 0x00aa: CALL_PAL("gentrap"); break; // generate software trap
- case 0x00ae: CALL_PAL("clrfen"); break; // clear floating-point enable
-
- // OpenVMS privileged PALcode
- case 0x0000: CALL_PAL("halt"); break; // halt processor
- case 0x0001: CALL_PAL("cflush"); break; // cache flush
- case 0x0002: CALL_PAL("draina"); break; // drain aborts
- case 0x0003: CALL_PAL("ldqp"); break; // load quadword physical
- case 0x0004: CALL_PAL("stqp"); break; // store quadword physical
- case 0x0005: CALL_PAL("swpctx"); break; // swap privileged context
- case 0x0006: CALL_PAL("mfpr_asn"); break; // move from processor register ASN
- case 0x0009: CALL_PAL("cserve"); break; // console service
- case 0x000a: CALL_PAL("swppal"); break; // swap PALcode image
- case 0x000b: CALL_PAL("mfpr_fen"); break; // move from processor register FEN
- case 0x000c: CALL_PAL("mtpr_fen"); break; // move to processor register FEN
- case 0x000d: CALL_PAL("mtpr_ipir"); break; // move to processor register IPRI
- case 0x000e: CALL_PAL("mfpr_ipl"); break; // move from processor register IPL
- case 0x000f: CALL_PAL("mtpr_ipl"); break; // move to processor register IPL
- case 0x0010: CALL_PAL("mfpr_mces"); break; // move from processor register MCES
- case 0x0011: CALL_PAL("mtpr_mces"); break; // move to processor register MCES
- case 0x0012: CALL_PAL("mfpr_pcbb"); break; // move from processor register PCBB
- case 0x0013: CALL_PAL("mfpr_prbr"); break; // move from processor register PRBR
- case 0x0014: CALL_PAL("mtpr_prbr"); break; // move to processor register PRBR
- case 0x0015: CALL_PAL("mfpr_ptbr"); break; // move from processor register PTBR
- case 0x0016: CALL_PAL("mfpr_scbb"); break; // move from processor register SCBB
- case 0x0017: CALL_PAL("mtpr_scbb"); break; // move to processor register SCBB
- case 0x0018: CALL_PAL("mtpr_sirr"); break; // move to processor register SIRR
- case 0x0019: CALL_PAL("mfpr_sisr"); break; // move from processor register SISR
- case 0x001a: CALL_PAL("mfpr_tbchk"); break; // move from processor register TBCHK
- case 0x001b: CALL_PAL("mtpr_tbia"); break; // move to processor register TBIA
- case 0x001c: CALL_PAL("mtpr_tbiap"); break; // move to processor register TBIAP
- case 0x001d: CALL_PAL("mtpr_tbis"); break; // move to processor register TBIS
- case 0x001e: CALL_PAL("mfpr_esp"); break; // move from processor register ESP
- case 0x001f: CALL_PAL("mtpr_esp"); break; // move to processor register ESP
- case 0x0020: CALL_PAL("mfpr_ssp"); break; // move from processor register SSP
- case 0x0021: CALL_PAL("mtpr_ssp"); break; // move to processor register SSP
- case 0x0022: CALL_PAL("mfpr_usp"); break; // move from processor register USP
- case 0x0023: CALL_PAL("mtpr_usp"); break; // move to processor register USP
- case 0x0024: CALL_PAL("mtpr_tbisd"); break; // move to processor register TBISD
- case 0x0025: CALL_PAL("mtpr_tbisi"); break; // move to processor register TBISI
- case 0x0026: CALL_PAL("mtpr_asten"); break; // move to processor register ASTEN
- case 0x0027: CALL_PAL("mtpr_astsr"); break; // move to processor register ASTSR
- case 0x0029: CALL_PAL("mfpr_vptb"); break; // move from processor register VPTB
- case 0x002a: CALL_PAL("mtpr_vptb"); break; // move to processor register VPTB
- case 0x002b: CALL_PAL("mtpr_perfmon"); break; // move to processor register PERFMON
- case 0x002e: CALL_PAL("mtpr_datfx"); break; // move to processor register DATFX
- case 0x003e: CALL_PAL("wtint"); break; // wait for interrupt
- case 0x003f: CALL_PAL("mfpr_whami"); break; // move from processor register WHAMI
-
- default: UNKNOWN("call_pal"); break;
- }
- break;
- }
- break;
-
- // reserved opcodes
- case 0x01: RESERVED("opc01"); break; // OPC01
- case 0x02: RESERVED("opc02"); break; // OPC02
- case 0x03: RESERVED("opc03"); break; // OPC03
- case 0x04: RESERVED("opc04"); break; // OPC04
- case 0x05: RESERVED("opc05"); break; // OPC05
- case 0x06: RESERVED("opc06"); break; // OPC06
- case 0x07: RESERVED("opc07"); break; // OPC07
-
- // memory format
- case 0x08:
- if (Rb(instruction) == 31)
- OPERATE_IR("mov", Disp_M(instruction), Ra(instruction));
- else
- MEMORY_R("lda", Ra(instruction), Disp_M(instruction), Rb(instruction)); // LDA
- break;
- case 0x09: MEMORY_R("ldah", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // LDAH
- case 0x0a: MEMORY_R("ldbu", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // LDBU (BWX)
- case 0x0b:
- if (Ra(instruction) == 31 && Disp_M(instruction) == 0)
- MISC("unop");
- else
- MEMORY_R("ldq_u", Ra(instruction), Disp_M(instruction), Rb(instruction)); // LDQ_U
- break;
- case 0x0c: MEMORY_R("ldwu", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // LDWU (BWX)
- case 0x0d: MEMORY_R("stw", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // STW (BWX)
- case 0x0e: MEMORY_R("stb", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // STB (BWX)
- case 0x0f: MEMORY_R("stq_u", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // STQ_U
-
- // operate format
- case 0x10: // INTA* (integer arithmetic)
- switch ((instruction >> 5) & 0xff)
- {
- // register variants
- case 0x00:
- if (Ra(instruction) == 31)
- OPERATE_RR("sextl", Rb(instruction), Rc(instruction));
- else
- OPERATE_RRR("addl", Ra(instruction), Rb(instruction), Rc(instruction)); // ADDL
- break;
- case 0x02: OPERATE_RRR("s4addl", Ra(instruction), Rb(instruction), Rc(instruction)); break; // S4ADDL
- case 0x09:
- if (Ra(instruction) == 31)
- OPERATE_RR("negl", Rb(instruction), Rc(instruction));
- else
- OPERATE_RRR("subl", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBL
- break;
- case 0x0b: OPERATE_RRR("s4subl", Ra(instruction), Rb(instruction), Rc(instruction)); break; // S4SUBL
- case 0x0f: OPERATE_RRR("cmpbge", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPBGE
- case 0x12: OPERATE_RRR("s8addl", Ra(instruction), Rb(instruction), Rc(instruction)); break; // S8ADDL
- case 0x1b: OPERATE_RRR("s8subl", Ra(instruction), Rb(instruction), Rc(instruction)); break; // S8SUBL
- case 0x1d: OPERATE_RRR("cmpult", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPULT
- case 0x20: OPERATE_RRR("addq", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDQ
- case 0x22: OPERATE_RRR("s4addq", Ra(instruction), Rb(instruction), Rc(instruction)); break; // S4ADDQ
- case 0x29:
- if (Ra(instruction) == 31)
- OPERATE_RR("negq", Rb(instruction), Rc(instruction));
- else
- OPERATE_RRR("subq", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBQ
- break;
- case 0x2b: OPERATE_RRR("s4subq", Ra(instruction), Rb(instruction), Rc(instruction)); break; // S4SUBQ
- case 0x2d: OPERATE_RRR("cmpeq", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPEQ
- case 0x32: OPERATE_RRR("s8addq", Ra(instruction), Rb(instruction), Rc(instruction)); break; // S8ADDQ
- case 0x3b: OPERATE_RRR("s8subq", Ra(instruction), Rb(instruction), Rc(instruction)); break; // S8SUBQ
- case 0x3d: OPERATE_RRR("cmpule", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPULE
- case 0x40: OPERATE_RRR("addl/v", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDL/V
- case 0x49:
- if (Ra(instruction) == 31)
- OPERATE_RR("negl/v", Rb(instruction), Rc(instruction));
- else
- OPERATE_RRR("subl/v", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBL/V
- break;
- case 0x4d: OPERATE_RRR("cmplt", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPLT
- case 0x60: OPERATE_RRR("addq/v", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDQ/V
- case 0x69:
- if (Ra(instruction) == 31)
- OPERATE_RR("negq/v", Rb(instruction), Rc(instruction));
- else
- OPERATE_RRR("subq/v", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBQ/V
- break;
- case 0x6d: OPERATE_RRR("cmple", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPLE
-
- // immediate variants
- case 0x80:
- if (Ra(instruction) == 31)
- OPERATE_IR("sextl", Im(instruction), Rc(instruction));
- else
- OPERATE_RIR("addl", Ra(instruction), Im(instruction), Rc(instruction)); // ADDL
- break;
- case 0x82: OPERATE_RIR("s4addl", Ra(instruction), Im(instruction), Rc(instruction)); break; // S4ADDL
- case 0x89:
- if (Ra(instruction) == 31)
- OPERATE_IR("negl", Im(instruction), Rc(instruction));
- else
- OPERATE_RIR("subl", Ra(instruction), Im(instruction), Rc(instruction)); // SUBL
- break;
- case 0x8b: OPERATE_RIR("s4subl", Ra(instruction), Im(instruction), Rc(instruction)); break; // S4SUBL
- case 0x8f: OPERATE_RIR("cmpbge", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMPBGE
- case 0x92: OPERATE_RIR("s8addl", Ra(instruction), Im(instruction), Rc(instruction)); break; // S8ADDL
- case 0x9b: OPERATE_RIR("s8subl", Ra(instruction), Im(instruction), Rc(instruction)); break; // S8SUBL
- case 0x9d: OPERATE_RIR("cmpult", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMPULT
- case 0xa0: OPERATE_RIR("addq", Ra(instruction), Im(instruction), Rc(instruction)); break; // ADDQ
- case 0xa2: OPERATE_RIR("s4addq", Ra(instruction), Im(instruction), Rc(instruction)); break; // S4ADDQ
- case 0xa9:
- if (Ra(instruction) == 31)
- OPERATE_IR("negq", Im(instruction), Rc(instruction));
- else
- OPERATE_RIR("subq", Ra(instruction), Im(instruction), Rc(instruction)); // SUBQ
- break;
- case 0xab: OPERATE_RIR("s4subq", Ra(instruction), Im(instruction), Rc(instruction)); break; // S4SUBQ
- case 0xad: OPERATE_RIR("cmpeq", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMPEQ
- case 0xb2: OPERATE_RIR("s8addq", Ra(instruction), Im(instruction), Rc(instruction)); break; // S8ADDQ
- case 0xbb: OPERATE_RIR("s8subq", Ra(instruction), Im(instruction), Rc(instruction)); break; // S8SUBQ
- case 0xbd: OPERATE_RIR("cmpule", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMPULE
- case 0xc0: OPERATE_RIR("addl/v", Ra(instruction), Im(instruction), Rc(instruction)); break; // ADDL/V
- case 0xc9:
- if (Ra(instruction) == 31)
- OPERATE_IR("negl/v", Im(instruction), Rc(instruction));
- else
- OPERATE_RIR("subl/v", Ra(instruction), Im(instruction), Rc(instruction)); // SUBL/V
- break;
- case 0xcd: OPERATE_RIR("cmplt", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMPLT
- case 0xe0: OPERATE_RIR("addq/v", Ra(instruction), Im(instruction), Rc(instruction)); break; // ADDQ/V
- case 0xe9:
- if (Ra(instruction) == 31)
- OPERATE_IR("negq/v", Im(instruction), Rc(instruction));
- else
- OPERATE_RIR("subq/v", Ra(instruction), Im(instruction), Rc(instruction)); // SUBQ/V
- break;
- case 0xed: OPERATE_RIR("cmple", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMPLE
-
- default: UNKNOWN("inta*"); break;
- }
- break;
- case 0x11: // INTL* (integer logical)
- switch ((instruction >> 5) & 0xff)
- {
- // register variants
- case 0x00: OPERATE_RRR("and", Ra(instruction), Rb(instruction), Rc(instruction)); break; // AND
- case 0x08: OPERATE_RRR("bic", Ra(instruction), Rb(instruction), Rc(instruction)); break; // BIC
- case 0x14: OPERATE_RRR("cmovlbs", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMOVLBS
- case 0x16: OPERATE_RRR("cmovlbc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMOVLBC
- case 0x20:
- if (Ra(instruction) == 31 && Rb(instruction) == 31 && Rc(instruction) == 31)
- MISC("nop");
- else if (Ra(instruction) == 31 && Rb(instruction) == 31)
- OPERATE_R("clr", Rc(instruction));
- else if (Ra(instruction) == Rb(instruction))
- OPERATE_RR("mov", Rb(instruction), Rc(instruction));
- else
- OPERATE_RRR("bis", Ra(instruction), Rb(instruction), Rc(instruction)); // BIS
- break;
- case 0x24: OPERATE_RRR("cmoveq", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMOVEQ
- case 0x26: OPERATE_RRR("cmovne", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMOVNE
- case 0x28:
- if (Ra(instruction) == 31)
- OPERATE_RR("not", Rb(instruction), Rc(instruction));
- else
- OPERATE_RRR("ornot", Ra(instruction), Rb(instruction), Rc(instruction)); // ORNOT
- break;
- case 0x40: OPERATE_RRR("xor", Ra(instruction), Rb(instruction), Rc(instruction)); break; // XOR
- case 0x44: OPERATE_RRR("cmovlt", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMOVLT
- case 0x46: OPERATE_RRR("cmovge", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMOVGE
- case 0x48: OPERATE_RRR("eqv", Ra(instruction), Rb(instruction), Rc(instruction)); break; // EQV
- case 0x61: OPERATE_RR("amask", Rb(instruction), Rc(instruction)); break; // AMASK
- case 0x64: OPERATE_RRR("cmovle", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMOVLE
- case 0x66: OPERATE_RRR("cmovgt", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMOVGT
-
- // immediate variants
- case 0x80: OPERATE_RIR("and", Ra(instruction), Im(instruction), Rc(instruction)); break; // AND
- case 0x88: OPERATE_RIR("bic", Ra(instruction), Im(instruction), Rc(instruction)); break; // BIC
- case 0x94: OPERATE_RIR("cmovlbs", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMOVLBS
- case 0x96: OPERATE_RIR("cmovlbc", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMOVLBC
- case 0xa0:
- if (Ra(instruction) == 31)
- OPERATE_IR("mov", Im(instruction), Rc(instruction));
- else
- OPERATE_RIR("bis", Ra(instruction), Im(instruction), Rc(instruction)); // BIS
- break;
- case 0xa4: OPERATE_RIR("cmoveq", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMOVEQ
- case 0xa6: OPERATE_RIR("cmovne", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMOVNE
- case 0xa8:
- if (Ra(instruction) == 31)
- OPERATE_IR("not", Im(instruction), Rc(instruction));
- else
- OPERATE_RIR("ornot", Ra(instruction), Im(instruction), Rc(instruction)); // ORNOT
- break;
- case 0xc0: OPERATE_RIR("xor", Ra(instruction), Im(instruction), Rc(instruction)); break; // XOR
- case 0xc4: OPERATE_RIR("cmovlt", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMOVLT
- case 0xc6: OPERATE_RIR("cmovge", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMOVGE
- case 0xc8: OPERATE_RIR("eqv", Ra(instruction), Im(instruction), Rc(instruction)); break; // EQV
- case 0xe1: OPERATE_IR("amask", Im(instruction), Rc(instruction)); break; // AMASK
- case 0xe4: OPERATE_RIR("cmovle", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMOVLE
- case 0xe6: OPERATE_RIR("cmovgt", Ra(instruction), Im(instruction), Rc(instruction)); break; // CMOVGT
-
- // TODO: Rb must be literal #1?
- case 0xec: OPERATE_R("implver", Rc(instruction)); break; // IMPLVER
-
- default: UNKNOWN("intl*"); break;
- }
- break;
- case 0x12: // INTS* (integer shift)
- switch ((instruction >> 5) & 0xff)
- {
- // register variants
- case 0x02: OPERATE_RRR("mskbl", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MSKBL
- case 0x06: OPERATE_RRR("extbl", Ra(instruction), Rb(instruction), Rc(instruction)); break; // EXTBL
- case 0x0b: OPERATE_RRR("insbl", Ra(instruction), Rb(instruction), Rc(instruction)); break; // INSBL
- case 0x12: OPERATE_RRR("mskwl", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MSKWL
- case 0x16: OPERATE_RRR("extwl", Ra(instruction), Rb(instruction), Rc(instruction)); break; // EXTWL
- case 0x1b: OPERATE_RRR("inswl", Ra(instruction), Rb(instruction), Rc(instruction)); break; // INSWL
- case 0x22: OPERATE_RRR("mskll", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MSKLL
- case 0x26: OPERATE_RRR("extll", Ra(instruction), Rb(instruction), Rc(instruction)); break; // EXTLL
- case 0x2b: OPERATE_RRR("insll", Ra(instruction), Rb(instruction), Rc(instruction)); break; // INSLL
- case 0x30: OPERATE_RRR("zap", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ZAP
- case 0x31: OPERATE_RRR("zapnot", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ZAPNOT
- case 0x32: OPERATE_RRR("mskql", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MSKQL
- case 0x34: OPERATE_RRR("srl", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SRL
- case 0x36: OPERATE_RRR("extql", Ra(instruction), Rb(instruction), Rc(instruction)); break; // EXTQL
- case 0x39: OPERATE_RRR("sll", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SLL
- case 0x3b: OPERATE_RRR("insql", Ra(instruction), Rb(instruction), Rc(instruction)); break; // INSQL
- case 0x3c: OPERATE_RRR("sra", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SRA
- case 0x52: OPERATE_RRR("mskwh", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MSKWH
- case 0x57: OPERATE_RRR("inswh", Ra(instruction), Rb(instruction), Rc(instruction)); break; // INSWH
- case 0x5a: OPERATE_RRR("extwh", Ra(instruction), Rb(instruction), Rc(instruction)); break; // EXTWH
- case 0x62: OPERATE_RRR("msklh", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MSKLH
- case 0x67: OPERATE_RRR("inslh", Ra(instruction), Rb(instruction), Rc(instruction)); break; // INSLH
- case 0x6a: OPERATE_RRR("extlh", Ra(instruction), Rb(instruction), Rc(instruction)); break; // EXTLH
- case 0x72: OPERATE_RRR("mskqh", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MSKQH
- case 0x77: OPERATE_RRR("insqh", Ra(instruction), Rb(instruction), Rc(instruction)); break; // INSQH
- case 0x7a: OPERATE_RRR("extqh", Ra(instruction), Rb(instruction), Rc(instruction)); break; // EXTQH
-
- // immediate variants
- case 0x82: OPERATE_RIR("mskbl", Ra(instruction), Im(instruction), Rc(instruction)); break; // MSKBL
- case 0x86: OPERATE_RIR("extbl", Ra(instruction), Im(instruction), Rc(instruction)); break; // EXTBL
- case 0x8b: OPERATE_RIR("insbl", Ra(instruction), Im(instruction), Rc(instruction)); break; // INSBL
- case 0x92: OPERATE_RIR("mskwl", Ra(instruction), Im(instruction), Rc(instruction)); break; // MSKWL
- case 0x96: OPERATE_RIR("extwl", Ra(instruction), Im(instruction), Rc(instruction)); break; // EXTWL
- case 0x9b: OPERATE_RIR("inswl", Ra(instruction), Im(instruction), Rc(instruction)); break; // INSWL
- case 0xa2: OPERATE_RIR("mskll", Ra(instruction), Im(instruction), Rc(instruction)); break; // MSKLL
- case 0xa6: OPERATE_RIR("extll", Ra(instruction), Im(instruction), Rc(instruction)); break; // EXTLL
- case 0xab: OPERATE_RIR("insll", Ra(instruction), Im(instruction), Rc(instruction)); break; // INSLL
- case 0xb0: OPERATE_RIR("zap", Ra(instruction), Im(instruction), Rc(instruction)); break; // ZAP
- case 0xb1: OPERATE_RIR("zapnot", Ra(instruction), Im(instruction), Rc(instruction)); break; // ZAPNOT
- case 0xb2: OPERATE_RIR("mskql", Ra(instruction), Im(instruction), Rc(instruction)); break; // MSKQL
- case 0xb4: OPERATE_RIR("srl", Ra(instruction), Im(instruction), Rc(instruction)); break; // SRL
- case 0xb6: OPERATE_RIR("extql", Ra(instruction), Im(instruction), Rc(instruction)); break; // EXTQL
- case 0xb9: OPERATE_RIR("sll", Ra(instruction), Im(instruction), Rc(instruction)); break; // SLL
- case 0xbb: OPERATE_RIR("insql", Ra(instruction), Im(instruction), Rc(instruction)); break; // INSQL
- case 0xbc: OPERATE_RIR("sra", Ra(instruction), Im(instruction), Rc(instruction)); break; // SRA
- case 0xd2: OPERATE_RIR("mskwh", Ra(instruction), Im(instruction), Rc(instruction)); break; // MSKWH
- case 0xd7: OPERATE_RIR("inswh", Ra(instruction), Im(instruction), Rc(instruction)); break; // INSWH
- case 0xda: OPERATE_RIR("extwh", Ra(instruction), Im(instruction), Rc(instruction)); break; // EXTWH
- case 0xe2: OPERATE_RIR("msklh", Ra(instruction), Im(instruction), Rc(instruction)); break; // MSKLH
- case 0xe7: OPERATE_RIR("inslh", Ra(instruction), Im(instruction), Rc(instruction)); break; // INSLH
- case 0xea: OPERATE_RIR("extlh", Ra(instruction), Im(instruction), Rc(instruction)); break; // EXTLH
- case 0xf2: OPERATE_RIR("mskqh", Ra(instruction), Im(instruction), Rc(instruction)); break; // MSKQH
- case 0xf7: OPERATE_RIR("insqh", Ra(instruction), Im(instruction), Rc(instruction)); break; // INSQH
- case 0xfa: OPERATE_RIR("extqh", Ra(instruction), Im(instruction), Rc(instruction)); break; // EXTQH
-
- default: UNKNOWN("ints*"); break;
- }
- break;
- case 0x13: // INTM* (integer multiply)
- switch ((instruction >> 5) & 0xff)
- {
- // register variants
- case 0x00: OPERATE_RRR("mull", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULL
- case 0x20: OPERATE_RRR("mulq", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULQ
- case 0x30: OPERATE_RRR("umulh", Ra(instruction), Rb(instruction), Rc(instruction)); break; // UMULH
- case 0x40: OPERATE_RRR("mull/v", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULL/V
- case 0x60: OPERATE_RRR("mulq/v", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULQ/V
-
- // immediate variants
- case 0x80: OPERATE_RIR("mull", Ra(instruction), Im(instruction), Rc(instruction)); break; // MULL
- case 0xa0: OPERATE_RIR("mulq", Ra(instruction), Im(instruction), Rc(instruction)); break; // MULQ
- case 0xb0: OPERATE_RIR("umulh", Ra(instruction), Im(instruction), Rc(instruction)); break; // UMULH
- case 0xc0: OPERATE_RIR("mull/v", Ra(instruction), Im(instruction), Rc(instruction)); break; // MULL/V
- case 0xe0: OPERATE_RIR("mulq/v", Ra(instruction), Im(instruction), Rc(instruction)); break; // MULQ/V
-
- default: UNKNOWN("intm*"); break;
- }
- case 0x14: // ITFP* (integer to floating)
- switch ((instruction >> 5) & 0x7ff)
- {
- case 0x004: OPERATE_RF("itofs", Ra(instruction), Rc(instruction)); break; // ITOFS
- case 0x00a: OPERATE_FF("sqrtf/c", Rb(instruction), Rc(instruction)); break; // SQRTF/C
- case 0x00b: OPERATE_FF("sqrts/c", Rb(instruction), Rc(instruction)); break; // SQRTS/C
- case 0x014: OPERATE_RF("itoff", Ra(instruction), Rc(instruction)); break; // ITOFF
- case 0x024: OPERATE_RF("itoft", Ra(instruction), Rc(instruction)); break; // ITOFT
- case 0x02a: OPERATE_FF("sqrtg/c", Rb(instruction), Rc(instruction)); break; // SQRTG/C
- case 0x02b: OPERATE_FF("sqrtt/c", Rb(instruction), Rc(instruction)); break; // SQRTT/C
- case 0x04b: OPERATE_FF("sqrts/m", Rb(instruction), Rc(instruction)); break; // SQRTS/M
- case 0x06b: OPERATE_FF("sqrtt/m", Rb(instruction), Rc(instruction)); break; // SQRTT/M
- case 0x08a: OPERATE_FF("sqrtf", Rb(instruction), Rc(instruction)); break; // SQRTF
- case 0x08b: OPERATE_FF("sqrts", Rb(instruction), Rc(instruction)); break; // SQRTS
- case 0x0aa: OPERATE_FF("sqrtg", Rb(instruction), Rc(instruction)); break; // SQRTG
- case 0x0ab: OPERATE_FF("sqrtt", Rb(instruction), Rc(instruction)); break; // SQRTT
- case 0x0cb: OPERATE_FF("sqrts/d", Rb(instruction), Rc(instruction)); break; // SQRTS/D
- case 0x0eb: OPERATE_FF("sqrtt/d", Rb(instruction), Rc(instruction)); break; // SQRTT/D
- case 0x10a: OPERATE_FF("sqrtf/uc", Rb(instruction), Rc(instruction)); break; // SQRTF/UC
- case 0x10b: OPERATE_FF("sqrts/uc", Rb(instruction), Rc(instruction)); break; // SQRTS/UC
- case 0x12a: OPERATE_FF("sqrtg/uc", Rb(instruction), Rc(instruction)); break; // SQRTG/UC
- case 0x12b: OPERATE_FF("sqrtt/uc", Rb(instruction), Rc(instruction)); break; // SQRTT/UC
- case 0x14b: OPERATE_FF("sqrts/um", Rb(instruction), Rc(instruction)); break; // SQRTS/UM
- case 0x16b: OPERATE_FF("sqrtt/um", Rb(instruction), Rc(instruction)); break; // SQRTT/UM
- case 0x18a: OPERATE_FF("sqrtf/u", Rb(instruction), Rc(instruction)); break; // SQRTF/U
- case 0x1aa: OPERATE_FF("sqrtg/u", Rb(instruction), Rc(instruction)); break; // SQRTG/U
- case 0x1ab: OPERATE_FF("sqrtt/u", Rb(instruction), Rc(instruction)); break; // SQRTT/U
- case 0x1cb: OPERATE_FF("sqrts/ud", Rb(instruction), Rc(instruction)); break; // SQRTS/UD
- case 0x1eb: OPERATE_FF("sqrtt/ud", Rb(instruction), Rc(instruction)); break; // SQRTT/UD
- case 0x40a: OPERATE_FF("sqrtf/sc", Rb(instruction), Rc(instruction)); break; // SQRTF/SC
- case 0x42a: OPERATE_FF("sqrtg/sc", Rb(instruction), Rc(instruction)); break; // SQRTG/SC
- case 0x48a: OPERATE_FF("sqrtf/s", Rb(instruction), Rc(instruction)); break; // SQRTF/S
- case 0x4aa: OPERATE_FF("sqrtg/s", Rb(instruction), Rc(instruction)); break; // SQRTG/S
- case 0x50a: OPERATE_FF("sqrtf/suc", Rb(instruction), Rc(instruction)); break; // SQRTF/SUC
- case 0x50b: OPERATE_FF("sqrts/suc", Rb(instruction), Rc(instruction)); break; // SQRTS/SUC
- case 0x52a: OPERATE_FF("sqrtg/suc", Rb(instruction), Rc(instruction)); break; // SQRTG/SUC
- case 0x52b: OPERATE_FF("sqrtt/suc", Rb(instruction), Rc(instruction)); break; // SQRTT/SUC
- case 0x54b: OPERATE_FF("sqrts/sum", Rb(instruction), Rc(instruction)); break; // SQRTS/SUM
- case 0x56b: OPERATE_FF("sqrtt/sum", Rb(instruction), Rc(instruction)); break; // SQRTT/SUM
- case 0x58a: OPERATE_FF("sqrtf/su", Rb(instruction), Rc(instruction)); break; // SQRTF/SU
- case 0x58b: OPERATE_FF("sqrts/su", Rb(instruction), Rc(instruction)); break; // SQRTS/SU
- case 0x5aa: OPERATE_FF("sqrtg/su", Rb(instruction), Rc(instruction)); break; // SQRTG/SU
- case 0x5ab: OPERATE_FF("sqrtt/su", Rb(instruction), Rc(instruction)); break; // SQRTT/SU
- case 0x5cb: OPERATE_FF("sqrts/sud", Rb(instruction), Rc(instruction)); break; // SQRTS/SUD
- case 0x5eb: OPERATE_FF("sqrtt/sud", Rb(instruction), Rc(instruction)); break; // SQRTT/SUD
- case 0x70b: OPERATE_FF("sqrts/suic", Rb(instruction), Rc(instruction)); break; // SQRTS/SUIC
- case 0x72b: OPERATE_FF("sqrtt/suic", Rb(instruction), Rc(instruction)); break; // SQRTT/SUIC
- case 0x74b: OPERATE_FF("sqrts/suim", Rb(instruction), Rc(instruction)); break; // SQRTS/SUIM
- case 0x76b: OPERATE_FF("sqrtt/suim", Rb(instruction), Rc(instruction)); break; // SQRTT/SUIM
- case 0x78b: OPERATE_FF("sqrts/sui", Rb(instruction), Rc(instruction)); break; // SQRTS/SUI
- case 0x7ab: OPERATE_FF("sqrtt/sui", Rb(instruction), Rc(instruction)); break; // SQRTT/SUI
- case 0x7cb: OPERATE_FF("sqrts/suid", Rb(instruction), Rc(instruction)); break; // SQRTS/SUID
- case 0x7eb: OPERATE_FF("sqrtt/suid", Rb(instruction), Rc(instruction)); break; // SQRTT/SUID
-
- default: UNKNOWN("itfp*"); break;
- }
- break;
- case 0x15: // FLTV* (vax floating)
- switch ((instruction >> 5) & 0x7ff)
- {
- case 0x000: OPERATE_FFF("addf/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDF/C
- case 0x001: OPERATE_FFF("subf/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBF/C
- case 0x002: OPERATE_FFF("mulf/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULF/C
- case 0x003: OPERATE_FFF("divf/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVF/C
- case 0x01e: OPERATE_FF("cvtdg/c", Rb(instruction), Rc(instruction)); break; // CVTDG/C
- case 0x020: OPERATE_FFF("addg/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDG/C
- case 0x021: OPERATE_FFF("subg/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBG/C
- case 0x022: OPERATE_FFF("mulg/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULG/C
- case 0x023: OPERATE_FFF("divg/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVG/C
- case 0x02c: OPERATE_FF("cvtgf/c", Rb(instruction), Rc(instruction)); break; // CVTGF/C
- case 0x02d: OPERATE_FF("cvtgd/c", Rb(instruction), Rc(instruction)); break; // CVTGD/C
- case 0x02f: OPERATE_FF("cvtgq/c", Rb(instruction), Rc(instruction)); break; // CVTGQ/C
- case 0x03c: OPERATE_FF("cvtqf/c", Rb(instruction), Rc(instruction)); break; // CVTQF/C
- case 0x03e: OPERATE_FF("cvtqg/c", Rb(instruction), Rc(instruction)); break; // CVTQG/C
- case 0x080: OPERATE_FFF("addf", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDF
- case 0x081:
- if (Ra(instruction) == 31)
- OPERATE_FF("negf", Rb(instruction), Rc(instruction));
- else
- OPERATE_FFF("subf", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBF
- break;
- case 0x082: OPERATE_FFF("mulf", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULF
- case 0x083: OPERATE_FFF("divf", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVF
- case 0x09e: OPERATE_FF("cvtdg", Rb(instruction), Rc(instruction)); break; // CVTDG
- case 0x0a0: OPERATE_FFF("addg", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDG
- case 0x0a1:
- if (Ra(instruction) == 31)
- OPERATE_FF("negg", Rb(instruction), Rc(instruction));
- else
- OPERATE_FFF("subg", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBG
- break;
- case 0x0a2: OPERATE_FFF("mulg", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULG
- case 0x0a3: OPERATE_FFF("divg", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVG
- case 0x0a5: OPERATE_FFF("cmpgeq", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPGEQ
- case 0x0a6: OPERATE_FFF("cmpglt", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPGLT
- case 0x0a7: OPERATE_FFF("cmpgle", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPGLE
- case 0x0ac: OPERATE_FF("cvtgf", Rb(instruction), Rc(instruction)); break; // CVTGF
- case 0x0ad: OPERATE_FF("cvtgd", Rb(instruction), Rc(instruction)); break; // CVTGD
- case 0x0af: OPERATE_FF("cvtgq", Rb(instruction), Rc(instruction)); break; // CVTGQ
- case 0x0bc: OPERATE_FF("cvtqf", Rb(instruction), Rc(instruction)); break; // CVTQF
- case 0x0be: OPERATE_FF("cvtqg", Rb(instruction), Rc(instruction)); break; // CVTQG
- case 0x100: OPERATE_FFF("addf/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDF/UC
- case 0x101: OPERATE_FFF("subf/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBF/UC
- case 0x102: OPERATE_FFF("mulf/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULF/UC
- case 0x103: OPERATE_FFF("divf/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVF/UC
- case 0x11e: OPERATE_FF("cvtdg/uc", Rb(instruction), Rc(instruction)); break; // CVTDG/UC
- case 0x120: OPERATE_FFF("addg/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDG/UC
- case 0x121: OPERATE_FFF("subg/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBG/UC
- case 0x122: OPERATE_FFF("mulg/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULG/UC
- case 0x123: OPERATE_FFF("divg/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVG/UC
- case 0x12c: OPERATE_FF("cvtgf/uc", Rb(instruction), Rc(instruction)); break; // CVTGF/UC
- case 0x12d: OPERATE_FF("cvtgd/uc", Rb(instruction), Rc(instruction)); break; // CVTGD/UC
- case 0x12f: OPERATE_FF("cvtgq/vc", Rb(instruction), Rc(instruction)); break; // CVTGQ/VC
- case 0x180: OPERATE_FFF("addf/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDF/U
- case 0x181: OPERATE_FFF("subf/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBF/U
- case 0x182: OPERATE_FFF("mulf/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULF/U
- case 0x183: OPERATE_FFF("divf/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVF/U
- case 0x19e: OPERATE_FF("cvtdg/u", Rb(instruction), Rc(instruction)); break; // CVTDG/U
- case 0x1a0: OPERATE_FFF("addg/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDG/U
- case 0x1a1: OPERATE_FFF("subg/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBG/U
- case 0x1a2: OPERATE_FFF("mulg/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULG/U
- case 0x1a3: OPERATE_FFF("divg/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVG/U
- case 0x1ac: OPERATE_FF("cvtgf/u", Rb(instruction), Rc(instruction)); break; // CVTGF/U
- case 0x1ad: OPERATE_FF("cvtgd/u", Rb(instruction), Rc(instruction)); break; // CVTGD/U
- case 0x1af: OPERATE_FF("cvtgq/v", Rb(instruction), Rc(instruction)); break; // CVTGQ/V
- case 0x400: OPERATE_FFF("addf/sc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDF/SC
- case 0x401: OPERATE_FFF("subf/sc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBF/SC
- case 0x402: OPERATE_FFF("mulf/sc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULF/SC
- case 0x403: OPERATE_FFF("divf/sc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVF/SC
- case 0x41e: OPERATE_FF("cvtdg/sc", Rb(instruction), Rc(instruction)); break; // CVTDG/SC
- case 0x420: OPERATE_FFF("addg/sc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDG/SC
- case 0x421: OPERATE_FFF("subg/sc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBG/SC
- case 0x422: OPERATE_FFF("mulg/sc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULG/SC
- case 0x423: OPERATE_FFF("divg/sc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVG/SC
- case 0x42c: OPERATE_FF("cvtgf/sc", Rb(instruction), Rc(instruction)); break; // CVTGF/SC
- case 0x42d: OPERATE_FF("cvtgd/sc", Rb(instruction), Rc(instruction)); break; // CVTGD/SC
- case 0x42f: OPERATE_FF("cvtgq/sc", Rb(instruction), Rc(instruction)); break; // CVTGQ/SC
- case 0x480: OPERATE_FFF("addf/s", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDF/S
- case 0x481:
- if (Ra(instruction) == 31)
- OPERATE_FF("negf/s", Rb(instruction), Rc(instruction));
- else
- OPERATE_FFF("subf/s", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBF/S
- break;
- case 0x482: OPERATE_FFF("mulf/s", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULF/S
- case 0x483: OPERATE_FFF("divf/s", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVF/S
- case 0x49e: OPERATE_FF("cvtdg/s", Rb(instruction), Rc(instruction)); break; // CVTDG/S
- case 0x4a0: OPERATE_FFF("addg/s", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDG/S
- case 0x4a1:
- if (Ra(instruction) == 31)
- OPERATE_FF("negg/s", Rb(instruction), Rc(instruction));
- else
- OPERATE_FFF("subg/s", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBG/S
- break;
- case 0x4a2: OPERATE_FFF("mulg/s", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULG/S
- case 0x4a3: OPERATE_FFF("divg/s", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVG/S
- case 0x4a5: OPERATE_FFF("cmpgeq/s", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPGEQ/S
- case 0x4a6: OPERATE_FFF("cmpglt/s", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPGLT/S
- case 0x4a7: OPERATE_FFF("cmpgle/s", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPGLE/S
- case 0x4ac: OPERATE_FF("cvtgf/s", Rb(instruction), Rc(instruction)); break; // CVTGF/S
- case 0x4ad: OPERATE_FF("cvtgd/s", Rb(instruction), Rc(instruction)); break; // CVTGD/S
- case 0x4af: OPERATE_FF("cvtgq/s", Rb(instruction), Rc(instruction)); break; // CVTGQ/S
- case 0x500: OPERATE_FFF("addf/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDF/SUC
- case 0x501: OPERATE_FFF("subf/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBF/SUC
- case 0x502: OPERATE_FFF("mulf/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULF/SUC
- case 0x503: OPERATE_FFF("divf/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVF/SUC
- case 0x51e: OPERATE_FF("cvtdg/suc", Rb(instruction), Rc(instruction)); break; // CVTDG/SUC
- case 0x520: OPERATE_FFF("addg/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDG/SUC
- case 0x521: OPERATE_FFF("subg/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBG/SUC
- case 0x522: OPERATE_FFF("mulg/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULG/SUC
- case 0x523: OPERATE_FFF("divg/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVG/SUC
- case 0x52c: OPERATE_FF("cvtgf/suc", Rb(instruction), Rc(instruction)); break; // CVTGF/SUC
- case 0x52d: OPERATE_FF("cvtgd/suc", Rb(instruction), Rc(instruction)); break; // CVTGD/SUC
- case 0x52f: OPERATE_FF("cvtgq/svc", Rb(instruction), Rc(instruction)); break; // CVTGQ/SVC
- case 0x580: OPERATE_FFF("addf/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDF/SU
- case 0x581: OPERATE_FFF("subf/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBF/SU
- case 0x582: OPERATE_FFF("mulf/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULF/SU
- case 0x583: OPERATE_FFF("divf/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVF/SU
- case 0x59e: OPERATE_FF("cvtdg/su", Rb(instruction), Rc(instruction)); break; // CVTDG/SU
- case 0x5a0: OPERATE_FFF("addg/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDG/SU
- case 0x5a1: OPERATE_FFF("subg/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBG/SU
- case 0x5a2: OPERATE_FFF("mulg/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULG/SU
- case 0x5a3: OPERATE_FFF("divg/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVG/SU
- case 0x5ac: OPERATE_FF("cvtgf/su", Rb(instruction), Rc(instruction)); break; // CVTGF/SU
- case 0x5ad: OPERATE_FF("cvtgd/su", Rb(instruction), Rc(instruction)); break; // CVTGD/SU
- case 0x5af: OPERATE_FF("cvtgq/sv", Rb(instruction), Rc(instruction)); break; // CVTGQ/SV
-
- default: UNKNOWN("fltv*"); break;
- }
- break;
- case 0x16: // FLTI* (ieee floating)
- switch ((instruction >> 5) & 0x7ff)
- {
- case 0x000: OPERATE_FFF("adds/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/C
- case 0x001: OPERATE_FFF("subs/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBS/C
- case 0x002: OPERATE_FFF("muls/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/C
- case 0x003: OPERATE_FFF("divs/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/C
- case 0x020: OPERATE_FFF("addt/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/C
- case 0x021: OPERATE_FFF("subt/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBT/C
- case 0x022: OPERATE_FFF("mult/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/C
- case 0x023: OPERATE_FFF("divt/c", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/C
- case 0x02c: OPERATE_FF("cvttts/c", Rb(instruction), Rc(instruction)); break; // CVTTS/C
- case 0x02f: OPERATE_FF("cvttq/c", Rb(instruction), Rc(instruction)); break; // CVTTQ/C
- case 0x03c: OPERATE_FF("cvtqs/c", Rb(instruction), Rc(instruction)); break; // CVTQS/C
- case 0x03e: OPERATE_FF("cvtqt/c", Rb(instruction), Rc(instruction)); break; // CVTQT/C
- case 0x040: OPERATE_FFF("adds/m", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/M
- case 0x041: OPERATE_FFF("subs/m", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBS/M
- case 0x042: OPERATE_FFF("muls/m", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/M
- case 0x043: OPERATE_FFF("divs/m", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/M
- case 0x060: OPERATE_FFF("addt/m", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/M
- case 0x061: OPERATE_FFF("subt/m", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBT/M
- case 0x062: OPERATE_FFF("mult/m", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/M
- case 0x063: OPERATE_FFF("divt/m", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/M
- case 0x06c: OPERATE_FF("cvttts/m", Rb(instruction), Rc(instruction)); break; // CVTTS/M
- case 0x06f: OPERATE_FF("cvttq/m", Rb(instruction), Rc(instruction)); break; // CVTTQ/M
- case 0x07c: OPERATE_FF("cvtqs/m", Rb(instruction), Rc(instruction)); break; // CVTQS/M
- case 0x07e: OPERATE_FF("cvtqt/m", Rb(instruction), Rc(instruction)); break; // CVTQT/M
- case 0x080: OPERATE_FFF("adds", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS
- case 0x081:
- if (Ra(instruction) == 31)
- OPERATE_FF("negs", Rb(instruction), Rc(instruction));
- else
- OPERATE_FFF("subs", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBS
- break;
- case 0x082: OPERATE_FFF("muls", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS
- case 0x083: OPERATE_FFF("divs", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS
- case 0x0a0: OPERATE_FFF("addt", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT
- case 0x0a1:
- if (Ra(instruction) == 31)
- OPERATE_FF("negt", Rb(instruction), Rc(instruction));
- else
- OPERATE_FFF("subt", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBT
- break;
- case 0x0a2: OPERATE_FFF("mult", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT
- case 0x0a3: OPERATE_FFF("divt", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT
- case 0x0a4: OPERATE_FFF("cmptun", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPTUN
- case 0x0a5: OPERATE_FFF("cmpteq", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPTEQ
- case 0x0a6: OPERATE_FFF("cmptlt", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPTLT
- case 0x0a7: OPERATE_FFF("cmptle", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPTLE
- case 0x0ac: OPERATE_FF("cvttts", Rb(instruction), Rc(instruction)); break; // CVTTS
- case 0x0af: OPERATE_FF("cvttq", Rb(instruction), Rc(instruction)); break; // CVTTQ
- case 0x0bc: OPERATE_FF("cvtqs", Rb(instruction), Rc(instruction)); break; // CVTQS
- case 0x0be: OPERATE_FF("cvtqt", Rb(instruction), Rc(instruction)); break; // CVTQT
- case 0x0c0: OPERATE_FFF("adds/d", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/D
- case 0x0c1: OPERATE_FFF("subs/d", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBS/D
- case 0x0c2: OPERATE_FFF("muls/d", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/D
- case 0x0c3: OPERATE_FFF("divs/d", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/D
- case 0x0e0: OPERATE_FFF("addt/d", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/D
- case 0x0e1: OPERATE_FFF("subt/d", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBT/D
- case 0x0e2: OPERATE_FFF("mult/d", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/D
- case 0x0e3: OPERATE_FFF("divt/d", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/D
- case 0x0ec: OPERATE_FF("cvttts/d", Rb(instruction), Rc(instruction)); break; // CVTTS/D
- case 0x0ef: OPERATE_FF("cvttq/d", Rb(instruction), Rc(instruction)); break; // CVTTQ/D
- case 0x0fc: OPERATE_FF("cvtqs/d", Rb(instruction), Rc(instruction)); break; // CVTQS/D
- case 0x0fe: OPERATE_FF("cvtqt/d", Rb(instruction), Rc(instruction)); break; // CVTQT/D
- case 0x100: OPERATE_FFF("adds/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/UC
- case 0x101: OPERATE_FFF("subs/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBS/UC
- case 0x102: OPERATE_FFF("muls/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/UC
- case 0x103: OPERATE_FFF("divs/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/UC
- case 0x120: OPERATE_FFF("addt/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/UC
- case 0x121: OPERATE_FFF("subt/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBT/UC
- case 0x122: OPERATE_FFF("mult/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/UC
- case 0x123: OPERATE_FFF("divt/uc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/UC
- case 0x12c: OPERATE_FF("cvttts/uc", Rb(instruction), Rc(instruction)); break; // CVTTS/UC
- case 0x12f: OPERATE_FF("cvttq/vc", Rb(instruction), Rc(instruction)); break; // CVTTQ/VC
- case 0x140: OPERATE_FFF("adds/um", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/UM
- case 0x141: OPERATE_FFF("subs/um", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBS/UM
- case 0x142: OPERATE_FFF("muls/um", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/UM
- case 0x143: OPERATE_FFF("divs/um", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/UM
- case 0x160: OPERATE_FFF("addt/um", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/UM
- case 0x161: OPERATE_FFF("subt/um", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBT/UM
- case 0x162: OPERATE_FFF("mult/um", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/UM
- case 0x163: OPERATE_FFF("divt/um", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/UM
- case 0x16c: OPERATE_FF("cvttts/um", Rb(instruction), Rc(instruction)); break; // CVTTS/UM
- case 0x16f: OPERATE_FF("cvttq/vm", Rb(instruction), Rc(instruction)); break; // CVTTQ/VM
- case 0x180: OPERATE_FFF("adds/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/U
- case 0x181: OPERATE_FFF("subs/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBS/U
- case 0x182: OPERATE_FFF("muls/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/U
- case 0x183: OPERATE_FFF("divs/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/U
- case 0x1a0: OPERATE_FFF("addt/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/U
- case 0x1a1: OPERATE_FFF("subt/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBT/U
- case 0x1a2: OPERATE_FFF("mult/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/U
- case 0x1a3: OPERATE_FFF("divt/u", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/U
- case 0x1ac: OPERATE_FF("cvttts/u", Rb(instruction), Rc(instruction)); break; // CVTTS/U
- case 0x1af: OPERATE_FF("cvttq/v", Rb(instruction), Rc(instruction)); break; // CVTTQ/V
- case 0x1c0: OPERATE_FFF("adds/ud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/UD
- case 0x1c1: OPERATE_FFF("subs/ud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBS/UD
- case 0x1c2: OPERATE_FFF("muls/ud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/UD
- case 0x1c3: OPERATE_FFF("divs/ud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/UD
- case 0x1e0: OPERATE_FFF("addt/ud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/UD
- case 0x1e1: OPERATE_FFF("subs/ud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBT/UD
- case 0x1e2: OPERATE_FFF("mult/ud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/UD
- case 0x1e3: OPERATE_FFF("divt/ud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/UD
- case 0x1ec: OPERATE_FF("cvttts/ud", Rb(instruction), Rc(instruction)); break; // CVTTS/UD
- case 0x1ef: OPERATE_FF("cvttq/vd", Rb(instruction), Rc(instruction)); break; // CVTTQ/VD
- case 0x2ac: OPERATE_FF("cvtst", Rb(instruction), Rc(instruction)); break; // CVTST
- case 0x500: OPERATE_FFF("adds/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/SUC
- case 0x501: OPERATE_FFF("subs/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBS/SUC
- case 0x502: OPERATE_FFF("muls/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/SUC
- case 0x503: OPERATE_FFF("divs/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/SUC
- case 0x520: OPERATE_FFF("addt/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/SUC
- case 0x521: OPERATE_FFF("subt/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBT/SUC
- case 0x522: OPERATE_FFF("mult/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/SUC
- case 0x523: OPERATE_FFF("divt/suc", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/SUC
- case 0x52c: OPERATE_FF("cvttts/suc", Rb(instruction), Rc(instruction)); break; // CVTTS/SUC
- case 0x52f: OPERATE_FF("cvttq/svc", Rb(instruction), Rc(instruction)); break; // CVTTQ/SVC
- case 0x540: OPERATE_FFF("adds/sum", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/SUM
- case 0x541: OPERATE_FFF("subs/sum", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBS/SUM
- case 0x542: OPERATE_FFF("muls/sum", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/SUM
- case 0x543: OPERATE_FFF("divs/sum", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/SUM
- case 0x560: OPERATE_FFF("addt/sum", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/SUM
- case 0x561: OPERATE_FFF("subt/sum", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBT/SUM
- case 0x562: OPERATE_FFF("mult/sum", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/SUM
- case 0x563: OPERATE_FFF("divt/sum", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/SUM
- case 0x56c: OPERATE_FF("cvttts/sum", Rb(instruction), Rc(instruction)); break; // CVTTS/SUM
- case 0x56f: OPERATE_FF("cvttq/svm", Rb(instruction), Rc(instruction)); break; // CVTTQ/SVM
- case 0x580: OPERATE_FFF("adds/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/SU
- case 0x581:
- if (Ra(instruction) == 31)
- OPERATE_FF("negs/su", Rb(instruction), Rc(instruction));
- else
- OPERATE_FFF("subs/su", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBS/SU
- break;
- case 0x582: OPERATE_FFF("muls/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/SU
- case 0x583: OPERATE_FFF("divs/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/SU
- case 0x5a0: OPERATE_FFF("addt/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/SU
- case 0x5a1:
- if (Ra(instruction) == 31)
- OPERATE_FF("negt/su", Rb(instruction), Rc(instruction));
- else
- OPERATE_FFF("subt/su", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBT/SU
- break;
- case 0x5a2: OPERATE_FFF("mult/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/SU
- case 0x5a3: OPERATE_FFF("divt/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/SU
- case 0x5a4: OPERATE_FFF("cmptun/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPTUN/SU
- case 0x5a5: OPERATE_FFF("cmpteq/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPTEQ/SU
- case 0x5a6: OPERATE_FFF("cmptlt/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPTLT/SU
- case 0x5a7: OPERATE_FFF("cmptle/su", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CMPTLE/SU
- case 0x5ac: OPERATE_FF("cvttts/su", Rb(instruction), Rc(instruction)); break; // CVTTS/SU
- case 0x5af: OPERATE_FF("cvttq/sv", Rb(instruction), Rc(instruction)); break; // CVTTQ/SV
- case 0x5c0: OPERATE_FFF("adds/sud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/SUD
- case 0x5c1: OPERATE_FFF("subs/sud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBS/SUD
- case 0x5c2: OPERATE_FFF("muls/sud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/SUD
- case 0x5c3: OPERATE_FFF("divs/sud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/SUD
- case 0x5e0: OPERATE_FFF("addt/sud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/SUD
- case 0x5e1: OPERATE_FFF("subt/sud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBT/SUD
- case 0x5e2: OPERATE_FFF("mult/sud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/SUD
- case 0x5e3: OPERATE_FFF("divt/sud", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/SUD
- case 0x5ec: OPERATE_FF("cvttts/sud", Rb(instruction), Rc(instruction)); break; // CVTTS/SUD
- case 0x5ef: OPERATE_FF("cvttq/svd", Rb(instruction), Rc(instruction)); break; // CVTTQ/SVD
- case 0x6ac: OPERATE_FF("cvtst/s", Rb(instruction), Rc(instruction)); break; // CVTST/S
- case 0x700: OPERATE_FFF("adds/suic", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/SUIC
- case 0x701: OPERATE_FFF("subs/suic", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBS/SUIC
- case 0x702: OPERATE_FFF("muls/suic", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/SUIC
- case 0x703: OPERATE_FFF("divs/suic", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/SUIC
- case 0x720: OPERATE_FFF("addt/suic", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/SUIC
- case 0x721: OPERATE_FFF("subt/suic", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBT/SUIC
- case 0x722: OPERATE_FFF("mult/suic", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/SUIC
- case 0x723: OPERATE_FFF("divt/suic", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/SUIC
- case 0x72c: OPERATE_FF("cvttts/suic", Rb(instruction), Rc(instruction)); break; // CVTTS/SUIC
- case 0x72f: OPERATE_FF("cvttq/svic", Rb(instruction), Rc(instruction)); break; // CVTTQ/SVIC
- case 0x73c: OPERATE_FF("cvtqs/suic", Rb(instruction), Rc(instruction)); break; // CVTQS/SUIC
- case 0x73e: OPERATE_FF("cvtqt/suic", Rb(instruction), Rc(instruction)); break; // CVTQT/SUIC
- case 0x740: OPERATE_FFF("adds/suim", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/SUIM
- case 0x741: OPERATE_FFF("subs/suim", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBS/SUIM
- case 0x742: OPERATE_FFF("muls/suim", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/SUIM
- case 0x743: OPERATE_FFF("divs/suim", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/SUIM
- case 0x760: OPERATE_FFF("addt/suim", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/SUIM
- case 0x761: OPERATE_FFF("subt/suim", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBT/SUIM
- case 0x762: OPERATE_FFF("mult/suim", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/SUIM
- case 0x763: OPERATE_FFF("divt/suim", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/SUIM
- case 0x76c: OPERATE_FF("cvttts/suim", Rb(instruction), Rc(instruction)); break; // CVTTS/SUIM
- case 0x76f: OPERATE_FF("cvttq/svim", Rb(instruction), Rc(instruction)); break; // CVTTQ/SVIM
- case 0x77c: OPERATE_FF("cvtqs/suim", Rb(instruction), Rc(instruction)); break; // CVTQS/SUIM
- case 0x77e: OPERATE_FF("cvtqt/suim", Rb(instruction), Rc(instruction)); break; // CVTQT/SUIM
- case 0x780: OPERATE_FFF("adds/sui", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/SUI
- case 0x781:
- if (Ra(instruction) == 31)
- OPERATE_FF("negs/sui", Rb(instruction), Rc(instruction));
- else
- OPERATE_FFF("subs/sui", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBS/SUI
- break;
- case 0x782: OPERATE_FFF("muls/sui", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/SUI
- case 0x783: OPERATE_FFF("divs/sui", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/SUI
- case 0x7a0: OPERATE_FFF("addt/sui", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/SUI
- case 0x7a1:
- if (Ra(instruction) == 31)
- OPERATE_FF("negt/sui", Rb(instruction), Rc(instruction));
- else
- OPERATE_FFF("subt/sui", Ra(instruction), Rb(instruction), Rc(instruction)); // SUBT/SUI
- break;
- case 0x7a2: OPERATE_FFF("mult/sui", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/SUI
- case 0x7a3: OPERATE_FFF("divt/sui", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/SUI
- case 0x7ac: OPERATE_FF("cvttts/sui", Rb(instruction), Rc(instruction)); break; // CVTTS/SUI
- case 0x7af: OPERATE_FF("cvttq/svi", Rb(instruction), Rc(instruction)); break; // CVTTQ/SVI
- case 0x7bc: OPERATE_FF("cvtqs/sui", Rb(instruction), Rc(instruction)); break; // CVTQS/SUI
- case 0x7be: OPERATE_FF("cvtqt/sui", Rb(instruction), Rc(instruction)); break; // CVTQT/SUI
- case 0x7c0: OPERATE_FFF("adds/suid", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDS/SUID
- case 0x7c1: OPERATE_FFF("subs/suid", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBS/SUID
- case 0x7c2: OPERATE_FFF("muls/suid", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULS/SUID
- case 0x7c3: OPERATE_FFF("divs/suid", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVS/SUID
- case 0x7e0: OPERATE_FFF("addt/suid", Ra(instruction), Rb(instruction), Rc(instruction)); break; // ADDT/SUID
- case 0x7e1: OPERATE_FFF("subt/suid", Ra(instruction), Rb(instruction), Rc(instruction)); break; // SUBT/SUID
- case 0x7e2: OPERATE_FFF("mult/suid", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MULT/SUID
- case 0x7e3: OPERATE_FFF("divt/suid", Ra(instruction), Rb(instruction), Rc(instruction)); break; // DIVT/SUID
- case 0x7ec: OPERATE_FF("cvttts/suid", Rb(instruction), Rc(instruction)); break; // CVTTS/SUID
- case 0x7ef: OPERATE_FF("cvttq/svid", Rb(instruction), Rc(instruction)); break; // CVTTQ/SVID
- case 0x7fc: OPERATE_FF("cvtqs/suid", Rb(instruction), Rc(instruction)); break; // CVTQS/SUID
- case 0x7fe: OPERATE_FF("cvtqt/suid", Rb(instruction), Rc(instruction)); break; // CVTQT/SUID
-
- default: UNKNOWN("flti*"); break;
- }
- break;
- case 0x17: // FLTL* (floating)
- switch ((instruction >> 5) & 0x7ff)
- {
- case 0x010: OPERATE_FF("cvtlq", Rb(instruction), Rc(instruction)); break; // CVTLQ
- case 0x020:
- if (Ra(instruction) == 31 && Rb(instruction) == 31 && Rc(instruction) == 31)
- MISC("fnop");
- else if (Ra(instruction) == 31 && Rb(instruction) == 31)
- OPERATE_F("fclr", Rc(instruction));
- else if (Ra(instruction) == 31)
- OPERATE_FF("fabs", Rb(instruction), Rc(instruction));
- else if (Ra(instruction) == Rb(instruction))
- OPERATE_FF("fmov", Rb(instruction), Rc(instruction));
- else
- OPERATE_FFF("cpys", Ra(instruction), Rb(instruction), Rc(instruction)); // CPYS
- break;
- case 0x021:
- if (Ra(instruction) == Rb(instruction))
- OPERATE_FF("fneg", Rb(instruction), Rc(instruction));
- else
- OPERATE_FFF("cpysn", Ra(instruction), Rb(instruction), Rc(instruction)); // CPYSN
- break;
- case 0x022: OPERATE_FFF("cpyse", Ra(instruction), Rb(instruction), Rc(instruction)); break; // CPYSE
- case 0x024:
- if (Ra(instruction) == Rb(instruction) && Rb(instruction) == Rc(instruction))
- OPERATE_F("mt_fpcr", Rc(instruction));
- else
- OPERATE_FFF("mt_fpcr", Ra(instruction), Rb(instruction), Rc(instruction)); // MT_FPCR
- break;
- case 0x025:
- if (Ra(instruction) == Rb(instruction) && Rb(instruction) == Rc(instruction))
- OPERATE_F("mf_fpcr", Rc(instruction));
- else
- OPERATE_FFF("mf_fpcr", Ra(instruction), Rb(instruction), Rc(instruction)); // MF_FPCR
- break;
- case 0x02a: OPERATE_FFF("fcmoveq", Ra(instruction), Rb(instruction), Rc(instruction)); break; // FCMOVEQ
- case 0x02b: OPERATE_FFF("fcmovne", Ra(instruction), Rb(instruction), Rc(instruction)); break; // FCMOVNE
- case 0x02c: OPERATE_FFF("fcmovlt", Ra(instruction), Rb(instruction), Rc(instruction)); break; // FCMOVLT
- case 0x02d: OPERATE_FFF("fcmovge", Ra(instruction), Rb(instruction), Rc(instruction)); break; // FCMOVGE
- case 0x02e: OPERATE_FFF("fcmovle", Ra(instruction), Rb(instruction), Rc(instruction)); break; // FCMOVLE
- case 0x02f: OPERATE_FFF("fcmovgt", Ra(instruction), Rb(instruction), Rc(instruction)); break; // FCMOVGT
- case 0x030: OPERATE_FF("cvtql", Rb(instruction), Rc(instruction)); break; // CVTQL
- case 0x130: OPERATE_FF("cvtql/v", Rb(instruction), Rc(instruction)); break; // CVTQL/V
- case 0x530: OPERATE_FF("cvtql/sv", Rb(instruction), Rc(instruction)); break; // CVTQL/SV
-
- default: UNKNOWN("fltl*"); break;
- }
- break;
- case 0x18: // MISC* (miscellaneous)
- switch (u16(instruction))
- {
- case 0x0000: MISC("trapb"); break; // TRAPB
- case 0x0400: MISC("excb"); break; // EXCB
- case 0x4000: MISC("mb"); break; // MB
- case 0x4400: MISC("wmb"); break; // WMB
- case 0x8000: MISC_M("fetch", Rb(instruction)); break; // FETCH
- case 0xa000: MISC_M("fetch_m", Rb(instruction)); break; // FETCH_M
- case 0xc000: MISC_R("rpcc", Ra(instruction)); break; // RPCC
- case 0xe000: MISC_R("rc", Ra(instruction)); break; // RC
- case 0xe800: MISC_M("ecb", Rb(instruction)); break; // ECB
- case 0xf000: MISC_R("rs", Ra(instruction)); break; // RS
- case 0xf800: MISC_M("wh64", Rb(instruction)); break; // WH64
-
- default: UNKNOWN("misc*"); break;
- }
- break;
- case 0x19: // PAL19
- switch ((instruction >> 5) & 0x7)
- {
- case 0x0: MISC("nop"); break;
- case 0x1: OPERATE_RI("hw_mfpr/i", Rb(instruction), Rc(instruction)); break;
- case 0x2: OPERATE_RA("hw_mfpr/a", Rb(instruction), Rc(instruction)); break;
- case 0x3: OPERATE_RAI("hw_mfpr/ai", Rb(instruction), Rc(instruction)); break;
- case 0x4: OPERATE_RP("hw_mfpr/p", Rb(instruction), Rc(instruction)); break;
- case 0x5: OPERATE_RPI("hw_mfpr/pi", Rb(instruction), Rc(instruction)); break;
- case 0x6: OPERATE_RPA("hw_mfpr/pa", Rb(instruction), Rc(instruction)); break;
- case 0x7: OPERATE_RPAI("hw_mfpr/pai", Rb(instruction), Rc(instruction)); break;
- }
- break;
-
- case 0x1a: // JSR* (jump)
- switch ((instruction >> 14) & 3)
- {
- case 0: JUMP("jmp", Ra(instruction), Rb(instruction)); break; // JMP
- case 1: JUMP("jsr", Ra(instruction), Rb(instruction)); flags |= STEP_OVER; break; // JSR
- case 2: JUMP("ret", Ra(instruction), Rb(instruction)); flags |= STEP_OUT; break; // RET
- case 3: JUMP("jsr_c", Ra(instruction), Rb(instruction)); break; // JSR_COROUTINE
- }
- break;
- case 0x1b: // PAL1B
- switch ((instruction >> 12) & 0xf)
- {
- case 0x0: MEMORY_R("hw_ldl", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x1: MEMORY_R("hw_ldq", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x2: MEMORY_R("hw_ldl/r", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x3: MEMORY_R("hw_ldq/r", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x4: MEMORY_R("hw_ldl/a", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x5: MEMORY_R("hw_ldq/a", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x6: MEMORY_R("hw_ldl/ar", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x7: MEMORY_R("hw_ldq/ar", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x8: MEMORY_R("hw_ldl/p", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x9: MEMORY_R("hw_ldq/p", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0xa: MEMORY_R("hw_ldl/pr", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0xb: MEMORY_R("hw_ldq/pr", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0xc: MEMORY_R("hw_ldl/pa", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0xd: MEMORY_R("hw_ldq/pa", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0xe: MEMORY_R("hw_ldl/par", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0xf: MEMORY_R("hw_ldq/par", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- }
- break;
- case 0x1c: // FPTI* (floating to integer)
- switch ((instruction >> 5) & 0xff)
- {
- // register variants
- case 0x00: OPERATE_RR("sextb", Rb(instruction), Rc(instruction)); break; // SEXTB (BWX)
- case 0x01: OPERATE_RR("sextw", Rb(instruction), Rc(instruction)); break; // SEXTW (BWX)
- case 0x30: OPERATE_RR("ctpop", Rb(instruction), Rc(instruction)); break; // CTPOP (CIX)
- case 0x31: OPERATE_RRR("perr", Ra(instruction), Rb(instruction), Rc(instruction)); break; // PERR (MVI)
- case 0x32: OPERATE_RR("ctlz", Rb(instruction), Rc(instruction)); break; // CTLZ (CIX)
- case 0x33: OPERATE_RR("cttz", Rb(instruction), Rc(instruction)); break; // CTTZ (CIX)
- case 0x34: OPERATE_RR("unpkbw", Rb(instruction), Rc(instruction)); break; // UNPKBW (MVI)
- case 0x35: OPERATE_RR("unpkbl", Rb(instruction), Rc(instruction)); break; // UNPKBL (MVI)
- case 0x36: OPERATE_RR("pkwb", Rb(instruction), Rc(instruction)); break; // PKWB (MVI)
- case 0x37: OPERATE_RR("pklb", Rb(instruction), Rc(instruction)); break; // PKLB (MVI)
- case 0x38: OPERATE_RRR("minsb8", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MINSB8 (MVI)
- case 0x39: OPERATE_RRR("minsw4", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MINSW4 (MVI)
- case 0x3a: OPERATE_RRR("minub8", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MINUB8 (MVI)
- case 0x3b: OPERATE_RRR("minuw4", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MINUW4 (MVI)
- case 0x3c: OPERATE_RRR("maxub8", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MAXUB8 (MVI)
- case 0x3d: OPERATE_RRR("maxuw4", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MAXUW4 (MVI)
- case 0x3e: OPERATE_RRR("maxsb8", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MAXSB8 (MVI)
- case 0x3f: OPERATE_RRR("maxsw4", Ra(instruction), Rb(instruction), Rc(instruction)); break; // MAXSW4 (MVI)
- case 0x70: OPERATE_FR("ftoit", Ra(instruction), Rc(instruction)); break; // FTOIT (FIX)
- case 0x78: OPERATE_FR("ftois", Ra(instruction), Rc(instruction)); break; // FTOIS (FIX)
-
- // immediate variants
- case 0x80: OPERATE_IR("sextb", Im(instruction), Rc(instruction)); break; // SEXTB (BWX)
- case 0x81: OPERATE_IR("sextw", Im(instruction), Rc(instruction)); break; // SEXTW (BWX)
- case 0xb8: OPERATE_RIR("minsb8", Ra(instruction), Im(instruction), Rc(instruction)); break; // MINSB8 (MVI)
- case 0xb9: OPERATE_RIR("minsw4", Ra(instruction), Im(instruction), Rc(instruction)); break; // MINSW4 (MVI)
- case 0xba: OPERATE_RIR("minub8", Ra(instruction), Im(instruction), Rc(instruction)); break; // MINUB8 (MVI)
- case 0xbb: OPERATE_RIR("minuw4", Ra(instruction), Im(instruction), Rc(instruction)); break; // MINUW4 (MVI)
- case 0xbc: OPERATE_RIR("maxub8", Ra(instruction), Im(instruction), Rc(instruction)); break; // MAXUB8 (MVI)
- case 0xbd: OPERATE_RIR("maxuw4", Ra(instruction), Im(instruction), Rc(instruction)); break; // MAXUW4 (MVI)
- case 0xbe: OPERATE_RIR("maxsb8", Ra(instruction), Im(instruction), Rc(instruction)); break; // MAXSB8 (MVI)
- case 0xbf: OPERATE_RIR("maxsw4", Ra(instruction), Im(instruction), Rc(instruction)); break; // MAXSW4 (MVI)
-
- default: UNKNOWN("fpti*"); break;
- }
- break;
- case 0x1d: // PAL1D
- switch ((instruction >> 5) & 0x7)
- {
- case 0x0: MISC("nop"); break;
- case 0x1: OPERATE_RI("hw_mtpr/i", Rb(instruction), Rc(instruction)); break;
- case 0x2: OPERATE_RA("hw_mtpr/a", Rb(instruction), Rc(instruction)); break;
- case 0x3: OPERATE_RAI("hw_mtpr/ai", Rb(instruction), Rc(instruction)); break;
- case 0x4: OPERATE_RP("hw_mtpr/p", Rb(instruction), Rc(instruction)); break;
- case 0x5: OPERATE_RPI("hw_mtpr/pi", Rb(instruction), Rc(instruction)); break;
- case 0x6: OPERATE_RPA("hw_mtpr/pa", Rb(instruction), Rc(instruction)); break;
- case 0x7: OPERATE_RPAI("hw_mtpr/pai", Rb(instruction), Rc(instruction)); break;
- }
- break;
- case 0x1e: // PAL1E
- switch (instruction & 0x03ffffff)
- {
- case 0x03ff8000: MISC("hw_rei"); break;
-
- default: UNKNOWN("pal1e"); break;
- }
- break;
- case 0x1f: // PAL1F
- switch ((instruction >> 12) & 0xf)
- {
- case 0x0: MEMORY_R("hw_stl", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x1: MEMORY_R("hw_stq", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x2: MEMORY_R("hw_stl/r", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x3: MEMORY_R("hw_stq/r", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x4: MEMORY_R("hw_stl/a", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x5: MEMORY_R("hw_stq/a", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x6: MEMORY_R("hw_stl/ar", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x7: MEMORY_R("hw_stq/ar", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x8: MEMORY_R("hw_stl/p", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0x9: MEMORY_R("hw_stq/p", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0xa: MEMORY_R("hw_stl/pr", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0xb: MEMORY_R("hw_stq/pr", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0xc: MEMORY_R("hw_stl/pa", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0xd: MEMORY_R("hw_stq/pa", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0xe: MEMORY_R("hw_stl/par", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- case 0xf: MEMORY_R("hw_stq/par", Ra(instruction), Disp_P(instruction), Rb(instruction)); break;
- }
- break;
- // memory format
- case 0x20: MEMORY_F("ldf", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // LDF
- case 0x21: MEMORY_F("ldg", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // LDG
- case 0x22: MEMORY_F("lds", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // LDS
- case 0x23: MEMORY_F("ldt", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // LDT
- case 0x24: MEMORY_F("stf", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // STF
- case 0x25: MEMORY_F("stg", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // STG
- case 0x26: MEMORY_F("sts", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // STS
- case 0x27: MEMORY_F("stt", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // STT
- case 0x28: MEMORY_R("ldl", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // LDL
- case 0x29: MEMORY_R("ldq", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // LDQ
- case 0x2a: MEMORY_R("ldl_l", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // LDL_L
- case 0x2b: MEMORY_R("ldq_l", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // LDQ_L
- case 0x2c: MEMORY_R("stl", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // STL
- case 0x2d: MEMORY_R("stq", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // STQ
- case 0x2e: MEMORY_R("stl_c", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // STL_C
- case 0x2f: MEMORY_R("stq_c", Ra(instruction), Disp_M(instruction), Rb(instruction)); break; // STQ_C
-
- // branch format
- case 0x30:
- if (Ra(instruction) == 31)
- BRANCH("br", Disp_B(instruction));
- else
- BRANCH_R("br", Ra(instruction), Disp_B(instruction)); // BR
- break;
- case 0x31: BRANCH_F("fbeq", Ra(instruction), Disp_B(instruction)); break; // FBEQ
- case 0x32: BRANCH_F("fblt", Ra(instruction), Disp_B(instruction)); break; // FBLT
- case 0x33: BRANCH_F("fble", Ra(instruction), Disp_B(instruction)); break; // FBLE
- case 0x34: BRANCH_R("bsr", Ra(instruction), Disp_B(instruction)); break; // BSR
- case 0x35: BRANCH_F("fbne", Ra(instruction), Disp_B(instruction)); break; // FBNE
- case 0x36: BRANCH_F("fbge", Ra(instruction), Disp_B(instruction)); break; // FBGE
- case 0x37: BRANCH_F("fbgt", Ra(instruction), Disp_B(instruction)); break; // FBGT
- case 0x38: BRANCH_R("blbc", Ra(instruction), Disp_B(instruction)); break; // BLBC
- case 0x39: BRANCH_R("beq", Ra(instruction), Disp_B(instruction)); break; // BEQ
- case 0x3a: BRANCH_R("blt", Ra(instruction), Disp_B(instruction)); break; // BLT
- case 0x3b: BRANCH_R("ble", Ra(instruction), Disp_B(instruction)); break; // BLE
- case 0x3c: BRANCH_R("blbs", Ra(instruction), Disp_B(instruction)); break; // BLBS
- case 0x3d: BRANCH_R("bne", Ra(instruction), Disp_B(instruction)); break; // BNE
- case 0x3e: BRANCH_R("bge", Ra(instruction), Disp_B(instruction)); break; // BGE
- case 0x3f: BRANCH_R("bgt", Ra(instruction), Disp_B(instruction)); break; // BGT
- }
-
- return bytes | flags;
-}
diff --git a/src/devices/cpu/alpha/alphad.h b/src/devices/cpu/alpha/alphad.h
deleted file mode 100644
index 3c3475e5730..00000000000
--- a/src/devices/cpu/alpha/alphad.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Patrick Mackinlay
-
-#ifndef MAME_CPU_ALPHA_ALPHAD_H
-#define MAME_CPU_ALPHA_ALPHAD_H
-
-#pragma once
-
-class alpha_disassembler : public util::disasm_interface
-{
-public:
- enum dasm_type : unsigned
- {
- TYPE_UNKNOWN = 0,
- TYPE_NT = 1,
- TYPE_UNIX = 2,
- TYPE_VMS = 3,
- };
-
- alpha_disassembler(alpha_disassembler::dasm_type type = TYPE_UNKNOWN)
- : m_dasm_type(type)
- {
- };
- virtual ~alpha_disassembler() = default;
-
- virtual u32 opcode_alignment() const override { return 4; };
- virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params) override;
-
-private:
- static char const *const R[];
- static char const *const F[];
-
- static char const *const PT[];
- static char const *const ABX[];
- static char const *const IBX[];
-
- dasm_type const m_dasm_type;
-};
-
-#endif // MAME_CPU_ALPHA_ALPHAD_H
diff --git a/src/devices/cpu/alpha/common.h b/src/devices/cpu/alpha/common.h
deleted file mode 100644
index 0c9668f304a..00000000000
--- a/src/devices/cpu/alpha/common.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Patrick Mackinlay
-
-#ifndef MAME_CPU_ALPHA_COMMON_H
-#define MAME_CPU_ALPHA_COMMON_H
-
-#pragma once
-
-// instruction field extraction
-#define Ra(x) ((x >> 21) & 31) // 'a' register field
-#define Rb(x) ((x >> 16) & 31) // 'b' register field
-#define Rc(x) (x & 31) // 'c' register field
-#define Im(x) (u64(u8(x >> 13))) // literal immediate field
-
-#define Disp_M(x) (s64(s16(x))) // memory instruction 16-bit signed offset
-#define Disp_P(x) (s64(s16(x << 4)) >> 4) // hardware load/store 12-bit signed offset
-#define Disp_B(x) (s64(s32(x << 11)) >> 9) // branch instruction offset
-
-#endif // MAME_CPU_ALPHA_COMMON_H
diff --git a/src/devices/cpu/alto2/a2ether.cpp b/src/devices/cpu/alto2/a2ether.cpp
index 2c1a3d56a89..7af15ffbad0 100644
--- a/src/devices/cpu/alto2/a2ether.cpp
+++ b/src/devices/cpu/alto2/a2ether.cpp
@@ -522,7 +522,7 @@ void alto2_cpu_device::rx_breath_of_life(void* ptr, int32_t arg)
m_eth.rx_timer->adjust(attotime::from_seconds(m_eth.breath_of_life), 0);
} else {
// receive at a rate of 5.44us per word
- m_eth.rx_timer->adjust(attotime::from_nsec(5440), arg);
+ m_eth.rx_timer->adjust(attotime::from_usec(5.44), arg);
}
eth_wakeup();
}
@@ -557,10 +557,10 @@ void alto2_cpu_device::tx_packet(void* ptr, int32_t arg)
// the FIFO is empty now: clear the OBUSY and WLF flip flops
PUT_ETH_OBUSY(m_eth.status, 0);
PUT_ETH_WLF(m_eth.status, 0);
- m_eth.tx_timer->adjust(attotime::from_nsec(5440), -1);
+ m_eth.tx_timer->adjust(attotime::from_usec(5.44), -1);
} else {
// transmit the next word after 5.44us
- m_eth.tx_timer->adjust(attotime::from_nsec(5440), arg + 1);
+ m_eth.tx_timer->adjust(attotime::from_usec(5.44), arg + 1);
}
eth_wakeup();
}
@@ -722,7 +722,7 @@ void alto2_cpu_device::f2_late_eodfct()
uint8_t a49 = m_ether_a49[16 * m_eth.fifo_wr + m_eth.fifo_rd];
if (0 == BF(a49)) {
m_task_wakeup &= ~(1 << task_ether);
- m_eth.tx_timer->adjust(attotime::from_nsec(5440), 0);
+ m_eth.tx_timer->adjust(attotime::from_usec(5.44), 0);
}
}
@@ -774,7 +774,7 @@ void alto2_cpu_device::f2_late_eefct()
PUT_ETH_OBUSY(m_eth.status, 1);
PUT_ETH_OEOT(m_eth.status, 1);
// end transmitting the packet
- m_eth.tx_timer->adjust(attotime::from_nsec(5440), -1);
+ m_eth.tx_timer->adjust(attotime::from_usec(5.44), -1);
eth_wakeup();
}
diff --git a/src/devices/cpu/amis2000/amis2000.h b/src/devices/cpu/amis2000/amis2000.h
index 58665c7f6bc..2739461b44b 100644
--- a/src/devices/cpu/amis2000/amis2000.h
+++ b/src/devices/cpu/amis2000/amis2000.h
@@ -30,13 +30,12 @@ public:
// S2000 has a hardcoded 7seg table, that (unlike S2200) is officially
// uncustomizable, but wildfire proves to be an exception to that rule.
- void set_7seg_table(const u8 *ptr) { m_7seg_table = ptr; } // d0=A, d1=B, etc.
+ void set_7seg_table(const u8 *ptr) { m_7seg_table = ptr; }
void data_64x4(address_map &map);
void data_80x4(address_map &map);
void program_1_5k(address_map &map);
void program_1k(address_map &map);
-
protected:
// construction/destruction
amis2000_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 bu_bits, u8 callstack_bits, u8 callstack_depth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data)
diff --git a/src/devices/cpu/amis2000/amis2000op.cpp b/src/devices/cpu/amis2000/amis2000op.cpp
index 92c2eaae3dc..e67ee6d153b 100644
--- a/src/devices/cpu/amis2000/amis2000op.cpp
+++ b/src/devices/cpu/amis2000/amis2000op.cpp
@@ -220,13 +220,11 @@ void amis2000_base_device::op_disn()
// DISN: set D-latch to ACC+carry via on-die segment decoder
static const u8 lut_segment_decoder[0x10] =
{
- 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, // 0-7
- 0x7f, 0x6f, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71 // 8-F
+ // 0-F digits in bit order [DP]abcdefg
+ 0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, 0x7f, 0x7b, 0x77, 0x1f, 0x4e, 0x3d, 0x4f, 0x47
};
- const u8 *lut = (m_7seg_table != nullptr) ? m_7seg_table : lut_segment_decoder;
-
- // segments are in order [DP]abcdefg
- m_d = bitswap<7>(lut[m_acc],0,1,2,3,4,5,6) | (m_carry ? 0x80 : 0x00);
+ const u8 *ptr = (m_7seg_table != nullptr) ? m_7seg_table : lut_segment_decoder;
+ m_d = ptr[m_acc] | (m_carry ? 0x80 : 0x00);
d_latch_out(true);
}
@@ -502,6 +500,7 @@ void amis2000_base_device::op_rf2()
}
+
// AMI S2152 specific handlers
void amis2152_cpu_device::d2f_timer_clock()
diff --git a/src/devices/cpu/arm7/lpc210x.cpp b/src/devices/cpu/arm7/lpc210x.cpp
index d2964589e01..19f21ea7b00 100644
--- a/src/devices/cpu/arm7/lpc210x.cpp
+++ b/src/devices/cpu/arm7/lpc210x.cpp
@@ -2,7 +2,7 @@
// copyright-holders:David Haywood
/***************************************************************************
- NXP (Philips) LPC2103 series
+ NXP (Phillips) LPC2103 series
covering LPC2101, LPC2102, LPC2103*
*currently only LPC2103
@@ -276,6 +276,5 @@ void lpc210x_device::write_timer(address_space &space, int timer, int offset, ui
-void lpc210x_device::device_add_mconfig(machine_config &config)
-{
-}
+MACHINE_CONFIG_START(lpc210x_device::device_add_mconfig)
+MACHINE_CONFIG_END
diff --git a/src/devices/cpu/cosmac/cosmac.cpp b/src/devices/cpu/cosmac/cosmac.cpp
index e4155a514c7..0a7bd554d93 100644
--- a/src/devices/cpu/cosmac/cosmac.cpp
+++ b/src/devices/cpu/cosmac/cosmac.cpp
@@ -733,12 +733,10 @@ inline void cosmac_device::run_state()
case cosmac_state::STATE_2_DMA_IN:
dma_input();
- debug();
break;
case cosmac_state::STATE_2_DMA_OUT:
dma_output();
- debug();
break;
case cosmac_state::STATE_3_INT:
diff --git a/src/devices/cpu/dspp/dspp.h b/src/devices/cpu/dspp/dspp.h
index 302d141db13..9ebf08f6f6e 100644
--- a/src/devices/cpu/dspp/dspp.h
+++ b/src/devices/cpu/dspp/dspp.h
@@ -67,10 +67,10 @@ public:
DECLARE_READ16_MEMBER( noise_r );
void update_fifo_dma();
- void print_sums() { printf("%04x: %04x\n", (uint16_t)m_core->m_arg0, (uint16_t)m_core->m_arg1); }
- void print_branches() { printf("Branch: %d %d %d %d %d\n", m_core->m_arg0 ? 1 : 0, m_core->m_arg1 ? 1 : 0, m_core->m_arg2 ? 1 : 0, m_core->m_arg3 ? 1 : 0, m_core->m_arg4 ? 1 : 0); }
- void print_value() { printf("Value is %08x\n", m_core->m_arg0); }
- void print_addr() { printf("New value is %08x from %08x\n", m_core->m_arg0, m_core->m_arg1); }
+ void print_sums() { printf("%04x: %04x\n", (uint16_t)m_core->m_arg0, (uint16_t)m_core->m_arg1); }
+ void print_branches() { printf("Branch: %d %d %d %d %d\n", m_core->m_arg0 ? 1 : 0, m_core->m_arg1 ? 1 : 0, m_core->m_arg2 ? 1 : 0, m_core->m_arg3 ? 1 : 0, m_core->m_arg4 ? 1 : 0); }
+ void print_value() { printf("Value is %08x\n", m_core->m_arg0); }
+ void print_addr() { printf("New value is %08x from %08x\n", m_core->m_arg0, m_core->m_arg1); }
protected:
// device-level overrides
@@ -232,10 +232,10 @@ private:
const char *m_format;
uint32_t m_arg0;
- uint32_t m_arg1;
- uint32_t m_arg2;
- uint32_t m_arg3;
- uint32_t m_arg4;
+ uint32_t m_arg1;
+ uint32_t m_arg2;
+ uint32_t m_arg3;
+ uint32_t m_arg4;
struct
{
@@ -316,7 +316,7 @@ private:
uint32_t cycles; /* accumulated cycles */
uint8_t checkints; /* need to check interrupts before next instruction */
uint8_t checksoftints; /* need to check software interrupts before next instruction */
- uml::code_label abortlabel; /* label to abort execution of this block */
+ uml::code_label abortlabel; /* label to abort execution of this block */
uml::code_label labelnum; /* index for local labels */
};
diff --git a/src/devices/cpu/dspp/dsppdrc.cpp b/src/devices/cpu/dspp/dsppdrc.cpp
index 68b0c3cb741..aefa9b9999c 100644
--- a/src/devices/cpu/dspp/dsppdrc.cpp
+++ b/src/devices/cpu/dspp/dsppdrc.cpp
@@ -22,7 +22,7 @@ using namespace uml;
// map variables
#define MAPVAR_PC M0
-#define MAPVAR_CYCLES M1
+#define MAPVAR_CYCLES M1
// exit codes
#define EXECUTE_OUT_OF_CYCLES 0
@@ -244,12 +244,12 @@ void dspp_device::compile_block(offs_t pc)
if (seqhead->flags & OPFLAG_IS_BRANCH_TARGET)
UML_LABEL(block, seqhead->pc | 0x80000000); // label seqhead->pc
- compiler.abortlabel = compiler.labelnum++;
+ compiler.abortlabel = compiler.labelnum++;
/* iterate over instructions in the sequence and compile them */
for (curdesc = seqhead; curdesc != seqlast->next(); curdesc = curdesc->next())
generate_sequence_instruction(block, &compiler, curdesc);
- UML_LABEL(block, compiler.abortlabel);
+ UML_LABEL(block, compiler.abortlabel);
/* if we need to return to the start, do it */
if (seqlast->flags & OPFLAG_RETURN_TO_START)
@@ -293,11 +293,11 @@ 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);
- UML_MOV(block, I0, 0);
+ UML_MOV(block, I0, 0);
UML_LOAD(block, I0, base, 0, SIZE_WORD, SCALE_x2); // load i0,base,0,word
- UML_CMP(block, I0, sum); // cmp i0,opptr[0]
- UML_EXHc(block, COND_NE, *m_nocode, seqhead->pc); // exne nocode,seqhead->pc
+ UML_CMP(block, I0, sum); // cmp i0,opptr[0]
+ UML_EXHc(block, COND_NE, *m_nocode, seqhead->pc); // exne nocode,seqhead->pc
}
}
@@ -307,7 +307,7 @@ 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);
- UML_LOAD(block, I0, base, 0, SIZE_WORD, SCALE_x2); // load i0,base,0,dword
+ 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))
@@ -315,12 +315,12 @@ void dspp_device::generate_checksum_block(drcuml_block &block, compiler_state *c
addr = curdesc->physpc;
base = m_codeptr(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
+ UML_LOAD(block, I1, base, 0, SIZE_WORD, SCALE_x2); // load i1,base,dword
+ UML_ADD(block, I0, I0, I1); // add i0,i0,i1
sum += curdesc->opptr.w[0];
}
- UML_CMP(block, I0, sum); // cmp i0,sum
- UML_EXHc(block, COND_NE, *m_nocode, epc(seqhead)); // exne nocode,seqhead->pc
+ UML_CMP(block, I0, sum); // cmp i0,sum
+ UML_EXHc(block, COND_NE, *m_nocode, epc(seqhead)); // exne nocode,seqhead->pc
}
}
@@ -373,12 +373,12 @@ void dspp_device::static_generate_nocode_handler()
/* generate a hash jump via the current mode and PC */
alloc_handle(m_drcuml.get(), &m_nocode, "nocode");
- UML_HANDLE(block, *m_nocode); // handle nocode
- UML_GETEXP(block, I0); // getexp i0
+ UML_HANDLE(block, *m_nocode); // handle nocode
+ UML_GETEXP(block, I0); // getexp i0
- UML_MOV(block, mem(&m_core->m_pc), I0); // mov [pc],i0
- //save_fast_iregs(block); // <save fastregs>
- UML_EXIT(block, EXECUTE_MISSING_CODE); // exit EXECUTE_MISSING_CODE
+ UML_MOV(block, mem(&m_core->m_pc), I0); // mov [pc],i0
+ //save_fast_iregs(block); // <save fastregs>
+ UML_EXIT(block, EXECUTE_MISSING_CODE); // exit EXECUTE_MISSING_CODE
block.end();
}
@@ -390,11 +390,11 @@ void dspp_device::static_generate_out_of_cycles()
/* generate a hash jump via the current mode and PC */
alloc_handle(m_drcuml.get(), &m_out_of_cycles, "out_of_cycles");
- UML_HANDLE(block, *m_out_of_cycles); // handle out_of_cycles
- UML_GETEXP(block, I0); // getexp i0
- UML_MOV(block, mem(&m_core->m_pc), I0); // mov <pc>,i0
- //save_fast_iregs(block); // <save fastregs>
- UML_EXIT(block, EXECUTE_OUT_OF_CYCLES); // exit EXECUTE_OUT_OF_CYCLES
+ UML_HANDLE(block, *m_out_of_cycles); // handle out_of_cycles
+ UML_GETEXP(block, I0); // getexp i0
+ UML_MOV(block, mem(&m_core->m_pc), I0); // mov <pc>,i0
+ //save_fast_iregs(block); // <save fastregs>
+ UML_EXIT(block, EXECUTE_OUT_OF_CYCLES); // exit EXECUTE_OUT_OF_CYCLES
block.end();
}
@@ -402,28 +402,28 @@ void dspp_device::static_generate_out_of_cycles()
void dspp_device::generate_sequence_instruction(drcuml_block &block, compiler_state *compiler, const opcode_desc *desc)
{
/* set the PC map variable */
- UML_MAPVAR(block, MAPVAR_PC, desc->pc); // mapvar PC,desc->pc
+ UML_MAPVAR(block, MAPVAR_PC, desc->pc); // mapvar PC,desc->pc
/* accumulate total cycles */
compiler->cycles += desc->cycles;
/* update the icount map variable */
- UML_MAPVAR(block, MAPVAR_CYCLES, compiler->cycles); // mapvar CYCLES,compiler->cycles
+ UML_MAPVAR(block, MAPVAR_CYCLES, compiler->cycles); // mapvar CYCLES,compiler->cycles
/* if we are debugging, call the debugger */
if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
{
- UML_MOV(block, mem(&m_core->m_pc), desc->pc); // mov [pc],desc->pc
- //save_fast_iregs(block); // <save fastregs>
- UML_DEBUG(block, desc->pc); // debug desc->pc
+ UML_MOV(block, mem(&m_core->m_pc), desc->pc); // mov [pc],desc->pc
+ //save_fast_iregs(block); // <save fastregs>
+ UML_DEBUG(block, desc->pc); // debug desc->pc
}
/* if we hit an unmapped address, fatal error */
if (desc->flags & OPFLAG_COMPILER_UNMAPPED)
{
- UML_MOV(block, mem(&m_core->m_pc), desc->pc); // mov [pc],desc->pc
- save_fast_iregs(block); // <save fastregs>
- UML_EXIT(block, EXECUTE_UNMAPPED_CODE); // exit EXECUTE_UNMAPPED_CODE
+ UML_MOV(block, mem(&m_core->m_pc), desc->pc); // mov [pc],desc->pc
+ save_fast_iregs(block); // <save fastregs>
+ UML_EXIT(block, EXECUTE_UNMAPPED_CODE); // exit EXECUTE_UNMAPPED_CODE
}
/* unless this is a virtual no-op, it's a regular instruction */
@@ -438,9 +438,9 @@ void dspp_device::generate_update_cycles(drcuml_block &block, compiler_state *co
/* account for cycles */
if (compiler->cycles > 0)
{
- UML_SUB(block, mem(&m_core->m_icount), mem(&m_core->m_icount), MAPVAR_CYCLES); // sub icount,icount,cycles
- UML_MAPVAR(block, MAPVAR_CYCLES, 0); // mapvar cycles,0
- UML_EXHc(block, COND_S, *m_out_of_cycles, param); // exh out_of_cycles,nextpc
+ UML_SUB(block, mem(&m_core->m_icount), mem(&m_core->m_icount), MAPVAR_CYCLES); // sub icount,icount,cycles
+ UML_MAPVAR(block, MAPVAR_CYCLES, 0); // mapvar cycles,0
+ UML_EXHc(block, COND_S, *m_out_of_cycles, param); // exh out_of_cycles,nextpc
}
compiler->cycles = 0;
}
@@ -458,8 +458,8 @@ void dspp_device::generate_opcode(drcuml_block &block, compiler_state *compiler,
code_label skip = compiler->labelnum++;
UML_TEST(block, mem(&m_core->m_dspx_control), DSPX_CONTROL_GWILLING);
UML_JMPc(block, COND_Z, compiler->abortlabel);
- //UML_TEST(block, mem(&m_core->m_flag_sleep), 1);
- //UML_JMPc(block, COND_NZ, compiler->abortlabel);
+ //UML_TEST(block, mem(&m_core->m_flag_sleep), 1);
+ //UML_JMPc(block, COND_NZ, compiler->abortlabel);
//UML_MOV(block, mem(&m_core->m_arg0), desc->physpc);
//UML_MOV(block, mem(&m_core->m_arg1), op);
@@ -522,7 +522,7 @@ void dspp_device::generate_super_special(drcuml_block &block, compiler_state *co
{
if (m_drcuml.get()->logging())
block.append_comment("BAC");
- UML_SHR(block, mem(&m_core->m_jmpdest), mem(&m_core->m_acc), 4); // m_core->m_pc = m_core->m_acc >> 4;
+ UML_SHR(block, mem(&m_core->m_jmpdest), mem(&m_core->m_acc), 4); // m_core->m_pc = m_core->m_acc >> 4;
generate_branch(block, compiler, desc);
break;
}
@@ -549,8 +549,8 @@ void dspp_device::generate_super_special(drcuml_block &block, compiler_state *co
// TODO: How does sleep work?
if (m_drcuml.get()->logging())
block.append_comment("SLEEP");
- UML_SUB(block, mem(&m_core->m_pc), mem(&m_core->m_pc), 1); // --m_core->m_pc;
- UML_MOV(block, mem(&m_core->m_flag_sleep), 1); // m_core->m_flag_sleep = 1;
+ UML_SUB(block, mem(&m_core->m_pc), mem(&m_core->m_pc), 1); // --m_core->m_pc;
+ UML_MOV(block, mem(&m_core->m_flag_sleep), 1); // m_core->m_flag_sleep = 1;
break;
}
@@ -609,7 +609,7 @@ void dspp_device::generate_special_opcode(drcuml_block &block, compiler_state *c
// Indirect
if (regdi & 0x0010)
{
- UML_CALLH(block, *m_dm_read16); // addr = read_data(addr);
+ UML_CALLH(block, *m_dm_read16); // addr = read_data(addr);
UML_MOV(block, I2, I0);
}
else
@@ -621,7 +621,7 @@ void dspp_device::generate_special_opcode(drcuml_block &block, compiler_state *c
generate_read_next_operand(block, compiler, desc);
UML_MOV(block, I0, I1);
UML_MOV(block, I1, I2);
- UML_CALLH(block, *m_dm_write16); // write_data(addr, read_next_operand());
+ UML_CALLH(block, *m_dm_write16); // write_data(addr, read_next_operand());
break;
}
case 5: // RBASE
@@ -639,7 +639,7 @@ void dspp_device::generate_special_opcode(drcuml_block &block, compiler_state *c
generate_read_next_operand(block, compiler, desc);
UML_MOV(block, I0, I1);
UML_MOV(block, I1, op & 0x3ff);
- UML_CALLH(block, *m_dm_write16); // write_data(op & 0x3ff, read_next_operand());
+ UML_CALLH(block, *m_dm_write16); // write_data(op & 0x3ff, read_next_operand());
break;
}
case 7: // MOVEI
@@ -648,12 +648,12 @@ void dspp_device::generate_special_opcode(drcuml_block &block, compiler_state *c
block.append_comment("MOVEI");
generate_parse_operands(block, compiler, desc, 1);
UML_MOV(block, I1, op & 0x3ff);
- UML_CALLH(block, *m_dm_read16); // uint32_t addr = read_data(op & 0x3ff);
+ UML_CALLH(block, *m_dm_read16); // uint32_t addr = read_data(op & 0x3ff);
UML_MOV(block, I2, I1);
generate_read_next_operand(block, compiler, desc);
UML_MOV(block, I0, I1);
UML_MOV(block, I1, I2);
- UML_CALLH(block, *m_dm_write16); // write_data(addr, read_next_operand());
+ UML_CALLH(block, *m_dm_write16); // write_data(addr, read_next_operand());
break;
}
@@ -669,23 +669,23 @@ void dspp_device::generate_branch(drcuml_block &block, compiler_state *compiler,
/* update the cycles and jump through the hash table to the target */
if (desc->targetpc != BRANCH_TARGET_DYNAMIC)
{
- generate_update_cycles(block, &compiler_temp, desc->targetpc); // <subtract cycles>
+ generate_update_cycles(block, &compiler_temp, desc->targetpc); // <subtract cycles>
if (desc->flags & OPFLAG_INTRABLOCK_BRANCH)
- UML_JMP(block, desc->targetpc | 0x80000000); // jmp desc->targetpc | 0x80000000
+ UML_JMP(block, desc->targetpc | 0x80000000); // jmp desc->targetpc | 0x80000000
else
- UML_HASHJMP(block, 0, desc->targetpc, *m_nocode); // hashjmp <mode>,desc->targetpc,nocode
+ UML_HASHJMP(block, 0, desc->targetpc, *m_nocode); // hashjmp <mode>,desc->targetpc,nocode
}
else
{
- generate_update_cycles(block, &compiler_temp, uml::mem(&m_core->m_jmpdest)); // <subtract cycles>
- UML_HASHJMP(block, 0, mem(&m_core->m_jmpdest), *m_nocode); // hashjmp <mode>,<rsreg>,nocode
+ generate_update_cycles(block, &compiler_temp, uml::mem(&m_core->m_jmpdest)); // <subtract cycles>
+ UML_HASHJMP(block, 0, mem(&m_core->m_jmpdest), *m_nocode); // hashjmp <mode>,<rsreg>,nocode
}
/* update the label */
compiler->labelnum = compiler_temp.labelnum;
/* reset the mapvar to the current cycles */
- UML_MAPVAR(block, MAPVAR_CYCLES, compiler->cycles); // mapvar CYCLES,compiler.cycles
+ UML_MAPVAR(block, MAPVAR_CYCLES, compiler->cycles); // mapvar CYCLES,compiler.cycles
}
void dspp_device::generate_branch_opcode(drcuml_block &block, compiler_state *compiler, const opcode_desc *desc)
@@ -718,10 +718,10 @@ void dspp_device::generate_branch_opcode(drcuml_block &block, compiler_state *co
UML_OR(block, I0, I0, mask0);
UML_OR(block, I1, I1, mask1);
- UML_AND(block, I0, I0, I1); // bool branch = (flag0 || mask0) && (flag1 || mask1);
+ UML_AND(block, I0, I0, I1); // bool branch = (flag0 || mask0) && (flag1 || mask1);
- if (mode == 2) // if (mode == 2)
- UML_SUB(block, I0, 1, I0); // branch = !branch;
+ if (mode == 2) // if (mode == 2)
+ UML_SUB(block, I0, 1, I0); // branch = !branch;
//UML_MOV(block, mem(&m_core->m_arg0), I0);
//UML_MOV(block, mem(&m_core->m_arg2), 1-mask0);
@@ -729,9 +729,9 @@ void dspp_device::generate_branch_opcode(drcuml_block &block, compiler_state *co
//UML_CALLC(block, cfunc_print_branches, this);
code_label skip = compiler->labelnum++;
- UML_TEST(block, I0, 1); // if (branch)
+ UML_TEST(block, I0, 1); // if (branch)
UML_JMPc(block, COND_Z, skip);
- UML_MOV(block, mem(&m_core->m_jmpdest), op & 0x3ff); // m_core->m_pc = op & 0x3ff;
+ UML_MOV(block, mem(&m_core->m_jmpdest), op & 0x3ff); // m_core->m_pc = op & 0x3ff;
generate_branch(block, compiler, desc);
UML_LABEL(block, skip);
}
@@ -745,19 +745,19 @@ void dspp_device::generate_complex_branch_opcode(drcuml_block &block, compiler_s
case 0: // BLT
if (m_drcuml.get()->logging())
block.append_comment("BLT");
- UML_XOR(block, I0, mem(&m_core->m_flag_neg), mem(&m_core->m_flag_over)); // branch = (n && !v) || (!n && v);
+ UML_XOR(block, I0, mem(&m_core->m_flag_neg), mem(&m_core->m_flag_over)); // branch = (n && !v) || (!n && v);
break;
case 1: // BLE
if (m_drcuml.get()->logging())
block.append_comment("BLE");
UML_XOR(block, I0, mem(&m_core->m_flag_neg), mem(&m_core->m_flag_over));
- UML_OR(block, I0, I0, mem(&m_core->m_flag_zero)); // branch = ((n && !v) || (!n && v)) || z;
+ UML_OR(block, I0, I0, mem(&m_core->m_flag_zero)); // branch = ((n && !v) || (!n && v)) || z;
break;
case 2: // BGE
if (m_drcuml.get()->logging())
block.append_comment("BGE");
UML_XOR(block, I0, mem(&m_core->m_flag_neg), mem(&m_core->m_flag_over));
- UML_SUB(block, I0, 1, I0); // branch = ((n && v) || (!n && !v));
+ UML_SUB(block, I0, 1, I0); // branch = ((n && v) || (!n && !v));
break;
case 3: // BGT
if (m_drcuml.get()->logging())
@@ -765,36 +765,36 @@ void dspp_device::generate_complex_branch_opcode(drcuml_block &block, compiler_s
UML_AND(block, I0, mem(&m_core->m_flag_neg), mem(&m_core->m_flag_over));
UML_SUB(block, I0, 1, I0);
UML_SUB(block, I1, 1, mem(&m_core->m_flag_zero));
- UML_AND(block, I0, I0, I1); // branch = ((n && v) || (!n && !v)) && !z;
+ UML_AND(block, I0, I0, I1); // branch = ((n && v) || (!n && !v)) && !z;
break;
case 4: // BHI
if (m_drcuml.get()->logging())
block.append_comment("BHI");
UML_SUB(block, I0, 1, mem(&m_core->m_flag_zero));
- UML_AND(block, I0, I0, mem(&m_core->m_flag_carry)); // branch = c && !z;
+ UML_AND(block, I0, I0, mem(&m_core->m_flag_carry)); // branch = c && !z;
break;
case 5: // BLS
if (m_drcuml.get()->logging())
block.append_comment("BLS");
UML_SUB(block, I0, 1, mem(&m_core->m_flag_carry));
- UML_OR(block, I0, I0, mem(&m_core->m_flag_zero)); // branch = !c || z;
+ UML_OR(block, I0, I0, mem(&m_core->m_flag_zero)); // branch = !c || z;
break;
case 6: // BXS
if (m_drcuml.get()->logging())
block.append_comment("BXS");
- UML_MOV(block, I0, mem(&m_core->m_flag_exact)); // branch = x;
+ UML_MOV(block, I0, mem(&m_core->m_flag_exact)); // branch = x;
break;
case 7: // BXC
if (m_drcuml.get()->logging())
block.append_comment("BXC");
- UML_SUB(block, I0, 1, mem(&m_core->m_flag_exact)); // branch = !x;
+ UML_SUB(block, I0, 1, mem(&m_core->m_flag_exact)); // branch = !x;
break;
}
code_label skip = compiler->labelnum++;
- UML_TEST(block, I0, 1); // if (branch)
+ UML_TEST(block, I0, 1); // if (branch)
UML_JMPc(block, COND_Z, skip);
- UML_MOV(block, mem(&m_core->m_jmpdest), op & 0x3ff); // m_core->m_pc = op & 0x3ff;
+ UML_MOV(block, mem(&m_core->m_jmpdest), op & 0x3ff); // m_core->m_pc = op & 0x3ff;
generate_branch(block, compiler, desc);
UML_LABEL(block, skip);
}
@@ -941,8 +941,8 @@ void dspp_device::generate_read_next_operand(drcuml_block &block, compiler_state
UML_LOAD(block, I0, (void *)&m_core->m_operands[0].value, mem(&m_core->m_opidx), SIZE_DWORD, SCALE_x8);
//if (op == 0x46a0)
//{
- // UML_MOV(block, mem(&m_core->m_arg0), I0);
- // UML_CALLC(block, cfunc_print_value, this);
+ // UML_MOV(block, mem(&m_core->m_arg0), I0);
+ // UML_CALLC(block, cfunc_print_value, this);
//}
UML_TEST(block, I0, 0x80000000U);
@@ -950,13 +950,13 @@ void dspp_device::generate_read_next_operand(drcuml_block &block, compiler_state
UML_LOAD(block, I1, (void *)&m_core->m_operands[0].addr, mem(&m_core->m_opidx), SIZE_DWORD, SCALE_x8);
//if (op == 0x46a0)
//{
- // UML_MOV(block, mem(&m_core->m_arg1), I1);
+ // UML_MOV(block, mem(&m_core->m_arg1), I1);
//}
UML_CALLH(block, *m_dm_read16);
//if (op == 0x46a0)
//{
- // UML_MOV(block, mem(&m_core->m_arg0), I0);
- // UML_CALLC(block, cfunc_print_addr, this);
+ // UML_MOV(block, mem(&m_core->m_arg0), I0);
+ // UML_CALLC(block, cfunc_print_addr, this);
//}
UML_LABEL(block, no_load);
@@ -1071,16 +1071,16 @@ void dspp_device::generate_arithmetic_opcode(drcuml_block &block, compiler_state
if (m_drcuml.get()->logging())
block.append_comment("_TRA");
UML_MOV(block, I0, I2); // alu_res = alu_a;
- UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
- UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
+ UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 1: // _NEG
if (m_drcuml.get()->logging())
block.append_comment("_NEG");
UML_SUB(block, I0, 0, I3); // alu_res = -alu_b;
- UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
- UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
+ UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 2: // _+
@@ -1092,175 +1092,175 @@ void dspp_device::generate_arithmetic_opcode(drcuml_block &block, compiler_state
UML_XOR(block, I3, I2, I3);
UML_TEST(block, I3, 0x80000);
- UML_JMPc(block, COND_NZ, skip_over); // if ((alu_a & 0x80000) == (alu_b & 0x80000) &&
+ UML_JMPc(block, COND_NZ, skip_over); // if ((alu_a & 0x80000) == (alu_b & 0x80000) &&
UML_XOR(block, I3, I2, I0);
- UML_TEST(block, I3, 0x80000); // (alu_a & 0x80000) != (alu_res & 0x80000))
- UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_over), 1); // m_core->m_flag_over = 1;
+ UML_TEST(block, I3, 0x80000); // (alu_a & 0x80000) != (alu_res & 0x80000))
+ UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_over), 1); // m_core->m_flag_over = 1;
UML_LABEL(block, skip_over);
- UML_TEST(block, I0, 0x00100000); // if (alu_res & 0x00100000)
- UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_carry), 1); // m_core->m_flag_carry = 1;
+ UML_TEST(block, I0, 0x00100000); // if (alu_res & 0x00100000)
+ UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_carry), 1); // m_core->m_flag_carry = 1;
// else
- UML_MOVc(block, COND_Z, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_MOVc(block, COND_Z, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 3: // _+C
if (m_drcuml.get()->logging())
block.append_comment("_+C");
UML_SHL(block, I3, mem(&m_core->m_flag_carry), 4);
- UML_ADD(block, I0, I2, I3); // alu_res = alu_a + (m_core->m_flag_carry << 4);
+ UML_ADD(block, I0, I2, I3); // alu_res = alu_a + (m_core->m_flag_carry << 4);
- UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
+ UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
- UML_TEST(block, I0, 0x00100000); // if (alu_res & 0x00100000)
- UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_carry), 1); // m_core->m_flag_carry = 1;
+ UML_TEST(block, I0, 0x00100000); // if (alu_res & 0x00100000)
+ UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_carry), 1); // m_core->m_flag_carry = 1;
// else
- UML_MOVc(block, COND_Z, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_MOVc(block, COND_Z, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 4: // _-
if (m_drcuml.get()->logging())
block.append_comment("_-");
- UML_SUB(block, I0, I2, I3); // alu_res = alu_a - alu_b;
+ UML_SUB(block, I0, I2, I3); // alu_res = alu_a - alu_b;
UML_MOV(block, mem(&m_core->m_flag_over), 0);
UML_XOR(block, I3, I3, 0xffffffffU);
UML_XOR(block, I3, I2, I3);
UML_TEST(block, I3, 0x80000);
- UML_JMPc(block, COND_NZ, skip_over); // if ((alu_a & 0x80000) == (~alu_b & 0x80000) &&
+ UML_JMPc(block, COND_NZ, skip_over); // if ((alu_a & 0x80000) == (~alu_b & 0x80000) &&
UML_XOR(block, I3, I2, I0);
- UML_TEST(block, I3, 0x80000); // (alu_a & 0x80000) != (alu_res & 0x80000))
- UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_over), 1); // m_core->m_flag_over = 1;
+ UML_TEST(block, I3, 0x80000); // (alu_a & 0x80000) != (alu_res & 0x80000))
+ UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_over), 1); // m_core->m_flag_over = 1;
UML_LABEL(block, skip_over);
- UML_TEST(block, I0, 0x00100000); // if (alu_res & 0x00100000)
- UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_carry), 1); // m_core->m_flag_carry = 1;
+ UML_TEST(block, I0, 0x00100000); // if (alu_res & 0x00100000)
+ UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_carry), 1); // m_core->m_flag_carry = 1;
// else
- UML_MOVc(block, COND_Z, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_MOVc(block, COND_Z, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 5: // _-B
if (m_drcuml.get()->logging())
block.append_comment("_-B");
UML_SHL(block, I3, mem(&m_core->m_flag_carry), 4);
- UML_SUB(block, I0, I2, I3); // alu_res = alu_a - (m_core->m_flag_carry << 4);
+ UML_SUB(block, I0, I2, I3); // alu_res = alu_a - (m_core->m_flag_carry << 4);
- UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
+ UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
- UML_TEST(block, I0, 0x00100000); // if (alu_res & 0x00100000)
- UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_carry), 1); // m_core->m_flag_carry = 1;
+ UML_TEST(block, I0, 0x00100000); // if (alu_res & 0x00100000)
+ UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_carry), 1); // m_core->m_flag_carry = 1;
// else
- UML_MOVc(block, COND_Z, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_MOVc(block, COND_Z, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 6: // _++
if (m_drcuml.get()->logging())
block.append_comment("_++");
- UML_ADD(block, I0, I2, 1); // alu_res = alu_a + 1;
+ UML_ADD(block, I0, I2, 1); // alu_res = alu_a + 1;
UML_XOR(block, I3, I2, 0x80000);
UML_AND(block, I3, I3, I0);
UML_TEST(block, I3, 0x80000);
UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_over), 1);
- UML_MOVc(block, COND_Z, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = !(alu_a & 0x80000) && (alu_res & 0x80000);
+ UML_MOVc(block, COND_Z, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = !(alu_a & 0x80000) && (alu_res & 0x80000);
- UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 7: // _--
if (m_drcuml.get()->logging())
block.append_comment("_--");
- UML_SUB(block, I0, I2, 1); // alu_res = alu_a - 1;
+ UML_SUB(block, I0, I2, 1); // alu_res = alu_a - 1;
UML_XOR(block, I3, I0, 0x80000);
UML_AND(block, I3, I3, I2);
UML_TEST(block, I3, 0x80000);
UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_over), 1);
- UML_MOVc(block, COND_Z, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = (alu_a & 0x80000) && !(alu_res & 0x80000);
+ UML_MOVc(block, COND_Z, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = (alu_a & 0x80000) && !(alu_res & 0x80000);
- UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 8: // _TRL
if (m_drcuml.get()->logging())
block.append_comment("_TRL");
- UML_MOV(block, I0, I2); // alu_res = alu_a;
- UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
- UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_MOV(block, I0, I2); // alu_res = alu_a;
+ UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
+ UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 9: // _NOT
if (m_drcuml.get()->logging())
block.append_comment("_NOT");
- UML_XOR(block, I0, I2, 0xffffffff); // alu_res = ~alu_a;
- UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
- UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_XOR(block, I0, I2, 0xffffffff); // alu_res = ~alu_a;
+ UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
+ UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 10: // _AND
if (m_drcuml.get()->logging())
block.append_comment("_AND");
- UML_AND(block, I0, I2, I3); // alu_res = alu_a & alu_b;
- UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
- UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_AND(block, I0, I2, I3); // alu_res = alu_a & alu_b;
+ UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
+ UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 11: // _NAND
if (m_drcuml.get()->logging())
block.append_comment("_NAND");
UML_AND(block, I0, I2, I3);
- UML_XOR(block, I0, I0, 0xffffffff); // alu_res = ~(alu_a & alu_b);
- UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
- UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_XOR(block, I0, I0, 0xffffffff); // alu_res = ~(alu_a & alu_b);
+ UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
+ UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 12: // _OR
if (m_drcuml.get()->logging())
block.append_comment("_OR");
- UML_OR(block, I0, I2, I3); // alu_res = alu_a | alu_b;
- UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
- UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_OR(block, I0, I2, I3); // alu_res = alu_a | alu_b;
+ UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
+ UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 13: // _NOR
if (m_drcuml.get()->logging())
block.append_comment("_NOR");
UML_OR(block, I0, I2, I3);
- UML_XOR(block, I0, I0, 0xffffffff); // alu_res = ~(alu_a | alu_b);
- UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
- UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_XOR(block, I0, I0, 0xffffffff); // alu_res = ~(alu_a | alu_b);
+ UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
+ UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 14: // _XOR
if (m_drcuml.get()->logging())
block.append_comment("_XOR");
- UML_XOR(block, I0, I2, I3); // alu_res = alu_a ^ alu_b;
- UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
- UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_XOR(block, I0, I2, I3); // alu_res = alu_a ^ alu_b;
+ UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
+ UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
case 15: // _XNOR
if (m_drcuml.get()->logging())
block.append_comment("_XNOR");
UML_XOR(block, I0, I2, I3);
- UML_XOR(block, I0, I0, 0xffffffff); // alu_res = ~(alu_a ^ alu_b);
- UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
- UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
+ UML_XOR(block, I0, I0, 0xffffffff); // alu_res = ~(alu_a ^ alu_b);
+ UML_MOV(block, mem(&m_core->m_flag_over), 0); // m_core->m_flag_over = 0;
+ UML_MOV(block, mem(&m_core->m_flag_carry), 0); // m_core->m_flag_carry = 0;
break;
}
UML_TEST(block, I0, 0x00080000);
UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_neg), 1);
- UML_MOVc(block, COND_Z, mem(&m_core->m_flag_neg), 0); // m_core->m_flag_neg = (alu_res & 0x00080000) != 0;
+ UML_MOVc(block, COND_Z, mem(&m_core->m_flag_neg), 0); // m_core->m_flag_neg = (alu_res & 0x00080000) != 0;
UML_TEST(block, I0, 0x000ffff0);
UML_MOVc(block, COND_Z, mem(&m_core->m_flag_zero), 1);
- UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_zero), 0); // m_core->m_flag_zero = (alu_res & 0x000ffff0) == 0;
+ UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_zero), 0); // m_core->m_flag_zero = (alu_res & 0x000ffff0) == 0;
UML_TEST(block, I0, 0x0000000f);
UML_MOVc(block, COND_Z, mem(&m_core->m_flag_exact), 1);
- UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_exact), 0); // m_core->m_flag_exact = (alu_res & 0x0000000f) == 0;
+ UML_MOVc(block, COND_NZ, mem(&m_core->m_flag_exact), 0); // m_core->m_flag_exact = (alu_res & 0x0000000f) == 0;
// ALU_RES = I3
UML_MOV(block, I3, I0);
@@ -1269,9 +1269,9 @@ void dspp_device::generate_arithmetic_opcode(drcuml_block &block, compiler_state
static const int32_t shifts[8] = { 0, 1, 2, 3, 4, 5, 8, 16 };
if (barrel_code == 8)
- generate_read_next_operand(block, compiler, desc); // I0 = barrel_code;
+ generate_read_next_operand(block, compiler, desc); // I0 = barrel_code;
else
- UML_MOV(block, I0, barrel_code); // I0 = barrel_code;
+ UML_MOV(block, I0, barrel_code); // I0 = barrel_code;
code_label left_shift = compiler->labelnum++;
code_label done_shift = compiler->labelnum++;
@@ -1279,57 +1279,57 @@ void dspp_device::generate_arithmetic_opcode(drcuml_block &block, compiler_state
code_label no_clip = compiler->labelnum++;
code_label no_writeback = compiler->labelnum++;
code_label done = compiler->labelnum++;
- UML_TEST(block, I0, 8); // if (barrel_code & 8)
- UML_JMPc(block, COND_Z, left_shift); // {
+ UML_TEST(block, I0, 8); // if (barrel_code & 8)
+ UML_JMPc(block, COND_Z, left_shift); // {
UML_XOR(block, I0, I0, 0xffffffffU);
UML_ADD(block, I0, I0, 1);
UML_AND(block, I0, I0, 7);
- UML_LOAD(block, I0, (void *)shifts, I0, SIZE_DWORD, SCALE_x8); // uint32_t shift = shifts[(~barrel_code + 1) & 7];
- if (alu_op < 8) // if (alu_op < 8)
- { // {
+ UML_LOAD(block, I0, (void *)shifts, I0, SIZE_DWORD, SCALE_x8); // uint32_t shift = shifts[(~barrel_code + 1) & 7];
+ if (alu_op < 8) // if (alu_op < 8)
+ { // {
UML_SHL(block, I3, I3, 12);
- UML_SAR(block, I3, I3, 12); // // Arithmetic
- UML_SAR(block, mem(&m_core->m_acc), I3, I0); // m_core->m_acc = sign_extend20(alu_res) >> shift;
- } // }
- else // else
- { // {
- UML_AND(block, I3, I3, 0x000fffff); // // Logical
- UML_SHR(block, mem(&m_core->m_acc), I3, I0); // m_core->m_acc = (alu_res & 0xfffff) >> shift;
- } // }
- UML_JMP(block, done_shift); // }
- UML_LABEL(block, left_shift); // else
+ UML_SAR(block, I3, I3, 12); // // Arithmetic
+ UML_SAR(block, mem(&m_core->m_acc), I3, I0); // m_core->m_acc = sign_extend20(alu_res) >> shift;
+ } // }
+ else // else
+ { // {
+ UML_AND(block, I3, I3, 0x000fffff); // // Logical
+ UML_SHR(block, mem(&m_core->m_acc), I3, I0); // m_core->m_acc = (alu_res & 0xfffff) >> shift;
+ } // }
+ UML_JMP(block, done_shift); // }
+ UML_LABEL(block, left_shift); // else
// {
- UML_LOAD(block, I0, (void *)shifts, I0, SIZE_DWORD, SCALE_x8); // uint32_t shift = shifts[barrel_code];
- UML_CMP(block, I0, 16); // if (shift != 16)
- UML_JMPc(block, COND_E, no_shift); // {
+ UML_LOAD(block, I0, (void *)shifts, I0, SIZE_DWORD, SCALE_x8); // uint32_t shift = shifts[barrel_code];
+ UML_CMP(block, I0, 16); // if (shift != 16)
+ UML_JMPc(block, COND_E, no_shift); // {
UML_SHL(block, I3, I3, 12);
UML_SAR(block, I3, I3, 12);
- UML_SHL(block, mem(&m_core->m_acc), I3, I0); // m_core->m_acc = sign_extend20(alu_res) << shift;
- UML_JMP(block, done_shift); // }
+ UML_SHL(block, mem(&m_core->m_acc), I3, I0); // m_core->m_acc = sign_extend20(alu_res) << shift;
+ UML_JMP(block, done_shift); // }
// else
- UML_LABEL(block, no_shift); // {
- UML_TEST(block, mem(&m_core->m_flag_over), 1); // // Clip and saturate
- UML_JMPc(block, COND_Z, no_clip); // if (m_core->m_flag_over)
+ UML_LABEL(block, no_shift); // {
+ UML_TEST(block, mem(&m_core->m_flag_over), 1); // // Clip and saturate
+ UML_JMPc(block, COND_Z, no_clip); // if (m_core->m_flag_over)
UML_TEST(block, mem(&m_core->m_flag_neg), 1);
- UML_MOVc(block, COND_NZ, mem(&m_core->m_acc), 0x7ffff); // m_core->m_acc = m_core->m_flag_neg ? 0x7ffff : 0xfff80000;
+ UML_MOVc(block, COND_NZ, mem(&m_core->m_acc), 0x7ffff); // m_core->m_acc = m_core->m_flag_neg ? 0x7ffff : 0xfff80000;
UML_MOVc(block, COND_Z, mem(&m_core->m_acc), 0xfff80000);
- UML_JMP(block, done_shift); // else
+ UML_JMP(block, done_shift); // else
UML_LABEL(block, no_clip);
- UML_SHL(block, I3, I3, 12); // sign_extend20(alu_res);
- UML_SAR(block, mem(&m_core->m_acc), I3, 12); // }
- UML_LABEL(block, done_shift); // }
+ UML_SHL(block, I3, I3, 12); // sign_extend20(alu_res);
+ UML_SAR(block, mem(&m_core->m_acc), I3, 12); // }
+ UML_LABEL(block, done_shift); // }
- UML_CMP(block, mem(&m_core->m_writeback), 0); // if (m_core->m_writeback >= 0)
- UML_JMPc(block, COND_L, no_writeback); // {
+ UML_CMP(block, mem(&m_core->m_writeback), 0); // if (m_core->m_writeback >= 0)
+ UML_JMPc(block, COND_L, no_writeback); // {
UML_SHR(block, I0, mem(&m_core->m_acc), 4);
UML_MOV(block, I1, mem(&m_core->m_writeback));
- UML_CALLH(block, *m_dm_write16); // write_data(m_core->m_writeback, m_core->m_acc >> 4);
- UML_MOV(block, mem(&m_core->m_writeback), 0xffffffffU); // m_core->m_writeback = -1;
- UML_JMP(block, done); // }
+ UML_CALLH(block, *m_dm_write16); // write_data(m_core->m_writeback, m_core->m_acc >> 4);
+ UML_MOV(block, mem(&m_core->m_writeback), 0xffffffffU); // m_core->m_writeback = -1;
+ UML_JMP(block, done); // }
UML_LABEL(block, no_writeback);
- UML_CMP(block, mem(&m_core->m_opidx), numops); // else if (m_core->m_opidx < numops)
- UML_JMPc(block, COND_GE, done); // {
- generate_write_next_operand(block, compiler); // write_next_operand(m_core->m_acc >> 4);
- UML_LABEL(block, done); // }
+ UML_CMP(block, mem(&m_core->m_opidx), numops); // else if (m_core->m_opidx < numops)
+ UML_JMPc(block, COND_GE, done); // {
+ generate_write_next_operand(block, compiler); // write_next_operand(m_core->m_acc >> 4);
+ UML_LABEL(block, done); // }
}
diff --git a/src/devices/cpu/e132xs/e132xs.h b/src/devices/cpu/e132xs/e132xs.h
index 335aeab8898..ff5e9cb9bdb 100644
--- a/src/devices/cpu/e132xs/e132xs.h
+++ b/src/devices/cpu/e132xs/e132xs.h
@@ -439,6 +439,8 @@ private:
uint32_t m_drcoptions;
uint8_t m_cache_dirty;
+ uml::parameter m_regmap[16];
+
uml::code_handle *m_entry;
uml::code_handle *m_nocode;
uml::code_handle *m_interrupt_checks;
diff --git a/src/devices/cpu/f8/f8.cpp b/src/devices/cpu/f8/f8.cpp
index ce09d9ca835..e0f86369a06 100644
--- a/src/devices/cpu/f8/f8.cpp
+++ b/src/devices/cpu/f8/f8.cpp
@@ -7,11 +7,6 @@
* This work is based on Frank Palazzolo's F8 emulation in a standalone
* Fairchild Channel F emulator and the 'Fairchild F3850 CPU' data sheets.
*
- * TODO:
- * - ROMC signals are supposed to be handled externally
- *
- *****************************************************************************
- *
* The 3850 CPU itself does not include the address bus, pointer registers
* or an interrupt controller. Those functions are provided by at least one
* of the following devices:
@@ -19,9 +14,7 @@
* - 3851 Program Storage Unit (PSU)
* - 3852 Dynamic Memory Interface (DMI)
* - 3853 Static Memory Interface (SMI)
- * - 3854 Direct Memory Access Controller (DMAC)
* - 3856 Program Storage Unit (PSU)
- * - 38T56 Program Storage Unit (PSU)
* - 3861 Peripheral Input/Output (PIO)
* - 3871 Peripheral Input/Output (PIO)
*
@@ -35,12 +28,6 @@
* devices responding to the same DC0 address and attempting to place their
* bytes on the data bus simultaneously!
*
- * Combined packages:
- * - 3859 = 3850 + 3851
- * - 3870 = 3850 + 38T56
- * - 3872 = 3870 + extra 2KB ROM
- * - 3873 = 3870 + extra 64 bytes executable RAM
- *
*****************************************************************************/
#include "emu.h"
@@ -50,11 +37,11 @@
/* status flags */
-static constexpr u8 S = 0x01; // sign
-static constexpr u8 C = 0x02; // carry
-static constexpr u8 Z = 0x04; // zero
-static constexpr u8 O = 0x08; // overflow
-static constexpr u8 I = 0x10; // interrupt control bit (ICB)
+static constexpr u8 S = 0x01;
+static constexpr u8 C = 0x02;
+static constexpr u8 Z = 0x04;
+static constexpr u8 O = 0x08;
+static constexpr u8 I = 0x10;
/* cycle (short/long) */
static constexpr int cS = 4;
@@ -64,11 +51,21 @@ static constexpr int cL = 6;
DEFINE_DEVICE_TYPE(F8, f8_cpu_device, "f8", "Fairchild F8")
-f8_cpu_device::f8_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- cpu_device(mconfig, F8, tag, owner, clock),
- m_program_config("program", ENDIANNESS_BIG, 8, 16, 0),
- m_io_config("io", ENDIANNESS_BIG, 8, 8, 0)
-{ }
+f8_cpu_device::f8_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : cpu_device(mconfig, F8, tag, owner, clock)
+ , m_program_config("program", ENDIANNESS_BIG, 8, 16, 0)
+ , m_io_config("io", ENDIANNESS_BIG, 8, 8, 0)
+ , m_pc0(0)
+ , m_pc1(0)
+ , m_dc0(0)
+ , m_dc1(0)
+ , m_a(0)
+ , m_w(0)
+ , m_is(0)
+ , m_debug_pc(0)
+{
+ memset(m_r, 0x00, sizeof(m_r));
+}
device_memory_interface::space_config_vector f8_cpu_device::memory_space_config() const
{
@@ -104,22 +101,6 @@ void f8_cpu_device::device_start()
m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>();
m_iospace = &space(AS_IO);
- // zerofill
- m_debug_pc = 0;
- m_pc0 = 0;
- m_pc1 = 0;
- m_dc0 = 0;
- m_dc1 = 0;
- m_a = 0;
- m_w = 0;
- m_is = 0;
- m_dbus = 0;
- m_io = 0;
- m_irq_vector = 0;
- memset(m_r, 0, sizeof(m_r));
- m_irq_request = 0;
-
- // register for savestates
save_item(NAME(m_debug_pc));
save_item(NAME(m_pc0));
save_item(NAME(m_pc1));
@@ -134,7 +115,6 @@ void f8_cpu_device::device_start()
save_item(NAME(m_irq_request));
save_item(NAME(m_r));
- // register for debugger
state_add( F8_PC0, "PC0", m_pc0).formatstr("%04X");
state_add( F8_PC1, "PC1", m_pc1).formatstr("%04X");
state_add( F8_DC0, "DC0", m_dc0).formatstr("%04X");
@@ -216,18 +196,55 @@ void f8_cpu_device::device_start()
void f8_cpu_device::device_reset()
{
- // save PC0 to PC1 and reset PC0, and clear ICB
- ROMC_08();
- m_w &= ~I;
+ m_debug_pc = 0;
+ m_pc0 = 0;
+ m_pc1 = 0;
+ m_dc0 = 0;
+ m_dc1 = 0;
+ m_a = 0;
+ m_w = 0;
+ m_is = 0;
+ m_dbus = 0;
+ m_io = 0;
+ m_irq_vector = 0;
+ memset(m_r, 0, sizeof(m_r));
+ m_irq_request = 0;
+
+ m_w&=~I;
- // fetch the first opcode
+ /* save PC0 to PC1 and reset PC0 */
+ ROMC_08();
+ /* fetch the first opcode */
ROMC_00(cS);
+
+ /* initialize the timer shift register
+ * this is an 8 bit polynomial counter which can be loaded parallel
+ * with 0xff the outputs never change and thus the timer is disabled.
+ * with 0xfe the shifter starts cycling through 255 states until it
+ * reaches 0xfe again (and then issues an interrupt).
+ * the counter output values are not sequential, but go like this:
+ * 0xfe, 0xfd, 0xfb, 0xf7, 0xee, 0xdc ... etc. :-)
+ * We have to build a lookup table to tell how many cycles a write
+
+ */
+ u8 data = 0xfe; /* initial value */
+ for (int i = 0; i < 256; i++)
+ {
+ timer_shifter[i] = data;
+ if ( (((data >> 3) ^ (data >> 4)) ^ ((data >> 5) ^ (data >> 7))) & 1 )
+ {
+ data <<= 1;
+ }
+ else
+ {
+ data = (data << 1) | 1;
+ }
+ }
}
void f8_cpu_device::execute_set_input( int inptnum, int state )
{
- assert (inptnum == F8_INPUT_LINE_INT_REQ);
m_irq_request = state;
}
@@ -499,7 +516,7 @@ void f8_cpu_device::ROMC_10()
/*
* Inhibit any modification to the interrupt priority logic.
*/
- // TODO
+ m_w |= 0x20; /* ???? */
m_icount -= cL;
}
@@ -985,7 +1002,7 @@ void f8_cpu_device::f8_pop()
void f8_cpu_device::f8_lr_w_j()
{
ROMC_1C(cS);
- m_w = m_r[9] & 0x1f;
+ m_w = m_r[9];
}
/***************************************************
@@ -1314,9 +1331,9 @@ void f8_cpu_device::f8_bt(int e)
{
ROMC_1C(cS);
if (m_w & e)
- ROMC_01(); // take the relative branch
+ ROMC_01(); /* take the relative branch */
else
- ROMC_03(cS); // just read the argument on the data bus
+ ROMC_03(cS); /* just read the argument on the data bus */
}
/***************************************************
@@ -1395,7 +1412,7 @@ void f8_cpu_device::f8_cm()
void f8_cpu_device::f8_adc()
{
m_dbus = m_a;
- ROMC_0A(); // add data bus value to DC0
+ ROMC_0A(); /* add data bus value to DC0 */
}
/***************************************************
@@ -1405,9 +1422,9 @@ void f8_cpu_device::f8_adc()
void f8_cpu_device::f8_br7()
{
if ((m_is & 7) == 7)
- ROMC_03(cS); // just read the argument on the data bus
+ ROMC_03(cS); /* just read the argument on the data bus */
else
- ROMC_01(); // take the relative branch
+ ROMC_01(); /* take the relative branch */
}
/***************************************************
@@ -1418,9 +1435,9 @@ void f8_cpu_device::f8_bf(int t)
{
ROMC_1C(cS);
if (m_w & t)
- ROMC_03(cS); // just read the argument on the data bus
+ ROMC_03(cS); /* just read the argument on the data bus */
else
- ROMC_01(); // take the relative branch
+ ROMC_01(); /* take the relative branch */
}
/***************************************************
@@ -1652,10 +1669,7 @@ void f8_cpu_device::f8_ns_isar_d()
}
-/***************************************************
- * Execute cycles
- ***************************************************/
-
+/* Execute cycles - returns number of cycles actually run */
void f8_cpu_device::execute_run()
{
do
@@ -1665,307 +1679,305 @@ void f8_cpu_device::execute_run()
m_debug_pc = (m_pc0 - 1) & 0xffff;
debugger_instruction_hook(m_debug_pc);
- switch (op)
+ switch( op )
{
- case 0x00: f8_lr_a_ku(); break;
- case 0x01: f8_lr_a_kl(); break;
- case 0x02: f8_lr_a_qu(); break;
- case 0x03: f8_lr_a_ql(); break;
- case 0x04: f8_lr_ku_a(); break;
- case 0x05: f8_lr_kl_a(); break;
- case 0x06: f8_lr_qu_a(); break;
- case 0x07: f8_lr_ql_a(); break;
- case 0x08: f8_lr_k_p(); break;
- case 0x09: f8_lr_p_k(); break;
- case 0x0a: f8_lr_a_is(); break;
- case 0x0b: f8_lr_is_a(); break;
- case 0x0c: f8_pk(); break;
- case 0x0d: f8_lr_p0_q(); break;
- case 0x0e: f8_lr_q_dc(); break;
- case 0x0f: f8_lr_dc_q(); break;
-
- case 0x10: f8_lr_dc_h(); break;
- case 0x11: f8_lr_h_dc(); break;
- case 0x12: f8_sr_1(); break;
- case 0x13: f8_sl_1(); break;
- case 0x14: f8_sr_4(); break;
- case 0x15: f8_sl_4(); break;
- case 0x16: f8_lm(); break;
- case 0x17: f8_st(); break;
- case 0x18: f8_com(); break;
- case 0x19: f8_lnk(); break;
- case 0x1a: f8_di(); break;
- case 0x1b: f8_ei(); break;
- case 0x1c: f8_pop(); break;
- case 0x1d: f8_lr_w_j(); break;
- case 0x1e: f8_lr_j_w(); break;
- case 0x1f: f8_inc(); break;
-
- case 0x20: f8_li(); break;
- case 0x21: f8_ni(); break;
- case 0x22: f8_oi(); break;
- case 0x23: f8_xi(); break;
- case 0x24: f8_ai(); break;
- case 0x25: f8_ci(); break;
- case 0x26: f8_in(); break;
- case 0x27: f8_out(); break;
- case 0x28: f8_pi(); break;
- case 0x29: f8_jmp(); break;
- case 0x2a: f8_dci(); break;
- case 0x2b: f8_nop(); break;
- case 0x2c: f8_xdc(); break;
- case 0x2d: illegal(); break;
- case 0x2e: illegal(); break;
- case 0x2f: illegal(); break;
-
- case 0x30: f8_ds_r(0); break;
- case 0x31: f8_ds_r(1); break;
- case 0x32: f8_ds_r(2); break;
- case 0x33: f8_ds_r(3); break;
- case 0x34: f8_ds_r(4); break;
- case 0x35: f8_ds_r(5); break;
- case 0x36: f8_ds_r(6); break;
- case 0x37: f8_ds_r(7); break;
- case 0x38: f8_ds_r(8); break;
- case 0x39: f8_ds_r(9); break;
- case 0x3a: f8_ds_r(10); break;
- case 0x3b: f8_ds_r(11); break;
- case 0x3c: f8_ds_isar(); break;
- case 0x3d: f8_ds_isar_i(); break;
- case 0x3e: f8_ds_isar_d(); break;
- case 0x3f: illegal(); break;
-
- case 0x40: f8_lr_a_r(0); break;
- case 0x41: f8_lr_a_r(1); break;
- case 0x42: f8_lr_a_r(2); break;
- case 0x43: f8_lr_a_r(3); break;
- case 0x44: f8_lr_a_r(4); break;
- case 0x45: f8_lr_a_r(5); break;
- case 0x46: f8_lr_a_r(6); break;
- case 0x47: f8_lr_a_r(7); break;
- case 0x48: f8_lr_a_r(8); break;
- case 0x49: f8_lr_a_r(9); break;
- case 0x4a: f8_lr_a_r(10); break;
- case 0x4b: f8_lr_a_r(11); break;
- case 0x4c: f8_lr_a_isar(); break;
- case 0x4d: f8_lr_a_isar_i(); break;
- case 0x4e: f8_lr_a_isar_d(); break;
- case 0x4f: illegal(); break;
-
- case 0x50: f8_lr_r_a(0); break;
- case 0x51: f8_lr_r_a(1); break;
- case 0x52: f8_lr_r_a(2); break;
- case 0x53: f8_lr_r_a(3); break;
- case 0x54: f8_lr_r_a(4); break;
- case 0x55: f8_lr_r_a(5); break;
- case 0x56: f8_lr_r_a(6); break;
- case 0x57: f8_lr_r_a(7); break;
- case 0x58: f8_lr_r_a(8); break;
- case 0x59: f8_lr_r_a(9); break;
- case 0x5a: f8_lr_r_a(10); break;
- case 0x5b: f8_lr_r_a(11); break;
- case 0x5c: f8_lr_isar_a(); break;
- case 0x5d: f8_lr_isar_i_a(); break;
- case 0x5e: f8_lr_isar_d_a(); break;
- case 0x5f: illegal(); break;
-
- case 0x60: f8_lisu(0x00); break;
- case 0x61: f8_lisu(0x08); break;
- case 0x62: f8_lisu(0x10); break;
- case 0x63: f8_lisu(0x18); break;
- case 0x64: f8_lisu(0x20); break;
- case 0x65: f8_lisu(0x28); break;
- case 0x66: f8_lisu(0x30); break;
- case 0x67: f8_lisu(0x38); break;
- case 0x68: f8_lisl(0x00); break;
- case 0x69: f8_lisl(0x01); break;
- case 0x6a: f8_lisl(0x02); break;
- case 0x6b: f8_lisl(0x03); break;
- case 0x6c: f8_lisl(0x04); break;
- case 0x6d: f8_lisl(0x05); break;
- case 0x6e: f8_lisl(0x06); break;
- case 0x6f: f8_lisl(0x07); break;
-
- case 0x70: f8_lis(0x0); break;
- case 0x71: f8_lis(0x1); break;
- case 0x72: f8_lis(0x2); break;
- case 0x73: f8_lis(0x3); break;
- case 0x74: f8_lis(0x4); break;
- case 0x75: f8_lis(0x5); break;
- case 0x76: f8_lis(0x6); break;
- case 0x77: f8_lis(0x7); break;
- case 0x78: f8_lis(0x8); break;
- case 0x79: f8_lis(0x9); break;
- case 0x7a: f8_lis(0xa); break;
- case 0x7b: f8_lis(0xb); break;
- case 0x7c: f8_lis(0xc); break;
- case 0x7d: f8_lis(0xd); break;
- case 0x7e: f8_lis(0xe); break;
- case 0x7f: f8_lis(0xf); break;
-
- case 0x80: f8_bt(0); break;
- case 0x81: f8_bt(1); break;
- case 0x82: f8_bt(2); break;
- case 0x83: f8_bt(3); break;
- case 0x84: f8_bt(4); break;
- case 0x85: f8_bt(5); break;
- case 0x86: f8_bt(6); break;
- case 0x87: f8_bt(7); break;
- case 0x88: f8_am(); break;
- case 0x89: f8_amd(); break;
- case 0x8a: f8_nm(); break;
- case 0x8b: f8_om(); break;
- case 0x8c: f8_xm(); break;
- case 0x8d: f8_cm(); break;
- case 0x8e: f8_adc(); break;
- case 0x8f: f8_br7(); break;
-
- case 0x90: f8_bf(0x0); break;
- case 0x91: f8_bf(0x1); break;
- case 0x92: f8_bf(0x2); break;
- case 0x93: f8_bf(0x3); break;
- case 0x94: f8_bf(0x4); break;
- case 0x95: f8_bf(0x5); break;
- case 0x96: f8_bf(0x6); break;
- case 0x97: f8_bf(0x7); break;
- case 0x98: f8_bf(0x8); break;
- case 0x99: f8_bf(0x9); break;
- case 0x9a: f8_bf(0xa); break;
- case 0x9b: f8_bf(0xb); break;
- case 0x9c: f8_bf(0xc); break;
- case 0x9d: f8_bf(0xd); break;
- case 0x9e: f8_bf(0xe); break;
- case 0x9f: f8_bf(0xf); break;
-
- case 0xa0: f8_ins_0(0x0); break;
- case 0xa1: f8_ins_0(0x1); break;
- case 0xa2: illegal(); break;
- case 0xa3: illegal(); break;
- case 0xa4: f8_ins_1(0x4); break;
- case 0xa5: f8_ins_1(0x5); break;
- case 0xa6: f8_ins_1(0x6); break;
- case 0xa7: f8_ins_1(0x7); break;
- case 0xa8: f8_ins_1(0x8); break;
- case 0xa9: f8_ins_1(0x9); break;
- case 0xaa: f8_ins_1(0xa); break;
- case 0xab: f8_ins_1(0xb); break;
- case 0xac: f8_ins_1(0xc); break;
- case 0xad: f8_ins_1(0xd); break;
- case 0xae: f8_ins_1(0xe); break;
- case 0xaf: f8_ins_1(0xf); break;
-
- case 0xb0: f8_outs_0(0x0); break;
- case 0xb1: f8_outs_0(0x1); break;
- case 0xb2: illegal(); break;
- case 0xb3: illegal(); break;
- case 0xb4: f8_outs_1(0x4); break;
- case 0xb5: f8_outs_1(0x5); break;
- case 0xb6: f8_outs_1(0x6); break;
- case 0xb7: f8_outs_1(0x7); break;
- case 0xb8: f8_outs_1(0x8); break;
- case 0xb9: f8_outs_1(0x9); break;
- case 0xba: f8_outs_1(0xa); break;
- case 0xbb: f8_outs_1(0xb); break;
- case 0xbc: f8_outs_1(0xc); break;
- case 0xbd: f8_outs_1(0xd); break;
- case 0xbe: f8_outs_1(0xe); break;
- case 0xbf: f8_outs_1(0xf); break;
-
- case 0xc0: f8_as(0x0); break;
- case 0xc1: f8_as(0x1); break;
- case 0xc2: f8_as(0x2); break;
- case 0xc3: f8_as(0x3); break;
- case 0xc4: f8_as(0x4); break;
- case 0xc5: f8_as(0x5); break;
- case 0xc6: f8_as(0x6); break;
- case 0xc7: f8_as(0x7); break;
- case 0xc8: f8_as(0x8); break;
- case 0xc9: f8_as(0x9); break;
- case 0xca: f8_as(0xa); break;
- case 0xcb: f8_as(0xb); break;
- case 0xcc: f8_as_isar(); break;
- case 0xcd: f8_as_isar_i(); break;
- case 0xce: f8_as_isar_d(); break;
- case 0xcf: illegal(); break;
-
- case 0xd0: f8_asd(0x0); break;
- case 0xd1: f8_asd(0x1); break;
- case 0xd2: f8_asd(0x2); break;
- case 0xd3: f8_asd(0x3); break;
- case 0xd4: f8_asd(0x4); break;
- case 0xd5: f8_asd(0x5); break;
- case 0xd6: f8_asd(0x6); break;
- case 0xd7: f8_asd(0x7); break;
- case 0xd8: f8_asd(0x8); break;
- case 0xd9: f8_asd(0x9); break;
- case 0xda: f8_asd(0xa); break;
- case 0xdb: f8_asd(0xb); break;
- case 0xdc: f8_asd_isar(); break;
- case 0xdd: f8_asd_isar_i(); break;
- case 0xde: f8_asd_isar_d(); break;
- case 0xdf: illegal(); break;
-
- case 0xe0: f8_xs(0x0); break;
- case 0xe1: f8_xs(0x1); break;
- case 0xe2: f8_xs(0x2); break;
- case 0xe3: f8_xs(0x3); break;
- case 0xe4: f8_xs(0x4); break;
- case 0xe5: f8_xs(0x5); break;
- case 0xe6: f8_xs(0x6); break;
- case 0xe7: f8_xs(0x7); break;
- case 0xe8: f8_xs(0x8); break;
- case 0xe9: f8_xs(0x9); break;
- case 0xea: f8_xs(0xa); break;
- case 0xeb: f8_xs(0xb); break;
- case 0xec: f8_xs_isar(); break;
- case 0xed: f8_xs_isar_i(); break;
- case 0xee: f8_xs_isar_d(); break;
- case 0xef: illegal(); break;
-
- case 0xf0: f8_ns(0x0); break;
- case 0xf1: f8_ns(0x1); break;
- case 0xf2: f8_ns(0x2); break;
- case 0xf3: f8_ns(0x3); break;
- case 0xf4: f8_ns(0x4); break;
- case 0xf5: f8_ns(0x5); break;
- case 0xf6: f8_ns(0x6); break;
- case 0xf7: f8_ns(0x7); break;
- case 0xf8: f8_ns(0x8); break;
- case 0xf9: f8_ns(0x9); break;
- case 0xfa: f8_ns(0xa); break;
- case 0xfb: f8_ns(0xb); break;
- case 0xfc: f8_ns_isar(); break;
- case 0xfd: f8_ns_isar_i(); break;
- case 0xfe: f8_ns_isar_d(); break;
- case 0xff: illegal(); break;
+ /* opcode bitmask */
+ case 0x00: /* 0000 0000 */ f8_lr_a_ku(); break;
+ case 0x01: /* 0000 0001 */ f8_lr_a_kl(); break;
+ case 0x02: /* 0000 0010 */ f8_lr_a_qu(); break;
+ case 0x03: /* 0000 0011 */ f8_lr_a_ql(); break;
+ case 0x04: /* 0000 0100 */ f8_lr_ku_a(); break;
+ case 0x05: /* 0000 0101 */ f8_lr_kl_a(); break;
+ case 0x06: /* 0000 0110 */ f8_lr_qu_a(); break;
+ case 0x07: /* 0000 0111 */ f8_lr_ql_a(); break;
+ case 0x08: /* 0000 1000 */ f8_lr_k_p(); break;
+ case 0x09: /* 0000 1001 */ f8_lr_p_k(); break;
+ case 0x0a: /* 0000 1010 */ f8_lr_a_is(); break;
+ case 0x0b: /* 0000 1011 */ f8_lr_is_a(); break;
+ case 0x0c: /* 0000 1100 */ f8_pk(); break;
+ case 0x0d: /* 0000 1101 */ f8_lr_p0_q(); break;
+ case 0x0e: /* 0000 1110 */ f8_lr_q_dc(); break;
+ case 0x0f: /* 0000 1111 */ f8_lr_dc_q(); break;
+
+ case 0x10: /* 0001 0000 */ f8_lr_dc_h(); break;
+ case 0x11: /* 0001 0001 */ f8_lr_h_dc(); break;
+ case 0x12: /* 0001 0010 */ f8_sr_1(); break;
+ case 0x13: /* 0001 0011 */ f8_sl_1(); break;
+ case 0x14: /* 0001 0100 */ f8_sr_4(); break;
+ case 0x15: /* 0001 0101 */ f8_sl_4(); break;
+ case 0x16: /* 0001 0110 */ f8_lm(); break;
+ case 0x17: /* 0001 0111 */ f8_st(); break;
+ case 0x18: /* 0001 1000 */ f8_com(); break;
+ case 0x19: /* 0001 1001 */ f8_lnk(); break;
+ case 0x1a: /* 0001 1010 */ f8_di(); break;
+ case 0x1b: /* 0001 1011 */ f8_ei(); break;
+ case 0x1c: /* 0001 1100 */ f8_pop(); break;
+ case 0x1d: /* 0001 1101 */ f8_lr_w_j(); break;
+ case 0x1e: /* 0001 1110 */ f8_lr_j_w(); break;
+ case 0x1f: /* 0001 1111 */ f8_inc(); break;
+
+ case 0x20: /* 0010 0000 */ f8_li(); break;
+ case 0x21: /* 0010 0001 */ f8_ni(); break;
+ case 0x22: /* 0010 0010 */ f8_oi(); break;
+ case 0x23: /* 0010 0011 */ f8_xi(); break;
+ case 0x24: /* 0010 0100 */ f8_ai(); break;
+ case 0x25: /* 0010 0101 */ f8_ci(); break;
+ case 0x26: /* 0010 0110 */ f8_in(); break;
+ case 0x27: /* 0010 0111 */ f8_out(); break;
+ case 0x28: /* 0010 1000 */ f8_pi(); break;
+ case 0x29: /* 0010 1001 */ f8_jmp(); break;
+ case 0x2a: /* 0010 1010 */ f8_dci(); break;
+ case 0x2b: /* 0010 1011 */ f8_nop(); break;
+ case 0x2c: /* 0010 1100 */ f8_xdc(); break;
+ case 0x2d: /* 0010 1101 */ illegal(); break;
+ case 0x2e: /* 0010 1110 */ illegal(); break;
+ case 0x2f: /* 0010 1111 */ illegal(); break;
+
+ case 0x30: /* 0011 0000 */ f8_ds_r( 0); break;
+ case 0x31: /* 0011 0001 */ f8_ds_r( 1); break;
+ case 0x32: /* 0011 0010 */ f8_ds_r( 2); break;
+ case 0x33: /* 0011 0011 */ f8_ds_r( 3); break;
+ case 0x34: /* 0011 0100 */ f8_ds_r( 4); break;
+ case 0x35: /* 0011 0101 */ f8_ds_r( 5); break;
+ case 0x36: /* 0011 0110 */ f8_ds_r( 6); break;
+ case 0x37: /* 0011 0111 */ f8_ds_r( 7); break;
+ case 0x38: /* 0011 1000 */ f8_ds_r( 8); break;
+ case 0x39: /* 0011 1001 */ f8_ds_r( 9); break;
+ case 0x3a: /* 0011 1010 */ f8_ds_r(10); break;
+ case 0x3b: /* 0011 1011 */ f8_ds_r(11); break;
+ case 0x3c: /* 0011 1100 */ f8_ds_isar(); break;
+ case 0x3d: /* 0011 1101 */ f8_ds_isar_i(); break;
+ case 0x3e: /* 0011 1110 */ f8_ds_isar_d(); break;
+ case 0x3f: /* 0011 1111 */ illegal(); break;
+
+ case 0x40: /* 0100 0000 */ f8_lr_a_r( 0); break;
+ case 0x41: /* 0100 0001 */ f8_lr_a_r( 1); break;
+ case 0x42: /* 0100 0010 */ f8_lr_a_r( 2); break;
+ case 0x43: /* 0100 0011 */ f8_lr_a_r( 3); break;
+ case 0x44: /* 0100 0100 */ f8_lr_a_r( 4); break;
+ case 0x45: /* 0100 0101 */ f8_lr_a_r( 5); break;
+ case 0x46: /* 0100 0110 */ f8_lr_a_r( 6); break;
+ case 0x47: /* 0100 0111 */ f8_lr_a_r( 7); break;
+ case 0x48: /* 0100 1000 */ f8_lr_a_r( 8); break;
+ case 0x49: /* 0100 1001 */ f8_lr_a_r( 9); break;
+ case 0x4a: /* 0100 1010 */ f8_lr_a_r(10); break;
+ case 0x4b: /* 0100 1011 */ f8_lr_a_r(11); break;
+ case 0x4c: /* 0100 1100 */ f8_lr_a_isar(); break;
+ case 0x4d: /* 0100 1101 */ f8_lr_a_isar_i(); break;
+ case 0x4e: /* 0100 1110 */ f8_lr_a_isar_d(); break;
+ case 0x4f: /* 0100 1111 */ illegal(); break;
+
+ case 0x50: /* 0101 0000 */ f8_lr_r_a( 0); break;
+ case 0x51: /* 0101 0001 */ f8_lr_r_a( 1); break;
+ case 0x52: /* 0101 0010 */ f8_lr_r_a( 2); break;
+ case 0x53: /* 0101 0011 */ f8_lr_r_a( 3); break;
+ case 0x54: /* 0101 0100 */ f8_lr_r_a( 4); break;
+ case 0x55: /* 0101 0101 */ f8_lr_r_a( 5); break;
+ case 0x56: /* 0101 0110 */ f8_lr_r_a( 6); break;
+ case 0x57: /* 0101 0111 */ f8_lr_r_a( 7); break;
+ case 0x58: /* 0101 1000 */ f8_lr_r_a( 8); break;
+ case 0x59: /* 0101 1001 */ f8_lr_r_a( 9); break;
+ case 0x5a: /* 0101 1010 */ f8_lr_r_a(10); break;
+ case 0x5b: /* 0101 1011 */ f8_lr_r_a(11); break;
+ case 0x5c: /* 0101 1100 */ f8_lr_isar_a(); break;
+ case 0x5d: /* 0101 1101 */ f8_lr_isar_i_a(); break;
+ case 0x5e: /* 0101 1110 */ f8_lr_isar_d_a(); break;
+ case 0x5f: /* 0101 1111 */ illegal(); break;
+
+ case 0x60: /* 0110 0000 */ f8_lisu(0x00); break;
+ case 0x61: /* 0110 0001 */ f8_lisu(0x08); break;
+ case 0x62: /* 0110 0010 */ f8_lisu(0x10); break;
+ case 0x63: /* 0110 0011 */ f8_lisu(0x18); break;
+ case 0x64: /* 0110 0100 */ f8_lisu(0x20); break;
+ case 0x65: /* 0110 0101 */ f8_lisu(0x28); break;
+ case 0x66: /* 0110 0110 */ f8_lisu(0x30); break;
+ case 0x67: /* 0110 0111 */ f8_lisu(0x38); break;
+ case 0x68: /* 0110 1000 */ f8_lisl(0x00); break;
+ case 0x69: /* 0110 1001 */ f8_lisl(0x01); break;
+ case 0x6a: /* 0110 1010 */ f8_lisl(0x02); break;
+ case 0x6b: /* 0110 1011 */ f8_lisl(0x03); break;
+ case 0x6c: /* 0110 1100 */ f8_lisl(0x04); break;
+ case 0x6d: /* 0110 1101 */ f8_lisl(0x05); break;
+ case 0x6e: /* 0110 1110 */ f8_lisl(0x06); break;
+ case 0x6f: /* 0110 1111 */ f8_lisl(0x07); break;
+
+ case 0x70: /* 0111 0000 */ f8_lis(0x0); break;
+ case 0x71: /* 0111 0001 */ f8_lis(0x1); break;
+ case 0x72: /* 0111 0010 */ f8_lis(0x2); break;
+ case 0x73: /* 0111 0011 */ f8_lis(0x3); break;
+ case 0x74: /* 0111 0100 */ f8_lis(0x4); break;
+ case 0x75: /* 0111 0101 */ f8_lis(0x5); break;
+ case 0x76: /* 0111 0110 */ f8_lis(0x6); break;
+ case 0x77: /* 0111 0111 */ f8_lis(0x7); break;
+ case 0x78: /* 0111 1000 */ f8_lis(0x8); break;
+ case 0x79: /* 0111 1001 */ f8_lis(0x9); break;
+ case 0x7a: /* 0111 1010 */ f8_lis(0xa); break;
+ case 0x7b: /* 0111 1011 */ f8_lis(0xb); break;
+ case 0x7c: /* 0111 1100 */ f8_lis(0xc); break;
+ case 0x7d: /* 0111 1101 */ f8_lis(0xd); break;
+ case 0x7e: /* 0111 1110 */ f8_lis(0xe); break;
+ case 0x7f: /* 0111 1111 */ f8_lis(0xf); break;
+
+ case 0x80: /* 1000 0000 */ f8_bt(0); break;
+ case 0x81: /* 1000 0001 */ f8_bt(1); break;
+ case 0x82: /* 1000 0010 */ f8_bt(2); break;
+ case 0x83: /* 1000 0011 */ f8_bt(3); break;
+ case 0x84: /* 1000 0100 */ f8_bt(4); break;
+ case 0x85: /* 1000 0101 */ f8_bt(5); break;
+ case 0x86: /* 1000 0110 */ f8_bt(6); break;
+ case 0x87: /* 1000 0111 */ f8_bt(7); break;
+ case 0x88: /* 1000 1000 */ f8_am(); break;
+ case 0x89: /* 1000 1001 */ f8_amd(); break;
+ case 0x8a: /* 1000 1010 */ f8_nm(); break;
+ case 0x8b: /* 1000 1011 */ f8_om(); break;
+ case 0x8c: /* 1000 1100 */ f8_xm(); break;
+ case 0x8d: /* 1000 1101 */ f8_cm(); break;
+ case 0x8e: /* 1000 1110 */ f8_adc(); break;
+ case 0x8f: /* 1000 1111 */ f8_br7(); break;
+
+ case 0x90: /* 1001 0000 */ f8_bf(0x0); break;
+ case 0x91: /* 1001 0001 */ f8_bf(0x1); break;
+ case 0x92: /* 1001 0010 */ f8_bf(0x2); break;
+ case 0x93: /* 1001 0011 */ f8_bf(0x3); break;
+ case 0x94: /* 1001 0100 */ f8_bf(0x4); break;
+ case 0x95: /* 1001 0101 */ f8_bf(0x5); break;
+ case 0x96: /* 1001 0110 */ f8_bf(0x6); break;
+ case 0x97: /* 1001 0111 */ f8_bf(0x7); break;
+ case 0x98: /* 1001 1000 */ f8_bf(0x8); break;
+ case 0x99: /* 1001 1001 */ f8_bf(0x9); break;
+ case 0x9a: /* 1001 1010 */ f8_bf(0xa); break;
+ case 0x9b: /* 1001 1011 */ f8_bf(0xb); break;
+ case 0x9c: /* 1001 1100 */ f8_bf(0xc); break;
+ case 0x9d: /* 1001 1101 */ f8_bf(0xd); break;
+ case 0x9e: /* 1001 1110 */ f8_bf(0xe); break;
+ case 0x9f: /* 1001 1111 */ f8_bf(0xf); break;
+
+ case 0xa0: /* 1010 0000 */ f8_ins_0(0x0); break;
+ case 0xa1: /* 1010 0001 */ f8_ins_0(0x1); break;
+ case 0xa2: /* 1010 0010 */ illegal(); break;
+ case 0xa3: /* 1010 0011 */ illegal(); break;
+ case 0xa4: /* 1010 0100 */ f8_ins_1(0x4); break;
+ case 0xa5: /* 1010 0101 */ f8_ins_1(0x5); break;
+ case 0xa6: /* 1010 0110 */ f8_ins_1(0x6); break;
+ case 0xa7: /* 1010 0111 */ f8_ins_1(0x7); break;
+ case 0xa8: /* 1010 1000 */ f8_ins_1(0x8); break;
+ case 0xa9: /* 1010 1001 */ f8_ins_1(0x9); break;
+ case 0xaa: /* 1010 1010 */ f8_ins_1(0xa); break;
+ case 0xab: /* 1010 1011 */ f8_ins_1(0xb); break;
+ case 0xac: /* 1010 1100 */ f8_ins_1(0xc); break;
+ case 0xad: /* 1010 1101 */ f8_ins_1(0xd); break;
+ case 0xae: /* 1010 1110 */ f8_ins_1(0xe); break;
+ case 0xaf: /* 1010 1111 */ f8_ins_1(0xf); break;
+
+ case 0xb0: /* 1011 0000 */ f8_outs_0(0x0); break;
+ case 0xb1: /* 1011 0001 */ f8_outs_0(0x1); break;
+ case 0xb2: /* 1011 0010 */ illegal(); break;
+ case 0xb3: /* 1011 0011 */ illegal(); break;
+ case 0xb4: /* 1011 0100 */ f8_outs_1(0x4); break;
+ case 0xb5: /* 1011 0101 */ f8_outs_1(0x5); break;
+ case 0xb6: /* 1011 0110 */ f8_outs_1(0x6); break;
+ case 0xb7: /* 1011 0111 */ f8_outs_1(0x7); break;
+ case 0xb8: /* 1011 1000 */ f8_outs_1(0x8); break;
+ case 0xb9: /* 1011 1001 */ f8_outs_1(0x9); break;
+ case 0xba: /* 1011 1010 */ f8_outs_1(0xa); break;
+ case 0xbb: /* 1011 1011 */ f8_outs_1(0xb); break;
+ case 0xbc: /* 1011 1100 */ f8_outs_1(0xc); break;
+ case 0xbd: /* 1011 1101 */ f8_outs_1(0xd); break;
+ case 0xbe: /* 1011 1110 */ f8_outs_1(0xe); break;
+ case 0xbf: /* 1011 1111 */ f8_outs_1(0xf); break;
+
+ case 0xc0: /* 1100 0000 */ f8_as(0x0); break;
+ case 0xc1: /* 1100 0001 */ f8_as(0x1); break;
+ case 0xc2: /* 1100 0010 */ f8_as(0x2); break;
+ case 0xc3: /* 1100 0011 */ f8_as(0x3); break;
+ case 0xc4: /* 1100 0100 */ f8_as(0x4); break;
+ case 0xc5: /* 1100 0101 */ f8_as(0x5); break;
+ case 0xc6: /* 1100 0110 */ f8_as(0x6); break;
+ case 0xc7: /* 1100 0111 */ f8_as(0x7); break;
+ case 0xc8: /* 1100 1000 */ f8_as(0x8); break;
+ case 0xc9: /* 1100 1001 */ f8_as(0x9); break;
+ case 0xca: /* 1100 1010 */ f8_as(0xa); break;
+ case 0xcb: /* 1100 1011 */ f8_as(0xb); break;
+ case 0xcc: /* 1100 1100 */ f8_as_isar(); break;
+ case 0xcd: /* 1100 1101 */ f8_as_isar_i(); break;
+ case 0xce: /* 1100 1110 */ f8_as_isar_d(); break;
+ case 0xcf: /* 1100 1111 */ illegal(); break;
+
+ case 0xd0: /* 1101 0000 */ f8_asd(0x0); break;
+ case 0xd1: /* 1101 0001 */ f8_asd(0x1); break;
+ case 0xd2: /* 1101 0010 */ f8_asd(0x2); break;
+ case 0xd3: /* 1101 0011 */ f8_asd(0x3); break;
+ case 0xd4: /* 1101 0100 */ f8_asd(0x4); break;
+ case 0xd5: /* 1101 0101 */ f8_asd(0x5); break;
+ case 0xd6: /* 1101 0110 */ f8_asd(0x6); break;
+ case 0xd7: /* 1101 0111 */ f8_asd(0x7); break;
+ case 0xd8: /* 1101 1000 */ f8_asd(0x8); break;
+ case 0xd9: /* 1101 1001 */ f8_asd(0x9); break;
+ case 0xda: /* 1101 1010 */ f8_asd(0xa); break;
+ case 0xdb: /* 1101 1011 */ f8_asd(0xb); break;
+ case 0xdc: /* 1101 1100 */ f8_asd_isar(); break;
+ case 0xdd: /* 1101 1101 */ f8_asd_isar_i(); break;
+ case 0xde: /* 1101 1110 */ f8_asd_isar_d(); break;
+ case 0xdf: /* 1101 1111 */ illegal(); break;
+
+ case 0xe0: /* 1110 0000 */ f8_xs(0x0); break;
+ case 0xe1: /* 1110 0001 */ f8_xs(0x1); break;
+ case 0xe2: /* 1110 0010 */ f8_xs(0x2); break;
+ case 0xe3: /* 1110 0011 */ f8_xs(0x3); break;
+ case 0xe4: /* 1110 0100 */ f8_xs(0x4); break;
+ case 0xe5: /* 1110 0101 */ f8_xs(0x5); break;
+ case 0xe6: /* 1110 0110 */ f8_xs(0x6); break;
+ case 0xe7: /* 1110 0111 */ f8_xs(0x7); break;
+ case 0xe8: /* 1110 1000 */ f8_xs(0x8); break;
+ case 0xe9: /* 1110 1001 */ f8_xs(0x9); break;
+ case 0xea: /* 1110 1010 */ f8_xs(0xa); break;
+ case 0xeb: /* 1110 1011 */ f8_xs(0xb); break;
+ case 0xec: /* 1110 1100 */ f8_xs_isar(); break;
+ case 0xed: /* 1110 1101 */ f8_xs_isar_i(); break;
+ case 0xee: /* 1110 1110 */ f8_xs_isar_d(); break;
+ case 0xef: /* 1110 1111 */ illegal(); break;
+
+ case 0xf0: /* 1111 0000 */ f8_ns(0x0); break;
+ case 0xf1: /* 1111 0001 */ f8_ns(0x1); break;
+ case 0xf2: /* 1111 0010 */ f8_ns(0x2); break;
+ case 0xf3: /* 1111 0011 */ f8_ns(0x3); break;
+ case 0xf4: /* 1111 0100 */ f8_ns(0x4); break;
+ case 0xf5: /* 1111 0101 */ f8_ns(0x5); break;
+ case 0xf6: /* 1111 0110 */ f8_ns(0x6); break;
+ case 0xf7: /* 1111 0111 */ f8_ns(0x7); break;
+ case 0xf8: /* 1111 1000 */ f8_ns(0x8); break;
+ case 0xf9: /* 1111 1001 */ f8_ns(0x9); break;
+ case 0xfa: /* 1111 1010 */ f8_ns(0xa); break;
+ case 0xfb: /* 1111 1011 */ f8_ns(0xb); break;
+ case 0xfc: /* 1111 1100 */ f8_ns_isar(); break;
+ case 0xfd: /* 1111 1101 */ f8_ns_isar_i(); break;
+ case 0xfe: /* 1111 1110 */ f8_ns_isar_d(); break;
+ case 0xff: /* 1111 1111 */ illegal(); break;
}
- switch (op)
- {
- case 0x0c: case 0x1b: case 0x1c: case 0x1d:
+ switch (op) {
+ case 0x0d: case 0x1b: case 0x1c: case 0x1d:
case 0x27: case 0x28: case 0x29:
case 0xb4: case 0xb5: case 0xb6: case 0xb7:
case 0xb8: case 0xb9: case 0xba: case 0xbb:
case 0xbc: case 0xbd: case 0xbe: case 0xbf:
- // don't handle irq after privileged instruction
ROMC_00(cS);
break;
default:
- // 'freeze cycle' for handling interrupts
if (m_w&I && m_irq_request)
{
- ROMC_10();
ROMC_1C(cL);
ROMC_0F();
ROMC_13();
}
-
- // fetch next instruction (DS is long cycle)
- if ((op >= 0x30) && (op <= 0x3f))
+ if( ( op >= 0x30 ) && ( op <= 0x3f) ) /* DS is a long cycle inst */
+ {
ROMC_00(cL);
+ }
else
+ {
ROMC_00(cS);
-
+ }
break;
}
} while( m_icount > 0 );
diff --git a/src/devices/cpu/f8/f8.h b/src/devices/cpu/f8/f8.h
index 5185b938a05..cdd8f03b862 100644
--- a/src/devices/cpu/f8/f8.h
+++ b/src/devices/cpu/f8/f8.h
@@ -76,6 +76,9 @@ private:
u8 m_r[64]; /* scratchpad RAM */
int m_irq_request;
+ /* timer shifter polynomial values (will be used for timer interrupts) */
+ u8 timer_shifter[256];
+
u16 m_debug_pc; // only for the MAME debugger
inline void CLR_OZCS();
diff --git a/src/devices/cpu/g65816/g65816.cpp b/src/devices/cpu/g65816/g65816.cpp
index 93c93f96ed8..a65122b6153 100644
--- a/src/devices/cpu/g65816/g65816.cpp
+++ b/src/devices/cpu/g65816/g65816.cpp
@@ -17,10 +17,6 @@ All rights reserved.
/*
Changes:
- 1.02 (2019-02-02):
- R. Belmont
- - Corrected WDM to take 2 bytes and added callback
-
1.01 (2010-04-04):
Angelo Salese
- Added boundary checks for MVP and MVN in M mode.
@@ -119,7 +115,6 @@ g65816_device::g65816_device(const machine_config &mconfig, device_type type, co
, m_data_config("data", ENDIANNESS_LITTLE, 8, 24, 0, internal)
, m_opcode_config("opcodes", ENDIANNESS_LITTLE, 8, 24, 0, internal)
, m_vector_config("vectors", ENDIANNESS_LITTLE, 8, 5, 0)
- , m_wdm_w(*this)
, m_cpu_type(cpu_type)
{
}
@@ -865,8 +860,6 @@ void g65816_device::device_start()
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>();
- m_wdm_w.resolve_safe();
-
save_item(NAME(m_a));
save_item(NAME(m_b));
save_item(NAME(m_x));
diff --git a/src/devices/cpu/g65816/g65816.h b/src/devices/cpu/g65816/g65816.h
index 454dc7fd1b5..e53f9eb784b 100644
--- a/src/devices/cpu/g65816/g65816.h
+++ b/src/devices/cpu/g65816/g65816.h
@@ -56,8 +56,7 @@ public:
// construction/destruction
g65816_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto wdm_handler() { return m_wdm_w.bind(); }
-
+protected:
/* Registers - used by g65816_set_reg() and g65816_get_reg() */
enum
{
@@ -67,7 +66,6 @@ public:
_5A22_FASTROM
};
-protected:
g65816_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int cpu_type, address_map_constructor internal);
// device-level overrides
@@ -98,7 +96,6 @@ protected:
address_space_config m_data_config;
address_space_config m_opcode_config;
address_space_config m_vector_config;
- devcb_write8 m_wdm_w; /* WDM callback */
typedef void (g65816_device::*opcode_func) ();
typedef unsigned (g65816_device::*get_reg_func)(int regnum);
@@ -142,10 +139,8 @@ protected:
void g65816_set_pc(unsigned val);
unsigned g65816_get_sp();
void g65816_set_sp(unsigned val);
-public:
unsigned g65816_get_reg(int regnum);
void g65816_set_reg(int regnum, unsigned value);
-protected:
void g65816_restore_state();
unsigned g65816i_read_8_normal(unsigned address);
unsigned g65816i_read_8_immediate(unsigned address);
diff --git a/src/devices/cpu/g65816/g65816ds.cpp b/src/devices/cpu/g65816/g65816ds.cpp
index 355be140f99..0f40b42f5d6 100644
--- a/src/devices/cpu/g65816/g65816ds.cpp
+++ b/src/devices/cpu/g65816/g65816ds.cpp
@@ -101,7 +101,7 @@ const g65816_disassembler::opcode_struct g65816_disassembler::s_opcodes[256] =
{op::BIT, M, DX }, {op::AND, M, DX }, {op::ROL, M, DX }, {op::AND, M, DLIY},
{op::SEC, I, IMP }, {op::AND, M, AY }, {op::DEA, I, IMP }, {op::TSC, I, IMP },
{op::BIT, M, AX }, {op::AND, M, AX }, {op::ROL, M, AX }, {op::AND, M, ALX },
- {op::RTI, I, IMP }, {op::EOR, M, DXI }, {op::WDM, I, SIG }, {op::EOR, M, S },
+ {op::RTI, I, IMP }, {op::EOR, M, DXI }, {op::WDM, I, IMP }, {op::EOR, M, S },
{op::MVP, I, MVP }, {op::EOR, M, D }, {op::LSR, M, D }, {op::EOR, M, DLI },
{op::PHA, I, IMP }, {op::EOR, M, IMM }, {op::LSR, M, ACC }, {op::PHK, I, IMP },
{op::JMP, I, A }, {op::EOR, M, A }, {op::LSR, M, A }, {op::EOR, M, AL },
diff --git a/src/devices/cpu/g65816/g65816op.h b/src/devices/cpu/g65816/g65816op.h
index 727117c0f29..97b198e9385 100644
--- a/src/devices/cpu/g65816/g65816op.h
+++ b/src/devices/cpu/g65816/g65816op.h
@@ -1428,8 +1428,7 @@
#undef OP_WDM
#define OP_WDM() \
CLK(CLK_OP + CLK_IMPLIED); \
- SRC = OPER_8_IMM(); \
- m_wdm_w(SRC);
+ REGISTER_PC++
/* G65816 Exchange accum high and low bytes */
#undef OP_XBA
diff --git a/src/devices/cpu/h8/h83003.cpp b/src/devices/cpu/h8/h83003.cpp
index 7b7b468d7b5..4e3e59c15cf 100644
--- a/src/devices/cpu/h8/h83003.cpp
+++ b/src/devices/cpu/h8/h83003.cpp
@@ -136,9 +136,7 @@ void h83003_device::map(address_map &map)
map(0xffffd2, 0xffffd2).rw("port9", FUNC(h8_port_device::port_r), FUNC(h8_port_device::dr_w));
map(0xffffd3, 0xffffd3).rw("porta", FUNC(h8_port_device::port_r), FUNC(h8_port_device::dr_w));
map(0xffffd4, 0xffffd4).w("portb", FUNC(h8_port_device::ddr_w));
- map(0xffffd5, 0xffffd5).w("portc", FUNC(h8_port_device::ddr_w));
map(0xffffd6, 0xffffd6).rw("portb", FUNC(h8_port_device::port_r), FUNC(h8_port_device::dr_w));
- map(0xffffd7, 0xffffd7).rw("portc", FUNC(h8_port_device::port_r), FUNC(h8_port_device::dr_w));
map(0xffffda, 0xffffda).rw("port4", FUNC(h8_port_device::pcr_r), FUNC(h8_port_device::pcr_w));
map(0xffffe0, 0xffffe7).r("adc", FUNC(h8_adc_device::addr8_r));
@@ -169,7 +167,6 @@ void h83003_device::device_add_mconfig(machine_config &config)
H8_PORT(config, "port9", h8_device::PORT_9, 0x00, 0xc0);
H8_PORT(config, "porta", h8_device::PORT_A, 0x00, 0x00);
H8_PORT(config, "portb", h8_device::PORT_B, 0x00, 0x00);
- H8_PORT(config, "portc", h8_device::PORT_C, 0x00, 0x00);
H8_TIMER16(config, "timer16", 5, 0xe0);
H8H_TIMER16_CHANNEL(config, "timer16:0", 2, 2, "intc", 24);
H8H_TIMER16_CHANNEL(config, "timer16:1", 2, 2, "intc", 28);
diff --git a/src/devices/cpu/hmcs40/hmcs40.cpp b/src/devices/cpu/hmcs40/hmcs40.cpp
index 42e1ca45ef8..795ab3de985 100644
--- a/src/devices/cpu/hmcs40/hmcs40.cpp
+++ b/src/devices/cpu/hmcs40/hmcs40.cpp
@@ -466,7 +466,6 @@ void hmcs40_cpu_device::do_interrupt()
m_irt = 0;
standard_irq_callback(line);
- m_prev_pc = m_pc;
}
void hmcs40_cpu_device::execute_set_input(int line, int state)
diff --git a/src/devices/cpu/hpc/hpc.cpp b/src/devices/cpu/hpc/hpc.cpp
deleted file mode 100644
index 399ca9164af..00000000000
--- a/src/devices/cpu/hpc/hpc.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- National Semiconductor High-Performance microController (HPC)
-
- Currently this device is just a stub with no actual execution core.
-
-****************************************************************************
-
- HPC feature options by part number
-
- HPC16xxx Military temperature range (-55°C to +125°C)
- HPC26xxx Automotive temperature range (-40°C to +105°C)
- HPC36xxx Industrial temperature range (-40°C to +85°C)
- HPC46xxx Commercial temperature range (0°C to +75°C)
-
- HPCxx1xx 8-channel A/D converter
- HPCxx0xx No A/D converter
-
- HPCxxx6x 16k bytes of on-chip ROM
- HPCxxx8x 8k bytes of on-chip ROM
- HPCxxx0x No on-chip ROM
-
- HPCxxxx4 512 bytes of on-chip RAM
- HPCxxxx3 256 bytes of on-chip RAM
-
-***************************************************************************/
-
-#include "emu.h"
-#include "hpc.h"
-#include "hpcdasm.h"
-
-// device type definitions
-DEFINE_DEVICE_TYPE(HPC46003, hpc46003_device, "hpc46003", "HPC46003")
-DEFINE_DEVICE_TYPE(HPC46104, hpc46104_device, "hpc46104", "HPC46104")
-
-
-void hpc46003_device::internal_map(address_map &map)
-{
- map(0x0000, 0x00bf).ram();
- map(0x00c0, 0x00c0).rw(FUNC(hpc46003_device::psw_r), FUNC(hpc46003_device::psw_w));
- map(0x00c4, 0x00cf).ram().share("core_regs");
- // TODO: many other internal registers
- map(0x01c0, 0x01ff).ram();
-}
-
-void hpc46104_device::internal_map(address_map &map)
-{
- map(0x0000, 0x00bf).ram();
- map(0x00c0, 0x00c0).rw(FUNC(hpc46104_device::psw_r), FUNC(hpc46104_device::psw_w));
- map(0x00c4, 0x00cf).ram().share("core_regs");
- // TODO: many other internal registers
- map(0x01c0, 0x02ff).ram();
-}
-
-std::unique_ptr<util::disasm_interface> hpc46003_device::create_disassembler()
-{
- return std::make_unique<hpc16083_disassembler>();
-}
-
-std::unique_ptr<util::disasm_interface> hpc46104_device::create_disassembler()
-{
- return std::make_unique<hpc16164_disassembler>();
-}
-
-
-hpc_device::hpc_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_program_config("program", ENDIANNESS_LITTLE, 16, 16, 0, map)
- , m_program(nullptr)
- , m_core_regs(*this, "core_regs")
- , m_psw(0)
- , m_icount(0)
-{
-}
-
-hpc46003_device::hpc46003_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : hpc_device(mconfig, HPC46003, tag, owner, clock, address_map_constructor(FUNC(hpc46003_device::internal_map), this))
-{
-}
-
-hpc46104_device::hpc46104_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : hpc_device(mconfig, HPC46104, tag, owner, clock, address_map_constructor(FUNC(hpc46104_device::internal_map), this))
-{
-}
-
-device_memory_interface::space_config_vector hpc_device::memory_space_config() const
-{
- return space_config_vector {
- std::make_pair(AS_PROGRAM, &m_program_config),
- };
-}
-
-
-void hpc_device::device_start()
-{
- m_program = &space(AS_PROGRAM);
-
- set_icountptr(m_icount);
-
- state_add(HPC_PSW, "PSW", m_psw);
- state_add(HPC_SP, "SP", m_core_regs[0]);
- state_add(HPC_PC, "PC", m_core_regs[1]);
- state_add(STATE_GENPC, "GENPC", m_core_regs[1]).callimport().noshow();
- state_add(STATE_GENPCBASE, "CURPC", m_core_regs[1]).callimport().noshow();
- state_add(HPC_A, "A", m_core_regs[2]);
- state_add(HPC_K, "K", m_core_regs[3]);
- state_add(HPC_B, "B", m_core_regs[4]);
- state_add(HPC_X, "X", m_core_regs[5]);
-
- save_item(NAME(m_psw));
-}
-
-void hpc_device::device_reset()
-{
- m_psw = 0x00;
- std::fill_n(&m_core_regs[0], 6, 0x0000);
-}
-
-
-u8 hpc_device::psw_r()
-{
- return m_psw;
-}
-
-void hpc_device::psw_w(u8 data)
-{
- m_psw = data;
-}
-
-
-void hpc_device::execute_run()
-{
- m_core_regs[1] = m_program->read_word(0xfffe);
- debugger_instruction_hook(m_core_regs[1]);
-
- m_icount = 0;
-}
-
-void hpc_device::execute_set_input(int inputnum, int state)
-{
- // TODO
-}
diff --git a/src/devices/cpu/hpc/hpc.h b/src/devices/cpu/hpc/hpc.h
deleted file mode 100644
index 5f73a0ee2e6..00000000000
--- a/src/devices/cpu/hpc/hpc.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-
-#ifndef MAME_CPU_HPC_HPC_H
-#define MAME_CPU_HPC_HPC_H
-
-#pragma once
-
-
-class hpc_device : public cpu_device
-{
-public:
- enum {
- HPC_PSW,
- HPC_SP,
- HPC_PC,
- HPC_A,
- HPC_K,
- HPC_B,
- HPC_X
- };
-
-protected:
- // construction/destruction
- hpc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, address_map_constructor map);
-
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
- // device_execute_interface overrides
- virtual void execute_run() override;
- virtual void execute_set_input(int inputnum, int state) override;
-
- // device_memory_interface overrides
- virtual space_config_vector memory_space_config() const override;
-
- // internal register access
- u8 psw_r();
- void psw_w(u8 data);
-
-private:
- // address space
- address_space_config m_program_config;
- address_space *m_program;
-
- // internal state
- required_shared_ptr<u16> m_core_regs;
- u8 m_psw;
-
- // execution sequencing
- s32 m_icount;
-};
-
-class hpc46003_device : public hpc_device
-{
-public:
- // construction/destruction
- hpc46003_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
-protected:
- // device_disasm_interface overrides
- virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
-
-private:
- void internal_map(address_map &map);
-};
-
-class hpc46104_device : public hpc_device
-{
-public:
- // construction/destruction
- hpc46104_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
-protected:
- // device_disasm_interface overrides
- virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
-
-private:
- void internal_map(address_map &map);
-};
-
-
-// device type declarations
-DECLARE_DEVICE_TYPE(HPC46003, hpc46003_device)
-DECLARE_DEVICE_TYPE(HPC46104, hpc46104_device)
-
-#endif // MAME_CPU_HPC_HPC_H
diff --git a/src/devices/cpu/hpc/hpcdasm.cpp b/src/devices/cpu/hpc/hpcdasm.cpp
deleted file mode 100644
index 86c575a826e..00000000000
--- a/src/devices/cpu/hpc/hpcdasm.cpp
+++ /dev/null
@@ -1,764 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/***************************************************************************
-
- National Semiconductor HPC disassembler
-
- Note that though all 16-bit fields in instructions have the MSB first,
- the HPC's memory organization is in fact little-endian. This is why r16
- is not used to read them.
-
-***************************************************************************/
-
-#include "util/disasmintf.h"
-#include "hpcdasm.h"
-
-#include "util/strformat.h"
-#include <ctype.h>
-
-using osd::u32;
-using util::BIT;
-using offs_t = u32;
-
-const char *const hpc16083_disassembler::s_regs[128] =
-{
- "psw", nullptr, "SP", "PC", "A", "K", "B", "X",
- "enir", "irpd", "ircd", "sio", "porti", nullptr, "halten", nullptr,
- "porta", "portb", nullptr, "upic", nullptr, nullptr, nullptr, nullptr,
- "dira", "dirb", "bfun", nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, "portd", nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- "enu", "enui", "rbuf", "tbuf", "enur", nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- "t4", "r4", "t5", "r5", "t6", "r6", "t7", "r7",
- "pwmode", "portp", nullptr, nullptr, nullptr, nullptr, "eicon", "eicr",
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- "i4cr", "i3cr", "i2cr", "r2", "t2", "r3", "t3", "divby",
- "tmmode", "t0con", "watchdog", nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
-};
-
-const char *const hpc16164_disassembler::s_regs[128] =
-{
- "psw", nullptr, "SP", "PC", "A", "K", "B", "X",
- "enir", "irpd", "ircd", "sio", "porti", nullptr, "halten", "romdump",
- "porta", "portb", nullptr, "upic", nullptr, nullptr, nullptr, nullptr,
- "dira", "dirb", "bfun", nullptr, nullptr, nullptr, nullptr, nullptr,
- "adcr1", "adcr2", "portd", "adcr3", nullptr, nullptr, nullptr, nullptr,
- "ad0", "ad1", "ad2", "ad3", "ad4", "ad5", "ad6", "ad7",
- "enu", "enui", "rbuf", "tbuf", "enur", nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- "t4", "r4", "t5", "r5", "t6", "r6", "t7", "r7",
- "pwmode", "portp", nullptr, nullptr, nullptr, nullptr, "eicon", "eicr",
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- "i4cr", "i3cr", "i2cr", "r2", "t2", "r3", "t3", "divby",
- "tmmode", "t0con", "watchdog", nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
-};
-
-hpc_disassembler::hpc_disassembler(const char *const regs[])
- : util::disasm_interface()
- , m_regs(regs)
-{
-}
-
-u32 hpc_disassembler::opcode_alignment() const
-{
- return 1;
-}
-
-void hpc_disassembler::format_register(std::ostream &stream, u16 reg) const
-{
- if (reg >= 0x00c0 && reg < 0x01c0)
- {
- const char *name = m_regs[(reg - 0x00c0) >> 1];
- if (name != nullptr)
- {
- stream << name;
- if (BIT(reg, 0))
- stream << "+1";
- return;
- }
- }
-
- util::stream_format(stream, "0%X", reg);
-}
-
-void hpc_disassembler::format_immediate_byte(std::ostream &stream, u8 data) const
-{
- stream << "#";
- if (data >= 0x10)
- stream << "0";
- util::stream_format(stream, "%02X", data);
-}
-
-void hpc_disassembler::format_immediate_word(std::ostream &stream, u16 data) const
-{
- stream << "#";
- if (data >= 0x1000)
- stream << "0";
- util::stream_format(stream, "%04X", data);
-}
-
-void hpc_disassembler::disassemble_op(std::ostream &stream, const char *op, u16 reg, u16 src, bool imm, bool indir, bool idx, bool w) const
-{
- util::stream_format(stream, "%-8s", op);
- if (idx)
- stream << "A";
- else
- format_register(stream, reg);
- stream << ",";
- if (imm)
- {
- if (w)
- format_immediate_word(stream, src);
- else
- format_immediate_byte(stream, src);
- }
- else
- {
- if (idx)
- util::stream_format(stream, "0%X", u16(reg));
-
- if (indir)
- stream << "[";
- format_register(stream, src);
- if (indir)
- stream << "]";
-
- if (w)
- stream << ".w";
- else
- stream << ".b";
- }
-}
-
-void hpc_disassembler::disassemble_unary_op(std::ostream &stream, const char *op, u16 offset, u16 src, bool indir, bool idx, bool w) const
-{
- util::stream_format(stream, "%-8s", op);
- if (idx)
- util::stream_format(stream, "0%X", offset);
-
- if (indir)
- stream << "[";
- format_register(stream, src);
- if (indir)
- stream << "]";
-
- if (w)
- {
- if (src < 0x00c4 || src >= 0x00d0 || indir)
- stream << ".w";
- }
- else
- stream << ".b";
-}
-
-void hpc_disassembler::disassemble_bit_op(std::ostream &stream, const char *op, u8 bit, u16 offset, u16 src, bool indir, bool idx) const
-{
- if (src >= 0x00c0 && src < 0x01c0 && BIT(src, 0) && !indir && m_regs[(src - 0x00c0) >> 1] != nullptr)
- {
- src &= 0xfffe;
- bit += 8;
- }
-
- util::stream_format(stream, "%-8s%d,", op, bit);
-
- if (idx)
- util::stream_format(stream, "0%X", offset);
-
- if (indir)
- stream << "[";
- format_register(stream, src);
- if (indir)
- stream << "].b";
-}
-
-offs_t hpc_disassembler::disassemble(std::ostream &stream, offs_t pc, const hpc_disassembler::data_buffer &opcodes, const hpc_disassembler::data_buffer &params)
-{
- u8 opcode = opcodes.r8(pc);
- u16 reg = REGISTER_A;
- u16 src = REGISTER_B;
- bool imm = false;
- bool dmode = false;
- bool indir = true;
- bool idx = false;
- bool jmp = false;
- offs_t bytes = 1;
-
- switch (opcode)
- {
- case 0x20: case 0x21: case 0x22: case 0x23:
- case 0x24: case 0x25: case 0x26: case 0x27:
- case 0x28: case 0x29: case 0x2a: case 0x2b:
- case 0x2c: case 0x2d: case 0x2e: case 0x2f:
- jmp = true;
- src = 0xffd0 + (opcode & 0x0f) * 2;
- bytes = 1;
- break;
-
- case 0x30: case 0x31: case 0x32: case 0x33:
- jmp = true;
- src = pc + 2 + ((opcode & 0x03) << 8 | opcodes.r8(pc + 1));
- bytes = 2;
- break;
-
- case 0x34: case 0x35: case 0x36: case 0x37:
- jmp = true;
- src = pc - ((opcode & 0x03) << 8 | opcodes.r8(pc + 1));
- bytes = 2;
- break;
-
- case 0x38: case 0x39: case 0x3a:
- reg = REGISTER_X;
- break;
-
- case 0x3f:
- case 0x89: case 0x8a:
- case 0xa9: case 0xaa: case 0xaf:
- indir = false;
- src = opcodes.r8(pc + 1);
- bytes = 2;
- break;
-
- case 0x40: case 0x41: case 0x42: case 0x43:
- case 0x44: case 0x45: case 0x46: case 0x47:
- case 0x48: case 0x49: case 0x4a: case 0x4b:
- case 0x4c: case 0x4d: case 0x4e: case 0x4f:
- case 0x50: case 0x51: case 0x52: case 0x53:
- case 0x54: case 0x55: case 0x56: case 0x57:
- case 0x58: case 0x59: case 0x5a: case 0x5b:
- case 0x5c: case 0x5d: case 0x5e: case 0x5f:
- jmp = true;
- src = pc + 1 + (opcode & 0x1f);
- break;
-
- case 0x60: case 0x61: case 0x62: case 0x63:
- case 0x64: case 0x65: case 0x66: case 0x67:
- case 0x68: case 0x69: case 0x6a: case 0x6b:
- case 0x6c: case 0x6d: case 0x6e: case 0x6f:
- case 0x70: case 0x71: case 0x72: case 0x73:
- case 0x74: case 0x75: case 0x76: case 0x77:
- case 0x78: case 0x79: case 0x7a: case 0x7b:
- case 0x7c: case 0x7d: case 0x7e: case 0x7f:
- jmp = true;
- src = pc - (opcode & 0x1f);
- break;
-
- case 0x80: case 0x82:
- case 0xa0:
- dmode = true;
- indir = false;
- if (BIT(opcode, 1))
- imm = true;
-
- src = opcodes.r8(pc + 1);
- reg = opcodes.r8(pc + 2);
- opcode = opcodes.r8(pc + 3);
- bytes = 4;
- break;
-
- case 0x84: case 0x86:
- case 0xa4:
- dmode = true;
- indir = false;
- if (BIT(opcode, 1))
- imm = true;
-
- src = (opcodes.r8(pc + 1) << 8) | opcodes.r8(pc + 2);
- reg = opcodes.r8(pc + 3);
- opcode = opcodes.r8(pc + 4);
- bytes = 5;
- break;
-
- case 0x81: case 0x83:
- case 0xa1:
- dmode = true;
- indir = false;
- if (BIT(opcode, 1))
- imm = true;
-
- src = opcodes.r8(pc + 1);
- reg = (opcodes.r8(pc + 2) << 8) | opcodes.r8(pc + 3);
- opcode = opcodes.r8(pc + 4);
- bytes = 5;
- break;
-
- case 0xa2:
- idx = true;
- reg = opcodes.r8(pc + 1);
- src = opcodes.r8(pc + 2);
- opcode = opcodes.r8(pc + 3);
- bytes = 4;
- break;
-
- case 0x85: case 0x87:
- case 0xa5:
- dmode = true;
- indir = false;
- if (BIT(opcode, 1))
- imm = true;
-
- src = (opcodes.r8(pc + 1) << 8) | opcodes.r8(pc + 2);
- reg = (opcodes.r8(pc + 3) << 8) | opcodes.r8(pc + 4);
- opcode = opcodes.r8(pc + 5);
- bytes = 6;
- break;
-
- case 0xa6:
- idx = true;
- reg = (opcodes.r8(pc + 1) << 8) | opcodes.r8(pc + 2);
- src = opcodes.r8(pc + 3);
- opcode = opcodes.r8(pc + 4);
- bytes = 5;
- break;
-
- case 0x88: case 0x8b: case 0x8e:
- case 0xa8: case 0xab: case 0xae:
- indir = false;
- src = opcodes.r8(pc + 1);
- bytes = 2;
- break;
-
- case 0x8c:
- case 0xac:
- indir = false;
- src = opcodes.r8(pc + 1);
- reg = opcodes.r8(pc + 2);
- bytes = 3;
- break;
-
- case 0x8d:
- imm = true;
- src = opcodes.r8(pc + 1);
- reg = opcodes.r8(pc + 2);
- bytes = 3;
- break;
-
- case 0x8f:
- src = REGISTER_X;
- opcode = opcodes.r8(pc + 1);
- bytes = 2;
- break;
-
- case 0x90: case 0x91: case 0x92: case 0x93:
- imm = true;
- reg = 0x00c8 | ((opcode & 0x03) << 1);
- src = opcodes.r8(pc + 1);
- bytes = 2;
- break;
-
- case 0x98: case 0x99: case 0x9a: case 0x9b:
- case 0x9c: case 0x9d: case 0x9e: case 0x9f:
- imm = true;
- src = opcodes.r8(pc + 1);
- bytes = 2;
- break;
-
- case 0x94:
- jmp = true;
- src = pc + 2 + opcodes.r8(pc + 1);
- bytes = 2;
- break;
-
- case 0x95:
- jmp = true;
- src = pc - opcodes.r8(pc + 1);
- bytes = 2;
- break;
-
- case 0x96:
- indir = false;
- src = opcodes.r8(pc + 1);
- opcode = opcodes.r8(pc + 2);
- bytes = 3;
- break;
-
- case 0x97:
- indir = false;
- imm = true;
- src = opcodes.r8(pc + 1);
- reg = opcodes.r8(pc + 2);
- bytes = 3;
- break;
-
- case 0xa7:
- imm = true;
- src = (opcodes.r8(pc + 1) << 8) | opcodes.r8(pc + 2);
- reg = (opcodes.r8(pc + 3) << 8) | opcodes.r8(pc + 4);
- bytes = 5;
- break;
-
- case 0xad:
- src = opcodes.r8(pc + 1);
- opcode = opcodes.r8(pc + 2);
- bytes = 3;
- break;
-
- case 0xb0: case 0xb1: case 0xb2: case 0xb3:
- imm = true;
- reg = 0x00c8 | ((opcode & 0x03) << 1);
- src = (opcodes.r8(pc + 1) << 8) | opcodes.r8(pc + 2);
- bytes = 3;
- break;
-
- case 0xb8: case 0xb9: case 0xba: case 0xbb:
- case 0xbc: case 0xbd: case 0xbe: case 0xbf:
- imm = true;
- src = (opcodes.r8(pc + 1) << 8) | opcodes.r8(pc + 2);
- bytes = 3;
- break;
-
- case 0xb4: case 0xb5:
- jmp = true;
- src = pc + 3 + ((opcodes.r8(pc + 1) << 8) | opcodes.r8(pc + 2));
- bytes = 3;
- break;
-
- case 0xb6:
- indir = false;
- src = (opcodes.r8(pc + 1) << 8) | opcodes.r8(pc + 2);
- opcode = opcodes.r8(pc + 3);
- bytes = 4;
- break;
-
- case 0xb7:
- imm = true;
- src = (opcodes.r8(pc + 1) << 8) | opcodes.r8(pc + 2);
- reg = opcodes.r8(pc + 3);
- bytes = 4;
- break;
-
- case 0xd4: case 0xd5: case 0xd6:
- case 0xf4: case 0xf5: case 0xf6:
- src = REGISTER_X;
- break;
- }
-
- switch (opcode)
- {
- case 0x00:
- util::stream_format(stream, "%-8sA", "clr");
- break;
-
- case 0x01:
- util::stream_format(stream, "%-8sA", "comp");
- break;
-
- case 0x02:
- stream << "sc";
- break;
-
- case 0x03:
- stream << "rc";
- break;
-
- case 0x04:
- util::stream_format(stream, "%-8sA", "inc");
- break;
-
- case 0x05:
- util::stream_format(stream, "%-8sA", "dec");
- break;
-
- case 0x06:
- stream << "ifnc";
- break;
-
- case 0x07:
- stream << "ifc";
- break;
-
- case 0x08: case 0x09: case 0x0a: case 0x0b:
- case 0x0c: case 0x0d: case 0x0e: case 0x0f:
- disassemble_bit_op(stream, "sbit", opcode & 0x07, reg, src, indir, idx);
- break;
-
- case 0x10: case 0x11: case 0x12: case 0x13:
- case 0x14: case 0x15: case 0x16: case 0x17:
- disassemble_bit_op(stream, "ifbit", opcode & 0x07, reg, src, indir, idx);
- break;
-
- case 0x18: case 0x19: case 0x1a: case 0x1b:
- case 0x1c: case 0x1d: case 0x1e: case 0x1f:
- disassemble_bit_op(stream, "rbit", opcode & 0x07, reg, src, indir, idx);
- break;
-
- case 0x20: case 0x21: case 0x22: case 0x23:
- case 0x24: case 0x25: case 0x26: case 0x27:
- case 0x28: case 0x29: case 0x2a: case 0x2b:
- case 0x2c: case 0x2d: case 0x2e: case 0x2f:
- util::stream_format(stream, "%-8s", "jsrp");
- if (jmp)
- util::stream_format(stream, "[0%X]", src);
- else
- stream << "???";
- bytes |= STEP_OVER;
- break;
-
- case 0x30: case 0x31: case 0x32: case 0x33:
- case 0x34: case 0x35: case 0x36: case 0x37:
- util::stream_format(stream, "%-8s", "jsr");
- if (jmp)
- util::stream_format(stream, "0%X", src);
- else
- stream << "???";
- bytes |= STEP_OVER;
- break;
-
- case 0x38:
- disassemble_op(stream, "rbit", reg, src, imm, indir, idx, false);
- break;
-
- case 0x39:
- disassemble_op(stream, "sbit", reg, src, imm, indir, idx, false);
- break;
-
- case 0x3a:
- disassemble_op(stream, "ifbit", reg, src, imm, indir, idx, false);
- break;
-
- case 0x3b:
- util::stream_format(stream, "%-8sA", "swap");
- break;
-
- case 0x3c:
- stream << "ret";
- bytes |= STEP_OUT;
- break;
-
- case 0x3d:
- stream << "retsk";
- bytes |= STEP_OUT;
- break;
-
- case 0x3e:
- stream << "reti";
- bytes |= STEP_OUT;
- break;
-
- case 0x3f:
- util::stream_format(stream, "%-8s", "pop");
- format_register(stream, src);
- break;
-
- case 0x40:
- stream << "nop";
- break;
-
- case 0x41: case 0x42: case 0x43:
- case 0x44: case 0x45: case 0x46: case 0x47:
- case 0x48: case 0x49: case 0x4a: case 0x4b:
- case 0x4c: case 0x4d: case 0x4e: case 0x4f:
- case 0x50: case 0x51: case 0x52: case 0x53:
- case 0x54: case 0x55: case 0x56: case 0x57:
- case 0x58: case 0x59: case 0x5a: case 0x5b:
- case 0x5c: case 0x5d: case 0x5e: case 0x5f:
- case 0x60: case 0x61: case 0x62: case 0x63:
- case 0x64: case 0x65: case 0x66: case 0x67:
- case 0x68: case 0x69: case 0x6a: case 0x6b:
- case 0x6c: case 0x6d: case 0x6e: case 0x6f:
- case 0x70: case 0x71: case 0x72: case 0x73:
- case 0x74: case 0x75: case 0x76: case 0x77:
- case 0x78: case 0x79: case 0x7a: case 0x7b:
- case 0x7c: case 0x7d: case 0x7e: case 0x7f:
- util::stream_format(stream, "%-8s", "jp");
- if (jmp)
- util::stream_format(stream, "0%X", src);
- else
- stream << "???";
- break;
-
- case 0x88: case 0x8c:
- case 0x90: case 0x91: case 0x92: case 0x93:
- case 0x97:
- case 0xa8: case 0xac:
- case 0xb0: case 0xb1: case 0xb2: case 0xb3:
- case 0xb7:
- case 0xc4:
- case 0xd4:
- case 0xe4:
- case 0xf4:
- disassemble_op(stream, "ld", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0x89:
- case 0xa9:
- disassemble_unary_op(stream, "inc", reg, src, indir, idx, BIT(opcode, 5));
- break;
-
- case 0x8a:
- case 0xaa:
- disassemble_unary_op(stream, "decsz", reg, src, indir, idx, BIT(opcode, 5));
- bytes |= STEP_OVER | (1 << OVERINSTSHIFT);
- break;
-
- case 0x8b:
- case 0xab:
- case 0xc6:
- case 0xd6:
- case 0xe6:
- case 0xf6:
- disassemble_op(stream, dmode ? "ld" : "st", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0x8d:
- util::stream_format(stream, "%-8sBK,", "ld");
- format_immediate_byte(stream, src);
- stream << ",";
- format_immediate_byte(stream, reg);
- break;
-
- case 0x8e:
- case 0xae:
- case 0xc5:
- case 0xd5:
- case 0xe5:
- case 0xf5:
- disassemble_op(stream, "x", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0x94: case 0x95:
- util::stream_format(stream, "%-8s", "jp");
- if (jmp)
- util::stream_format(stream, "0%X", src);
- else
- stream << "???";
- break;
-
- case 0x98: case 0xb8: case 0xd8: case 0xf8:
- disassemble_op(stream, "add", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0x99: case 0xb9: case 0xd9: case 0xf9:
- disassemble_op(stream, "and", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0x9a: case 0xba: case 0xda: case 0xfa:
- disassemble_op(stream, "or", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0x9b: case 0xbb: case 0xdb: case 0xfb:
- disassemble_op(stream, "xor", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0x9c: case 0xbc: case 0xdc: case 0xfc:
- disassemble_op(stream, "ifeq", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0x9d: case 0xbd: case 0xdd: case 0xfd:
- disassemble_op(stream, "ifgt", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0x9e: case 0xbe: case 0xde: case 0xfe:
- disassemble_op(stream, "mult", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0x9f: case 0xbf: case 0xdf: case 0xff:
- disassemble_op(stream, "div", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0xa7:
- util::stream_format(stream, "%-8sBK,", "ld");
- format_immediate_word(stream, src);
- stream << ",";
- format_immediate_word(stream, reg);
- break;
-
- case 0xaf:
- util::stream_format(stream, "%-8s", "push");
- format_register(stream, src);
- break;
-
- case 0xb4:
- util::stream_format(stream, "%-8s", "jmpl");
- if (jmp)
- util::stream_format(stream, "0%X", src);
- else
- stream << "???";
- break;
-
- case 0xb5:
- util::stream_format(stream, "%-8s", "jsrl");
- if (jmp)
- util::stream_format(stream, "0%X", src);
- else
- stream << "???";
- bytes |= STEP_OVER;
- break;
-
- case 0xc0: case 0xc2:
- case 0xe0: case 0xe2:
- util::stream_format(stream, "%-8sA,[B%c].%c", "lds",
- BIT(opcode, 1) ? '-' : '+',
- BIT(opcode, 5) ? 'w' : 'b');
- bytes |= STEP_OVER | (1 << OVERINSTSHIFT);
- break;
-
- case 0xd0: case 0xd2:
- case 0xf0: case 0xf2:
- util::stream_format(stream, "%-8sA,[X%c].%c", "ld",
- BIT(opcode, 1) ? '-' : '+',
- BIT(opcode, 5) ? 'w' : 'b');
- break;
-
- case 0xc1: case 0xc3:
- case 0xe1: case 0xe3:
- util::stream_format(stream, "%-8sA,[B%c].%c", "xs",
- BIT(opcode, 1) ? '-' : '+',
- BIT(opcode, 5) ? 'w' : 'b');
- bytes |= STEP_OVER | (1 << OVERINSTSHIFT);
- break;
-
- case 0xd1: case 0xd3:
- case 0xf1: case 0xf3:
- util::stream_format(stream, "%-8sA,[X%c].%c", "x",
- BIT(opcode, 1) ? '-' : '+',
- BIT(opcode, 5) ? 'w' : 'b');
- break;
-
- case 0xc7: case 0xe7:
- util::stream_format(stream, "%-8sA", BIT(opcode, 5) ? "shl" : "shr");
- break;
-
- case 0xd7: case 0xf7:
- util::stream_format(stream, "%-8sA", BIT(opcode, 5) ? "rlc" : "rrc");
- break;
-
- case 0xc8: case 0xe8:
- disassemble_op(stream, "adc", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0xc9: case 0xe9:
- disassemble_op(stream, "dadc", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0xca: case 0xea:
- disassemble_op(stream, "dsubc", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0xcb: case 0xeb:
- disassemble_op(stream, "subc", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- case 0xcc: case 0xec:
- stream << "jid";
- if (BIT(opcode, 5))
- stream << "w";
- break;
-
- case 0xcf: case 0xef:
- disassemble_op(stream, "divd", reg, src, imm, indir, idx, BIT(opcode, 5));
- break;
-
- default:
- stream << "???";
- break;
- }
-
- return bytes | SUPPORTED;
-}
diff --git a/src/devices/cpu/hpc/hpcdasm.h b/src/devices/cpu/hpc/hpcdasm.h
deleted file mode 100644
index ed57c6b1a35..00000000000
--- a/src/devices/cpu/hpc/hpcdasm.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-
-#ifndef MAME_CPU_HPC_HPCDASM_H
-#define MAME_CPU_HPC_HPCDASM_H
-
-#pragma once
-
-class hpc_disassembler : public util::disasm_interface
-{
-protected:
- enum : u16
- {
- REGISTER_A = 0x00c8,
- REGISTER_K = 0x00ca,
- REGISTER_B = 0x00cc,
- REGISTER_X = 0x00ce
- };
-
- // construction/destruction
- hpc_disassembler(const char *const regs[]);
-
- // disassembler overrides
- virtual u32 opcode_alignment() const override;
- virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params) override;
-
-private:
- // internal helpers
- void format_register(std::ostream &stream, u16 reg) const;
- void format_immediate_byte(std::ostream &stream, u8 data) const;
- void format_immediate_word(std::ostream &stream, u16 data) const;
- void disassemble_op(std::ostream &stream, const char *op, u16 reg, u16 src, bool imm, bool indir, bool idx, bool w) const;
- void disassemble_unary_op(std::ostream &stream, const char *op, u16 offset, u16 src, bool indir, bool idx, bool w) const;
- void disassemble_bit_op(std::ostream &stream, const char *op, u8 bit, u16 offset, u16 src, bool indir, bool idx) const;
-
- // register names
- const char *const *m_regs;
-};
-
-class hpc16083_disassembler : public hpc_disassembler
-{
-public:
- hpc16083_disassembler() : hpc_disassembler(s_regs) { }
-
-private:
- static const char *const s_regs[128];
-};
-
-class hpc16164_disassembler : public hpc_disassembler
-{
-public:
- hpc16164_disassembler() : hpc_disassembler(s_regs) { }
-
-private:
- static const char *const s_regs[128];
-};
-
-#endif // MAME_CPU_HPC_HPCDASM_H
diff --git a/src/devices/cpu/hphybrid/hphybrid.cpp b/src/devices/cpu/hphybrid/hphybrid.cpp
index b9e7da6cc4e..246804ec468 100644
--- a/src/devices/cpu/hphybrid/hphybrid.cpp
+++ b/src/devices/cpu/hphybrid/hphybrid.cpp
@@ -175,8 +175,6 @@ uint8_t hp_hybrid_cpu_device::pa_r() const
hp_hybrid_cpu_device::hp_hybrid_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t addrwidth)
: cpu_device(mconfig, type, tag, owner, clock)
, m_pa_changed_func(*this)
- , m_opcode_func(*this)
- , m_stm_func(*this)
, m_addr_mask((1U << addrwidth) - 1)
, m_relative_mode(true)
, m_r_cycles(DEF_MEM_R_CYCLES)
@@ -243,8 +241,6 @@ void hp_hybrid_cpu_device::device_start()
set_icountptr(m_icount);
m_pa_changed_func.resolve_safe();
- m_opcode_func.resolve_safe();
- m_stm_func.resolve();
}
void hp_hybrid_cpu_device::device_reset()
@@ -264,7 +260,6 @@ void hp_hybrid_cpu_device::device_reset()
m_dmapa = 0;
m_dmama = 0;
m_dmac = 0;
- m_curr_cycle = 0;
m_forced_bsc_25 = m_boot_mode;
m_last_pa = ~0;
@@ -317,7 +312,7 @@ uint16_t hp_hybrid_cpu_device::execute_one(uint16_t opcode)
}
// Indirect addressing in EXE instruction seems to use AEC case A instead of case C
// (because it's an opcode fetch)
- return fetch_at(add_mae(AEC_CASE_A , fetch_addr));
+ return RM(add_mae(AEC_CASE_A , fetch_addr));
} else {
uint16_t next_P;
if (!execute_one_bpc(opcode , next_P) &&
@@ -957,11 +952,6 @@ uint16_t hp_hybrid_cpu_device::RM(uint32_t addr)
// Any access to internal registers removes forcing of BSC 2x
m_forced_bsc_25 = false;
- if (m_stm_func) {
- m_stm_func(m_curr_cycle | CYCLE_RAL_MASK | CYCLE_RD_MASK);
- m_curr_cycle = 0;
- }
-
// Memory mapped BPC registers
uint16_t tmp;
switch (addr_wo_bsc) {
@@ -1026,10 +1016,6 @@ uint16_t hp_hybrid_cpu_device::RM(uint32_t addr)
return tmp;
} else {
m_icount -= m_r_cycles;
- if (m_stm_func) {
- m_stm_func(m_curr_cycle | CYCLE_RD_MASK);
- m_curr_cycle = 0;
- }
return m_cache->read_word(addr);
}
}
@@ -1079,11 +1065,6 @@ void hp_hybrid_cpu_device::WM(uint32_t addr , uint16_t v)
// Any access to internal registers removes forcing of BSC 2x
m_forced_bsc_25 = false;
- if (m_stm_func) {
- m_stm_func(m_curr_cycle | CYCLE_RAL_MASK | CYCLE_WR_MASK);
- m_curr_cycle = 0;
- }
-
// Memory mapped BPC registers
switch (addr_wo_bsc) {
case HP_REG_A_ADDR:
@@ -1149,10 +1130,6 @@ void hp_hybrid_cpu_device::WM(uint32_t addr , uint16_t v)
m_icount -= REGISTER_RW_CYCLES;
} else {
m_icount -= m_w_cycles;
- if (m_stm_func) {
- m_stm_func(m_curr_cycle | CYCLE_WR_MASK);
- m_curr_cycle = 0;
- }
m_program->write_word(addr , v);
}
}
@@ -1191,15 +1168,7 @@ bool hp_hybrid_cpu_device::write_emc_reg(uint16_t addr , uint16_t v)
uint16_t hp_hybrid_cpu_device::fetch()
{
m_genpc = add_mae(AEC_CASE_A , m_reg_P);
- return fetch_at(m_genpc);
-}
-
-uint16_t hp_hybrid_cpu_device::fetch_at(uint32_t addr)
-{
- m_curr_cycle |= CYCLE_IFETCH_MASK;
- uint16_t opcode = RM(addr);
- m_opcode_func(opcode);
- return opcode;
+ return RM(m_genpc);
}
uint16_t hp_hybrid_cpu_device::get_indirect_target(uint32_t addr)
@@ -1617,10 +1586,6 @@ bool hp_5061_3011_cpu_device::execute_no_bpc(uint16_t opcode , uint16_t& next_pc
// 16 bits units.
WM(tmp_addr >> 1 , tmp);
} else {
- if (m_stm_func) {
- m_stm_func(m_curr_cycle | CYCLE_WR_MASK);
- m_curr_cycle = 0;
- }
// Extend address, form byte address
uint16_t mask = BIT(tmp_addr , 0) ? 0x00ff : 0xff00;
tmp_addr = add_mae(AEC_CASE_C , tmp_addr >> 1);
@@ -1709,7 +1674,6 @@ void hp_5061_3011_cpu_device::handle_dma()
bool tc = BIT(--m_dmac , 15) != 0;
uint16_t tmp;
- m_curr_cycle |= CYCLE_DMA_MASK;
// Timing here assumes that DMA transfers are isolated and not done in bursts
if (BIT(m_flags , HPHYBRID_DMADIR_BIT)) {
// "Outward" DMA: memory -> peripheral
@@ -1991,10 +1955,6 @@ bool hp_09825_67907_cpu_device::execute_no_bpc(uint16_t opcode , uint16_t& next_
// 16 bits units.
WM(tmp_addr , tmp);
} else {
- if (m_stm_func) {
- m_stm_func(m_curr_cycle | CYCLE_WR_MASK);
- m_curr_cycle = 0;
- }
uint16_t mask = BIT(*ptr_reg , 15) ? 0xff00 : 0x00ff;
m_program->write_word(tmp_addr , tmp , mask);
m_icount -= m_w_cycles;
@@ -2077,7 +2037,6 @@ void hp_09825_67907_cpu_device::handle_dma()
uint16_t tmp;
// Timing here assumes that DMA transfers are isolated and not done in bursts
- m_curr_cycle |= CYCLE_DMA_MASK;
if (BIT(m_dmama , 15)) {
// "Outward" DMA: memory -> peripheral
tmp = RM(AEC_CASE_D , m_dmama);
diff --git a/src/devices/cpu/hphybrid/hphybrid.h b/src/devices/cpu/hphybrid/hphybrid.h
index 5059e114bb7..5d29f77b515 100644
--- a/src/devices/cpu/hphybrid/hphybrid.h
+++ b/src/devices/cpu/hphybrid/hphybrid.h
@@ -64,29 +64,6 @@ public:
void set_relative_mode(bool rela) { m_relative_mode = rela; }
void set_rw_cycles(unsigned read_cycles , unsigned write_cycles) { m_r_cycles = read_cycles; m_w_cycles = write_cycles; }
- // Possible combinations:
- // 00 No r/w cycle in progress
- // 01 Non-ifetch rd cycle
- // 05 Ifetch rd cycle
- // 09 DMA rd cycle
- // 02 Wr cycle
- // 0a DMA wr cycle
- //
- // CYCLE_RAL_MASK is set when access is into register space [0..1f]
- enum : uint8_t {
- CYCLE_RD_MASK = 0x01,
- CYCLE_WR_MASK = 0x02,
- CYCLE_IFETCH_MASK = 0x04,
- CYCLE_DMA_MASK = 0x08,
- CYCLE_RAL_MASK = 0x10
- };
-
- // Called at start of each memory access
- auto stm_cb() { return m_stm_func.bind(); }
-
- // Tap into fetched opcodes
- auto opcode_cb() { return m_opcode_func.bind(); }
-
protected:
hp_hybrid_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t addrwidth);
@@ -146,7 +123,6 @@ protected:
void WIO(uint8_t pa , uint8_t ic , uint16_t v);
uint16_t fetch();
- uint16_t fetch_at(uint32_t addr);
virtual uint16_t get_indirect_target(uint32_t addr);
virtual void enter_isr();
virtual void handle_dma() = 0;
@@ -157,8 +133,6 @@ protected:
devcb_write8 m_pa_changed_func;
uint8_t m_last_pa;
- devcb_write16 m_opcode_func;
- devcb_write8 m_stm_func;
int m_icount;
uint32_t m_addr_mask;
@@ -185,8 +159,6 @@ protected:
uint16_t m_dmac; // DMA counter
uint16_t m_reg_I; // Instruction register
uint32_t m_genpc; // Full PC
- uint8_t m_curr_cycle; // Current cycle type
-
// EMC registers
uint16_t m_reg_ar2[ 4 ]; // AR2 register
uint16_t m_reg_se; // SE register (4 bits)
diff --git a/src/devices/cpu/i386/cache.h b/src/devices/cpu/i386/cache.h
deleted file mode 100644
index a04f2cacf2e..00000000000
--- a/src/devices/cpu/i386/cache.h
+++ /dev/null
@@ -1,258 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Samuele Zannoli
-
-#ifndef MAME_CPU_I386_CACHE_H
-#define MAME_CPU_I386_CACHE_H
-
-#pragma once
-
-/* To test it outside of Mame
-#include <cstdlib>
-
-typedef unsigned char u8;
-typedef unsigned int u32;
-*/
-
-enum {
- CacheLineBytes16 = 4,
- CacheLineBytes32 = 5,
- CacheLineBytes64 = 6,
- CacheLineBytes128 = 7,
- CacheLineBytes256 = 8,
-};
-
-enum {
- CacheDirectMapped = 0,
- Cache2Way = 1,
- Cache4Way = 2,
- Cache8Way = 3,
- Cache16Way = 4
-};
-
-enum {
- CacheRead = 0,
- CacheWrite = 1
-};
-
-template<int TagBits, int SetBits, int WayBits, int LineBits>
-class cpucache {
-public:
- // Constructor
- cpucache();
- // Reset the cache
- void reset();
- // Find the cacheline containing data at address
- template <int ReadWrite> u8* search(u32 address);
- // Allocate a cacheline for data at address
- template <int ReadWrite> bool allocate(u32 address, u8 **data);
- // Get the address where the cacheline data should be written back to
- u32 old();
- // Get the address of the first byte of the cacheline that contains data at address
- u32 base(u32 address);
- // Compose the cacheline parameters into an address
- u32 address(u32 tag, u32 set, u32 offset);
- // Get the data of the first cacheline marked as dirty
- u8* first_dirty(u32 &base, bool clean);
- // Get the data of the next cacheline marked as dirty
- u8* next_dirty(u32 &base, bool clean);
-
-private:
- static const int Ways = 1 << WayBits;
- static const int LineBytes = 1 << LineBits;
- static const int Sets = 1 << SetBits;
- static const u32 LineMask = (1 << LineBits) - 1;
- static const u32 SetMask = ((1 << SetBits) - 1) << LineBits;
- static const u32 WayMask = (1 << WayBits) - 1;
- static const int TagShift = LineBits + SetBits;
-
- struct cacheline {
- u8 data[LineBytes];
- bool allocated;
- bool dirty;
- u32 tag;
- u32 debug_address;
- };
-
- struct cacheset {
- cacheline lines[Ways];
- int nextway;
- };
-
- cacheset sets[Sets];
- u32 writeback_base;
- int last_set;
- int last_way;
-};
-
-template<int TagBits, int SetBits, int WayBits, int LineBits>
-cpucache<TagBits, SetBits, WayBits, LineBits>::cpucache()
-{
- reset();
-}
-
-template<int TagBits, int SetBits, int WayBits, int LineBits>
-void cpucache<TagBits, SetBits, WayBits, LineBits>::reset()
-{
- for (int s = 0; s < Sets; s++)
- for (int w = 0; w < Ways; w++)
- {
- sets[s].nextway = 0;
- sets[s].lines[w].allocated = false;
- sets[s].lines[w].dirty = false;
- sets[s].lines[w].debug_address = 0;
- }
- last_set = -1;
- last_way = -1;
-}
-
-template<int TagBits, int SetBits, int WayBits, int LineBits>
-template<int ReadWrite>
-u8* cpucache<TagBits, SetBits, WayBits, LineBits>::search(u32 address)
-{
- const int addresset = (address & SetMask) >> LineBits;
- const int addrestag = address >> TagShift;
-
- for (int w = 0; w < Ways; w++)
- if ((sets[addresset].lines[w].allocated) && (sets[addresset].lines[w].tag == addrestag))
- {
- if (ReadWrite != 0)
- sets[addresset].lines[w].dirty = true;
- return sets[addresset].lines[w].data;
- }
- return nullptr;
-}
-
-template<int TagBits, int SetBits, int WayBits, int LineBits>
-template<int ReadWrite>
-bool cpucache<TagBits, SetBits, WayBits, LineBits>::allocate(u32 address, u8 **data)
-{
- const int addresset = (address & SetMask) >> LineBits;
- const int addrestag = address >> TagShift;
- const int victimway = sets[addresset].nextway;
- bool old_allocated, old_dirty;
- bool ret;
-
- sets[addresset].nextway = (victimway + 1) & WayMask; // decide wich way will be allocated next
- old_allocated = sets[addresset].lines[victimway].allocated;
- old_dirty = sets[addresset].lines[victimway].dirty;
- writeback_base = (sets[addresset].lines[victimway].tag << TagShift) | (address & SetMask);
- sets[addresset].lines[victimway].tag = addrestag;
- sets[addresset].lines[victimway].allocated = true;
- if (ReadWrite == 0)
- sets[addresset].lines[victimway].dirty = false; // caller must write back the cacheline if told so
- else
- sets[addresset].lines[victimway].dirty = true; // line is allocated to write into it
- *data = sets[addresset].lines[victimway].data;
- sets[addresset].lines[victimway].debug_address = address;
- ret = old_allocated; // ret = old_allocated && old_dirty
- if (!old_dirty)
- ret = false;
- return ret; // true if caller must write back the cacheline
-}
-
-template<int TagBits, int SetBits, int WayBits, int LineBits>
-u32 cpucache<TagBits, SetBits, WayBits, LineBits>::old()
-{
- return writeback_base;
-}
-
-template<int TagBits, int SetBits, int WayBits, int LineBits>
-u32 cpucache<TagBits, SetBits, WayBits, LineBits>::base(u32 address)
-{
- return address & ~LineMask;
-}
-
-template<int TagBits, int SetBits, int WayBits, int LineBits>
-u32 cpucache<TagBits, SetBits, WayBits, LineBits>::address(u32 tag, u32 set, u32 offset)
-{
- return (tag << TagShift) | (set << LineBits) | offset;
-}
-
-template<int TagBits, int SetBits, int WayBits, int LineBits>
-u8* cpucache<TagBits, SetBits, WayBits, LineBits>::first_dirty(u32 &base, bool clean)
-{
- for (int s = 0; s < Sets; s++)
- for (int w = 0; w < Ways; w++)
- if (sets[s].lines[w].dirty == true)
- {
- if (clean)
- sets[s].lines[w].dirty = false;
- last_set = s;
- last_way = w;
- base = address(sets[s].lines[w].tag, s, 0);
- return sets[s].lines[w].data;
- }
- return nullptr;
-}
-
-template<int TagBits, int SetBits, int WayBits, int LineBits>
-u8* cpucache<TagBits, SetBits, WayBits, LineBits>::next_dirty(u32 &base, bool clean)
-{
- if (last_set < 0)
- return nullptr;
- while (true)
- {
- last_way++;
- if (last_way == Ways)
- {
- last_way = 0;
- last_set++;
- if (last_set == Sets)
- {
- last_set = -1;
- last_way = -1;
- return nullptr;
- }
- }
- if (sets[last_set].lines[last_way].dirty == true)
- {
- if (clean)
- sets[last_set].lines[last_way].dirty = false;
- base = address(sets[last_set].lines[last_way].tag, last_set, 0);
- return sets[last_set].lines[last_way].data;
- }
- }
-}
-
-#endif
-
-/* To test it outside of Mame
-const int memorysize = 256 * 1024;
-u8 memory[memorysize];
-
-void readline(u8 *data, u32 address)
-{
- for (int n = 0; n < 64; n++)
- data[n] = memory[address + n];
-}
-
-void writeline(u8 *data, u32 address)
-{
- for (int n = 0; n < 64; n++)
- memory[address + n] = data[n];
-}
-
-void cache_tester()
-{
- cpucache<18, 8, 6, 2> cache;
- bool r;
- u8 *data;
- int address;
- u8 value;
-
- for (int n = 0; n < memorysize; n++)
- memory[n] = 0xaa ^ n;
- address = std::rand() & (memorysize - 1);
- r = cache.search(address, &data);
- if (r == false)
- {
- r = cache.allocate(address, &data);
- if (r == true)
- writeline(data, cache.base(address));
- readline(data, cache.base(address));
- }
- value = data[address & 63];
- if (value != memory[address])
- printf("Error reading address %d\n\r", address);
-}
-*/
diff --git a/src/devices/cpu/i386/cpuidmsrs.hxx b/src/devices/cpu/i386/cpuidmsrs.hxx
index 842ff85b4b2..e7abcf27154 100644
--- a/src/devices/cpu/i386/cpuidmsrs.hxx
+++ b/src/devices/cpu/i386/cpuidmsrs.hxx
@@ -1,5 +1,3 @@
-// license:BSD-3-Clause
-// copyright-holders:Ville Linde, Barry Rodewald, Carl, Philip Bennett, Samuele Zannoli
uint64_t pentium_device::opcode_rdmsr(bool &valid_msr)
{
@@ -255,85 +253,49 @@ void athlonxp_device::opcode_cpuid()
uint64_t athlonxp_device::opcode_rdmsr(bool &valid_msr)
{
- uint64_t ret;
uint32_t offset = REG32(ECX);
- ret = 0;
switch (offset)
{
case 0x10: // TSC
break;
case 0x1b: // APIC_BASE
break;
- case 0xfe: // MTRRcap
- // 7-0 MTRRCapVCnt - Number of variable range MTRRs (8)
- // 8 MtrrCapFix - Fixed range MTRRs available (1)
- // 10 MtrrCapWc - Write combining memory type available (1)
- ret = 0x508;
- break;
case 0x17b: // MCG_CTL
break;
case 0x200: // MTRRphysBase0-7
- case 0x202:
- case 0x204:
- case 0x206:
- case 0x208:
- case 0x20a:
- case 0x20c:
- case 0x20e:
- // 7-0 Type - Memory type for this memory range
- // 39-12 PhyBase27-0 - Base address for this memory range
- /* Format of type field:
- Bits 2-0 specify the memory type with the following encoding
- 0 UC Uncacheable
- 1 WC Write Combining
- 4 WT Write Through
- 5 WP Write Protect
- 6 WB Write Back
- 7 UC Uncacheable used only in PAT register
- Bit 3 WrMem 1 write to memory 0 write to mmio, present only in fixed range MTRRs
- Bit 4 RdMem 1 read from memory 0 read from mmio, present only in fixed range MTRRs
- Other bits are unused
- */
- break;
case 0x201: // MTRRphysMask0-7
+ case 0x202:
case 0x203:
+ case 0x204:
case 0x205:
+ case 0x206:
case 0x207:
+ case 0x208:
case 0x209:
+ case 0x20a:
case 0x20b:
+ case 0x20c:
case 0x20d:
+ case 0x20e:
case 0x20f:
- // 11 Valid - Memory range active
- // 39-12 PhyMask27-0 - Address mask
break;
case 0x2ff: // MTRRdefType
- // 7-0 MtrrDefMemType - Default memory type
- // 10 MtrrDefTypeFixEn - Enable fixed range MTRRs
- // 11 MtrrDefTypeEn - Enable MTRRs
break;
case 0x250: // MTRRfix64K_00000
- // 8 bits for each 64k block starting at address 0
- ret = m_msr_mtrrfix[0];
break;
case 0x258: // MTRRfix16K_80000
- // 8 bits for each 16k block starting at address 0x80000
- ret = m_msr_mtrrfix[1];
break;
case 0x259: // MTRRfix16K_A0000
- // 8 bits for each 16k block starting at address 0xa0000
- ret = m_msr_mtrrfix[2];
- break;
- case 0x268: // MTRRfix4K_C0000
- case 0x269: // MTRRfix4K_C8000
- case 0x26a: // MTRRfix4K_D0000
- case 0x26b: // MTRRfix4K_D8000
- case 0x26c: // MTRRfix4K_E0000
- case 0x26d: // MTRRfix4K_E8000
- case 0x26e: // MTRRfix4K_F0000
- case 0x26f: // MTRRfix4K_F8000
- // 8 bits for each 4k block
- ret = m_msr_mtrrfix[3 + offset - 0x268];
+ break;
+ case 0x268: // MTRRfix4K_C0000-F8000
+ case 0x269:
+ case 0x26a:
+ case 0x26b:
+ case 0x26c:
+ case 0x26d:
+ case 0x26e:
+ case 0x26f:
break;
case 0x400: // MC0_CTL
break;
@@ -344,25 +306,15 @@ uint64_t athlonxp_device::opcode_rdmsr(bool &valid_msr)
case 0x40c: // MC3_CTL
break;
case 0xC0010010: // SYS_CFG
- // 20 MtrrVarDramEn - Enable top of memory address and I/O range registers
- // 19 MtrrFixDramModEn - Enable modification of RdDram and WrDram bits in fixed MTRRs
- // 18 MtrrFixDramEn - Enable RdDram and WrDram attributes in fixed MTRRs
break;
case 0xC0010015: // HWCR
break;
- case 0xC0010016: // IORRBase0-1
+ case 0xC0010016: // IORRBase
+ case 0xC0010017: // IORRMask
case 0xC0010018:
- // 39-12 Base27-0 - Base address for this memory range
- // 4 RdDram - Read from DRAM
- // 3 WrDram - Write to DRAM
- break;
- case 0xC0010017: // IORRMask0-1
case 0xC0010019:
- // 39-12 Mask27-0 - Address mask
- // 11 V - Register enabled
break;
case 0xC001001A: // TOP_MEM
- // 39-23 TOM16-0 - Top of Memory, accesses from this address onward are directed to mmio
break;
case 0xC001001D: // TOP_MEM2
break;
@@ -370,7 +322,7 @@ uint64_t athlonxp_device::opcode_rdmsr(bool &valid_msr)
break;
}
valid_msr = true;
- return ret;
+ return 0;
}
void athlonxp_device::opcode_wrmsr(uint64_t data, bool &valid_msr)
@@ -403,16 +355,10 @@ void athlonxp_device::opcode_wrmsr(uint64_t data, bool &valid_msr)
case 0x2ff: // MTRRdefType
break;
case 0x250: // MTRRfix64K_00000
- m_msr_mtrrfix[0] = data;
- parse_mtrrfix(data, 0, 64);
break;
case 0x258: // MTRRfix16K_80000
- m_msr_mtrrfix[1] = data;
- parse_mtrrfix(data, 0x80000, 16);
break;
case 0x259: // MTRRfix16K_A0000
- m_msr_mtrrfix[2] = data;
- parse_mtrrfix(data, 0xa0000, 16);
break;
case 0x268: // MTRRfix4K_C0000-F8000
case 0x269:
@@ -422,8 +368,6 @@ void athlonxp_device::opcode_wrmsr(uint64_t data, bool &valid_msr)
case 0x26d:
case 0x26e:
case 0x26f:
- m_msr_mtrrfix[3 + offset - 0x268] = data;
- parse_mtrrfix(data, 0xc0000 + (offset - 0x268) * 0x8000, 4);
break;
case 0x400: // MC0_CTL
break;
diff --git a/src/devices/cpu/i386/i386.cpp b/src/devices/cpu/i386/i386.cpp
index f372dba1239..a4408c69175 100644
--- a/src/devices/cpu/i386/i386.cpp
+++ b/src/devices/cpu/i386/i386.cpp
@@ -3367,10 +3367,15 @@ 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>();
+ 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(address); };
+ m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
} else {
- macache32 = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
+ 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(address); };
+ m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
}
m_io = &space(AS_IO);
@@ -4721,10 +4726,6 @@ void athlonxp_device::device_reset()
m_cpuid_id2 = ('D' << 24) | ('M' << 16) | ('A' << 8) | 'c'; // cAMD
memset(m_processor_name_string, 0, 48);
strcpy((char *)m_processor_name_string, "AMD Athlon(tm) Processor");
- for (int n = 0; n < 11; n++)
- m_msr_mtrrfix[n] = 0;
- for (int n = 0; n < (1024 / 4); n++)
- m_memory_ranges_1m[n] = 0; // change the 0 to 6 to test the cache just after reset
m_cpuid_max_input_value_eax = 0x01;
m_cpu_version = REG32(EDX);
@@ -4735,227 +4736,6 @@ void athlonxp_device::device_reset()
CHANGE_PC(m_eip);
}
-void athlonxp_device::parse_mtrrfix(u64 mtrr, offs_t base, int kblock)
-{
- int nb = kblock / 4;
- int range = (int)(base >> 12); // base must never be higher than 1 megabyte
-
- for (int n = 0; n < 8; n++)
- {
- uint8_t type = mtrr & 0xff;
-
- for (int b = 0; b < nb; b++)
- {
- m_memory_ranges_1m[range] = type;
- range++;
- }
- mtrr = mtrr >> 8;
- }
-}
-
-int athlonxp_device::check_cacheable(offs_t address)
-{
- offs_t block;
- int disabled;
-
- disabled = 0;
- if (m_cr[0] & (1 << 30))
- disabled = 128;
- if (address >= 0x100000)
- return disabled;
- block = address >> 12;
- return m_memory_ranges_1m[block] | disabled;
-}
-
-template <class dt, offs_t xorle>
-dt athlonxp_device::opcode_read_cache(offs_t address)
-{
- int mode = check_cacheable(address);
- bool nocache = false;
- u8 *data;
-
- if ((mode & 7) == 0)
- nocache = true;
- if (mode & 1)
- nocache = true;
- if (nocache == false)
- {
- int offset = (address & 63) ^ xorle;
- data = cache.search<CacheRead>(address);
- if (data)
- return *(dt *)(data + offset);
- if (!(mode & 128))
- {
- bool dirty = cache.allocate<CacheRead>(address, &data);
- address = cache.base(address);
- if (dirty)
- {
- offs_t old_address = cache.old();
-
- for (int w = 0; w < 64; w += 4)
- macache32->write_dword(old_address + w, *(u32 *)(data + w));
- }
- for (int r = 0; r < 64; r += 4)
- *(u32 *)(data + r) = macache32->read_dword(address + r);
- return *(dt *)(data + offset);
- }
- else
- {
- if (sizeof(dt) == 1)
- return macache32->read_byte(address);
- else if (sizeof(dt) == 2)
- return macache32->read_word(address);
- else
- return macache32->read_dword(address);
- }
- }
- else
- {
- if (sizeof(dt) == 1)
- return macache32->read_byte(address);
- else if (sizeof(dt) == 2)
- return macache32->read_word(address);
- else
- return macache32->read_dword(address);
- }
-}
-
-template <class dt, offs_t xorle>
-dt athlonxp_device::program_read_cache(offs_t address)
-{
- int mode = check_cacheable(address);
- bool nocache = false;
- u8 *data;
-
- if ((mode & 7) == 0)
- nocache = true;
- if (mode & 1)
- nocache = true;
- if (nocache == false)
- {
- int offset = (address & 63) ^ xorle;
- data = cache.search<CacheRead>(address);
- if (data)
- return *(dt *)(data + offset);
- if (!(mode & 128))
- {
- bool dirty = cache.allocate<CacheRead>(address, &data);
- address = cache.base(address);
- if (dirty)
- {
- offs_t old_address = cache.old();
-
- for (int w = 0; w < 64; w += 4)
- m_program->write_dword(old_address + w, *(u32 *)(data + w));
- }
- for (int r = 0; r < 64; r += 4)
- *(u32 *)(data + r) = m_program->read_dword(address + r);
- return *(dt *)(data + offset);
- }
- else
- {
- if (sizeof(dt) == 1)
- return m_program->read_byte(address);
- else if (sizeof(dt) == 2)
- return m_program->read_word(address);
- else
- return m_program->read_dword(address);
- }
- }
- else
- {
- if (sizeof(dt) == 1)
- return m_program->read_byte(address);
- else if (sizeof(dt) == 2)
- return m_program->read_word(address);
- else
- return m_program->read_dword(address);
- }
-}
-
-template <class dt, offs_t xorle>
-void athlonxp_device::program_write_cache(offs_t address, dt data)
-{
- int mode = check_cacheable(address);
- bool nocache = false;
- u8 *dataw;
-
- if ((mode & 7) == 0)
- nocache = true;
- if (mode & 1)
- nocache = true;
- if (nocache == false)
- {
- int offset = (address & 63) ^ xorle;
- dataw = cache.search<CacheWrite>(address);
- if (dataw)
- {
- *(dt *)(dataw + offset) = data;
- return;
- }
- if (!(mode & 128))
- {
- bool dirty = cache.allocate<CacheWrite>(address, &dataw);
- address = cache.base(address);
- if (dirty)
- {
- offs_t old_address = cache.old();
-
- for (int w = 0; w < 64; w += 4)
- m_program->write_dword(old_address + w, *(u32 *)(dataw + w));
- }
- for (int r = 0; r < 64; r += 4)
- *(u32 *)(dataw + r) = m_program->read_dword(address + r);
- *(dt *)(dataw + offset) = data;
- }
- else
- {
- if (sizeof(dt) == 1)
- m_program->write_byte(address, data);
- else if (sizeof(dt) == 2)
- m_program->write_word(address, data);
- else
- m_program->write_dword(address, data);
- }
- }
- else
- {
- if (sizeof(dt) == 1)
- m_program->write_byte(address, data);
- else if (sizeof(dt) == 2)
- m_program->write_word(address, data);
- else
- m_program->write_dword(address, data);
- }
-}
-
-void athlonxp_device::invalidate_cache(bool writeback)
-{
- u32 base;
- u8 *data;
-
- data = cache.first_dirty(base, true);
- while (data != nullptr)
- {
- if (writeback)
- for (int w = 0; w < 64; w += 4)
- m_program->write_dword(base + w, *(u32 *)(data + w));
- data = cache.next_dirty(base, true);
- }
- cache.reset();
-}
-
-void athlonxp_device::opcode_invd()
-{
- invalidate_cache(false);
-}
-
-void athlonxp_device::opcode_wbinvd()
-{
- invalidate_cache(true);
-}
-
-
/*****************************************************************************/
/* Intel Pentium 4 */
diff --git a/src/devices/cpu/i386/i386.h b/src/devices/cpu/i386/i386.h
index 90aab9f0667..e7a460488c0 100644
--- a/src/devices/cpu/i386/i386.h
+++ b/src/devices/cpu/i386/i386.h
@@ -16,7 +16,6 @@
#include "divtlb.h"
#include "i386dasm.h"
-#include "cache.h"
#define INPUT_LINE_A20 1
#define INPUT_LINE_SMI 2
@@ -72,24 +71,10 @@ protected:
virtual int get_mode() const override;
// routines for opcodes whose operation can vary between cpu models
- // default implementations usually just log an error message
+ // default implementations just log an error message
virtual void opcode_cpuid();
virtual uint64_t opcode_rdmsr(bool &valid_msr);
virtual void opcode_wrmsr(uint64_t data, bool &valid_msr);
- virtual void opcode_invd() {}
- virtual void opcode_wbinvd() {}
-
- // 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_prd8(offs_t address) { return m_program->read_byte(address); }
- virtual u16 mem_prd16(offs_t address) { return m_program->read_word(address); }
- virtual u32 mem_prd32(offs_t address) { return m_program->read_dword(address); }
- virtual void mem_pwd8(offs_t address, u8 data) { m_program->write_byte(address, data); }
- virtual void mem_pwd16(offs_t address, u16 data) { m_program->write_word(address, data); }
- virtual void mem_pwd32(offs_t address, u32 data) { m_program->write_dword(address, data); }
address_space_config m_program_config;
address_space_config m_io_config;
@@ -295,10 +280,11 @@ protected:
uint8_t m_irq_state;
address_space *m_program;
+ std::function<u8 (offs_t)> m_pr8;
+ std::function<u16 (offs_t)> m_pr16;
+ std::function<u32 (offs_t)> m_pr32;
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;
int m_cpuid_max_input_value_eax; // Highest CPUID standard function available
uint32_t m_cpuid_id0, m_cpuid_id1, m_cpuid_id2;
@@ -1509,13 +1495,9 @@ class i386sx_device : public i386_device
public:
// construction/destruction
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); };
};
+
class i486_device : public i386_device
{
public:
@@ -1632,34 +1614,10 @@ protected:
virtual void opcode_cpuid() override;
virtual uint64_t opcode_rdmsr(bool &valid_msr) override;
virtual void opcode_wrmsr(uint64_t data, bool &valid_msr) override;
- virtual void opcode_invd() override;
- virtual void opcode_wbinvd() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual u8 mem_pr8(offs_t address) override { return opcode_read_cache<u8, NATIVE_ENDIAN_VALUE_LE_BE(0, 3)>(address); }
- virtual u16 mem_pr16(offs_t address) override { return opcode_read_cache<u16, NATIVE_ENDIAN_VALUE_LE_BE(0, 2)>(address); }
- virtual u32 mem_pr32(offs_t address) override { return opcode_read_cache<u32, 0>(address); }
- virtual u8 mem_prd8(offs_t address) override { return program_read_cache<u8, NATIVE_ENDIAN_VALUE_LE_BE(0, 3)>(address); }
- virtual u16 mem_prd16(offs_t address) override { return program_read_cache<u16, NATIVE_ENDIAN_VALUE_LE_BE(0, 2)>(address); }
- virtual u32 mem_prd32(offs_t address) override { return program_read_cache<u32, 0>(address); }
- virtual void mem_pwd8(offs_t address, u8 data) override { program_write_cache<u8, NATIVE_ENDIAN_VALUE_LE_BE(0, 3)>(address, data); }
- virtual void mem_pwd16(offs_t address, u16 data) override { program_write_cache<u16, NATIVE_ENDIAN_VALUE_LE_BE(0, 2)>(address, data); }
- virtual void mem_pwd32(offs_t address, u32 data) override { program_write_cache<u32, 0>(address, data); }
-
-private:
- void parse_mtrrfix(u64 mtrr, offs_t base, int kblock);
- int check_cacheable(offs_t address);
- void invalidate_cache(bool writeback);
-
- template <class dt, offs_t xorle> dt opcode_read_cache(offs_t address);
- template <class dt, offs_t xorle> dt program_read_cache(offs_t address);
- template <class dt, offs_t xorle> void program_write_cache(offs_t address, dt data);
-
uint8_t m_processor_name_string[48];
- uint64_t m_msr_mtrrfix[11];
- uint8_t m_memory_ranges_1m[1024 / 4];
- cpucache<17, 9, Cache2Way, CacheLineBytes64> cache; // 512 sets, 2 ways (cachelines per set), 64 bytes per cacheline
};
diff --git a/src/devices/cpu/i386/i386priv.h b/src/devices/cpu/i386/i386priv.h
index 0343cf74ef1..954e49ee6c7 100644
--- a/src/devices/cpu/i386/i386priv.h
+++ b/src/devices/cpu/i386/i386priv.h
@@ -386,7 +386,7 @@ uint8_t i386_device::FETCH()
if(!translate_address(m_CPL,TRANSLATE_FETCH,&address,&error))
PF_THROW(error);
- value = mem_pr8(address & m_a20_mask);
+ value = m_pr8(address & m_a20_mask);
#ifdef DEBUG_MISSING_OPCODE
m_opcode_bytes[m_opcode_bytes_length] = value;
m_opcode_bytes_length = (m_opcode_bytes_length + 1) & 15;
@@ -407,7 +407,7 @@ uint16_t i386_device::FETCH16()
if(!translate_address(m_CPL,TRANSLATE_FETCH,&address,&error))
PF_THROW(error);
address &= m_a20_mask;
- value = mem_pr16(address);
+ value = m_pr16(address);
m_eip += 2;
m_pc += 2;
}
@@ -428,7 +428,7 @@ uint32_t i386_device::FETCH32()
PF_THROW(error);
address &= m_a20_mask;
- value = mem_pr32(address);
+ value = m_pr32(address);
m_eip += 4;
m_pc += 4;
}
@@ -443,7 +443,7 @@ uint8_t i386_device::READ8(uint32_t ea)
PF_THROW(error);
address &= m_a20_mask;
- return mem_prd8(address);
+ return m_program->read_byte(address);
}
uint16_t i386_device::READ16(uint32_t ea)
{
@@ -458,7 +458,7 @@ uint16_t i386_device::READ16(uint32_t ea)
PF_THROW(error);
address &= m_a20_mask;
- value = mem_prd16( address );
+ value = m_program->read_word( address );
}
return value;
}
@@ -477,7 +477,7 @@ uint32_t i386_device::READ32(uint32_t ea)
PF_THROW(error);
address &= m_a20_mask;
- value = mem_prd32( address );
+ value = m_program->read_dword( address );
}
return value;
}
@@ -501,8 +501,8 @@ uint64_t i386_device::READ64(uint32_t ea)
PF_THROW(error);
address &= m_a20_mask;
- value = (((uint64_t) mem_prd32( address+0 )) << 0);
- value |= (((uint64_t) mem_prd32( address+4 )) << 32);
+ value = (((uint64_t) m_program->read_dword( address+0 )) << 0);
+ value |= (((uint64_t) m_program->read_dword( address+4 )) << 32);
}
return value;
}
@@ -514,7 +514,7 @@ uint8_t i386_device::READ8PL0(uint32_t ea)
PF_THROW(error);
address &= m_a20_mask;
- return mem_prd8(address);
+ return m_program->read_byte(address);
}
uint16_t i386_device::READ16PL0(uint32_t ea)
{
@@ -529,7 +529,7 @@ uint16_t i386_device::READ16PL0(uint32_t ea)
PF_THROW(error);
address &= m_a20_mask;
- value = mem_prd16( address );
+ value = m_program->read_word( address );
}
return value;
}
@@ -549,7 +549,7 @@ uint32_t i386_device::READ32PL0(uint32_t ea)
PF_THROW(error);
address &= m_a20_mask;
- value = mem_prd32( address );
+ value = m_program->read_dword( address );
}
return value;
}
@@ -569,7 +569,7 @@ void i386_device::WRITE8(uint32_t ea, uint8_t value)
PF_THROW(error);
address &= m_a20_mask;
- mem_pwd8(address, value);
+ m_program->write_byte(address, value);
}
void i386_device::WRITE16(uint32_t ea, uint16_t value)
{
@@ -583,7 +583,7 @@ void i386_device::WRITE16(uint32_t ea, uint16_t value)
PF_THROW(error);
address &= m_a20_mask;
- mem_pwd16(address, value);
+ m_program->write_word(address, value);
}
}
void i386_device::WRITE32(uint32_t ea, uint32_t value)
@@ -600,7 +600,7 @@ void i386_device::WRITE32(uint32_t ea, uint32_t value)
PF_THROW(error);
ea &= m_a20_mask;
- mem_pwd32(address, value);
+ m_program->write_dword(address, value);
}
}
@@ -622,8 +622,8 @@ void i386_device::WRITE64(uint32_t ea, uint64_t value)
PF_THROW(error);
ea &= m_a20_mask;
- mem_pwd32(address+0, value & 0xffffffff);
- mem_pwd32(address+4, (value >> 32) & 0xffffffff);
+ m_program->write_dword(address+0, value & 0xffffffff);
+ m_program->write_dword(address+4, (value >> 32) & 0xffffffff);
}
}
diff --git a/src/devices/cpu/i386/i486ops.hxx b/src/devices/cpu/i386/i486ops.hxx
index 6946e463796..77e9ee3dd2d 100644
--- a/src/devices/cpu/i386/i486ops.hxx
+++ b/src/devices/cpu/i386/i486ops.hxx
@@ -44,15 +44,13 @@ void i386_device::i486_cpuid() // Opcode 0x0F A2
void i386_device::i486_invd() // Opcode 0x0f 08
{
- // TODO: manage the cache if present
- opcode_invd();
+ // Nothing to do ?
CYCLES(CYCLES_INVD);
}
void i386_device::i486_wbinvd() // Opcode 0x0f 09
{
- // TODO: manage the cache if present
- opcode_wbinvd();
+ // Nothing to do ?
}
void i386_device::i486_cmpxchg_rm8_r8() // Opcode 0x0f b0
@@ -235,8 +233,6 @@ void i386_device::i486_group0F01_16() // Opcode 0x0f 01
ea = GetEA(modrm,1);
}
WRITE16(ea, m_gdtr.limit);
- // Win32s requires all 32 bits to be stored here, despite various Intel docs
- // claiming that the upper 8 bits are either zeroed or undefined in 16-bit mode
WRITE32(ea + 2, m_gdtr.base);
CYCLES(CYCLES_SGDT);
break;
diff --git a/src/devices/cpu/i386/pentops.hxx b/src/devices/cpu/i386/pentops.hxx
index b44ce8c40ed..d5f6f6ca592 100644
--- a/src/devices/cpu/i386/pentops.hxx
+++ b/src/devices/cpu/i386/pentops.hxx
@@ -203,7 +203,6 @@ void i386_device::pentium_prefetch_m8() // Opcode 0x0f 18
{
uint8_t modrm = FETCH();
uint32_t ea = GetEA(modrm,0);
- // TODO: manage the cache if present
CYCLES(1+(ea & 1)); // TODO: correct cycle count
}
@@ -1046,7 +1045,7 @@ void i386_device::pentium_movnti_m16_r16() // Opcode 0f c3
// unsupported by cpu
CYCLES(1); // TODO: correct cycle count
} else {
- // TODO: manage the cache if present
+ // since cache is not implemented
uint32_t ea = GetEA(modrm, 0);
WRITE16(ea,LOAD_RM16(modrm));
CYCLES(1); // TODO: correct cycle count
@@ -1060,7 +1059,7 @@ void i386_device::pentium_movnti_m32_r32() // Opcode 0f c3
// unsupported by cpu
CYCLES(1); // TODO: correct cycle count
} else {
- // TODO: manage the cache if present
+ // since cache is not implemented
uint32_t ea = GetEA(modrm, 0);
WRITE32(ea,LOAD_RM32(modrm));
CYCLES(1); // TODO: correct cycle count
@@ -1117,7 +1116,7 @@ void i386_device::pentium_movntq_m64_r64() // Opcode 0f e7
if( modrm >= 0xc0 ) {
CYCLES(1); // unsupported
} else {
- // TODO: manage the cache if present
+ // since cache is not implemented
uint32_t ea = GetEA(modrm, 0);
WRITEMMX(ea, MMX((modrm >> 3) & 0x7));
CYCLES(1); // TODO: correct cycle count
@@ -3318,7 +3317,7 @@ void i386_device::sse_movntps_m128_r128() // Opcode 0f 2b
// unsupported by cpu
CYCLES(1); // TODO: correct cycle count
} else {
- // TODO: manage the cache if present
+ // since cache is not implemented
uint32_t ea = GetEA(modrm, 0);
WRITEXMM(ea, XMM((modrm >> 3) & 0x7));
CYCLES(1); // TODO: correct cycle count
@@ -5963,7 +5962,7 @@ void i386_device::sse_movntdq_m128_r128() // Opcode 66 0f e7
if( modrm >= 0xc0 ) {
CYCLES(1); // unsupported
} else {
- // TODO: manage the cache if present
+ // since cache is not implemented
uint32_t ea = GetEA(modrm, 0);
WRITEXMM(ea, XMM((modrm >> 3) & 0x7));
CYCLES(1); // TODO: correct cycle count
@@ -6277,7 +6276,7 @@ void i386_device::sse_movntpd_m128_r128() // Opcode 66 0f 2b
// unsupported by cpu
CYCLES(1); // TODO: correct cycle count
} else {
- // TODO: manage the cache if present
+ // since cache is not implemented
uint32_t ea = GetEA(modrm, 0);
WRITEXMM(ea, XMM((modrm >> 3) & 0x7));
CYCLES(1); // TODO: correct cycle count
diff --git a/src/devices/cpu/i8089/i8089.cpp b/src/devices/cpu/i8089/i8089.cpp
index 7e9371de36c..cf694d53cfb 100644
--- a/src/devices/cpu/i8089/i8089.cpp
+++ b/src/devices/cpu/i8089/i8089.cpp
@@ -16,7 +16,7 @@
// MACROS/CONSTANTS
//**************************************************************************
-#define VERBOSE 0
+#define VERBOSE 1
//**************************************************************************
diff --git a/src/devices/cpu/i8089/i8089_channel.cpp b/src/devices/cpu/i8089/i8089_channel.cpp
index 02bb12daa8c..433a3ca792c 100644
--- a/src/devices/cpu/i8089/i8089_channel.cpp
+++ b/src/devices/cpu/i8089/i8089_channel.cpp
@@ -20,7 +20,7 @@
// MACROS/CONSTANTS
//**************************************************************************
-#define VERBOSE 0
+#define VERBOSE 1
#define VERBOSE_DMA 0
// channel control register fields
@@ -374,10 +374,11 @@ int i8089_channel_device::execute_run()
// do we need to read another byte?
if (BIT(m_r[PSW].w, 1) && !BIT(m_r[PSW].w, 0) && !m_store_hi)
{
- m_store_hi = true;
-
if (CC_SYNC == 0x02)
+ {
+ m_store_hi = true;
m_dma_state = DMA_WAIT_FOR_DEST_DRQ;
+ }
else
m_dma_state = DMA_STORE_BYTE_HIGH;
}
diff --git a/src/devices/cpu/i86/i186.cpp b/src/devices/cpu/i86/i186.cpp
index 48329288bf5..7738ee64d6c 100644
--- a/src/devices/cpu/i86/i186.cpp
+++ b/src/devices/cpu/i86/i186.cpp
@@ -173,22 +173,6 @@ void i80186_cpu_device::execute_run()
{
while(m_icount > 0 )
{
- if((m_dma[0].drq_state && (m_dma[0].control & ST_STOP)) || (m_dma[1].drq_state && (m_dma[1].control & ST_STOP)))
- {
- int channel = m_last_dma ? 0 : 1;
- m_last_dma = !m_last_dma;
- if(!(m_dma[1].drq_state && (m_dma[1].control & ST_STOP)))
- channel = 0;
- else if(!(m_dma[0].drq_state && (m_dma[0].control & ST_STOP)))
- channel = 1;
- else if((m_dma[0].control & CHANNEL_PRIORITY) && !(m_dma[1].control & CHANNEL_PRIORITY))
- channel = 0;
- else if((m_dma[1].control & CHANNEL_PRIORITY) && !(m_dma[0].control & CHANNEL_PRIORITY))
- channel = 1;
- m_icount--;
- drq_callback(channel);
- continue;
- }
if ( m_seg_prefix_next )
{
m_seg_prefix = true;
@@ -603,18 +587,6 @@ void i80186_cpu_device::device_start()
state_add( I80186_T_COUNT + 2, "T2_COUNT", m_timer[2].count ).formatstr("%04X");
state_add( I80186_T_MAX_A + 2, "T2_MAX", m_timer[2].maxA ).formatstr("%04X");
state_add( I80186_T_CONTROL + 2, "T2_CONTROL", m_timer[2].control ).formatstr("%04X");
- state_add( I80186_ISR, "ISR", m_intr.in_service ).formatstr("%04X");
- state_add( I80186_IRR, "IRR", m_intr.request ).formatstr("%04X");
- state_add( I80186_PMR, "PMR", m_intr.priority_mask ).formatstr("%04X");
- state_add( I80186_ICSR, "ICSR", m_intr.status ).formatstr("%04X");
- state_add( I80186_TMRCR, "TMRCR", m_intr.timer ).formatstr("%04X");
- state_add( I80186_D0CR, "D0CR", m_intr.dma[0] ).formatstr("%04X");
- state_add( I80186_D1CR, "D1CR", m_intr.dma[1] ).formatstr("%04X");
- state_add( I80186_I0CR, "I0CR", m_intr.ext[0] ).formatstr("%04X");
- state_add( I80186_I1CR, "I1CR", m_intr.ext[1] ).formatstr("%04X");
- state_add( I80186_I2CR, "I2CR", m_intr.ext[2] ).formatstr("%04X");
- state_add( I80186_I3CR, "I3CR", m_intr.ext[3] ).formatstr("%04X");
- state_add( I80186_POLL, "POLL", m_intr.poll_status ).formatstr("%04X");
// register for savestates
save_item(NAME(m_timer[0].control));
@@ -655,7 +627,6 @@ void i80186_cpu_device::device_start()
save_item(NAME(m_mem.middle_size));
save_item(NAME(m_mem.peripheral));
save_item(NAME(m_reloc));
- save_item(NAME(m_last_dma));
// zerofill
memset(m_timer, 0, sizeof(m_timer));
diff --git a/src/devices/cpu/i86/i186.h b/src/devices/cpu/i86/i186.h
index a968f5ef3dd..01960a619f5 100644
--- a/src/devices/cpu/i86/i186.h
+++ b/src/devices/cpu/i86/i186.h
@@ -22,8 +22,8 @@ public:
auto tmrout1_handler() { return m_out_tmrout1_func.bind(); }
IRQ_CALLBACK_MEMBER(int_callback);
- DECLARE_WRITE_LINE_MEMBER(drq0_w) { m_dma[0].drq_state = state; }
- DECLARE_WRITE_LINE_MEMBER(drq1_w) { m_dma[1].drq_state = state; }
+ DECLARE_WRITE_LINE_MEMBER(drq0_w) { if(state) drq_callback(0); m_dma[0].drq_state = state; }
+ DECLARE_WRITE_LINE_MEMBER(drq1_w) { if(state) drq_callback(1); m_dma[1].drq_state = state; }
DECLARE_WRITE_LINE_MEMBER(tmrin0_w) { if(state && (m_timer[0].control & 0x8004) == 0x8004) { inc_timer(0); } }
DECLARE_WRITE_LINE_MEMBER(tmrin1_w) { if(state && (m_timer[1].control & 0x8004) == 0x8004) { inc_timer(1); } }
DECLARE_WRITE_LINE_MEMBER(int0_w) { external_int(0, state); }
@@ -46,12 +46,7 @@ protected:
I80186_T_COUNT = I80186_DMA_CR + 2,
I80186_T_MAX_A = I80186_T_COUNT + 3,
I80186_T_MAX_B = I80186_T_MAX_A + 3,
- I80186_T_CONTROL = I80186_T_MAX_B + 2,
- I80186_ISR = I80186_T_CONTROL + 3,
- I80186_IRR, I80186_PMR, I80186_ICSR,
- I80186_TMRCR, I80186_D0CR, I80186_D1CR,
- I80186_I0CR, I80186_I1CR, I80186_I2CR, I80186_I3CR,
- I80186_POLL
+ I80186_T_CONTROL = I80186_T_MAX_B + 2
};
i80186_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int data_bus_size);
@@ -137,7 +132,6 @@ private:
dma_state m_dma[2];
intr_state m_intr;
mem_state m_mem;
- bool m_last_dma;
static const device_timer_id TIMER_INT0 = 0;
static const device_timer_id TIMER_INT1 = 1;
diff --git a/src/devices/cpu/i86/i86.cpp b/src/devices/cpu/i86/i86.cpp
index 4f1d6f07afd..d578c6f3a2c 100644
--- a/src/devices/cpu/i86/i86.cpp
+++ b/src/devices/cpu/i86/i86.cpp
@@ -317,7 +317,7 @@ void i8086_cpu_device::execute_run()
case 0xdd:
case 0xde:
case 0xdf:
- m_esc_opcode_handler(m_pc);
+ m_esc_opcode_handler(m_pc - 1);
m_modrm = fetch();
if(m_modrm < 0xc0)
m_esc_data_handler(get_ea(1, I8086_READ));
diff --git a/src/devices/cpu/m6502/dxavix2000.lst b/src/devices/cpu/m6502/dxavix2000.lst
index fc2e7bde133..c96f6987dd5 100644
--- a/src/devices/cpu/m6502/dxavix2000.lst
+++ b/src/devices/cpu/m6502/dxavix2000.lst
@@ -6,7 +6,7 @@ bpl_rel xavora_idy phx_imp orapa_imp asr_zpx ora_zpx asl_zpx
jsr_adr xavand_idx callf_xa3 andj_imp bit_zpg and_zpg rol_zpg andk_imp plp_imp and_imm rol_acc andl_imp bit_aba and_aba rol_aba andm_imp
bmi_rel xavand_idy plx_imp andpa_imp bit_zpx and_zpx rol_zpx andpb_imp sec_imp and_aby bit_imm lpa0_imp bit_abx and_abx rol_abx lpb0_imp
rti_xav_imp xaveor_idx nop_imp eorj_imp nop_imp eor_zpg lsr_zpg eork_imp pha_imp eor_imm lsr_acc eorl_imp jmp_adr eor_aba lsr_aba eorm_imp
-bvc_rel xaveor_idy phy_imp eorpa_imp nop_imp eor_zpx lsr_zpx eorpb_imp cli_imp eor_aby nop_imp spa1_imp jmp_xa3 eor_abx lsr_abx spb1_imp
+bvc_rel xaveor_idy phy_imp eorpa_imp nop_imp eor_zpx lsr_zpx eorpb_imp cli_imp eor_aby nop_imp spa1_imp callf_aba eor_abx lsr_abx spb1_imp
rts_imp xavadc_idx nop_imp adcj_imp nop_imp adc_zpg ror_zpg adck_imp pla_imp adc_imm ror_acc adcl_imp jmp_ind adc_aba ror_aba adcm_imp
bvs_rel xavadc_idy ply_imp adcpa_imp nop_imp adc_zpx ror_zpx adcpb_imp sei_imp adc_aby nop_imp lpa1_imp jmpf_ind adc_abx ror_abx lpb1_imp
retf_imp xavsta_idx stz_zpg staj_imp sty_zpg sta_zpg stx_zpg stak_imp dey_imp sev_imp txa_imp stal_imp sty_aba sta_aba stx_aba stam_imp
diff --git a/src/devices/cpu/m6502/oxavix.lst b/src/devices/cpu/m6502/oxavix.lst
index 437a86ffc5f..38b8eadee1a 100644
--- a/src/devices/cpu/m6502/oxavix.lst
+++ b/src/devices/cpu/m6502/oxavix.lst
@@ -18,14 +18,6 @@ callf_xa3
set_codebank(TMP2);
prefetch();
-jmp_xa3
- TMP2 = read_pc();
- TMP = read_pc();
- TMP = set_h(TMP, read_pc());
- PC = TMP;
- set_codebank(TMP2);
- prefetch();
-
retf_imp
read_pc_noinc();
read(SP);
diff --git a/src/devices/cpu/m6502/oxavix2000.lst b/src/devices/cpu/m6502/oxavix2000.lst
index 3341c6eccf2..c51b0263e1a 100644
--- a/src/devices/cpu/m6502/oxavix2000.lst
+++ b/src/devices/cpu/m6502/oxavix2000.lst
@@ -448,12 +448,8 @@ asr_zpg
prefetch();
asr_aba
- TMP = read_pc();
- TMP = set_h(TMP, read_pc());
- TMP2 = read(TMP);
- write(TMP, TMP2);
- TMP2 = do_asr(TMP2); // used by xavbox, see 14e8
- write(TMP, TMP2);
+ fatalerror("unhandled opcode %02x%04x: %02x\n", m_codebank, PPC, inst_state);
+ read_pc_noinc();
prefetch();
asr_zpx
@@ -480,6 +476,11 @@ sev_imp
P |= F_V;
prefetch();
+callf_aba
+ fatalerror("unhandled opcode %02x%04x: %02x\n", m_codebank, PPC, inst_state);
+ read_pc_noinc();
+ prefetch();
+
jmpf_ind
TMP = read_pc();
TMP = set_h(TMP, read_pc());
diff --git a/src/devices/cpu/m6502/xavix.h b/src/devices/cpu/m6502/xavix.h
index 3e20ec8a899..9b28a429dad 100644
--- a/src/devices/cpu/m6502/xavix.h
+++ b/src/devices/cpu/m6502/xavix.h
@@ -15,6 +15,7 @@
class xavix_device : public m6502_device {
public:
xavix_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ xavix_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
virtual void do_exec_full() override;
@@ -24,7 +25,6 @@ public:
// xaviv opcodes
O(callf_xa3);
- O(jmp_xa3);
O(retf_imp);
O(brk_xav_imp);
O(rti_xav_imp);
@@ -101,8 +101,6 @@ protected:
uint8_t m_codebank;
uint32_t XPC;
- xavix_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
uint32_t adr_with_codebank(uint16_t adr) { return adr | (get_codebank() << 16); }
virtual void device_start() override;
diff --git a/src/devices/cpu/m6502/xavix2000.cpp b/src/devices/cpu/m6502/xavix2000.cpp
index 94b56308e0d..0c928ce159d 100644
--- a/src/devices/cpu/m6502/xavix2000.cpp
+++ b/src/devices/cpu/m6502/xavix2000.cpp
@@ -7,8 +7,8 @@
The dies for these are marked
SSD 2000 NEC 85605-621
-
- SSD 2002 NEC 85054-611
+ and possibly
+ SSD 2002 NEC 85054-611 (although this might use even more opcodes and need it's own file)
6502 with custom opcodes
integrated gfx / sound
@@ -17,12 +17,77 @@
see xavix.cpp for basic notes
- the 2000 chip has more opcodes than the 97/98 chips in xavix.cpp, and
- is a similar die structure to the 2002 chip, but doesn't seem to have any
- additional capabilities.
-
- the 2002 chip seems to be the one that was officially dubbed 'SuperXaviX'
- and has additional video capabilities on top of the extended opcodes.
+ the machines using the '2000' series chips seem to have more extra
+ opcodes, so presumably these were only available in those models.
+ of note, push x / push y and pull x / pull y
+
+ Dirt Rebel MX, which is confirmed as 2000 type however seems to require
+ some of the documented but 'undocumented' opcodes on the 6502 to have additonal
+ meaning for one specific function on startup
+
+ this just seems to be some very buggy checksum code where the games don't even care about the result...
+ (actually it looks like some games might be using it as a PRNG seed?)
+
+ a is 80 when entering here?
+
+ 01BC37: A0 3F ldy #$3f
+ 01BC39: B2 clr a // clear acculuator
+ 01BC3A: 1B spa0 a // store 'accumulator' into byte 0 of PA 'address' register
+ 01BC3B: 9B spa2 a // store 'accumulator' into byte 2 of PA 'address' register
+
+ -- loop point 2
+ 01BC3C: 98 tya // y -> a (3f on first run of loop)
+ 01BC3D: 5B spa1 a // store 'accumulator' into byte 1 of PA 'address' register (003f00 on first loop?)
+
+ -- loop point 1
+ 01BC3E: A3 ldal0 a // read byte 0 of 32-bit 'long' register into accumulator
+ 01BC3F: 73 adcpa // adc ($Address PA)
+ 01BC40: 83 stal0 a // store accumulator back in byte 0 of 32-bit 'long' register (even byte checksum?)
+ 01BC41: FB incpa // increase 'address' register PA
+ 01BC42: A7 ldal1 a // read byte 1 of 32-bit 'long' register into accumulator
+ 01BC43: 73 adcpa // adc ($Address PA)
+ 01BC44: 87 stal1 a // store accumulator back in byte 0 of 32-bit 'long' register (odd byte checksum?)
+ 01BC45: FB incpa // increase 'address' register PA
+ 01BC46: D0 F6 bne $1bc3e // (branch based on PA increase, so PA must set flags?, probably overflows after 0xffff if upper byte is 'bank'? or at 0xff if this really is a mirror of the function below
+
+ 01BC48: 88 dey // decrease y, which contained 3f at the start
+ 01BC49: 10 F1 bpl $1bc3c // branch back to loop point 2 to reload counter
+
+ // contains the odd byte checksum once we drop out the loop
+ 01BC4B: 8D FB 00 sta $00fb // store it in zero page memory
+ 01BC4E: A3 ldal0 a // get the even byte checksum from byte 0 of 32-bit 'long' register
+ 01BC4F: 8D FA 00 sta $00fa // store it in zero page memory
+ 01BC52: 07 oral1 a // why do we want to do this? (routine below does it too)
+ 01BC53: D0 03 bne $1bc58
+ 01BC55: CE FA 00 dec $00fa
+ 01BC58: 80 retf
+
+ this is presumably meant to be similar to the function found in Namco
+ Nostalgia 2
+
+ // A is 80 on entry
+ 09FFD8: A9 3F lda #$3f
+ 09FFDA: 85 01 sta $01 // set upper bit of pointer at 0x0000 to 3f (it completely fails to initialize the ram at 00, we currently init it to ff, but should probably be 0?)
+ 09FFDC: A0 00 ldy #$00 // clear inner loop counter
+ -- loop point 1 and 2
+ 09FFDE: AD FA 00 lda $00fa // read current even byte checksum value from zero page ram fa (game also completely fails to initialize this)
+ 09FFE1: 71 00 adc ($00), y // so 3f00 + y first outer loop, 3e00 + y second outer loop with y increasing in inner loop (add byte read to even checksum byte?)
+ 09FFE3: 8D FA 00 sta $00fa // store even checksum at 0xfa in zero page ram
+ 09FFE6: C8 iny // increase counter y
+ 09FFE7: AD FB 00 lda $00fb // read current odd byte checksum value from zero page ram fb (likewise never initialized!)
+ 09FFEA: 71 00 adc ($00), y // 3f00 + y (add byte read to odd checksum byte)
+ 09FFEC: 8D FB 00 sta $00fb // store odd checksum byte at 0xfb in zero page ram
+ 09FFEF: C8 iny // increase y
+ 09FFF0: D0 EC bne $9ffde // branch back if y hasn't overflowed (so work on 0x100 bytes, looping back 0x7f times)
+ 09FFF2: C6 01 dec $01 // decrease accumulator (started at 3f) (inner loop counter already 0 because it overflowed)
+ 09FFF4: 10 E8 bpl $9ffde // branch back
+
+ // checksums are already in place after loop so no need to copy them like in above
+ 09FFF6: 0D FA 00 ora $00fa // same weird 'or' call
+ --
+ 09FFF9: D0 03 bne $9fffe
+ 09FFFB: CE FA 00 dec $00fa
+ 09FFFE: 80 retf
***************************************************************************/
@@ -31,13 +96,10 @@
#include "xavix2000.h"
#include "xavix2000d.h"
-DEFINE_DEVICE_TYPE(XAVIX2000, xavix2000_device, "xavix2000", "XaviX (SSD 2000)")
-DEFINE_DEVICE_TYPE(XAVIX2002, xavix2002_device, "xavix2002", "XaviX (SSD 2002) (SuperXaviX)")
-
-
+DEFINE_DEVICE_TYPE(XAVIX2000, xavix2000_device, "xavix2000", "XaviX (SSD 2000 / 2002)")
-xavix2000_device::xavix2000_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
- xavix_device(mconfig, type, tag, owner, clock)
+xavix2000_device::xavix2000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ xavix_device(mconfig, XAVIX2000, tag, owner, clock)
{
program_config.m_addr_width = 24;
program_config.m_logaddr_width = 24;
@@ -45,17 +107,6 @@ xavix2000_device::xavix2000_device(const machine_config &mconfig, device_type ty
sprogram_config.m_logaddr_width = 24;
}
-xavix2000_device::xavix2000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- xavix2000_device(mconfig, XAVIX2000, tag, owner, clock)
-{
-}
-
-xavix2002_device::xavix2002_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- xavix2000_device(mconfig, XAVIX2002, tag, owner, clock)
-{
-}
-
-
void xavix2000_device::device_start()
{
xavix_device::device_start();
diff --git a/src/devices/cpu/m6502/xavix2000.h b/src/devices/cpu/m6502/xavix2000.h
index 425c15c8816..6eec3db88d5 100644
--- a/src/devices/cpu/m6502/xavix2000.h
+++ b/src/devices/cpu/m6502/xavix2000.h
@@ -17,9 +17,6 @@ public:
xavix2000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
-
-protected:
- xavix2000_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void do_exec_full() override;
virtual void do_exec_partial() override;
@@ -139,6 +136,7 @@ protected:
O(cmc_imp);
O(sev_imp);
+ O(callf_aba);
O(jmpf_ind);
#undef O
@@ -162,13 +160,6 @@ enum {
SXAVIX_PB
};
-class xavix2002_device : public xavix2000_device {
-public:
- xavix2002_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-};
-
-
DECLARE_DEVICE_TYPE(XAVIX2000, xavix2000_device)
-DECLARE_DEVICE_TYPE(XAVIX2002, xavix2002_device)
#endif // MAME_CPU_M6502_XAVIX2000_H
diff --git a/src/devices/cpu/m68000/m68000.h b/src/devices/cpu/m68000/m68000.h
index 0ee41f348b5..0596dd07976 100644
--- a/src/devices/cpu/m68000/m68000.h
+++ b/src/devices/cpu/m68000/m68000.h
@@ -148,7 +148,6 @@ public:
void set_tas_write_callback(write8_delegate callback);
uint16_t get_fc();
void set_hmmu_enable(int enable);
- int get_pmmu_enable() {return m_pmmu_enabled;};
void set_fpu_enable(int enable);
void set_buserror_details(uint32_t fault_addr, uint8_t rw, uint8_t fc);
@@ -350,8 +349,6 @@ protected:
#include "m68kops.h"
#include "m68kfpu.hxx"
#include "m68kmmu.h"
-
- virtual void m68k_reset_peripherals() { }
};
@@ -378,6 +375,21 @@ protected:
const device_type type, uint32_t prg_data_width, uint32_t prg_address_bits, address_map_constructor internal_map);
};
+class m68301_device : public m68000_base_device
+{
+public:
+ // construction/destruction
+ m68301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
+
+ virtual uint32_t execute_min_cycles() const override { return 4; };
+ virtual uint32_t execute_max_cycles() const override { return 158; };
+
+ // device-level overrides
+ virtual void device_start() override;
+};
+
@@ -635,6 +647,7 @@ public:
DECLARE_DEVICE_TYPE(M68000, m68000_device)
+DECLARE_DEVICE_TYPE(M68301, m68301_device)
DECLARE_DEVICE_TYPE(M68008, m68008_device)
DECLARE_DEVICE_TYPE(M68008PLCC, m68008plcc_device)
DECLARE_DEVICE_TYPE(M68010, m68010_device)
diff --git a/src/devices/cpu/m68000/m68k_in.cpp b/src/devices/cpu/m68000/m68k_in.cpp
index 0eed7fbe629..b5751811530 100644
--- a/src/devices/cpu/m68000/m68k_in.cpp
+++ b/src/devices/cpu/m68000/m68k_in.cpp
@@ -8286,7 +8286,6 @@ M68KMAKE_OP(reset, 0, ., .)
{
if (!m_reset_instr_callback.isnull())
(m_reset_instr_callback)(1);
- m68k_reset_peripherals();
m_remaining_cycles -= m_cyc_reset;
return;
}
diff --git a/src/devices/cpu/m68000/m68kcpu.cpp b/src/devices/cpu/m68000/m68kcpu.cpp
index 851c27163ea..e875b377af3 100644
--- a/src/devices/cpu/m68000/m68kcpu.cpp
+++ b/src/devices/cpu/m68000/m68kcpu.cpp
@@ -2019,6 +2019,11 @@ std::unique_ptr<util::disasm_interface> m68000_device::create_disassembler()
return std::make_unique<m68k_disassembler>(m68k_disassembler::TYPE_68000);
}
+std::unique_ptr<util::disasm_interface> m68301_device::create_disassembler()
+{
+ return std::make_unique<m68k_disassembler>(m68k_disassembler::TYPE_68000);
+}
+
std::unique_ptr<util::disasm_interface> m68008_device::create_disassembler()
{
return std::make_unique<m68k_disassembler>(m68k_disassembler::TYPE_68008);
@@ -2357,6 +2362,7 @@ device_memory_interface::space_config_vector m68000_base_device::memory_space_co
DEFINE_DEVICE_TYPE(M68000, m68000_device, "m68000", "Motorola MC68000")
+DEFINE_DEVICE_TYPE(M68301, m68301_device, "m68301", "Motorola MC68301")
DEFINE_DEVICE_TYPE(M68008, m68008_device, "m68008", "Motorola MC68008")
DEFINE_DEVICE_TYPE(M68008PLCC, m68008plcc_device, "m68008plcc", "Motorola MC68008PLCC")
DEFINE_DEVICE_TYPE(M68010, m68010_device, "m68010", "Motorola MC68010")
@@ -2399,6 +2405,21 @@ m68000_device::m68000_device(const machine_config &mconfig, const char *tag, dev
+m68301_device::m68301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : m68000_base_device(mconfig, tag, owner, clock, M68301, 16,24)
+{
+}
+
+
+void m68301_device::device_start()
+{
+ init_cpu_m68000();
+}
+
+
+
+
+
/* m68008_device */
diff --git a/src/devices/cpu/m68000/m68kmmu.h b/src/devices/cpu/m68000/m68kmmu.h
index 99481039b0f..114d89ff5c1 100644
--- a/src/devices/cpu/m68000/m68kmmu.h
+++ b/src/devices/cpu/m68000/m68kmmu.h
@@ -33,7 +33,7 @@ static constexpr uint32_t M68K_MMU_DF_WP = 0x00000004;
static constexpr uint32_t M68K_MMU_DF_USED = 0x00000008;
static constexpr uint32_t M68K_MMU_DF_MODIFIED = 0x00000010;
static constexpr uint32_t M68K_MMU_DF_CI = 0x00000040;
-static constexpr uint32_t M68K_MMU_DF_SUPERVISOR = 0x00000100;
+static constexpr uint32_t M68K_MMU_DF_SUPERVISOR = 0000000100;
static constexpr uint32_t M68K_MMU_DF_ADDR_MASK = 0xfffffff0;
static constexpr uint32_t M68K_MMU_DF_IND_ADDR_MASK = 0xfffffffc;
diff --git a/src/devices/cpu/m6809/6x09dasm.cpp b/src/devices/cpu/m6809/6x09dasm.cpp
index bc366a567fe..9b7721ab268 100644
--- a/src/devices/cpu/m6809/6x09dasm.cpp
+++ b/src/devices/cpu/m6809/6x09dasm.cpp
@@ -214,10 +214,6 @@ offs_t m6x09_base_disassembler::disassemble(std::ostream &stream, offs_t pc, con
else if (numoperands == 2)
{
ea = params.r16(ppc);
- if( !(ea & 0xff00) )
- {
- stream << '>'; // need the '>' to force an assembler to use EXT addressing
- }
util::stream_format(stream, "$%04X", ea);
}
break;
@@ -234,7 +230,7 @@ offs_t m6x09_base_disassembler::disassemble(std::ostream &stream, offs_t pc, con
pb = params.r8(ppc);
}
- indexed(stream, pb, params, p);
+ indirect(stream, pb, params, p);
break;
case IMM:
@@ -814,10 +810,10 @@ m6x09_disassembler::m6x09_disassembler(m6x09_instruction_level level, const char
}
//-------------------------------------------------
-// indexed addressing mode for M6809/HD6309
+// indirect addressing mode for M6809/HD6309
//-------------------------------------------------
-void m6x09_disassembler::indexed(std::ostream &stream, uint8_t pb, const data_buffer &params, offs_t &p)
+void m6x09_disassembler::indirect(std::ostream &stream, uint8_t pb, const data_buffer &params, offs_t &p)
{
uint8_t reg = (pb >> 5) & 3;
uint8_t pbm = pb & 0x8f;
@@ -912,14 +908,16 @@ void m6x09_disassembler::indexed(std::ostream &stream, uint8_t pb, const data_bu
break;
case 0x8c: // (+/- 7 bit offset),PC
- offset = (int8_t)params.r8(p++);
- util::stream_format(stream, "$%04X,PCR", (p+offset)); // PC Relative addressing (assembler computes offset from specified absolute address)
+ offset = (int8_t)params.r8(p);
+ util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
+ util::stream_format(stream, "$%02X,PC", (offset < 0) ? -offset : offset);
break;
case 0x8d: // (+/- 15 bit offset),PC
offset = (int16_t)params.r16(p);
p += 2;
- util::stream_format(stream, "$%04X,PCR", (p+offset)); // PC Relative addressing (assembler computes offset from specified absolute address)
+ util::stream_format(stream, "%s", (offset < 0) ? "-" : "");
+ util::stream_format(stream, "$%04X,PC", (offset < 0) ? -offset : offset);
break;
case 0x8e: // (+/- W),R
@@ -1242,10 +1240,10 @@ konami_disassembler::konami_disassembler() : m6x09_base_disassembler(konami_opco
}
//-------------------------------------------------
-// indexed addressing mode for Konami
+// indirect addressing mode for Konami
//-------------------------------------------------
-void konami_disassembler::indexed(std::ostream &stream, uint8_t mode, const data_buffer &params, offs_t &p)
+void konami_disassembler::indirect(std::ostream &stream, uint8_t mode, const data_buffer &params, offs_t &p)
{
static const char index_reg[8][3] =
{
diff --git a/src/devices/cpu/m6809/6x09dasm.h b/src/devices/cpu/m6809/6x09dasm.h
index e6320038b54..a14de7849c9 100644
--- a/src/devices/cpu/m6809/6x09dasm.h
+++ b/src/devices/cpu/m6809/6x09dasm.h
@@ -101,7 +101,7 @@ protected:
static const char *const hd6309_tfmregs[16];
static const char *const tfm_s[];
- virtual void indexed(std::ostream &stream, uint8_t pb, const data_buffer &params, offs_t &p) = 0;
+ virtual void indirect(std::ostream &stream, uint8_t pb, const data_buffer &params, offs_t &p) = 0;
virtual void register_register(std::ostream &stream, uint8_t pb) = 0;
private:
@@ -123,7 +123,7 @@ public:
m6x09_disassembler(m6x09_instruction_level level, const char teregs[16][4]);
protected:
- virtual void indexed(std::ostream &stream, uint8_t pb, const data_buffer &params, offs_t &p) override;
+ virtual void indirect(std::ostream &stream, uint8_t pb, const data_buffer &params, offs_t &p) override;
virtual void register_register(std::ostream &stream, uint8_t pb) override;
private:
@@ -138,7 +138,7 @@ public:
konami_disassembler();
protected:
- virtual void indexed(std::ostream &stream, uint8_t pb, const data_buffer &params, offs_t &p) override;
+ virtual void indirect(std::ostream &stream, uint8_t pb, const data_buffer &params, offs_t &p) override;
virtual void register_register(std::ostream &stream, uint8_t pb) override;
private:
diff --git a/src/devices/cpu/mcs51/mcs51.cpp b/src/devices/cpu/mcs51/mcs51.cpp
index c307c19a611..60d39a25139 100644
--- a/src/devices/cpu/mcs51/mcs51.cpp
+++ b/src/devices/cpu/mcs51/mcs51.cpp
@@ -874,8 +874,6 @@ uint8_t mcs51_cpu_device::bit_address_r(uint8_t offset)
int distance; /* distance between bit addressable words */
/* 1 for normal bits, 8 for sfr bit addresses */
- m_last_bit = offset;
-
//User defined bit addresses 0x20-0x2f (values are 0x0-0x7f)
if (offset < 0x80) {
distance = 1;
@@ -1360,8 +1358,6 @@ void mcs51_cpu_device::execute_op(uint8_t op)
m_recalc_parity = 0;
}
- m_last_op = op;
-
switch( op )
{
case 0x00: nop(op); break; //NOP
@@ -1781,10 +1777,6 @@ void mcs51_cpu_device::check_irqs()
return;
}
- // Hack to work around polling latency issue with JB INT0/INT1
- if (m_last_op == 0x20 && ((int_vec == V_IE0 && m_last_bit == 0xb2) || (int_vec == V_IE1 && m_last_bit == 0xb3)))
- PC = PPC + 3;
-
//Save current pc to stack, set pc to new interrupt vector
push_pc();
PC = int_vec;
@@ -2134,8 +2126,6 @@ void mcs51_cpu_device::device_start()
save_item(NAME(m_ppc));
save_item(NAME(m_pc));
- save_item(NAME(m_last_op));
- save_item(NAME(m_last_bit));
save_item(NAME(m_rwm) );
save_item(NAME(m_cur_irq_prio) );
save_item(NAME(m_last_line_state) );
@@ -2223,8 +2213,6 @@ void mcs51_cpu_device::device_reset()
/* Flag as NO IRQ in Progress */
m_irq_active = 0;
m_cur_irq_prio = -1;
- m_last_op = 0;
- m_last_bit = 0;
/* these are all defined reset states */
PC = 0;
diff --git a/src/devices/cpu/mcs51/mcs51.h b/src/devices/cpu/mcs51/mcs51.h
index bd7b6d7b085..e0d4028f493 100644
--- a/src/devices/cpu/mcs51/mcs51.h
+++ b/src/devices/cpu/mcs51/mcs51.h
@@ -122,10 +122,6 @@ protected:
uint8_t m_forced_inputs[4]; /* allow read even if configured as output */
- // JB-related hacks
- uint8_t m_last_op;
- uint8_t m_last_bit;
-
int m_icount;
struct mcs51_uart
diff --git a/src/devices/cpu/mips/mips1.cpp b/src/devices/cpu/mips/mips1.cpp
index 1ed202c0d63..72479a6065d 100644
--- a/src/devices/cpu/mips/mips1.cpp
+++ b/src/devices/cpu/mips/mips1.cpp
@@ -7,6 +7,8 @@
* while those without have hard-wired address translation.
*
* TODO
+ * - FPU support
+ * - further cleanup on coprocessors
* - R3041 features
* - cache emulation
*
@@ -15,32 +17,37 @@
#include "mips1.h"
#include "mips1dsm.h"
#include "debugger.h"
-#include "softfloat3/source/include/softfloat.h"
#define LOG_GENERAL (1U << 0)
#define LOG_TLB (1U << 1)
-#define LOG_IOP (1U << 2)
-#define LOG_RISCOS (1U << 3)
//#define VERBOSE (LOG_GENERAL|LOG_TLB)
-
#include "logmacro.h"
+#define ENABLE_IOP_KPUTS (0)
+
#define RSREG ((op >> 21) & 31)
#define RTREG ((op >> 16) & 31)
#define RDREG ((op >> 11) & 31)
#define SHIFT ((op >> 6) & 31)
-#define FTREG ((op >> 16) & 31)
-#define FSREG ((op >> 11) & 31)
-#define FDREG ((op >> 6) & 31)
+#define RSVAL m_r[RSREG]
+#define RTVAL m_r[RTREG]
+#define RDVAL m_r[RDREG]
#define SIMMVAL s16(op)
#define UIMMVAL u16(op)
#define LIMMVAL (op & 0x03ffffff)
-#define SR m_cop0[COP0_Status]
-#define CAUSE m_cop0[COP0_Cause]
+#define ADDPC(x) do { m_branch_state = BRANCH; m_branch_target = m_pc + 4 + ((x) << 2); } while (0)
+#define ADDPCL(x,l) do { m_branch_state = BRANCH; m_branch_target = m_pc + 4 + ((x) << 2); m_r[l] = m_pc + 8; } while (0)
+#define ABSPC(x) do { m_branch_state = BRANCH; m_branch_target = ((m_pc + 4) & 0xf0000000) | ((x) << 2); } while (0)
+#define ABSPCL(x,l) do { m_branch_state = BRANCH; m_branch_target = ((m_pc + 4) & 0xf0000000) | ((x) << 2); m_r[l] = m_pc + 8; } while (0)
+#define SETPC(x) do { m_branch_state = BRANCH; m_branch_target = (x); } while (0)
+#define SETPCL(x,l) do { m_branch_state = BRANCH; m_branch_target = (x); m_r[l] = m_pc + 8; } while (0)
+
+#define SR m_cpr[0][COP0_Status]
+#define CAUSE m_cpr[0][COP0_Cause]
DEFINE_DEVICE_TYPE(R2000, r2000_device, "r2000", "MIPS R2000")
DEFINE_DEVICE_TYPE(R2000A, r2000a_device, "r2000a", "MIPS R2000A")
@@ -63,6 +70,8 @@ mips1core_device_base::mips1core_device_base(const machine_config &mconfig, devi
, m_icache_config("icache", ENDIANNESS_BIG, 32, 32)
, m_dcache_config("dcache", ENDIANNESS_BIG, 32, 32)
, m_cpurev(cpurev)
+ , m_hasfpu(false)
+ , m_fpurev(0)
, m_endianness(ENDIANNESS_BIG)
, m_icount(0)
, m_icache_size(icache_size)
@@ -73,7 +82,6 @@ mips1core_device_base::mips1core_device_base(const machine_config &mconfig, devi
mips1_device_base::mips1_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 cpurev, size_t icache_size, size_t dcache_size)
: mips1core_device_base(mconfig, type, tag, owner, clock, cpurev, icache_size, dcache_size)
- , m_fcr0(0)
{
}
@@ -118,14 +126,14 @@ r3052e_device::r3052e_device(const machine_config &mconfig, const char *tag, dev
}
r3071_device::r3071_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, size_t icache_size, size_t dcache_size)
- : mips1_device_base(mconfig, R3071, tag, owner, clock, 0x0200, icache_size, dcache_size)
+ : mips1core_device_base(mconfig, R3071, tag, owner, clock, 0x0200, icache_size, dcache_size)
{
}
r3081_device::r3081_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, size_t icache_size, size_t dcache_size)
- : mips1_device_base(mconfig, R3081, tag, owner, clock, 0x0200, icache_size, dcache_size)
+ : mips1core_device_base(mconfig, R3081, tag, owner, clock, 0x0200, icache_size, dcache_size)
{
- set_fpu(0x0300);
+ set_fpurev(0x0300);
}
iop_device::iop_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
@@ -145,6 +153,18 @@ void mips1core_device_base::device_add_mconfig(machine_config &config)
set_addrmap(2, &mips1core_device_base::dcache_map);
}
+void mips1core_device_base::icache_map(address_map &map)
+{
+ if (m_icache_size)
+ map(0, m_icache_size - 1).ram().mirror(~(m_icache_size - 1));
+}
+
+void mips1core_device_base::dcache_map(address_map &map)
+{
+ if (m_dcache_size)
+ map(0, m_dcache_size - 1).ram().mirror(~(m_dcache_size - 1));
+}
+
void mips1core_device_base::device_start()
{
// set our instruction counter
@@ -157,32 +177,49 @@ void mips1core_device_base::device_start()
// register our state for the debugger
state_add(STATE_GENPC, "GENPC", m_pc).noshow();
state_add(STATE_GENPCBASE, "CURPC", m_pc).noshow();
+ state_add(STATE_GENSP, "GENSP", m_r[31]).noshow();
+ state_add(STATE_GENFLAGS, "GENFLAGS", m_cpr[0][COP0_Status]).noshow();
- state_add(MIPS1_PC, "PC", m_pc);
- state_add(MIPS1_COP0 + COP0_Status, "SR", m_cop0[COP0_Status]);
+ state_add(MIPS1_PC, "PC", m_pc);
+ state_add(MIPS1_COP0_SR, "SR", m_cpr[0][COP0_Status]);
- for (unsigned i = 0; i < ARRAY_LENGTH(m_r); i++)
+ for (int i = 0; i < 32; i++)
state_add(MIPS1_R0 + i, util::string_format("R%d", i).c_str(), m_r[i]);
state_add(MIPS1_HI, "HI", m_hi);
state_add(MIPS1_LO, "LO", m_lo);
-
- // cop0 exception registers
- state_add(MIPS1_COP0 + COP0_BadVAddr, "BadVAddr", m_cop0[COP0_BadVAddr]);
- state_add(MIPS1_COP0 + COP0_Cause, "Cause", m_cop0[COP0_Cause]);
- state_add(MIPS1_COP0 + COP0_EPC, "EPC", m_cop0[COP0_EPC]);
+ state_add(MIPS1_COP0_BADVADDR, "BadVAddr", m_cpr[0][COP0_BadVAddr]);
+ state_add(MIPS1_COP0_CAUSE, "Cause", m_cpr[0][COP0_Cause]);
+ state_add(MIPS1_COP0_EPC, "EPC", m_cpr[0][COP0_EPC]);
// register our state for saving
save_item(NAME(m_pc));
save_item(NAME(m_hi));
save_item(NAME(m_lo));
save_item(NAME(m_r));
- save_item(NAME(m_cop0));
+ save_item(NAME(m_cpr));
+ save_item(NAME(m_ccr));
save_item(NAME(m_branch_state));
save_item(NAME(m_branch_target));
- // initialise cpu id register
- m_cop0[COP0_PRId] = m_cpurev;
+ // initialise cpu and fpu id registers
+ m_cpr[0][COP0_PRId] = m_cpurev;
+ m_ccr[1][0] = m_fpurev;
+}
+
+void mips1_device_base::device_start()
+{
+ mips1core_device_base::device_start();
+
+ // cop0 tlb registers
+ state_add(MIPS1_COP0_INDEX, "Index", m_cpr[0][COP0_Index]);
+ state_add(MIPS1_COP0_RANDOM, "Random", m_cpr[0][COP0_Random]);
+ state_add(MIPS1_COP0_ENTRYLO, "EntryLo", m_cpr[0][COP0_EntryLo]);
+ state_add(MIPS1_COP0_ENTRYHI, "EntryHi", m_cpr[0][COP0_EntryHi]);
+ state_add(MIPS1_COP0_CONTEXT, "Context", m_cpr[0][COP0_Context]);
+
+ save_item(NAME(m_reset_time));
+ save_item(NAME(m_tlb));
}
void r3041_device::device_start()
@@ -190,11 +227,11 @@ void r3041_device::device_start()
mips1core_device_base::device_start();
// cop0 r3041 registers
- state_add(MIPS1_COP0 + COP0_BusCtrl, "BusCtrl", m_cop0[COP0_BusCtrl]);
- state_add(MIPS1_COP0 + COP0_Config, "Config", m_cop0[COP0_Config]);
- state_add(MIPS1_COP0 + COP0_Count, "Count", m_cop0[COP0_Count]);
- state_add(MIPS1_COP0 + COP0_PortSize, "PortSize", m_cop0[COP0_PortSize]);
- state_add(MIPS1_COP0 + COP0_Compare, "Compare", m_cop0[COP0_Compare]);
+ state_add(MIPS1_COP0_BUSCTRL, "BusCtrl", m_cpr[0][COP0_BusCtrl]);
+ state_add(MIPS1_COP0_CONFIG, "Config", m_cpr[0][COP0_Config]);
+ state_add(MIPS1_COP0_COUNT, "Count", m_cpr[0][COP0_Count]);
+ state_add(MIPS1_COP0_PORTSIZE, "PortSize", m_cpr[0][COP0_PortSize]);
+ state_add(MIPS1_COP0_COMPARE, "Compare", m_cpr[0][COP0_Compare]);
}
void mips1core_device_base::device_reset()
@@ -204,402 +241,19 @@ void mips1core_device_base::device_reset()
m_branch_state = NONE;
// non-tlb devices have tlb shut down
- m_cop0[COP0_Status] = SR_BEV | SR_TS;
+ m_cpr[0][COP0_Status] = SR_BEV | SR_TS;
m_data_spacenum = 0;
}
-void mips1core_device_base::execute_run()
-{
- // check for interrupts
- check_irqs();
-
- // core execution loop
- while (m_icount-- > 0)
- {
- // debugging
- debugger_instruction_hook(m_pc);
-
- if (VERBOSE & LOG_IOP)
- {
- if ((m_pc & 0x1fffffff) == 0x00012C48 || (m_pc & 0x1fffffff) == 0x0001420C || (m_pc & 0x1fffffff) == 0x0001430C)
- {
- u32 ptr = m_r[5];
- u32 length = m_r[6];
- if (length >= 4096)
- length = 4095;
- while (length)
- {
- load<u8>(ptr, [](char c) { printf("%c", c); });
- ptr++;
- length--;
- }
- fflush(stdout);
- }
- }
-
- // fetch and execute instruction
- fetch(m_pc, [this](u32 const op)
- {
- // parse the instruction
- switch (op >> 26)
- {
- case 0x00: // SPECIAL
- switch (op & 63)
- {
- case 0x00: // SLL
- m_r[RDREG] = m_r[RTREG] << SHIFT;
- break;
- case 0x02: // SRL
- m_r[RDREG] = m_r[RTREG] >> SHIFT;
- break;
- case 0x03: // SRA
- m_r[RDREG] = s32(m_r[RTREG]) >> SHIFT;
- break;
- case 0x04: // SLLV
- m_r[RDREG] = m_r[RTREG] << (m_r[RSREG] & 31);
- break;
- case 0x06: // SRLV
- m_r[RDREG] = m_r[RTREG] >> (m_r[RSREG] & 31);
- break;
- case 0x07: // SRAV
- m_r[RDREG] = s32(m_r[RTREG]) >> (m_r[RSREG] & 31);
- break;
- case 0x08: // JR
- m_branch_state = BRANCH;
- m_branch_target = m_r[RSREG];
- break;
- case 0x09: // JALR
- m_branch_state = BRANCH;
- m_branch_target = m_r[RSREG];
- m_r[RDREG] = m_pc + 8;
- break;
- case 0x0c: // SYSCALL
- generate_exception(EXCEPTION_SYSCALL);
- break;
- case 0x0d: // BREAK
- generate_exception(EXCEPTION_BREAK);
- break;
- case 0x10: // MFHI
- m_r[RDREG] = m_hi;
- break;
- case 0x11: // MTHI
- m_hi = m_r[RSREG];
- break;
- case 0x12: // MFLO
- m_r[RDREG] = m_lo;
- break;
- case 0x13: // MTLO
- m_lo = m_r[RSREG];
- break;
- case 0x18: // MULT
- {
- u64 product = mul_32x32(m_r[RSREG], m_r[RTREG]);
-
- m_lo = product;
- m_hi = product >> 32;
- m_icount -= 11;
- }
- break;
- case 0x19: // MULTU
- {
- u64 product = mulu_32x32(m_r[RSREG], m_r[RTREG]);
-
- m_lo = product;
- m_hi = product >> 32;
- m_icount -= 11;
- }
- break;
- case 0x1a: // DIV
- if (m_r[RTREG])
- {
- m_lo = s32(m_r[RSREG]) / s32(m_r[RTREG]);
- m_hi = s32(m_r[RSREG]) % s32(m_r[RTREG]);
- }
- m_icount -= 34;
- break;
- case 0x1b: // DIVU
- if (m_r[RTREG])
- {
- m_lo = m_r[RSREG] / m_r[RTREG];
- m_hi = m_r[RSREG] % m_r[RTREG];
- }
- m_icount -= 34;
- break;
- case 0x20: // ADD
- {
- u32 const sum = m_r[RSREG] + m_r[RTREG];
-
- // overflow: (sign(addend0) == sign(addend1)) && (sign(addend0) != sign(sum))
- if (!BIT(m_r[RSREG] ^ m_r[RTREG], 31) && BIT(m_r[RSREG] ^ sum, 31))
- generate_exception(EXCEPTION_OVERFLOW);
- else
- m_r[RDREG] = sum;
- }
- break;
- case 0x21: // ADDU
- m_r[RDREG] = m_r[RSREG] + m_r[RTREG];
- break;
- case 0x22: // SUB
- {
- u32 const difference = m_r[RSREG] - m_r[RTREG];
-
- // overflow: (sign(minuend) != sign(subtrahend)) && (sign(minuend) != sign(difference))
- if (BIT(m_r[RSREG] ^ m_r[RTREG], 31) && BIT(m_r[RSREG] ^ difference, 31))
- generate_exception(EXCEPTION_OVERFLOW);
- else
- m_r[RDREG] = difference;
- }
- break;
- case 0x23: // SUBU
- m_r[RDREG] = m_r[RSREG] - m_r[RTREG];
- break;
- case 0x24: // AND
- m_r[RDREG] = m_r[RSREG] & m_r[RTREG];
- break;
- case 0x25: // OR
- m_r[RDREG] = m_r[RSREG] | m_r[RTREG];
- break;
- case 0x26: // XOR
- m_r[RDREG] = m_r[RSREG] ^ m_r[RTREG];
- break;
- case 0x27: // NOR
- m_r[RDREG] = ~(m_r[RSREG] | m_r[RTREG]);
- break;
- case 0x2a: // SLT
- m_r[RDREG] = s32(m_r[RSREG]) < s32(m_r[RTREG]);
- break;
- case 0x2b: // SLTU
- m_r[RDREG] = u32(m_r[RSREG]) < u32(m_r[RTREG]);
- break;
- default:
- generate_exception(EXCEPTION_INVALIDOP);
- break;
- }
- break;
- case 0x01: // REGIMM
- switch (RTREG)
- {
- case 0x00: // BLTZ
- if (s32(m_r[RSREG]) < 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
- case 0x01: // BGEZ
- if (s32(m_r[RSREG]) >= 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
- case 0x10: // BLTZAL
- if (s32(m_r[RSREG]) < 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- m_r[31] = m_pc + 8;
- }
- break;
- case 0x11: // BGEZAL
- if (s32(m_r[RSREG]) >= 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- m_r[31] = m_pc + 8;
- }
- break;
- default:
- generate_exception(EXCEPTION_INVALIDOP);
- break;
- }
- break;
- case 0x02: // J
- m_branch_state = BRANCH;
- m_branch_target = ((m_pc + 4) & 0xf0000000) | (LIMMVAL << 2);
- break;
- case 0x03: // JAL
- m_branch_state = BRANCH;
- m_branch_target = ((m_pc + 4) & 0xf0000000) | (LIMMVAL << 2);
- m_r[31] = m_pc + 8;
- break;
- case 0x04: // BEQ
- if (m_r[RSREG] == m_r[RTREG])
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
- case 0x05: // BNE
- if (m_r[RSREG] != m_r[RTREG])
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
- case 0x06: // BLEZ
- if (s32(m_r[RSREG]) <= 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
- case 0x07: // BGTZ
- if (s32(m_r[RSREG]) > 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
- case 0x08: // ADDI
- {
- u32 const sum = m_r[RSREG] + SIMMVAL;
-
- // overflow: (sign(addend0) == sign(addend1)) && (sign(addend0) != sign(sum))
- if (!BIT(m_r[RSREG] ^ s32(SIMMVAL), 31) && BIT(m_r[RSREG] ^ sum, 31))
- generate_exception(EXCEPTION_OVERFLOW);
- else
- m_r[RTREG] = sum;
- }
- break;
- case 0x09: // ADDIU
- m_r[RTREG] = m_r[RSREG] + SIMMVAL;
- break;
- case 0x0a: // SLTI
- m_r[RTREG] = s32(m_r[RSREG]) < s32(SIMMVAL);
- break;
- case 0x0b: // SLTIU
- m_r[RTREG] = u32(m_r[RSREG]) < u32(SIMMVAL);
- break;
- case 0x0c: // ANDI
- m_r[RTREG] = m_r[RSREG] & UIMMVAL;
- break;
- case 0x0d: // ORI
- m_r[RTREG] = m_r[RSREG] | UIMMVAL;
- break;
- case 0x0e: // XORI
- m_r[RTREG] = m_r[RSREG] ^ UIMMVAL;
- break;
- case 0x0f: // LUI
- m_r[RTREG] = UIMMVAL << 16;
- break;
- case 0x10: // COP0
- if (!(SR & SR_KUc) || (SR & SR_COP0))
- handle_cop0(op);
- else
- generate_exception(EXCEPTION_BADCOP0);
- break;
- case 0x11: // COP1
- handle_cop1(op);
- break;
- case 0x12: // COP2
- handle_cop2(op);
- break;
- case 0x13: // COP3
- handle_cop3(op);
- break;
- case 0x20: // LB
- load<u8>(SIMMVAL + m_r[RSREG], [this, op](s8 temp) { m_r[RTREG] = temp; });
- break;
- case 0x21: // LH
- load<u16>(SIMMVAL + m_r[RSREG], [this, op](s16 temp) { m_r[RTREG] = temp; });
- break;
- case 0x22: // LWL
- lwl(op);
- break;
- case 0x23: // LW
- load<u32>(SIMMVAL + m_r[RSREG], [this, op](u32 temp) { m_r[RTREG] = temp; });
- break;
- case 0x24: // LBU
- load<u8>(SIMMVAL + m_r[RSREG], [this, op](u8 temp) { m_r[RTREG] = temp; });
- break;
- case 0x25: // LHU
- load<u16>(SIMMVAL + m_r[RSREG], [this, op](u16 temp) { m_r[RTREG] = temp; });
- break;
- case 0x26: // LWR
- lwr(op);
- break;
- case 0x28: // SB
- store<u8>(SIMMVAL + m_r[RSREG], m_r[RTREG]);
- break;
- case 0x29: // SH
- store<u16>(SIMMVAL + m_r[RSREG], m_r[RTREG]);
- break;
- case 0x2a: // SWL
- swl(op);
- break;
- case 0x2b: // SW
- store<u32>(SIMMVAL + m_r[RSREG], m_r[RTREG]);
- break;
- case 0x2e: // SWR
- swr(op);
- break;
- case 0x31: // LWC1
- handle_cop1(op);
- break;
- case 0x32: // LWC2
- handle_cop2(op);
- break;
- case 0x33: // LWC3
- handle_cop3(op);
- break;
- case 0x39: // SWC1
- handle_cop1(op);
- break;
- case 0x3a: // SWC2
- handle_cop2(op);
- break;
- case 0x3b: // SWC3
- handle_cop3(op);
- break;
- default:
- generate_exception(EXCEPTION_INVALIDOP);
- break;
- }
-
- // update pc and branch state
- switch (m_branch_state)
- {
- case NONE:
- m_pc += 4;
- break;
-
- case DELAY:
- m_branch_state = NONE;
- m_pc = m_branch_target;
- break;
-
- case BRANCH:
- m_branch_state = DELAY;
- m_pc += 4;
- break;
-
- case EXCEPTION:
- m_branch_state = NONE;
- break;
- }
-
- // clear register 0
- m_r[0] = 0;
- });
- }
-}
-
-void mips1core_device_base::execute_set_input(int irqline, int state)
+void mips1_device_base::device_reset()
{
- if (state != CLEAR_LINE)
- {
- CAUSE |= CAUSE_IPEX0 << irqline;
+ mips1core_device_base::device_reset();
- // enable debugger interrupt breakpoints
- if ((SR & SR_IEc) && (SR & (SR_IMEX0 << irqline)))
- standard_irq_callback(irqline);
- }
- else
- CAUSE &= ~(CAUSE_IPEX0 << irqline);
+ // tlb is not shut down
+ m_cpr[0][COP0_Status] &= ~SR_TS;
- check_irqs();
+ m_reset_time = total_cycles();
}
device_memory_interface::space_config_vector mips1core_device_base::memory_space_config() const
@@ -611,228 +265,29 @@ device_memory_interface::space_config_vector mips1core_device_base::memory_space
};
}
-bool mips1core_device_base::memory_translate(int spacenum, int intention, offs_t &address)
-{
- // check for kernel memory address
- if (BIT(address, 31))
- {
- // check debug or kernel mode
- if ((intention & TRANSLATE_DEBUG_MASK) || !(SR & SR_KUc))
- {
- switch (address & 0xe0000000)
- {
- case 0x80000000: // kseg0: unmapped, cached, privileged
- case 0xa0000000: // kseg1: unmapped, uncached, privileged
- address &= ~0xe0000000;
- break;
-
- case 0xc0000000: // kseg2: mapped, cached, privileged
- case 0xe0000000:
- break;
- }
- }
- else if (SR & SR_KUc)
- {
- if (!machine().side_effects_disabled())
- {
- // exception
- m_cop0[COP0_BadVAddr] = address;
-
- generate_exception((intention & TRANSLATE_WRITE) ? EXCEPTION_ADDRSTORE : EXCEPTION_ADDRLOAD);
- }
- return false;
- }
- }
- else
- // kuseg physical addresses have a 1GB offset
- address += 0x40000000;
-
- return true;
-}
-
std::unique_ptr<util::disasm_interface> mips1core_device_base::create_disassembler()
{
return std::make_unique<mips1_disassembler>();
}
-void mips1core_device_base::icache_map(address_map &map)
-{
- if (m_icache_size)
- map(0, m_icache_size - 1).ram().mirror(~(m_icache_size - 1));
-}
-
-void mips1core_device_base::dcache_map(address_map &map)
-{
- if (m_dcache_size)
- map(0, m_dcache_size - 1).ram().mirror(~(m_dcache_size - 1));
-}
-
-void mips1core_device_base::generate_exception(u32 exception, bool refill)
+void mips1core_device_base::generate_exception(int exception, bool refill)
{
- if ((VERBOSE & LOG_RISCOS) && (exception == EXCEPTION_SYSCALL))
- {
- static char const *const sysv_syscalls[] =
- {
- "syscall", "exit", "fork", "read", "write", "open", "close", "wait", "creat", "link",
- "unlink", "execv", "chdir", "time", "mknod", "chmod", "chown", "brk", "stat", "lseek",
- "getpid", "mount", "umount", "setuid", "getuid", "stime", "ptrace", "alarm", "fstat", "pause",
- "utime", "stty", "gtty", "access", "nice", "statfs", "sync", "kill", "fstatfs", "setpgrp",
- nullptr, "dup", "pipe", "times", "profil", "plock", "setgid", "getgid", "signal", "msgsys",
- "sysmips", "acct", "shmsys", "semsys", "ioctl", "uadmin", nullptr, "utssys", nullptr, "execve",
- "umask", "chroot", "ofcntl", "ulimit", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- "advfs", "unadvfs", "rmount", "rumount", "rfstart", nullptr, "rdebug", "rfstop", "rfsys", "rmdir",
- "mkdir", "getdents", nullptr, nullptr, "sysfs", "getmsg", "putmsg", "poll", "sigreturn", "accept",
- "bind", "connect", "gethostid", "getpeername", "getsockname", "getsockopt", "listen", "recv", "recvfrom", "recvmsg",
- "select", "send", "sendmsg", "sendto", "sethostid", "setsockopt", "shutdown", "socket", "gethostname", "sethostname",
- "getdomainname","setdomainname","truncate", "ftruncate", "rename", "symlink", "readlink", "lstat", "nfsmount", "nfssvc",
- "getfh", "async_daemon", "old_exportfs", "mmap", "munmap", "getitimer", "setitimer", nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- "cacheflush", "cachectl", "fchown", "fchmod", "wait3", "mmap", "munmap", "madvise", "getpagesize", "setreuid",
- "setregid", "setpgid", "getgroups", "setgroups", "gettimeofday", "getrusage", "getrlimit", "setrlimit", "exportfs", "fcntl"
- };
-
- static char const *const bsd_syscalls[] =
- {
- "syscall", "exit", "fork", "read", "write", "open", "close", nullptr, "creat", "link",
- "unlink", "execv", "chdir", nullptr, "mknod", "chmod", "chown", "brk", nullptr, "lseek",
- "getpid", "omount", "oumount", nullptr, "getuid", nullptr, "ptrace", nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, "access", nullptr, nullptr, "sync", "kill", "stat", nullptr,
- "lstat", "dup", "pipe", nullptr, "profil", nullptr, nullptr, "getgid", nullptr, nullptr,
- nullptr, "acct", nullptr, nullptr, "ioctl", "reboot", nullptr, "symlink", "readlink", "execve",
- "umask", "chroot", "fstat", nullptr, "getpagesize", "mremap", "vfork", nullptr, nullptr, "sbrk",
- "sstk", "mmap", "vadvise", "munmap", "mprotec", "madvise", "vhangup", nullptr, "mincore", "getgroups",
- "setgroups", "getpgrp", "setpgrp", "setitimer", "wait3", "swapon", "getitimer", "gethostname", "sethostname", "getdtablesize",
- "dup2", "getdopt", "fcntl", "select", "setdopt", "fsync", "setpriority", "socket", "connect", "accept",
- "getpriority", "send", "recv", "sigreturn", "bind", "setsockopt", "listen", nullptr, "sigvec", "sigblock",
- "sigsetmask", "sigpause", "sigstack", "recvmsg", "sendmsg", nullptr, "gettimeofday", "getrusage", "getsockopt", nullptr,
- "readv", "writev", "settimeofday", "fchown", "fchmod", "recvfrom", "setreuid", "setregid", "rename", "truncate",
- "ftruncate", "flock", nullptr, "sendto", "shutdown", "socketpair", "mkdir", "rmdir", "utimes", "sigcleanup",
- "adjtime", "getpeername", "gethostid", "sethostid", "getrlimit", "setrlimit", "killpg", nullptr, "setquota", "quota",
- "getsockname", "sysmips", "cacheflush", "cachectl", "debug", nullptr, nullptr, nullptr, "nfssvc", "getdirentries",
- "statfs", "fstatfs", "unmount", "async_daemon", "getfh", "getdomainname","setdomainname",nullptr, "quotactl", "old_exportfs",
- "mount", "hdwconf", "exportfs", "nfsfh_open", "libattach", "libdetach"
- };
-
- static char const *const msg_syscalls[] = { "msgget", "msgctl", "msgrcv", "msgsnd" };
- static char const *const shm_syscalls[] = { "shmat", "shmctl", "shmdt", "shmget" };
- static char const *const sem_syscalls[] = { "semctl", "semget", "semop" };
- static char const *const mips_syscalls[] = { "mipskopt", "mipshwconf", "mipsgetrusage", "mipswait", "mipscacheflush", "mipscachectl" };
-
- unsigned const asid = (m_cop0[COP0_EntryHi] & EH_ASID) >> 6;
- switch (m_r[2])
- {
- case 1000: // indirect
- switch (m_r[4])
- {
- case 1049: // msgsys
- LOGMASKED(LOG_RISCOS, "asid %d syscall msgsys:%s() (%s)\n",
- asid, (m_r[5] < ARRAY_LENGTH(msg_syscalls)) ? msg_syscalls[m_r[5]] : "unknown", machine().describe_context());
- break;
-
- case 1052: // shmsys
- LOGMASKED(LOG_RISCOS, "asid %d syscall shmsys:%s() (%s)\n",
- asid, (m_r[5] < ARRAY_LENGTH(shm_syscalls)) ? shm_syscalls[m_r[5]] : "unknown", machine().describe_context());
- break;
-
- case 1053: // semsys
- LOGMASKED(LOG_RISCOS, "asid %d syscall semsys:%s() (%s)\n",
- asid, (m_r[5] < ARRAY_LENGTH(sem_syscalls)) ? sem_syscalls[m_r[5]] : "unknown", machine().describe_context());
- break;
-
- case 2151: // bsd_sysmips
- switch (m_r[5])
- {
- case 0x100: // mipskopt
- LOGMASKED(LOG_RISCOS, "asid %d syscall bsd_sysmips:mipskopt(\"%s\") (%s)\n",
- asid, debug_string(m_r[6]), machine().describe_context());
- break;
-
- default:
- if ((m_r[5] > 0x100) && (m_r[5] - 0x100) < ARRAY_LENGTH(mips_syscalls))
- LOGMASKED(LOG_RISCOS, "asid %d syscall bsd_sysmips:%s() (%s)\n",
- asid, mips_syscalls[m_r[5] - 0x100], machine().describe_context());
- else
- LOGMASKED(LOG_RISCOS, "asid %d syscall bsd_sysmips:unknown %d (%s)\n",
- asid, m_r[5], machine().describe_context());
- break;
- }
- break;
-
- default:
- if ((m_r[4] > 2000) && (m_r[4] - 2000 < ARRAY_LENGTH(bsd_syscalls)) && bsd_syscalls[m_r[4] - 2000])
- LOGMASKED(LOG_RISCOS, "asid %d syscall bsd_%s() (%s)\n",
- asid, bsd_syscalls[m_r[4] - 2000], machine().describe_context());
- else
- LOGMASKED(LOG_RISCOS, "asid %d syscall indirect:unknown %d (%s)\n",
- asid, m_r[4], machine().describe_context());
- break;
- }
- break;
-
- case 1003: // read
- case 1006: // close
- case 1054: // ioctl
- case 1169: // fcntl
- LOGMASKED(LOG_RISCOS, "asid %d syscall %s(%d) (%s)\n",
- asid, sysv_syscalls[m_r[2] - 1000], m_r[4], machine().describe_context());
- break;
-
- case 1004: // write
- if (m_r[4] == 1 || m_r[4] == 2)
- LOGMASKED(LOG_RISCOS, "asid %d syscall %s(%d, \"%s\") (%s)\n",
- asid, sysv_syscalls[m_r[2] - 1000], m_r[4], debug_string(m_r[5], m_r[6]), machine().describe_context());
- else
- LOGMASKED(LOG_RISCOS, "asid %d syscall %s(%d) (%s)\n",
- asid, sysv_syscalls[m_r[2] - 1000], m_r[4], machine().describe_context());
- break;
-
- case 1005: // open
- case 1008: // creat
- case 1009: // link
- case 1010: // unlink
- case 1012: // chdir
- case 1018: // stat
- case 1033: // access
- LOGMASKED(LOG_RISCOS, "asid %d syscall %s(\"%s\") (%s)\n",
- asid, sysv_syscalls[m_r[2] - 1000], debug_string(m_r[4]), machine().describe_context());
- break;
-
- case 1059: // execve
- LOGMASKED(LOG_RISCOS, "asid %d syscall execve(\"%s\", [ %s ], [ %s ]) (%s)\n",
- asid, debug_string(m_r[4]), debug_string_array(m_r[5]), debug_string_array(m_r[6]), machine().describe_context());
- break;
-
- case 1060: // umask
- LOGMASKED(LOG_RISCOS, "asid %d syscall umask(%#o) (%s)\n",
- asid, m_r[4] & 0777, machine().describe_context());
- break;
-
- default:
- if ((m_r[2] > 1000) && (m_r[2] - 1000 < ARRAY_LENGTH(sysv_syscalls)) && sysv_syscalls[m_r[2] - 1000])
- LOGMASKED(LOG_RISCOS, "asid %d syscall %s() (%s)\n", asid, sysv_syscalls[m_r[2] - 1000], machine().describe_context());
- else
- LOGMASKED(LOG_RISCOS, "asid %d syscall unknown %d (%s)\n", asid, m_r[2], machine().describe_context());
- break;
- }
- }
-
// set the exception PC
- m_cop0[COP0_EPC] = m_pc;
+ m_cpr[0][COP0_EPC] = m_pc;
- // load the cause register
- CAUSE = (CAUSE & CAUSE_IP) | exception;
+ // put the cause in the low 8 bits and clear the branch delay flag
+ CAUSE = (CAUSE & ~0x800000ff) | (exception << 2);
// if in a branch delay slot, restart the branch
if (m_branch_state == DELAY)
{
- m_cop0[COP0_EPC] -= 4;
- CAUSE |= CAUSE_BD;
+ m_cpr[0][COP0_EPC] -= 4;
+ CAUSE |= 0x80000000;
}
m_branch_state = EXCEPTION;
// shift the exception bits
- SR = (SR & ~SR_KUIE) | ((SR << 2) & SR_KUIEop);
+ SR = (SR & 0xffffffc0) | ((SR << 2) & 0x3c);
if (refill)
m_pc = (SR & SR_BEV) ? 0xbfc00100 : 0x80000000;
@@ -840,369 +295,109 @@ void mips1core_device_base::generate_exception(u32 exception, bool refill)
m_pc = (SR & SR_BEV) ? 0xbfc00180 : 0x80000080;
debugger_exception_hook(exception);
-
- if (SR & SR_KUp)
- debugger_privilege_hook();
}
void mips1core_device_base::check_irqs()
{
- if ((CAUSE & SR & SR_IM) && (SR & SR_IEc))
+ if ((CAUSE & SR & 0xff00) && (SR & SR_IEc))
generate_exception(EXCEPTION_INTERRUPT);
}
-void mips1core_device_base::handle_cop0(u32 const op)
-{
- switch (RSREG)
- {
- case 0x00: // MFC0
- m_r[RTREG] = get_cop0_reg(RDREG);
- break;
- case 0x04: // MTC0
- set_cop0_reg(RDREG, m_r[RTREG]);
- break;
- case 0x08: // BC0
- switch (RTREG)
- {
- case 0x00: // BC0F
- if (!m_in_brcond[0]())
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
- case 0x01: // BC0T
- if (m_in_brcond[0]())
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
- default:
- generate_exception(EXCEPTION_INVALIDOP);
- break;
- }
- break;
- case 0x10: // COP0
- switch (op & 31)
- {
- case 0x10: // RFE
- SR = (SR & ~SR_KUIEpc) | ((SR >> 2) & SR_KUIEpc);
- if (bool(SR & SR_KUc) ^ bool(SR & SR_KUp))
- debugger_privilege_hook();
- break;
- default:
- generate_exception(EXCEPTION_INVALIDOP);
- break;
- }
- break;
- default:
- generate_exception(EXCEPTION_INVALIDOP);
- break;
- }
-}
-
-u32 mips1core_device_base::get_cop0_reg(unsigned const reg)
-{
- return m_cop0[reg];
-}
-
-void mips1core_device_base::set_cop0_reg(unsigned const reg, u32 const data)
-{
- switch (reg)
- {
- case COP0_Context:
- m_cop0[COP0_Context] = (m_cop0[COP0_Context] & ~PTE_BASE) | (data & PTE_BASE);
- break;
- case COP0_Status:
- {
- u32 const delta = SR ^ data;
-
- m_cop0[COP0_Status] = data;
-
- // handle cache isolation and swap
- m_data_spacenum = (data & SR_IsC) ? ((data & SR_SwC) ? 1 : 2) : 0;
-
- // update interrupts
- if (delta & (SR_IEc | SR_IM))
- check_irqs();
-
- if ((delta & SR_KUc) && (m_branch_state != EXCEPTION))
- debugger_privilege_hook();
- }
- break;
- case COP0_Cause:
- CAUSE = (CAUSE & CAUSE_IPEX) | (data & ~CAUSE_IPEX);
-
- // update interrupts -- software ints can occur this way
- check_irqs();
- break;
- case COP0_PRId:
- // read-only register
- break;
-
- default:
- m_cop0[reg] = data;
- break;
- }
-}
-
-void mips1core_device_base::handle_cop1(u32 const op)
-{
- if (!(SR & SR_COP1))
- generate_exception(EXCEPTION_BADCOP1);
-}
-
-void mips1core_device_base::handle_cop2(u32 const op)
-{
- if (SR & SR_COP2)
- {
- switch (RSREG)
- {
- case 0x08: // BC2
- switch (RTREG)
- {
- case 0x00: // BC2F
- if (!m_in_brcond[2]())
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
- case 0x01: // BC2T
- if (m_in_brcond[2]())
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
- default:
- generate_exception(EXCEPTION_INVALIDOP);
- break;
- }
- break;
- default:
- generate_exception(EXCEPTION_INVALIDOP);
- break;
- }
- }
- else
- generate_exception(EXCEPTION_BADCOP2);
-}
-
-void mips1core_device_base::handle_cop3(u32 const op)
+void mips1core_device_base::set_irq_line(int irqline, int state)
{
- if (SR & SR_COP3)
- {
- switch (RSREG)
- {
- case 0x08: // BC3
- switch (RTREG)
- {
- case 0x00: // BC3F
- if (!m_in_brcond[3]())
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
- case 0x01: // BC3T
- if (m_in_brcond[3]())
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
- default:
- generate_exception(EXCEPTION_INVALIDOP);
- break;
- }
- break;
- default:
- generate_exception(EXCEPTION_INVALIDOP);
- break;
- }
- }
+ if (state != CLEAR_LINE)
+ CAUSE |= 0x400 << irqline;
else
- generate_exception(EXCEPTION_BADCOP3);
-}
+ CAUSE &= ~(0x400 << irqline);
-void mips1core_device_base::lwl(u32 const op)
-{
- offs_t const offset = SIMMVAL + m_r[RSREG];
- load<u32>(offset & ~3, [this, op, offset](u32 temp)
- {
- unsigned const shift = ((offset & 3) ^ ENDIAN_VALUE_LE_BE(m_endianness, 3, 0)) << 3;
-
- m_r[RTREG] = (m_r[RTREG] & ~u32(0xffffffffU << shift)) | (temp << shift);
- });
-}
-
-void mips1core_device_base::lwr(u32 const op)
-{
- offs_t const offset = SIMMVAL + m_r[RSREG];
- load<u32>(offset & ~3, [this, op, offset](u32 temp)
- {
- unsigned const shift = ((offset & 0x3) ^ ENDIAN_VALUE_LE_BE(m_endianness, 0, 3)) << 3;
-
- m_r[RTREG] = (m_r[RTREG] & ~u32(0xffffffffU >> shift)) | (temp >> shift);
- });
+ check_irqs();
}
-void mips1core_device_base::swl(u32 const op)
+u32 mips1core_device_base::get_cop0_reg(int const index)
{
- offs_t const offset = SIMMVAL + m_r[RSREG];
- unsigned const shift = ((offset & 3) ^ ENDIAN_VALUE_LE_BE(m_endianness, 3, 0)) << 3;
-
- store<u32>(offset & ~3, m_r[RTREG] >> shift, 0xffffffffU >> shift);
+ return m_cpr[0][index];
}
-void mips1core_device_base::swr(u32 const op)
+u32 mips1_device_base::get_cop0_reg(int const index)
{
- offs_t const offset = SIMMVAL + m_r[RSREG];
- unsigned const shift = ((offset & 3) ^ ENDIAN_VALUE_LE_BE(m_endianness, 0, 3)) << 3;
+ // assume 64-entry tlb with 8 wired entries
+ if (index == COP0_Random)
+ m_cpr[0][index] = (63 - ((total_cycles() - m_reset_time) % 56)) << 8;
- store<u32>(offset & ~3, m_r[RTREG] << shift, 0xffffffffU << shift);
+ return m_cpr[0][index];
}
-template <typename T, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(T)>>::value, void> mips1core_device_base::load(u32 address, U &&apply)
+void mips1core_device_base::set_cop0_reg(int const index, u32 const data)
{
- if (memory_translate(m_data_spacenum, TRANSLATE_READ, address))
+ if (index == COP0_Cause)
{
- switch (sizeof(T))
- {
- case 1: apply(T(space(m_data_spacenum).read_byte(address))); break;
- case 2: apply(T(space(m_data_spacenum).read_word(address))); break;
- case 4: apply(T(space(m_data_spacenum).read_dword(address))); break;
- }
- }
-}
+ CAUSE = (CAUSE & 0xfc00) | (data & ~0xfc00);
-template <typename T, typename U> std::enable_if_t<std::is_convertible<U, T>::value, void> mips1core_device_base::store(u32 address, U data, T mem_mask)
-{
- if (memory_translate(m_data_spacenum, TRANSLATE_WRITE, address))
- {
- switch (sizeof(T))
- {
- case 1: space(m_data_spacenum).write_byte(address, T(data)); break;
- case 2: space(m_data_spacenum).write_word(address, T(data), mem_mask); break;
- case 4: space(m_data_spacenum).write_dword(address, T(data), mem_mask); break;
- }
+ // update interrupts -- software ints can occur this way
+ check_irqs();
}
-}
-
-bool mips1core_device_base::fetch(u32 address, std::function<void(u32)> &&apply)
-{
- if (memory_translate(0, TRANSLATE_FETCH, address))
+ else if (index == COP0_Status)
{
- apply(space(0).read_dword(address));
+ m_cpr[0][index] = data;
- return true;
+ // handle cache isolation and swap
+ m_data_spacenum = (data & SR_IsC) ? ((data & SR_SwC) ? 1 : 2) : 0;
+
+ // update interrupts
+ check_irqs();
}
- else
- return false;
+ else if (index == COP0_Context)
+ m_cpr[0][index] = (m_cpr[0][index] & ~PTE_BASE) | (data & PTE_BASE);
+ else if (index != COP0_PRId)
+ m_cpr[0][index] = data;
}
-std::string mips1core_device_base::debug_string(u32 string_pointer, unsigned const limit)
+void mips1core_device_base::handle_cop0(u32 const op)
{
- auto const suppressor(machine().disable_side_effects());
-
- bool done = false;
- bool mapped = false;
- std::string result("");
-
- while (!done)
+ switch (RSREG)
{
- done = true;
- load<u8>(string_pointer++, [limit, &done, &mapped, &result](u8 byte)
- {
- mapped = true;
- if (byte != 0)
+ case 0x00: /* MFCz */ if (RTREG) RTVAL = get_cop0_reg(RDREG); break;
+ case 0x02: /* CFCz */ if (RTREG) RTVAL = get_cop_creg<0>(RDREG); break;
+ case 0x04: /* MTCz */ set_cop0_reg(RDREG, RTVAL); break;
+ case 0x06: /* CTCz */ set_cop_creg<0>(RDREG, RTVAL); break;
+ case 0x08: /* BC */
+ switch (RTREG)
{
- result += byte;
-
- done = result.length() == limit;
+ case 0x00: /* BCzF */ if (!m_in_brcond[0]()) ADDPC(SIMMVAL); break;
+ case 0x01: /* BCzT */ if (m_in_brcond[0]()) ADDPC(SIMMVAL); break;
+ case 0x02: /* BCzFL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x03: /* BCzTL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ default: generate_exception(EXCEPTION_INVALIDOP); break;
}
- });
- }
-
- if (!mapped)
- result.assign("[unmapped]");
-
- return result;
-}
-
-std::string mips1core_device_base::debug_string_array(u32 array_pointer)
-{
- auto const suppressor(machine().disable_side_effects());
-
- bool done = false;
- std::string result("");
-
- while (!done)
- {
- done = true;
- load<u32>(array_pointer, [this, &done, &result](u32 string_pointer)
- {
- if (string_pointer != 0)
+ break;
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x13:
+ case 0x14:
+ case 0x15:
+ case 0x16:
+ case 0x17:
+ case 0x18:
+ case 0x19:
+ case 0x1a:
+ case 0x1b:
+ case 0x1c:
+ case 0x1d:
+ case 0x1e:
+ case 0x1f: /* COP */
+ switch (op & 0x01ffffff)
{
- if (!result.empty())
- result += ", ";
-
- result += '\"' + debug_string(string_pointer) + '\"';
-
- done = false;
+ case 0x01: /* TLBR */ break;
+ case 0x02: /* TLBWI */ break;
+ case 0x06: /* TLBWR */ break;
+ case 0x08: /* TLBP */ break;
+ case 0x10: /* RFE */ SR = (SR & 0xfffffff0) | ((SR >> 2) & 0x0f); break;
+ case 0x18: /* ERET */ generate_exception(EXCEPTION_INVALIDOP); break;
+ default: generate_exception(EXCEPTION_INVALIDOP); break;
}
- });
-
- array_pointer += 4;
- }
-
- return result;
-}
-
-void mips1_device_base::device_start()
-{
- mips1core_device_base::device_start();
-
- // cop0 tlb registers
- state_add(MIPS1_COP0 + COP0_Index, "Index", m_cop0[COP0_Index]);
- state_add(MIPS1_COP0 + COP0_Random, "Random", m_cop0[COP0_Random]);
- state_add(MIPS1_COP0 + COP0_EntryLo, "EntryLo", m_cop0[COP0_EntryLo]);
- state_add(MIPS1_COP0 + COP0_EntryHi, "EntryHi", m_cop0[COP0_EntryHi]);
- state_add(MIPS1_COP0 + COP0_Context, "Context", m_cop0[COP0_Context]);
-
- // cop1 registers
- if (m_fcr0)
- {
- state_add(MIPS1_FCR31, "FCSR", m_fcr31);
- for (unsigned i = 0; i < ARRAY_LENGTH(m_f); i++)
- state_add(MIPS1_F0 + i, util::string_format("F%d", i).c_str(), m_f[i]);
- }
-
- save_item(NAME(m_reset_time));
- save_item(NAME(m_tlb));
-
- save_item(NAME(m_fcr30));
- save_item(NAME(m_fcr31));
- save_item(NAME(m_f));
-}
-
-void mips1_device_base::device_reset()
-{
- mips1core_device_base::device_reset();
-
- // tlb is not shut down
- m_cop0[COP0_Status] &= ~SR_TS;
-
- m_reset_time = total_cycles();
-
- // initialize tlb mru index with identity mapping
- for (unsigned i = 0; i < ARRAY_LENGTH(m_tlb); i++)
- {
- m_tlb_mru[TRANSLATE_READ][i] = i;
- m_tlb_mru[TRANSLATE_WRITE][i] = i;
- m_tlb_mru[TRANSLATE_FETCH][i] = i;
+ break;
+ default: generate_exception(EXCEPTION_INVALIDOP); break;
}
}
@@ -1212,26 +407,26 @@ void mips1_device_base::handle_cop0(u32 const op)
{
case 0x42000001: // TLBR - read tlb
{
- u8 const index = (m_cop0[COP0_Index] >> 8) & 0x3f;
+ u8 const index = (m_cpr[0][COP0_Index] >> 8) & 0x3f;
- m_cop0[COP0_EntryHi] = m_tlb[index][0];
- m_cop0[COP0_EntryLo] = m_tlb[index][1];
+ m_cpr[0][COP0_EntryHi] = m_tlb[index][0];
+ m_cpr[0][COP0_EntryLo] = m_tlb[index][1];
}
break;
case 0x42000002: // TLBWI - write tlb (indexed)
{
- u8 const index = (m_cop0[COP0_Index] >> 8) & 0x3f;
+ u8 const index = (m_cpr[0][COP0_Index] >> 8) & 0x3f;
- m_tlb[index][0] = m_cop0[COP0_EntryHi];
- m_tlb[index][1] = m_cop0[COP0_EntryLo];
+ m_tlb[index][0] = m_cpr[0][COP0_EntryHi];
+ m_tlb[index][1] = m_cpr[0][COP0_EntryLo];
LOGMASKED(LOG_TLB, "tlb write index %d asid %d vpn 0x%08x pfn 0x%08x %c%c%c%c (%s)\n",
- index, (m_cop0[COP0_EntryHi] & EH_ASID) >> 6, m_cop0[COP0_EntryHi] & EH_VPN, m_cop0[COP0_EntryLo] & EL_PFN,
- m_cop0[COP0_EntryLo] & EL_N ? 'N' : '-',
- m_cop0[COP0_EntryLo] & EL_D ? 'D' : '-',
- m_cop0[COP0_EntryLo] & EL_V ? 'V' : '-',
- m_cop0[COP0_EntryLo] & EL_G ? 'G' : '-',
+ index, (m_cpr[0][COP0_EntryHi] & EH_ASID) >> 6, m_cpr[0][COP0_EntryHi] & EH_VPN, m_cpr[0][COP0_EntryLo] & EL_PFN,
+ m_cpr[0][COP0_EntryLo] & EL_N ? 'N' : '-',
+ m_cpr[0][COP0_EntryLo] & EL_D ? 'D' : '-',
+ m_cpr[0][COP0_EntryLo] & EL_V ? 'V' : '-',
+ m_cpr[0][COP0_EntryLo] & EL_G ? 'G' : '-',
machine().describe_context());
}
break;
@@ -1240,37 +435,37 @@ void mips1_device_base::handle_cop0(u32 const op)
{
u8 const random = get_cop0_reg(COP0_Random) >> 8;
- m_tlb[random][0] = m_cop0[COP0_EntryHi];
- m_tlb[random][1] = m_cop0[COP0_EntryLo];
+ m_tlb[random][0] = m_cpr[0][COP0_EntryHi];
+ m_tlb[random][1] = m_cpr[0][COP0_EntryLo];
LOGMASKED(LOG_TLB, "tlb write random %d asid %d vpn 0x%08x pfn 0x%08x %c%c%c%c (%s)\n",
- random, (m_cop0[COP0_EntryHi] & EH_ASID) >> 6, m_cop0[COP0_EntryHi] & EH_VPN, m_cop0[COP0_EntryLo] & EL_PFN,
- m_cop0[COP0_EntryLo] & EL_N ? 'N' : '-',
- m_cop0[COP0_EntryLo] & EL_D ? 'D' : '-',
- m_cop0[COP0_EntryLo] & EL_V ? 'V' : '-',
- m_cop0[COP0_EntryLo] & EL_G ? 'G' : '-',
+ random, (m_cpr[0][COP0_EntryHi] & EH_ASID) >> 6, m_cpr[0][COP0_EntryHi] & EH_VPN, m_cpr[0][COP0_EntryLo] & EL_PFN,
+ m_cpr[0][COP0_EntryLo] & EL_N ? 'N' : '-',
+ m_cpr[0][COP0_EntryLo] & EL_D ? 'D' : '-',
+ m_cpr[0][COP0_EntryLo] & EL_V ? 'V' : '-',
+ m_cpr[0][COP0_EntryLo] & EL_G ? 'G' : '-',
machine().describe_context());
}
break;
case 0x42000008: // TLBP - probe tlb
- m_cop0[COP0_Index] = 0x80000000;
+ m_cpr[0][COP0_Index] = 0x80000000;
for (u8 index = 0; index < 64; index++)
{
// test vpn and optionally asid
u32 const mask = (m_tlb[index][1] & EL_G) ? EH_VPN : EH_VPN | EH_ASID;
- if ((m_tlb[index][0] & mask) == (m_cop0[COP0_EntryHi] & mask))
+ if ((m_tlb[index][0] & mask) == (m_cpr[0][COP0_EntryHi] & mask))
{
LOGMASKED(LOG_TLB, "tlb probe hit vpn 0x%08x index %d (%s)\n",
- m_cop0[COP0_EntryHi] & mask, index, machine().describe_context());
+ m_cpr[0][COP0_EntryHi] & mask, index, machine().describe_context());
- m_cop0[COP0_Index] = index << 8;
+ m_cpr[0][COP0_Index] = index << 8;
break;
}
}
- if ((VERBOSE & LOG_TLB) && BIT(m_cop0[COP0_Index], 31))
+ if ((VERBOSE & LOG_TLB) && BIT(m_cpr[0][COP0_Index], 31))
LOGMASKED(LOG_TLB, "tlb probe miss asid %d vpn 0x%08x(%s)\n",
- (m_cop0[COP0_EntryHi] & EH_ASID) >> 6, m_cop0[COP0_EntryHi] & EH_VPN, machine().describe_context());
+ (m_cpr[0][COP0_EntryHi] & EH_ASID) >> 6, m_cpr[0][COP0_EntryHi] & EH_VPN, machine().describe_context());
break;
default:
@@ -1278,558 +473,491 @@ void mips1_device_base::handle_cop0(u32 const op)
}
}
-u32 mips1_device_base::get_cop0_reg(unsigned const reg)
+void mips1core_device_base::set_cop1_creg(int idx, u32 val)
{
- // assume 64-entry tlb with 8 wired entries
- if (reg == COP0_Random)
- m_cop0[reg] = (63 - ((total_cycles() - m_reset_time) % 56)) << 8;
-
- return m_cop0[reg];
+ // fpu revision register is read-only
+ if (idx)
+ m_ccr[1][idx] = val;
}
-void mips1_device_base::handle_cop1(u32 const op)
+void mips1core_device_base::handle_cop1(u32 const op)
{
- if (!(SR & SR_COP1))
- {
- generate_exception(EXCEPTION_BADCOP1);
- return;
- }
-
- if (!m_fcr0)
+ if (!m_hasfpu)
return;
- switch (op >> 26)
+ switch (RSREG)
{
- case 0x11: // COP1
- switch ((op >> 21) & 0x1f)
- {
- case 0x00: // MFC1
- if (FSREG & 1)
- // move the high half of the floating point register
- m_r[RTREG] = m_f[FSREG >> 1] >> 32;
- else
- // move the low half of the floating point register
- m_r[RTREG] = m_f[FSREG >> 1] >> 0;
- break;
- case 0x02: // CFC1
- switch (FSREG)
+ case 0x00: /* MFCz */ if (RTREG) RTVAL = get_cop_reg<1>(RDREG); break;
+ case 0x02: /* CFCz */ if (RTREG) RTVAL = get_cop_creg<1>(RDREG); break;
+ case 0x04: /* MTCz */ set_cop_reg<1>(RDREG, RTVAL); break;
+ case 0x06: /* CTCz */ set_cop1_creg(RDREG, RTVAL); break;
+ case 0x08: /* BC */
+ switch (RTREG)
{
- case 0: m_r[RTREG] = m_fcr0; break;
- case 30: m_r[RTREG] = m_fcr30; break;
- case 31: m_r[RTREG] = m_fcr31; break;
- break;
-
- default:
- logerror("cfc1 undefined fpu control register %d (%s)\n", FSREG, machine().describe_context());
- break;
+ case 0x00: /* BCzF */ if (!m_in_brcond[1]()) ADDPC(SIMMVAL); break;
+ case 0x01: /* BCzT */ if (m_in_brcond[1]()) ADDPC(SIMMVAL); break;
+ case 0x02: /* BCzFL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x03: /* BCzTL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ default: generate_exception(EXCEPTION_INVALIDOP); break;
}
break;
- case 0x04: // MTC1
- if (FSREG & 1)
- // load the high half of the floating point register
- m_f[FSREG >> 1] = (u64(m_r[RTREG]) << 32) | u32(m_f[FSREG >> 1]);
- else
- // load the low half of the floating point register
- m_f[FSREG >> 1] = (m_f[FSREG >> 1] & ~0xffffffffULL) | m_r[RTREG];
- break;
- case 0x06: // CTC1
- switch (RDREG)
- {
- case 0: // register is read-only
- break;
-
- case 30:
- m_fcr30 = m_r[RTREG];
- break;
-
- case 31:
- m_fcr31 = m_r[RTREG];
-
- // update rounding mode
- switch (m_fcr31 & FCR31_RM)
- {
- case 0: softfloat_roundingMode = softfloat_round_near_even; break;
- case 1: softfloat_roundingMode = softfloat_round_minMag; break;
- case 2: softfloat_roundingMode = softfloat_round_max; break;
- case 3: softfloat_roundingMode = softfloat_round_min; break;
- }
-
- // exception check
- if ((m_fcr31 & FCR31_CE) || ((m_fcr31 & FCR31_CM) >> 5) & (m_fcr31 & FCR31_EM))
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- break;
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x13:
+ case 0x14:
+ case 0x15:
+ case 0x16:
+ case 0x17:
+ case 0x18:
+ case 0x19:
+ case 0x1a:
+ case 0x1b:
+ case 0x1c:
+ case 0x1d:
+ case 0x1e:
+ case 0x1f: /* COP */ generate_exception(EXCEPTION_INVALIDOP); break;
+ default: generate_exception(EXCEPTION_INVALIDOP); break;
+ }
+}
- default:
- logerror("ctc1 undefined fpu control register %d (%s)\n", RDREG, machine().describe_context());
- break;
- }
- break;
- case 0x08: // BC
- switch ((op >> 16) & 0x1f)
+template <unsigned Coprocessor> void mips1core_device_base::handle_cop(u32 const op)
+{
+ switch (RSREG)
+ {
+ case 0x00: /* MFCz */ if (RTREG) RTVAL = get_cop_reg<Coprocessor>(RDREG); break;
+ case 0x02: /* CFCz */ if (RTREG) RTVAL = get_cop_creg<Coprocessor>(RDREG); break;
+ case 0x04: /* MTCz */ set_cop_reg<Coprocessor>(RDREG, RTVAL); break;
+ case 0x06: /* CTCz */ set_cop_creg<Coprocessor>(RDREG, RTVAL); break;
+ case 0x08: /* BC */
+ switch (RTREG)
{
- case 0x00: // BC1F
- if (!(m_fcr31 & FCR31_C))
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
- case 0x01: // BC1T
- if (m_fcr31 & FCR31_C)
- {
- m_branch_state = BRANCH;
- m_branch_target = m_pc + 4 + (s32(SIMMVAL) << 2);
- }
- break;
-
- default:
- // unimplemented operation
- m_fcr31 |= FCR31_CE;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- break;
+ case 0x00: /* BCzF */ if (!m_in_brcond[Coprocessor]()) ADDPC(SIMMVAL); break;
+ case 0x01: /* BCzT */ if (m_in_brcond[Coprocessor]()) ADDPC(SIMMVAL); break;
+ case 0x02: /* BCzFL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x03: /* BCzTL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ default: generate_exception(EXCEPTION_INVALIDOP); break;
}
break;
- case 0x10: // S
- switch (op & 0x3f)
- {
- case 0x00: // ADD.S
- set_cop1_reg(FDREG >> 1, f32_add(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }).v);
- break;
- case 0x01: // SUB.S
- set_cop1_reg(FDREG >> 1, f32_sub(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }).v);
- break;
- case 0x02: // MUL.S
- set_cop1_reg(FDREG >> 1, f32_mul(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }).v);
- break;
- case 0x03: // DIV.S
- set_cop1_reg(FDREG >> 1, f32_div(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }).v);
- break;
- case 0x05: // ABS.S
- if (f32_lt(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ 0 }))
- set_cop1_reg(FDREG >> 1, f32_mul(float32_t{ u32(m_f[FSREG >> 1]) }, i32_to_f32(-1)).v);
- else
- set_cop1_reg(FDREG >> 1, m_f[FSREG >> 1]);
- break;
- case 0x06: // MOV.S
- m_f[FDREG >> 1] = m_f[FSREG >> 1];
- break;
- case 0x07: // NEG.S
- set_cop1_reg(FDREG >> 1, f32_mul(float32_t{ u32(m_f[FSREG >> 1]) }, i32_to_f32(-1)).v);
- break;
-
- case 0x21: // CVT.D.S
- set_cop1_reg(FDREG >> 1, f32_to_f64(float32_t{ u32(m_f[FSREG >> 1]) }).v);
- break;
- case 0x24: // CVT.W.S
- set_cop1_reg(FDREG >> 1, f32_to_i32(float32_t{ u32(m_f[FSREG >> 1]) }, softfloat_roundingMode, true));
- break;
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x13:
+ case 0x14:
+ case 0x15:
+ case 0x16:
+ case 0x17:
+ case 0x18:
+ case 0x19:
+ case 0x1a:
+ case 0x1b:
+ case 0x1c:
+ case 0x1d:
+ case 0x1e:
+ case 0x1f: /* COP */ generate_exception(EXCEPTION_INVALIDOP); break;
+ default: generate_exception(EXCEPTION_INVALIDOP); break;
+ }
+}
- case 0x30: // C.F.S (false)
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x31: // C.UN.S (unordered)
- f32_eq(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) });
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x32: // C.EQ.S (equal)
- if (f32_eq(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x33: // C.UEQ.S (unordered equal)
- if (f32_eq(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x34: // C.OLT.S (less than)
- if (f32_lt(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x35: // C.ULT.S (unordered less than)
- if (f32_lt(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x36: // C.OLE.S (less than or equal)
- if (f32_le(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x37: // C.ULE.S (unordered less than or equal)
- if (f32_le(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
+void mips1core_device_base::execute_run()
+{
+ // check for IRQs
+ check_irqs();
- case 0x38: // C.SF.S (signalling false)
- f32_eq(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) });
+ // core execution loop
+ do
+ {
+ // debugging
+ debugger_instruction_hook(m_pc);
- m_fcr31 &= ~FCR31_C;
+#if ENABLE_IOP_KPUTS
+ if ((m_pc & 0x1fffffff) == 0x00012C48 || (m_pc & 0x1fffffff) == 0x0001420C || (m_pc & 0x1fffffff) == 0x0001430C)
+ {
+ u32 ptr = m_r[5];
+ u32 length = m_r[6];
+ if (length >= 4096)
+ length = 4095;
+ while (length)
+ {
+ load<u8>(ptr, [this](char c) { printf("%c", c); });
+ ptr++;
+ length--;
+ }
+ fflush(stdout);
+ }
+#endif
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
+ // fetch and execute instruction
+ fetch(m_pc, [this](u32 const op)
+ {
+ // parse the instruction
+ switch (op >> 26)
{
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
- break;
- case 0x39: // C.NGLE.S (not greater, less than or equal)
- f32_eq(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) });
+ case 0x00: /* SPECIAL */
+ switch (op & 63)
+ {
+ case 0x00: /* SLL */ if (RDREG) RDVAL = RTVAL << SHIFT; break;
+ case 0x02: /* SRL */ if (RDREG) RDVAL = RTVAL >> SHIFT; break;
+ case 0x03: /* SRA */ if (RDREG) RDVAL = s32(RTVAL) >> SHIFT; break;
+ case 0x04: /* SLLV */ if (RDREG) RDVAL = RTVAL << (RSVAL & 31); break;
+ case 0x06: /* SRLV */ if (RDREG) RDVAL = RTVAL >> (RSVAL & 31); break;
+ case 0x07: /* SRAV */ if (RDREG) RDVAL = s32(RTVAL) >> (RSVAL & 31); break;
+ case 0x08: /* JR */ SETPC(RSVAL); break;
+ case 0x09: /* JALR */ SETPCL(RSVAL, RDREG); break;
+ case 0x0c: /* SYSCALL */ generate_exception(EXCEPTION_SYSCALL); break;
+ case 0x0d: /* BREAK */ generate_exception(EXCEPTION_BREAK); break;
+ case 0x0f: /* SYNC */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x10: /* MFHI */ if (RDREG) RDVAL = m_hi; break;
+ case 0x11: /* MTHI */ m_hi = RSVAL; break;
+ case 0x12: /* MFLO */ if (RDREG) RDVAL = m_lo; break;
+ case 0x13: /* MTLO */ m_lo = RSVAL; break;
+ case 0x18: /* MULT */
+ {
+ u64 product = mul_32x32(RSVAL, RTVAL);
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_C | FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x3a: // C.SEQ.S (signalling equal)
- if (f32_eq(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
+ m_lo = product;
+ m_hi = product >> 32;
+ m_icount -= 11;
+ }
+ break;
+ case 0x19: /* MULTU */
+ {
+ u64 product = mulu_32x32(RSVAL, RTVAL);
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
- break;
- case 0x3b: // C.NGL.S (not greater or less than)
- if (f32_eq(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
+ m_lo = product;
+ m_hi = product >> 32;
+ m_icount -= 11;
+ }
+ break;
+ case 0x1a: /* DIV */
+ if (RTVAL)
+ {
+ m_lo = s32(RSVAL) / s32(RTVAL);
+ m_hi = s32(RSVAL) % s32(RTVAL);
+ }
+ m_icount -= 34;
+ break;
+ case 0x1b: /* DIVU */
+ if (RTVAL)
+ {
+ m_lo = RSVAL / RTVAL;
+ m_hi = RSVAL % RTVAL;
+ }
+ m_icount -= 34;
+ break;
+ case 0x20: /* ADD */
+ {
+ u32 const sum = RSVAL + RTVAL;
+
+ // overflow: (sign(addend0) == sign(addend1)) && (sign(addend0) != sign(sum))
+ if (!BIT(RSVAL ^ RTVAL, 31) && BIT(RSVAL ^ sum, 31))
+ generate_exception(EXCEPTION_OVERFLOW);
+ else if (RDREG)
+ RDVAL = sum;
+ }
+ break;
+ case 0x21: /* ADDU */ if (RDREG) RDVAL = RSVAL + RTVAL; break;
+ case 0x22: /* SUB */
+ {
+ u32 const difference = RSVAL - RTVAL;
+
+ // overflow: (sign(minuend) != sign(subtrahend)) && (sign(minuend) != sign(difference))
+ if (BIT(RSVAL ^ RTVAL, 31) && BIT(RSVAL ^ difference, 31))
+ generate_exception(EXCEPTION_OVERFLOW);
+ else if (RDREG)
+ RDVAL = difference;
+ }
+ break;
+ case 0x23: /* SUBU */ if (RDREG) RDVAL = RSVAL - RTVAL; break;
+ case 0x24: /* AND */ if (RDREG) RDVAL = RSVAL & RTVAL; break;
+ case 0x25: /* OR */ if (RDREG) RDVAL = RSVAL | RTVAL; break;
+ case 0x26: /* XOR */ if (RDREG) RDVAL = RSVAL ^ RTVAL; break;
+ case 0x27: /* NOR */ if (RDREG) RDVAL = ~(RSVAL | RTVAL); break;
+ case 0x2a: /* SLT */ if (RDREG) RDVAL = s32(RSVAL) < s32(RTVAL); break;
+ case 0x2b: /* SLTU */ if (RDREG) RDVAL = u32(RSVAL) < u32(RTVAL); break;
+ case 0x30: /* TEQ */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x31: /* TGEU */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x32: /* TLT */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x33: /* TLTU */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x34: /* TGE */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x36: /* TNE */ generate_exception(EXCEPTION_INVALIDOP); break;
+ default: /* ??? */ generate_exception(EXCEPTION_INVALIDOP); break;
+ }
+ break;
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
- break;
- case 0x3c: // C.LT.S (less than)
- if (f32_lt(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
+ case 0x01: /* REGIMM */
+ switch (RTREG)
+ {
+ case 0x00: /* BLTZ */ if (s32(RSVAL) < 0) ADDPC(SIMMVAL); break;
+ case 0x01: /* BGEZ */ if (s32(RSVAL) >= 0) ADDPC(SIMMVAL); break;
+ case 0x02: /* BLTZL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x03: /* BGEZL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x08: /* TGEI */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x09: /* TGEIU */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x0a: /* TLTI */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x0b: /* TLTIU */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x0c: /* TEQI */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x0e: /* TNEI */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x10: /* BLTZAL */ if (s32(RSVAL) < 0) ADDPCL(SIMMVAL, 31); break;
+ case 0x11: /* BGEZAL */ if (s32(RSVAL) >= 0) ADDPCL(SIMMVAL, 31); break;
+ case 0x12: /* BLTZALL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x13: /* BGEZALL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ default: /* ??? */ generate_exception(EXCEPTION_INVALIDOP); break;
+ }
+ break;
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
- break;
- case 0x3d: // C.NGE.S (not greater or equal)
- if (f32_lt(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
+ case 0x02: /* J */ ABSPC(LIMMVAL); break;
+ case 0x03: /* JAL */ ABSPCL(LIMMVAL, 31); break;
+ case 0x04: /* BEQ */ if (RSVAL == RTVAL) ADDPC(SIMMVAL); break;
+ case 0x05: /* BNE */ if (RSVAL != RTVAL) ADDPC(SIMMVAL); break;
+ case 0x06: /* BLEZ */ if (s32(RSVAL) <= 0) ADDPC(SIMMVAL); break;
+ case 0x07: /* BGTZ */ if (s32(RSVAL) > 0) ADDPC(SIMMVAL); break;
+ case 0x08: /* ADDI */
+ {
+ u32 const sum = RSVAL + SIMMVAL;
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
+ // overflow: (sign(addend0) == sign(addend1)) && (sign(addend0) != sign(sum))
+ if (!BIT(RSVAL ^ s32(SIMMVAL), 31) && BIT(RSVAL ^ sum, 31))
+ generate_exception(EXCEPTION_OVERFLOW);
+ else if (RTREG)
+ RTVAL = sum;
+ }
+ break;
+ case 0x09: /* ADDIU */ if (RTREG) RTVAL = RSVAL + SIMMVAL; break;
+ case 0x0a: /* SLTI */ if (RTREG) RTVAL = s32(RSVAL) < s32(SIMMVAL); break;
+ case 0x0b: /* SLTIU */ if (RTREG) RTVAL = u32(RSVAL) < u32(SIMMVAL); break;
+ case 0x0c: /* ANDI */ if (RTREG) RTVAL = RSVAL & UIMMVAL; break;
+ case 0x0d: /* ORI */ if (RTREG) RTVAL = RSVAL | UIMMVAL; break;
+ case 0x0e: /* XORI */ if (RTREG) RTVAL = RSVAL ^ UIMMVAL; break;
+ case 0x0f: /* LUI */ if (RTREG) RTVAL = UIMMVAL << 16; break;
+ case 0x10: /* COP0 */
+ if (!(SR & SR_KUc) || (SR & SR_COP0))
+ handle_cop0(op);
+ else
+ generate_exception(EXCEPTION_BADCOP);
+ break;
+ case 0x11: // COP1
+ if (SR & SR_COP1)
+ handle_cop1(op);
+ else
+ generate_exception(EXCEPTION_BADCOP);
+ break;
+ case 0x12: // COP2
+ if (SR & SR_COP2)
+ handle_cop<2>(op);
+ else
+ generate_exception(EXCEPTION_BADCOP);
+ break;
+ case 0x13: // COP3
+ if (SR & SR_COP3)
+ handle_cop<3>(op);
+ else
+ generate_exception(EXCEPTION_BADCOP);
+ break;
+ case 0x14: /* BEQL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x15: /* BNEL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x16: /* BLEZL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x17: /* BGTZL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x20: /* LB */ load<u8>(SIMMVAL + RSVAL, [this, op](s8 temp) { if (RTREG) RTVAL = temp; }); break;
+ case 0x21: /* LH */ load<u16>(SIMMVAL + RSVAL, [this, op](s16 temp) { if (RTREG) RTVAL = temp; }); break;
+ case 0x22: /* LWL */ lwl(op); break;
+ case 0x23: /* LW */ load<u32>(SIMMVAL + RSVAL, [this, op](u32 temp) { if (RTREG) RTVAL = temp; }); break;
+ case 0x24: /* LBU */ load<u8>(SIMMVAL + RSVAL, [this, op](u8 temp) { if (RTREG) RTVAL = temp; }); break;
+ case 0x25: /* LHU */ load<u16>(SIMMVAL + RSVAL, [this, op](u16 temp) { if (RTREG) RTVAL = temp; }); break;
+ case 0x26: /* LWR */ lwr(op); break;
+ case 0x28: /* SB */ store<u8>(SIMMVAL + RSVAL, RTVAL); break;
+ case 0x29: /* SH */ store<u16>(SIMMVAL + RSVAL, RTVAL); break;
+ case 0x2a: /* SWL */ swl(op); break;
+ case 0x2b: /* SW */ store<u32>(SIMMVAL + RSVAL, RTVAL); break;
+ case 0x2e: /* SWR */ swr(op); break;
+ case 0x2f: /* CACHE */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x30: /* LL */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x31: /* LWC1 */ load<u32>(SIMMVAL + RSVAL, [this, op](u32 temp) { set_cop_reg<1>(RTREG, temp); }); break;
+ case 0x32: /* LWC2 */ load<u32>(SIMMVAL + RSVAL, [this, op](u32 temp) { set_cop_reg<2>(RTREG, temp); }); break;
+ case 0x33: /* LWC3 */ load<u32>(SIMMVAL + RSVAL, [this, op](u32 temp) { set_cop_reg<3>(RTREG, temp); }); break;
+ case 0x34: /* LDC0 */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x35: /* LDC1 */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x36: /* LDC2 */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x37: /* LDC3 */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x38: /* SC */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x39: /* LWC1 */ store<u32>(SIMMVAL + RSVAL, get_cop_reg<1>(RTREG)); break;
+ case 0x3a: /* LWC2 */ store<u32>(SIMMVAL + RSVAL, get_cop_reg<2>(RTREG)); break;
+ case 0x3b: /* LWC3 */ store<u32>(SIMMVAL + RSVAL, get_cop_reg<3>(RTREG)); break;
+ case 0x3c: /* SDC0 */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x3d: /* SDC1 */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x3e: /* SDC2 */ generate_exception(EXCEPTION_INVALIDOP); break;
+ case 0x3f: /* SDC3 */ generate_exception(EXCEPTION_INVALIDOP); break;
+ default: /* ??? */ generate_exception(EXCEPTION_INVALIDOP); break;
}
+
+ // update pc and branch state
+ switch (m_branch_state)
+ {
+ case NONE:
+ m_pc += 4;
break;
- case 0x3e: // C.LE.S (less than or equal)
- if (f32_le(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
+ case DELAY:
+ m_branch_state = NONE;
+ m_pc = m_branch_target;
break;
- case 0x3f: // C.NGT.S (not greater than)
- if (f32_le(float32_t{ u32(m_f[FSREG >> 1]) }, float32_t{ u32(m_f[FTREG >> 1]) }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
+ case BRANCH:
+ m_branch_state = DELAY;
+ m_pc += 4;
break;
- default: // unimplemented operation
- m_fcr31 |= FCR31_CE;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
+ case EXCEPTION:
+ m_branch_state = NONE;
break;
}
- break;
- case 0x11: // D
- switch (op & 0x3f)
- {
- case 0x00: // ADD.D
- set_cop1_reg(FDREG >> 1, f64_add(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }).v);
- break;
- case 0x01: // SUB.D
- set_cop1_reg(FDREG >> 1, f64_sub(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }).v);
- break;
- case 0x02: // MUL.D
- set_cop1_reg(FDREG >> 1, f64_mul(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }).v);
- break;
- case 0x03: // DIV.D
- set_cop1_reg(FDREG >> 1, f64_div(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }).v);
- break;
+ });
+ m_icount--;
- case 0x05: // ABS.D
- if (f64_lt(float64_t{ m_f[FSREG >> 1] }, float64_t{ 0 }))
- set_cop1_reg(FDREG >> 1, f64_mul(float64_t{ m_f[FSREG >> 1] }, i32_to_f64(-1)).v);
- else
- set_cop1_reg(FDREG >> 1, m_f[FSREG >> 1]);
- break;
- case 0x06: // MOV.D
- m_f[FDREG >> 1] = m_f[FSREG >> 1];
- break;
- case 0x07: // NEG.D
- set_cop1_reg(FDREG >> 1, f64_mul(float64_t{ m_f[FSREG >> 1] }, i32_to_f64(-1)).v);
- break;
+ } while (m_icount > 0 || m_branch_state);
+}
- case 0x20: // CVT.S.D
- set_cop1_reg(FDREG >> 1, f64_to_f32(float64_t{ m_f[FSREG >> 1] }).v);
- break;
- case 0x24: // CVT.W.D
- set_cop1_reg(FDREG >> 1, f64_to_i32(float64_t{ m_f[FSREG >> 1] }, softfloat_roundingMode, true));
- break;
+void mips1core_device_base::lwl(u32 const op)
+{
+ offs_t const offset = SIMMVAL + RSVAL;
+ load<u32>(offset & ~3, [this, op, offset](u32 temp)
+ {
+ if (RTREG)
+ {
+ unsigned const shift = ((offset & 3) ^ ENDIAN_VALUE_LE_BE(m_endianness, 3, 0)) << 3;
- case 0x30: // C.F.D (false)
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x31: // C.UN.D (unordered)
- f64_eq(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] });
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x32: // C.EQ.D (equal)
- if (f64_eq(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x33: // C.UEQ.D (unordered equal)
- if (f64_eq(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x34: // C.OLT.D (less than)
- if (f64_lt(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x35: // C.ULT.D (unordered less than)
- if (f64_lt(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x36: // C.OLE.D (less than or equal)
- if (f64_le(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x37: // C.ULE.D (unordered less than or equal)
- if (f64_le(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- break;
+ RTVAL = (RTVAL & ~u32(0xffffffffU << shift)) | (temp << shift);
+ }
+ });
+}
- case 0x38: // C.SF.D (signalling false)
- f64_eq(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] });
+void mips1core_device_base::lwr(u32 const op)
+{
+ offs_t const offset = SIMMVAL + RSVAL;
+ load<u32>(offset & ~3, [this, op, offset](u32 temp)
+ {
+ if (RTREG)
+ {
+ unsigned const shift = ((offset & 0x3) ^ ENDIAN_VALUE_LE_BE(m_endianness, 0, 3)) << 3;
- m_fcr31 &= ~FCR31_C;
+ RTVAL = (RTVAL & ~u32(0xffffffffU >> shift)) | (temp >> shift);
+ }
+ });
+}
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
- break;
- case 0x39: // C.NGLE.D (not greater, less than or equal)
- f64_eq(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] });
+void mips1core_device_base::swl(u32 const op)
+{
+ offs_t const offset = SIMMVAL + RSVAL;
+ unsigned const shift = ((offset & 3) ^ ENDIAN_VALUE_LE_BE(m_endianness, 3, 0)) << 3;
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_C | FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
- else
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x3a: // C.SEQ.D (signalling equal)
- if (f64_eq(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
+ // only load if necessary
+ if (shift)
+ {
+ load<u32>(offset & ~3, [this, op, offset, shift](u32 temp)
+ {
+ store<u32>(offset & ~3, (temp & ~u32(0xffffffffU >> shift)) | (RTVAL >> shift));
+ });
+ }
+ else
+ store<u32>(offset & ~3, RTVAL);
+}
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
- break;
- case 0x3b: // C.NGL.D (not greater or less than)
- if (f64_eq(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
- break;
- case 0x3c: // C.LT.D (less than)
- if (f64_lt(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
+void mips1core_device_base::swr(u32 const op)
+{
+ offs_t const offset = SIMMVAL + RSVAL;
+ unsigned const shift = ((offset & 3) ^ ENDIAN_VALUE_LE_BE(m_endianness, 0, 3)) << 3;
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
- break;
- case 0x3d: // C.NGE.D (not greater or equal)
- if (f64_lt(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
+ // only load if necessary
+ if (shift)
+ {
+ load<u32>(offset & ~3, [this, op, offset, shift](u32 temp)
+ {
+ store<u32>(offset & ~3, (temp & ~u32(0xffffffffU << shift)) | (RTVAL << shift));
+ });
+ }
+ else
+ store<u32>(offset & ~3, RTVAL);
+}
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
- break;
- case 0x3e: // C.LE.D (less than or equal)
- if (f64_le(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
+template <typename T, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(T)>>::value, void> mips1core_device_base::load(u32 program_address, U &&apply)
+{
+ offs_t translated_address = program_address;
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
- break;
- case 0x3f: // C.NGT.D (not greater than)
- if (f64_le(float64_t{ m_f[FSREG >> 1] }, float64_t{ m_f[FTREG >> 1] }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
+ if (memory_translate(m_data_spacenum, TRANSLATE_READ, translated_address))
+ {
+ switch (sizeof(T))
+ {
+ case 1: apply(T(space(m_data_spacenum).read_byte(translated_address))); break;
+ case 2: apply(T(space(m_data_spacenum).read_word(translated_address))); break;
+ case 4: apply(T(space(m_data_spacenum).read_dword(translated_address))); break;
+ }
+ }
+}
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- }
- break;
+template <typename T, typename U> std::enable_if_t<std::is_convertible<U, T>::value, void> mips1core_device_base::store(u32 program_address, U data)
+{
+ offs_t translated_address = program_address;
- default: // unimplemented operation
- m_fcr31 |= FCR31_CE;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- break;
- }
- break;
- case 0x14: // W
- switch (op & 0x3f)
- {
- case 0x20: // CVT.S.W
- set_cop1_reg(FDREG >> 1, i32_to_f32(s32(m_f[FSREG >> 1])).v);
- break;
- case 0x21: // CVT.D.W
- set_cop1_reg(FDREG >> 1, i32_to_f64(s32(m_f[FSREG >> 1])).v);
- break;
+ if (memory_translate(m_data_spacenum, TRANSLATE_WRITE, translated_address))
+ {
+ switch (sizeof(T))
+ {
+ case 1: space(m_data_spacenum).write_byte(translated_address, T(data)); break;
+ case 2: space(m_data_spacenum).write_word(translated_address, T(data)); break;
+ case 4: space(m_data_spacenum).write_dword(translated_address, T(data)); break;
+ }
+ }
+}
- default: // unimplemented operation
- m_fcr31 |= FCR31_CE;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- break;
- }
- break;
+bool mips1core_device_base::fetch(u32 program_address, std::function<void(u32)> &&apply)
+{
+ offs_t translated_address = program_address;
- default: // unimplemented operation
- m_fcr31 |= FCR31_CE;
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- break;
- }
- break;
- case 0x31: // LWC1
- load<u32>(SIMMVAL + m_r[RSREG],
- [this, op](u32 data)
- {
- if (FTREG & 1)
- // load the high half of the floating point register
- m_f[FTREG >> 1] = (u64(data) << 32) | u32(m_f[FTREG >> 1]);
- else
- // load the low half of the floating point register
- m_f[FTREG >> 1] = (m_f[FTREG >> 1] & ~0xffffffffULL) | data;
- });
- break;
- case 0x39: // SWC1
- if (FTREG & 1)
- // store the high half of the floating point register
- store<u32>(SIMMVAL + m_r[RSREG], m_f[FTREG >> 1] >> 32);
- else
- // store the low half of the floating point register
- store<u32>(SIMMVAL + m_r[RSREG], m_f[FTREG >> 1]);
- break;
+ if (memory_translate(0, TRANSLATE_FETCH, translated_address))
+ {
+ apply(space(0).read_dword(translated_address));
+
+ return true;
}
+ else
+ return false;
}
-void mips1_device_base::set_cop1_reg(unsigned const reg, u64 const data)
+bool mips1core_device_base::memory_translate(int spacenum, int intention, offs_t &address)
{
- // translate softfloat exception flags to cause register
- if (softfloat_exceptionFlags)
+ // check for kernel memory address
+ if (BIT(address, 31))
{
- if (softfloat_exceptionFlags & softfloat_flag_inexact)
- m_fcr31 |= FCR31_CI;
- if (softfloat_exceptionFlags & softfloat_flag_underflow)
- m_fcr31 |= FCR31_CU;
- if (softfloat_exceptionFlags & softfloat_flag_overflow)
- m_fcr31 |= FCR31_CO;
- if (softfloat_exceptionFlags & softfloat_flag_infinite)
- m_fcr31 |= FCR31_CZ;
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- m_fcr31 |= FCR31_CV;
-
- // check if exception is enabled
- if (((m_fcr31 & FCR31_CM) >> 5) & (m_fcr31 & FCR31_EM))
+ // check debug or kernel mode
+ if ((intention & TRANSLATE_DEBUG_MASK) || !(SR & SR_KUc))
{
- execute_set_input(m_fpu_irq, ASSERT_LINE);
- return;
+ switch (address & 0xe0000000)
+ {
+ case 0x80000000: // kseg0: unmapped, cached, privileged
+ case 0xa0000000: // kseg1: unmapped, uncached, privileged
+ address &= ~0xe0000000;
+ break;
+
+ case 0xc0000000: // kseg2: mapped, cached, privileged
+ case 0xe0000000:
+ break;
+ }
}
+ else if (SR & SR_KUc)
+ {
+ // exception
+ m_cpr[0][COP0_BadVAddr] = address;
- // set flags
- m_fcr31 |= ((m_fcr31 & FCR31_CM) >> 10);
+ generate_exception((intention & TRANSLATE_WRITE) ? EXCEPTION_ADDRSTORE : EXCEPTION_ADDRLOAD);
+ return false;
+ }
}
+ else
+ // kuseg physical addresses have a 1GB offset
+ address += 0x40000000;
- m_f[reg] = data;
+ return true;
}
bool mips1_device_base::memory_translate(int spacenum, int intention, offs_t &address)
@@ -1854,30 +982,21 @@ bool mips1_device_base::memory_translate(int spacenum, int intention, offs_t &ad
}
else if (SR & SR_KUc)
{
- if (!machine().side_effects_disabled())
- {
- // exception
- m_cop0[COP0_BadVAddr] = address;
+ // exception
+ m_cpr[0][COP0_BadVAddr] = address;
- generate_exception((intention & TRANSLATE_WRITE) ? EXCEPTION_ADDRSTORE : EXCEPTION_ADDRLOAD);
- }
+ generate_exception((intention & TRANSLATE_WRITE) ? EXCEPTION_ADDRSTORE : EXCEPTION_ADDRLOAD);
return false;
}
}
// key is a combination of VPN and ASID
- u32 const key = (address & EH_VPN) | (m_cop0[COP0_EntryHi] & EH_ASID);
-
- unsigned *mru = m_tlb_mru[intention & TRANSLATE_TYPE_MASK];
-
+ u32 const key = (address & EH_VPN) | (m_cpr[0][COP0_EntryHi] & EH_ASID);
bool refill = !BIT(address, 31);
- bool modify = false;
+ bool dirty = false;
- for (unsigned i = 0; i < ARRAY_LENGTH(m_tlb); i++)
+ for (u32 const *entry : m_tlb)
{
- unsigned const index = mru[i];
- u32 const *const entry = m_tlb[index];
-
// test vpn and optionally asid
u32 const mask = (entry[1] & EL_G) ? EH_VPN : EH_VPN | EH_ASID;
if ((entry[0] & mask) != (key & mask))
@@ -1894,39 +1013,28 @@ bool mips1_device_base::memory_translate(int spacenum, int intention, offs_t &ad
if ((intention & TRANSLATE_WRITE) && !(entry[1] & EL_D))
{
refill = false;
- modify = true;
+ dirty = true;
break;
}
// translate the address
address &= ~EH_VPN;
address |= (entry[1] & EL_PFN);
-
- // promote the entry in the mru index
- if (i > 0)
- std::swap(mru[i - 1], mru[i]);
-
return true;
}
- if (!machine().side_effects_disabled() && !(intention & TRANSLATE_DEBUG_MASK))
+ if (!(intention & TRANSLATE_DEBUG_MASK))
{
- if (VERBOSE & LOG_TLB)
- {
- if (modify)
- LOGMASKED(LOG_TLB, "tlb modify asid %d address 0x%08x (%s)\n",
- (m_cop0[COP0_EntryHi] & EH_ASID) >> 6, address, machine().describe_context());
- else
- LOGMASKED(LOG_TLB, "tlb miss %c asid %d address 0x%08x (%s)\n",
- (intention & TRANSLATE_WRITE) ? 'w' : 'r', (m_cop0[COP0_EntryHi] & EH_ASID) >> 6, address, machine().describe_context());
- }
+ if ((VERBOSE & LOG_TLB) && !dirty)
+ LOGMASKED(LOG_TLB, "tlb miss %c asid %d address 0x%08x (%s)\n",
+ (intention & TRANSLATE_WRITE) ? 'w' : 'r', (m_cpr[0][COP0_EntryHi] & EH_ASID) >> 6, address, machine().describe_context());
// load tlb exception registers
- m_cop0[COP0_BadVAddr] = address;
- m_cop0[COP0_EntryHi] = key;
- m_cop0[COP0_Context] = (m_cop0[COP0_Context] & PTE_BASE) | ((address >> 10) & BAD_VPN);
+ m_cpr[0][COP0_BadVAddr] = address;
+ m_cpr[0][COP0_EntryHi] = key;
+ m_cpr[0][COP0_Context] = (m_cpr[0][COP0_Context] & PTE_BASE) | ((address >> 10) & BAD_VPN);
- generate_exception(modify ? EXCEPTION_TLBMOD : (intention & TRANSLATE_WRITE) ? EXCEPTION_TLBSTORE : EXCEPTION_TLBLOAD, refill);
+ generate_exception(dirty ? EXCEPTION_TLBMOD : (intention & TRANSLATE_WRITE) ? EXCEPTION_TLBSTORE : EXCEPTION_TLBLOAD, refill);
}
return false;
diff --git a/src/devices/cpu/mips/mips1.h b/src/devices/cpu/mips/mips1.h
index 3ae34e4b69f..d77bdef3cdb 100644
--- a/src/devices/cpu/mips/mips1.h
+++ b/src/devices/cpu/mips/mips1.h
@@ -9,8 +9,21 @@
class mips1core_device_base : public cpu_device
{
public:
+ // floating point coprocessor revision numbers recognised by RISC/os 4.52 and IRIX
+ enum fpu_rev_t : u32
+ {
+ MIPS_R2360 = 0x0100, // MIPS R2360 Floating Point Board
+ MIPS_R2010 = 0x0200, // MIPS R2010 VLSI Floating Point Chip
+ MIPS_R2010A = 0x0310, // MIPS R2010A VLSI Floating Point Chip
+ MIPS_R3010 = 0x0320, // MIPS R3010 VLSI Floating Point Chip
+ MIPS_R3010A = 0x0330, // MIPS R3010A VLSI Floating Point Chip
+ MIPS_R3010Av4 = 0x0340, // MIPS R3010A VLSI Floating Point Chip
+ MIPS_R6010 = 0x0400, // MIPS R6010 Floating Point Chip
+ };
+
// device configuration
void set_endianness(endianness_t endianness) { m_endianness = endianness; }
+ void set_fpurev(u32 revision) { m_hasfpu = true; m_fpurev = revision; }
// input lines
template <unsigned Coprocessor> auto in_brcond() { return m_in_brcond[Coprocessor].bind(); }
@@ -18,40 +31,53 @@ public:
protected:
mips1core_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 cpurev, size_t icache_size, size_t dcache_size);
- enum registers : unsigned
+ enum registers
{
- MIPS1_R0 = 0,
- MIPS1_COP0 = 32,
- MIPS1_F0 = 64,
+ // general purpose cpu registers
+ MIPS1_R0, MIPS1_R1, MIPS1_R2, MIPS1_R3, MIPS1_R4, MIPS1_R5, MIPS1_R6, MIPS1_R7,
+ MIPS1_R8, MIPS1_R9, MIPS1_R10, MIPS1_R11, MIPS1_R12, MIPS1_R13, MIPS1_R14, MIPS1_R15,
+ MIPS1_R16, MIPS1_R17, MIPS1_R18, MIPS1_R19, MIPS1_R20, MIPS1_R21, MIPS1_R22, MIPS1_R23,
+ MIPS1_R24, MIPS1_R25, MIPS1_R26, MIPS1_R27, MIPS1_R28, MIPS1_R29, MIPS1_R30, MIPS1_R31,
- MIPS1_PC = 80,
+ // other cpu registers
MIPS1_HI,
MIPS1_LO,
- MIPS1_FCR30,
- MIPS1_FCR31,
+ MIPS1_PC,
+
+ // coprocessor 0 registers
+ MIPS1_COP0_INDEX, // reg 0, tlb only
+ MIPS1_COP0_RANDOM, // reg 1, tlb only
+ MIPS1_COP0_ENTRYLO, // reg 2, tlb only
+ MIPS1_COP0_BUSCTRL, // reg 2, r3041 only
+ MIPS1_COP0_CONFIG, // reg 3, r3041/r3071/r3081 only
+ MIPS1_COP0_CONTEXT, // reg 4, tlb only
+ MIPS1_COP0_BADVADDR, // reg 8
+ MIPS1_COP0_COUNT, // reg 9, r3041 only
+ MIPS1_COP0_ENTRYHI, // reg 10, tlb only
+ MIPS1_COP0_PORTSIZE, // reg 10, r3041 only
+ MIPS1_COP0_COMPARE, // reg 11, r3041 only
+ MIPS1_COP0_SR, // reg 12
+ MIPS1_COP0_CAUSE, // reg 13
+ MIPS1_COP0_EPC, // reg 14
+ MIPS1_COP0_PRID, // reg 15
};
- enum exception : u32
+ enum exception : int
{
- EXCEPTION_INTERRUPT = 0x00000000,
- EXCEPTION_TLBMOD = 0x00000004,
- EXCEPTION_TLBLOAD = 0x00000008,
- EXCEPTION_TLBSTORE = 0x0000000c,
- EXCEPTION_ADDRLOAD = 0x00000010,
- EXCEPTION_ADDRSTORE = 0x00000014,
- EXCEPTION_BUSINST = 0x00000018,
- EXCEPTION_BUSDATA = 0x0000001c,
- EXCEPTION_SYSCALL = 0x00000020,
- EXCEPTION_BREAK = 0x00000024,
- EXCEPTION_INVALIDOP = 0x00000028,
- EXCEPTION_BADCOP = 0x0000002c,
- EXCEPTION_OVERFLOW = 0x00000030,
- EXCEPTION_TRAP = 0x00000034,
-
- EXCEPTION_BADCOP0 = 0x0000002c,
- EXCEPTION_BADCOP1 = 0x1000002c,
- EXCEPTION_BADCOP2 = 0x2000002c,
- EXCEPTION_BADCOP3 = 0x3000002c,
+ EXCEPTION_INTERRUPT = 0,
+ EXCEPTION_TLBMOD = 1,
+ EXCEPTION_TLBLOAD = 2,
+ EXCEPTION_TLBSTORE = 3,
+ EXCEPTION_ADDRLOAD = 4,
+ EXCEPTION_ADDRSTORE = 5,
+ EXCEPTION_BUSINST = 6,
+ EXCEPTION_BUSDATA = 7,
+ EXCEPTION_SYSCALL = 8,
+ EXCEPTION_BREAK = 9,
+ EXCEPTION_INVALIDOP = 10,
+ EXCEPTION_BADCOP = 11,
+ EXCEPTION_OVERFLOW = 12,
+ EXCEPTION_TRAP = 13,
};
enum cop0_reg : u8
@@ -101,29 +127,6 @@ protected:
SR_COP1 = 0x20000000, // coprocessor 1 usable
SR_COP2 = 0x40000000, // coprocessor 2 usable
SR_COP3 = 0x80000000, // coprocessor 3 usable
-
- SR_KUIE = 0x0000003f, // all interrupt enable and user mode bits
- SR_KUIEpc = 0x0000000f, // previous and current interrupt enable and user mode bits
- SR_KUIEop = 0x0000003c, // old and previous interrupt enable and user mode bits
- SR_IM = 0x0000ff00, // all interrupt mask bits
- };
-
- enum cause_mask : u32
- {
- CAUSE_EXCCODE = 0x0000007c, // exception code
- CAUSE_IPSW0 = 0x00000100, // software interrupt 0 pending
- CAUSE_IPSW1 = 0x00000200, // software interrupt 1 pending
- CAUSE_IPEX0 = 0x00000400, // external interrupt 0 pending
- CAUSE_IPEX1 = 0x00000800, // external interrupt 1 pending
- CAUSE_IPEX2 = 0x00001000, // external interrupt 2 pending
- CAUSE_IPEX3 = 0x00002000, // external interrupt 3 pending
- CAUSE_IPEX4 = 0x00004000, // external interrupt 4 pending
- CAUSE_IPEX5 = 0x00008000, // external interrupt 5 pending
- CAUSE_IP = 0x0000ff00, // interrupt pending
- CAUSE_CE = 0x30000000, // co-processor error
- CAUSE_BD = 0x80000000, // branch delay
-
- CAUSE_IPEX = 0x0000fc00, // external interrupt pending
};
enum entryhi_mask : u32
@@ -155,7 +158,7 @@ protected:
virtual u32 execute_max_cycles() const override { return 40; }
virtual u32 execute_input_lines() const override { return 6; }
virtual void execute_run() override;
- virtual void execute_set_input(int inputnum, int state) override;
+ virtual void execute_set_input(int inputnum, int state) override { set_irq_line(inputnum, state); }
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
@@ -168,18 +171,25 @@ protected:
void dcache_map(address_map &map);
// interrupts
- void generate_exception(u32 exception, bool refill = false);
+ void generate_exception(int exception, bool refill = false);
void check_irqs();
+ void set_irq_line(int irqline, int state);
// cop0
+ virtual u32 get_cop0_reg(int const index);
+ void set_cop0_reg(int const index, u32 const data);
virtual void handle_cop0(u32 const op);
- virtual u32 get_cop0_reg(unsigned const reg);
- virtual void set_cop0_reg(unsigned const reg, u32 const data);
- // other coprocessors
- virtual void handle_cop1(u32 const op);
- virtual void handle_cop2(u32 const op);
- virtual void handle_cop3(u32 const op);
+ // cop1
+ void set_cop1_creg(int const index, u32 const data);
+ void handle_cop1(u32 const op);
+
+ // generic coprocessor implementation
+ template <unsigned Coprocessor> void handle_cop(u32 const op);
+ template <unsigned Coprocessor> u32 get_cop_reg(int const index) { return m_cpr[Coprocessor][index]; }
+ template <unsigned Coprocessor> void set_cop_reg(int const index, u32 const data) { m_cpr[Coprocessor][index] = data; }
+ template <unsigned Coprocessor> u32 get_cop_creg(int const index) { return m_ccr[Coprocessor][index]; }
+ template <unsigned Coprocessor> void set_cop_creg(int const index, u32 const data) { m_ccr[Coprocessor][index] = data; }
// load/store left/right opcodes
void lwl(u32 const op);
@@ -188,13 +198,9 @@ protected:
void swr(u32 const op);
// memory accessors
- template <typename T, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(T)>>::value, void> load(u32 address, U &&apply);
- template <typename T, typename U> std::enable_if_t<std::is_convertible<U, T>::value, void> store(u32 address, U data, T mem_mask = ~T(0));
- bool fetch(u32 address, std::function<void(u32)> &&apply);
-
- // debug helpers
- std::string debug_string(u32 string_pointer, unsigned const limit = 0);
- std::string debug_string_array(u32 array_pointer);
+ template <typename T, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(T)>>::value, void> load(u32 program_address, U &&apply);
+ template <typename T, typename U> std::enable_if_t<std::is_convertible<U, T>::value, void> store(u32 program_address, U data);
+ bool fetch(u32 program_address, std::function<void(u32)> &&apply);
// address spaces
const address_space_config m_program_config_be;
@@ -206,16 +212,19 @@ protected:
// configuration
u32 m_cpurev;
+ bool m_hasfpu;
+ u32 m_fpurev;
endianness_t m_endianness;
// core registers
u32 m_pc;
- u32 m_r[32];
u32 m_hi;
u32 m_lo;
+ u32 m_r[32];
- // cop0 registers
- u32 m_cop0[32];
+ // COP registers
+ u32 m_cpr[4][32];
+ u32 m_ccr[4][32];
// internal stuff
int m_icount;
@@ -239,54 +248,9 @@ protected:
class mips1_device_base : public mips1core_device_base
{
-public:
- // floating point coprocessor revision numbers recognised by RISC/os 4.52 and IRIX
- enum fpu_rev_t : u32
- {
- MIPS_R2360 = 0x0100, // MIPS R2360 Floating Point Board
- MIPS_R2010 = 0x0200, // MIPS R2010 VLSI Floating Point Chip
- MIPS_R2010A = 0x0310, // MIPS R2010A VLSI Floating Point Chip
- MIPS_R3010 = 0x0320, // MIPS R3010 VLSI Floating Point Chip
- MIPS_R3010A = 0x0330, // MIPS R3010A VLSI Floating Point Chip
- MIPS_R3010Av4 = 0x0340, // MIPS R3010A VLSI Floating Point Chip
- MIPS_R6010 = 0x0400, // MIPS R6010 Floating Point Chip
- };
-
- void set_fpu(u32 revision, unsigned interrupt = 3) { m_fcr0 = revision; m_fpu_irq = interrupt; }
-
protected:
mips1_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 cpurev, size_t icache_size, size_t dcache_size);
- enum cp1_fcr31_mask : u32
- {
- FCR31_RM = 0x00000003, // rounding mode
-
- FCR31_FI = 0x00000004, // inexact operation flag
- FCR31_FU = 0x00000008, // underflow flag
- FCR31_FO = 0x00000010, // overflow flag
- FCR31_FZ = 0x00000020, // divide by zero flag
- FCR31_FV = 0x00000040, // invalid operation flag
-
- FCR31_EI = 0x00000080, // inexact operation enable
- FCR31_EU = 0x00000100, // underflow enable
- FCR31_EO = 0x00000200, // overflow enable
- FCR31_EZ = 0x00000400, // divide by zero enable
- FCR31_EV = 0x00000800, // invalid operation enable
-
- FCR31_CI = 0x00001000, // inexact operation cause
- FCR31_CU = 0x00002000, // underflow cause
- FCR31_CO = 0x00004000, // overflow cause
- FCR31_CZ = 0x00008000, // divide by zero cause
- FCR31_CV = 0x00010000, // invalid operation cause
- FCR31_CE = 0x00020000, // unimplemented operation cause
-
- FCR31_C = 0x00800000, // condition
-
- FCR31_FM = 0x0000007c, // flag mask
- FCR31_EM = 0x00000f80, // enable mask
- FCR31_CM = 0x0001f000, // cause mask (except unimplemented)
- };
-
// device_t overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -294,24 +258,12 @@ protected:
// device_memory_interface overrides
virtual bool memory_translate(int spacenum, int intention, offs_t &address) override;
+ virtual u32 get_cop0_reg(int idx) override;
virtual void handle_cop0(u32 const op) override;
- virtual u32 get_cop0_reg(unsigned const reg) override;
-
- virtual void handle_cop1(u32 const op) override;
- virtual void set_cop1_reg(unsigned const reg, u64 const data);
private:
u64 m_reset_time;
u32 m_tlb[64][2]; // 0 is hi, 1 is lo
- unsigned m_tlb_mru[3][64];
-
- // cop1 registers
- u64 m_f[16];
- u32 m_fcr0;
- u32 m_fcr30;
- u32 m_fcr31;
-
- unsigned m_fpu_irq;
};
class r2000_device : public mips1_device_base
@@ -365,13 +317,13 @@ public:
r3052e_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
};
-class r3071_device : public mips1_device_base
+class r3071_device : public mips1core_device_base
{
public:
r3071_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, size_t icache_size = 16384, size_t dcache_size = 4096);
};
-class r3081_device : public mips1_device_base
+class r3081_device : public mips1core_device_base
{
public:
r3081_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, size_t icache_size = 16384, size_t dcache_size = 4096);
diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp
index 178d81fadbd..8c8816b8e23 100644
--- a/src/devices/cpu/mips/mips3.cpp
+++ b/src/devices/cpu/mips/mips3.cpp
@@ -16,10 +16,9 @@
#include "ps2vu.h"
#include <cmath>
-#define ENABLE_OVERFLOWS (0)
-#define ENABLE_EE_ELF_LOADER (0)
-#define ENABLE_EE_DECI2 (0)
-#define DELAY_SLOT_EXCEPTION_HACK (0)
+#define ENABLE_OVERFLOWS (0)
+#define ENABLE_EE_ELF_LOADER (0)
+#define ENABLE_EE_DECI2 (0)
/***************************************************************************
HELPER MACROS
@@ -161,15 +160,13 @@ mips3_device::mips3_device(const machine_config &mconfig, device_type type, cons
, m_pfnmask(flavor == MIPS3_TYPE_VR4300 ? 0x000fffff : 0x00ffffff)
, m_tlbentries(flavor == MIPS3_TYPE_VR4300 ? 32 : MIPS3_MAX_TLB_ENTRIES)
, m_bigendian(endianness == ENDIANNESS_BIG)
- , m_byte_xor(data_bits == 64 ? (m_bigendian ? BYTE8_XOR_BE(0) : BYTE8_XOR_LE(0)) : (m_bigendian ? BYTE4_XOR_BE(0) : BYTE4_XOR_LE(0)))
- , m_word_xor(data_bits == 64 ? (m_bigendian ? WORD2_XOR_BE(0) : WORD2_XOR_LE(0)) : (m_bigendian ? WORD_XOR_BE(0) : WORD_XOR_LE(0)))
- , m_dword_xor(data_bits == 64 ? (m_bigendian ? DWORD_XOR_BE(0) : DWORD_XOR_LE(0)) : 0)
+ , m_byte_xor(m_bigendian ? BYTE4_XOR_BE(0) : BYTE4_XOR_LE(0))
+ , m_word_xor(m_bigendian ? WORD_XOR_BE(0) : WORD_XOR_LE(0))
, c_icache_size(0)
, c_dcache_size(0)
- , c_secondary_cache_line_size(0)
, m_fastram_select(0)
, m_debugger_temp(0)
- , m_drc_cache(DRC_CACHE_SIZE + sizeof(internal_mips3_state) + 0x800000)
+ , m_drc_cache(DRC_CACHE_SIZE + sizeof(internal_mips3_state) + 0x80000)
, m_drcuml(nullptr)
, m_drcfe(nullptr)
, m_drcoptions(0)
@@ -316,11 +313,7 @@ void mips3_device::generate_exception(int exception, int backup)
if (!(SR & SR_EXL))
{
/* if we were in a branch delay slot, adjust */
-#if DELAY_SLOT_EXCEPTION_HACK
- if (((m_nextpc != ~0) || (m_delayslot)) && (m_ppc == m_core->pc - 4))
-#else
if ((m_nextpc != ~0) || (m_delayslot))
-#endif
{
m_delayslot = false;
m_nextpc = ~0;
@@ -343,7 +336,6 @@ void mips3_device::generate_exception(int exception, int backup)
if ((CAUSE & 0x7f) == 0)
logerror("Took interrupt -- Cause = %08X, PC = %08X\n", (uint32_t)CAUSE, m_core->pc);
*/
- debugger_exception_hook(exception);
}
@@ -1241,7 +1233,7 @@ inline bool mips3_device::RWORD(offs_t address, uint32_t *result, bool insn)
{
continue;
}
- *result = m_fastram[ramnum].offset_base32[(tlbaddress ^ m_dword_xor) >> 2];
+ *result = m_fastram[ramnum].offset_base32[tlbaddress >> 2];
return true;
}
*result = (*m_memory.read_dword)(*m_program, tlbaddress);
@@ -1411,7 +1403,7 @@ inline void mips3_device::WWORD(offs_t address, uint32_t data)
{
continue;
}
- m_fastram[ramnum].offset_base32[(tlbaddress ^ m_dword_xor) >> 2] = data;
+ m_fastram[ramnum].offset_base32[tlbaddress >> 2] = data;
return;
}
(*m_memory.write_dword)(*m_program, tlbaddress, data);
@@ -1780,7 +1772,7 @@ inline void mips3_device::set_cop0_creg(int idx, uint64_t val)
void mips3_device::handle_cop0(uint32_t op)
{
- if ((SR & SR_KSU_MASK) != SR_KSU_KERNEL && !(SR & SR_COP0) && !(SR & (SR_EXL | SR_ERL)))
+ if ((SR & SR_KSU_MASK) != SR_KSU_KERNEL && !(SR & SR_COP0))
{
m_badcop_value = 0;
generate_exception(EXCEPTION_BADCOP, 1);
@@ -1840,13 +1832,7 @@ void mips3_device::handle_cop0(uint32_t op)
break;
case 0x10: /* RFE */ invalid_instruction(op); break;
- case 0x18: /* ERET */
- m_core->pc = m_core->cpr[0][COP0_EPC];
- SR &= ~SR_EXL;
- check_irqs();
- m_lld_value ^= 0xffffffff;
- m_ll_value ^= 0xffffffff;
- break;
+ case 0x18: /* ERET */ m_core->pc = m_core->cpr[0][COP0_EPC]; SR &= ~SR_EXL; check_irqs(); m_lld_value ^= 0xffffffff; m_ll_value ^= 0xffffffff; break;
case 0x20: /* WAIT */ break;
default: handle_extra_cop0(op); break;
}
@@ -3530,13 +3516,47 @@ void mips3_device::handle_special(uint32_t op)
m_core->icount -= 35;
break;
case 0x1c: /* DMULT */
- LOVAL64 = mul_64x64(RSVAL64, RTVAL64, reinterpret_cast<s64 *>(&HIVAL64));
+ {
+ uint64_t a_hi = (uint32_t)(RSVAL64 >> 32);
+ uint64_t b_hi = (uint32_t)(RTVAL64 >> 32);
+ uint64_t a_lo = (uint32_t)RSVAL64;
+ uint64_t b_lo = (uint32_t)RTVAL64;
+ uint64_t p1 = a_lo * b_lo;
+ uint64_t p2 = a_hi * b_lo;
+ uint64_t p3 = a_lo * b_hi;
+ uint64_t p4 = a_hi * b_hi;
+ uint64_t carry = (uint32_t)(((p1 >> 32) + (uint32_t)p2 + (uint32_t)p3) >> 32);
+
+ LOVAL64 = p1 + (p2 << 32) + (p3 << 32);
+ HIVAL64 = p4 + (p2 >> 32) + (p3 >> 32) + carry;
+
+ // Adjust for sign
+ if (RSVAL64 < 0)
+ HIVAL64 -= RTVAL64;
+ if (RTVAL64 < 0)
+ HIVAL64 -= RSVAL64;
+
m_core->icount -= 7;
break;
+ }
case 0x1d: /* DMULTU */
- LOVAL64 = mulu_64x64(RSVAL64, RTVAL64, &HIVAL64);
+ {
+ uint64_t a_hi = (uint32_t)(RSVAL64 >> 32);
+ uint64_t b_hi = (uint32_t)(RTVAL64 >> 32);
+ uint64_t a_lo = (uint32_t)RSVAL64;
+ uint64_t b_lo = (uint32_t)RTVAL64;
+ uint64_t p1 = a_lo * b_lo;
+ uint64_t p2 = a_hi * b_lo;
+ uint64_t p3 = a_lo * b_hi;
+ uint64_t p4 = a_hi * b_hi;
+ uint64_t carry = (uint32_t)(((p1 >> 32) + (uint32_t)p2 + (uint32_t)p3) >> 32);
+
+ LOVAL64 = p1 + (p2 << 32) + (p3 << 32);
+ HIVAL64 = p4 + (p2 >> 32) + (p3 >> 32) + carry;
+
m_core->icount -= 7;
break;
+ }
case 0x1e: /* DDIV */
if (RTVAL64)
{
@@ -5480,7 +5500,7 @@ void mips3_device::load_elf()
void r5000be_device::handle_cache(uint32_t op)
{
- if ((SR & SR_KSU_MASK) != SR_KSU_KERNEL && !(SR & SR_COP0) && !(SR & (SR_EXL | SR_ERL)))
+ if ((SR & SR_KSU_MASK) != SR_KSU_KERNEL && !(SR & SR_COP0))
{
m_badcop_value = 0;
generate_exception(EXCEPTION_BADCOP, 1);
diff --git a/src/devices/cpu/mips/mips3.h b/src/devices/cpu/mips/mips3.h
index 0afa4ef610b..8d16c6cbd84 100644
--- a/src/devices/cpu/mips/mips3.h
+++ b/src/devices/cpu/mips/mips3.h
@@ -297,7 +297,6 @@ public:
void set_icache_size(size_t icache_size) { c_icache_size = icache_size; }
void set_dcache_size(size_t dcache_size) { c_dcache_size = dcache_size; }
- void set_secondary_cache_line_size(uint8_t secondary_cache_line_size) { c_secondary_cache_line_size = secondary_cache_line_size; }
void set_system_clock(uint32_t system_clock) { c_system_clock = system_clock; }
TIMER_CALLBACK_MEMBER(compare_int_callback);
@@ -437,13 +436,11 @@ protected:
bool m_bigendian;
uint32_t m_byte_xor;
uint32_t m_word_xor;
- uint32_t m_dword_xor;
data_accessors m_memory;
/* cache memory */
size_t c_icache_size;
size_t c_dcache_size;
- uint8_t c_secondary_cache_line_size;
/* MMU */
mips3_tlb_entry m_tlb[MIPS3_MAX_TLB_ENTRIES];
diff --git a/src/devices/cpu/mips/mips3com.cpp b/src/devices/cpu/mips/mips3com.cpp
index 04225d86da7..0cab50ca894 100644
--- a/src/devices/cpu/mips/mips3com.cpp
+++ b/src/devices/cpu/mips/mips3com.cpp
@@ -273,13 +273,6 @@ uint32_t mips3_device::compute_config_register()
else if (c_icache_size <= 0x40000) configreg |= 6 << 9;
else configreg |= 7 << 9;
- if (c_secondary_cache_line_size != 0) {
- configreg &= ~((0xf << 20) | (1 << 17));
- if (c_secondary_cache_line_size <= 0x10) configreg |= 0 << 22;
- else if (c_secondary_cache_line_size <= 0x20) configreg |= 1 << 22;
- else if (c_secondary_cache_line_size <= 0x40) configreg |= 2 << 22;
- else configreg |= 3 << 22;
- }
/* set the system clock divider */
int divisor = 2;
if (c_system_clock != 0)
diff --git a/src/devices/cpu/mips/mips3drc.cpp b/src/devices/cpu/mips/mips3drc.cpp
index 02439727608..abedfd59a8d 100644
--- a/src/devices/cpu/mips/mips3drc.cpp
+++ b/src/devices/cpu/mips/mips3drc.cpp
@@ -318,9 +318,8 @@ void mips3_device::code_compile_block(uint8_t mode, offs_t pc)
/* if we don't have a hash for this mode/pc, or if we are overriding all, add one */
if (override || !m_drcuml->hash_exists(mode, seqhead->pc))
- {
UML_HASH(block, mode, seqhead->pc); // hash mode,pc
- }
+
/* if we already have a hash, and this is the first sequence, assume that we */
/* are recompiling due to being out of sync and allow future overrides */
else if (seqhead == desclist)
@@ -333,7 +332,8 @@ void mips3_device::code_compile_block(uint8_t mode, offs_t pc)
else
{
UML_LABEL(block, seqhead->pc | 0x80000000); // label seqhead->pc | 0x80000000
- UML_HASHJMP(block, m_core->mode, seqhead->pc, *m_nocode); // hashjmp <mode>,seqhead->pc,nocode
+ UML_HASHJMP(block, m_core->mode, seqhead->pc, *m_nocode);
+ // hashjmp <mode>,seqhead->pc,nocode
continue;
}
@@ -343,15 +343,11 @@ void mips3_device::code_compile_block(uint8_t mode, offs_t pc)
/* label this instruction, if it may be jumped to locally */
if (seqhead->flags & OPFLAG_IS_BRANCH_TARGET)
- {
UML_LABEL(block, seqhead->pc | 0x80000000); // label seqhead->pc | 0x80000000
- }
/* iterate over instructions in the sequence and compile them */
for (curdesc = seqhead; curdesc != seqlast->next(); curdesc = curdesc->next())
- {
generate_sequence_instruction(block, compiler, curdesc);
- }
/* if we need to return to the start, do it */
if (seqlast->flags & OPFLAG_RETURN_TO_START)
@@ -366,13 +362,11 @@ void mips3_device::code_compile_block(uint8_t mode, offs_t pc)
/* if the last instruction can change modes, use a variable mode; otherwise, assume the same mode */
if (seqlast->flags & OPFLAG_CAN_CHANGE_MODES)
- {
- UML_HASHJMP(block, mem(&m_core->mode), nextpc, *m_nocode); // hashjmp <mode>,nextpc,nocode
- }
+ UML_HASHJMP(block, mem(&m_core->mode), nextpc, *m_nocode);
+ // hashjmp <mode>,nextpc,nocode
else if (seqlast->next() == nullptr || seqlast->next()->pc != nextpc)
- {
- UML_HASHJMP(block, m_core->mode, nextpc, *m_nocode); // hashjmp <mode>,nextpc,nocode
- }
+ UML_HASHJMP(block, m_core->mode, nextpc, *m_nocode);
+ // hashjmp <mode>,nextpc,nocode
}
/* end the sequence */
@@ -1064,6 +1058,7 @@ void mips3_device::generate_update_cycles(drcuml_block &block, compiler_state &c
compiler.cycles = 0;
}
+
/*-------------------------------------------------
generate_checksum_block - generate code to
validate a sequence of opcodes
@@ -1082,17 +1077,15 @@ void mips3_device::generate_checksum_block(drcuml_block &block, compiler_state &
{
uint32_t sum = seqhead->opptr.l[0];
const void *base = m_prptr(seqhead->physpc);
- uint32_t low_bits = (seqhead->physpc & (m_data_bits == 64 ? 4 : 0)) ^ m_dword_xor;
- UML_LOAD(block, I0, base, low_bits, SIZE_DWORD, SCALE_x1); // load i0,base,0,dword
+ UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,0,dword
if (seqhead->delay.first() != nullptr
&& !(seqhead->delay.first()->flags & OPFLAG_VIRTUAL_NOOP)
&& seqhead->physpc != seqhead->delay.first()->physpc)
{
- uint32_t low_bits = (seqhead->delay.first()->physpc & (m_data_bits == 64 ? 4 : 0)) ^ m_dword_xor;
base = m_prptr(seqhead->delay.first()->physpc);
assert(base != nullptr);
- UML_LOAD(block, I1, base, low_bits, SIZE_DWORD, SCALE_x1); // load i1,base,dword
+ UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword
UML_ADD(block, I0, I0, I1); // add i0,i0,i1
sum += seqhead->delay.first()->opptr.l[0];
@@ -1111,24 +1104,21 @@ void mips3_device::generate_checksum_block(drcuml_block &block, compiler_state &
if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
{
const void *base = m_prptr(seqhead->physpc);
- UML_LOAD(block, I0, base, m_dword_xor, SIZE_DWORD, SCALE_x1); // load i0,base,0,dword
+ UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,0,dword
UML_CMP(block, I0, curdesc->opptr.l[0]); // cmp i0,opptr[0]
UML_EXHc(block, COND_NE, *m_nocode, epc(seqhead)); // exne nocode,seqhead->pc
}
#else
uint32_t sum = 0;
const void *base = m_prptr(seqhead->physpc);
- uint32_t low_bits = (seqhead->physpc & (m_data_bits == 64 ? 4 : 0)) ^ m_dword_xor;
- UML_LOAD(block, I0, base, low_bits, SIZE_DWORD, SCALE_x1); // load i0,base,0,dword
+ 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_prptr(curdesc->physpc);
assert(base != nullptr);
- uint32_t low_bits = (curdesc->physpc & (m_data_bits == 64 ? 4 : 0)) ^ m_dword_xor;
- UML_LOAD(block, I1, base, low_bits, SIZE_DWORD, SCALE_x1); // load i1,base,dword
+ UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword
UML_ADD(block, I0, I0, I1); // add i0,i0,i1
sum += curdesc->opptr.l[0];
@@ -1138,13 +1128,11 @@ void mips3_device::generate_checksum_block(drcuml_block &block, compiler_state &
{
base = m_prptr(curdesc->delay.first()->physpc);
assert(base != nullptr);
- uint32_t low_bits = (curdesc->delay.first()->physpc & (m_data_bits == 64 ? 4 : 0)) ^ m_dword_xor;
- UML_LOAD(block, I1, base, low_bits, SIZE_DWORD, SCALE_x1); // load i1,base,dword
+ UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword
UML_ADD(block, I0, I0, I1); // add i0,i0,i1
sum += curdesc->delay.first()->opptr.l[0];
}
}
- }
UML_CMP(block, I0, sum); // cmp i0,sum
UML_EXHc(block, COND_NE, *m_nocode, epc(seqhead)); // exne nocode,seqhead->pc
#endif
@@ -1303,18 +1291,17 @@ void mips3_device::generate_delay_slot_and_branch(drcuml_block &block, compiler_
{
generate_update_cycles(block, compiler_temp, desc->targetpc, true); // <subtract cycles>
if (desc->flags & OPFLAG_INTRABLOCK_BRANCH)
- {
UML_JMP(block, desc->targetpc | 0x80000000); // jmp desc->targetpc | 0x80000000
- }
else
- {
- UML_HASHJMP(block, m_core->mode, desc->targetpc, *m_nocode); // hashjmp <mode>,desc->targetpc,nocode
- }
+ UML_HASHJMP(block, m_core->mode, desc->targetpc, *m_nocode);
+ // hashjmp <mode>,desc->targetpc,nocode
}
else
{
- generate_update_cycles(block, compiler_temp, uml::mem(&m_core->jmpdest), true); // <subtract cycles>
- UML_HASHJMP(block, m_core->mode, mem(&m_core->jmpdest), *m_nocode); // hashjmp <mode>,<rsreg>,nocode
+ generate_update_cycles(block, compiler_temp, uml::mem(&m_core->jmpdest), true);
+ // <subtract cycles>
+ UML_HASHJMP(block, m_core->mode, mem(&m_core->jmpdest), *m_nocode);
+ // hashjmp <mode>,<rsreg>,nocode
}
/* update the label */
@@ -2628,8 +2615,10 @@ bool mips3_device::generate_cop0(drcuml_block &block, compiler_state &compiler,
UML_MOV(block, CPR032(COP0_Status), I0); // mov [Status],i0
generate_update_mode(block);
compiler.checkints = true;
- generate_update_cycles(block, compiler, CPR032(COP0_ErrorPC), true); // <subtract cycles>
- UML_HASHJMP(block, mem(&m_core->mode), CPR032(COP0_ErrorPC), *m_nocode); // hashjmp <mode>,[EPC],nocode
+ generate_update_cycles(block, compiler, CPR032(COP0_ErrorPC), true);
+ // <subtract cycles>
+ UML_HASHJMP(block, mem(&m_core->mode), CPR032(COP0_ErrorPC), *m_nocode);
+ // hashjmp <mode>,[EPC],nocode
return true;
case 0x20: /* WAIT */
diff --git a/src/devices/cpu/mips/mips3fe.cpp b/src/devices/cpu/mips/mips3fe.cpp
index 77b72c9b48b..ff0c59797d9 100644
--- a/src/devices/cpu/mips/mips3fe.cpp
+++ b/src/devices/cpu/mips/mips3fe.cpp
@@ -316,13 +316,13 @@ bool mips3_frontend::describe_special(uint32_t op, opcode_desc &desc)
return true;
case 0x10: // MFHI
- desc.regin[2] |= REGFLAG_HI;
+ desc.regin[0] |= REGFLAG_HI;
desc.regout[0] |= REGFLAG_R(RDREG);
return true;
case 0x11: // MTHI
desc.regin[0] |= REGFLAG_R(RSREG);
- desc.regout[2] |= REGFLAG_HI;
+ desc.regout[0] |= REGFLAG_HI;
return true;
case 0x12: // MFLO
diff --git a/src/devices/cpu/mips/r4000.cpp b/src/devices/cpu/mips/r4000.cpp
deleted file mode 100644
index ca95b107c65..00000000000
--- a/src/devices/cpu/mips/r4000.cpp
+++ /dev/null
@@ -1,3067 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Patrick Mackinlay
-
-/*
- * This is a stripped-down MIPS-III CPU derived from the main mips3 code. Its
- * primary purpose is to act as a test-bed to aid in debugging MIPS-based
- * systems, after which the changes/improvements from here are expected to
- * be back-ported and incorporated into the original mips3 device.
- *
- * Because of this specific approach, no attempt is made to support many of the
- * current features of the mips3 device at this time. Key differences bewteen
- * this implementation and mips3 include:
- *
- * - only supports MIPS R4000/R4400 and QED R4600
- * - no dynamic recompilation
- * - reworked address translation logic, including 64-bit modes
- * - reworked softfloat3-based floating point
- * - experimental primary instruction cache
- * - memory tap based ll/sc
- * - configurable endianness
- * - it's very very very slow
- *
- * TODO
- * - try to eliminate mode check in address calculations
- * - find a better way to deal with software interrupts
- * - enforce mode checks for cp1
- * - cache instructions
- * - check/improve instruction timing
- *
- */
-
-#include "emu.h"
-#include "debugger.h"
-#include "r4000.h"
-#include "mips3dsm.h"
-
-#include "softfloat3/source/include/softfloat.h"
-
-#define LOG_GENERAL (1U << 0)
-#define LOG_TLB (1U << 1)
-#define LOG_CACHE (1U << 2)
-#define LOG_EXCEPTION (1U << 3)
-#define LOG_SYSCALL (1U << 4)
-#define LOG_STATS (1U << 5)
-
-#define VERBOSE (LOG_GENERAL)
-
-// operating system specific system call logging
-#define SYSCALL_IRIX53 (1U << 0)
-#define SYSCALL_WINNT4 (1U << 1)
-#if VERBOSE & LOG_SYSCALL
-#define SYSCALL_MASK (SYSCALL_IRIX53)
-#else
-#define SYSCALL_MASK (0)
-#endif
-
-// experimental primary instruction cache
-#define ICACHE 0
-
-#include "logmacro.h"
-
-#define USE_ABI_REG_NAMES 1
-
-// cpu instruction fiels
-#define RSREG ((op >> 21) & 31)
-#define RTREG ((op >> 16) & 31)
-#define RDREG ((op >> 11) & 31)
-#define SHIFT ((op >> 6) & 31)
-
-// cop1 instruction fields
-#define FRREG ((op >> 21) & 31)
-#define FTREG ((op >> 16) & 31)
-#define FSREG ((op >> 11) & 31)
-#define FDREG ((op >> 6) & 31)
-
-#define R4000_ENDIAN_LE_BE(le, be) ((m_cp0[CP0_Config] & CONFIG_BE) ? (be) : (le))
-
-// identify odd-numbered cop1 registers
-#define ODD_REGS 0x00010840U
-
-// address computation
-#define ADDR(r, o) (cp0_64() ? ((r) + (o)) : s64(s32((r) + (o))))
-
-#define SR m_cp0[CP0_Status]
-#define CAUSE m_cp0[CP0_Cause]
-
-DEFINE_DEVICE_TYPE(R4000, r4000_device, "r4000", "MIPS R4000")
-DEFINE_DEVICE_TYPE(R4400, r4400_device, "r4400", "MIPS R4400")
-DEFINE_DEVICE_TYPE(R4600, r4600_device, "r4600", "QED R4600")
-
-r4000_base_device::r4000_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 prid, cache_size_t icache_size, cache_size_t dcache_size)
- : cpu_device(mconfig, type, tag, owner, clock)
- , m_program_config_le("program", ENDIANNESS_LITTLE, 64, 32)
- , m_program_config_be("program", ENDIANNESS_BIG, 64, 32)
- , m_ll_watch(nullptr)
- , m_fcr0(0x00000500U)
-{
- m_cp0[CP0_PRId] = prid;
-
- // default configuration
- m_cp0[CP0_Config] = CONFIG_BE | (icache_size << 9) | (dcache_size << 6);
-}
-
-void r4000_base_device::device_start()
-{
- // TODO: save state
-
- state_add(STATE_GENPC, "GENPC", m_pc).noshow();
- state_add(STATE_GENPCBASE, "CURPC", m_pc).noshow();
- state_add(MIPS3_PC, "PC", m_pc).formatstr("%016X");
-
- // exception processing
- state_add(MIPS3_CP0 + CP0_Status, "SR", m_cp0[CP0_Status]).formatstr("%08X");
- state_add(MIPS3_CP0 + CP0_EPC, "EPC", m_cp0[CP0_EPC]).formatstr("%016X");
- state_add(MIPS3_CP0 + CP0_Cause, "Cause", m_cp0[CP0_Cause]).formatstr("%08X");
- state_add(MIPS3_CP0 + CP0_Context, "Context", m_cp0[CP0_Context]).formatstr("%016X");
- state_add(MIPS3_CP0 + CP0_BadVAddr, "BadVAddr", m_cp0[CP0_BadVAddr]).formatstr("%016X");
- state_add(MIPS3_CP0 + CP0_Compare, "Compare", m_cp0[CP0_Compare]).formatstr("%08X");
- state_add(MIPS3_CP0 + CP0_WatchLo, "WatchLo", m_cp0[CP0_WatchLo]).formatstr("%08X");
- state_add(MIPS3_CP0 + CP0_WatchHi, "WatchHi", m_cp0[CP0_WatchHi]).formatstr("%08X");
- state_add(MIPS3_CP0 + CP0_XContext, "XContext", m_cp0[CP0_XContext]).formatstr("%016X");
-
- // memory management
- state_add(MIPS3_CP0 + CP0_Index, "Index", m_cp0[CP0_Index]).formatstr("%08X");
- state_add(MIPS3_CP0 + CP0_EntryLo0, "EntryLo0", m_cp0[CP0_EntryLo0]).formatstr("%016X");
- state_add(MIPS3_CP0 + CP0_EntryLo1, "EntryLo1", m_cp0[CP0_EntryLo1]).formatstr("%016X");
- state_add(MIPS3_CP0 + CP0_PageMask, "PageMask", m_cp0[CP0_PageMask]).formatstr("%08X");
- state_add(MIPS3_CP0 + CP0_Wired, "Wired", m_cp0[CP0_Wired]).formatstr("%08X");
- state_add(MIPS3_CP0 + CP0_EntryHi, "EntryHi", m_cp0[CP0_EntryHi]).formatstr("%016X");
- state_add(MIPS3_CP0 + CP0_LLAddr, "LLAddr", m_cp0[CP0_LLAddr]).formatstr("%08X");
-
-#if USE_ABI_REG_NAMES
- state_add(MIPS3_R0 + 0, "zero", m_r[0]).callimport().formatstr("%016X"); // Can't change R0
- state_add(MIPS3_R0 + 1, "at", m_r[1]).formatstr("%016X");
- state_add(MIPS3_R0 + 2, "v0", m_r[2]).formatstr("%016X");
- state_add(MIPS3_R0 + 3, "v1", m_r[3]).formatstr("%016X");
- state_add(MIPS3_R0 + 4, "a0", m_r[4]).formatstr("%016X");
- state_add(MIPS3_R0 + 5, "a1", m_r[5]).formatstr("%016X");
- state_add(MIPS3_R0 + 6, "a2", m_r[6]).formatstr("%016X");
- state_add(MIPS3_R0 + 7, "a3", m_r[7]).formatstr("%016X");
- state_add(MIPS3_R0 + 8, "t0", m_r[8]).formatstr("%016X");
- state_add(MIPS3_R0 + 9, "t1", m_r[9]).formatstr("%016X");
- state_add(MIPS3_R0 + 10, "t2", m_r[10]).formatstr("%016X");
- state_add(MIPS3_R0 + 11, "t3", m_r[11]).formatstr("%016X");
- state_add(MIPS3_R0 + 12, "t4", m_r[12]).formatstr("%016X");
- state_add(MIPS3_R0 + 13, "t5", m_r[13]).formatstr("%016X");
- state_add(MIPS3_R0 + 14, "t6", m_r[14]).formatstr("%016X");
- state_add(MIPS3_R0 + 15, "t7", m_r[15]).formatstr("%016X");
- state_add(MIPS3_R0 + 16, "s0", m_r[16]).formatstr("%016X");
- state_add(MIPS3_R0 + 17, "s1", m_r[17]).formatstr("%016X");
- state_add(MIPS3_R0 + 18, "s2", m_r[18]).formatstr("%016X");
- state_add(MIPS3_R0 + 19, "s3", m_r[19]).formatstr("%016X");
- state_add(MIPS3_R0 + 20, "s4", m_r[20]).formatstr("%016X");
- state_add(MIPS3_R0 + 21, "s5", m_r[21]).formatstr("%016X");
- state_add(MIPS3_R0 + 22, "s6", m_r[22]).formatstr("%016X");
- state_add(MIPS3_R0 + 23, "s7", m_r[23]).formatstr("%016X");
- state_add(MIPS3_R0 + 24, "t8", m_r[24]).formatstr("%016X");
- state_add(MIPS3_R0 + 25, "t9", m_r[25]).formatstr("%016X");
- state_add(MIPS3_R0 + 26, "k0", m_r[26]).formatstr("%016X");
- state_add(MIPS3_R0 + 27, "k1", m_r[27]).formatstr("%016X");
- state_add(MIPS3_R0 + 28, "gp", m_r[28]).formatstr("%016X");
- state_add(MIPS3_R0 + 29, "sp", m_r[29]).formatstr("%016X");
- state_add(MIPS3_R0 + 30, "fp", m_r[30]).formatstr("%016X");
- state_add(MIPS3_R0 + 31, "ra", m_r[31]).formatstr("%016X");
-#else
- state_add(MIPS3_R0, "R0", m_r[0]).callimport().formatstr("%016X");
- for (unsigned i = 1; i < 32; i++)
- state_add(MIPS3_R0 + i, util::string_format("R%d", i).c_str(), m_r[i]);
-#endif
-
- state_add(MIPS3_HI, "HI", m_hi).formatstr("%016X");
- state_add(MIPS3_LO, "LO", m_lo).formatstr("%016X");
-
- // floating point registers
- state_add(MIPS3_FCR30, "FCR30", m_fcr30).formatstr("%08X");
- state_add(MIPS3_FCR31, "FCR31", m_fcr31).formatstr("%08X");
- for (unsigned i = 0; i < 32; i++)
- state_add(MIPS3_F0 + i, util::string_format("F%d", i).c_str(), m_f[i]);
-
- set_icountptr(m_icount);
-
- m_cp0_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(r4000_base_device::cp0_timer_callback), this));
-
- // compute icache line selection mask and allocate tag and data
- unsigned const config_ic = (m_cp0[CP0_Config] & CONFIG_IC) >> 9;
-
- m_icache_mask_hi = (0x1000U << config_ic) - 1;
- m_icache_tag = std::make_unique<u32[]>(0x100U << config_ic);
- m_icache_data = std::make_unique<u32 []>((0x1000U << config_ic) >> 2);
-}
-
-void r4000_base_device::device_reset()
-{
- m_branch_state = NONE;
- m_pc = s64(s32(0xbfc00000));
-
- m_cp0[CP0_Status] = SR_BEV | SR_ERL;
- m_cp0[CP0_Wired] = 0;
- m_cp0[CP0_Compare] = 0;
- m_cp0[CP0_Count] = 0;
-
- m_cp0_timer_zero = total_cycles();
-
- if (m_ll_watch)
- {
- m_ll_watch->remove();
- m_ll_watch = nullptr;
- }
-
- m_cp0[CP0_WatchLo] = 0;
- m_cp0[CP0_WatchHi] = 0;
-
- // initialize tlb mru index with identity mapping
- for (unsigned i = 0; i < ARRAY_LENGTH(m_tlb); i++)
- {
- m_tlb_mru[TRANSLATE_READ][i] = i;
- m_tlb_mru[TRANSLATE_WRITE][i] = i;
- m_tlb_mru[TRANSLATE_FETCH][i] = i;
- }
-
- // initialize statistics
- m_tlb_scans = 0;
- m_tlb_loops = 0;
- m_icache_hits = 0;
- m_icache_misses = 0;
-}
-
-void r4000_base_device::device_stop()
-{
- if ((m_icache_hits + m_icache_misses) > 0)
- LOGMASKED(LOG_STATS, "icache hit ratio %.3f%% (%d hits %d misses)\n",
- double(m_icache_hits) / double(m_icache_hits + m_icache_misses) * 100.0, m_icache_hits, m_icache_misses);
-
- if (m_tlb_scans > 0)
- LOGMASKED(LOG_STATS, "tlb scans %d loops %d average %.3f loops per scan\n", m_tlb_scans, m_tlb_loops, double(m_tlb_loops) / double(m_tlb_scans));
-}
-
-device_memory_interface::space_config_vector r4000_base_device::memory_space_config() const
-{
- return space_config_vector{
- std::make_pair(AS_PROGRAM, R4000_ENDIAN_LE_BE(&m_program_config_le, &m_program_config_be))
- };
-}
-
-bool r4000_base_device::memory_translate(int spacenum, int intention, offs_t &address)
-{
- // FIXME: address truncation
- u64 placeholder = s32(address);
-
- translate_t const t = translate(intention, placeholder);
-
- if (t == ERROR || t == MISS)
- return false;
-
- address = placeholder;
- return true;
-}
-
-std::unique_ptr<util::disasm_interface> r4000_base_device::create_disassembler()
-{
- return std::make_unique<mips3_disassembler>();
-}
-
-void r4000_base_device::execute_run()
-{
- // check interrupts
- if ((CAUSE & SR & CAUSE_IP) && (SR & SR_IE) && !(SR & (SR_EXL | SR_ERL)))
- cpu_exception(EXCEPTION_INT);
-
- while (m_icount > 0)
- {
- debugger_instruction_hook(m_pc);
-
- fetch(m_pc,
- [this](u32 const op)
- {
- cpu_execute(op);
-
- // zero register zero
- m_r[0] = 0;
- });
-
- // update pc and branch state
- switch (m_branch_state)
- {
- case NONE:
- m_pc += 4;
- break;
-
- case DELAY:
- m_branch_state = NONE;
- m_pc = m_branch_target;
- break;
-
- case BRANCH:
- m_branch_state = DELAY;
- m_pc += 4;
- break;
-
- case EXCEPTION:
- m_branch_state = NONE;
- break;
-
- case NULLIFY:
- m_branch_state = NONE;
- m_pc += 8;
- break;
- }
-
- m_icount--;
- }
-}
-
-void r4000_base_device::execute_set_input(int inputnum, int state)
-{
- if (state)
- m_cp0[CP0_Cause] |= (CAUSE_IPEX0 << inputnum);
- else
- m_cp0[CP0_Cause] &= ~(CAUSE_IPEX0 << inputnum);
-}
-
-void r4000_base_device::cpu_execute(u32 const op)
-{
- switch (op >> 26)
- {
- case 0x00: // SPECIAL
- switch (op & 0x3f)
- {
- case 0x00: // SLL
- m_r[RDREG] = s64(s32(m_r[RTREG] << SHIFT));
- break;
- //case 0x01: // *
- case 0x02: // SRL
- m_r[RDREG] = s64(s32(u32(m_r[RTREG]) >> SHIFT));
- break;
- case 0x03: // SRA
- m_r[RDREG] = s64(s32(m_r[RTREG]) >> SHIFT);
- break;
- case 0x04: // SLLV
- m_r[RDREG] = s64(s32(m_r[RTREG] << (m_r[RSREG] & 31)));
- break;
- //case 0x05: // *
- case 0x06: // SRLV
- m_r[RDREG] = s64(s32(u32(m_r[RTREG]) >> (m_r[RSREG] & 31)));
- break;
- case 0x07: // SRAV
- m_r[RDREG] = s64(s32(m_r[RTREG]) >> (m_r[RSREG] & 31));
- break;
- case 0x08: // JR
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_r[RSREG], 0);
- break;
- case 0x09: // JALR
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_r[RSREG], 0);
- m_r[RDREG] = ADDR(m_pc, 8);
- break;
- //case 0x0a: // *
- //case 0x0b: // *
- case 0x0c: // SYSCALL
- if (VERBOSE & LOG_SYSCALL)
- {
- if (SYSCALL_MASK & SYSCALL_IRIX53)
- {
- switch (m_r[2])
- {
- case 0x3e9: // 1001 = exit
- LOGMASKED(LOG_SYSCALL, "exit(%d) (%s)\n", m_r[4], machine().describe_context());
- break;
-
- case 0x3ea: // 1002 = fork
- LOGMASKED(LOG_SYSCALL, "fork() (%s)\n", machine().describe_context());
- break;
-
- case 0x3eb: // 1003 = read
- LOGMASKED(LOG_SYSCALL, "read(%d, 0x%x, %d) (%s)\n", m_r[4], m_r[5], m_r[6], machine().describe_context());
- break;
-
- case 0x3ec: // 1004 = write
- LOGMASKED(LOG_SYSCALL, "write(%d, 0x%x, %d) (%s)\n", m_r[4], m_r[5], m_r[6], machine().describe_context());
- if (m_r[4] == 1 || m_r[4] == 2)
- printf("%s", debug_string(m_r[5], m_r[6]).c_str());
- break;
-
- case 0x3ed: // 1005 = open
- LOGMASKED(LOG_SYSCALL, "open(\"%s\", %#o) (%s)\n", debug_string(m_r[4]), m_r[5], machine().describe_context());
- break;
-
- case 0x3ee: // 1006 = close
- LOGMASKED(LOG_SYSCALL, "close(%d) (%s)\n", m_r[4], machine().describe_context());
- break;
-
- case 0x3ef: // 1007 = creat
- LOGMASKED(LOG_SYSCALL, "creat(\"%s\", %#o) (%s)\n", debug_string(m_r[4]), m_r[5], machine().describe_context());
- break;
-
- case 0x423: // 1059 = exece
- LOGMASKED(LOG_SYSCALL, "exece(\"%s\", [ %s ], [ %s ]) (%s)\n", debug_string(m_r[4]), debug_string_array(m_r[5]), debug_string_array(m_r[6]), machine().describe_context());
- break;
-
- default:
- LOGMASKED(LOG_SYSCALL, "syscall 0x%x (%s)\n", m_r[2], machine().describe_context());
- break;
- }
- }
- else if (SYSCALL_MASK & SYSCALL_WINNT4)
- {
- switch (m_r[2])
- {
- case 0x4f:
- load<s32>(m_r[7] + 8,
- [this](s64 string_pointer)
- {
- LOGMASKED(LOG_SYSCALL, "NtOpenFile(%s) (%s)\n", debug_string(string_pointer), machine().describe_context());
- });
- break;
-
- default:
- LOGMASKED(LOG_SYSCALL, "syscall 0x%x (%s)\n", m_r[2], machine().describe_context());
- break;
- }
- }
- }
- cpu_exception(EXCEPTION_SYS);
- break;
- case 0x0d: // BREAK
- cpu_exception(EXCEPTION_BP);
- break;
- //case 0x0e: // *
- case 0x0f: // SYNC
- break;
- case 0x10: // MFHI
- m_r[RDREG] = m_hi;
- break;
- case 0x11: // MTHI
- m_hi = m_r[RSREG];
- break;
- case 0x12: // MFLO
- m_r[RDREG] = m_lo;
- break;
- case 0x13: // MTLO
- m_lo = m_r[RSREG];
- break;
- case 0x14: // DSLLV
- m_r[RDREG] = m_r[RTREG] << (m_r[RSREG] & 63);
- break;
- //case 0x15: // *
- case 0x16: // DSRLV
- m_r[RDREG] = m_r[RTREG] >> (m_r[RSREG] & 63);
- break;
- case 0x17: // DSRAV
- m_r[RDREG] = s64(m_r[RTREG]) >> (m_r[RSREG] & 63);
- break;
- case 0x18: // MULT
- {
- u64 const product = mul_32x32(s32(m_r[RSREG]), s32(m_r[RTREG]));
-
- m_lo = s64(s32(product));
- m_hi = s64(s32(product >> 32));
- m_icount -= 3;
- }
- break;
- case 0x19: // MULTU
- {
- u64 const product = mulu_32x32(u32(m_r[RSREG]), u32(m_r[RTREG]));
-
- m_lo = s64(s32(product));
- m_hi = s64(s32(product >> 32));
- m_icount -= 3;
- }
- break;
- case 0x1a: // DIV
- if (m_r[RTREG])
- {
- m_lo = s64(s32(m_r[RSREG]) / s32(m_r[RTREG]));
- m_hi = s64(s32(m_r[RSREG]) % s32(m_r[RTREG]));
- }
- m_icount -= 35;
- break;
- case 0x1b: // DIVU
- if (m_r[RTREG])
- {
- m_lo = s64(s32(u32(m_r[RSREG]) / u32(m_r[RTREG])));
- m_hi = s64(s32(u32(m_r[RSREG]) % u32(m_r[RTREG])));
- }
- m_icount -= 35;
- break;
- case 0x1c: // DMULT
- m_lo = mul_64x64(m_r[RSREG], m_r[RTREG], reinterpret_cast<s64 *>(&m_hi));
- m_icount -= 7;
- break;
- case 0x1d: // DMULTU
- m_lo = mulu_64x64(m_r[RSREG], m_r[RTREG], &m_hi);
- m_icount -= 7;
- break;
- case 0x1e: // DDIV
- if (m_r[RTREG])
- {
- m_lo = s64(m_r[RSREG]) / s64(m_r[RTREG]);
- m_hi = s64(m_r[RSREG]) % s64(m_r[RTREG]);
- }
- m_icount -= 67;
- break;
- case 0x1f: // DDIVU
- if (m_r[RTREG])
- {
- m_lo = m_r[RSREG] / m_r[RTREG];
- m_hi = m_r[RSREG] % m_r[RTREG];
- }
- m_icount -= 67;
- break;
- case 0x20: // ADD
- {
- u32 const sum = u32(m_r[RSREG]) + u32(m_r[RTREG]);
-
- // overflow: (sign(addend0) == sign(addend1)) && (sign(addend0) != sign(sum))
- if (!BIT(u32(m_r[RSREG]) ^ u32(m_r[RTREG]), 31) && BIT(u32(m_r[RSREG]) ^ sum, 31))
- cpu_exception(EXCEPTION_OV);
- else
- m_r[RDREG] = s64(s32(sum));
- }
- break;
- case 0x21: // ADDU
- m_r[RDREG] = s64(s32(u32(m_r[RSREG]) + u32(m_r[RTREG])));
- break;
- case 0x22: // SUB
- {
- u32 const difference = u32(m_r[RSREG]) - u32(m_r[RTREG]);
-
- // overflow: (sign(minuend) != sign(subtrahend)) && (sign(minuend) != sign(difference))
- if (BIT(u32(m_r[RSREG]) ^ u32(m_r[RTREG]), 31) && BIT(u32(m_r[RSREG]) ^ difference, 31))
- cpu_exception(EXCEPTION_OV);
- else
- m_r[RDREG] = s64(s32(difference));
- }
- break;
- case 0x23: // SUBU
- m_r[RDREG] = s64(s32(u32(m_r[RSREG]) - u32(m_r[RTREG])));
- break;
- case 0x24: // AND
- m_r[RDREG] = m_r[RSREG] & m_r[RTREG];
- break;
- case 0x25: // OR
- m_r[RDREG] = m_r[RSREG] | m_r[RTREG];
- break;
- case 0x26: // XOR
- m_r[RDREG] = m_r[RSREG] ^ m_r[RTREG];
- break;
- case 0x27: // NOR
- m_r[RDREG] = ~(m_r[RSREG] | m_r[RTREG]);
- break;
- //case 0x28: // *
- //case 0x29: // *
- case 0x2a: // SLT
- m_r[RDREG] = s64(m_r[RSREG]) < s64(m_r[RTREG]);
- break;
- case 0x2b: // SLTU
- m_r[RDREG] = m_r[RSREG] < m_r[RTREG];
- break;
- case 0x2c: // DADD
- {
- u64 const sum = m_r[RSREG] + m_r[RTREG];
-
- // overflow: (sign(addend0) == sign(addend1)) && (sign(addend0) != sign(sum))
- if (!BIT(m_r[RSREG] ^ m_r[RTREG], 63) && BIT(m_r[RSREG] ^ sum, 63))
- cpu_exception(EXCEPTION_OV);
- else
- m_r[RDREG] = sum;
- }
- break;
- case 0x2d: // DADDU
- m_r[RDREG] = m_r[RSREG] + m_r[RTREG];
- break;
- case 0x2e: // DSUB
- {
- u64 const difference = m_r[RSREG] - m_r[RTREG];
-
- // overflow: (sign(minuend) != sign(subtrahend)) && (sign(minuend) != sign(difference))
- if (BIT(m_r[RSREG] ^ m_r[RTREG], 63) && BIT(m_r[RSREG] ^ difference, 63))
- cpu_exception(EXCEPTION_OV);
- else
- m_r[RDREG] = difference;
- }
- break;
- case 0x2f: // DSUBU
- m_r[RDREG] = m_r[RSREG] - m_r[RTREG];
- break;
- case 0x30: // TGE
- if (s64(m_r[RSREG]) >= s64(m_r[RTREG]))
- cpu_exception(EXCEPTION_TR);
- break;
- case 0x31: // TGEU
- if (m_r[RSREG] >= m_r[RTREG])
- cpu_exception(EXCEPTION_TR);
- break;
- case 0x32: // TLT
- if (s64(m_r[RSREG]) < s64(m_r[RTREG]))
- cpu_exception(EXCEPTION_TR);
- break;
- case 0x33: // TLTU
- if (m_r[RSREG] < m_r[RTREG])
- cpu_exception(EXCEPTION_TR);
- break;
- case 0x34: // TEQ
- if (m_r[RSREG] == m_r[RTREG])
- cpu_exception(EXCEPTION_TR);
- break;
- //case 0x35: // *
- case 0x36: // TNE
- if (m_r[RSREG] != m_r[RTREG])
- cpu_exception(EXCEPTION_TR);
- break;
- //case 0x37: // *
- case 0x38: // DSLL
- m_r[RDREG] = m_r[RTREG] << SHIFT;
- break;
- //case 0x39: // *
- case 0x3a: // DSRL
- m_r[RDREG] = m_r[RTREG] >> SHIFT;
- break;
- case 0x3b: // DSRA
- m_r[RDREG] = s64(m_r[RTREG]) >> SHIFT;
- break;
- case 0x3c: // DSLL32
- m_r[RDREG] = m_r[RTREG] << (SHIFT + 32);
- break;
- //case 0x3d: // *
- case 0x3e: // DSRL32
- m_r[RDREG] = m_r[RTREG] >> (SHIFT + 32);
- break;
- case 0x3f: // DSRA32
- m_r[RDREG] = s64(m_r[RTREG]) >> (SHIFT + 32);
- break;
-
- default:
- // * Operation codes marked with an asterisk cause reserved
- // instruction exceptions in all current implementations and are
- // reserved for future versions of the architecture.
- cpu_exception(EXCEPTION_RI);
- break;
- }
- break;
- case 0x01: // REGIMM
- switch ((op >> 16) & 0x1f)
- {
- case 0x00: // BLTZ
- if (s64(m_r[RSREG]) < 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- break;
- case 0x01: // BGEZ
- if (s64(m_r[RSREG]) >= 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- break;
- case 0x02: // BLTZL
- if (s64(m_r[RSREG]) < 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- else
- m_branch_state = NULLIFY;
- break;
- case 0x03: // BGEZL
- if (s64(m_r[RSREG]) >= 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- else
- m_branch_state = NULLIFY;
- break;
- //case 0x04: // *
- //case 0x05: // *
- //case 0x06: // *
- //case 0x07: // *
- case 0x08: // TGEI
- if (s64(m_r[RSREG]) >= s16(op))
- cpu_exception(EXCEPTION_TR);
- break;
- case 0x09: // TGEIU
- if (m_r[RSREG] >= u64(s64(s16(op))))
- cpu_exception(EXCEPTION_TR);
- break;
- case 0x0a: // TLTI
- if (s64(m_r[RSREG]) < s16(op))
- cpu_exception(EXCEPTION_TR);
- break;
- case 0x0b: // TLTIU
- if (m_r[RSREG] >= u64(s64(s16(op))))
- cpu_exception(EXCEPTION_TR);
- break;
- case 0x0c: // TEQI
- if (m_r[RSREG] == u64(s64(s16(op))))
- cpu_exception(EXCEPTION_TR);
- break;
- //case 0x0d: // *
- case 0x0e: // TNEI
- if (m_r[RSREG] != u64(s64(s16(op))))
- cpu_exception(EXCEPTION_TR);
- break;
- //case 0x0f: // *
- case 0x10: // BLTZAL
- if (s64(m_r[RSREG]) < 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- m_r[31] = ADDR(m_pc, 8);
- break;
- case 0x11: // BGEZAL
- if (s64(m_r[RSREG]) >= 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- m_r[31] = ADDR(m_pc, 8);
- break;
- case 0x12: // BLTZALL
- if (s64(m_r[RSREG]) < 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- else
- m_branch_state = NULLIFY;
- m_r[31] = ADDR(m_pc, 8);
- break;
- case 0x13: // BGEZALL
- if (s64(m_r[RSREG]) >= 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- else
- m_branch_state = NULLIFY;
- m_r[31] = ADDR(m_pc, 8);
- break;
- //case 0x14: // *
- //case 0x15: // *
- //case 0x16: // *
- //case 0x17: // *
- //case 0x18: // *
- //case 0x19: // *
- //case 0x1a: // *
- //case 0x1b: // *
- //case 0x1c: // *
- //case 0x1d: // *
- //case 0x1e: // *
- //case 0x1f: // *
-
- default:
- // * Operation codes marked with an asterisk cause reserved
- // instruction exceptions in all current implementations and are
- // reserved for future versions of the architecture.
- cpu_exception(EXCEPTION_RI);
- break;
- }
- break;
- case 0x02: // J
- m_branch_state = BRANCH;
- m_branch_target = (ADDR(m_pc, 4) & ~0x0fffffffULL) | ((op & 0x03ffffffU) << 2);
- break;
- case 0x03: // JAL
- m_branch_state = BRANCH;
- m_branch_target = (ADDR(m_pc, 4) & ~0x0fffffffULL) | ((op & 0x03ffffffU) << 2);
- m_r[31] = ADDR(m_pc, 8);
- break;
- case 0x04: // BEQ
- if (m_r[RSREG] == m_r[RTREG])
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- break;
- case 0x05: // BNE
- if (m_r[RSREG] != m_r[RTREG])
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- break;
- case 0x06: // BLEZ
- if (s64(m_r[RSREG]) <= 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- break;
- case 0x07: // BGTZ
- if (s64(m_r[RSREG]) > 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- break;
- case 0x08: // ADDI
- {
- u32 const sum = u32(m_r[RSREG]) + s16(op);
-
- // overflow: (sign(addend0) == sign(addend1)) && (sign(addend0) != sign(sum))
- if (!BIT(u32(m_r[RSREG]) ^ s32(s16(op)), 31) && BIT(u32(m_r[RSREG]) ^ sum, 31))
- cpu_exception(EXCEPTION_OV);
- else
- m_r[RTREG] = s64(s32(sum));
- }
- break;
- case 0x09: // ADDIU
- m_r[RTREG] = s64(s32(u32(m_r[RSREG]) + s16(op)));
- break;
- case 0x0a: // SLTI
- m_r[RTREG] = s64(m_r[RSREG]) < s64(s16(op));
- break;
- case 0x0b: // SLTIU
- m_r[RTREG] = m_r[RSREG] < u64(s64(s16(op)));
- break;
- case 0x0c: // ANDI
- m_r[RTREG] = m_r[RSREG] & u16(op);
- break;
- case 0x0d: // ORI
- m_r[RTREG] = m_r[RSREG] | u16(op);
- break;
- case 0x0e: // XORI
- m_r[RTREG] = m_r[RSREG] ^ u16(op);
- break;
- case 0x0f: // LUI
- m_r[RTREG] = s64(s16(op)) << 16;
- break;
- case 0x10: // COP0
- cp0_execute(op);
- break;
- case 0x11: // COP1
- cp1_execute(op);
- break;
- case 0x12: // COP2
- cp2_execute(op);
- break;
- //case 0x13: // *
- case 0x14: // BEQL
- if (m_r[RSREG] == m_r[RTREG])
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- else
- m_branch_state = NULLIFY;
- break;
- case 0x15: // BNEL
- if (m_r[RSREG] != m_r[RTREG])
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- else
- m_branch_state = NULLIFY;
- break;
- case 0x16: // BLEZL
- if (s64(m_r[RSREG]) <= 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- else
- m_branch_state = NULLIFY;
- break;
- case 0x17: // BGTZL
- if (s64(m_r[RSREG]) > 0)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- else
- m_branch_state = NULLIFY;
- break;
- case 0x18: // DADDI
- {
- u64 const sum = m_r[RSREG] + s64(s16(op));
-
- // overflow: (sign(addend0) == sign(addend1)) && (sign(addend0) != sign(sum))
- if (!BIT(m_r[RSREG] ^ s64(s16(op)), 63) && BIT(m_r[RSREG] ^ sum, 63))
- cpu_exception(EXCEPTION_OV);
- else
- m_r[RTREG] = sum;
- }
- break;
- case 0x19: // DADDIU
- m_r[RTREG] = m_r[RSREG] + s64(s16(op));
- break;
- case 0x1a: // LDL
- if (!(SR & SR_KSU) || (SR & (SR_EXL | SR_ERL)) || cp0_64())
- cpu_ldl(op);
- else
- cpu_exception(EXCEPTION_RI);
- break;
- case 0x1b: // LDR
- if (!(SR & SR_KSU) || (SR & (SR_EXL | SR_ERL)) || cp0_64())
- cpu_ldr(op);
- else
- cpu_exception(EXCEPTION_RI);
- break;
- //case 0x1c: // *
- //case 0x1d: // *
- //case 0x1e: // *
- //case 0x1f: // *
- case 0x20: // LB
- load<s8>(ADDR(m_r[RSREG], s16(op)),
- [this, op](s8 data)
- {
- m_r[RTREG] = data;
- });
- break;
- case 0x21: // LH
- load<s16>(ADDR(m_r[RSREG], s16(op)),
- [this, op](s16 data)
- {
- m_r[RTREG] = data;
- });
- break;
- case 0x22: // LWL
- cpu_lwl(op);
- break;
- case 0x23: // LW
- load<s32>(ADDR(m_r[RSREG], s16(op)),
- [this, op](s32 data)
- {
- m_r[RTREG] = data;
- });
- break;
- case 0x24: // LBU
- load<s8>(ADDR(m_r[RSREG], s16(op)),
- [this, op](u8 data)
- {
- m_r[RTREG] = data;
- });
- break;
- case 0x25: // LHU
- load<u16>(ADDR(m_r[RSREG], s16(op)),
- [this, op](u16 data)
- {
- m_r[RTREG] = data;
- });
- break;
- case 0x26: // LWR
- cpu_lwr(op);
- break;
- case 0x27: // LWU
- load<u32>(ADDR(m_r[RSREG], s16(op)),
- [this, op](u32 data)
- {
- m_r[RTREG] = data;
- });
- break;
- case 0x28: // SB
- store<u8>(ADDR(m_r[RSREG], s16(op)), u8(m_r[RTREG]));
- break;
- case 0x29: // SH
- store<u16>(ADDR(m_r[RSREG], s16(op)), u16(m_r[RTREG]));
- break;
- case 0x2a: // SWL
- cpu_swl(op);
- break;
- case 0x2b: // SW
- store<u32>(ADDR(m_r[RSREG], s16(op)), u32(m_r[RTREG]));
- break;
- case 0x2c: // SDL
- if (!(SR & SR_KSU) || (SR & (SR_EXL | SR_ERL)) || cp0_64())
- cpu_sdl(op);
- else
- cpu_exception(EXCEPTION_RI);
- break;
- case 0x2d: // SDR
- if (!(SR & SR_KSU) || (SR & (SR_EXL | SR_ERL)) || cp0_64())
- cpu_sdr(op);
- else
- cpu_exception(EXCEPTION_RI);
- break;
- case 0x2e: // SWR
- cpu_swr(op);
- break;
- case 0x2f: // CACHE
- if ((SR & SR_KSU) && !(SR & SR_CU0) && !(SR & (SR_EXL | SR_ERL)))
- {
- cpu_exception(EXCEPTION_CP0);
- break;
- }
-
- switch ((op >> 16) & 0x1f)
- {
- case 0x00: // index invalidate (I)
- if (ICACHE)
- {
- m_icache_tag[(ADDR(m_r[RSREG], s16(op)) & m_icache_mask_hi) >> m_icache_shift] &= ~ICACHE_V;
- break;
- }
-
- case 0x04: // index load tag (I)
- if (ICACHE)
- {
- u32 const tag = m_icache_tag[(ADDR(m_r[RSREG], s16(op)) & m_icache_mask_hi) >> m_icache_shift];
-
- m_cp0[CP0_TagLo] = ((tag & ICACHE_PTAG) << 8) | ((tag & ICACHE_V) >> 18) | ((tag & ICACHE_P) >> 25);
- m_cp0[CP0_ECC] = 0; // data ecc or parity
-
- break;
- }
-
- case 0x08: // index store tag (I)
- if (ICACHE)
- {
- // FIXME: compute parity
- m_icache_tag[(ADDR(m_r[RSREG], s16(op)) & m_icache_mask_hi) >> m_icache_shift] =
- (m_cp0[CP0_TagLo] & TAGLO_PTAGLO) >> 8 | (m_cp0[CP0_TagLo] & TAGLO_PSTATE) << 18;
-
- break;
- }
-
- case 0x01: // index writeback invalidate (D)
- case 0x02: // index invalidate (SI)
- case 0x03: // index writeback invalidate (SD)
-
- case 0x05: // index load tag (D)
- case 0x06: // index load tag (SI)
- case 0x07: // index load tag (SI)
-
- case 0x09: // index store tag (D)
- case 0x0a: // index store tag (SI)
- case 0x0b: // index store tag (SD)
-
- case 0x0d: // create dirty exclusive (D)
- case 0x0f: // create dirty exclusive (SD)
-
- case 0x10: // hit invalidate (I)
- case 0x11: // hit invalidate (D)
- case 0x12: // hit invalidate (SI)
- case 0x13: // hit invalidate (SD)
-
- case 0x14: // fill (I)
- case 0x15: // hit writeback invalidate (D)
- case 0x17: // hit writeback invalidate (SD)
-
- case 0x18: // hit writeback (I)
- case 0x19: // hit writeback (D)
- case 0x1b: // hit writeback (SD)
-
- case 0x1e: // hit set virtual (SI)
- case 0x1f: // hit set virtual (SD)
- //LOGMASKED(LOG_CACHE, "cache 0x%08x unimplemented (%s)\n", op, machine().describe_context());
- break;
- }
- break;
- case 0x30: // LL
- load_linked<s32>(ADDR(m_r[RSREG], s16(op)),
- [this, op](u64 address, s32 data)
- {
- // remove existing tap
- if (m_ll_watch)
- m_ll_watch->remove();
-
- m_r[RTREG] = data;
- m_cp0[CP0_LLAddr] = u32(address >> 4);
-
- // install write tap
- // FIXME: physical address truncation
- m_ll_watch = space(0).install_write_tap(offs_t(address & ~7), offs_t(address | 7), "ll",
- [this, hi(bool(BIT(address, 2)))](offs_t offset, u64 &data, u64 mem_mask)
- {
- if (hi ? ACCESSING_BITS_32_63 : ACCESSING_BITS_0_31)
- {
- m_ll_watch->remove();
- m_ll_watch = nullptr;
- }
- });
- });
- break;
- case 0x31: // LWC1
- cp1_execute(op);
- break;
- case 0x32: // LWC2
- cp2_execute(op);
- break;
- //case 0x33: // *
- case 0x34: // LLD
- load_linked<u64>(ADDR(m_r[RSREG], s16(op)),
- [this, op](u64 address, u64 data)
- {
- // remove existing tap
- if (m_ll_watch)
- m_ll_watch->remove();
-
- m_r[RTREG] = data;
- m_cp0[CP0_LLAddr] = u32(address >> 4);
-
- // install write tap
- // FIXME: address truncation
- m_ll_watch = space(0).install_write_tap(offs_t(address & ~7), offs_t(address | 7), "lld",
- [this](offs_t offset, u64 &data, u64 mem_mask)
- {
- m_ll_watch->remove();
- m_ll_watch = nullptr;
- });
- });
- break;
- case 0x35: // LDC1
- cp1_execute(op);
- break;
- case 0x36: // LDC2
- cp2_execute(op);
- break;
- case 0x37: // LD
- load<u64>(ADDR(m_r[RSREG], s16(op)),
- [this, op](u64 data)
- {
- m_r[RTREG] = data;
- });
- break;
- case 0x38: // SC
- if (m_ll_watch)
- {
- m_ll_watch->remove();
- m_ll_watch = nullptr;
-
- store<u32>(ADDR(m_r[RSREG], s16(op)), u32(m_r[RTREG]));
- m_r[RTREG] = 1;
- }
- else
- m_r[RTREG] = 0;
- break;
- case 0x39: // SWC1
- cp1_execute(op);
- break;
- case 0x3a: // SWC2
- cp2_execute(op);
- break;
- //case 0x3b: // *
- case 0x3c: // SCD
- if (m_ll_watch)
- {
- m_ll_watch->remove();
- m_ll_watch = nullptr;
-
- store<u64>(ADDR(m_r[RSREG], s16(op)), m_r[RTREG]);
- m_r[RTREG] = 1;
- }
- else
- m_r[RTREG] = 0;
- break;
- case 0x3d: // SDC1
- cp1_execute(op);
- break;
- case 0x3e: // SDC2
- cp2_execute(op);
- break;
- case 0x3f: // SD
- store<u64>(ADDR(m_r[RSREG], s16(op)), m_r[RTREG]);
- break;
-
- default:
- // * Operation codes marked with an asterisk cause reserved instruction
- // exceptions in all current implementations and are reserved for future
- // versions of the architecture.
- cpu_exception(EXCEPTION_RI);
- break;
- }
-}
-
-void r4000_base_device::cpu_exception(u32 exception, u16 const vector)
-{
- if (exception != EXCEPTION_INT)
- LOGMASKED(LOG_EXCEPTION, "exception 0x%08x\n", exception);
-
- if (!(SR & SR_EXL))
- {
- m_cp0[CP0_EPC] = m_pc;
-
- CAUSE = (CAUSE & CAUSE_IP) | exception;
-
- // if in a branch delay slot, restart at the branch instruction
- if (m_branch_state == DELAY)
- {
- m_cp0[CP0_EPC] -= 4;
- CAUSE |= CAUSE_BD;
- }
-
- SR |= SR_EXL;
- }
- else
- CAUSE = (CAUSE & (CAUSE_BD | CAUSE_IP)) | exception;
-
- m_branch_state = EXCEPTION;
- m_pc = ((SR & SR_BEV) ? s64(s32(0xbfc00200)) : s64(s32(0x80000000))) + vector;
-
- if (exception != EXCEPTION_INT)
- debugger_exception_hook(exception);
-}
-
-void r4000_base_device::cpu_lwl(u32 const op)
-{
- u64 const offset = ADDR(m_r[RSREG], s16(op));
- unsigned const shift = ((offset & 3) ^ R4000_ENDIAN_LE_BE(3, 0)) << 3;
-
- load<u32>(offset & ~3,
- [this, op, shift](u32 const data)
- {
- m_r[RTREG] = s32((m_r[RTREG] & ~u32(~u32(0) << shift)) | (data << shift));
- });
-}
-
-void r4000_base_device::cpu_lwr(u32 const op)
-{
- u64 const offset = ADDR(m_r[RSREG], s16(op));
- unsigned const shift = ((offset & 0x3) ^ R4000_ENDIAN_LE_BE(0, 3)) << 3;
-
- load<u32>(offset & ~3,
- [this, op, shift](u32 const data)
- {
- m_r[RTREG] = s32((m_r[RTREG] & ~u32(~u32(0) >> shift)) | (data >> shift));
- });
-}
-
-void r4000_base_device::cpu_swl(u32 const op)
-{
- u64 const offset = ADDR(m_r[RSREG], s16(op));
- unsigned const shift = ((offset & 3) ^ R4000_ENDIAN_LE_BE(3, 0)) << 3;
-
- store<u32>(offset & ~3, u32(m_r[RTREG]) >> shift, ~u32(0) >> shift);
-}
-
-void r4000_base_device::cpu_swr(u32 const op)
-{
- u64 const offset = ADDR(m_r[RSREG], s16(op));
- unsigned const shift = ((offset & 3) ^ R4000_ENDIAN_LE_BE(0, 3)) << 3;
-
- store<u32>(offset & ~3, u32(m_r[RTREG]) << shift, ~u32(0) << shift);
-}
-
-void r4000_base_device::cpu_ldl(u32 const op)
-{
- u64 const offset = ADDR(m_r[RSREG], s16(op));
- unsigned const shift = ((offset & 7) ^ R4000_ENDIAN_LE_BE(7, 0)) << 3;
-
- load<u64>(offset & ~7,
- [this, op, shift](u64 const data)
- {
- m_r[RTREG] = (m_r[RTREG] & ~u64(~u64(0) << shift)) | (data << shift);
- });
-}
-
-void r4000_base_device::cpu_ldr(u32 const op)
-{
- u64 const offset = ADDR(m_r[RSREG], s16(op));
- unsigned const shift = ((offset & 7) ^ R4000_ENDIAN_LE_BE(0, 7)) << 3;
-
- load<u64>(offset & ~7,
- [this, op, shift](u64 const data)
- {
- m_r[RTREG] = (m_r[RTREG] & ~u64(~u64(0) >> shift)) | (data >> shift);
- });
-}
-
-void r4000_base_device::cpu_sdl(u32 const op)
-{
- u64 const offset = ADDR(m_r[RSREG], s16(op));
- unsigned const shift = ((offset & 7) ^ R4000_ENDIAN_LE_BE(7, 0)) << 3;
-
- store<u64>(offset & ~7, m_r[RTREG] >> shift, ~u64(0) >> shift);
-}
-
-void r4000_base_device::cpu_sdr(u32 const op)
-{
- u64 const offset = ADDR(m_r[RSREG], s16(op));
- unsigned const shift = ((offset & 7) ^ R4000_ENDIAN_LE_BE(0, 7)) << 3;
-
- store<u64>(offset & ~7, m_r[RTREG] << shift, ~u64(0) << shift);
-}
-
-void r4000_base_device::cp0_execute(u32 const op)
-{
- if ((SR & SR_KSU) && !(SR & SR_CU0) && !(SR & (SR_EXL | SR_ERL)))
- {
- cpu_exception(EXCEPTION_CP0);
- return;
- }
-
- switch ((op >> 21) & 0x1f)
- {
- case 0x00: // MFC0
- m_r[RTREG] = s32(cp0_get(RDREG));
- break;
- case 0x01: // DMFC0
- // ε Operation codes marked with epsilon are valid when the
- // processor is operating either in the Kernel mode or in the
- // 64-bit non-Kernel (User or Supervisor) mode. These instructions
- // cause a reserved instruction exception if 64-bit operation is
- // not enabled in User or Supervisor mode.
- if (!(SR & SR_KSU) || (SR & (SR_EXL | SR_ERL)) || cp0_64())
- m_r[RTREG] = cp0_get(RDREG);
- else
- cpu_exception(EXCEPTION_RI);
- break;
- case 0x02: // CFC0
- break;
-
- case 0x04: // MTC0
- cp0_set(RDREG, s64(s32(m_r[RTREG])));
- break;
- case 0x05: // DMTC0
- // ε Operation codes marked with epsilon are valid when the
- // processor is operating either in the Kernel mode or in the
- // 64-bit non-Kernel (User or Supervisor) mode. These instructions
- // cause a reserved instruction exception if 64-bit operation is
- // not enabled in User or Supervisor mode.
- if (!(SR & SR_KSU) || (SR & (SR_EXL | SR_ERL)) || cp0_64())
- cp0_set(RDREG, m_r[RTREG]);
- else
- cpu_exception(EXCEPTION_RI);
- break;
- case 0x06: // CTC0
- break;
-
- case 0x08: // BC0
- switch ((op >> 16) & 0x1f)
- {
- case 0x00: // BC0F
- case 0x01: // BC0T
- case 0x02: // BC0FL
- case 0x03: // BC0TL
- // fall through
-
- default:
- // γ Operation codes marked with a gamma cause a reserved
- // instruction exception. They are reserved for future versions
- // of the architecture.
- cpu_exception(EXCEPTION_RI);
- break;
- }
- break;
-
- case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17:
- case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
- // CP0 function
- switch (op & 0x3f)
- {
- case 0x01: // TLBR
- cp0_tlbr();
- break;
- case 0x02: // TLBWI
- cp0_tlbwi(m_cp0[CP0_Index] & 0x3f);
- break;
-
- case 0x06: // TLBWR
- cp0_tlbwr();
- break;
-
- case 0x08: // TLBP
- cp0_tlbp();
- break;
-
- case 0x10: // RFE
- // ξ Operation codes marked with a xi cause a reserved
- // instruction exception on R4000 processors.
- cpu_exception(EXCEPTION_RI);
- break;
-
- case 0x18: // ERET
- if (SR & SR_ERL)
- {
- logerror("eret from error\n");
- m_branch_state = EXCEPTION;
- m_pc = m_cp0[CP0_ErrorEPC];
- SR &= ~SR_ERL;
- }
- else
- {
- m_branch_state = EXCEPTION;
- m_pc = m_cp0[CP0_EPC];
- SR &= ~SR_EXL;
- }
-
- if (m_ll_watch)
- {
- m_ll_watch->remove();
- m_ll_watch = nullptr;
- }
- break;
-
- default:
- // Φ Operation codes marked with a phi are invalid but do not
- // cause reserved instruction exceptions in R4000 implementations.
- break;
- }
- break;
-
- default:
- // γ Operation codes marked with a gamma cause a reserved
- // instruction exception. They are reserved for future versions
- // of the architecture.
- cpu_exception(EXCEPTION_RI);
- break;
- }
-}
-
-u64 r4000_base_device::cp0_get(unsigned const reg)
-{
- switch (reg)
- {
- case CP0_Count:
- return u32((total_cycles() - m_cp0_timer_zero) / 2);
-
- case CP0_Random:
- {
- u8 const wired = m_cp0[CP0_Wired] & 0x3f;
-
- if (wired < ARRAY_LENGTH(m_tlb))
- return ((total_cycles() - m_cp0_timer_zero) % (ARRAY_LENGTH(m_tlb) - wired) + wired) & 0x3f;
- else
- return ARRAY_LENGTH(m_tlb) - 1;
- }
- break;
-
- default:
- return m_cp0[reg];
- }
-}
-
-void r4000_base_device::cp0_set(unsigned const reg, u64 const data)
-{
- switch (reg)
- {
- case CP0_Count:
- m_cp0[CP0_Count] = u32(data);
- m_cp0_timer_zero = total_cycles() - m_cp0[CP0_Count] * 2;
-
- cp0_update_timer();
- break;
-
- case CP0_EntryHi:
- m_cp0[CP0_EntryHi] = data & (EH_R | EH_VPN2_64 | EH_ASID);
- break;
-
- case CP0_Compare:
- m_cp0[CP0_Compare] = u32(data);
- CAUSE &= ~CAUSE_IPEX5;
-
- cp0_update_timer(true);
- break;
-
- case CP0_Status:
- m_cp0[CP0_Status] = u32(data);
-
- // FIXME: software interrupt check
- if (CAUSE & SR & SR_IMSW)
- m_icount = 0;
-
- if (data & SR_RE)
- fatalerror("unimplemented reverse endian mode enabled (%s)\n", machine().describe_context().c_str());
- break;
-
- case CP0_Cause:
- CAUSE = (CAUSE & ~CAUSE_IPSW) | (data & CAUSE_IPSW);
-
- // FIXME: software interrupt check
- if (CAUSE & SR & SR_IMSW)
- m_icount = 0;
- break;
-
- case CP0_PRId:
- // read-only register
- break;
-
- case CP0_Config:
- m_cp0[CP0_Config] = (m_cp0[CP0_Config] & ~CONFIG_WM) | (data & CONFIG_WM);
-
- if (m_cp0[CP0_Config] & CONFIG_IB)
- {
- m_icache_line_size = 32;
- m_icache_shift = 5;
- m_icache_mask_lo = ~u32(0x1f);
- }
- else
- {
- m_icache_line_size = 16;
- m_icache_shift = 4;
- m_icache_mask_lo = ~u32(0xf);
- }
-
- LOGMASKED(LOG_CACHE, "icache/dcache line sizes %d/%d bytes\n",
- m_icache_line_size, m_cp0[CP0_Config] & CONFIG_DB ? 32 : 16);
- break;
-
- default:
- m_cp0[reg] = data;
- break;
- }
-}
-
-void r4000_base_device::cp0_tlbr()
-{
- u8 const index = m_cp0[CP0_Index] & 0x3f;
-
- if (index < ARRAY_LENGTH(m_tlb))
- {
- tlb_entry_t const &entry = m_tlb[index];
-
- m_cp0[CP0_PageMask] = entry.mask;
- m_cp0[CP0_EntryHi] = entry.vpn;
- m_cp0[CP0_EntryLo0] = entry.pfn[0];
- m_cp0[CP0_EntryLo1] = entry.pfn[1];
- }
-}
-
-void r4000_base_device::cp0_tlbwi(u8 const index)
-{
- if (index < ARRAY_LENGTH(m_tlb))
- {
- tlb_entry_t &entry = m_tlb[index];
-
- entry.mask = m_cp0[CP0_PageMask];
- entry.vpn = m_cp0[CP0_EntryHi];
- if ((m_cp0[CP0_EntryLo0] & EL_G) && (m_cp0[CP0_EntryLo1] & EL_G))
- entry.vpn |= EH_G;
- entry.pfn[0] = m_cp0[CP0_EntryLo0];
- entry.pfn[1] = m_cp0[CP0_EntryLo1];
-
- entry.low_bit = 32 - count_leading_zeros((entry.mask >> 1) | 0xfff);
-
- LOGMASKED(LOG_TLB, "tlb write index %02d mask 0x%016x vpn2 0x%016x %c asid 0x%02x pfn0 0x%016x %c%c pfn1 0x%016x %c%c (%s)\n",
- index, entry.mask,
- entry.vpn, entry.vpn & EH_G ? 'G' : '-', entry.vpn & EH_ASID,
- entry.pfn[0] & EL_PFN, entry.pfn[0] & EL_D ? 'D' : '-', entry.pfn[0] & EL_V ? 'V' : '-',
- entry.pfn[1] & EL_PFN, entry.pfn[1] & EL_D ? 'D' : '-', entry.pfn[1] & EL_V ? 'V' : '-',
- machine().describe_context());
- }
-}
-
-void r4000_base_device::cp0_tlbwr()
-{
- u8 const wired = m_cp0[CP0_Wired] & 0x3f;
- u8 const unwired = ARRAY_LENGTH(m_tlb) - wired;
-
- u8 const index = (unwired > 0) ? ((total_cycles() - m_cp0_timer_zero) % unwired + wired) & 0x3f : (ARRAY_LENGTH(m_tlb) - 1);
-
- cp0_tlbwi(index);
-}
-
-void r4000_base_device::cp0_tlbp()
-{
- m_cp0[CP0_Index] = 0x80000000;
- for (u8 index = 0; index < ARRAY_LENGTH(m_tlb); index++)
- {
- tlb_entry_t const &entry = m_tlb[index];
-
- u64 const mask = (cp0_64() ? EH_R | (EH_VPN2_64 & ~entry.mask) : (EH_VPN2_32 & ~entry.mask))
- | ((entry.vpn & EH_G) ? 0 : EH_ASID);
-
- if ((entry.vpn & mask) == (m_cp0[CP0_EntryHi] & mask))
- {
- m_cp0[CP0_Index] = index;
- break;
- }
- }
-
- if (m_cp0[CP0_Index] == 0x80000000)
- LOGMASKED(LOG_TLB, "tlbp miss 0x%08x\n", m_cp0[CP0_EntryHi]);
- else
- LOGMASKED(LOG_TLB, "tlbp hit 0x%08x index %02d\n", m_cp0[CP0_EntryHi], m_cp0[CP0_Index]);
-}
-
-void r4000_base_device::cp0_update_timer(bool start)
-{
- if (start || m_cp0_timer->enabled())
- {
- u32 const count = (total_cycles() - m_cp0_timer_zero) / 2;
- u32 const delta = m_cp0[CP0_Compare] - count;
-
- m_cp0_timer->adjust(cycles_to_attotime(u64(delta) * 2));
- }
-}
-
-TIMER_CALLBACK_MEMBER(r4000_base_device::cp0_timer_callback)
-{
- m_cp0[CP0_Cause] |= CAUSE_IPEX5;
-}
-
-bool r4000_base_device::cp0_64() const
-{
- switch (SR & (SR_KSU | SR_ERL | SR_EXL))
- {
- case SR_KSU_U: return bool(SR & SR_UX);
- case SR_KSU_S: return bool(SR & SR_SX);
-
- default:
- return bool(SR & SR_KX);
- }
-}
-
-void r4000_base_device::cp1_execute(u32 const op)
-{
- if (!(SR & SR_CU1))
- {
- cpu_exception(EXCEPTION_CP1);
- return;
- }
-
- softfloat_exceptionFlags = 0;
- switch (op >> 26)
- {
- case 0x11: // COP1
- switch ((op >> 21) & 0x1f)
- {
- case 0x00: // MFC1
- if (SR & SR_FR)
- m_r[RTREG] = s64(s32(m_f[RDREG]));
- else
- if (RDREG & 1)
- // move the high half of the even floating point register
- m_r[RTREG] = s64(s32(m_f[RDREG & ~1] >> 32));
- else
- // move the low half of the even floating point register
- m_r[RTREG] = s64(s32(m_f[RDREG & ~1] >> 0));
- break;
- case 0x01: // DMFC1
- // TODO: MIPS3 only
- if ((SR & SR_FR) || !(RDREG & 1))
- m_r[RTREG] = m_f[RDREG];
- break;
- case 0x02: // CFC1
- switch (RDREG)
- {
- case 0: m_r[RTREG] = m_fcr0; break;
- case 30: m_r[RTREG] = m_fcr30; break;
- case 31: m_r[RTREG] = m_fcr31; break;
-
- default:
- logerror("cfc1 undefined fpu control register %d (%s)\n", RDREG, machine().describe_context());
- break;
- }
- break;
- case 0x04: // MTC1
- if (SR & SR_FR)
- m_f[RDREG] = u32(m_r[RTREG]);
- else
- if (RDREG & 1)
- // load the high half of the even floating point register
- m_f[RDREG & ~1] = (m_r[RTREG] << 32) | u32(m_f[RDREG & ~1]);
- else
- // load the low half of the even floating point register
- m_f[RDREG & ~1] = (m_f[RDREG & ~1] & ~0xffffffffULL) | u32(m_r[RTREG]);
- break;
- case 0x05: // DMTC1
- // TODO: MIPS3 only
- if ((SR & SR_FR) || !(RDREG & 1))
- m_f[RDREG] = m_r[RTREG];
- break;
- case 0x06: // CTC1
- switch (RDREG)
- {
- case 0: // register is read-only
- break;
-
- case 30: // unknown
- m_fcr30 = u32(m_r[RTREG]);
- break;
-
- case 31:
- m_fcr31 = u32(m_r[RTREG]);
-
- // update rounding mode
- switch (m_fcr31 & FCR31_RM)
- {
- case 0: softfloat_roundingMode = softfloat_round_near_even; break;
- case 1: softfloat_roundingMode = softfloat_round_minMag; break;
- case 2: softfloat_roundingMode = softfloat_round_max; break;
- case 3: softfloat_roundingMode = softfloat_round_min; break;
- }
-
- // exception check
- if ((m_fcr31 & FCR31_CE) || ((m_fcr31 & FCR31_CM) >> 5) & (m_fcr31 & FCR31_EM))
- cpu_exception(EXCEPTION_FPE);
-
- break;
-
- default:
- logerror("ctc1 undefined fpu control register %d (%s)\n", RDREG, machine().describe_context());
- break;
- }
- break;
- case 0x08: // BC
- switch ((op >> 16) & 0x1f)
- {
- case 0x00: // BC1F
- if (!(m_fcr31 & FCR31_C))
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- break;
- case 0x01: // BC1T
- if (m_fcr31 & FCR31_C)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- break;
- case 0x02: // BC1FL
- if (!(m_fcr31 & FCR31_C))
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- else
- m_branch_state = NULLIFY;
- break;
- case 0x03: // BC1TL
- if (m_fcr31 & FCR31_C)
- {
- m_branch_state = BRANCH;
- m_branch_target = ADDR(m_pc + 4, s32(s16(op)) << 2);
- }
- else
- m_branch_state = NULLIFY;
- break;
-
- default:
- // reserved instructions
- cpu_exception(EXCEPTION_RI);
- break;
- }
- break;
-
- case 0x10: // S
- switch (op & 0x3f)
- {
- case 0x00: // ADD.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_add(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }).v);
- break;
- case 0x01: // SUB.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_sub(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }).v);
- break;
- case 0x02: // MUL.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_mul(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }).v);
- break;
- case 0x03: // DIV.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_div(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }).v);
- break;
- case 0x04: // SQRT.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_sqrt(float32_t{ u32(m_f[FSREG]) }).v);
- break;
- case 0x05: // ABS.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f32_lt(float32_t{ u32(m_f[FSREG]) }, float32_t{ 0 }))
- cp1_set(FDREG, f32_mul(float32_t{ u32(m_f[FSREG]) }, i32_to_f32(-1)).v);
- else
- cp1_set(FDREG, m_f[FSREG]);
- }
- break;
- case 0x06: // MOV.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- m_f[FDREG] = m_f[FSREG];
- break;
- case 0x07: // NEG.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_mul(float32_t{ u32(m_f[FSREG]) }, i32_to_f32(-1)).v);
- break;
- case 0x08: // ROUND.L.S
- // TODO: MIPS3 only
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_to_i64(float32_t{ u32(m_f[FSREG]) }, softfloat_round_near_even, true));
- break;
- case 0x09: // TRUNC.L.S
- // TODO: MIPS3 only
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_to_i64(float32_t{ u32(m_f[FSREG]) }, softfloat_round_minMag, true));
- break;
- case 0x0a: // CEIL.L.S
- // TODO: MIPS3 only
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_to_i64(float32_t{ u32(m_f[FSREG]) }, softfloat_round_max, true));
- break;
- case 0x0b: // FLOOR.L.S
- // TODO: MIPS3 only
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_to_i64(float32_t{ u32(m_f[FSREG]) }, softfloat_round_min, true));
- break;
- case 0x0c: // ROUND.W.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_to_i32(float32_t{ u32(m_f[FSREG]) }, softfloat_round_near_even, true));
- break;
- case 0x0d: // TRUNC.W.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_to_i32(float32_t{ u32(m_f[FSREG]) }, softfloat_round_minMag, true));
- break;
- case 0x0e: // CEIL.W.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_to_i32(float32_t{ u32(m_f[FSREG]) }, softfloat_round_max, true));
- break;
- case 0x0f: // FLOOR.W.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_to_i32(float32_t{ u32(m_f[FSREG]) }, softfloat_round_min, true));
- break;
-
- case 0x21: // CVT.D.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_to_f64(float32_t{ u32(m_f[FSREG]) }).v);
- break;
- case 0x24: // CVT.W.S
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_to_i32(float32_t{ u32(m_f[FSREG]) }, softfloat_roundingMode, true));
- break;
- case 0x25: // CVT.L.S
- // TODO: MIPS3 only
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f32_to_i64(float32_t{ u32(m_f[FSREG]) }, softfloat_roundingMode, true));
- break;
-
- case 0x30: // C.F.S (false)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x31: // C.UN.S (unordered)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- // detect unordered
- f32_eq(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) });
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x32: // C.EQ.S (equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f32_eq(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x33: // C.UEQ.S (unordered equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f32_eq(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x34: // C.OLT.S (less than)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f32_lt(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x35: // C.ULT.S (unordered less than)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f32_lt(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x36: // C.OLE.S (less than or equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f32_le(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x37: // C.ULE.S (unordered less than or equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f32_le(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
-
- case 0x38: // C.SF.S (signalling false)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- // detect unordered
- f32_eq(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) });
-
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
- case 0x39: // C.NGLE.S (not greater, less than or equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- // detect unordered
- f32_eq(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) });
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_C | FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x3a: // C.SEQ.S (signalling equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f32_eq(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
- case 0x3b: // C.NGL.S (not greater or less than)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f32_eq(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
- case 0x3c: // C.LT.S (less than)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f32_lt(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
- case 0x3d: // C.NGE.S (not greater or equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f32_lt(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
- case 0x3e: // C.LE.S (less than or equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f32_le(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
- case 0x3f: // C.NGT.S (not greater than)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f32_le(float32_t{ u32(m_f[FSREG]) }, float32_t{ u32(m_f[FTREG]) }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
-
- default: // unimplemented operations
- m_fcr31 |= FCR31_CE;
- cpu_exception(EXCEPTION_FPE);
- break;
- }
- break;
- case 0x11: // D
- switch (op & 0x3f)
- {
- case 0x00: // ADD.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_add(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }).v);
- break;
- case 0x01: // SUB.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_sub(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }).v);
- break;
- case 0x02: // MUL.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_mul(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }).v);
- break;
- case 0x03: // DIV.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_div(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }).v);
- break;
- case 0x04: // SQRT.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_sqrt(float64_t{ m_f[FSREG] }).v);
- break;
- case 0x05: // ABS.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f64_lt(float64_t{ m_f[FSREG] }, float64_t{ 0 }))
- cp1_set(FDREG, f64_mul(float64_t{ m_f[FSREG] }, i32_to_f64(-1)).v);
- else
- cp1_set(FDREG, m_f[FSREG]);
- }
- break;
- case 0x06: // MOV.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- m_f[FDREG] = m_f[FSREG];
- break;
- case 0x07: // NEG.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_mul(float64_t{ m_f[FSREG] }, i32_to_f64(-1)).v);
- break;
- case 0x08: // ROUND.L.D
- // TODO: MIPS3 only
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_to_i64(float64_t{ m_f[FSREG] }, softfloat_round_near_even, true));
- break;
- case 0x09: // TRUNC.L.D
- // TODO: MIPS3 only
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_to_i64(float64_t{ m_f[FSREG] }, softfloat_round_minMag, true));
- break;
- case 0x0a: // CEIL.L.D
- // TODO: MIPS3 only
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_to_i64(float64_t{ m_f[FSREG] }, softfloat_round_max, true));
- break;
- case 0x0b: // FLOOR.L.D
- // TODO: MIPS3 only
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_to_i64(float64_t{ m_f[FSREG] }, softfloat_round_min, true));
- break;
- case 0x0c: // ROUND.W.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_to_i32(float64_t{ m_f[FSREG] }, softfloat_round_near_even, true));
- break;
- case 0x0d: // TRUNC.W.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_to_i32(float64_t{ m_f[FSREG] }, softfloat_round_minMag, true));
- break;
- case 0x0e: // CEIL.W.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_to_i32(float64_t{ m_f[FSREG] }, softfloat_round_max, true));
- break;
- case 0x0f: // FLOOR.W.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_to_i32(float64_t{ m_f[FSREG] }, softfloat_round_min, true));
- break;
-
- case 0x20: // CVT.S.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_to_f32(float64_t{ m_f[FSREG] }).v);
- break;
- case 0x24: // CVT.W.D
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_to_i32(float64_t{ m_f[FSREG] }, softfloat_roundingMode, true));
- break;
- case 0x25: // CVT.L.D
- // TODO: MIPS3 only
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, f64_to_i64(float64_t{ m_f[FSREG] }, softfloat_roundingMode, true));
- break;
-
- case 0x30: // C.F.D (false)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- m_fcr31 &= ~FCR31_C;
- break;
- case 0x31: // C.UN.D (unordered)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- // detect unordered
- f64_eq(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] });
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x32: // C.EQ.D (equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f64_eq(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x33: // C.UEQ.D (unordered equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f64_eq(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x34: // C.OLT.D (less than)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f64_lt(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x35: // C.ULT.D (unordered less than)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f64_lt(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x36: // C.OLE.D (less than or equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f64_le(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x37: // C.ULE.D (unordered less than or equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f64_le(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
-
- case 0x38: // C.SF.D (signalling false)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- // detect unordered
- f64_eq(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] });
-
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
- case 0x39: // C.NGLE.D (not greater, less than or equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- // detect unordered
- f64_eq(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] });
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_C | FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- else
- m_fcr31 &= ~FCR31_C;
- }
- break;
- case 0x3a: // C.SEQ.D (signalling equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f64_eq(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
- case 0x3b: // C.NGL.D (not greater or less than)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f64_eq(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
- case 0x3c: // C.LT.D (less than)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f64_lt(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
- case 0x3d: // C.NGE.D (not greater or equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f64_lt(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
- case 0x3e: // C.LE.D (less than or equal)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f64_le(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
- case 0x3f: // C.NGT.D (not greater than)
- if ((SR & SR_FR) || !(op & ODD_REGS))
- {
- if (f64_le(float64_t{ m_f[FSREG] }, float64_t{ m_f[FTREG] }) || (softfloat_exceptionFlags & softfloat_flag_invalid))
- m_fcr31 |= FCR31_C;
- else
- m_fcr31 &= ~FCR31_C;
-
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- {
- m_fcr31 |= FCR31_CV;
- cpu_exception(EXCEPTION_FPE);
- }
- }
- break;
-
- default: // unimplemented operations
- m_fcr31 |= FCR31_CE;
- cpu_exception(EXCEPTION_FPE);
- break;
- }
- break;
- case 0x14: // W
- switch (op & 0x3f)
- {
- case 0x20: // CVT.S.W
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, i32_to_f32(s32(m_f[FSREG])).v);
- break;
- case 0x21: // CVT.D.W
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, i32_to_f64(s32(m_f[FSREG])).v);
- break;
-
- default: // unimplemented operations
- m_fcr31 |= FCR31_CE;
- cpu_exception(EXCEPTION_FPE);
- break;
- }
- break;
- case 0x15: // L
- // TODO: MIPS3 only
- switch (op & 0x3f)
- {
- case 0x02a00020: // CVT.S.L
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, i64_to_f32(s64(m_f[FSREG])).v);
- break;
- case 0x02a00021: // CVT.D.L
- if ((SR & SR_FR) || !(op & ODD_REGS))
- cp1_set(FDREG, i64_to_f64(s64(m_f[FSREG])).v);
- break;
-
- default: // unimplemented operations
- m_fcr31 |= FCR31_CE;
- cpu_exception(EXCEPTION_FPE);
- break;
- }
- break;
-
- default: // unimplemented operations
- m_fcr31 |= FCR31_CE;
- cpu_exception(EXCEPTION_FPE);
- break;
- }
- break;
-
- case 0x31: // LWC1
- load<u32>(ADDR(m_r[RSREG], s16(op)),
- [this, op](u32 data)
- {
- if (SR & SR_FR)
- m_f[RTREG] = data;
- else
- if (RTREG & 1)
- // load the high half of the even floating point register
- m_f[RTREG & ~1] = (u64(data) << 32) | u32(m_f[RTREG & ~1]);
- else
- // load the low half of the even floating point register
- m_f[RTREG & ~1] = (m_f[RTREG & ~1] & ~0xffffffffULL) | data;
- });
- break;
-
- case 0x35: // LDC1
- load<u64>(ADDR(m_r[RSREG], s16(op)),
- [this, op](u64 data)
- {
- if ((SR & SR_FR) || !(RTREG & 1))
- m_f[RTREG] = data;
- });
- break;
-
- case 0x39: // SWC1
- if (SR & SR_FR)
- store<u32>(ADDR(m_r[RSREG], s16(op)), u32(m_f[RTREG]));
- else
- if (RTREG & 1)
- // store the high half of the even floating point register
- store<u32>(ADDR(m_r[RSREG], s16(op)), u32(m_f[RTREG & ~1] >> 32));
- else
- // store the low half of the even floating point register
- store<u32>(ADDR(m_r[RSREG], s16(op)), u32(m_f[RTREG & ~1]));
- break;
-
- case 0x3d: // SDC1
- if ((SR & SR_FR) || !(RTREG & 1))
- store<u64>(ADDR(m_r[RSREG], s16(op)), m_f[RTREG]);
- break;
- }
-}
-
-void r4000_base_device::cp1_set(unsigned const reg, u64 const data)
-{
- // translate softfloat exception flags to cause register
- if (softfloat_exceptionFlags)
- {
- if (softfloat_exceptionFlags & softfloat_flag_inexact)
- m_fcr31 |= FCR31_CI;
- if (softfloat_exceptionFlags & softfloat_flag_underflow)
- m_fcr31 |= FCR31_CU;
- if (softfloat_exceptionFlags & softfloat_flag_overflow)
- m_fcr31 |= FCR31_CO;
- if (softfloat_exceptionFlags & softfloat_flag_infinite)
- m_fcr31 |= FCR31_CZ;
- if (softfloat_exceptionFlags & softfloat_flag_invalid)
- m_fcr31 |= FCR31_CV;
-
- // check if exception is enabled
- if (((m_fcr31 & FCR31_CM) >> 5) & (m_fcr31 & FCR31_EM))
- {
- cpu_exception(EXCEPTION_FPE);
- return;
- }
-
- // set flags
- m_fcr31 |= ((m_fcr31 & FCR31_CM) >> 10);
- }
-
- m_f[reg] = data;
-}
-
-void r4000_base_device::cp2_execute(u32 const op)
-{
- if (!(SR & SR_CU2))
- {
- cpu_exception(EXCEPTION_CP2);
- return;
- }
-
- switch (op >> 26)
- {
- case 0x12: // COP2
- switch ((op >> 21) & 0x1f)
- {
- case 0x00: // MFC2
- logerror("mfc2 unimplemented (%s)\n", machine().describe_context());
- break;
- case 0x01: // DMFC2
- // ε Operation codes marked with epsilon are valid when the
- // processor is operating either in the Kernel mode or in the
- // 64-bit non-Kernel (User or Supervisor) mode. These instructions
- // cause a reserved instruction exception if 64-bit operation is
- // not enabled in User or Supervisor mode.
- if (!(SR & SR_KSU) || (SR & (SR_EXL | SR_ERL)) || cp0_64())
- logerror("dmfc2 unimplemented (%s)\n", machine().describe_context());
- else
- cpu_exception(EXCEPTION_RI);
- break;
- case 0x02: // CFC2
- logerror("cfc2 unimplemented (%s)\n", machine().describe_context());
- break;
-
- case 0x04: // MTC2
- logerror("mtc2 unimplemented (%s)\n", machine().describe_context());
- break;
- case 0x05: // DMTC2
- // ε Operation codes marked with epsilon are valid when the
- // processor is operating either in the Kernel mode or in the
- // 64-bit non-Kernel (User or Supervisor) mode. These instructions
- // cause a reserved instruction exception if 64-bit operation is
- // not enabled in User or Supervisor mode.
- if (!(SR & SR_KSU) || (SR & (SR_EXL | SR_ERL)) || cp0_64())
- logerror("dmtc2 unimplemented (%s)\n", machine().describe_context());
- else
- cpu_exception(EXCEPTION_RI);
- break;
- case 0x06: // CTC2
- logerror("ctc2 unimplemented (%s)\n", machine().describe_context());
- break;
-
- case 0x08: // BC2
- switch ((op >> 16) & 0x1f)
- {
- case 0x00: // BC2F
- case 0x01: // BC2F
- case 0x02: // BC2FL
- case 0x03: // BC2TL
- logerror("bc2 unimplemented (%s)\n", machine().describe_context());
- break;
-
- default:
- // γ Operation codes marked with a gamma cause a reserved
- // instruction exception. They are reserved for future versions
- // of the architecture.
- cpu_exception(EXCEPTION_RI);
- break;
- }
- break;
-
- case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17:
- case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
- // CP2 function
- logerror("function unimplemented (%s)\n", machine().describe_context());
- break;
-
- default:
- // γ Operation codes marked with a gamma cause a reserved
- // instruction exception. They are reserved for future versions
- // of the architecture.
- cpu_exception(EXCEPTION_RI);
- break;
- }
- break;
-
- case 0x32: // LWC2
- logerror("lwc2 unimplemented (%s)\n", machine().describe_context());
- break;
-
- case 0x36: // LDC2
- logerror("ldc2 unimplemented (%s)\n", machine().describe_context());
- break;
-
- case 0x3a: // SWC2
- logerror("swc2 unimplemented (%s)\n", machine().describe_context());
- break;
-
- case 0x3e: // SDC2
- logerror("sdc2 unimplemented (%s)\n", machine().describe_context());
- break;
- }
-}
-
-r4000_base_device::translate_t r4000_base_device::translate(int intention, u64 &address)
-{
- /*
- * Decode the program address into one of the following ranges depending on
- * the active status register bits.
- *
- * 32-bit modes
- * user: 0x0000'0000-0x7fff'ffff (useg, mapped)
- *
- * super: 0x0000'0000-0x7fff'ffff (suseg, mapped)
- * 0xc000'0000-0xdfff'ffff (ssseg, mapped)
- *
- * kernel: 0x0000'0000-0x7fff'ffff (kuseg, mapped)
- * 0x8000'0000-0x9fff'ffff (kseg0, unmapped, cached)
- * 0xa000'0000-0xbfff'ffff (kseg1, unmapped, uncached)
- * 0xc000'0000-0xdfff'ffff (ksseg, mapped)
- * 0xe000'0000-0xffff'ffff (kseg3, mapped)
- *
- * 64-bit modes
- * user: 0x0000'0000'0000'0000-0x0000'00ff'ffff'ffff (xuseg, mapped)
- *
- * super: 0x0000'0000'0000'0000-0x0000'00ff'ffff'ffff (xsuseg, mapped)
- * 0x4000'0000'0000'0000-0x4000'00ff'ffff'ffff (xsseg, mapped)
- * 0xffff'ffff'c000'0000-0xffff'ffff'dfff'ffff (csseg, mapped)
- *
- * kernel: 0x0000'0000'0000'0000-0x0000'00ff'ffff'ffff (xkuseg, mapped)
- * 0x4000'0000'0000'0000-0x4000'00ff'ffff'ffff (xksseg, mapped)
- * 0x8000'0000'0000'0000-0xbfff'ffff'ffff'ffff (xkphys, unmapped)
- * 0xc000'0000'0000'0000-0xc000'00ff'7fff'ffff (xkseg, mapped)
- * 0xffff'ffff'8000'0000-0xffff'ffff'9fff'ffff (ckseg0, unmapped, cached)
- * 0xffff'ffff'a000'0000-0xffff'ffff'bfff'ffff (ckseg1, unmapped, uncached)
- * 0xffff'ffff'c000'0000-0xffff'ffff'dfff'ffff (cksseg, mapped)
- * 0xffff'ffff'e000'0000-0xffff'ffff'ffff'ffff (ckseg3, mapped)
- */
-
- bool extended = false;
-
- switch (SR & (SR_KSU | SR_ERL | SR_EXL))
- {
- case SR_KSU_U:
- // user mode
- if (SR & SR_UX)
- {
- // 64-bit user mode
- if (address & 0xffff'ff00'0000'0000)
- return ERROR; // exception
- else
- extended = true; // xuseg
- }
- else
- {
- // 32-bit user mode
- if (address & 0xffff'ffff'8000'0000)
- return ERROR; // exception
- else
- extended = false; // useg
- }
- break;
-
- case SR_KSU_S:
- // supervisor mode
- if (SR & SR_SX)
- {
- // 64-bit supervisor mode
- if (address & 0xffff'ff00'0000'0000)
- if ((address & 0xffff'ff00'0000'0000) == 0x4000'0000'0000'0000)
- extended = true; // xsseg
- else
- if ((address & 0xffff'ffff'e000'0000) == 0xffff'ffff'c000'0000)
- extended = true; // csseg
- else
- return ERROR; // exception
- else
- extended = true; // xsuseg
- }
- else
- {
- // 32-bit supervisor mode
- if (address & 0xffff'ffff'8000'0000)
- if ((address & 0xffff'ffff'e000'0000) == 0xffff'ffff'c000'0000)
- extended = false; // sseg
- else
- return ERROR; // exception
- else
- extended = false; // suseg
- }
- break;
-
- case SR_KSU_U | SR_KSU_S:
- fatalerror("invalid ksu bits 0x%08x (%s)\n", u32(SR), machine().describe_context().c_str());
- break;
-
- default:
- // kernel mode
- if (SR & SR_KX)
- {
- // 64-bit kernel mode
- if (address & 0xffff'ff00'0000'0000)
- if ((address & 0xffff'ff00'0000'0000) == 0x4000'0000'0000'0000)
- extended = true; // xksseg
- else
- if ((address & 0xc000'0000'0000'0000) == 0x8000'0000'0000'0000)
- {
- address &= 0x0000'000f'ffff'ffff; // xkphys
-
- // FIXME: caching depends on top three bits
- return CACHED;
- }
- else
- if ((address & 0xffff'ff00'0000'0000) == 0xc000'0000'0000'0000)
- if ((address & 0x0000'00ff'8000'0000) == 0x0000'00ff'8000'0000)
- return ERROR; // exception
- else
- extended = true; // xkseg
- else
- // FIXME: ckseg0 caching depends on config regiter
- switch (address & 0xffff'ffff'e000'0000)
- {
- case 0xffff'ffff'8000'0000: address &= 0x7fff'ffff; return CACHED; // ckseg0
- case 0xffff'ffff'a000'0000: address &= 0x1fff'ffff; return UNCACHED; // ckseg1
- case 0xffff'ffff'c000'0000: extended = true; break; // cksseg
- case 0xffff'ffff'e000'0000: extended = true; break; // ckseg3
- default: return ERROR; // exception
- }
- else
- if (SR & SR_ERL)
- // FIXME: documentation says 2^31, but assume it should be 2^40
- return UNCACHED; // xkuseg (unmapped, uncached)
- else
- extended = true; // xkuseg
- }
- else
- {
- // 32-bit kernel mode
- if (address & 0xffff'ffff'8000'0000)
- switch (address & 0xffff'ffff'e000'0000)
- {
- case 0xffff'ffff'8000'0000: address &= 0x7fff'ffff; return CACHED; // kseg0
- case 0xffff'ffff'a000'0000: address &= 0x1fff'ffff; return UNCACHED; // kseg1
- case 0xffff'ffff'c000'0000: extended = false; break; // ksseg
- case 0xffff'ffff'e000'0000: extended = false; break; // kseg3
- default: return ERROR; // exception
- }
- else
- if (SR & SR_ERL)
- return UNCACHED; // kuseg (unmapped, uncached)
- else
- extended = false; // kuseg
- }
- break;
- }
-
- // address needs translation, using a combination of VPN2 and ASID
- u64 const key = (address & (extended ? (EH_R | EH_VPN2_64) : EH_VPN2_32)) | (m_cp0[CP0_EntryHi] & EH_ASID);
-
- unsigned *mru = m_tlb_mru[intention & TRANSLATE_TYPE_MASK];
- if (LOG_STATS)
- m_tlb_scans++;
-
- bool invalid = false;
- bool modify = false;
- for (unsigned i = 0; i < ARRAY_LENGTH(m_tlb); i++)
- {
- unsigned const index = mru[i];
- tlb_entry_t const &entry = m_tlb[index];
-
- // test vpn and asid
- u64 const mask = (extended ? EH_R | (EH_VPN2_64 & ~entry.mask) : (EH_VPN2_32 & ~entry.mask))
- | ((entry.vpn & EH_G) ? 0 : EH_ASID);
-
- if ((entry.vpn & mask) != (key & mask))
- continue;
-
- if (LOG_STATS)
- m_tlb_loops += i + 1;
-
- u64 const pfn = entry.pfn[BIT(address, entry.low_bit)];
-
- // test valid
- if (!(pfn & EL_V))
- {
- invalid = true;
- break;
- }
-
- // test dirty
- if ((intention & TRANSLATE_WRITE) && !(pfn & EL_D))
- {
- modify = true;
- break;
- }
-
- // translate the address
- address &= (entry.mask >> 1) | 0xfff;
- address |= ((pfn & EL_PFN) << 6) & ~(entry.mask >> 1);
-
- // promote the entry in the mru index
- if (i > 0)
- std::swap(mru[i - 1], mru[i]);
-
- return ((pfn & EL_C) == C_2) ? UNCACHED : CACHED;
- }
-
- // tlb miss, invalid entry, or a store to a non-dirty entry
- if (!machine().side_effects_disabled() && !(intention & TRANSLATE_DEBUG_MASK))
- {
- if (VERBOSE & LOG_TLB)
- {
- char const mode[] = { 'r', 'w', 'x' };
-
- if (modify)
- LOGMASKED(LOG_TLB, "tlb modify asid %d address 0x%016x (%s)\n",
- m_cp0[CP0_EntryHi] & EH_ASID, address, machine().describe_context());
- else
- LOGMASKED(LOG_TLB, "tlb miss %c asid %d address 0x%016x (%s)\n",
- mode[intention & TRANSLATE_TYPE_MASK], m_cp0[CP0_EntryHi] & EH_ASID, address, machine().describe_context());
- }
-
- // load tlb exception registers
- m_cp0[CP0_BadVAddr] = address;
- m_cp0[CP0_EntryHi] = key;
- m_cp0[CP0_Context] = (m_cp0[CP0_Context] & CONTEXT_PTEBASE) | ((address >> 9) & CONTEXT_BADVPN2);
- m_cp0[CP0_XContext] = (m_cp0[CP0_XContext] & XCONTEXT_PTEBASE) | ((address >> 31) & XCONTEXT_R) | ((address >> 9) & XCONTEXT_BADVPN2);
-
- if (invalid || modify || (SR & SR_EXL))
- cpu_exception(modify ? EXCEPTION_MOD : (intention & TRANSLATE_WRITE) ? EXCEPTION_TLBS : EXCEPTION_TLBL);
- else
- cpu_exception((intention & TRANSLATE_WRITE) ? EXCEPTION_TLBS : EXCEPTION_TLBL, extended ? 0x000 : 0x080);
- }
-
- return MISS;
-}
-
-void r4000_base_device::address_error(int intention, u64 const address)
-{
- if (!machine().side_effects_disabled() && !(intention & TRANSLATE_DEBUG_MASK))
- {
- logerror("address_error 0x%016x (%s)\n", address, machine().describe_context());
-
- // TODO: check this
- if (!(SR & SR_EXL))
- m_cp0[CP0_BadVAddr] = address;
-
- cpu_exception((intention & TRANSLATE_WRITE) ? EXCEPTION_ADES : EXCEPTION_ADEL);
-
- // address errors shouldn't typically occur, so a breakpoint is handy
- machine().debug_break();
- }
-}
-
-template <typename T, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(T)>>::value, bool> r4000_base_device::load(u64 address, U &&apply)
-{
- // alignment error
- if (address & (sizeof(T) - 1))
- {
- address_error(TRANSLATE_READ, address);
- return false;
- }
-
- translate_t const t = translate(TRANSLATE_READ, address);
-
- // address error
- if (t == ERROR)
- {
- address_error(TRANSLATE_READ, address);
-
- return false;
- }
-
- // tlb miss
- if (t == MISS)
- return false;
-
- // watchpoint
- if ((m_cp0[CP0_WatchLo] & WATCHLO_R) && !(SR & SR_EXL))
- {
- u64 const watch_address = ((m_cp0[CP0_WatchHi] & WATCHHI_PADDR1) << 32) | (m_cp0[CP0_WatchLo] & WATCHLO_PADDR0);
-
- if ((address & ~7) == watch_address)
- {
- cpu_exception(EXCEPTION_WATCH);
- return false;
- }
- }
-
- // TODO: cache lookup
-
- switch (sizeof(T))
- {
- case 1: apply(T(space(0).read_byte(address))); break;
- case 2: apply(T(space(0).read_word(address))); break;
- case 4: apply(T(space(0).read_dword(address))); break;
- case 8: apply(T(space(0).read_qword(address))); break;
- }
-
- return true;
-}
-
-template <typename T, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(u64, T)>>::value, bool> r4000_base_device::load_linked(u64 address, U &&apply)
-{
- // alignment error
- if (address & (sizeof(T) - 1))
- {
- address_error(TRANSLATE_READ, address);
- return false;
- }
-
- translate_t const t = translate(TRANSLATE_READ, address);
-
- // address error
- if (t == ERROR)
- {
- address_error(TRANSLATE_READ, address);
- return false;
- }
-
- // tlb miss
- if (t == MISS)
- return false;
-
- // watchpoint
- if ((m_cp0[CP0_WatchLo] & WATCHLO_R) && !(SR & SR_EXL))
- {
- u64 const watch_address = ((m_cp0[CP0_WatchHi] & WATCHHI_PADDR1) << 32) | (m_cp0[CP0_WatchLo] & WATCHLO_PADDR0);
-
- if ((address & ~7) == watch_address)
- {
- cpu_exception(EXCEPTION_WATCH);
- return false;
- }
- }
-
- // TODO: cache lookup
-
- switch (sizeof(T))
- {
- case 4: apply(address, T(space(0).read_dword(address))); break;
- case 8: apply(address, T(space(0).read_qword(address))); break;
- }
-
- return true;
-}
-
-template <typename T, typename U> std::enable_if_t<std::is_convertible<U, T>::value, bool> r4000_base_device::store(u64 address, U data, T mem_mask)
-{
- // alignment error
- if (address & (sizeof(T) - 1))
- {
- address_error(TRANSLATE_READ, address);
- return false;
- }
-
- translate_t const t = translate(TRANSLATE_WRITE, address);
-
- // address error
- if (t == ERROR)
- {
- address_error(TRANSLATE_WRITE, address);
- return false;
- }
-
- // tlb miss
- if (t == MISS)
- return false;
-
- // watchpoint
- if ((m_cp0[CP0_WatchLo] & WATCHLO_W) && !(SR & SR_EXL))
- {
- u64 const watch_address = ((m_cp0[CP0_WatchHi] & WATCHHI_PADDR1) << 32) | (m_cp0[CP0_WatchLo] & WATCHLO_PADDR0);
-
- if ((address & ~7) == watch_address)
- {
- cpu_exception(EXCEPTION_WATCH);
- return false;
- }
- }
-
- // TODO: cache lookup
-
- switch (sizeof(T))
- {
- case 1: space(0).write_byte(address, T(data)); break;
- case 2: space(0).write_word(address, T(data), mem_mask); break;
- case 4: space(0).write_dword(address, T(data), mem_mask); break;
- case 8: space(0).write_qword(address, T(data), mem_mask); break;
- }
-
- return true;
-}
-
-bool r4000_base_device::fetch(u64 address, std::function<void(u32)> &&apply)
-{
- u64 const program_address = address;
-
- // alignment error
- if (address & 3)
- {
- address_error(TRANSLATE_FETCH, address);
-
- return false;
- }
-
- translate_t const t = translate(TRANSLATE_FETCH, address);
-
- // address error
- if (t == ERROR)
- {
- address_error(TRANSLATE_FETCH, address);
-
- return false;
- }
-
- // tlb miss
- if (t == MISS)
- return false;
-
- if (ICACHE)
- {
- if (t == UNCACHED)
- {
- apply(space(0).read_dword(address));
-
- return true;
- }
-
- // look up the tag
- u32 const cache_address = (program_address & m_icache_mask_hi);
- u32 &tag = m_icache_tag[cache_address >> m_icache_shift];
-
- // check for cache miss
- if (!(tag & ICACHE_V) || (tag & ICACHE_PTAG) != (address >> 12))
- {
- // cache miss
- m_icache_misses++;
-
- // reload the cache line
- tag = ICACHE_V | (address >> 12);
- for (unsigned i = 0; i < m_icache_line_size; i += 8)
- {
- u64 const data = space(0).read_qword((address & m_icache_mask_lo) | i);
-
- m_icache_data[(((cache_address & m_icache_mask_lo) | i) >> 2) + 0] = u32(data);
- m_icache_data[(((cache_address & m_icache_mask_lo) | i) >> 2) + 1] = data >> 32;
- }
- }
- else
- m_icache_hits++;
-
- // apply the result
- apply(m_icache_data[cache_address >> 2]);
- }
- else
- apply(space(0).read_dword(address));
-
- return true;
-}
-
-std::string r4000_base_device::debug_string(u64 string_pointer, unsigned limit)
-{
- auto const suppressor(machine().disable_side_effects());
-
- bool done = false;
- bool mapped = false;
- std::string result("");
-
- while (!done)
- {
- done = true;
- load<u8>(string_pointer++, [limit, &done, &mapped, &result](u8 byte)
- {
- mapped = true;
- if (byte != 0)
- {
- result += byte;
-
- done = result.length() == limit;
- }
- });
- }
-
- if (!mapped)
- result.assign("[unmapped]");
-
- return result;
-}
-
-std::string r4000_base_device::debug_string_array(u64 array_pointer)
-{
- auto const suppressor(machine().disable_side_effects());
-
- bool done = false;
- std::string result("");
-
- while (!done)
- {
- done = true;
- load<s32>(array_pointer, [this, &done, &result](u64 string_pointer)
- {
- if (string_pointer != 0)
- {
- if (!result.empty())
- result += ", ";
-
- result += '\"' + debug_string(string_pointer) + '\"';
-
- done = false;
- }
- });
-
- array_pointer += 4;
- }
-
- return result;
-}
-
-std::string r4000_base_device::debug_unicode_string(u64 unicode_string_pointer)
-{
- auto const suppressor(machine().disable_side_effects());
-
- std::wstring result(L"");
-
- if (!load<u16>(unicode_string_pointer,
- [this, unicode_string_pointer, &result](u16 const length)
- {
- if (length)
- if (!load<u32>(unicode_string_pointer + 4,
- [this, length, &result](s32 buffer)
- {
- for (int i = 0; i < length; i += 2)
- load<u16>(buffer + i, [&result](wchar_t const character) { result += character; });
- }))
- result.assign(L"[unmapped]");
- }))
- result.assign(L"[unmapped]");
-
- return utf8_from_wstring(result);
-}
diff --git a/src/devices/cpu/mips/r4000.h b/src/devices/cpu/mips/r4000.h
deleted file mode 100644
index 8c3a1760ba3..00000000000
--- a/src/devices/cpu/mips/r4000.h
+++ /dev/null
@@ -1,463 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Patrick Mackinlay
-
-#ifndef MAME_CPU_MIPS_R4000_H
-#define MAME_CPU_MIPS_R4000_H
-
-#pragma once
-
-DECLARE_DEVICE_TYPE(R4000, r4000_device)
-DECLARE_DEVICE_TYPE(R4400, r4400_device)
-DECLARE_DEVICE_TYPE(R4600, r4600_device)
-
-class r4000_base_device : public cpu_device
-{
-public:
- enum config_mask : u32
- {
- CONFIG_K0 = 0x00000007, // kseg0 cache coherency
- CONFIG_CU = 0x00000080, // store conditional cache coherent
- CONFIG_DB = 0x00000010, // primary d-cache line 32 bytes
- CONFIG_IB = 0x00000020, // primary i-cache line 32 bytes
- CONFIG_DC = 0x000001c0, // primary d-cache size
- CONFIG_IC = 0x00000e00, // primary i-cache size
- CONFIG_EB = 0x00002000, // sub-block ordering
- CONFIG_EM = 0x00004000, // parity mode enable
- CONFIG_BE = 0x00008000, // big endian
- CONFIG_SM = 0x00010000, // dirty shared disable
- CONFIG_SC = 0x00020000, // secondary cache absent
- CONFIG_EW = 0x000c0000, // system port width
- CONFIG_SW = 0x00100000, // secondary cache port width
- CONFIG_SS = 0x00200000, // split secondary cache mode
- CONFIG_SB = 0x00c00000, // secondary cache line size
- CONFIG_EP = 0x0f000000, // transmit data pattern
- CONFIG_EC = 0x70000000, // system clock ratio
- CONFIG_CM = 0x80000000, // master/checker enable
-
- CONFIG_WM = 0x0000003f, // runtime-writable bits
- };
- void set_config(u32 data, u32 mem_mask = ~u32(0))
- {
- if (!configured())
- COMBINE_DATA(&m_cp0[CP0_Config]);
- }
-
-protected:
- enum cache_size_t
- {
- CACHE_4K = 0,
- CACHE_8K = 1,
- CACHE_16K = 2,
- CACHE_32K = 3,
- CACHE_64K = 4,
- CACHE_128K = 5,
- CACHE_256K = 6,
- CACHE_512K = 7,
- };
- r4000_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 prid, cache_size_t icache_size, cache_size_t dcache_size);
-
- enum cp0_reg : int
- {
- CP0_Index = 0,
- CP0_Random = 1,
- CP0_EntryLo0 = 2,
- CP0_EntryLo1 = 3,
- CP0_Context = 4,
- CP0_PageMask = 5,
- CP0_Wired = 6,
- CP0_BadVAddr = 8,
- CP0_Count = 9,
- CP0_EntryHi = 10,
- CP0_Compare = 11,
- CP0_Status = 12,
- CP0_Cause = 13,
- CP0_EPC = 14,
- CP0_PRId = 15,
- CP0_Config = 16,
- CP0_LLAddr = 17,
- CP0_WatchLo = 18,
- CP0_WatchHi = 19,
- CP0_XContext = 20,
- CP0_ECC = 26,
- CP0_CacheErr = 27,
- CP0_TagLo = 28,
- CP0_TagHi = 29,
- CP0_ErrorEPC = 30,
- };
-
- enum cp0_sr_mask : u32
- {
- SR_IE = 0x00000001, // interrupt enable
- SR_EXL = 0x00000002, // exception level
- SR_ERL = 0x00000004, // error level
- SR_KSU = 0x00000018, // kernel/supervisor/user mode
- SR_UX = 0x00000020, // 64-bit addressing user mode
- SR_SX = 0x00000040, // 64-bit addressing supervisor mode
- SR_KX = 0x00000080, // 64-bit addressing kernel mode
- SR_IMSW0 = 0x00000100, // software interrupt 0 enable
- SR_IMSW1 = 0x00000200, // software interrupt 1 enable
- SR_IMEX0 = 0x00000400, // external interrupt 0 enable
- SR_IMEX1 = 0x00000800, // external interrupt 1 enable
- SR_IMEX2 = 0x00001000, // external interrupt 2 enable
- SR_IMEX3 = 0x00002000, // external interrupt 3 enable
- SR_IMEX4 = 0x00004000, // external interrupt 4 enable
- SR_IMEX5 = 0x00008000, // external interrupt 5 enable
- SR_DE = 0x00010000, // disable cache parity/ecc exceptions
- SR_CE = 0x00020000, // cache ecc check enable
- SR_CH = 0x00040000, // cache hit
- SR_SR = 0x00100000, // soft reset
- SR_TS = 0x00200000, // tlb shutdown (read only)
- SR_BEV = 0x00400000, // bootstrap exception vectors
- SR_RE = 0x02000000, // reverse endian
- SR_FR = 0x04000000, // enable additional floating-point registers
- SU_RP = 0x08000000, // reduced power
- SR_CU0 = 0x10000000, // coprocessor usable 0
- SR_CU1 = 0x20000000, // coprocessor usable 1
- SR_CU2 = 0x40000000, // coprocessor usable 2
- SR_CU3 = 0x80000000, // coprocessor usable 3
-
- SR_IMSW = 0x00000300,
- SR_IM = 0x0000ff00, // interrupt mask
- SR_DS = 0x01ff0000, // diagnostic status
- };
-
- enum cp0_sr_ksu_mode : u32
- {
- SR_KSU_K = 0x00000000, // kernel mode
- SR_KSU_S = 0x00000008, // supervisor mode
- SR_KSU_U = 0x00000010, // user mode
- };
-
- enum cp0_cause_mask : u32
- {
- CAUSE_EXCCODE = 0x0000007c, // exception code
- CAUSE_IPSW0 = 0x00000100, // software interrupt 0 pending
- CAUSE_IPSW1 = 0x00000200, // software interrupt 1 pending
- CAUSE_IPEX0 = 0x00000400, // external interrupt 0 pending
- CAUSE_IPEX1 = 0x00000800, // external interrupt 1 pending
- CAUSE_IPEX2 = 0x00001000, // external interrupt 2 pending
- CAUSE_IPEX3 = 0x00002000, // external interrupt 3 pending
- CAUSE_IPEX4 = 0x00004000, // external interrupt 4 pending
- CAUSE_IPEX5 = 0x00008000, // external interrupt 5 pending
- CAUSE_CE = 0x30000000, // coprocessor unit
- CAUSE_BD = 0x80000000, // branch delay slot
-
- CAUSE_IPSW = 0x00000300,
- CAUSE_IPHW = 0x0000fc00,
- CAUSE_IP = 0x0000ff00,
- };
-
- enum cp0_watchlo_mask : u32
- {
- WATCHLO_W = 0x00000001, // trap on store
- WATCHLO_R = 0x00000002, // trap on load
- WATCHLO_PADDR0 = 0xfffffff8, // physical address bits 31:3
- };
- enum cp0_watchhi_mask : u32
- {
- WATCHHI_PADDR1 = 0x0000000f, // physical address bits 35:32
- };
-
- enum cp0_tlb_mask : u64
- {
- TLB_MASK = 0x0000'0000'01ff'e000,
- };
- enum cp0_tlb_eh : u64
- {
- EH_ASID = 0x0000'0000'0000'00ff, // address space id
- EH_G = 0x0000'0000'0000'1000, // global (tlb only)
- EH_VPN2_32 = 0x0000'0000'ffff'e000, // virtual page number (32-bit mode)
- EH_VPN2_64 = 0x0000'00ff'ffff'e000, // virtual page number (64-bit mode)
- EH_R = 0xc000'0000'0000'0000, // region (64-bit mode)
- };
- enum cp0_tlb_el : u64
- {
- EL_G = 0x0000'0000'0000'0001, // global (entrylo only)
- EL_V = 0x0000'0000'0000'0002, // valid
- EL_D = 0x0000'0000'0000'0004, // dirty
- EL_C = 0x0000'0000'0000'0038, // coherency
- EL_PFN = 0x0000'0000'3fff'ffc0, // page frame number
- };
- enum cp0_tlb_el_c : u64
- {
- C_0 = 0x00, // reserved
- C_1 = 0x08, // reserved
- C_2 = 0x10, // uncached
- C_3 = 0x18, // cacheable noncoherent (noncoherent)
- C_4 = 0x20, // cacheable coherent exclusive (exclusive)
- C_5 = 0x28, // cacheable coherent exclusive on write (sharable)
- C_6 = 0x30, // cacheable coherent update on write (update)
- C_7 = 0x38, // reserved
- };
-
- enum cp0_context_mask : u64
- {
- CONTEXT_PTEBASE = 0xffff'ffff'ff80'0000,
- CONTEXT_BADVPN2 = 0x0000'0000'007f'fff0,
- };
-
- enum cp0_xcontext_mask : u64
- {
- XCONTEXT_PTEBASE = 0xffff'fffe'0000'0000, // page table entry base
- XCONTEXT_R = 0x0000'0001'8000'0000, // region
- XCONTEXT_BADVPN2 = 0x0000'0000'7fff'fff0, // bad virtual page number / 2
- };
-
- enum cp0_pagemask_mask : u32
- {
- PAGEMASK = 0x01ff'e000,
- };
-
- enum exception_mask : u32
- {
- EXCEPTION_INT = 0x00000000, // interrupt
- EXCEPTION_MOD = 0x00000004, // tlb modification
- EXCEPTION_TLBL = 0x00000008, // tlb load
- EXCEPTION_TLBS = 0x0000000c, // tlb store
- EXCEPTION_ADEL = 0x00000010, // address error load
- EXCEPTION_ADES = 0x00000014, // address error store
- EXCEPTION_IBE = 0x00000018, // bus error (instruction fetch)
- EXCEPTION_DBE = 0x0000001c, // bus error (data reference: load or store)
- EXCEPTION_SYS = 0x00000020, // syscall
- EXCEPTION_BP = 0x00000024, // breakpoint
- EXCEPTION_RI = 0x00000028, // reserved instruction
- EXCEPTION_CPU = 0x0000002c, // coprocessor unusable
- EXCEPTION_OV = 0x00000030, // arithmetic overflow
- EXCEPTION_TR = 0x00000034, // trap
- EXCEPTION_VCEI = 0x00000038, // virtual coherency exception instruction
- EXCEPTION_FPE = 0x0000003c, // floating point
- EXCEPTION_WATCH = 0x0000005c, // reference to watchhi/watchlo address
- EXCEPTION_VCED = 0x0000007c, // virtual coherency exception data
-
- EXCEPTION_CP0 = 0x0000002c, // coprocessor 0 unusable
- EXCEPTION_CP1 = 0x1000002c, // coprocessor 1 unusable
- EXCEPTION_CP2 = 0x2000002c, // coprocessor 2 unusable
- EXCEPTION_CP3 = 0x3000002c, // coprocessor 3 unusable
- };
-
- enum cp1_fcr31_mask : u32
- {
- FCR31_RM = 0x00000003, // rounding mode
-
- FCR31_FI = 0x00000004, // inexact operation flag
- FCR31_FU = 0x00000008, // underflow flag
- FCR31_FO = 0x00000010, // overflow flag
- FCR31_FZ = 0x00000020, // divide by zero flag
- FCR31_FV = 0x00000040, // invalid operation flag
-
- FCR31_EI = 0x00000080, // inexact operation enable
- FCR31_EU = 0x00000100, // underflow enable
- FCR31_EO = 0x00000200, // overflow enable
- FCR31_EZ = 0x00000400, // divide by zero enable
- FCR31_EV = 0x00000800, // invalid operation enable
-
- FCR31_CI = 0x00001000, // inexact operation cause
- FCR31_CU = 0x00002000, // underflow cause
- FCR31_CO = 0x00004000, // overflow cause
- FCR31_CZ = 0x00008000, // divide by zero cause
- FCR31_CV = 0x00010000, // invalid operation cause
- FCR31_CE = 0x00020000, // unimplemented operation cause
-
- FCR31_C = 0x00800000, // condition
- FCR31_FS = 0x01000000, // flush denormalized results
-
- FCR31_FM = 0x0000007c, // flag mask
- FCR31_EM = 0x00000f80, // enable mask
- FCR31_CM = 0x0001f000, // cause mask (except unimplemented)
- };
-
- enum mips3_registers : unsigned
- {
- MIPS3_R0 = 0,
- MIPS3_CP0 = 32,
- MIPS3_F0 = 64,
-
- MIPS3_PC = 96,
- MIPS3_HI,
- MIPS3_LO,
- MIPS3_FCR30,
- MIPS3_FCR31,
- };
-
- enum cp0_taglo_mask : u32
- {
- TAGLO_PTAGLO = 0xffffff00, // physical adddress bits 35:12
- TAGLO_PSTATE = 0x000000c0, // primary cache state
- TAGLO_P = 0x00000001, // primary tag even parity
- };
- enum icache_mask : u32
- {
- ICACHE_PTAG = 0x00ffffff, // physical tag
- ICACHE_V = 0x01000000, // valid
- ICACHE_P = 0x02000000, // even parity
- };
- enum dcache_mask : u32
- {
- DCACHE_PTAG = 0x00ffffff, // physical tag
- DCACHE_CS = 0x01000000, // primary cache state
- DCACHE_P = 0x02000000, // even parity for ptag and cs
- DCACHE_W = 0x02000000, // write-back
- DCACHE_WP = 0x02000000, // even parity for write-back
- };
-
- // device_t overrides
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_stop() override;
-
- // device_memory_interface overrides
- virtual space_config_vector memory_space_config() const override;
- virtual bool memory_translate(int spacenum, int intention, offs_t &address) override;
-
- // device_disasm_interface overrides
- virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
-
- // device_execute_interface overrides
- virtual u32 execute_min_cycles() const override { return 1; }
- virtual u32 execute_max_cycles() const override { return 40; }
- virtual u32 execute_input_lines() const override { return 6; }
- virtual void execute_run() override;
- virtual void execute_set_input(int inputnum, int state) override;
-
- // cpu implementation
- void cpu_execute(u32 const op);
- void cpu_exception(u32 exception, u16 const vector = 0x180);
- void cpu_lwl(u32 const op);
- void cpu_lwr(u32 const op);
- void cpu_ldl(u32 const op);
- void cpu_ldr(u32 const op);
- void cpu_swl(u32 const op);
- void cpu_swr(u32 const op);
- void cpu_sdl(u32 const op);
- void cpu_sdr(u32 const op);
-
- // cp0 implementation
- void cp0_execute(u32 const op);
- u64 cp0_get(unsigned const reg);
- void cp0_set(unsigned const reg, u64 const data);
- void cp0_tlbr();
- void cp0_tlbwi(u8 const index);
- void cp0_tlbwr();
- void cp0_tlbp();
-
- // cp0 helpers
- TIMER_CALLBACK_MEMBER(cp0_timer_callback);
- void cp0_update_timer(bool start = false);
- bool cp0_64() const;
-
- // cp1 implementation
- void cp1_execute(u32 const op);
- void cp1_set(unsigned const reg, u64 const data);
-
- // cp2 implementation
- void cp2_execute(u32 const op);
-
- // address and memory handling
- enum translate_t { ERROR, MISS, UNCACHED, CACHED };
- translate_t translate(int intention, u64 &address);
- void address_error(int intention, u64 const address);
-
- template <typename T, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(T)>>::value, bool> load(u64 program_address, U &&apply);
- template <typename T, typename U> std::enable_if_t<std::is_convertible<U, std::function<void(u64, T)>>::value, bool> load_linked(u64 program_address, U &&apply);
- template <typename T, typename U> std::enable_if_t<std::is_convertible<U, T>::value, bool> store(u64 program_address, U data, T mem_mask = ~T(0));
- bool fetch(u64 address, std::function<void(u32)> &&apply);
-
- // debugging helpers
- std::string debug_string(u64 string_pointer, unsigned limit = 0);
- std::string debug_string_array(u64 array_pointer);
- std::string debug_unicode_string(u64 unicode_string_pointer);
-
- // device configuration state
- address_space_config m_program_config_le;
- address_space_config m_program_config_be;
-
- // runtime state
- int m_icount;
-
- // cpu state
- u64 m_pc;
- u64 m_r[32];
- u64 m_hi;
- u64 m_lo;
- enum branch_state_t : unsigned
- {
- NONE = 0,
- DELAY = 1, // delay slot instruction active
- BRANCH = 2, // branch instruction active
- EXCEPTION = 3, // exception triggered
- NULLIFY = 4, // next instruction nullified
- }
- m_branch_state;
- u64 m_branch_target;
-
- // cp0 state
- u64 m_cp0[32];
- u64 m_cp0_timer_zero;
- emu_timer *m_cp0_timer;
- memory_passthrough_handler *m_ll_watch;
- struct tlb_entry_t
- {
- u64 mask;
- u64 vpn;
- u64 pfn[2];
-
- unsigned low_bit;
- }
- m_tlb[48];
- unsigned m_tlb_mru[3][48];
-
- // cp1 state
- u64 m_f[32]; // floating point registers
- u32 m_fcr0; // implementation and revision register
- u32 m_fcr30; // unknown
- u32 m_fcr31; // control/status register
-
- // experimental icache state
- u32 m_icache_mask_hi;
- u32 m_icache_mask_lo;
- unsigned m_icache_line_size;
- unsigned m_icache_shift;
- std::unique_ptr<u32[]> m_icache_tag;
- std::unique_ptr<u32[]> m_icache_data;
-
- // statistics
- u64 m_tlb_scans;
- u64 m_tlb_loops;
- u64 m_icache_hits;
- u64 m_icache_misses;
-};
-
-class r4000_device : public r4000_base_device
-{
-public:
- // NOTE: R4000 chips prior to 3.0 have an xtlb bug
- r4000_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : r4000_base_device(mconfig, R4000, tag, owner, clock, 0x0430, CACHE_8K, CACHE_8K)
- {
- // no secondary cache
- m_cp0[CP0_Config] |= CONFIG_SC;
- }
-};
-
-class r4400_device : public r4000_base_device
-{
-public:
- r4400_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : r4000_base_device(mconfig, R4400, tag, owner, clock, 0x0440, CACHE_16K, CACHE_16K)
- {
- // no secondary cache
- m_cp0[CP0_Config] |= CONFIG_SC;
- }
-};
-
-class r4600_device : public r4000_base_device
-{
-public:
- r4600_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : r4000_base_device(mconfig, R4600, tag, owner, clock, 0x2000, CACHE_16K, CACHE_16K)
- {
- // no secondary cache
- m_cp0[CP0_Config] |= CONFIG_SC;
- }
-};
-#endif // MAME_CPU_MIPS_R4000_H
diff --git a/src/devices/cpu/nec/v5x.cpp b/src/devices/cpu/nec/v5x.cpp
index bed8b42bc73..533a112a7a4 100644
--- a/src/devices/cpu/nec/v5x.cpp
+++ b/src/devices/cpu/nec/v5x.cpp
@@ -199,8 +199,8 @@ void v53_device::install_peripheral_io()
}
else // uPD71071 mode
space(AS_IO).install_readwrite_handler(base + 0x00, base + 0x0f,
- read8sm_delegate(FUNC(v5x_dmau_device::read), m_dmau.target()),
- write8sm_delegate(FUNC(v5x_dmau_device::write), m_dmau.target()), 0xffff);
+ read8_delegate(FUNC(v5x_dmau_device::read), m_dmau.target()),
+ write8_delegate(FUNC(v5x_dmau_device::write), m_dmau.target()), 0xffff);
}
if (m_OPSEL & OPSEL_IS)
@@ -264,8 +264,8 @@ void v50_device::install_peripheral_io()
u16 const base = ((m_OPHA << 8) | m_DULA) & 0xfffe;
space(AS_IO).install_readwrite_handler(base + 0x00, base + 0x0f,
- read8sm_delegate(FUNC(v5x_dmau_device::read), m_dmau.target()),
- write8sm_delegate(FUNC(v5x_dmau_device::write), m_dmau.target()), 0xffff);
+ read8_delegate(FUNC(v5x_dmau_device::read), m_dmau.target()),
+ write8_delegate(FUNC(v5x_dmau_device::write), m_dmau.target()), 0xffff);
}
if (m_OPSEL & OPSEL_IS)
diff --git a/src/devices/cpu/ns32000/ns32000.cpp b/src/devices/cpu/ns32000/ns32000.cpp
deleted file mode 100644
index 6bf23e28289..00000000000
--- a/src/devices/cpu/ns32000/ns32000.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/*****************************************************************************
-*
-* ns32000.cpp
-*
-* NS32000 CPU family
-*
-*****************************************************************************/
-
-#include "emu.h"
-#include "ns32000.h"
-#include "ns32000dasm.h"
-#include "debugger.h"
-
-//**************************************************************************
-// DEVICE INTERFACE
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(NS32008, ns32008_cpu_device, "ns32008", "National Semiconductor NS32008")
-DEFINE_DEVICE_TYPE(NS32016, ns32016_cpu_device, "ns32016", "National Semiconductor NS32016")
-DEFINE_DEVICE_TYPE(NS32032, ns32032_cpu_device, "ns32032", "National Semiconductor NS32032")
-
-
-//-------------------------------------------------
-// ns32000_cpu_device - constructor
-//-------------------------------------------------
-
-ns32000_cpu_device::ns32000_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int databits, int addrbits)
- : cpu_device(mconfig, type, tag, owner, clock)
- , m_program_config("program", ENDIANNESS_LITTLE, databits, addrbits, 0)
- , m_icount(0)
-{
-}
-
-ns32008_cpu_device::ns32008_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : ns32000_cpu_device(mconfig, NS32008, tag, owner, clock, 8, 24)
-{
-}
-
-ns32016_cpu_device::ns32016_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : ns32000_cpu_device(mconfig, NS32016, tag, owner, clock, 16, 24)
-{
-}
-
-ns32032_cpu_device::ns32032_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : ns32000_cpu_device(mconfig, NS32032, tag, owner, clock, 32, 24)
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void ns32000_cpu_device::device_start()
-{
- set_icountptr(m_icount);
-
- save_item(NAME(m_pc));
- save_item(NAME(m_r));
- save_item(NAME(m_f));
-
- state_add(STATE_GENPC, "GENPC", m_pc).noshow();
- state_add(STATE_GENPCBASE, "CURPC", m_pc).noshow();
-
- // dedicated registers
- state_add(NS32000_PC, "PC", m_pc);
- state_add(NS32000_SB, "SB", m_sb);
- state_add(NS32000_FP, "FP", m_fp);
- state_add(NS32000_SP1, "SP1", m_sp1);
- state_add(NS32000_SP0, "SP0", m_sp0);
- state_add(NS32000_INTBASE, "INTBASE", m_intbase);
- state_add(NS32000_PSR, "PSR", m_psr);
- state_add(NS32000_MOD, "MOD", m_mod);
-
- // general registers
- for (unsigned i = 0; i < 8; i++)
- state_add(NS32000_R0 + i, util::string_format("R%d", i).c_str(), m_r[i]);
-
- // floating point registers
- //for (unsigned i = 0; i < 8; i++)
- // state_add(NS32000_R7 + i, util::string_format("F%d", i).c_str(), m_f[i]);
-
- // set our instruction counter
- //set_icountptr(m_icount);
-}
-
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void ns32000_cpu_device::device_reset()
-{
- m_nmi_line = false;
- m_irq_line = false;
-
- m_pc = 0;
-}
-
-//-------------------------------------------------
-// execute_run - execute a timeslice's worth of
-// opcodes
-//-------------------------------------------------
-
-void ns32000_cpu_device::execute_run()
-{
- while (m_icount > 0)
- {
- debugger_instruction_hook(m_pc);
-
- m_icount--;
- }
-}
-
-//-------------------------------------------------
-// execute_set_input - act on a changed input/
-// interrupt line
-//-------------------------------------------------
-
-void ns32000_cpu_device::execute_set_input(int inputnum, int state)
-{
- switch (inputnum)
- {
- case INPUT_LINE_NMI:
- // NMI is edge triggered
- m_nmi_line = m_nmi_line || (state == ASSERT_LINE);
- break;
-
- case INPUT_LINE_IRQ0:
- // IRQ is line triggered
- m_irq_line = state == ASSERT_LINE;
- break;
- }
-}
-
-//-------------------------------------------------
-// memory_space_config - return the configuration
-// of the specified address space, or nullptr if
-// the space doesn't exist
-//-------------------------------------------------
-
-device_memory_interface::space_config_vector ns32000_cpu_device::memory_space_config() const
-{
- return space_config_vector{ std::make_pair(AS_PROGRAM, &m_program_config) };
-}
-
-bool ns32000_cpu_device::memory_translate(int spacenum, int intention, offs_t &address)
-{
- return true;
-}
-
-//-------------------------------------------------
-// disassemble - call the disassembly
-// helper function
-//-------------------------------------------------
-
-std::unique_ptr<util::disasm_interface> ns32000_cpu_device::create_disassembler()
-{
- return std::make_unique<ns32000_disassembler>();
-}
diff --git a/src/devices/cpu/ns32000/ns32000.h b/src/devices/cpu/ns32000/ns32000.h
deleted file mode 100644
index 7b17cafba99..00000000000
--- a/src/devices/cpu/ns32000/ns32000.h
+++ /dev/null
@@ -1,149 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/*****************************************************************************
-*
-* ns32000.h
-*
-* NS32000 CPU family
-*
-*****************************************************************************/
-
-#ifndef MAME_CPU_NS32016_NS32016_H
-#define MAME_CPU_NS32016_NS32016_H
-
-#pragma once
-
-
-/***********************************************************************
- CONSTANTS
-***********************************************************************/
-
-
-
-/***********************************************************************
- TYPE DEFINITIONS
-***********************************************************************/
-
-class ns32000_cpu_device : public cpu_device
-{
-public:
- // construction/destruction
- ns32000_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
-
-protected:
- ns32000_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int databits, int addrbits);
-
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
- // device_execute_interface overrides
- virtual u32 execute_min_cycles() const override { return 1; }
- virtual u32 execute_max_cycles() const override { return 6; }
- virtual u32 execute_input_lines() const override { return 2; }
- virtual void execute_run() override;
- virtual void execute_set_input(int inputnum, int state) override;
- virtual bool execute_input_edge_triggered(int inputnum) const override { return inputnum == INPUT_LINE_NMI; }
-
-
- // device_memory_interface overrides
- virtual space_config_vector memory_space_config() const override;
- virtual bool memory_translate(int spacenum, int intention, offs_t &address) override;
-
- // device_disasm_interface overrides
- virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
-
- // addressing modes
- enum
- {
- ADDRESSING_MODE_REGISTER_0 = 0,
- ADDRESSING_MODE_REGISTER_1,
- ADDRESSING_MODE_REGISTER_2,
- ADDRESSING_MODE_REGISTER_3,
- ADDRESSING_MODE_REGISTER_4,
- ADDRESSING_MODE_REGISTER_5,
- ADDRESSING_MODE_REGISTER_6,
- ADDRESSING_MODE_REGISTER_7,
- ADDRESSING_MODE_REGISTER_0_RELATIVE,
- ADDRESSING_MODE_REGISTER_1_RELATIVE,
- ADDRESSING_MODE_REGISTER_2_RELATIVE,
- ADDRESSING_MODE_REGISTER_3_RELATIVE,
- ADDRESSING_MODE_REGISTER_4_RELATIVE,
- ADDRESSING_MODE_REGISTER_5_RELATIVE,
- ADDRESSING_MODE_REGISTER_6_RELATIVE,
- ADDRESSING_MODE_REGISTER_7_RELATIVE,
- ADDRESSING_MODE_FRAME_MEMORY_RELATIVE,
- ADDRESSING_MODE_STACK_MEMORY_RELATIVE,
- ADDRESSING_MODE_STATIC_MEMORY_RELATIVE,
- ADDRESSING_MODE_RESERVED,
- ADDRESSING_MODE_IMMEDIATE,
- ADDRESSING_MODE_ABSOLUTE,
- ADDRESSING_MODE_EXTERNAL,
- ADDRESSING_MODE_TOP_OF_STACK,
- ADDRESSING_MODE_FRAME_MEMORY,
- ADDRESSING_MODE_STACK_MEMORY,
- ADDRESSING_MODE_STATIC_MEMORY,
- ADDRESSING_MODE_PROGRAM_MEMORY,
- ADDRESSING_MODE_INDEX_BYTES,
- ADDRESSING_MODE_INDEX_WORDS,
- ADDRESSING_MODE_INDEX_DOUBLE_WORDS,
- ADDRESSING_MODE_INDEX_QUAD_WORDS,
- };
-
- // registers
- enum
- {
- NS32000_PC = 1,
- NS32000_SB, NS32000_FP, NS32000_SP1, NS32000_SP0, NS32000_INTBASE, NS32000_PSR, NS32000_MOD,
- NS32000_R0, NS32000_R1, NS32000_R2, NS32000_R3, NS32000_R4, NS32000_R5, NS32000_R6, NS32000_R7,
- };
-
-private:
- // configuration
- address_space_config m_program_config;
-
- // emulation state
- int m_icount;
-
- u32 m_pc;
- u32 m_sb;
- u32 m_fp;
- u32 m_sp1;
- u32 m_sp0;
- u32 m_intbase;
- u32 m_psr;
- u32 m_mod;
- u32 m_r[8];
- u32 m_f[8];
-
- u8 m_irq_line;
- u8 m_nmi_line;
-};
-
-class ns32008_cpu_device : public ns32000_cpu_device
-{
-public:
- ns32008_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-};
-
-class ns32016_cpu_device : public ns32000_cpu_device
-{
-public:
- ns32016_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-};
-
-class ns32032_cpu_device : public ns32000_cpu_device
-{
-public:
- ns32032_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-};
-
-/***********************************************************************
- DEVICE TYPE DECLARATIONS
-***********************************************************************/
-
-DECLARE_DEVICE_TYPE(NS32008, ns32008_cpu_device)
-DECLARE_DEVICE_TYPE(NS32016, ns32016_cpu_device)
-DECLARE_DEVICE_TYPE(NS32032, ns32032_cpu_device)
-
-#endif // MAME_CPU_NS32016_NS32016_H
diff --git a/src/devices/cpu/ns32000/ns32000dasm.cpp b/src/devices/cpu/ns32000/ns32000dasm.cpp
deleted file mode 100644
index 8bc25f48c60..00000000000
--- a/src/devices/cpu/ns32000/ns32000dasm.cpp
+++ /dev/null
@@ -1,835 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/*****************************************************************************
-*
-* ns32000dasm.cpp
-*
-* NS32000 CPU Disassembly
-*
-*****************************************************************************/
-
-#include "emu.h"
-#include "ns32000dasm.h"
-
-// instruction field extraction
-#define Format0cond(x) ((x >> 4) & 0x0f)
-
-#define Format1op(x) ((x >> 4) & 0x0f)
-
-#define Format2i(x) ((x >> 0) & 0x03)
-#define Format2op(x) ((x >> 4) & 0x07)
-#define Format2short(x) ((x >> 7) & 0x0f)
-#define Format2gen(x) ((x >> 11) & 0x1f)
-
-#define Format3i(x) ((x >> 0) & 0x03)
-#define Format3op(x) ((x >> 7) & 0x0f)
-#define Format3gen(x) ((x >> 11) & 0x1f)
-
-#define Format4i(x) ((x >> 0) & 0x03)
-#define Format4op(x) ((x >> 2) & 0x0f)
-#define Format4gen2(x) ((x >> 6) & 0x1f)
-#define Format4gen1(x) ((x >> 11) & 0x1f)
-
-#define Format5i(x) ((x >> 8) & 0x03)
-#define Format5op(x) ((x >> 10) & 0x07)
-#define Format5short(x) ((x >> 15) & 0x0f)
-
-#define Format6i(x) ((x >> 8) & 0x03)
-#define Format6op(x) ((x >> 10) & 0x0f)
-#define Format6gen2(x) ((x >> 14) & 0x1f)
-#define Format6gen1(x) ((x >> 19) & 0x1f)
-
-#define Format7i(x) ((x >> 8) & 0x03)
-#define Format7op(x) ((x >> 10) & 0x0f)
-#define Format7gen2(x) ((x >> 14) & 0x1f)
-#define Format7gen1(x) ((x >> 19) & 0x1f)
-
-#define Format8i(x) ((x >> 8) & 0x03)
-#define Format8op(x) (((x >> 8) & 0x04) | ((x >> 6) & 0x03))
-#define Format8reg(x) ((x >> 11) & 0x07)
-#define Format8gen2(x) ((x >> 14) & 0x1f)
-#define Format8gen1(x) ((x >> 19) & 0x1f)
-
-#define Format9i(x) ((x >> 8) & 0x03)
-#define Format9f(x) ((x >> 10) & 0x01)
-#define Format9op(x) ((x >> 11) & 0x07)
-#define Format9gen2(x) ((x >> 14) & 0x1f)
-#define Format9gen1(x) ((x >> 19) & 0x1f)
-
-#define Format11f(x) ((x >> 8) & 0x01)
-#define Format11op(x) ((x >> 10) & 0x0f)
-#define Format11gen2(x) ((x >> 14) & 0x1f)
-#define Format11gen1(x) ((x >> 19) & 0x1f)
-
-#define Format14i(x) ((x >> 8) & 0x01)
-#define Format14op(x) ((x >> 10) & 0x0f)
-#define Format14short(x) ((x >> 15) & 0x1f)
-#define Format14gen1(x) ((x >> 19) & 0x1f)
-
-// instructions
-const ns32000_disassembler::NS32000_OPCODE ns32000_disassembler::format0_op[1] =
-{
- { "Bcond", DISP, 0, 0, 0, 0 }
-};
-const ns32000_disassembler::NS32000_OPCODE ns32000_disassembler::format1_op[16] =
-{
- { "BSR", DISP, 0, 0, 0, STEP_OVER },
- { "RET", DISP, 0, 0, 0, STEP_OUT },
- { "CXP", DISP, 0, 0, 0, STEP_OVER },
- { "RXP", DISP, 0, 0, 0, STEP_OUT },
- { "RETT", 0, 0, 0, 0, STEP_OUT },
- { "RETI", DISP, 0, 0, 0, STEP_OUT },
- { "SAVE", IMM, 0, 0, 0, 0 },
- { "RESTORE", IMM, 0, 0, 0, 0 },
- { "ENTER", IMM, DISP, 0, 0, 0 },
- { "EXIT", IMM, 0, 0, 0, 0 },
- { "NOP", 0, 0, 0, 0, 0 },
- { "WAIT", 0, 0, 0, 0, 0 },
- { "DIA", 0, 0, 0, 0, 0 },
- { "FLAG", 0, 0, 0, 0, 0 },
- { "SVC", 0, 0, 0, 0, 0 },
- { "BPT", 0, 0, 0, 0, 0 },
-};
-const ns32000_disassembler::NS32000_OPCODE ns32000_disassembler::format2_op[8] =
-{
- { "ADDQi", QUICK, GEN | RMW | I, 0, 0, 0 },
- { "CMPQi", QUICK, GEN | READ | I, 0, 0, 0 },
- { "SPRi", SHORT, GEN | WRITE | I, 0, 0, 0 },
- { "Scondi", GEN | WRITE | I, 0, 0, 0, 0 },
- { "ACBi", QUICK, GEN | RMW | I, DISP, 0, 0 },
- { "MOVQi", QUICK, GEN | WRITE | I, 0, 0, 0 },
- { "LPRi", SHORT, GEN | READ | I, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
-};
-const ns32000_disassembler::NS32000_OPCODE ns32000_disassembler::format3_op[16] =
-{
- { "CXPD", GEN | ADDR, 0, 0, 0, STEP_OVER },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "BICPSRi", GEN | READ | I, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "JUMP", GEN | ADDR, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "BISPSRB", GEN | READ | B, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "ADJSPi", GEN | READ | I, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "JSR", GEN | ADDR, 0, 0, 0, STEP_OVER },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "CASEi", GEN | READ | I, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
-};
-const ns32000_disassembler::NS32000_OPCODE ns32000_disassembler::format4_op[16] =
-{
- { "ADDi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
- { "CMPi", GEN | READ | I, GEN | READ | I, 0, 0, 0 },
- { "BICi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "ADDCi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
- { "MOVi", GEN | READ | I, GEN | WRITE | I, 0, 0, 0 },
- { "ORi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "SUBi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
- { "ADDR", GEN | ADDR, GEN | WRITE | D, 0, 0, 0 },
- { "ANDi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "SUBCi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
- { "TBITi", GEN | READ | I, GEN | REGADDR, 0, 0, 0 },
- { "XORi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
-};
-const ns32000_disassembler::NS32000_OPCODE ns32000_disassembler::format5_op[16] =
-{
- { "MOVSi", OPTIONS, 0, 0, 0, 0 },
- { "CMPSi", OPTIONS, 0, 0, 0, 0 },
- { "SETCFG", SHORT, 0, 0, 0, 0 },
- { "SKPSi", OPTIONS, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
-};
-const ns32000_disassembler::NS32000_OPCODE ns32000_disassembler::format6_op[16] =
-{
- { "ROTi", GEN | READ | B, GEN | RMW | I, 0, 0, 0 },
- { "ASHi", GEN | READ | B, GEN | RMW | I, 0, 0, 0 },
- { "CBITi", GEN | READ | I, GEN | REGADDR, 0, 0, 0 },
- { "CBITIi", GEN | READ | I, GEN | REGADDR, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "LSHi", GEN | READ | B, GEN | RMW | I, 0, 0, 0 },
- { "SBITi", GEN | READ | I, GEN | REGADDR, 0, 0, 0 },
- { "SBITIi", GEN | READ | I, GEN | REGADDR, 0, 0, 0 },
- { "NEGi", GEN | READ | I, GEN | WRITE | I, 0, 0, 0 },
- { "NOTi", GEN | READ | I, GEN | WRITE | I, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "SUBPi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
- { "ABSi", GEN | READ | I, GEN | READ | I, 0, 0, 0 },
- { "COM", GEN | READ | I, GEN | WRITE | I, 0, 0, 0 },
- { "IBITi", GEN | READ | I, GEN | REGADDR, 0, 0, 0 },
- { "ADDPi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
-};
-const ns32000_disassembler::NS32000_OPCODE ns32000_disassembler::format7_op[16] =
-{
- { "MOVMi", GEN | ADDR, GEN | ADDR, DISP, 0, 0 },
- { "CMPMi", GEN | ADDR, GEN | ADDR, DISP, 0, 0 },
- { "INSSi", GEN | READ | I, GEN | REGADDR, IMM, 0, 0 },
- { "EXTSi", GEN | REGADDR, GEN | WRITE | I, IMM, 0, 0 },
- { "MOVXBW", GEN | READ | B, GEN | WRITE | W, 0, 0, 0 },
- { "MOVZBW", GEN | READ | B, GEN | WRITE | W, 0, 0, 0 },
- { "MOVZiD", GEN | READ | I, GEN | WRITE | D, 0, 0, 0 },
- { "MOVXiD", GEN | READ | I, GEN | WRITE | D, 0, 0, 0 },
- { "MULi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
- { "MEIi", GEN | READ | I, GEN | RMW | I2, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "DEIi", GEN | READ | I, GEN | RMW | I2, 0, 0, 0 },
- { "QUOi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
- { "REMi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
- { "MODi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
- { "DIVi", GEN | READ | I, GEN | RMW | I, 0, 0, 0 },
-};
-const ns32000_disassembler::NS32000_OPCODE ns32000_disassembler::format8_op[] =
-{
- { "EXTi", REG, GEN | REGADDR, GEN | WRITE | I, DISP, 0 },
- { "CVTP", REG, GEN | ADDR, GEN | WRITE | D, 0, 0 },
- { "INSi", REG, GEN | READ | I, GEN | REGADDR, DISP, 0 },
- { "CHECKi", REG, GEN | ADDR, GEN | READ | I, 0, 0 },
- { "INDEXi", REG, GEN | READ | I, GEN | READ | I, 0, 0 },
- { "FFSi", GEN | READ | I, GEN | RMW | B, 0, 0, 0 },
- { "MOVSUi", GEN | ADDR, GEN | ADDR, 0, 0, 0 },
- { "MOVUSi", GEN | ADDR, GEN | ADDR, 0, 0, 0 }
-};
-const ns32000_disassembler::NS32000_OPCODE ns32000_disassembler::format9_op[] =
-{
- { "MOVif", GEN | READ | I, GEN | WRITE | F, 0, 0, 0 },
- { "LFSR", GEN | READ | D, 0, 0, 0, 0 },
- { "MOVLF", GEN | READ | L, GEN | WRITE | F, 0, 0, 0 },
- { "MOVFL", GEN | READ | F, GEN | WRITE | L, 0, 0, 0 },
- { "ROUNDfi", GEN | READ | F, GEN | WRITE | I, 0, 0, 0 },
- { "TRUNCfi", GEN | READ | F, GEN | WRITE | I, 0, 0, 0 },
- { "SFSR", GEN | WRITE | D, 0, 0, 0, 0 },
- { "FLOORfi", GEN | READ | F, GEN | WRITE | I, 0, 0, 0 },
-};
-const ns32000_disassembler::NS32000_OPCODE ns32000_disassembler::format11_op[] =
-{
- { "ADDf", GEN | READ | F, GEN | RMW | F, 0, 0, 0 },
- { "MOVf", GEN | READ | F, GEN | WRITE | F, 0, 0, 0 },
- { "CMPf", GEN | READ | F, GEN | READ | F, 0, 0, 0 }, // POLYf
- { "Trap (SLAVE)", 0, 0, 0, 0, 0 }, // DOTf
- { "SUBf", GEN | READ | F, GEN | RMW | F, 0, 0, 0 }, // SCALBf
- { "NEGf", GEN | READ | F, GEN | WRITE | F, 0, 0, 0 }, // LOGBf
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "DIVf", GEN | READ | F, GEN | RMW | F, 0, 0, 0 },
- { "Trap (SLAVE)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "MULf", GEN | READ | F, GEN | RMW | F, 0, 0, 0 },
- { "ABSf", GEN | READ | F, GEN | READ | F, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
-};
-const ns32000_disassembler::NS32000_OPCODE ns32000_disassembler::format14_op[] =
-{
- { "RDVAL", GEN | ADDR, 0, 0, 0, 0 },
- { "WRVAL", GEN | ADDR, 0, 0, 0, 0 },
- { "LMR", SHORT, GEN | READ | D, 0, 0, 0 },
- { "SMR", SHORT, GEN | WRITE | D, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 }, // CINV
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
- { "Trap (UND)", 0, 0, 0, 0, 0 },
-};
-
-
-const char *const ns32000_disassembler::Format0[] =
-{
- "Bcond"
-};
-const char *const ns32000_disassembler::Format1[] =
-{
- "BSR", "RET", "CXP", "RXP", "RETT", "RETI", "SAVE", "RESTORE", "ENTER", "EXIT", "NOP", "WAIT", "DIA", "FLAG", "SVC", "BPT"
-};
-const char *const ns32000_disassembler::Format2[] =
-{
- "ADDQi", "CMPQi", "SPRi", "Scondi", "ACBi", "MOVQi", "LPRi"
-};
-const char *const ns32000_disassembler::Format3[] =
-{
- "CXPD", "Trap (UND)", "BICPSR", "Trap (UND)", "JUMP", "Trap (UND)", "BISPSR", "Trap (UND)", "Trap (UND)", "Trap (UND)", "ADJSPi", "Trap (UND)", "JSR", "Trap (UND)", "CASEi", "Trap (UND)"
-};
-const char *const ns32000_disassembler::Format4[] =
-{
- "ADDi", "CMPi", "BICi", "Trap (UND)", "ADDCi", "MOVi", "ORi", "Trap (UND)", "SUBi", "ADDR", "ANDi", "Trap (UND)", "SUBCi", "TBITi", "XORi", "Trap (UND)"
-};
-const char *const ns32000_disassembler::Format5[] =
-{
- "MOVSi", "CMPSi", "SETCFG", "SKPSi", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)"
-};
-const char *const ns32000_disassembler::Format6[] =
-{
- "ROTi", "ASHi", "CBITi", "CBITIi", "Trap (UND)", "LSHi", "SBITi", "SBITIi", "NEGi", "NOTi", "Trap (UND)", "SUBPi", "ABSi", "COM", "IBITi", "ADDPi"
-};
-const char *const ns32000_disassembler::Format7[] =
-{
- "MOVMi", "CMPMi", "INSSi", "EXTSi", "MOVXBW", "MOVZBW", "MOVZiD", "MOVXiD", "MULi", "MEIi", "Trap (UND)", "DEIi", "QUOi", "REMi", "MODi", "DIVi"
-};
-const char *const ns32000_disassembler::Format8[] =
-{
- "EXTi", "CVTP", "INSi", "CHECKi", "INDEXi", "FFSi", "MOVSUi", "MOVUSi"
-};
-const char *const ns32000_disassembler::Format9[] =
-{
- "MOVif", "LFSR", "MOVLF", "MOVFL", "ROUNDfi", "TRUNCfi", "SFSR", "FLOORfi"
-};
-const char *const ns32000_disassembler::Format11[] =
-{
- "ADDf", "MOVf", "CMPf", "Trap (SLAVE)", "SUBf", "NEGf", "Trap (UND)", "Trap (UND)", "DIVf", "Trap (SLAVE)", "Trap (UND)", "Trap (UND)", "MULf", "ABSf", "Trap (UND)", "Trap (UND)"
-};
-const char *const ns32000_disassembler::Format14[] =
-{
- "RDVAL", "WRVAL", "LMR", "SMR", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)", "Trap (UND)"
-};
-
-// types
-const char *const ns32000_disassembler::iType[] =
-{
- "B", "W", " ", "D"
-};
-const char *const ns32000_disassembler::fType[] =
-{
- "L", "F"
-};
-const char *const ns32000_disassembler::cType[] =
-{
- "Q", "D"
-};
-
-// index byte sizes
-const char *const ns32000_disassembler::indexSize[] =
-{
- "B", "W", "D", "Q"
-};
-
-// short codes
-const char *const ns32000_disassembler::cond[] =
-{
- "EQ", "NE", "CS", "CC", "HI", "LS", "GT", "LE", "FS", "FC", "LO", "HS", "LT", "GE", "R", "N"
-};
-const char *const ns32000_disassembler::areg[] =
-{
- "US", "(reserved)", "(reserved)", "(reserved)", "(reserved)", "(reserved)", "(reserved)", "(reserved)", "FP", "SP", "SB", "(reserved)", "(reserved)", "PSR", "INTBASE", "MOD"
-};
-const char *const ns32000_disassembler::mreg[] =
-{
- "BPR0", "BPR1", "(reserved)", "(reserved)", "(reserved)", "(reserved)", "(reserved)", "(reserved)", "(reserved)", "(reserved)", "MSR", "BCNT", "PTB0", "PTB1", "(reserved)", "EIA"
-};
-
-// register names
-const char *const ns32000_disassembler::R[] =
-{
- "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7"
-};
-const char *const ns32000_disassembler::M[] =
-{
- "FP", "SP", "SB"
-};
-const char *const ns32000_disassembler::PR[] =
-{
- "UPSR", "DCR", "BPC", "DSR", "CAR", "", "", "", "FP", "SP", "SB", "USP", "CFG", "PSR", "INTBASE", "MOD"
-};
-
-int8_t ns32000_disassembler::short2int(uint8_t val)
-{
- return (val & 0x08) ? val | 0xf0 : val;
-}
-
-std::string ns32000_disassembler::mnemonic_index(std::string form, std::string itype, std::string ftype)
-{
- if (itype.size() && form.find('i') != std::string::npos)
- form.replace(form.find('i'), 1, itype);
- if (ftype.size() && form.find('f') != std::string::npos)
- form.replace(form.find('f'), 1, ftype);
- return form;
-}
-
-uint8_t ns32000_disassembler::opcode_format(uint8_t byte)
-{
- switch (byte & 0x0f)
- {
- case 0x0a: return 0;
- case 0x02: return 1;
- case 0x0c:
- case 0x0d:
- case 0x0f:
- if ((byte & 0x70) != 0x70)
- return 2;
- else
- return 3;
- }
-
- if ((byte & 0x03) != 0x02) return 4;
-
- switch (byte)
- {
- case 0x0e: return 5;
- case 0x4e: return 6;
- case 0xce: return 7;
- case 0x2e:
- case 0x6e:
- case 0xae:
- case 0xee: return 8;
- case 0x3e: return 9;
- case 0x7e: return 10;
- case 0xbe: return 11;
- case 0xfe: return 12;
- case 0x9e: return 13;
- case 0x1e: return 14;
- }
-
- return 99; /* unknown format */
-}
-
-inline std::string ns32000_disassembler::get_option_list(uint8_t cfg)
-{
- std::string option_list;
-
- option_list.append("[");
- if (BIT(cfg, 0)) option_list.append("I,");
- if (BIT(cfg, 1)) option_list.append("F,");
- if (BIT(cfg, 2)) option_list.append("M,");
- if (BIT(cfg, 3)) option_list.append("C,");
- if (option_list.back() == ',') option_list.pop_back();
- option_list.append("]");
-
- return option_list;
-}
-
-inline std::string ns32000_disassembler::get_options(uint8_t opts)
-{
- std::string options;
-
- options.append(" ");
- if ((opts & 0x02) == 0x02) options.append("B,");
- if ((opts & 0x04) == 0x04) options.append("W,");
- if ((opts & 0x0c) == 0x0c) options.append("U,");
- if (options.back() == ',') options.pop_back();
-
- return options;
-}
-
-inline int32_t ns32000_disassembler::get_disp(offs_t &pc, const data_buffer &opcodes)
-{
- /* displacement can be upto 3 bytes */
- uint32_t disp = bitswap<32>(opcodes.r32(pc), 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8, 23, 22, 21, 20, 19, 18, 17, 16, 31, 30, 29, 28, 27, 26, 25, 24);
-
- switch ((disp >> 29) & 0x07)
- {
- case 0: case 1: /* 7 bit positive */
- disp = (disp >> 24);
- pc += 1;
- break;
-
- case 2: case 3: /* 7 bit negative */
- disp = (disp >> 24) | 0xffffff80;
- pc += 1;
- break;
-
- case 4: /* 14 bit positive */
- disp = (disp >> 16) & 0x3fff;
- pc += 2;
- break;
-
- case 5: /* 14 bit negative */
- disp = (disp >> 16) | 0xffffc000;
- pc += 2;
- break;
-
- case 6: /* 30 bit positive */
- disp = disp & 0x3fffffff;
- pc += 4;
- break;
-
- case 7: /* 30 bit negative */
- pc += 4;
- break;
- }
-
- return disp;
-}
-
-inline std::string ns32000_disassembler::get_reg_list(offs_t &pc, const data_buffer &opcodes, bool reverse)
-{
- std::string reg_list;
-
- uint8_t byte = opcodes.r8(pc++);
-
- reg_list.append("[");
- for (int i = 0; i < 8; i++)
- {
- if (BIT(byte, i)) reg_list.append(R[reverse ? (~i & 7) : (i & 7)]).append(",");
- }
- if (reg_list.back() == ',') reg_list.pop_back();
- reg_list.append("]");
-
- return reg_list;
-}
-
-void ns32000_disassembler::stream_gen(std::ostream &stream, u8 gen_addr, u8 op_len, offs_t &pc, const data_buffer &opcodes)
-{
- uint8_t index_byte;
- int32_t disp1, disp2;
-
- switch (gen_addr)
- {
- case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
- /* Register */
- util::stream_format(stream, "%s", R[gen_addr & 0x07]);
- break;
- case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
- /* Register Relative */
- disp1 = get_disp(pc, opcodes);
- util::stream_format(stream, "%+d(%s)", disp1, R[gen_addr & 0x07]);
- break;
- case 0x10: case 0x11: case 0x12:
- /* Memory Relative */
- disp1 = get_disp(pc, opcodes);
- disp2 = get_disp(pc, opcodes);
- util::stream_format(stream, "#X%02X(#X%02X(%s))", disp2, disp1, M[gen_addr & 0x03]);
- break;
- case 0x13:
- /* Reserved */
- util::stream_format(stream, "(reserved)");
- break;
- case 0x14:
- /* Immediate */
- disp1 = bitswap<32>(opcodes.r32(pc), 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8, 23, 22, 21, 20, 19, 18, 17, 16, 31, 30, 29, 28, 27, 26, 25, 24);
- util::stream_format(stream, "#X%02X", (op_len == 0 ? (disp1 >> 24) : (op_len == 1 ? (disp1 >> 16) : disp1)));
- pc += op_len + 1;
- break;
- case 0x15:
- /* Absolute */
- disp1 = get_disp(pc, opcodes);
- util::stream_format(stream, "@#X%02X", disp1);
- break;
- case 0x16:
- /* External */
- disp1 = get_disp(pc, opcodes);
- disp2 = get_disp(pc, opcodes);
- util::stream_format(stream, "EXT(%d)+%d", disp1, disp2);
- break;
- case 0x17:
- /* Top Of Stack */
- util::stream_format(stream, "TOS");
- break;
- case 0x18: case 0x19: case 0x1a:
- /* Memory Space */
- disp1 = get_disp(pc, opcodes);
- util::stream_format(stream, "#X%02X(%s)", disp1, M[gen_addr & 0x03]);
- break;
- case 0x1b:
- /* Memory Space */
- disp1 = get_disp(pc, opcodes);
- util::stream_format(stream, "#X%06X", m_base_pc + disp1);
- break;
- case 0x1c:
- /* Scaled Index */
- index_byte = opcodes.r8(pc++);
- stream_gen(stream, index_byte >> 3, op_len, pc, opcodes);
- util::stream_format(stream, "[%s:%c]", R[index_byte & 0x07], indexSize[gen_addr & 0x03]);
- break;
- }
-}
-
-offs_t ns32000_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params)
-{
- uint32_t flags = SUPPORTED;
-
- uint32_t opcode;
- std::string mnemonic;
- uint8_t temp8;
-
- /* opcode can be upto 3 bytes */
- opcode = opcodes.r32(pc);
- m_base_pc = pc;
-
- switch (opcode_format(opcode))
- {
- case 0: /* Format 0 */
- pc += 1;
- util::stream_format(stream, "%-8s #X%06X", std::string("B").append(cond[Format0cond(opcode)]), m_base_pc + get_disp(pc, opcodes));
- break;
-
- case 0x01: /* Format 1 */
- pc += 1;
- switch (Format1op(opcode))
- {
- case 0x00:
- util::stream_format(stream, "%-8s #X%06X", Format1[Format1op(opcode)], m_base_pc + get_disp(pc, opcodes));
- break;
- case 0x01:
- util::stream_format(stream, "%-8s #X%02X", Format1[Format1op(opcode)], get_disp(pc, opcodes) & 0xffffff);
- break;
- case 0x02:
- util::stream_format(stream, "%-8s EXT(%d)", Format1[Format1op(opcode)], get_disp(pc, opcodes));
- break;
- case 0x03: case 0x04:
- util::stream_format(stream, "%-8s #X%02X", Format1[Format1op(opcode)], get_disp(pc, opcodes) & 0xffffff);
- break;
- case 0x05:
- util::stream_format(stream, "%-8s", Format1[Format1op(opcode)]);
- break;
- case 0x06:
- util::stream_format(stream, "%-8s %s", Format1[Format1op(opcode)], get_reg_list(pc, opcodes, false));
- break;
- case 0x07: case 0x09:
- util::stream_format(stream, "%-8s %s", Format1[Format1op(opcode)], get_reg_list(pc, opcodes, true));
- break;
- case 0x08:
- util::stream_format(stream, "%-8s %s, %d", Format1[Format1op(opcode)], get_reg_list(pc, opcodes, false), get_disp(pc, opcodes));
- break;
- case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
- util::stream_format(stream, "%-8s", Format1[Format1op(opcode)]);
- break;
- }
- break;
-
- case 0x02: /* Format 2 */
- pc += 2;
- mnemonic = mnemonic_index(Format2[Format2op(opcode)], iType[Format2i(opcode)], "");
- switch (Format2op(opcode))
- {
- case 0x00: case 0x01: case 0x05:
- util::stream_format(stream, "%-8s %+d, ", mnemonic, short2int(Format2short(opcode)));
- stream_gen(stream, Format2gen(opcode), Format2i(opcode), pc, opcodes);
- break;
- case 0x02: case 0x06:
- util::stream_format(stream, "%-8s %s, ", mnemonic, areg[Format2short(opcode)]);
- stream_gen(stream, Format2gen(opcode), Format2i(opcode), pc, opcodes);
- break;
- case 0x03:
- util::stream_format(stream, "%-8s ", std::string("S").append(cond[Format2short(opcode)]).append(iType[Format2i(opcode)]));
- stream_gen(stream, Format2gen(opcode), Format2i(opcode), pc, opcodes);
- break;
- case 0x04:
- util::stream_format(stream, "%-8s %+d, ", mnemonic, short2int(Format2short(opcode)));
- stream_gen(stream, Format2gen(opcode), Format2i(opcode), pc, opcodes);
- util::stream_format(stream, ", #X%06x", m_base_pc + get_disp(pc, opcodes));
- break;
- }
- break;
-
- case 0x03: /* Format 3 */
- pc += 2;
- mnemonic = mnemonic_index(Format3[Format3op(opcode)], iType[Format3i(opcode)], "");
- switch (Format3op(opcode))
- {
- case 0x00: case 0x02: case 0x04: case 0x06: case 0x0a: case 0x0c: case 0x0e:
- util::stream_format(stream, "%-8s ", mnemonic);
- stream_gen(stream, Format3gen(opcode), Format3i(opcode), pc, opcodes);
- break;
- default: /* Trap */
- util::stream_format(stream, "%-8s ", mnemonic);
- break;
- }
- break;
-
- case 0x04: /* Format 4 */
- pc += 2;
- mnemonic = mnemonic_index(Format4[Format4op(opcode)], iType[Format4i(opcode)], "");
- util::stream_format(stream, "%-8s ", mnemonic);
- stream_gen(stream, Format4gen1(opcode), Format4i(opcode), pc, opcodes);
- util::stream_format(stream, ", ");
- stream_gen(stream, Format4gen2(opcode), Format4i(opcode), pc, opcodes);
- break;
-
- case 0x05: /* Format 5 */
- pc += 3;
- mnemonic = mnemonic_index(Format5[Format5op(opcode)], iType[Format5i(opcode)], "");
- switch ((opcode >> 10) & 0x0f)
- {
- case 0x00: case 0x01: case 0x03:
- if (Format5short(opcode) & 0x01)
- util::stream_format(stream, "%-8s %s", std::string(Format5[Format5op(opcode)]).append("T"), get_options(Format5short(opcode)));
- else
- util::stream_format(stream, "%-8s %s", mnemonic, get_options(Format5short(opcode)));
- break;
- case 0x02:
- util::stream_format(stream, "%-8s %s", Format5[Format5op(opcode)], get_option_list(Format5short(opcode)));
- break;
- default: /* Trap */
- util::stream_format(stream, "%-8s ", mnemonic);
- break;
- }
- break;
-
- case 0x06: /* Format 6 */
- pc += 3;
- mnemonic = mnemonic_index(Format6[Format6op(opcode)], iType[Format6i(opcode)], "");
- switch ((opcode >> 10) & 0x0f)
- {
- case 0x00: case 0x01: case 0x02: case 0x03: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
- util::stream_format(stream, "%-8s ", mnemonic);
- stream_gen(stream, Format6gen1(opcode), Format6i(opcode), pc, opcodes);
- util::stream_format(stream, ", ");
- stream_gen(stream, Format6gen2(opcode), Format6i(opcode), pc, opcodes);
- break;
- default: /* Trap */
- util::stream_format(stream, "%-8s ", mnemonic);
- break;
- }
- break;
-
- case 0x07: /* Format 7 */
- pc += 3;
- mnemonic = mnemonic_index(Format7[Format7op(opcode)], iType[Format7i(opcode)], "");
- switch (Format7op(opcode))
- {
- case 0x00: case 0x01:
- util::stream_format(stream, "%-8s ", mnemonic);
- stream_gen(stream, Format7gen1(opcode), Format7i(opcode), pc, opcodes);
- util::stream_format(stream, ", ");
- stream_gen(stream, Format7gen2(opcode), Format7i(opcode), pc, opcodes);
- util::stream_format(stream, ", %d", get_disp(pc, opcodes));
- break;
- case 0x02: case 0x03:
- util::stream_format(stream, "%-8s ", mnemonic);
- stream_gen(stream, Format7gen1(opcode), Format7i(opcode), pc, opcodes);
- util::stream_format(stream, ", ");
- stream_gen(stream, Format7gen2(opcode), Format7i(opcode), pc, opcodes);
- temp8 = opcodes.r8(pc++);
- util::stream_format(stream, ", %d, %d", temp8 >> 5, temp8 + 1);
- break;
- case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
- util::stream_format(stream, "%-8s ", mnemonic);
- stream_gen(stream, Format7gen1(opcode), Format7i(opcode), pc, opcodes);
- util::stream_format(stream, ", ");
- stream_gen(stream, Format7gen2(opcode), Format7i(opcode), pc, opcodes);
- break;
- default: /* Trap */
- util::stream_format(stream, "%-8s ", mnemonic);
- break;
- }
- break;
-
- case 0x08: /* Format 8 */
- pc += 3;
- mnemonic = mnemonic_index(Format8[Format8op(opcode)], iType[Format8i(opcode)], "");
- switch (Format8op(opcode))
- {
- case 0x00: case 0x02:
- util::stream_format(stream, "%-8s %s, ", mnemonic, R[Format8reg(opcode)]);
- stream_gen(stream, Format8gen2(opcode), Format8i(opcode), pc, opcodes);
- util::stream_format(stream, ", ");
- stream_gen(stream, Format8gen1(opcode), Format8i(opcode), pc, opcodes);
- util::stream_format(stream, ", %d", get_disp(pc, opcodes));
- break;
- case 0x01: case 0x03: case 0x04:
- util::stream_format(stream, "%-8s %s, ", mnemonic, R[Format8reg(opcode)]);
- stream_gen(stream, Format8gen2(opcode), Format8i(opcode), pc, opcodes);
- util::stream_format(stream, ", ");
- stream_gen(stream, Format8gen1(opcode), Format8i(opcode), pc, opcodes);
- break;
- case 0x05:
- util::stream_format(stream, "%-8s ", mnemonic);
- stream_gen(stream, Format8gen2(opcode), Format8i(opcode), pc, opcodes);
- util::stream_format(stream, ", ");
- stream_gen(stream, Format8gen1(opcode), Format8i(opcode), pc, opcodes);
- break;
- case 0x06:
- if (Format8reg(opcode) == 0x01)
- util::stream_format(stream, "%-8s ", std::string(Format8[Format8op(opcode)]).append(iType[Format8i(opcode)]));
- else
- util::stream_format(stream, "%-8s ", std::string(Format8[Format8op(opcode) + 1]).append(iType[Format8i(opcode)]));
- stream_gen(stream, Format8gen2(opcode), Format8i(opcode), pc, opcodes);
- util::stream_format(stream, ", ");
- stream_gen(stream, Format8gen1(opcode), Format8i(opcode), pc, opcodes);
- break;
- }
- break;
-
- case 0x09: /* Format 9 */
- pc += 3;
- mnemonic = mnemonic_index(Format9[Format9op(opcode)], iType[Format9i(opcode)], fType[Format9f(opcode)]);
- switch (Format9op(opcode))
- {
- case 0x00: case 0x02: case 0x04: case 0x05: case 0x07:
- util::stream_format(stream, "%-8s ", mnemonic);
- stream_gen(stream, Format9gen1(opcode), Format9i(opcode), pc, opcodes);
- util::stream_format(stream, ", ");
- stream_gen(stream, Format9gen2(opcode), Format9i(opcode), pc, opcodes);
- break;
- case 0x01: case 0x06:
- util::stream_format(stream, "%-8s ", mnemonic);
- stream_gen(stream, Format9gen1(opcode), Format9i(opcode), pc, opcodes);
- break;
- }
- break;
-
- case 0x0b: /* Format 11 */
- pc += 3;
- mnemonic = mnemonic_index(Format11[Format11op(opcode)], "", fType[Format11f(opcode)]);
- switch (Format11op(opcode))
- {
- case 0x00: case 0x01: case 0x02: case 0x04: case 0x05 : case 0x08: case 0x0c : case 0x0d:
- util::stream_format(stream, "%-8s ", mnemonic);
- stream_gen(stream, Format11gen1(opcode), Format11f(opcode), pc, opcodes);
- util::stream_format(stream, ",");
- stream_gen(stream, Format11gen2(opcode), Format11f(opcode), pc, opcodes);
- break;
- default: /* Trap */
- util::stream_format(stream, "%-8s ", mnemonic);
- break;
- }
- break;
-
- case 0x0a: /* Format 10 */
- case 0x0c: /* Format 12 */
- case 0x0d: /* Format 13 */
- pc += 3;
- util::stream_format(stream, "Trap (UND)");
- break;
-
- case 0x0e: /* Format 14 */
- pc += 3;
- mnemonic = mnemonic_index(Format14[Format14op(opcode)], iType[Format14i(opcode)], "");
- switch (Format14op(opcode))
- {
- case 0x00: case 0x01:
- util::stream_format(stream, "%-8s ", mnemonic);
- stream_gen(stream, Format14gen1(opcode), Format14i(opcode), pc, opcodes);
- break;
- case 0x02: case 0x03:
- util::stream_format(stream, "%-8s %s, ", mnemonic, mreg[Format14short(opcode)]);
- stream_gen(stream, Format14gen1(opcode), Format14i(opcode), pc, opcodes);
- break;
- default: /* Trap */
- util::stream_format(stream, "%-8s ", mnemonic);
- break;
- }
- break;
-
- default:
- pc += 1;
- util::stream_format(stream, "unknown instruction format");
- break;
- }
-
- return (pc - m_base_pc) | flags;
-}
diff --git a/src/devices/cpu/ns32000/ns32000dasm.h b/src/devices/cpu/ns32000/ns32000dasm.h
deleted file mode 100644
index 4cbf4cf3bda..00000000000
--- a/src/devices/cpu/ns32000/ns32000dasm.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nigel Barnes
-/*****************************************************************************
-*
-* ns32000dasm.cpp
-*
-* NS32000 CPU Disassembly
-*
-*****************************************************************************/
-
-#ifndef MAME_CPU_NS32000_NS32000DASM_H
-#define MAME_CPU_NS32000_NS32000DASM_H
-
-#pragma once
-
-class ns32000_disassembler : public util::disasm_interface
-{
-public:
-
- ns32000_disassembler() = default;
- virtual ~ns32000_disassembler() = default;
-
- virtual u32 opcode_alignment() const override { return 1; }
- virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params) override;
-
-private:
- /* implied operand attributes */
- enum
- {
- REG = 16,
- QUICK,
- SHORT,
- IMM,
- DISP,
- GEN,
- OPTIONS,
- };
- /* access classes */
- enum
- {
- READ = 8,
- WRITE,
- RMW,
- ADDR,
- REGADDR
- };
- /* length attributes */
- enum
- {
- B = 0,
- W = 1,
- D = 3,
- I,
- I2,
- F,
- L
- };
- struct NS32000_OPCODE {
- const char *mnemonic;
- u32 operand1;
- u32 operand;
- u32 operand3;
- u32 operand4;
- offs_t dasm_flags;
- };
-
- static const NS32000_OPCODE format0_op[1];
- static const NS32000_OPCODE format1_op[16];
- static const NS32000_OPCODE format2_op[8];
- static const NS32000_OPCODE format3_op[16];
- static const NS32000_OPCODE format4_op[16];
- static const NS32000_OPCODE format5_op[16];
- static const NS32000_OPCODE format6_op[16];
- static const NS32000_OPCODE format7_op[16];
- static const NS32000_OPCODE format8_op[16];
- static const NS32000_OPCODE format9_op[16];
- static const NS32000_OPCODE format11_op[16];
- static const NS32000_OPCODE format14_op[16];
-
-
- static char const *const Format0[];
- static char const *const Format1[];
- static char const *const Format2[];
- static char const *const Format3[];
- static char const *const Format4[];
- static char const *const Format5[];
- static char const *const Format6[];
- static char const *const Format7[];
- static char const *const Format8[];
- static char const *const Format9[];
- static char const *const Format11[];
- static char const *const Format14[];
- static char const *const iType[];
- static char const *const fType[];
- static char const *const cType[];
- static char const *const indexSize[];
- static char const *const cond[];
- static char const *const areg[];
- static char const *const mreg[];
- static char const *const R[];
- static char const *const M[];
- static char const *const PR[];
-
- std::string mnemonic_index(std::string form, std::string itype, std::string ftype);
- uint8_t opcode_format(uint8_t byte);
- int8_t short2int(uint8_t val);
- static inline int32_t get_disp(offs_t &pc, const data_buffer &opcodes);
- static inline std::string get_option_list(uint8_t cfg);
- static inline std::string get_options(uint8_t opts);
- static inline std::string get_reg_list(offs_t &pc, const data_buffer &opcodes, bool reverse);
-
- void stream_gen(std::ostream &stream, u8 gen_addr, u8 op_len, offs_t &pc, const data_buffer &opcodes);
-
- u32 m_base_pc;
-};
-
-#endif
diff --git a/src/devices/cpu/pic16c5x/pic16c5x.cpp b/src/devices/cpu/pic16c5x/pic16c5x.cpp
index 21907b7d369..fe1b0280d2a 100644
--- a/src/devices/cpu/pic16c5x/pic16c5x.cpp
+++ b/src/devices/cpu/pic16c5x/pic16c5x.cpp
@@ -83,8 +83,8 @@ DEFINE_DEVICE_TYPE(PIC16C56, pic16c56_device, "pic16c56", "Microchip PIC16C56")
DEFINE_DEVICE_TYPE(PIC16C57, pic16c57_device, "pic16c57", "Microchip PIC16C57")
DEFINE_DEVICE_TYPE(PIC16C58, pic16c58_device, "pic16c58", "Microchip PIC16C58")
-DEFINE_DEVICE_TYPE(PIC1650, pic1650_device, "pic1650", "GI PIC1650")
-DEFINE_DEVICE_TYPE(PIC1655, pic1655_device, "pic1655", "GI PIC1655")
+DEFINE_DEVICE_TYPE(PIC1650, pic1650_device, "pic1650", "Microchip PIC1650")
+DEFINE_DEVICE_TYPE(PIC1655, pic1655_device, "pic1655", "Microchip PIC1655")
/****************************************************************************
diff --git a/src/devices/cpu/sh/sh2.cpp b/src/devices/cpu/sh/sh2.cpp
index d3660a52209..6eebabea4ac 100644
--- a/src/devices/cpu/sh/sh2.cpp
+++ b/src/devices/cpu/sh/sh2.cpp
@@ -402,7 +402,7 @@ void sh2_device::execute_run()
{
debugger_instruction_hook(m_sh2_state->pc);
- const uint16_t opcode = m_decrypted_program->read_word(m_sh2_state->pc >= 0x40000000 ? m_sh2_state->pc : m_sh2_state->pc & SH12_AM);
+ const uint16_t opcode = m_program->read_word(m_sh2_state->pc & SH12_AM);
if (m_sh2_state->m_delay)
{
diff --git a/src/devices/cpu/sm510/sm510base.cpp b/src/devices/cpu/sm510/sm510base.cpp
index 919fcea9e17..b3bef1d67b7 100644
--- a/src/devices/cpu/sm510/sm510base.cpp
+++ b/src/devices/cpu/sm510/sm510base.cpp
@@ -15,6 +15,7 @@
TODO:
- source organiziation between files is a mess
+ - LCD bs pin blink mode via Y register (0.5s off, 0.5s on)
- wake up after CEND doesn't work right
for more, see the *core.cpp file notes
@@ -199,8 +200,7 @@ void sm510_base_device::lcd_update()
m_write_segs(h | SM510_PORT_SEGC, get_lcd_row(h, m_lcd_ram_c), 0xffff);
// bs output from L/X and Y regs
- u8 blink = (m_div & 0x4000) ? m_y : 0;
- u8 bs = ((m_l & ~blink) >> h & 1) | ((m_x*2) >> h & 2);
+ u8 bs = (m_l >> h & 1) | ((m_x*2) >> h & 2);
m_write_segs(h | SM510_PORT_SEGBS, (m_bc || !m_bp) ? 0 : bs, 0xffff);
}
}
diff --git a/src/devices/cpu/tms1000/tms0270.cpp b/src/devices/cpu/tms1000/tms0270.cpp
index 899e3eb1ba3..5d1eb2b14d1 100644
--- a/src/devices/cpu/tms1000/tms0270.cpp
+++ b/src/devices/cpu/tms1000/tms0270.cpp
@@ -24,6 +24,9 @@ DEFINE_DEVICE_TYPE(TMS0270, tms0270_cpu_device, "tms0270", "Texas Instruments TM
// device definitions
tms0270_cpu_device::tms0270_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: tms0980_cpu_device(mconfig, TMS0270, tag, owner, clock, 16 /* o pins */, 16 /* r pins */, 7 /* pc bits */, 9 /* byte width */, 4 /* x width */, 11 /* prg width */, address_map_constructor(FUNC(tms0270_cpu_device::program_11bit_9), this), 8 /* data width */, address_map_constructor(FUNC(tms0270_cpu_device::data_144x4), this))
+ , m_read_ctl(*this)
+ , m_write_ctl(*this)
+ , m_write_pdc(*this)
{
}
@@ -44,6 +47,10 @@ void tms0270_cpu_device::device_start()
// common init
tms1k_base_device::device_start();
+ m_read_ctl.resolve_safe(0);
+ m_write_ctl.resolve_safe();
+ m_write_pdc.resolve_safe();
+
// zerofill
m_r_prev = 0;
m_chipsel = 0;
diff --git a/src/devices/cpu/tms1000/tms0270.h b/src/devices/cpu/tms1000/tms0270.h
index 45c231a950a..3043119e2aa 100644
--- a/src/devices/cpu/tms1000/tms0270.h
+++ b/src/devices/cpu/tms1000/tms0270.h
@@ -19,6 +19,11 @@ class tms0270_cpu_device : public tms0980_cpu_device
public:
tms0270_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ // TMS0270 was designed to interface with TMS5100, set it up at driver level
+ auto read_ctl() { return m_read_ctl.bind(); }
+ auto write_ctl() { return m_write_ctl.bind(); }
+ auto write_pdc() { return m_write_pdc.bind(); }
+
protected:
// overrides
virtual void device_start() override;
@@ -45,6 +50,10 @@ private:
u8 m_o_latch_low;
u8 m_o_latch;
u8 m_o_latch_prev;
+
+ devcb_read8 m_read_ctl;
+ devcb_write8 m_write_ctl;
+ devcb_write_line m_write_pdc;
};
diff --git a/src/devices/cpu/tms1000/tms1000c.cpp b/src/devices/cpu/tms1000/tms1000c.cpp
index b69a683f280..defc8482eef 100644
--- a/src/devices/cpu/tms1000/tms1000c.cpp
+++ b/src/devices/cpu/tms1000/tms1000c.cpp
@@ -52,3 +52,21 @@ u32 tms1000c_cpu_device::decode_micro(u8 sel)
return decode;
}
+
+
+// execute
+void tms1000c_cpu_device::execute_run()
+{
+ while (m_icount > 0)
+ {
+ if (m_halt_pin)
+ {
+ // not running (output pins remain unchanged)
+ m_icount = 0;
+ return;
+ }
+
+ m_icount--;
+ execute_one();
+ }
+}
diff --git a/src/devices/cpu/tms1000/tms1000c.h b/src/devices/cpu/tms1000/tms1000c.h
index 7857bf07f0c..364dd56879f 100644
--- a/src/devices/cpu/tms1000/tms1000c.h
+++ b/src/devices/cpu/tms1000/tms1000c.h
@@ -23,6 +23,7 @@ protected:
// overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual u32 decode_micro(u8 sel) override;
+ virtual void execute_run() override;
virtual void op_br() override { op_br3(); } // 3-level stack
virtual void op_call() override { op_call3(); } // "
diff --git a/src/devices/cpu/tms1000/tms1k_base.cpp b/src/devices/cpu/tms1000/tms1k_base.cpp
index 3f14dba6c5e..432e43e0d7b 100644
--- a/src/devices/cpu/tms1000/tms1k_base.cpp
+++ b/src/devices/cpu/tms1000/tms1k_base.cpp
@@ -90,9 +90,6 @@ tms1k_base_device::tms1k_base_device(const machine_config &mconfig, device_type
, m_write_o(*this)
, m_write_r(*this)
, m_power_off(*this)
- , m_read_ctl(*this)
- , m_write_ctl(*this)
- , m_write_pdc(*this)
{
}
@@ -134,9 +131,6 @@ void tms1k_base_device::device_start()
m_write_o.resolve_safe();
m_write_r.resolve_safe();
m_power_off.resolve_safe();
- m_read_ctl.resolve_safe(0);
- m_write_ctl.resolve_safe();
- m_write_pdc.resolve_safe();
// zerofill
m_pc = 0;
@@ -153,6 +147,7 @@ void tms1k_base_device::device_start()
m_r = 0;
m_o = 0;
m_o_index = 0;
+ m_halt_pin = false;
m_cki_bus = 0;
m_c4 = 0;
m_p = 0;
@@ -192,6 +187,7 @@ void tms1k_base_device::device_start()
save_item(NAME(m_r));
save_item(NAME(m_o));
save_item(NAME(m_o_index));
+ save_item(NAME(m_halt_pin));
save_item(NAME(m_cki_bus));
save_item(NAME(m_c4));
save_item(NAME(m_p));
@@ -301,7 +297,7 @@ void tms1k_base_device::read_opcode()
{
debugger_instruction_hook(m_rom_address);
m_opcode = m_program->read_byte(m_rom_address);
- m_c4 = bitswap<4>(m_opcode,0,1,2,3); // opcode operand is bitswapped for most opcodes
+ m_c4 = bitswap<8>(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes
m_fixed = m_fixed_decode[m_opcode];
m_micro = m_micro_decode[m_opcode];
@@ -315,6 +311,15 @@ void tms1k_base_device::read_opcode()
// i/o handling
//-------------------------------------------------
+void tms1k_base_device::execute_set_input(int line, int state)
+{
+ if (line != TMS1XXX_INPUT_LINE_HALT)
+ return;
+
+ // HALT pin (CMOS only)
+ m_halt_pin = bool(state);
+}
+
void tms1k_base_device::write_o_output(u8 index)
{
// a hardcoded table is supported if the output pla is unknown
diff --git a/src/devices/cpu/tms1000/tms1k_base.h b/src/devices/cpu/tms1000/tms1k_base.h
index d7681329c93..7a394b8dfbb 100644
--- a/src/devices/cpu/tms1000/tms1k_base.h
+++ b/src/devices/cpu/tms1000/tms1k_base.h
@@ -17,6 +17,10 @@
#include "machine/pla.h"
+// HALT input pin on CMOS chips (use set_input_line)
+#define TMS1XXX_INPUT_LINE_HALT 0
+
+
// pinout reference
/*
@@ -74,14 +78,6 @@ public:
// OFF request on TMS0980 and up
auto power_off() { return m_power_off.bind(); }
- // note: for HALT input pin on CMOS chips, use set_input_line with INPUT_LINE_HALT
- // similarly with the INIT pin, simply use INPUT_LINE_RESET
-
- // TMS0270 was designed to interface with TMS5100, set it up at driver level
- auto read_ctl() { return m_read_ctl.bind(); }
- auto write_ctl() { return m_write_ctl.bind(); }
- auto write_pdc() { return m_write_pdc.bind(); }
-
// Use this if the output PLA is unknown:
// If the microinstructions (or other) PLA is unknown, try using one from another romset.
void set_output_pla(const u16 *output_pla) { m_output_pla_table = output_pla; }
@@ -99,6 +95,8 @@ protected:
// device_execute_interface overrides
virtual u32 execute_min_cycles() const override { return 1; }
virtual u32 execute_max_cycles() const override { return 1; }
+ virtual u32 execute_input_lines() const override { return 1; }
+ virtual void execute_set_input(int line, int state) override;
virtual void execute_run() override;
virtual void execute_one();
@@ -247,6 +245,7 @@ protected:
int m_subcycle;
int m_icount;
u8 m_o_index;
+ bool m_halt_pin;
u8 m_o_pins; // how many O pins
u8 m_r_pins; // how many R pins
@@ -262,9 +261,6 @@ protected:
devcb_write16 m_write_o;
devcb_write16 m_write_r;
devcb_write_line m_power_off;
- devcb_read8 m_read_ctl;
- devcb_write8 m_write_ctl;
- devcb_write_line m_write_pdc;
u32 m_o_mask;
u32 m_r_mask;
diff --git a/src/devices/cpu/tms34010/tms34010.cpp b/src/devices/cpu/tms34010/tms34010.cpp
index 79e9cf42fb6..3851b16dd37 100644
--- a/src/devices/cpu/tms34010/tms34010.cpp
+++ b/src/devices/cpu/tms34010/tms34010.cpp
@@ -7,9 +7,6 @@
Copyright Alex Pasadyn/Zsolt Vasvari
Parts based on code by Aaron Giles
- TMS34020 TODO:
- - Big endian mode isn't implemented
-
***************************************************************************/
#include "emu.h"
@@ -29,80 +26,36 @@
#define LOGCONTROLREGS(...) LOGMASKED(LOG_CONTROL_REGS, __VA_ARGS__)
#define LOGGRAPHICSOPS(...) LOGMASKED(LOG_GRAPHICS_OPS, __VA_ARGS__)
-void tms34010_device::internal_regs_map(address_map &map)
-{
- //map(0x00000000, 0xbfffffff); General use
- map(0xc0000000, 0xc00001ff).rw(FUNC(tms34010_device::io_register_r), FUNC(tms34010_device::io_register_w)); // IO registers
- //map(0xc0000200, 0xc0001fff).noprw(); Reserved (for IO registers?)
- //map(0xc0002000, 0xffffdfff); General use
- //map(0xffffe000, 0xfffffbff).noprw(); Reserved (for interrupt vectors, maybe)
- //map(0xfffffc00, 0xffffffff); Interrupt Vectors
-}
-
-void tms34020_device::internal_regs_map(address_map &map)
-{
- //map(0x00000000, 0x000fffff); General use and extended trap vectors
- //map(0x00100000, 0xbfffffff); General use
- map(0xc0000000, 0xc00003ff).rw(FUNC(tms34020_device::io_register_r), FUNC(tms34020_device::io_register_w)); // IO registers
- //map(0xc0000400, 0xc0001fff).noprw(); Reserved for IO registers
- //map(0xc0002000, 0xffefffff); General use
- //map(0xfff00000, 0xffffdfff); General use and extended trap vectors
- //map(0xffffe000, 0xfffffbbf).noprw(); Reserved for interrupt vectors and extended trap vectors
- //map(0xfffffbc0, 0xffffffff); Interrupt vectors and trap vectors
-}
-DEFINE_DEVICE_TYPE(TMS34010, tms34010_device, "tms34010", "Texas Instruments TMS34010")
-DEFINE_DEVICE_TYPE(TMS34020, tms34020_device, "tms34020", "Texas Instruments TMS34020")
+DEFINE_DEVICE_TYPE(TMS34010, tms34010_device, "tms34010", "TMS34010")
+DEFINE_DEVICE_TYPE(TMS34020, tms34020_device, "tms34020", "TMS34020")
/***************************************************************************
GLOBAL VARIABLES
***************************************************************************/
-tms340x0_device::tms340x0_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor internal_regs_map)
+tms340x0_device::tms340x0_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: cpu_device(mconfig, type, tag, owner, clock)
, device_video_interface(mconfig, *this)
- , m_program_config("program", ENDIANNESS_LITTLE, 16, 32, 3, internal_regs_map)
- , m_pc(0)
- , m_ppc(0)
- , m_st(0)
- , m_pixel_write(nullptr)
- , m_pixel_read(nullptr)
- , m_raster_op(nullptr)
- , m_pixel_op(nullptr)
- , m_pixel_op_timing(0)
- , m_convsp(0)
- , m_convdp(0)
- , m_convmp(0)
- , m_gfxcycles(0)
- , m_pixelshift(0)
- , m_is_34020(0)
- , m_reset_deferred(false)
- , m_halt_on_reset(false)
- , m_hblank_stable(0)
- , m_external_host_access(0)
- , m_executing(0)
- , m_program(nullptr)
- , m_cache(nullptr)
+ , m_program_config("program", ENDIANNESS_LITTLE, 16, 32, 3), m_pc(0), m_ppc(0), m_st(0), m_pixel_write(nullptr), m_pixel_read(nullptr), m_raster_op(nullptr), m_pixel_op(nullptr), m_pixel_op_timing(0), m_convsp(0), m_convdp(0), m_convmp(0), m_gfxcycles(0), m_pixelshift(0), m_is_34020(0), m_reset_deferred(false)
+ , m_halt_on_reset(false), 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)
- , m_icount(0)
+ , m_pixperclock(0), m_scantimer(nullptr), m_icount(0)
, m_output_int_cb(*this)
- , m_ioreg_pre_write_cb(*this)
{
}
tms34010_device::tms34010_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms340x0_device(mconfig, TMS34010, tag, owner, clock, address_map_constructor(FUNC(tms34010_device::internal_regs_map), this))
+ : tms340x0_device(mconfig, TMS34010, tag, owner, clock)
{
m_is_34020 = 0;
}
tms34020_device::tms34020_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms340x0_device(mconfig, TMS34020, tag, owner, clock, address_map_constructor(FUNC(tms34020_device::internal_regs_map), this))
+ : tms340x0_device(mconfig, TMS34020, tag, owner, clock)
{
m_is_34020 = 1;
}
@@ -629,7 +582,6 @@ void tms340x0_device::device_start()
m_scanline_ind16_cb.bind_relative_to(*owner());
m_scanline_rgb32_cb.bind_relative_to(*owner());
m_output_int_cb.resolve();
- m_ioreg_pre_write_cb.resolve();
m_to_shiftreg_cb.bind_relative_to(*owner());
m_from_shiftreg_cb.bind_relative_to(*owner());
@@ -673,6 +625,7 @@ void tms340x0_device::device_start()
save_item(NAME(m_pixelshift));
save_item(NAME(m_gfxcycles));
save_pointer(NAME(&m_regs[0].reg), ARRAY_LENGTH(m_regs));
+ machine().save().register_postload(save_prepost_delegate(FUNC(tms340x0_device::tms34010_state_postload), this));
set_icountptr(m_icount);
}
@@ -708,7 +661,7 @@ void tms340x0_device::device_reset()
if (m_reset_deferred)
{
- io_register_w(REG_HSTCTLH, 0x8000, 0xffff);
+ io_register_w(*m_program, REG_HSTCTLH, 0x8000, 0xffff);
}
}
@@ -1136,11 +1089,8 @@ static const char *const ioreg_name[] =
"HCOUNT", "VCOUNT", "DPYADR", "REFCNT"
};
-void tms34010_device::io_register_w(offs_t offset, u16 data, u16 mem_mask)
+WRITE16_MEMBER( tms34010_device::io_register_w )
{
- if (!m_ioreg_pre_write_cb.isnull())
- m_ioreg_pre_write_cb(offset, data, mem_mask);
-
int oldreg, newreg;
/* Set register */
@@ -1287,11 +1237,8 @@ static const char *const ioreg020_name[] =
"IHOST3L", "IHOST3H", "IHOST4L", "IHOST4H"
};
-void tms34020_device::io_register_w(offs_t offset, u16 data, u16 mem_mask)
+WRITE16_MEMBER( tms34020_device::io_register_w )
{
- if (!m_ioreg_pre_write_cb.isnull())
- m_ioreg_pre_write_cb(offset, data, mem_mask);
-
int oldreg, newreg;
/* Set register */
@@ -1451,7 +1398,7 @@ void tms34020_device::io_register_w(offs_t offset, u16 data, u16 mem_mask)
I/O REGISTER READS
***************************************************************************/
-u16 tms34010_device::io_register_r(offs_t offset)
+READ16_MEMBER( tms34010_device::io_register_r )
{
int result, total;
@@ -1492,7 +1439,7 @@ u16 tms34010_device::io_register_r(offs_t offset)
}
-u16 tms34020_device::io_register_r(offs_t offset)
+READ16_MEMBER( tms34020_device::io_register_r )
{
int result, total;
@@ -1532,7 +1479,7 @@ u16 tms34020_device::io_register_r(offs_t offset)
SAVE STATE
***************************************************************************/
-void tms340x0_device::device_post_load()
+void tms340x0_device::tms34010_state_postload()
{
set_raster_op();
set_pixel_function();
@@ -1543,7 +1490,7 @@ void tms340x0_device::device_post_load()
HOST INTERFACE WRITES
***************************************************************************/
-void tms340x0_device::host_w(offs_t offset, u16 data, u16 mem_mask)
+WRITE16_MEMBER( tms340x0_device::host_w )
{
int reg = offset;
unsigned int addr;
@@ -1580,8 +1527,8 @@ void tms340x0_device::host_w(offs_t offset, u16 data, u16 mem_mask)
case TMS34010_HOST_CONTROL:
{
m_external_host_access = true;
- if (mem_mask&0xff00) io_register_w(REG_HSTCTLH, data & 0xff00, 0xff00);
- if (mem_mask&0x00ff) io_register_w(REG_HSTCTLL, data & 0x00ff, 0x00ff);
+ if (mem_mask&0xff00) io_register_w(*m_program, REG_HSTCTLH, data & 0xff00, 0xff00);
+ if (mem_mask&0x00ff) io_register_w(*m_program, REG_HSTCTLL, data & 0x00ff, 0x00ff);
m_external_host_access = false;
break;
}
@@ -1599,7 +1546,7 @@ void tms340x0_device::host_w(offs_t offset, u16 data, u16 mem_mask)
HOST INTERFACE READS
***************************************************************************/
-u16 tms340x0_device::host_r(offs_t offset)
+READ16_MEMBER( tms340x0_device::host_r )
{
int reg = offset;
unsigned int addr;
diff --git a/src/devices/cpu/tms34010/tms34010.h b/src/devices/cpu/tms34010/tms34010.h
index 313f94d3503..299282fe743 100644
--- a/src/devices/cpu/tms34010/tms34010.h
+++ b/src/devices/cpu/tms34010/tms34010.h
@@ -135,7 +135,6 @@ public:
void set_pixels_per_clock(int pixperclock) { m_pixperclock = pixperclock; }
auto output_int() { return m_output_int_cb.bind(); }
- auto ioreg_pre_write() { return m_ioreg_pre_write_cb.bind(); }
// Setters for ind16 scanline callback
template <class FunctionClass>
@@ -206,15 +205,16 @@ public:
}
void get_display_params(display_params *params);
+ void tms34010_state_postload();
uint32_t tms340x0_ind16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t tms340x0_rgb32(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- virtual void io_register_w(offs_t offset, u16 data, u16 mem_mask = ~u16(0)) = 0;
- virtual u16 io_register_r(offs_t offset) = 0;
+ virtual DECLARE_WRITE16_MEMBER(io_register_w) = 0;
+ virtual DECLARE_READ16_MEMBER(io_register_r) = 0;
- void host_w(offs_t offset, u16 data, u16 mem_mask = ~u16(0));
- u16 host_r(offs_t offset);
+ DECLARE_WRITE16_MEMBER(host_w);
+ DECLARE_READ16_MEMBER(host_r);
TIMER_CALLBACK_MEMBER(internal_interrupt_callback);
TIMER_CALLBACK_MEMBER(scanline_callback);
@@ -292,12 +292,11 @@ protected:
};
// construction/destruction
- tms340x0_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor internal_regs_map = address_map_constructor());
+ tms340x0_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
// device_execute_interface overrides
virtual uint32_t execute_min_cycles() const override { return 1; }
@@ -368,7 +367,6 @@ protected:
scanline_ind16_cb_delegate m_scanline_ind16_cb;
scanline_rgb32_cb_delegate m_scanline_rgb32_cb;
devcb_write_line m_output_int_cb; /* output interrupt callback */
- devcb_write16 m_ioreg_pre_write_cb;
shiftreg_in_cb_delegate m_to_shiftreg_cb; /* shift register write */
shiftreg_out_cb_delegate m_from_shiftreg_cb; /* shift register read */
@@ -1052,14 +1050,13 @@ public:
tms34010_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
/* Reads & writes to the 34010 I/O registers; place at 0xc0000000 */
- virtual void io_register_w(offs_t offset, u16 data, u16 mem_mask = ~u16(0)) override;
- virtual u16 io_register_r(offs_t offset) override;
+ virtual DECLARE_WRITE16_MEMBER( io_register_w ) override;
+ virtual DECLARE_READ16_MEMBER( io_register_r ) override;
protected:
virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const override { return (clocks + 8 - 1) / 8; }
virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const override { return (cycles * 8); }
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
- void internal_regs_map(address_map &map);
};
DECLARE_DEVICE_TYPE(TMS34010, tms34010_device)
@@ -1069,15 +1066,14 @@ class tms34020_device : public tms340x0_device
public:
tms34020_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- /* Reads & writes to the 34020 I/O registers; place at 0xc0000000 */
- virtual void io_register_w(offs_t offset, u16 data, u16 mem_mask = ~u16(0)) override;
- virtual u16 io_register_r(offs_t offset) override;
+ /* Reads & writes to the 34010 I/O registers; place at 0xc0000000 */
+ virtual DECLARE_WRITE16_MEMBER( io_register_w ) override;
+ virtual DECLARE_READ16_MEMBER( io_register_r ) override;
protected:
virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const override { return (clocks + 4 - 1) / 4; }
virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const override { return (cycles * 4); }
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
- void internal_regs_map(address_map &map);
};
DECLARE_DEVICE_TYPE(TMS34020, tms34020_device)
diff --git a/src/devices/cpu/tms9900/tms9900.cpp b/src/devices/cpu/tms9900/tms9900.cpp
index 840fd5d631a..8f092a3159d 100644
--- a/src/devices/cpu/tms9900/tms9900.cpp
+++ b/src/devices/cpu/tms9900/tms9900.cpp
@@ -182,11 +182,11 @@ tms99xx_device::tms99xx_device(const machine_config &mconfig, device_type type,
: cpu_device(mconfig, type, tag, owner, clock),
m_program_config("program", ENDIANNESS_BIG, data_width, prg_addr_bits),
m_setoffset_config("setoffset", ENDIANNESS_BIG, data_width, prg_addr_bits),
- m_io_config("cru", ENDIANNESS_LITTLE, 8, cru_addr_bits + 1, 1),
+ m_io_config("cru", ENDIANNESS_BIG, 8, cru_addr_bits),
m_prgspace(nullptr),
m_cru(nullptr),
m_prgaddr_mask((1<<prg_addr_bits)-1),
- m_cruaddr_mask((2<<cru_addr_bits)-2),
+ m_cruaddr_mask((1<<cru_addr_bits)-1),
m_clock_out_line(*this),
m_wait_line(*this),
m_holda_line(*this),
@@ -1625,70 +1625,67 @@ void tms99xx_device::register_write()
idempotent (i.e. they must not change the state of the queried device).
Read returns the number of consecutive CRU bits, with increasing CRU address
- from the least significant to the most significant bit; right-aligned (in
- other words, little-endian as opposed to the big-endian order of memory words).
+ from the least significant to the most significant bit; right-aligned
There seems to be no handling of wait states during CRU operations on the
TMS9900. The TMS9995, in contrast, respects wait states during the transmission
of each single bit.
- The current emulation of the CRU space involves a 1-bit address shift,
- reflecting the one-to-one correspondence between CRU bits and words (not
- bytes) in the lower part of the memory space. (On the TMS9980A and TMS9995,
- CRUOUT is multiplexed with the least significant address line.) Thus, what
- TI's documentation calls the software address (the R12 base value plus the
- bit offset multiplied by 2) is used in address maps and CPU-side operations.
- MAME's memory architecture automatically translates these to right-justified
- hardware addresses in the process of decoding offsets for read/write handlers,
- which is more typical of what peripheral devices expect. (Note also that
- address spaces do not support data widths narrower than 8 bits, so these
- handlers must specify 8-bit types despite only one bit being useful.)
-
Usage of this method:
CRU write: First bit is at rightmost position of m_value.
*/
void tms99xx_device::cru_input_operation()
{
- offs_t cruaddr = m_cru_address & m_cruaddr_mask;
- uint16_t value = 0;
+ int value, value1;
+ int offset, location;
- for (int i = 0; i < m_count; i++)
- {
- // Poll one bit at a time
- bool cruin = BIT(m_cru->read_byte(cruaddr), 0);
- if (cruin)
- value |= 1 << i;
+ location = (m_cru_address >> 4) & (m_cruaddr_mask>>3);
+ offset = (m_cru_address>>1) & 0x07;
- if (TRACE_CRU) logerror("CRU input operation, address %04x, value %d\n", cruaddr, cruin ? 1 : 0);
+ // Read 8 bits (containing the desired bits)
+ value = m_cru->read_byte(location);
- // Increment the CRU address
- cruaddr = (cruaddr + 2) & m_cruaddr_mask;
+ if ((offset + m_count) > 8) // spans two 8 bit cluster
+ {
+ // Read next 8 bits
+ location = (location + 1) & (m_cruaddr_mask>>3);
+ value1 = m_cru->read_byte(location);
+ value |= (value1 << 8);
- // On each machine cycle (2 clocks) only one CRU bit is transmitted
- pulse_clock(2);
+ if ((offset + m_count) > 16) // spans three 8 bit cluster
+ {
+ // Read next 8 bits
+ location = (location + 1) & (m_cruaddr_mask>>3);
+ value1 = m_cru->read_byte(location);
+ value |= (value1 << 16);
+ }
}
- m_value = value;
+ // On each machine cycle (2 clocks) only one CRU bit is transmitted
+ pulse_clock(m_count<<1);
+
+ // Shift back the bits so that the first bit is at the rightmost place
+ m_value = (value >> offset);
+
+ // Mask out what we want
+ m_value &= (0x0000ffff >> (16-m_count));
}
void tms99xx_device::cru_output_operation()
{
- offs_t cruaddr = m_cru_address & m_cruaddr_mask;
- uint16_t value = m_value;
+ int value;
+ int location;
+ location = (m_cru_address >> 1) & m_cruaddr_mask;
+ value = m_value;
// Write m_count bits from cru_address
- for (int i = 0; i < m_count; i++)
+ for (int i=0; i < m_count; i++)
{
- if (TRACE_CRU) logerror("CRU output operation, address %04x, value %d\n", cruaddr, BIT(value, 0));
-
- // Write one bit at a time
- m_cru->write_byte(cruaddr, BIT(value, 0));
+ if (TRACE_CRU) logerror("CRU output operation, address %04x, value %d\n", location<<1, value & 0x01);
+ m_cru->write_byte(location, (value & 0x01));
value >>= 1;
-
- // Increment the CRU address
- cruaddr = (cruaddr + 2) & m_cruaddr_mask;
-
+ location = (location + 1) & m_cruaddr_mask;
pulse_clock(2);
}
}
@@ -2167,7 +2164,6 @@ void tms99xx_device::alu_clr_swpb()
bool setstatus = true;
bool check_ov = true;
- bool check_c = true;
switch (m_command)
{
@@ -2185,7 +2181,6 @@ void tms99xx_device::alu_clr_swpb()
// LAE
dest_new = ~src_val & 0xffff;
check_ov = false;
- check_c = false;
break;
case NEG:
// LAECO
@@ -2228,7 +2223,7 @@ void tms99xx_device::alu_clr_swpb()
if (setstatus)
{
if (check_ov) set_status_bit(ST_OV, ((src_val & 0x8000)==sign) && ((dest_new & 0x8000)!=sign));
- if (check_c) set_status_bit(ST_C, (dest_new & 0x10000) != 0);
+ set_status_bit(ST_C, (dest_new & 0x10000) != 0);
m_current_value = dest_new & 0xffff;
compare_and_set_lae(m_current_value, 0);
}
@@ -2520,7 +2515,6 @@ void tms99xx_device::alu_shift()
uint16_t sign = 0;
uint32_t value;
int count;
- bool check_ov = false;
switch (m_state)
{
@@ -2578,7 +2572,6 @@ void tms99xx_device::alu_shift()
case SLA:
carry = ((value & 0x8000)!=0);
value <<= 1;
- check_ov = true;
if (carry != ((value&0x8000)!=0)) overflow = true;
break;
case SRC:
@@ -2591,7 +2584,7 @@ void tms99xx_device::alu_shift()
m_current_value = value & 0xffff;
set_status_bit(ST_C, carry);
- if (check_ov) set_status_bit(ST_OV, overflow); // only SLA
+ set_status_bit(ST_OV, overflow);
compare_and_set_lae(m_current_value, 0);
m_address = m_address_saved; // Register address
if (TRACE_STATUS) logerror("ST = %04x (val=%04x)\n", ST, m_current_value);
diff --git a/src/devices/cpu/tms9900/tms9995.cpp b/src/devices/cpu/tms9900/tms9995.cpp
index 09509f4623e..c83f74ac073 100644
--- a/src/devices/cpu/tms9900/tms9995.cpp
+++ b/src/devices/cpu/tms9900/tms9995.cpp
@@ -170,7 +170,7 @@ tms9995_device::tms9995_device(const machine_config &mconfig, device_type type,
PC_debug(0),
m_program_config("program", ENDIANNESS_BIG, 8, 16),
m_setoffset_config("setoffset", ENDIANNESS_BIG, 8, 16),
- m_io_config("cru", ENDIANNESS_LITTLE, 8, 16, 1),
+ m_io_config("cru", ENDIANNESS_BIG, 8, 16),
m_prgspace(nullptr),
m_sospace(nullptr),
m_cru(nullptr),
@@ -288,6 +288,8 @@ void tms9995_device::device_start()
save_item(NAME(m_cru_address));
save_item(NAME(m_cru_value));
save_item(NAME(m_cru_first_read));
+ save_item(NAME(m_cru_bits_left));
+ save_item(NAME(m_cru_read));
save_pointer(NAME(m_flag),16);
save_item(NAME(IR));
save_item(NAME(m_pre_IR));
@@ -1508,13 +1510,10 @@ void tms9995_device::int_prefetch_and_decode()
// If the current command is XOP or BLWP, ignore the interrupt
if (m_command != XOP && m_command != BLWP)
{
- // The actual interrupt trigger is an OR of the latch and of
- // the interrupt line (for INT1 and INT4); see [1],
- // section 2.3.2.1.3
- if ((m_int1_active || m_flag[2]) && intmask >= 1) m_int_pending |= PENDING_LEVEL1;
+ if (m_flag[2] && intmask >= 1) m_int_pending |= PENDING_LEVEL1;
if (m_int_overflow && intmask >= 2) m_int_pending |= PENDING_OVERFLOW;
if (m_flag[3] && intmask >= 3) m_int_pending |= PENDING_DECR;
- if ((m_int4_active || m_flag[4]) && intmask >= 4) m_int_pending |= PENDING_LEVEL4;
+ if (m_flag[4] && intmask >= 4) m_int_pending |= PENDING_LEVEL4;
}
if (m_int_pending!=0)
@@ -1563,7 +1562,7 @@ void tms9995_device::prefetch_and_decode()
m_value_copy = m_current_value;
if (!m_iaq_line.isnull()) m_iaq_line(ASSERT_LINE);
m_address = PC;
- LOGMASKED(LOG_DETAIL, "** Prefetching new instruction at %04x **\n", PC);
+ LOGMASKED(LOG_DETAIL, "**** Prefetching new instruction at %04x ****\n", PC);
}
word_read(); // changes m_mem_phase
@@ -1576,7 +1575,7 @@ void tms9995_device::prefetch_and_decode()
m_current_value = m_value_copy; // restore m_current_value
PC = (PC + 2) & 0xfffe; // advance PC
if (!m_iaq_line.isnull()) m_iaq_line(CLEAR_LINE);
- LOGMASKED(LOG_DETAIL, "++ Prefetch done ++\n");
+ LOGMASKED(LOG_DETAIL, "++++ Prefetch done ++++\n");
}
}
@@ -1689,7 +1688,7 @@ void tms9995_device::service_interrupt()
vectorpos = 0x0008;
m_intmask = 0x0001;
PC = (PC + 2) & 0xfffe;
- LOGMASKED(LOG_INT, "** MID pending\n");
+ LOGMASKED(LOG_INT, "***** MID pending\n");
m_mid_active = false;
}
else
@@ -1699,7 +1698,7 @@ void tms9995_device::service_interrupt()
vectorpos = 0xfffc;
m_int_pending &= ~PENDING_NMI;
m_intmask = 0;
- LOGMASKED(LOG_INT, "** NMI pending\n");
+ LOGMASKED(LOG_INT, "***** NMI pending\n");
}
else
{
@@ -1707,12 +1706,9 @@ void tms9995_device::service_interrupt()
{
vectorpos = 0x0004;
m_int_pending &= ~PENDING_LEVEL1;
- // Latches must be reset when the interrupt is serviced
- // Since the latch is edge-triggered, we should be allowed
- // to clear it right here, without considering the line state
- m_flag[2] = false;
+ if (!m_int1_active) m_flag[2] = false;
m_intmask = 0;
- LOGMASKED(LOG_INT, "** INT1 pending\n");
+ LOGMASKED(LOG_INT, "***** INT1 pending\n");
}
else
{
@@ -1721,7 +1717,7 @@ void tms9995_device::service_interrupt()
vectorpos = 0x0008;
m_int_pending &= ~PENDING_OVERFLOW;
m_intmask = 0x0001;
- LOGMASKED(LOG_INT, "** OVERFL pending\n");
+ LOGMASKED(LOG_INT, "***** OVERFL pending\n");
}
else
{
@@ -1731,16 +1727,15 @@ void tms9995_device::service_interrupt()
m_intmask = 0x0002;
m_int_pending &= ~PENDING_DECR;
m_flag[3] = false;
- LOGMASKED(LOG_DEC, "** DECR pending\n");
+ LOGMASKED(LOG_DEC, "***** DECR pending\n");
}
else
{
vectorpos = 0x0010;
m_intmask = 0x0003;
m_int_pending &= ~PENDING_LEVEL4;
- // See above for clearing the latch
- m_flag[4] = false;
- LOGMASKED(LOG_INT, "** INT4 pending\n");
+ if (!m_int4_active) m_flag[4] = false;
+ LOGMASKED(LOG_INT, "***** INT4 pending\n");
}
}
}
@@ -1748,7 +1743,7 @@ void tms9995_device::service_interrupt()
}
}
- LOGMASKED(LOG_INTD, "*** triggered an interrupt with vector %04x/%04x\n", vectorpos, vectorpos+2);
+ LOGMASKED(LOG_INT, "********* triggered an interrupt with vector %04x/%04x\n", vectorpos, vectorpos+2);
// just for debugging purposes
if (!m_reset) m_log_interrupt = true;
@@ -2085,7 +2080,8 @@ void tms9995_device::return_with_address_copy()
1FDA MID flag (only indication, does not trigger when set)
The TMS9995 allows for wait states during external CRU access. Therefore
- we do iterations for each bit, checking every time for the READY line
+ we read one block of 8 bits in one go (as given by the MESS architecture)
+ but we do iterations for each bit, checking every time for the READY line
in the main loop.
(write)
@@ -2096,8 +2092,8 @@ void tms9995_device::return_with_address_copy()
*/
-#define CRUREADMASK 0xfffe
-#define CRUWRITEMASK 0xfffe
+#define CRUREADMASK 0x0fff
+#define CRUWRITEMASK 0x7fff
void tms9995_device::cru_output_operation()
{
@@ -2133,7 +2129,7 @@ void tms9995_device::cru_output_operation()
// of the CPU. However, no wait states are generated for internal
// accesses. ([1], section 2.3.3.2)
- m_cru->write_byte(m_cru_address & CRUWRITEMASK, (m_cru_value & 0x01));
+ m_cru->write_byte((m_cru_address >> 1)& CRUWRITEMASK, (m_cru_value & 0x01));
m_cru_value >>= 1;
m_cru_address = (m_cru_address + 2) & 0xfffe;
m_count--;
@@ -2154,29 +2150,55 @@ void tms9995_device::cru_output_operation()
void tms9995_device::cru_input_operation()
{
- if (m_cru_first_read)
+ uint16_t crubit;
+ uint8_t crubyte;
+
+ // Reading is different, since MESS uses 8 bit transfers
+ // We read 8 bits in one go, then iterate another min(n-1,7) times to allow
+ // for wait states.
+
+ // read_byte for CRU delivers the first bit on the rightmost position
+
+ int offset = (m_cru_address>>1) & 0x07;
+
+ if (m_cru_first_read || m_cru_bits_left == 0)
{
- m_cru_value = 0;
- m_cru_first_read = false;
- m_pass = m_count;
+ // Read next 8 bits
+ // 00000000 0rrrrrrr r
+ // v
+ // ........ ........ X....... ........
+ //
+ crubyte = m_cru->read_byte((m_cru_address >> 4)& CRUREADMASK);
+ LOGMASKED(LOG_DETAIL, "Need to get next 8 bits (addresses %04x-%04x): %02x\n", (m_cru_address&0xfff0)+14, m_cru_address&0xfff0, crubyte);
+ m_cru_read = crubyte << 15;
+ m_cru_bits_left = 8;
+
+ if (m_cru_first_read)
+ {
+ m_cru_read >>= offset;
+ m_cru_bits_left -= offset;
+ m_cru_value = 0;
+ m_cru_first_read = false;
+ m_pass = m_count;
+ }
+ LOGMASKED(LOG_DETAIL, "adjusted value for shift: %06x\n", m_cru_read);
}
- // Read a single CRU bit
- bool crubit = BIT(m_cru->read_byte(m_cru_address & CRUREADMASK), 0);
+ crubit = (m_cru_read & 0x8000);
m_cru_value = (m_cru_value >> 1) & 0x7fff;
// During internal reading, the CRUIN line will be ignored. We emulate this
// by overwriting the bit which we got from outside. Also, READY is ignored.
if (m_cru_address == 0x1fda)
{
- crubit = m_mid_flag;
+ crubit = m_mid_flag? 0x8000 : 0x0000;
m_check_ready = false;
}
else
{
if ((m_cru_address & 0xffe0)==0x1ee0)
{
- crubit = m_flag[(m_cru_address>>1)&0x000f];
+ crubit = (m_flag[(m_cru_address>>1)&0x000f]==true)? 0x8000 : 0x0000;
m_check_ready = false;
}
else
@@ -2185,14 +2207,18 @@ void tms9995_device::cru_input_operation()
}
}
- LOGMASKED(LOG_CRU, "CRU input operation, address %04x, value %d\n", m_cru_address, crubit ? 1 : 0);
+ LOGMASKED(LOG_CRU, "CRU input operation, address %04x, value %d\n", m_cru_address, (crubit & 0x8000)>>15);
- if (crubit)
- m_cru_value |= 0x8000;
+ m_cru_value |= crubit;
m_cru_address = (m_cru_address + 2) & 0xfffe;
+ m_cru_bits_left--;
- if (m_pass == 1)
+ if (m_pass > 1)
+ {
+ m_cru_read >>= 1;
+ }
+ else
{
// This is the final shift. For both byte and word length transfers,
// the first bit is always m_cru_value & 0x0001.
@@ -3090,7 +3116,6 @@ void tms9995_device::alu_shift()
uint16_t sign = 0;
uint32_t value;
int count;
- bool check_ov = false;
switch (m_inst_state)
{
@@ -3139,7 +3164,6 @@ void tms9995_device::alu_shift()
case SLA:
carry = ((value & 0x8000)!=0);
value <<= 1;
- check_ov = true;
if (carry != ((value&0x8000)!=0)) overflow = true;
break;
case SRC:
@@ -3152,7 +3176,7 @@ void tms9995_device::alu_shift()
m_current_value = value & 0xffff;
set_status_bit(ST_C, carry);
- if (check_ov) set_status_bit(ST_OV, overflow); // only SLA
+ set_status_bit(ST_OV, overflow);
compare_and_set_lae(m_current_value, 0);
m_address = m_address_saved; // Register address
LOGMASKED(LOG_STATUS, "ST = %04x (val=%04x)\n", ST, m_current_value);
@@ -3170,7 +3194,6 @@ void tms9995_device::alu_single_arithm()
uint32_t src_val = m_current_value & 0x0000ffff;
uint16_t sign = 0;
bool check_ov = true;
- bool check_c = true;
switch (m_command)
{
@@ -3221,7 +3244,6 @@ void tms9995_device::alu_single_arithm()
// LAE
dest_new = ~src_val & 0xffff;
check_ov = false;
- check_c = false;
break;
case NEG:
// LAECO
@@ -3249,7 +3271,7 @@ void tms9995_device::alu_single_arithm()
}
if (check_ov) set_status_bit(ST_OV, ((src_val & 0x8000)==sign) && ((dest_new & 0x8000)!=sign));
- if (check_c) set_status_bit(ST_C, (dest_new & 0x10000) != 0);
+ set_status_bit(ST_C, (dest_new & 0x10000) != 0);
m_current_value = dest_new & 0xffff;
compare_and_set_lae(m_current_value, 0);
diff --git a/src/devices/cpu/tms9900/tms9995.h b/src/devices/cpu/tms9900/tms9995.h
index 531e5208a41..72dfc2960a1 100644
--- a/src/devices/cpu/tms9900/tms9995.h
+++ b/src/devices/cpu/tms9900/tms9995.h
@@ -245,6 +245,8 @@ private:
uint16_t m_cru_address;
uint16_t m_cru_value;
bool m_cru_first_read;
+ int m_cru_bits_left;
+ uint32_t m_cru_read;
// CPU-internal CRU flags
bool m_flag[16];
diff --git a/src/devices/cpu/unsp/unsp.cpp b/src/devices/cpu/unsp/unsp.cpp
index 7d1359896af..af964f713f9 100644
--- a/src/devices/cpu/unsp/unsp.cpp
+++ b/src/devices/cpu/unsp/unsp.cpp
@@ -14,41 +14,28 @@
#include "emu.h"
#include "unsp.h"
-#include "unspfe.h"
-
-#include "debugger.h"
-
-#include "unspdefs.h"
#include "unspdasm.h"
+#include "debugger.h"
DEFINE_DEVICE_TYPE(UNSP, unsp_device, "unsp", "SunPlus u'nSP")
-/* size of the execution code cache */
-#define CACHE_SIZE (64 * 1024 * 1024)
unsp_device::unsp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: cpu_device(mconfig, UNSP, tag, owner, clock)
, m_program_config("program", ENDIANNESS_BIG, 16, 23, -1)
+ , m_enable_irq(false)
+ , m_enable_fiq(false)
+ , m_irq(false)
+ , m_fiq(false)
+ , m_curirq(0)
+ , m_sirq(0)
+ , m_sb(0)
, m_program(nullptr)
- , m_core(nullptr)
+ , m_icount(0)
, m_debugger_temp(0)
-#if UNSP_LOG_OPCODES || UNSP_LOG_REGS
+#if UNSP_LOG_OPCODES
, m_log_ops(0)
#endif
- , m_cache(CACHE_SIZE + sizeof(unsp_device))
- , m_drcuml(nullptr)
- , m_drcfe(nullptr)
- , m_drcoptions(0)
- , m_cache_dirty(0)
- , m_entry(nullptr)
- , m_nocode(nullptr)
- , m_out_of_cycles(nullptr)
- , m_check_interrupts(nullptr)
- , m_trigger_fiq(nullptr)
- , m_trigger_irq(nullptr)
- , m_mem_read(nullptr)
- , m_mem_write(nullptr)
- , m_enable_drc(false)
{
}
@@ -64,6 +51,29 @@ std::unique_ptr<util::disasm_interface> unsp_device::create_disassembler()
return std::make_unique<unsp_disassembler>();
}
+
+/*****************************************************************************/
+
+#define OP0 (op >> 12)
+#define OPA ((op >> 9) & 7)
+#define OP1 ((op >> 6) & 7)
+#define OPN ((op >> 3) & 7)
+#define OPB (op & 7)
+#define OPIMM (op & 0x3f)
+
+#define UNSP_LPC (((UNSP_REG(SR) & 0x3f) << 16) | UNSP_REG(PC))
+
+#define UNSP_REG(reg) m_r[UNSP_##reg - 1]
+#define UNSP_REG_I(reg) m_r[reg]
+#define UNSP_LREG_I(reg) (((UNSP_REG(SR) << 6) & 0x3f0000) | UNSP_REG_I(reg))
+
+#define UNSP_N 0x0200
+#define UNSP_Z 0x0100
+#define UNSP_S 0x0080
+#define UNSP_C 0x0040
+
+/*****************************************************************************/
+
void unsp_device::unimplemented_opcode(uint16_t op)
{
fatalerror("UNSP: unknown opcode %04x at %04x\n", op, UNSP_LPC);
@@ -78,9 +88,6 @@ uint16_t unsp_device::read16(uint32_t address)
void unsp_device::write16(uint32_t address, uint16_t data)
{
-#if UNSP_LOG_REGS
- log_write(address, data);
-#endif
m_program->write_word(address, data);
}
@@ -88,141 +95,60 @@ void unsp_device::write16(uint32_t address, uint16_t data)
void unsp_device::device_start()
{
- m_core = (internal_unsp_state *)m_cache.alloc_near(sizeof(internal_unsp_state));
- memset(m_core, 0, sizeof(internal_unsp_state));
-
-#if ENABLE_UNSP_DRC
- m_enable_drc = allow_drc();
-#else
- m_enable_drc = false;
-#endif
-
-#if UNSP_LOG_REGS
- if (m_enable_drc)
- m_log_file = fopen("unsp_drc.bin", "wb");
- else
- m_log_file = fopen("unsp_interp.bin", "wb");
-#endif
-
+ memset(m_r, 0, sizeof(uint16_t) * 16);
+ m_enable_irq = false;
+ m_enable_fiq = false;
+ m_irq = false;
+ m_fiq = false;
+ m_curirq = 0;
+ m_sirq = 0;
+ m_sb = 0;
+ memset(m_saved_sb, 0, sizeof(uint8_t) * 3);
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); };
-
- uint32_t umlflags = 0;
- m_drcuml = std::make_unique<drcuml_state>(*this, m_cache, umlflags, 1, 23, 0);
-
- // add UML symbols-
- m_drcuml->symbol_add(&m_core->m_r[REG_SP], sizeof(uint32_t), "SP");
- m_drcuml->symbol_add(&m_core->m_r[REG_R1], sizeof(uint32_t), "R1");
- m_drcuml->symbol_add(&m_core->m_r[REG_R2], sizeof(uint32_t), "R2");
- m_drcuml->symbol_add(&m_core->m_r[REG_R3], sizeof(uint32_t), "R3");
- m_drcuml->symbol_add(&m_core->m_r[REG_R4], sizeof(uint32_t), "R4");
- m_drcuml->symbol_add(&m_core->m_r[REG_BP], sizeof(uint32_t), "BP");
- m_drcuml->symbol_add(&m_core->m_r[REG_SR], sizeof(uint32_t), "SR");
- m_drcuml->symbol_add(&m_core->m_r[REG_PC], sizeof(uint32_t), "PC");
- m_drcuml->symbol_add(&m_core->m_enable_irq, sizeof(uint32_t), "IRQE");
- m_drcuml->symbol_add(&m_core->m_enable_fiq, sizeof(uint32_t), "FIQE");
- m_drcuml->symbol_add(&m_core->m_irq, sizeof(uint32_t), "IRQ");
- m_drcuml->symbol_add(&m_core->m_fiq, sizeof(uint32_t), "FIQ");
- m_drcuml->symbol_add(&m_core->m_sb, sizeof(uint32_t), "SB");
- m_drcuml->symbol_add(&m_core->m_icount, sizeof(m_core->m_icount), "icount");
-
- /* initialize the front-end helper */
- m_drcfe = std::make_unique<unsp_frontend>(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE);
-
- /* mark the cache dirty so it is updated on next execute */
- m_cache_dirty = true;
-
- // register our state for the debugger
- state_add(STATE_GENFLAGS, "GENFLAGS", m_core->m_r[REG_SR]).callimport().callexport().formatstr("%4s").noshow();
- state_add(UNSP_SP, "SP", m_core->m_r[REG_SP]).formatstr("%04X");
- state_add(UNSP_R1, "R1", m_core->m_r[REG_R1]).formatstr("%04X");
- state_add(UNSP_R2, "R2", m_core->m_r[REG_R2]).formatstr("%04X");
- state_add(UNSP_R3, "R3", m_core->m_r[REG_R3]).formatstr("%04X");
- state_add(UNSP_R4, "R4", m_core->m_r[REG_R4]).formatstr("%04X");
- state_add(UNSP_BP, "BP", m_core->m_r[REG_BP]).formatstr("%04X");
- state_add(UNSP_SR, "SR", m_core->m_r[REG_SR]).formatstr("%04X");
+
+ state_add(STATE_GENFLAGS, "GENFLAGS", UNSP_REG(SR)).callimport().callexport().formatstr("%4s").noshow();
+ state_add(UNSP_SP, "SP", UNSP_REG(SP)).formatstr("%04X");
+ state_add(UNSP_R1, "R1", UNSP_REG(R1)).formatstr("%04X");
+ state_add(UNSP_R2, "R2", UNSP_REG(R2)).formatstr("%04X");
+ state_add(UNSP_R3, "R3", UNSP_REG(R3)).formatstr("%04X");
+ state_add(UNSP_R4, "R4", UNSP_REG(R4)).formatstr("%04X");
+ state_add(UNSP_BP, "BP", UNSP_REG(BP)).formatstr("%04X");
+ state_add(UNSP_SR, "SR", UNSP_REG(SR)).formatstr("%04X");
state_add(UNSP_PC, "PC", m_debugger_temp).callimport().callexport().formatstr("%06X");
- state_add(UNSP_IRQ_EN, "IRQE", m_core->m_enable_irq).formatstr("%1u");
- state_add(UNSP_FIQ_EN, "FIQE", m_core->m_enable_fiq).formatstr("%1u");
- state_add(UNSP_IRQ, "IRQ", m_core->m_irq).formatstr("%1u");
- state_add(UNSP_FIQ, "FIQ", m_core->m_fiq).formatstr("%1u");
- state_add(UNSP_SB, "SB", m_core->m_sb).formatstr("%1u");
-#if UNSP_LOG_OPCODES || UNSP_LOG_REGS
+ state_add(UNSP_IRQ_EN, "IRQE", m_enable_irq).formatstr("%1u");
+ state_add(UNSP_FIQ_EN, "FIQE", m_enable_fiq).formatstr("%1u");
+ state_add(UNSP_IRQ, "IRQ", m_irq).formatstr("%1u");
+ state_add(UNSP_FIQ, "FIQ", m_fiq).formatstr("%1u");
+ state_add(UNSP_SB, "SB", m_sb).formatstr("%1u");
+#if UNSP_LOG_OPCODES
state_add(UNSP_LOG_OPS,"LOG", m_log_ops).formatstr("%1u");
#endif
state_add(STATE_GENPC, "GENPC", m_debugger_temp).callexport().noshow();
state_add(STATE_GENPCBASE, "CURPC", m_debugger_temp).callexport().noshow();
- save_item(NAME(m_core->m_r));
- save_item(NAME(m_core->m_enable_irq));
- save_item(NAME(m_core->m_enable_fiq));
- save_item(NAME(m_core->m_irq));
- save_item(NAME(m_core->m_fiq));
- save_item(NAME(m_core->m_curirq));
- save_item(NAME(m_core->m_sirq));
- save_item(NAME(m_core->m_sb));
- save_item(NAME(m_core->m_saved_sb));
-
- set_icountptr(m_core->m_icount);
-}
-
-void unsp_device::device_reset()
-{
- memset(m_core->m_r, 0, sizeof(uint32_t) * 8);
-
- m_core->m_r[REG_PC] = read16(0xfff7);
- m_core->m_enable_irq = 0;
- m_core->m_enable_fiq = 0;
- m_core->m_irq = 0;
- m_core->m_fiq = 0;
+ set_icountptr(m_icount);
+
+ save_item(NAME(m_r));
+ save_item(NAME(m_enable_irq));
+ save_item(NAME(m_enable_fiq));
+ save_item(NAME(m_irq));
+ save_item(NAME(m_fiq));
+ save_item(NAME(m_curirq));
+ save_item(NAME(m_sirq));
+ save_item(NAME(m_sb));
+ save_item(NAME(m_saved_sb));
}
-void unsp_device::device_stop()
-{
- if (m_drcfe != nullptr)
- {
- m_drcfe = nullptr;
- }
- if (m_drcuml != nullptr)
- {
- m_drcuml = nullptr;
- }
-#if UNSP_LOG_REGS
- fclose(m_log_file);
-#endif
-}
-
-#if UNSP_LOG_REGS
-void unsp_device::log_regs()
-{
- if (m_log_ops == 0)
- return;
- fwrite(m_core->m_r, sizeof(uint32_t), 8, m_log_file);
- fwrite(&m_core->m_sb, sizeof(uint32_t), 1, m_log_file);
- fwrite(&m_core->m_icount, sizeof(uint32_t), 1, m_log_file);
-}
-
-void unsp_device::log_write(uint32_t addr, uint32_t data)
-{
- addr |= 0x80000000;
- fwrite(&addr, sizeof(uint32_t), 1, m_log_file);
- fwrite(&data, sizeof(uint32_t), 1, m_log_file);
-}
-
-#endif
-
void unsp_device::state_string_export(const device_state_entry &entry, std::string &str) const
{
switch (entry.index())
{
case STATE_GENFLAGS:
{
- const uint16_t sr = m_core->m_r[REG_SR];
+ const uint16_t sr = UNSP_REG(SR);
str = string_format("%c%c%c%c", (sr & UNSP_N) ? 'N' : ' ', (sr & UNSP_Z) ? 'Z' : ' ', (sr & UNSP_S) ? 'S' : ' ', (sr & UNSP_C) ? 'C' : ' ');
}
}
@@ -245,91 +171,105 @@ void unsp_device::state_import(const device_state_entry &entry)
switch (entry.index())
{
case UNSP_PC:
- m_core->m_r[REG_PC] = m_debugger_temp & 0x0000ffff;
- m_core->m_r[REG_SR] = (m_core->m_r[REG_SR] & 0xffc0) | ((m_debugger_temp & 0x003f0000) >> 16);
+ UNSP_REG(PC) = m_debugger_temp & 0x0000ffff;
+ UNSP_REG(SR) = (UNSP_REG(SR) & 0xffc0) | ((m_debugger_temp & 0x003f0000) >> 16);
break;
}
}
-/*****************************************************************************/
-
-void unsp_device::update_nzsc(uint32_t value, uint16_t r0, uint16_t r1)
+void unsp_device::device_reset()
{
- m_core->m_r[REG_SR] &= ~(UNSP_N | UNSP_Z | UNSP_S | UNSP_C);
- if (int16_t(r0) < int16_t(~r1))
- m_core->m_r[REG_SR] |= UNSP_S;
- if (BIT(value, 15))
- m_core->m_r[REG_SR] |= UNSP_N;
- if((uint16_t)value == 0)
- m_core->m_r[REG_SR] |= UNSP_Z;
- if (BIT(value, 16))
- m_core->m_r[REG_SR] |= UNSP_C;
+ memset(m_r, 0, sizeof(uint16_t) * 16);
+
+ UNSP_REG(PC) = read16(0xfff7);
+ m_enable_irq = false;
+ m_enable_fiq = false;
+ m_irq = false;
+ m_fiq = false;
}
+/*****************************************************************************/
+
void unsp_device::update_nz(uint32_t value)
{
- m_core->m_r[REG_SR] &= ~(UNSP_N | UNSP_Z);
+ UNSP_REG(SR) &= ~(UNSP_N | UNSP_Z);
if(value & 0x8000)
- m_core->m_r[REG_SR] |= UNSP_N;
+ {
+ UNSP_REG(SR) |= UNSP_N;
+ }
if((uint16_t)value == 0)
- m_core->m_r[REG_SR] |= UNSP_Z;
+ {
+ UNSP_REG(SR) |= UNSP_Z;
+ }
+}
+
+void unsp_device::update_sc(uint32_t value, uint16_t r0, uint16_t r1)
+{
+ UNSP_REG(SR) &= ~(UNSP_C | UNSP_S);
+ if(value != (uint16_t)value)
+ {
+ UNSP_REG(SR) |= UNSP_C;
+ }
+
+ if((int16_t)r0 < (int16_t)r1)
+ {
+ UNSP_REG(SR) |= UNSP_S;
+ }
}
-void unsp_device::push(uint32_t value, uint32_t *reg)
+void unsp_device::push(uint16_t value, uint16_t *reg)
{
- write16(*reg, (uint16_t)value);
- *reg = (uint16_t)(*reg - 1);
+ write16((*reg)--, value);
}
-uint16_t unsp_device::pop(uint32_t *reg)
+uint16_t unsp_device::pop(uint16_t *reg)
{
- *reg = (uint16_t)(*reg + 1);
- return (uint16_t)read16(*reg);
+ return read16(++(*reg));
}
void unsp_device::trigger_fiq()
{
- if (!m_core->m_enable_fiq || m_core->m_fiq || m_core->m_irq)
+ if (!m_enable_fiq || m_fiq || m_irq)
{
return;
}
- m_core->m_fiq = 1;
+ m_fiq = true;
- m_core->m_saved_sb[m_core->m_irq ? 1 : 0] = m_core->m_sb;
- m_core->m_sb = m_core->m_saved_sb[2];
+ m_saved_sb[m_irq ? 1 : 0] = m_sb;
+ m_sb = m_saved_sb[2];
- push(m_core->m_r[REG_PC], &m_core->m_r[REG_SP]);
- push(m_core->m_r[REG_SR], &m_core->m_r[REG_SP]);
- m_core->m_r[REG_PC] = read16(0xfff6);
- m_core->m_r[REG_SR] = 0;
+ push(UNSP_REG(PC), &UNSP_REG(SP));
+ push(UNSP_REG(SR), &UNSP_REG(SP));
+ UNSP_REG(PC) = read16(0xfff6);
+ UNSP_REG(SR) = 0;
}
void unsp_device::trigger_irq(int line)
{
- if (!m_core->m_enable_irq || m_core->m_irq || m_core->m_fiq)
+ if (!m_enable_irq || m_irq || m_fiq)
return;
- m_core->m_irq = 1;
+ m_irq = true;
- m_core->m_saved_sb[0] = m_core->m_sb;
- m_core->m_sb = m_core->m_saved_sb[1];
+ m_saved_sb[0] = m_sb;
+ m_sb = m_saved_sb[1];
- push(m_core->m_r[REG_PC], &m_core->m_r[REG_SP]);
- push(m_core->m_r[REG_SR], &m_core->m_r[REG_SP]);
- m_core->m_r[REG_PC] = read16(0xfff8 + line);
- m_core->m_r[REG_SR] = 0;
+ push(UNSP_REG(PC), &UNSP_REG(SP));
+ push(UNSP_REG(SR), &UNSP_REG(SP));
+ UNSP_REG(PC) = read16(0xfff8 + line);
+ UNSP_REG(SR) = 0;
}
void unsp_device::check_irqs()
{
- if (!m_core->m_sirq)
+ if (!m_sirq)
return;
int highest_irq = -1;
for (int i = 0; i <= 8; i++)
{
- if (BIT(m_core->m_sirq, i))
+ if (BIT(m_sirq, i))
{
highest_irq = i;
break;
@@ -345,9 +285,9 @@ void unsp_device::check_irqs()
void unsp_device::add_lpc(const int32_t offset)
{
const uint32_t new_lpc = UNSP_LPC + offset;
- m_core->m_r[REG_PC] = (uint16_t)new_lpc;
- m_core->m_r[REG_SR] &= 0xffc0;
- m_core->m_r[REG_SR] |= (new_lpc >> 16) & 0x3f;
+ UNSP_REG(PC) = (uint16_t)new_lpc;
+ UNSP_REG(SR) &= 0xffc0;
+ UNSP_REG(SR) |= (new_lpc >> 16) & 0x3f;
}
inline void unsp_device::execute_one(const uint16_t op)
@@ -357,154 +297,147 @@ inline void unsp_device::execute_one(const uint16_t op)
uint16_t r1 = 0;
uint32_t r2 = 0;
- const uint16_t op0 = (op >> 12) & 15;
- const uint16_t opa = (op >> 9) & 7;
- const uint16_t op1 = (op >> 6) & 7;
- const uint16_t opn = (op >> 3) & 7;
- const uint16_t opb = op & 7;
-
- const uint8_t lower_op = (op1 << 4) | op0;
+ const uint8_t lower_op = (OP1 << 4) | OP0;
- if(op0 < 0xf && opa == 0x7 && op1 < 2)
+ if(OP0 < 0xf && OPA == 0x7 && OP1 < 2)
{
- const uint32_t opimm = op & 0x3f;
- switch(op0)
+ switch(OP0)
{
case 0: // JB
- if(!(m_core->m_r[REG_SR] & UNSP_C))
+ if(!(UNSP_REG(SR) & UNSP_C))
{
- m_core->m_icount -= 4;
- add_lpc((op1 == 0) ? opimm : (0 - opimm));
+ m_icount -= 4;
+ add_lpc((OP1 == 0) ? OPIMM : (0 - OPIMM));
}
else
{
- m_core->m_icount -= 2;
+ m_icount -= 2;
}
return;
case 1: // JAE
- if(m_core->m_r[REG_SR] & UNSP_C)
+ if(UNSP_REG(SR) & UNSP_C)
{
- m_core->m_icount -= 4;
- add_lpc((op1 == 0) ? opimm : (0 - opimm));
+ m_icount -= 4;
+ add_lpc((OP1 == 0) ? OPIMM : (0 - OPIMM));
}
else
{
- m_core->m_icount -= 2;
+ m_icount -= 2;
}
return;
case 2: // JGE
- if(!(m_core->m_r[REG_SR] & UNSP_S))
+ if(!(UNSP_REG(SR) & UNSP_S))
{
- m_core->m_icount -= 4;
- add_lpc((op1 == 0) ? opimm : (0 - opimm));
+ m_icount -= 4;
+ add_lpc((OP1 == 0) ? OPIMM : (0 - OPIMM));
}
else
{
- m_core->m_icount -= 2;
+ m_icount -= 2;
}
return;
case 3: // JL
- if(m_core->m_r[REG_SR] & UNSP_S)
+ if(UNSP_REG(SR) & UNSP_S)
{
- m_core->m_icount -= 4;
- add_lpc((op1 == 0) ? opimm : (0 - opimm));
+ m_icount -= 4;
+ add_lpc((OP1 == 0) ? OPIMM : (0 - OPIMM));
}
else
{
- m_core->m_icount -= 2;
+ m_icount -= 2;
}
return;
case 4: // JNE
- if(!(m_core->m_r[REG_SR] & UNSP_Z))
+ if(!(UNSP_REG(SR) & UNSP_Z))
{
- m_core->m_icount -= 4;
- add_lpc((op1 == 0) ? opimm : (0 - opimm));
+ m_icount -= 4;
+ add_lpc((OP1 == 0) ? OPIMM : (0 - OPIMM));
}
else
{
- m_core->m_icount -= 2;
+ m_icount -= 2;
}
return;
case 5: // JE
- if(m_core->m_r[REG_SR] & UNSP_Z)
+ if(UNSP_REG(SR) & UNSP_Z)
{
- m_core->m_icount -= 4;
- add_lpc((op1 == 0) ? opimm : (0 - opimm));
+ m_icount -= 4;
+ add_lpc((OP1 == 0) ? OPIMM : (0 - OPIMM));
}
else
{
- m_core->m_icount -= 2;
+ m_icount -= 2;
}
return;
case 6: // JPL
- if(!(m_core->m_r[REG_SR] & UNSP_N))
+ if(!(UNSP_REG(SR) & UNSP_N))
{
- m_core->m_icount -= 4;
- add_lpc((op1 == 0) ? opimm : (0 - opimm));
+ m_icount -= 4;
+ add_lpc((OP1 == 0) ? OPIMM : (0 - OPIMM));
}
else
{
- m_core->m_icount -= 2;
+ m_icount -= 2;
}
return;
case 7: // JMI
- if(m_core->m_r[REG_SR] & UNSP_N)
+ if(UNSP_REG(SR) & UNSP_N)
{
- m_core->m_icount -= 4;
- add_lpc((op1 == 0) ? opimm : (0 - opimm));
+ m_icount -= 4;
+ add_lpc((OP1 == 0) ? OPIMM : (0 - OPIMM));
}
else
{
- m_core->m_icount -= 2;
+ m_icount -= 2;
}
return;
case 8: // JBE
- if((m_core->m_r[REG_SR] & (UNSP_Z | UNSP_C)) != UNSP_C) // branch if (!UNSP_Z && !UNSP_C) || UNSP_Z
+ if((UNSP_REG(SR) & (UNSP_Z | UNSP_C)) != UNSP_C)
{
- m_core->m_icount -= 4;
- add_lpc((op1 == 0) ? opimm : (0 - opimm));
+ m_icount -= 4;
+ add_lpc((OP1 == 0) ? OPIMM : (0 - OPIMM));
}
else
{
- m_core->m_icount -= 2;
+ m_icount -= 2;
}
return;
case 9: // JA
- if((m_core->m_r[REG_SR] & (UNSP_Z | UNSP_C)) == UNSP_C) // branch if !UNSP_Z && UNSP_C
+ if((UNSP_REG(SR) & (UNSP_Z | UNSP_C)) == UNSP_C)
{
- m_core->m_icount -= 4;
- add_lpc((op1 == 0) ? opimm : (0 - opimm));
+ m_icount -= 4;
+ add_lpc((OP1 == 0) ? OPIMM : (0 - OPIMM));
}
else
{
- m_core->m_icount -= 2;
+ m_icount -= 2;
}
return;
case 10: // JLE
- if(m_core->m_r[REG_SR] & (UNSP_Z | UNSP_S))
+ if(UNSP_REG(SR) & (UNSP_Z | UNSP_S))
{
- m_core->m_icount -= 4;
- add_lpc((op1 == 0) ? opimm : (0 - opimm));
+ m_icount -= 4;
+ add_lpc((OP1 == 0) ? OPIMM : (0 - OPIMM));
}
else
{
- m_core->m_icount -= 2;
+ m_icount -= 2;
}
return;
case 11: // JG
- if(!(m_core->m_r[REG_SR] & (UNSP_Z | UNSP_S)))
+ if(!(UNSP_REG(SR) & (UNSP_Z | UNSP_S)))
{
- m_core->m_icount -= 4;
- add_lpc((op1 == 0) ? opimm : (0 - opimm));
+ m_icount -= 4;
+ add_lpc((OP1 == 0) ? OPIMM : (0 - OPIMM));
}
else
{
- m_core->m_icount -= 2;
+ m_icount -= 2;
}
return;
case 14: // JMP
- add_lpc((op1 == 0) ? opimm : (0 - opimm));
- m_core->m_icount -= 4;
+ add_lpc((OP1 == 0) ? OPIMM : (0 - OPIMM));
+ m_icount -= 4;
return;
default:
unimplemented_opcode(op);
@@ -513,68 +446,69 @@ inline void unsp_device::execute_one(const uint16_t op)
}
else if (lower_op == 0x2d) // Push
{
- r0 = opn;
- r1 = opa;
- m_core->m_icount -= 4 + 2 * r0;
+ r0 = OPN;
+ r1 = OPA;
+ m_icount -= 4 + 2 * r0;
while (r0--)
{
- push(m_core->m_r[r1--], &m_core->m_r[opb]);
+ push(UNSP_REG_I(r1--), &UNSP_REG_I(OPB));
}
return;
}
- else if (lower_op == 0x29)
+ else if (lower_op == 0x29) // Pop
{
if (op == 0x9a98) // reti
{
- m_core->m_icount -= 8;
- m_core->m_r[REG_SR] = pop(&m_core->m_r[REG_SP]);
- m_core->m_r[REG_PC] = pop(&m_core->m_r[REG_SP]);
+ m_icount -= 8;
+ UNSP_REG(SR) = pop(&UNSP_REG(SP));
+ UNSP_REG(PC) = pop(&UNSP_REG(SP));
- if(m_core->m_fiq)
+ if(m_fiq)
{
- m_core->m_fiq = 0;
- m_core->m_saved_sb[2] = m_core->m_sb;
- m_core->m_sb = m_core->m_saved_sb[m_core->m_irq ? 1 : 0];
+ m_fiq = false;
+ m_saved_sb[2] = m_sb;
+ m_sb = m_saved_sb[m_irq ? 1 : 0];
}
- else if(m_core->m_irq)
+ else if(m_irq)
{
- m_core->m_irq = 0;
- m_core->m_saved_sb[1] = m_core->m_sb;
- m_core->m_sb = m_core->m_saved_sb[0];
+ m_irq = false;
+ m_saved_sb[1] = m_sb;
+ m_sb = m_saved_sb[0];
}
- m_core->m_curirq = 0;
+ m_curirq = 0;
+
check_irqs();
return;
}
- else // pop
+ else
{
- r0 = opn;
- r1 = opa;
- m_core->m_icount -= 4 + 2 * r0;
+ r0 = OPN;
+ r1 = OPA;
+ m_icount -= 4 + 2 * r0;
while (r0--)
{
- m_core->m_r[++r1] = pop(&m_core->m_r[opb]);
+ UNSP_REG_I(++r1) = pop(&UNSP_REG_I(OPB));
}
return;
}
}
- else if (op0 == 0xf)
+ else if (OP0 == 0xf)
{
- switch (op1)
+ switch (OP1)
{
case 0x00: // Multiply, Unsigned * Signed
- if(opn == 1 && opa != 7)
+ if(OPN == 1 && OPA != 7)
{
- m_core->m_icount -= 12;
- lres = m_core->m_r[opa] * m_core->m_r[opb];
- if(m_core->m_r[opb] & 0x8000)
+ m_icount -= 12;
+ lres = UNSP_REG_I(OPA) * UNSP_REG_I(OPB);
+ if(UNSP_REG_I(OPB) & 0x8000)
{
- lres -= m_core->m_r[opa] << 16;
+ lres -= UNSP_REG_I(OPA) << 16;
}
- m_core->m_r[REG_R4] = lres >> 16;
- m_core->m_r[REG_R3] = (uint16_t)lres;
+ UNSP_REG(R4) = lres >> 16;
+ UNSP_REG(R3) = (uint16_t)lres;
}
else
{
@@ -583,16 +517,16 @@ inline void unsp_device::execute_one(const uint16_t op)
return;
case 0x01: // Call
- if(!(opa & 1))
+ if(!(OPA & 1))
{
- m_core->m_icount -= 9;
+ m_icount -= 9;
r1 = read16(UNSP_LPC);
add_lpc(1);
- push(m_core->m_r[REG_PC], &m_core->m_r[REG_SP]);
- push(m_core->m_r[REG_SR], &m_core->m_r[REG_SP]);
- m_core->m_r[REG_PC] = r1;
- m_core->m_r[REG_SR] &= 0xffc0;
- m_core->m_r[REG_SR] |= op & 0x3f;
+ push(UNSP_REG(PC), &UNSP_REG(SP));
+ push(UNSP_REG(SR), &UNSP_REG(SP));
+ UNSP_REG(PC) = r1;
+ UNSP_REG(SR) &= 0xffc0;
+ UNSP_REG(SR) |= OPIMM;
}
else
{
@@ -601,12 +535,12 @@ inline void unsp_device::execute_one(const uint16_t op)
return;
case 0x02: // Far Jump
- if (opa == 7)
+ if (OPA == 7)
{
- m_core->m_icount -= 5;
- m_core->m_r[REG_PC] = read16(UNSP_LPC);
- m_core->m_r[REG_SR] &= 0xffc0;
- m_core->m_r[REG_SR] |= op & 0x3f;
+ m_icount -= 5;
+ UNSP_REG(PC) = read16(UNSP_LPC);
+ UNSP_REG(SR) &= 0xffc0;
+ UNSP_REG(SR) |= OPIMM;
}
else
{
@@ -615,20 +549,20 @@ inline void unsp_device::execute_one(const uint16_t op)
return;
case 0x04: // Multiply, Signed * Signed
- if(opn == 1 && opa != 7)
+ if(OPN == 1 && OPA != 7)
{
- m_core->m_icount -= 12;
- lres = m_core->m_r[opa] * m_core->m_r[opb];
- if(m_core->m_r[opb] & 0x8000)
+ m_icount -= 12;
+ lres = UNSP_REG_I(OPA) * UNSP_REG_I(OPB);
+ if(UNSP_REG_I(OPB) & 0x8000)
{
- lres -= m_core->m_r[opa] << 16;
+ lres -= UNSP_REG_I(OPA) << 16;
}
- if(m_core->m_r[opa] & 0x8000)
+ if(UNSP_REG_I(OPA) & 0x8000)
{
- lres -= m_core->m_r[opb] << 16;
+ lres -= UNSP_REG_I(OPB) << 16;
}
- m_core->m_r[REG_R4] = lres >> 16;
- m_core->m_r[REG_R3] = (uint16_t)lres;
+ UNSP_REG(R4) = lres >> 16;
+ UNSP_REG(R3) = (uint16_t)lres;
}
else
{
@@ -637,36 +571,36 @@ inline void unsp_device::execute_one(const uint16_t op)
return;
case 0x05: // Interrupt flags
- m_core->m_icount -= 2;
- switch(op & 0x3f)
+ m_icount -= 2;
+ switch(OPIMM)
{
case 0:
- m_core->m_enable_irq = 0;
- m_core->m_enable_fiq = 0;
+ m_enable_irq = false;
+ m_enable_fiq = false;
break;
case 1:
- m_core->m_enable_irq = 1;
- m_core->m_enable_fiq = 0;
+ m_enable_irq = true;
+ m_enable_fiq = false;
break;
case 2:
- m_core->m_enable_irq = 0;
- m_core->m_enable_fiq = 1;
+ m_enable_irq = false;
+ m_enable_fiq = true;
break;
case 3:
- m_core->m_enable_irq = 1;
- m_core->m_enable_fiq = 1;
+ m_enable_irq = true;
+ m_enable_fiq = true;
break;
case 8: // irq off
- m_core->m_enable_irq = 0;
+ m_enable_irq = false;
break;
case 9: // irq on
- m_core->m_enable_irq = 1;
+ m_enable_irq = true;
break;
case 12: // fiq off
- m_core->m_enable_fiq = 0;
+ m_enable_fiq = false;
break;
case 14: // fiq on
- m_core->m_enable_fiq = 1;
+ m_enable_fiq = true;
break;
case 37: // nop
break;
@@ -684,61 +618,65 @@ inline void unsp_device::execute_one(const uint16_t op)
// At this point, we should be dealing solely with ALU ops.
- r0 = m_core->m_r[opa];
+ r0 = UNSP_REG_I(OPA);
- switch (op1)
+ switch (OP1)
{
case 0x00: // r, [bp+imm6]
- m_core->m_icount -= 6;
+ m_icount -= 6;
- r2 = (uint16_t)(m_core->m_r[REG_BP] + (op & 0x3f));
- if (op0 != 0x0d)
+ r2 = (uint16_t)(UNSP_REG(BP) + OPIMM);
+ if (OP0 != 0x0d)
r1 = read16(r2);
break;
case 0x01: // r, imm6
- m_core->m_icount -= 2;
+ m_icount -= 2;
- r1 = op & 0x3f;
+ r1 = OPIMM;
break;
case 0x03: // Indirect
{
- m_core->m_icount -= (opa == 7 ? 7 : 6);
+ m_icount -= 6;
+ if (OPA == 7)
+ {
+ m_icount -= 1;
+ }
- const uint8_t lsbits = opn & 3;
- if (opn & 4)
+ const uint8_t lsbits = OPN & 3;
+ const uint8_t opb = OPB;
+ if (OPN & 4)
{
switch (lsbits)
{
- case 0: // r, [<ds:>r]
+ case 0: // r, [r]
r2 = UNSP_LREG_I(opb);
- if (op0 != 0x0d)
+ if (OP0 != 0x0d)
r1 = read16(r2);
break;
-
case 1: // r, [<ds:>r--]
r2 = UNSP_LREG_I(opb);
- if (op0 != 0x0d)
+ if (OP0 != 0x0d)
r1 = read16(r2);
- m_core->m_r[opb] = (uint16_t)(m_core->m_r[opb] - 1);
- if (m_core->m_r[opb] == 0xffff)
- m_core->m_r[REG_SR] -= 0x0400;
+ UNSP_REG_I(opb)--;
+ if (UNSP_REG_I(opb) == 0xffff)
+ UNSP_REG(SR) -= 0x0400;
break;
case 2: // r, [<ds:>r++]
r2 = UNSP_LREG_I(opb);
- if (op0 != 0x0d)
+ if (OP0 != 0x0d)
r1 = read16(r2);
- m_core->m_r[opb] = (uint16_t)(m_core->m_r[opb] + 1);
- if (m_core->m_r[opb] == 0x0000)
- m_core->m_r[REG_SR] += 0x0400;
+ UNSP_REG_I(opb)++;
+ if (UNSP_REG_I(opb) == 0x0000)
+ UNSP_REG(SR) += 0x0400;
break;
case 3: // r, [<ds:>++r]
- m_core->m_r[opb] = (uint16_t)(m_core->m_r[opb] + 1);
- if (m_core->m_r[opb] == 0x0000)
- m_core->m_r[REG_SR] += 0x0400;
+ UNSP_REG_I(opb)++;
+ if (UNSP_REG_I(opb) == 0x0000)
+ UNSP_REG(SR) += 0x0400;
r2 = UNSP_LREG_I(opb);
- if (op0 != 0x0d)
+ if (OP0 != 0x0d)
r1 = read16(r2);
break;
default:
@@ -750,26 +688,26 @@ inline void unsp_device::execute_one(const uint16_t op)
switch (lsbits)
{
case 0: // r, [r]
- r2 = m_core->m_r[opb];
- if (op0 != 0x0d)
+ r2 = UNSP_REG_I(opb);
+ if (OP0 != 0x0d)
r1 = read16(r2);
break;
case 1: // r, [r--]
- r2 = m_core->m_r[opb];
- if (op0 != 0x0d)
+ r2 = UNSP_REG_I(opb);
+ if (OP0 != 0x0d)
r1 = read16(r2);
- m_core->m_r[opb] = (uint16_t)(m_core->m_r[opb] - 1);
+ UNSP_REG_I(opb)--;
break;
case 2: // r, [r++]
- r2 = m_core->m_r[opb];
- if (op0 != 0x0d)
+ r2 = UNSP_REG_I(opb);
+ if (OP0 != 0x0d)
r1 = read16(r2);
- m_core->m_r[opb] = (uint16_t)(m_core->m_r[opb] + 1);
+ UNSP_REG_I(opb)++;
break;
case 3: // r, [++r]
- m_core->m_r[opb] = (uint16_t)(m_core->m_r[opb] + 1);
- r2 = m_core->m_r[opb];
- if (op0 != 0x0d)
+ UNSP_REG_I(opb)++;
+ r2 = UNSP_REG_I(opb);
+ if (OP0 != 0x0d)
r1 = read16(r2);
break;
default:
@@ -780,48 +718,73 @@ inline void unsp_device::execute_one(const uint16_t op)
}
case 0x04: // 16-bit ops
- switch (opn)
+ switch (OPN)
{
case 0x00: // r
- m_core->m_icount -= (opa == 7 ? 5 : 3);
- r1 = m_core->m_r[opb];
+ m_icount -= 3;
+ if (OPA == 7)
+ {
+ m_icount -= 2;
+ }
+
+ r1 = UNSP_REG_I(OPB);
break;
case 0x01: // imm16
- m_core->m_icount -= (opa == 7 ? 5 : 4);
- r0 = m_core->m_r[opb];
+ m_icount -= 4;
+ if (OPA == 7)
+ {
+ m_icount -= 1;
+ }
+
+ r0 = UNSP_REG_I(OPB);
r1 = read16(UNSP_LPC);
add_lpc(1);
break;
case 0x02: // [imm16]
- m_core->m_icount -= (opa == 7 ? 8 : 7);
- r0 = m_core->m_r[opb];
+ m_icount -= 7;
+ if (OPA == 7)
+ {
+ m_icount -= 1;
+ }
+
+ r0 = UNSP_REG_I(OPB);
r2 = read16(UNSP_LPC);
add_lpc(1);
- if (op0 != 0x0d)
+ if (OP0 != 0x0d)
{
r1 = read16(r2);
}
break;
case 0x03: // store [imm16], r
- m_core->m_icount -= (opa == 7 ? 8 : 7);
+ m_icount -= 7;
+ if (OPA == 7)
+ {
+ m_icount -= 1;
+ }
+
r1 = r0;
- r0 = m_core->m_r[opb];
+ r0 = UNSP_REG_I(OPB);
r2 = read16(UNSP_LPC);
add_lpc(1);
break;
default: // Shifted ops
{
- m_core->m_icount -= (opa == 7 ? 5 : 3);
- uint32_t shift = (m_core->m_r[opb] << 4) | m_core->m_sb;
+ m_icount -= 3;
+ if (OPA == 7)
+ {
+ m_icount -= 2;
+ }
+
+ uint32_t shift = (UNSP_REG_I(OPB) << 4) | m_sb;
if (shift & 0x80000)
shift |= 0xf00000;
- shift >>= (opn - 3);
- m_core->m_sb = shift & 0x0f;
+ shift >>= (OPN - 3);
+ m_sb = shift & 0x0f;
r1 = (uint16_t)(shift >> 4);
break;
}
@@ -829,116 +792,99 @@ inline void unsp_device::execute_one(const uint16_t op)
break;
case 0x05: // More shifted ops
- m_core->m_icount -= (opa == 7 ? 5 : 3);
+ m_icount -= 3;
+ if (OPA == 7)
+ {
+ m_icount -= 2;
+ }
- if (opn & 4) // Shift right
+ if (OPN & 4) // Shift right
{
- const uint32_t shift = ((m_core->m_r[opb] << 4) | m_core->m_sb) >> (opn - 3);
- m_core->m_sb = shift & 0x0f;
+ const uint32_t shift = ((UNSP_REG_I(OPB) << 4) | m_sb) >> (OPN - 3);
+ m_sb = shift & 0x0f;
r1 = (uint16_t)(shift >> 4);
}
else // Shift left
{
- const uint32_t shift = ((m_core->m_sb << 16) | m_core->m_r[opb]) << (opn + 1);
- m_core->m_sb = (shift >> 16) & 0x0f;
+ const uint32_t shift = ((m_sb << 16) | UNSP_REG_I(OPB)) << (OPN + 1);
+ m_sb = (shift >> 16) & 0x0f;
r1 = (uint16_t)shift;
}
break;
case 0x06: // Rotated ops
{
- m_core->m_icount -= (opa == 7 ? 5 : 3);
+ m_icount -= 3;
+ if (OPA == 7)
+ {
+ m_icount -= 2;
+ }
- uint32_t shift = (((m_core->m_sb << 16) | m_core->m_r[opb]) << 4) | m_core->m_sb;
- if (opn & 4) // Rotate right
+ uint32_t shift = (((m_sb << 16) | UNSP_REG_I(OPB)) << 4) | m_sb;
+ if (OPN & 4) // Rotate right
{
- shift >>= (opn - 3);
- m_core->m_sb = shift & 0x0f;
+ shift >>= (OPN - 3);
+ m_sb = shift & 0x0f;
}
else
{
- shift <<= (opn + 1);
- m_core->m_sb = (shift >> 20) & 0x0f;
+ shift <<= (OPN + 1);
+ m_sb = (shift >> 20) & 0x0f;
}
r1 = (uint16_t)(shift >> 4);
break;
}
case 0x07: // Direct 8
- m_core->m_icount -= (opa == 7 ? 6 : 5);
- r2 = op & 0x3f;
- r1 = read16(r2);
+ m_icount -= 5;
+ if (OPA == 7)
+ {
+ m_icount -= 1;
+ }
+
+ r2 = OPIMM;
+ r1 = read16(OPIMM);
break;
default:
break;
}
- switch (op0)
+ switch (OP0)
{
case 0x00: // Add
- {
lres = r0 + r1;
- if (opa != 7)
- update_nzsc(lres, r0, r1);
break;
- }
case 0x01: // Add w/ carry
- {
- uint32_t c = (m_core->m_r[REG_SR] & UNSP_C) ? 1 : 0;
- lres = r0 + r1 + c;
- if (opa != 7)
- update_nzsc(lres, r0, r1);
+ lres = r0 + r1;
+ if(UNSP_REG(SR) & UNSP_C)
+ lres++;
break;
- }
case 0x02: // Subtract
- lres = r0 + (uint16_t)(~r1) + uint32_t(1);
- if (opa != 7)
- update_nzsc(lres, r0, ~r1);
+ case 0x04: // Compare
+ lres = r0 + (uint16_t)(~r1) + 1;
break;
case 0x03: // Subtract w/ carry
- {
- uint32_t c = (m_core->m_r[REG_SR] & UNSP_C) ? 1 : 0;
- lres = r0 + (uint16_t)(~r1) + c;
- if (opa != 7)
- update_nzsc(lres, r0, ~r1);
+ lres = r0 + (uint16_t)(~r1);
+ if(UNSP_REG(SR) & UNSP_C)
+ lres++;
break;
- }
- case 0x04: // Compare
- lres = r0 + (uint16_t)(~r1) + uint32_t(1);
- if (opa != 7)
- update_nzsc(lres, r0, ~r1);
- return;
case 0x06: // Negate
lres = -r1;
- if (opa != 7)
- update_nz(lres);
break;
case 0x08: // XOR
lres = r0 ^ r1;
- if (opa != 7)
- update_nz(lres);
break;
case 0x09: // Load
lres = r1;
- if (opa != 7)
- update_nz(lres);
break;
case 0x0a: // OR
lres = r0 | r1;
- if (opa != 7)
- update_nz(lres);
break;
case 0x0b: // AND
- lres = r0 & r1;
- if (opa != 7)
- update_nz(lres);
- break;
case 0x0c: // Test
lres = r0 & r1;
- if (opa != 7)
- update_nz(lres);
- return;
+ break;
case 0x0d: // Store
write16(r2, r0);
return;
@@ -947,33 +893,34 @@ inline void unsp_device::execute_one(const uint16_t op)
return;
}
- if (op1 == 0x04 && opn == 0x03) // store [imm16], r
+ if (OP0 != 0x0d && OPA != 7) // If not a store opcode and not updating the PC, update negative/zero flags.
+ {
+ update_nz(lres);
+ }
+
+ if (OP0 < 0x05 && OPA != 7) // If Add, Add w/ Carry, Subtract, Subtract w/ Carry, Compare, and not updating the PC, update sign/carry flags.
+ update_sc(lres, r0, r1);
+
+ if (OP0 == 0x04 || OP0 == 0x0c) // Compare and Test don't write back results.
+ return;
+
+ if (OP1 == 0x04 && OPN == 0x03) // store [imm16], r
write16(r2, lres);
else
- m_core->m_r[opa] = (uint16_t)lres;
+ UNSP_REG_I(OPA) = lres;
}
void unsp_device::execute_run()
{
- if (m_enable_drc)
- {
- execute_run_drc();
- return;
- }
-
#if UNSP_LOG_OPCODES
unsp_disassembler dasm;
#endif
- while (m_core->m_icount >= 0)
+ while (m_icount > 0)
{
debugger_instruction_hook(UNSP_LPC);
const uint32_t op = read16(UNSP_LPC);
-#if UNSP_LOG_REGS
- log_regs();
-#endif
-
#if UNSP_LOG_OPCODES
if (m_log_ops)
{
@@ -994,26 +941,16 @@ void unsp_device::execute_run()
/*****************************************************************************/
-void unsp_device::execute_set_input(int inputnum, int state)
-{
- set_state_unsynced(inputnum, state);
-}
-
-uint8_t unsp_device::get_csb()
-{
- return 1 << ((UNSP_LPC >> 20) & 3);
-}
-
-void unsp_device::set_state_unsynced(int inputnum, int state)
+void unsp_device::execute_set_input(int irqline, int state)
{
- m_core->m_sirq &= ~(1 << inputnum);
+ m_sirq &= ~(1 << irqline);
if(!state)
{
return;
}
- switch (inputnum)
+ switch (irqline)
{
case UNSP_IRQ0_LINE:
case UNSP_IRQ1_LINE:
@@ -1024,20 +961,9 @@ void unsp_device::set_state_unsynced(int inputnum, int state)
case UNSP_IRQ6_LINE:
case UNSP_IRQ7_LINE:
case UNSP_FIQ_LINE:
- m_core->m_sirq |= (1 << inputnum);
+ m_sirq |= (1 << irqline);
break;
case UNSP_BRK_LINE:
break;
}
}
-
-uint16_t unsp_device::get_ds()
-{
- return (m_core->m_r[REG_SR] >> 10) & 0x3f;
-}
-
-void unsp_device::set_ds(uint16_t ds)
-{
- m_core->m_r[REG_SR] &= 0x03ff;
- m_core->m_r[REG_SR] |= (ds & 0x3f) << 10;
-}
diff --git a/src/devices/cpu/unsp/unsp.h b/src/devices/cpu/unsp/unsp.h
index 460198451fa..ad3f8250785 100644
--- a/src/devices/cpu/unsp/unsp.h
+++ b/src/devices/cpu/unsp/unsp.h
@@ -17,32 +17,7 @@
#pragma once
-#include "cpu/drcfe.h"
-#include "cpu/drcuml.h"
-#include "cpu/drcumlsh.h"
-
-/***************************************************************************
- CONSTANTS
-***************************************************************************/
-
-/* map variables */
-#define MAPVAR_PC M0
-#define MAPVAR_CYCLES M1
-
-#define SINGLE_INSTRUCTION_MODE (0)
-
-#define ENABLE_UNSP_DRC (1)
-
#define UNSP_LOG_OPCODES (0)
-#define UNSP_LOG_REGS (0)
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-class unsp_frontend;
-
-// ======================> unsp_device
enum
{
@@ -61,7 +36,7 @@ enum
UNSP_FIQ_EN,
UNSP_IRQ,
UNSP_FIQ,
-#if UNSP_LOG_OPCODES || UNSP_LOG_REGS
+#if UNSP_LOG_OPCODES
UNSP_SB,
UNSP_LOG_OPS
#else
@@ -87,38 +62,16 @@ enum
class unsp_device : public cpu_device
{
- friend class unsp_frontend;
-
public:
// construction/destruction
unsp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // HACK: IRQ line state can only be modified directly by hardware on-board the SPG SoC itself.
- // Therefore, to avoid an unnecessary scheduler sync when the external spg2xx_device sets or
- // clears an interrupt line, we provide this direct accessor.
- // A more correct but longer-term solution will be to move spg2xx_device to be internal to
- // a subclass of unsp_device rather than its own standalone device.
- void set_state_unsynced(int inputnum, int state);
-
- uint8_t get_csb();
-
- void set_ds(uint16_t ds);
- uint16_t get_ds();
-
- inline void ccfunc_unimplemented();
- void invalidate_cache();
-
-#if UNSP_LOG_REGS
- void log_regs();
- void log_write(uint32_t addr, uint32_t data);
- void cfunc_log_write();
-#endif
+ void set_timer_interval(int timer, uint32_t interval);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_stop() override;
// device_execute_interface overrides
virtual uint32_t execute_min_cycles() const override { return 5; }
@@ -139,69 +92,27 @@ protected:
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
private:
- // compilation boundaries -- how far back/forward does the analysis extend?
- enum : uint32_t
- {
- COMPILE_BACKWARDS_BYTES = 128,
- COMPILE_FORWARDS_BYTES = 512,
- COMPILE_MAX_INSTRUCTIONS = (COMPILE_BACKWARDS_BYTES / 4) + (COMPILE_FORWARDS_BYTES / 4),
- COMPILE_MAX_SEQUENCE = 64
- };
-
- // exit codes
- enum : int
- {
- EXECUTE_OUT_OF_CYCLES = 0,
- EXECUTE_MISSING_CODE = 1,
- EXECUTE_UNMAPPED_CODE = 2,
- EXECUTE_RESET_CACHE = 3
- };
-
- enum : uint32_t
- {
- REG_SP = 0,
- REG_R1,
- REG_R2,
- REG_R3,
- REG_R4,
- REG_BP,
- REG_SR,
- REG_PC
- };
-
void add_lpc(const int32_t offset);
inline void execute_one(const uint16_t op);
- struct internal_unsp_state
- {
- uint32_t m_r[8];
- uint32_t m_enable_irq;
- uint32_t m_enable_fiq;
- uint32_t m_irq;
- uint32_t m_fiq;
- uint32_t m_curirq;
- uint32_t m_sirq;
- uint32_t m_sb;
- uint32_t m_saved_sb[3];
-
- uint32_t m_arg0;
- uint32_t m_arg1;
- uint32_t m_jmpdest;
+ address_space_config m_program_config;
- int m_icount;
- };
+ uint16_t m_r[16];
+ bool m_enable_irq;
+ bool m_enable_fiq;
+ bool m_irq;
+ bool m_fiq;
+ uint16_t m_curirq;
+ uint16_t m_sirq;
+ uint8_t m_sb;
+ uint8_t m_saved_sb[3];
- 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;
-
- /* core state */
- internal_unsp_state *m_core;
+ int m_icount;
uint32_t m_debugger_temp;
-#if UNSP_LOG_OPCODES || UNSP_LOG_REGS
+#if UNSP_LOG_OPCODES
uint32_t m_log_ops;
#endif
@@ -209,70 +120,12 @@ private:
inline uint16_t read16(uint32_t address);
inline void write16(uint32_t address, uint16_t data);
inline void update_nz(uint32_t value);
- inline void update_nzsc(uint32_t value, uint16_t r0, uint16_t r1);
- inline void push(uint32_t value, uint32_t *reg);
- inline uint16_t pop(uint32_t *reg);
+ inline void update_sc(uint32_t value, uint16_t r0, uint16_t r1);
+ inline void push(uint16_t value, uint16_t *reg);
+ inline uint16_t pop(uint16_t *reg);
inline void trigger_fiq();
inline void trigger_irq(int line);
inline void check_irqs();
-
- drc_cache m_cache;
- std::unique_ptr<drcuml_state> m_drcuml;
- std::unique_ptr<unsp_frontend> m_drcfe;
- uint32_t m_drcoptions;
- uint8_t m_cache_dirty;
-
- uml::parameter m_regmap[16];
- uml::code_handle *m_entry;
- uml::code_handle *m_nocode;
- uml::code_handle *m_out_of_cycles;
- uml::code_handle *m_check_interrupts;
- uml::code_handle *m_trigger_fiq;
- uml::code_handle *m_trigger_irq;
-
- uml::code_handle *m_mem_read;
- uml::code_handle *m_mem_write;
-
- bool m_enable_drc;
-
- /* internal compiler state */
- struct compiler_state
- {
- compiler_state(compiler_state const &) = delete;
- compiler_state &operator=(compiler_state const &) = delete;
-
- uint32_t m_cycles; /* accumulated cycles */
- uml::code_label m_labelnum; /* index for local labels */
- };
-
- void execute_run_drc();
- void flush_drc_cache();
- void code_flush_cache();
- void code_compile_block(offs_t pc);
- void load_fast_iregs(drcuml_block &block);
- void save_fast_iregs(drcuml_block &block);
-
- void static_generate_entry_point();
- void static_generate_nocode_handler();
- void static_generate_out_of_cycles();
- void static_generate_check_interrupts();
- void static_generate_trigger_fiq();
- void static_generate_trigger_irq();
- void static_generate_memory_accessor(bool iswrite, const char *name, uml::code_handle *&handleptr);
-
- void generate_branch(drcuml_block &block, compiler_state &compiler, const opcode_desc *desc);
- void generate_check_cycles(drcuml_block &block, compiler_state &compiler, uml::parameter param);
- void generate_checksum_block(drcuml_block &block, compiler_state &compiler, const opcode_desc *seqhead, const opcode_desc *seqlast);
- void generate_sequence_instruction(drcuml_block &block, compiler_state &compiler, const opcode_desc *desc);
- void generate_add_lpc(drcuml_block &block, int32_t offset);
- void generate_update_nzsc(drcuml_block &block);
- void generate_update_nz(drcuml_block &block);
- void log_add_disasm_comment(drcuml_block &block, uint32_t pc, uint32_t op);
- bool generate_opcode(drcuml_block &block, compiler_state &compiler, const opcode_desc *desc);
-
-#if UNSP_LOG_REGS
- FILE *m_log_file;
-#endif
};
diff --git a/src/devices/cpu/unsp/unspdefs.h b/src/devices/cpu/unsp/unspdefs.h
deleted file mode 100644
index 382e25a0dac..00000000000
--- a/src/devices/cpu/unsp/unspdefs.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-
-#ifndef MAME_CPU_UNSP_UNSPDEFS_H
-#define MAME_CPU_UNSP_UNSPDEFS_H
-
-#pragma once
-
-#define UNSP_LPC (((m_core->m_r[REG_SR] & 0x3f) << 16) | m_core->m_r[REG_PC])
-#define UNSP_LREG_I(reg) (((m_core->m_r[REG_SR] << 6) & 0x3f0000) | m_core->m_r[reg])
-
-#define UNSP_N 0x0200
-#define UNSP_Z 0x0100
-#define UNSP_S 0x0080
-#define UNSP_C 0x0040
-
-#define UNSP_N_SHIFT 9
-#define UNSP_Z_SHIFT 8
-#define UNSP_S_SHIFT 7
-#define UNSP_C_SHIFT 6
-
-#endif // MAME_CPU_UNSP_UNSPDEFS_H
diff --git a/src/devices/cpu/unsp/unspdrc.cpp b/src/devices/cpu/unsp/unspdrc.cpp
deleted file mode 100644
index 3ee90c8c1c9..00000000000
--- a/src/devices/cpu/unsp/unspdrc.cpp
+++ /dev/null
@@ -1,1316 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-
-#include "emu.h"
-#include "unsp.h"
-#include "unspfe.h"
-#include "unspdefs.h"
-
-void unsp_device::invalidate_cache()
-{
- m_cache_dirty = true;
-}
-
-void unsp_device::execute_run_drc()
-{
- int execute_result;
-
- /* reset the cache if dirty */
- if (m_cache_dirty)
- {
- code_flush_cache();
- m_cache_dirty = false;
- }
-
-
- /* execute */
- do
- {
- /* run as much as we can */
- execute_result = m_drcuml->execute(*m_entry);
-
- /* if we need to recompile, do it */
- if (execute_result == EXECUTE_MISSING_CODE)
- {
- code_compile_block(UNSP_LPC);
- }
- else if (execute_result == EXECUTE_UNMAPPED_CODE)
- {
- fatalerror("Attempted to execute unmapped code at PC=%08X\n", UNSP_LPC);
- }
- else if (execute_result == EXECUTE_RESET_CACHE)
- {
- code_flush_cache();
- }
- } while (execute_result != EXECUTE_OUT_OF_CYCLES);
-}
-
-
-/***************************************************************************
- C FUNCTION CALLBACKS
-***************************************************************************/
-
-/*-------------------------------------------------
- cfunc_unimplemented - handler for
- unimplemented opcdes
--------------------------------------------------*/
-
-inline void unsp_device::ccfunc_unimplemented()
-{
- fatalerror("PC=%08X: Unimplemented op %04x\n", UNSP_LPC, (uint16_t)m_core->m_arg0);
-}
-
-static void cfunc_unimplemented(void *param)
-{
- ((unsp_device *)param)->ccfunc_unimplemented();
-}
-
-#if UNSP_LOG_REGS
-void unsp_device::cfunc_log_write()
-{
- log_write(m_core->m_arg0, m_core->m_arg1);
-}
-
-static void cfunc_log_regs(void *param)
-{
- ((unsp_device *)param)->log_regs();
-}
-
-static void ccfunc_log_write(void *param)
-{
- ((unsp_device *)param)->cfunc_log_write();
-}
-#endif
-
-/***************************************************************************
- CACHE MANAGEMENT
-***************************************************************************/
-
-/*-------------------------------------------------
- flush_drc_cache - outward-facing accessor to
- code_flush_cache
--------------------------------------------------*/
-
-void unsp_device::flush_drc_cache()
-{
- if (!m_enable_drc)
- return;
- m_cache_dirty = true;
-}
-
-/*-------------------------------------------------
- code_flush_cache - flush the cache and
- regenerate static code
--------------------------------------------------*/
-
-void unsp_device::code_flush_cache()
-{
- /* empty the transient cache contents */
- m_drcuml->reset();
-
- try
- {
- /* generate the entry point and out-of-cycles handlers */
- static_generate_entry_point();
- static_generate_nocode_handler();
- static_generate_out_of_cycles();
-
- static_generate_memory_accessor(false, "read", m_mem_read);
- static_generate_memory_accessor(true, "write", m_mem_write);
- static_generate_trigger_fiq();
- static_generate_trigger_irq();
- static_generate_check_interrupts();
- }
-
- catch (drcuml_block::abort_compilation &)
- {
- fatalerror("Unable to generate static u'nSP code\n"); fflush(stdout);
- }
-}
-
-/*-------------------------------------------------
- code_compile_block - compile a block of the
- given mode at the specified pc
--------------------------------------------------*/
-
-void unsp_device::code_compile_block(offs_t pc)
-{
- compiler_state compiler = { 0 };
- const opcode_desc *seqhead, *seqlast;
- bool override = false;
-
- g_profiler.start(PROFILER_DRC_COMPILE);
-
- /* get a description of this sequence */
- const opcode_desc *desclist = m_drcfe->describe_code(pc);
-
- bool succeeded = false;
- while (!succeeded)
- {
- try
- {
- /* start the block */
- drcuml_block &block(m_drcuml->begin_block(1024*8));
-
- /* loop until we get through all instruction sequences */
- for (seqhead = desclist; seqhead != nullptr; seqhead = seqlast->next())
- {
- const opcode_desc *curdesc;
- uint32_t nextpc;
-
- /* add a code log entry */
- if (m_drcuml->logging())
- block.append_comment("-------------------------");
-
- /* determine the last instruction in this sequence */
- for (seqlast = seqhead; seqlast != nullptr; seqlast = seqlast->next())
- if (seqlast->flags & OPFLAG_END_SEQUENCE)
- break;
- assert(seqlast != nullptr);
-
- /* if we don't have a hash for this mode/pc, or if we are overriding all, add one */
- if (override || !m_drcuml->hash_exists(0, seqhead->pc))
- UML_HASH(block, 0, seqhead->pc);
-
- /* if we already have a hash, and this is the first sequence, assume that we */
- /* are recompiling due to being out of sync and allow future overrides */
- else if (seqhead == desclist)
- {
- override = true;
- UML_HASH(block, 0, seqhead->pc);
- }
-
- /* otherwise, redispatch to that fixed PC and skip the rest of the processing */
- else
- {
- UML_LABEL(block, seqhead->pc | 0x80000000);
- UML_HASHJMP(block, 0, seqhead->pc, *m_nocode);
- continue;
- }
-
- /* validate this code block if we're not pointing into ROM */
- if (m_program->get_write_ptr(seqhead->physpc) != nullptr)
- generate_checksum_block(block, compiler, seqhead, seqlast);
-
- /* label this instruction, if it may be jumped to locally */
- if (seqhead->flags & OPFLAG_IS_BRANCH_TARGET)
- UML_LABEL(block, seqhead->pc | 0x80000000);
-
- /* iterate over instructions in the sequence and compile them */
- for (curdesc = seqhead; curdesc != seqlast->next(); curdesc = curdesc->next())
- {
- generate_check_cycles(block, compiler, curdesc->pc + curdesc->length);
- generate_sequence_instruction(block, compiler, curdesc);
- UML_CALLH(block, *m_check_interrupts);
- }
-
- nextpc = seqlast->pc + seqlast->length;
-
- /* if the last instruction can change modes, use a variable mode; otherwise, assume the same mode */
- if (seqlast->next() == nullptr || seqlast->next()->pc != nextpc)
- {
- UML_HASHJMP(block, 0, nextpc, *m_nocode); // hashjmp <mode>,nextpc,nocode
- }
- }
-
- /* end the sequence */
- block.end();
- g_profiler.stop();
- succeeded = true;
- }
- catch (drcuml_block::abort_compilation &)
- {
- code_flush_cache();
- }
- }
-}
-
-/***************************************************************************
- STATIC CODEGEN
-***************************************************************************/
-
-/*-------------------------------------------------
- alloc_handle - allocate a handle if not
- already allocated
--------------------------------------------------*/
-
-static inline void alloc_handle(drcuml_state &drcuml, uml::code_handle *&handleptr, const char *name)
-{
- if (!handleptr)
- handleptr = drcuml.handle_alloc(name);
-}
-
-/*-------------------------------------------------
- generate_entry_point - generate a
- static entry point
--------------------------------------------------*/
-
-void unsp_device::static_generate_entry_point()
-{
- /* begin generating */
- drcuml_block &block(m_drcuml->begin_block(32));
-
- /* forward references */
- alloc_handle(*m_drcuml, m_nocode, "nocode");
-
- alloc_handle(*m_drcuml, m_entry, "entry");
- UML_HANDLE(block, *m_entry);
-
- /* load fast integer registers */
- //load_fast_iregs(block);
-
- /* generate a hash jump via the current mode and PC */
- UML_ROLAND(block, I1, mem(&m_core->m_r[REG_SR]), 16, 0x003f0000);
- UML_OR(block, I1, I1, mem(&m_core->m_r[REG_PC]));
- UML_HASHJMP(block, 0, I1, *m_nocode);
- block.end();
-}
-
-
-/*-------------------------------------------------
- static_generate_nocode_handler - generate an
- exception handler for "out of code"
--------------------------------------------------*/
-
-void unsp_device::static_generate_nocode_handler()
-{
- /* begin generating */
- drcuml_block &block(m_drcuml->begin_block(10));
-
- /* generate a hash jump via the current mode and PC */
- alloc_handle(*m_drcuml, m_nocode, "nocode");
- UML_HANDLE(block, *m_nocode);
- UML_GETEXP(block, I0);
-
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), I0, 16, 0x3f);
- UML_AND(block, mem(&m_core->m_r[REG_PC]), I0, 0x0000ffff);
- //save_fast_iregs(block);
- UML_EXIT(block, EXECUTE_MISSING_CODE);
-
- block.end();
-}
-
-
-/*-------------------------------------------------
- static_generate_out_of_cycles - generate an
- out of cycles exception handler
--------------------------------------------------*/
-
-void unsp_device::static_generate_out_of_cycles()
-{
- /* begin generating */
- drcuml_block &block(m_drcuml->begin_block(10));
-
- /* generate a hash jump via the current mode and PC */
- alloc_handle(*m_drcuml, m_out_of_cycles, "out_of_cycles");
- UML_HANDLE(block, *m_out_of_cycles);
- //save_fast_iregs(block);
- UML_EXIT(block, EXECUTE_OUT_OF_CYCLES);
-
- block.end();
-}
-
-/*------------------------------------------------------------------
- static_generate_memory_accessor
-------------------------------------------------------------------*/
-
-void unsp_device::static_generate_memory_accessor(bool iswrite, const char *name, uml::code_handle *&handleptr)
-{
- /* on entry, address is in I0; data for writes is in I1 */
- /* on exit, read result is in I1 */
-
- /* begin generating */
- drcuml_block &block(m_drcuml->begin_block(32));
-
- /* add a global entry for this */
- alloc_handle(*m_drcuml, handleptr, name);
- UML_HANDLE(block, *handleptr);
-
- if (iswrite)
- {
-#if UNSP_LOG_REGS
- UML_MOV(block, mem(&m_core->m_arg0), I0);
- UML_MOV(block, mem(&m_core->m_arg1), I1);
- UML_CALLC(block, ccfunc_log_write, this);
-#endif
- UML_WRITE(block, I0, I1, SIZE_WORD, SPACE_PROGRAM);
- }
- else
- UML_READ(block, I1, I0, SIZE_WORD, SPACE_PROGRAM);
- UML_RET(block);
-
- block.end();
-}
-
-
-
-/***************************************************************************
- CODE GENERATION
-***************************************************************************/
-
-void unsp_device::static_generate_check_interrupts()
-{
- uml::code_label test_loop = 1;
- uml::code_label found = 2;
- uml::code_label do_irq = 3;
-
- /* begin generating */
- drcuml_block &block(m_drcuml->begin_block(256));
-
- /* generate a hash jump via the current mode and PC */
- alloc_handle(*m_drcuml, m_check_interrupts, "check_interrupts");
- UML_HANDLE(block, *m_check_interrupts);
-
- UML_CMP(block, mem(&m_core->m_sirq), 0);
- UML_RETc(block, uml::COND_Z);
-
- UML_MOV(block, I2, 0);
- UML_MOV(block, I0, 1);
- UML_MOV(block, I1, mem(&m_core->m_sirq));
-
- UML_LABEL(block, test_loop);
- UML_TEST(block, I1, I0);
- UML_JMPc(block, uml::COND_NZ, found);
- UML_SHL(block, I0, I0, 1);
- UML_ADD(block, I2, I2, 1);
- UML_CMP(block, I0, 1 << 9);
- UML_JMPc(block, uml::COND_NE, test_loop);
- UML_RET(block);
-
- UML_LABEL(block, found);
- UML_CMP(block, I0, 1);
- UML_JMPc(block, uml::COND_NE, do_irq);
- UML_CALLH(block, *m_trigger_fiq);
- UML_RET(block);
-
- UML_LABEL(block, do_irq);
- UML_CALLH(block, *m_trigger_irq);
- UML_RET(block);
-
- block.end();
-}
-
-void unsp_device::static_generate_trigger_fiq()
-{
- /* begin generating */
- drcuml_block &block(m_drcuml->begin_block(256));
-
- /* generate a hash jump via the current mode and PC */
- alloc_handle(*m_drcuml, m_trigger_fiq, "trigger_fiq");
- UML_HANDLE(block, *m_trigger_fiq);
-
- UML_OR(block, I0, mem(&m_core->m_fiq), mem(&m_core->m_irq));
- UML_TEST(block, I0, 1);
- UML_RETc(block, uml::COND_NZ);
-
- UML_TEST(block, mem(&m_core->m_enable_fiq), 1);
- UML_RETc(block, uml::COND_Z);
-
- UML_MOV(block, mem(&m_core->m_fiq), 1);
-
- UML_MOV(block, I0, mem(&m_core->m_sb));
- UML_MOV(block, I1, mem(&m_core->m_irq));
- UML_STORE(block, (void*)m_core->m_saved_sb, I1, I0, SIZE_DWORD, SCALE_x4);
- UML_MOV(block, mem(&m_core->m_sb), mem(&m_core->m_saved_sb[2]));
-
- UML_MOV(block, I0, mem(&m_core->m_r[REG_SP]));
-
- UML_MOV(block, I1, mem(&m_core->m_r[REG_PC]));
- UML_CALLH(block, *m_mem_write);
- UML_SUB(block, I0, I0, 1);
-
- UML_MOV(block, I1, mem(&m_core->m_r[REG_SR]));
- UML_CALLH(block, *m_mem_write);
- UML_SUB(block, I0, I0, 1);
-
- UML_AND(block, mem(&m_core->m_r[REG_SP]), I0, 0x0000ffff);
-
- UML_MOV(block, I0, 0x0000fff6);
- UML_CALLH(block, *m_mem_read);
- UML_MOV(block, mem(&m_core->m_r[REG_PC]), I1);
- UML_MOV(block, mem(&m_core->m_r[REG_SR]), 0);
- UML_HASHJMP(block, 0, I1, *m_nocode);
- UML_RET(block);
-
- block.end();
-}
-
-void unsp_device::static_generate_trigger_irq()
-{
- /* begin generating */
- drcuml_block &block(m_drcuml->begin_block(256));
-
- /* generate a hash jump via the current mode and PC */
- alloc_handle(*m_drcuml, m_trigger_irq, "trigger_irq");
- UML_HANDLE(block, *m_trigger_irq);
-
- UML_OR(block, I0, mem(&m_core->m_fiq), mem(&m_core->m_irq));
- UML_TEST(block, I0, 1);
- UML_RETc(block, uml::COND_NZ);
-
- UML_TEST(block, mem(&m_core->m_enable_irq), 1);
- UML_RETc(block, uml::COND_Z);
-
- UML_MOV(block, mem(&m_core->m_irq), 1);
-
- UML_MOV(block, mem(&m_core->m_saved_sb[0]), mem(&m_core->m_sb));
- UML_MOV(block, mem(&m_core->m_sb), mem(&m_core->m_saved_sb[1]));
-
- UML_MOV(block, I0, mem(&m_core->m_r[REG_SP]));
- UML_MOV(block, I1, mem(&m_core->m_r[REG_PC]));
- UML_CALLH(block, *m_mem_write);
- UML_SUB(block, I0, I0, 1);
-
- UML_MOV(block, I1, mem(&m_core->m_r[REG_SR]));
- UML_CALLH(block, *m_mem_write);
- UML_SUB(block, I0, I0, 1);
-
- UML_AND(block, mem(&m_core->m_r[REG_SP]), I0, 0x0000ffff);
-
- UML_ADD(block, I0, I2, 0x0000fff7);
-
- UML_CALLH(block, *m_mem_read);
-
- UML_MOV(block, mem(&m_core->m_r[REG_PC]), I1);
- UML_MOV(block, mem(&m_core->m_r[REG_SR]), 0);
- UML_HASHJMP(block, 0, I1, *m_nocode);
- UML_RET(block);
-
- block.end();
-}
-
-/*-------------------------------------------------
- generate_check_cycles - generate code to
- generate an exception if cycles are out
--------------------------------------------------*/
-
-void unsp_device::generate_check_cycles(drcuml_block &block, compiler_state &compiler, uml::parameter param)
-{
- UML_CMP(block, mem(&m_core->m_icount), 0);
- UML_EXHc(block, uml::COND_L, *m_out_of_cycles, param);
-}
-
-/*-------------------------------------------------
- generate_checksum_block - generate code to
- validate a sequence of opcodes
--------------------------------------------------*/
-
-void unsp_device::generate_checksum_block(drcuml_block &block, compiler_state &compiler, const opcode_desc *seqhead, const opcode_desc *seqlast)
-{
- const opcode_desc *curdesc;
- if (m_drcuml->logging())
- {
- block.append_comment("[Validation for %08X]", seqhead->pc);
- }
-
- /* full verification; sum up everything */
- void *memptr = m_program->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++)
- {
- UML_LOAD(block, I1, memptr, i, SIZE_WORD, SCALE_x2);
- UML_ADD(block, I0, I0, I1);
- sum += ((uint16_t*)memptr)[i];
- }
- for (curdesc = seqhead->next(); curdesc != seqlast->next(); curdesc = curdesc->next())
- {
- if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
- {
- memptr = m_program->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];
- for (int i = 1; i < curdesc->length; i++)
- {
- UML_LOAD(block, I1, memptr, i, SIZE_WORD, SCALE_x2);
- UML_ADD(block, I0, I0, I1);
- sum += ((uint16_t*)memptr)[i];
- }
- }
- }
- UML_CMP(block, I0, sum);
- UML_EXHc(block, COND_NE, *m_nocode, seqhead->pc);
-}
-
-
-/*-------------------------------------------------
- log_add_disasm_comment - add a comment
- including disassembly of a MIPS instruction
--------------------------------------------------*/
-
-void unsp_device::log_add_disasm_comment(drcuml_block &block, uint32_t pc, uint32_t op)
-{
- if (m_drcuml->logging())
- {
- block.append_comment("%08X: %08x", pc, op);
- }
-}
-
-
-/*------------------------------------------------------------------
- generate_branch
-------------------------------------------------------------------*/
-
-void unsp_device::generate_branch(drcuml_block &block, compiler_state &compiler, const opcode_desc *desc)
-{
- if (desc->targetpc == BRANCH_TARGET_DYNAMIC)
- {
- UML_ROLAND(block, I0, mem(&m_core->m_r[REG_SR]), 16, 0x3f0000);
- UML_OR(block, mem(&m_core->m_jmpdest), I0, mem(&m_core->m_r[REG_PC]));
- }
-
- /* update the cycles and jump through the hash table to the target */
- if (desc->targetpc != BRANCH_TARGET_DYNAMIC)
- {
- UML_CALLH(block, *m_check_interrupts);
- UML_HASHJMP(block, 0, desc->targetpc, *m_nocode);
- }
- else
- {
- UML_CALLH(block, *m_check_interrupts);
- UML_HASHJMP(block, 0, mem(&m_core->m_jmpdest), *m_nocode);
- }
-}
-
-
-/*-------------------------------------------------
- generate_sequence_instruction - generate code
- for a single instruction in a sequence
--------------------------------------------------*/
-
-void unsp_device::generate_sequence_instruction(drcuml_block &block, compiler_state &compiler, const opcode_desc *desc)
-{
- /* add an entry for the log */
- if (m_drcuml->logging() && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
- log_add_disasm_comment(block, desc->pc, desc->opptr.w[0]);
-
- /* set the PC map variable */
- UML_MAPVAR(block, MAPVAR_PC, desc->pc);
-
- /* if we are debugging, call the debugger */
- if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
- {
- //save_fast_iregs(block);
- UML_DEBUG(block, desc->pc);
- }
-
-#if UNSP_LOG_REGS
- UML_CALLC(block, cfunc_log_regs, this);
-#endif
-
- if (!(desc->flags & OPFLAG_VIRTUAL_NOOP))
- {
- /* compile the instruction */
- if (!generate_opcode(block, compiler, desc))
- {
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), desc->pc, 16, 0x3f);
- UML_AND(block, mem(&m_core->m_r[REG_PC]), desc->pc, 0x0000ffff);
- UML_MOV(block, mem(&m_core->m_arg0), desc->opptr.w[0]);
- UML_CALLC(block, cfunc_unimplemented, this);
- }
- }
-}
-
-
-/*------------------------------------------------------------------
- generate_add_lpc - adds an offset to the long program counter
- comprised of PC and the low 6 bits of SR
-------------------------------------------------------------------*/
-
-void unsp_device::generate_add_lpc(drcuml_block &block, int32_t offset)
-{
- UML_ROLAND(block, I0, mem(&m_core->m_r[REG_SR]), 16, 0x3f0000);
- UML_OR(block, I0, I0, mem(&m_core->m_r[REG_PC]));
- UML_ADD(block, I0, I0, offset);
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), I0, 16, 0x3f);
- UML_AND(block, mem(&m_core->m_r[REG_PC]), I0, 0x0000ffff);
-}
-
-
-/*------------------------------------------------------------------
- generate_update_nzsc - perform a full flag update
-------------------------------------------------------------------*/
-
-void unsp_device::generate_update_nzsc(drcuml_block &block)
-{
- UML_XOR(block, I1, I1, 0x0000ffff);
- UML_SEXT(block, I1, I1, SIZE_WORD);
- UML_SEXT(block, I2, I2, SIZE_WORD);
- UML_CMP(block, I2, I1);
- UML_SETc(block, uml::COND_L, I1);
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), I1, UNSP_S_SHIFT, UNSP_S);
-
- UML_TEST(block, I3, 0x8000);
- UML_SETc(block, uml::COND_NZ, I1);
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), I1, UNSP_N_SHIFT, UNSP_N);
-
- UML_TEST(block, I3, 0x10000);
- UML_SETc(block, uml::COND_NZ, I1);
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), I1, UNSP_C_SHIFT, UNSP_C);
-
- UML_TEST(block, I3, 0x0000ffff);
- UML_SETc(block, uml::COND_Z, I1);
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), I1, UNSP_Z_SHIFT, UNSP_Z);
-}
-
-
-/*------------------------------------------------------------------
- generate_update_nz - perform a partial flag update
-------------------------------------------------------------------*/
-
-void unsp_device::generate_update_nz(drcuml_block &block)
-{
- UML_TEST(block, I3, 0x8000);
- UML_SETc(block, uml::COND_NZ, I1);
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), I1, UNSP_N_SHIFT, UNSP_N);
-
- UML_AND(block, I2, I3, 0x0000ffff);
- UML_CMP(block, I2, 0);
- UML_SETc(block, uml::COND_E, I1);
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), I1, UNSP_Z_SHIFT, UNSP_Z);
-}
-
-
-/*------------------------------------------------------------------
- generate_opcode - main handler which generates the UML for a
- single opcode
-------------------------------------------------------------------*/
-
-bool unsp_device::generate_opcode(drcuml_block &block, compiler_state &compiler, const opcode_desc *desc)
-{
- uint32_t op = (uint32_t)desc->opptr.w[0];
-
- generate_add_lpc(block, 1);
-
- const uint16_t op0 = (op >> 12) & 15;
- const uint16_t opa = (op >> 9) & 7;
- const uint16_t op1 = (op >> 6) & 7;
- const uint16_t opn = (op >> 3) & 7;
- const uint16_t opb = op & 7;
-
- const uint8_t lower_op = (op1 << 4) | op0;
-
- uml::code_label skip_branch = compiler.m_labelnum++;
- uml::code_label clear_fiq = compiler.m_labelnum++;
- uml::code_label clear_irq = compiler.m_labelnum++;
- uml::code_label reti_done = compiler.m_labelnum++;
- uml::code_label mul_opa_nohi = compiler.m_labelnum++;
- uml::code_label mul_opb_nohi = compiler.m_labelnum++;
- uml::code_label shift_no_sign = compiler.m_labelnum++;
- uml::code_label no_carry = compiler.m_labelnum++;
-
- if(op0 < 0xf && opa == 0x7 && op1 < 2)
- {
- const uint32_t opimm = op & 0x3f;
- switch(op0)
- {
- case 0: // JB
- UML_TEST(block, mem(&m_core->m_r[REG_SR]), UNSP_C);
- UML_JMPc(block, uml::COND_NZ, skip_branch);
- break;
-
- case 1: // JAE
- UML_TEST(block, mem(&m_core->m_r[REG_SR]), UNSP_C);
- UML_JMPc(block, uml::COND_Z, skip_branch);
- break;
-
- case 2: // JGE
- UML_TEST(block, mem(&m_core->m_r[REG_SR]), UNSP_S);
- UML_JMPc(block, uml::COND_NZ, skip_branch);
- break;
-
- case 3: // JL
- UML_TEST(block, mem(&m_core->m_r[REG_SR]), UNSP_S);
- UML_JMPc(block, uml::COND_Z, skip_branch);
- break;
-
- case 4: // JNE
- UML_TEST(block, mem(&m_core->m_r[REG_SR]), UNSP_Z);
- UML_JMPc(block, uml::COND_NZ, skip_branch);
- break;
-
- case 5: // JE
- UML_TEST(block, mem(&m_core->m_r[REG_SR]), UNSP_Z);
- UML_JMPc(block, uml::COND_Z, skip_branch);
- break;
-
- case 6: // JPL
- UML_TEST(block, mem(&m_core->m_r[REG_SR]), UNSP_N);
- UML_JMPc(block, uml::COND_NZ, skip_branch);
- break;
-
- case 7: // JMI
- UML_TEST(block, mem(&m_core->m_r[REG_SR]), UNSP_N);
- UML_JMPc(block, uml::COND_Z, skip_branch);
- break;
-
- case 8: // JBE
- UML_AND(block, I0, mem(&m_core->m_r[REG_SR]), UNSP_Z | UNSP_C);
- UML_CMP(block, I0, UNSP_C);
- UML_JMPc(block, uml::COND_E, skip_branch);
- break;
-
- case 9: // JA
- UML_AND(block, I0, mem(&m_core->m_r[REG_SR]), UNSP_Z | UNSP_C);
- UML_CMP(block, I0, UNSP_C);
- UML_JMPc(block, uml::COND_NE, skip_branch);
- break;
-
- case 10: // JLE
- UML_TEST(block, mem(&m_core->m_r[REG_SR]), UNSP_Z | UNSP_S);
- UML_JMPc(block, uml::COND_Z, skip_branch);
- break;
-
- case 11: // JG
- UML_TEST(block, mem(&m_core->m_r[REG_SR]), UNSP_Z);
- UML_JMPc(block, uml::COND_NZ, skip_branch);
- UML_TEST(block, mem(&m_core->m_r[REG_SR]), UNSP_S);
- UML_JMPc(block, uml::COND_NZ, skip_branch);
- break;
-
- case 14: // JMP
- UML_SUB(block, mem(&m_core->m_icount), mem(&m_core->m_icount), 4);
- UML_MOV(block, I0, desc->targetpc);
- UML_AND(block, mem(&m_core->m_r[REG_PC]), I0, 0x0000ffff);
- generate_branch(block, compiler, desc);
- return true;
-
- default:
- return false;
- }
- UML_SUB(block, mem(&m_core->m_icount), mem(&m_core->m_icount), 4);
- generate_add_lpc(block, (op1 == 0) ? opimm : (0 - opimm));
- generate_branch(block, compiler, desc);
- UML_LABEL(block, skip_branch);
- UML_SUB(block, mem(&m_core->m_icount), mem(&m_core->m_icount), 2);
- return true;
- }
-
- UML_SUB(block, mem(&m_core->m_icount), mem(&m_core->m_icount), desc->cycles);
-
- if (lower_op == 0x2d) // Push
- {
- uint32_t r0 = opn;
- uint32_t r1 = opa;
- UML_MOV(block, I0, mem(&m_core->m_r[opb]));
- while (r0)
- {
- UML_MOV(block, I1, mem(&m_core->m_r[r1]));
- UML_CALLH(block, *m_mem_write);
- UML_SUB(block, I0, I0, 1);
- UML_AND(block, mem(&m_core->m_r[opb]), I0, 0x0000ffff);
- r0--;
- r1--;
- }
- return true;
- }
- else if (lower_op == 0x29)
- {
- if (op == 0x9a98) // reti
- {
- UML_ADD(block, I0, mem(&m_core->m_r[REG_SP]), 1);
- UML_CALLH(block, *m_mem_read);
- UML_MOV(block, mem(&m_core->m_r[REG_SR]), I1);
-
- UML_ADD(block, I0, I0, 1);
- UML_CALLH(block, *m_mem_read);
- UML_MOV(block, mem(&m_core->m_r[REG_PC]), I1);
-
- UML_AND(block, mem(&m_core->m_r[REG_SP]), I0, 0x0000ffff);
-
- UML_TEST(block, mem(&m_core->m_fiq), 1);
- UML_JMPc(block, uml::COND_NZ, clear_fiq);
- UML_TEST(block, mem(&m_core->m_irq), 1);
- UML_JMPc(block, uml::COND_NZ, clear_irq);
- UML_JMP(block, reti_done);
-
- UML_LABEL(block, clear_fiq);
- UML_MOV(block, mem(&m_core->m_fiq), 0);
- UML_MOV(block, mem(&m_core->m_saved_sb[2]), mem(&m_core->m_sb));
- UML_LOAD(block, mem(&m_core->m_sb), (void*)m_core->m_saved_sb, mem(&m_core->m_irq), SIZE_DWORD, SCALE_x4);
- UML_JMP(block, reti_done);
-
- UML_LABEL(block, clear_irq);
- UML_MOV(block, mem(&m_core->m_irq), 0);
- UML_MOV(block, mem(&m_core->m_saved_sb[1]), mem(&m_core->m_sb));
- UML_MOV(block, mem(&m_core->m_sb), mem(&m_core->m_saved_sb[0]));
-
- UML_LABEL(block, reti_done);
- UML_MOV(block, mem(&m_core->m_curirq), 0);
- generate_branch(block, compiler, desc);
- }
- else // pop
- {
- uint32_t r0 = opn;
- uint32_t r1 = opa;
- bool do_branch = false;
-
- UML_MOV(block, I0, mem(&m_core->m_r[opb]));
- while (r0)
- {
- r1++;
- UML_ADD(block, I0, I0, 1);
- UML_AND(block, mem(&m_core->m_r[opb]), I0, 0x0000ffff);
- UML_CALLH(block, *m_mem_read);
- UML_MOV(block, mem(&m_core->m_r[r1]), I1);
- if (r1 == REG_PC)
- do_branch = true;
- r0--;
- }
- if (do_branch)
- generate_branch(block, compiler, desc);
- }
- return true;
- }
- else if (op0 == 0xf)
- {
- switch (op1)
- {
- case 0x00: // Multiply, Unsigned * Signed
- if(opn == 1 && opa != 7)
- {
- UML_MOV(block, I0, mem(&m_core->m_r[opa]));
- UML_MOV(block, I1, mem(&m_core->m_r[opb]));
- UML_MULU(block, I2, I2, I0, I1);
-
- UML_TEST(block, I1, 0x00008000);
- UML_JMPc(block, uml::COND_Z, mul_opb_nohi);
- UML_SHL(block, I0, I0, 16);
- UML_SUB(block, I2, I2, I0);
-
- UML_LABEL(block, mul_opb_nohi);
- UML_SHR(block, mem(&m_core->m_r[REG_R4]), I2, 16);
- UML_AND(block, mem(&m_core->m_r[REG_R3]), I2, 0x0000ffff);
- return true;
- }
- return false;
-
- case 0x01: // Call
- if(!(opa & 1))
- {
- generate_add_lpc(block, 1);
-
- UML_MOV(block, I0, mem(&m_core->m_r[REG_SP]));
-
- UML_MOV(block, I1, mem(&m_core->m_r[REG_PC]));
- UML_CALLH(block, *m_mem_write);
- UML_SUB(block, I0, I0, 1);
-
- UML_MOV(block, I1, mem(&m_core->m_r[REG_SR]));
- UML_CALLH(block, *m_mem_write);
- UML_SUB(block, I0, I0, 1);
-
- UML_AND(block, mem(&m_core->m_r[REG_SP]), I0, 0x0000ffff);
-
- UML_MOV(block, I0, desc->targetpc);
- UML_AND(block, mem(&m_core->m_r[REG_PC]), I0, 0x0000ffff);
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), I0, 16, 0x3f);
- generate_branch(block, compiler, desc);
- return true;
- }
- return false;
-
- case 0x02: // Far Jump
- if (opa == 7)
- {
- UML_MOV(block, I0, desc->targetpc);
- UML_AND(block, mem(&m_core->m_r[REG_PC]), I0, 0x0000ffff);
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), I0, 16, 0x3f);
- generate_branch(block, compiler, desc);
- return true;
- }
- return false;
-
- case 0x04: // Multiply, Signed * Signed
- if(opn == 1 && opa != 7)
- {
- UML_MOV(block, I0, mem(&m_core->m_r[opa]));
- UML_MOV(block, I1, mem(&m_core->m_r[opb]));
- UML_MULU(block, I2, I2, I0, I1);
-
- UML_TEST(block, I1, 0x00008000);
- UML_JMPc(block, uml::COND_Z, mul_opb_nohi);
- UML_SHL(block, I0, I0, 16);
- UML_SUB(block, I2, I2, I0);
-
- UML_LABEL(block, mul_opb_nohi);
- UML_TEST(block, I0, 0x00008000);
- UML_JMPc(block, uml::COND_Z, mul_opa_nohi);
- UML_SHL(block, I1, I1, 16);
- UML_SUB(block, I2, I2, I1);
-
- UML_LABEL(block, mul_opa_nohi);
- UML_SHR(block, mem(&m_core->m_r[REG_R4]), I2, 16);
- UML_AND(block, mem(&m_core->m_r[REG_R3]), I2, 0x0000ffff);
- return true;
- }
- return false;
-
- case 0x05: // Interrupt flags
- switch(op & 0x3f)
- {
- case 0:
- UML_MOV(block, mem(&m_core->m_enable_irq), 0);
- UML_MOV(block, mem(&m_core->m_enable_fiq), 0);
- break;
-
- case 1:
- UML_MOV(block, mem(&m_core->m_enable_irq), 1);
- UML_MOV(block, mem(&m_core->m_enable_fiq), 0);
- break;
-
- case 2:
- UML_MOV(block, mem(&m_core->m_enable_irq), 0);
- UML_MOV(block, mem(&m_core->m_enable_fiq), 1);
- break;
-
- case 3:
- UML_MOV(block, mem(&m_core->m_enable_irq), 1);
- UML_MOV(block, mem(&m_core->m_enable_fiq), 1);
- break;
-
- case 8:
- UML_MOV(block, mem(&m_core->m_enable_irq), 0);
- break;
-
- case 9:
- UML_MOV(block, mem(&m_core->m_enable_irq), 1);
- break;
-
- case 12:
- UML_MOV(block, mem(&m_core->m_enable_fiq), 0);
- break;
-
- case 14:
- UML_MOV(block, mem(&m_core->m_enable_fiq), 1);
- break;
-
- case 37:
- // nop
- break;
-
- default:
- return false;
- }
- return true;
-
- default:
- return false;
- }
- }
-
- // At this point, we should be dealing solely with ALU ops.
- UML_MOV(block, I2, mem(&m_core->m_r[opa]));
-
- switch (op1)
- {
- case 0x00: // r, [bp+imm6]
- UML_ADD(block, I0, mem(&m_core->m_r[REG_BP]), op & 0x3f);
- UML_AND(block, I0, I0, 0x0000ffff);
- if (op0 != 0x0d)
- UML_CALLH(block, *m_mem_read);
- break;
-
- case 0x01: // r, imm6
- UML_MOV(block, I1, op & 0x3f);
- break;
-
- case 0x03: // Indirect
- {
- const uint8_t lsbits = opn & 3;
- if (opn & 4)
- {
- switch (lsbits)
- {
- case 0: // r, [<ds:>r]
- UML_ROLAND(block, I0, mem(&m_core->m_r[REG_SR]), 6, 0x3f0000);
- UML_OR(block, I0, I0, mem(&m_core->m_r[opb]));
- if (op0 != 0x0d)
- UML_CALLH(block, *m_mem_read);
- break;
-
- case 1: // r, [<ds:>r--]
- UML_ROLAND(block, I0, mem(&m_core->m_r[REG_SR]), 6, 0x3f0000);
- UML_OR(block, I0, I0, mem(&m_core->m_r[opb]));
- if (op0 != 0x0d)
- UML_CALLH(block, *m_mem_read);
- UML_SUB(block, I3, I0, 1);
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), I3, 32-6, 0x0000fc00);
- UML_AND(block, mem(&m_core->m_r[opb]), I3, 0x0000ffff);
- break;
-
- case 2: // r, [<ds:>r++]
- UML_ROLAND(block, I0, mem(&m_core->m_r[REG_SR]), 6, 0x3f0000);
- UML_OR(block, I0, I0, mem(&m_core->m_r[opb]));
- if (op0 != 0x0d)
- UML_CALLH(block, *m_mem_read);
- UML_ADD(block, I3, I0, 1);
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), I3, 32-6, 0x0000fc00);
- UML_AND(block, mem(&m_core->m_r[opb]), I3, 0x0000ffff);
- break;
-
- case 3: // r, [<ds:>++r]
- UML_ROLAND(block, I0, mem(&m_core->m_r[REG_SR]), 6, 0x3f0000);
- UML_OR(block, I0, I0, mem(&m_core->m_r[opb]));
- UML_ADD(block, I0, I0, 1);
- UML_ROLINS(block, mem(&m_core->m_r[REG_SR]), I0, 32-6, 0x0000fc00);
- UML_AND(block, mem(&m_core->m_r[opb]), I0, 0x0000ffff);
- if (op0 != 0x0d)
- UML_CALLH(block, *m_mem_read);
- break;
-
- default:
- // can't happen
- break;
- }
- }
- else
- {
- switch (lsbits)
- {
- case 0: // r, [r]
- UML_MOV(block, I0, mem(&m_core->m_r[opb]));
- if (op0 != 0x0d)
- UML_CALLH(block, *m_mem_read);
- break;
-
- case 1: // r, [r--]
- UML_MOV(block, I0, mem(&m_core->m_r[opb]));
- if (op0 != 0x0d)
- UML_CALLH(block, *m_mem_read);
- UML_SUB(block, I3, I0, 1);
- UML_AND(block, mem(&m_core->m_r[opb]), I3, 0x0000ffff);
- break;
-
- case 2: // r, [r++]
- UML_MOV(block, I0, mem(&m_core->m_r[opb]));
- if (op0 != 0x0d)
- UML_CALLH(block, *m_mem_read);
- UML_ADD(block, I3, I0, 1);
- UML_AND(block, mem(&m_core->m_r[opb]), I3, 0x0000ffff);
- break;
-
- case 3: // r, [++r]
- UML_ADD(block, I0, mem(&m_core->m_r[opb]), 1);
- UML_AND(block, I0, I0, 0x0000ffff);
- UML_MOV(block, mem(&m_core->m_r[opb]), I0);
- if (op0 != 0x0d)
- UML_CALLH(block, *m_mem_read);
- break;
- default:
- // can't happen
- break;
- }
- }
- break;
- }
-
- case 0x04: // 16-bit ops
- switch (opn)
- {
- case 0x00: // r
- UML_MOV(block, I1, mem(&m_core->m_r[opb]));
- break;
-
- case 0x01: // imm16
- {
- UML_MOV(block, I2, mem(&m_core->m_r[opb]));
- const uint16_t r1 = m_pr16(desc->pc + 1);
- generate_add_lpc(block, 1);
- UML_MOV(block, I1, r1);
- break;
- }
-
- case 0x02: // [imm16]
- {
- UML_MOV(block, I2, mem(&m_core->m_r[opb]));
- const uint16_t r1 = m_pr16(desc->pc + 1);
- generate_add_lpc(block, 1);
- UML_MOV(block, I0, r1);
- if (op0 != 0x0d)
- UML_CALLH(block, *m_mem_read);
- break;
- }
-
- case 0x03: // store [imm16], r
- {
- UML_MOV(block, I1, I2);
- UML_MOV(block, I2, mem(&m_core->m_r[opb]));
- const uint16_t r2 = m_pr16(desc->pc + 1);
- generate_add_lpc(block, 1);
- UML_MOV(block, I0, r2);
- break;
- }
-
- default: // Shifted ops
- {
- UML_SHL(block, I0, mem(&m_core->m_r[opb]), 4);
- UML_OR(block, I0, I0, mem(&m_core->m_sb));
- UML_TEST(block, I0, 0x80000);
- UML_JMPc(block, uml::COND_Z, shift_no_sign);
- UML_OR(block, I0, I0, 0xf00000);
-
- UML_LABEL(block, shift_no_sign);
- UML_SHR(block, I0, I0, opn - 3);
- UML_AND(block, mem(&m_core->m_sb), I0, 0xf);
- UML_SHR(block, I1, I0, 4);
- UML_AND(block, I1, I1, 0x0000ffff);
- break;
- }
- }
- break;
-
- case 0x05: // More shifted ops
- if (opn & 4) // Shift right
- {
- UML_SHL(block, I0, mem(&m_core->m_r[opb]), 4);
- UML_OR(block, I0, I0, mem(&m_core->m_sb));
- UML_SHR(block, I0, I0, opn - 3);
- UML_AND(block, mem(&m_core->m_sb), I0, 0xf);
- UML_SHR(block, I1, I0, 4);
- UML_AND(block, I1, I1, 0x0000ffff);
- }
- else // Shift left
- {
- UML_SHL(block, I0, mem(&m_core->m_sb), 16);
- UML_OR(block, I0, I0, mem(&m_core->m_r[opb]));
- UML_SHL(block, I0, I0, opn + 1);
- UML_SHR(block, I1, I0, 16);
- UML_AND(block, mem(&m_core->m_sb), I1, 0xf);
- UML_AND(block, I1, I0, 0x0000ffff);
- }
- break;
-
- case 0x06: // Rotated ops
- {
- UML_SHL(block, I0, mem(&m_core->m_sb), 16);
- UML_OR(block, I0, I0, mem(&m_core->m_r[opb]));
- UML_SHL(block, I0, I0, 4);
- UML_OR(block, I0, I0, mem(&m_core->m_sb));
- if (opn & 4) // Rotate right
- {
- UML_SHR(block, I0, I0, opn - 3);
- UML_AND(block, mem(&m_core->m_sb), I0, 0xf);
- }
- else // Rotate left
- {
- UML_SHL(block, I0, I0, opn + 1);
- UML_SHR(block, I1, I0, 20);
- UML_AND(block, mem(&m_core->m_sb), I1, 0xf);
- }
- UML_SHR(block, I1, I0, 4);
- UML_AND(block, I1, I1, 0x0000ffff);
- break;
- }
-
- case 0x07: // Direct 8
- UML_MOV(block, I0, op & 0x3f);
- UML_CALLH(block, *m_mem_read);
- break;
-
- default:
- break;
- }
-
- switch (op0)
- {
- case 0x00: // Add
- UML_ADD(block, I3, I2, I1);
- if (opa != 7)
- generate_update_nzsc(block);
- break;
-
- case 0x01: // Add w/ carry
- UML_ROLAND(block, I3, mem(&m_core->m_r[REG_SR]), 32-UNSP_C_SHIFT, 1);
- UML_ADD(block, I3, I3, I2);
- UML_ADD(block, I3, I3, I1);
- if (opa != 7)
- generate_update_nzsc(block);
- break;
-
- case 0x02: // Subtract
- UML_XOR(block, I1, I1, 0x0000ffff);
- UML_ADD(block, I3, I1, I2);
- UML_ADD(block, I3, I3, 1);
- if (opa != 7)
- generate_update_nzsc(block);
- break;
-
- case 0x03: // Subtract w/ carry
- UML_XOR(block, I1, I1, 0x0000ffff);
- UML_ADD(block, I3, I1, I2);
- UML_TEST(block, mem(&m_core->m_r[REG_SR]), UNSP_C);
- UML_JMPc(block, uml::COND_Z, no_carry);
- UML_ADD(block, I3, I3, 1);
-
- UML_LABEL(block, no_carry);
- if (opa != 7)
- generate_update_nzsc(block);
- break;
-
- case 0x04: // Compare
- UML_XOR(block, I1, I1, 0x0000ffff);
- UML_ADD(block, I3, I1, I2);
- UML_ADD(block, I3, I3, 1);
- if (opa != 7)
- generate_update_nzsc(block);
- return true;
-
- case 0x06: // Negate
- UML_SUB(block, I3, 0, I1);
- if (opa != 7)
- generate_update_nz(block);
- break;
-
- case 0x08: // XOR
- UML_XOR(block, I3, I2, I1);
- if (opa != 7)
- generate_update_nz(block);
- break;
-
- case 0x09: // Load
- UML_MOV(block, I3, I1);
- if (opa != 7)
- generate_update_nz(block);
- break;
-
- case 0x0a: // OR
- UML_OR(block, I3, I2, I1);
- if (opa != 7)
- generate_update_nz(block);
- break;
-
- case 0x0b: // AND
- UML_AND(block, I3, I2, I1);
- if (opa != 7)
- generate_update_nz(block);
- break;
-
- case 0x0c: // Test
- UML_AND(block, I3, I2, I1);
- if (opa != 7)
- generate_update_nz(block);
- return true;
-
- case 0x0d: // Store
- UML_MOV(block, I1, I2);
- UML_CALLH(block, *m_mem_write);
- return true;
-
- default:
- return false;
- }
-
- if (op1 == 0x04 && opn == 0x03)
- {
- UML_MOV(block, I1, I3);
- UML_CALLH(block, *m_mem_write);
- return true;
- }
-
- UML_AND(block, mem(&m_core->m_r[opa]), I3, 0x0000ffff);
- if (opa == REG_PC)
- generate_branch(block, compiler, desc);
- return true;
-}
diff --git a/src/devices/cpu/unsp/unspfe.cpp b/src/devices/cpu/unsp/unspfe.cpp
deleted file mode 100644
index 3eb38b2198c..00000000000
--- a/src/devices/cpu/unsp/unspfe.cpp
+++ /dev/null
@@ -1,357 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-/***************************************************************************
-
- unspfe.cpp
-
- Front end for u'nSP recompiler
-
-***************************************************************************/
-
-#include "emu.h"
-#include "unspfe.h"
-#include "unspdefs.h"
-
-/***************************************************************************
- INSTRUCTION PARSERS
-***************************************************************************/
-
-unsp_frontend::unsp_frontend(unsp_device *unsp, uint32_t window_start, uint32_t window_end, uint32_t max_sequence)
- : drc_frontend(*unsp, window_start, window_end, max_sequence)
- , m_cpu(unsp)
-{
-}
-
-inline uint16_t unsp_frontend::read_op_word(opcode_desc &desc, int offset)
-{
- return m_cpu->m_pr16(desc.physpc + offset);
-}
-
-/*-------------------------------------------------
- describe - build a description of a single
- instruction
--------------------------------------------------*/
-
-bool unsp_frontend::describe(opcode_desc &desc, const opcode_desc *prev)
-{
- uint16_t op = desc.opptr.w[0] = read_op_word(desc, 0);
-
- /* most instructions are 1 word */
- desc.length = 1;
- desc.delayslots = 0;
-
- const uint16_t op0 = (op >> 12) & 15;
- const uint16_t opa = (op >> 9) & 7;
- const uint16_t op1 = (op >> 6) & 7;
- const uint16_t opn = (op >> 3) & 7;
- const uint16_t opb = op & 7;
-
- const uint8_t lower_op = (op1 << 4) | op0;
-
- if(op0 < 0xf && opa == 0x7 && op1 < 2)
- {
- desc.cycles = 2; // cycles for a taken branch will be added at execute time
-
- const uint32_t opimm = op & 0x3f;
- switch(op0)
- {
- case 0: // JB
- case 1: // JAE
- case 2: // JGE
- case 3: // JL
- case 4: // JNE
- case 5: // JE
- case 6: // JPL
- case 7: // JMI
- case 8: // JBE
- case 9: // JA
- case 10: // JLE
- case 11: // JG
- desc.regin[0] |= 1 << unsp_device::REG_SR;
- desc.regout[0] |= 1 << unsp_device::REG_SR;
- desc.regout[0] |= 1 << unsp_device::REG_PC;
- desc.targetpc = BRANCH_TARGET_DYNAMIC;
- desc.flags |= OPFLAG_IS_CONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE;
- return true;
- case 14: // JMP
- desc.regout[0] |= 1 << unsp_device::REG_SR;
- desc.regout[0] |= 1 << unsp_device::REG_PC;
- desc.targetpc = desc.pc + 1 + ((op1 == 0) ? opimm : (0 - opimm));
- desc.flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE;
- return true;
- default:
- return false;
- }
- }
- else if (lower_op == 0x2d) // Push
- {
- uint16_t r0 = opn;
- uint16_t r1 = opa;
- desc.cycles = 4 + 2 * r0;
- desc.regin[0] |= 1 << opb;
- desc.regout[0] |= 1 << opb;
- desc.flags |= OPFLAG_WRITES_MEMORY;
- while (r0--)
- {
- desc.regin[0] |= 1 << r1;
- r1--;
- }
- return true;
- }
- else if (lower_op == 0x29) // Pop
- {
- if (op == 0x9a98) // reti
- {
- desc.cycles = 8;
- desc.regin[0] |= 1 << unsp_device::REG_SP;
- desc.regout[0] |= 1 << unsp_device::REG_SP;
- desc.regout[0] |= 1 << unsp_device::REG_SR;
- desc.regout[0] |= 1 << unsp_device::REG_PC;
- desc.targetpc = BRANCH_TARGET_DYNAMIC;
- desc.flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE | OPFLAG_READS_MEMORY;
- return true;
- }
- else
- {
- uint16_t r0 = opn;
- uint16_t r1 = opa;
- desc.cycles = 4 + 2 * r0;
- desc.regin[0] |= 1 << opb;
- desc.regout[0] |= 1 << opb;
- desc.flags |= OPFLAG_READS_MEMORY;
-
- while (r0--)
- {
- r1++;
- desc.regout[0] |= 1 << r1;
- }
- return true;
- }
- }
- else if (op0 == 0xf)
- {
- switch (op1)
- {
- case 0x00: // Multiply, Unsigned * Signed
- case 0x04: // Multiply, Signed * Signed
- if(opn == 1 && opa != 7)
- {
- desc.cycles = 12;
- desc.regin[0] |= 1 << opa;
- desc.regin[0] |= 1 << opb;
- desc.regout[0] |= 1 << unsp_device::REG_R3;
- desc.regout[0] |= 1 << unsp_device::REG_R4;
- return true;
- }
- return false;
-
- case 0x01: // Call
- if(!(opa & 1))
- {
- desc.cycles = 9;
- desc.length = 2;
- desc.targetpc = read_op_word(desc, 1) | ((op & 0x3f) << 16);
- desc.flags = OPFLAG_READS_MEMORY | OPFLAG_WRITES_MEMORY | OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE;
- desc.regin[0] |= 1 << unsp_device::REG_PC;
- desc.regin[0] |= 1 << unsp_device::REG_SP;
- desc.regout[0] |= 1 << unsp_device::REG_SP;
- desc.regout[0] |= 1 << unsp_device::REG_SR;
- desc.regout[0] |= 1 << unsp_device::REG_PC;
- return true;
- }
- return false;
-
- case 0x02: // Far Jump
- if (opa == 7)
- {
- desc.cycles = 5;
- desc.length = 2;
- desc.targetpc = read_op_word(desc, 1) | ((op & 0x3f) << 16);
- desc.flags = OPFLAG_READS_MEMORY | OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE;
- desc.regin[0] |= 1 << unsp_device::REG_PC;
- desc.regout[0] |= 1 << unsp_device::REG_SR;
- desc.regout[0] |= 1 << unsp_device::REG_PC;
- return true;
- }
- return false;
-
- case 0x05: // Interrupt flags
- desc.cycles = 2;
- switch(op & 0x3f)
- {
- case 0:
- case 1:
- case 2:
- case 3:
- case 8:
- case 9:
- case 12:
- case 14:
- case 37:
- return true;
- }
- return false;
-
- default:
- return false;
- }
- }
-
- // At this point, we should be dealing solely with ALU ops.
-
- desc.regin[0] |= 1 << opa;
-
- switch (op1)
- {
- case 0x00: // r, [bp+imm6]
- desc.cycles = 6;
- desc.regin[0] |= 1 << unsp_device::REG_BP;
- if (op0 != 0x0d)
- desc.flags |= OPFLAG_READS_MEMORY;
- break;
-
- case 0x01: // r, imm6
- desc.cycles = 2;
- break;
-
- case 0x03: // Indirect
- {
- desc.cycles = (opa == 7 ? 7 : 6);
- const uint8_t lsbits = opn & 3;
- if (opn & 4)
- {
- switch (lsbits)
- {
- case 0: // r, [r]
- desc.regin[0] |= 1 << unsp_device::REG_SR;
- desc.regin[0] |= 1 << opb;
- if (op0 != 0x0d)
- desc.flags |= OPFLAG_READS_MEMORY;
- break;
-
- case 1: // r, [<ds:>r--]
- case 2: // r, [<ds:>r++]
- case 3: // r, [<ds:>++r]
- desc.regin[0] |= 1 << unsp_device::REG_SR;
- desc.regin[0] |= 1 << opb;
- desc.regout[0] |= 1 << unsp_device::REG_SR;
- desc.regout[0] |= 1 << opb;
- if (op0 != 0x0d)
- desc.flags |= OPFLAG_READS_MEMORY;
- break;
- }
- }
- else
- {
- switch (lsbits)
- {
- case 0: // r, [r]
- desc.regin[0] |= 1 << opb;
- if (op0 != 0x0d)
- desc.flags |= OPFLAG_READS_MEMORY;
- break;
- case 1: // r, [r--]
- case 2: // r, [r++]
- case 3: // r, [++r]
- desc.regin[0] |= 1 << opb;
- desc.regout[0] |= 1 << opb;
- if (op0 != 0x0d)
- desc.flags |= OPFLAG_READS_MEMORY;
- break;
- }
- }
- break;
- }
-
- case 0x04: // 16-bit ops
- switch (opn)
- {
- case 0x00: // r
- desc.cycles = (opa == 7 ? 5 : 3);
- desc.regin[0] |= 1 << opb;
- break;
-
- case 0x01: // imm16
- desc.cycles = (opa == 7 ? 5 : 4);
- desc.length = 2;
- desc.regin[0] |= 1 << opb;
- desc.regin[0] |= 1 << unsp_device::REG_SR;
- desc.regin[0] |= 1 << unsp_device::REG_PC;
- desc.regout[0] |= 1 << unsp_device::REG_SR;
- desc.regout[0] |= 1 << unsp_device::REG_PC;
- desc.flags |= OPFLAG_READS_MEMORY;
- break;
-
- case 0x02: // [imm16]
- case 0x03: // store [imm16], r
- desc.cycles = (opa == 7 ? 8 : 7);
- desc.length = 2;
- desc.regin[0] |= 1 << opb;
- desc.regin[0] |= 1 << unsp_device::REG_SR;
- desc.regin[0] |= 1 << unsp_device::REG_PC;
- desc.regout[0] |= 1 << unsp_device::REG_SR;
- desc.regout[0] |= 1 << unsp_device::REG_PC;
- desc.flags |= OPFLAG_READS_MEMORY;
- break;
-
- default: // Shifted ops
- desc.cycles = (opa == 7 ? 5 : 3);
- desc.regin[0] |= 1 << opb;
- break;
- }
- break;
-
- case 0x05: // More shifted ops
- case 0x06: // Rotated ops
- desc.cycles = (opa == 7 ? 5 : 3);
- desc.regin[0] |= 1 << opb;
- break;
-
- case 0x07: // Direct 8
- desc.cycles = (opa == 7 ? 6 : 5);
- desc.flags |= OPFLAG_READS_MEMORY;
- break;
-
- default:
- // Can't happen
- break;
- }
-
- switch (op0)
- {
- case 0x00: // Add
- case 0x01: // Add w/ carry
- case 0x02: // Subtract
- case 0x03: // Subtract w/ carry
- case 0x06: // Negate
- case 0x08: // XOR
- case 0x09: // Load
- case 0x0a: // OR
- case 0x0b: // AND
- desc.regout[0] |= 1 << unsp_device::REG_SR;
- break;
- case 0x04: // Compare
- case 0x0c: // Test
- desc.regout[0] |= 1 << unsp_device::REG_SR;
- return true;
- case 0x0d: // Store
- desc.flags |= OPFLAG_WRITES_MEMORY;
- return true;
- }
-
- if (op1 == 0x04 && opn == 0x03) // store [imm16], r
- {
- desc.flags |= OPFLAG_WRITES_MEMORY;
- }
- else
- {
- desc.regout[0] |= 1 << opa;
- if (opa == 7)
- {
- desc.targetpc = BRANCH_TARGET_DYNAMIC;
- desc.flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE;
- }
- }
-
- return true;
-}
diff --git a/src/devices/cpu/unsp/unspfe.h b/src/devices/cpu/unsp/unspfe.h
deleted file mode 100644
index c30b2721e0a..00000000000
--- a/src/devices/cpu/unsp/unspfe.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-#ifndef MAME_CPU_UNSP_UNSPFE_H
-#define MAME_CPU_UNSP_UNSPFE_H
-
-#pragma once
-
-#include "unsp.h"
-#include "cpu/drcfe.h"
-
-class unsp_frontend : public drc_frontend
-{
-public:
- unsp_frontend(unsp_device *unsp, uint32_t window_start, uint32_t window_end, uint32_t max_sequence);
- void flush();
-
-protected:
- // required overrides
- virtual bool describe(opcode_desc &desc, const opcode_desc *prev) override;
-
-private:
- inline uint16_t read_op_word(opcode_desc &desc, int offset);
-
- unsp_device *m_cpu;
-};
-
-#endif /* MAME_CPU_UNSP_UNSPFE_H */
diff --git a/src/devices/cpu/z8/z8.cpp b/src/devices/cpu/z8/z8.cpp
index 1359fea831f..d5e19fe831f 100644
--- a/src/devices/cpu/z8/z8.cpp
+++ b/src/devices/cpu/z8/z8.cpp
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
-// copyright-holders:Curt Coder, AJR
+// copyright-holders:Curt Coder
/**********************************************************************
Zilog Z8 Single-Chip MCU emulation
@@ -11,6 +11,8 @@
TODO:
- strobed I/O
+ - timer Tin/Tout modes
+ - serial
- instruction pipeline
- internal diagnostic ROM in data space (requires high voltage reset)
@@ -31,14 +33,14 @@
#define Z8_P3_RDY0 0x20 /* not supported */
#define Z8_P3_RDY1 0x10 /* not supported */
#define Z8_P3_RDY2 0x40 /* not supported */
-#define Z8_P3_IRQ0 0x04
-#define Z8_P3_IRQ1 0x08
-#define Z8_P3_IRQ2 0x02
-#define Z8_P3_IRQ3 0x01
-#define Z8_P3_SIN 0x01
-#define Z8_P3_SOUT 0x80
-#define Z8_P3_TIN 0x02
-#define Z8_P3_TOUT 0x40
+#define Z8_P3_IRQ0 0x04 /* not supported */
+#define Z8_P3_IRQ1 0x08 /* not supported */
+#define Z8_P3_IRQ2 0x02 /* not supported */
+#define Z8_P3_IRQ3 0x01 /* not supported */
+#define Z8_P3_DI 0x01 /* not supported */
+#define Z8_P3_DO 0x80 /* not supported */
+#define Z8_P3_TIN 0x02 /* not supported */
+#define Z8_P3_TOUT 0x40 /* not supported */
#define Z8_P3_DM 0x10 /* not supported */
#define Z8_PRE0_COUNT_MODULO_N 0x01
@@ -50,15 +52,15 @@
#define Z8_TMR_ENABLE_T0 0x02
#define Z8_TMR_LOAD_T1 0x04
#define Z8_TMR_ENABLE_T1 0x08
-#define Z8_TMR_TIN_MASK 0x30
-#define Z8_TMR_TIN_EXTERNAL_CLK 0x00
-#define Z8_TMR_TIN_GATE 0x10
-#define Z8_TMR_TIN_TRIGGER 0x20
-#define Z8_TMR_TIN_RETRIGGER 0x30
-#define Z8_TMR_TOUT_MASK 0xc0
-#define Z8_TMR_TOUT_OFF 0x00
-#define Z8_TMR_TOUT_T0 0x40
-#define Z8_TMR_TOUT_T1 0x80
+#define Z8_TMR_TIN_MASK 0x30 /* not supported */
+#define Z8_TMR_TIN_EXTERNAL_CLK 0x00 /* not supported */
+#define Z8_TMR_TIN_GATE 0x10 /* not supported */
+#define Z8_TMR_TIN_TRIGGER 0x20 /* not supported */
+#define Z8_TMR_TIN_RETRIGGER 0x30 /* not supported */
+#define Z8_TMR_TOUT_MASK 0xc0 /* not supported */
+#define Z8_TMR_TOUT_OFF 0x00 /* not supported */
+#define Z8_TMR_TOUT_T0 0x40 /* not supported */
+#define Z8_TMR_TOUT_T1 0x80 /* not supported */
#define Z8_TMR_TOUT_INTERNAL_CLK 0xc0 /* not supported */
#define Z8_P01M_P0L_MODE_MASK 0x03
@@ -117,7 +119,6 @@ DEFINE_DEVICE_TYPE(UB8830D, ub8830d_device, "ub8830d", "UB8830D")
DEFINE_DEVICE_TYPE(Z8611, z8611_device, "z8611", "Zilog Z8611")
DEFINE_DEVICE_TYPE(Z8671, z8671_device, "z8671", "Zilog Z8671")
DEFINE_DEVICE_TYPE(Z8681, z8681_device, "z8681", "Zilog Z8681")
-DEFINE_DEVICE_TYPE(Z8682, z8682_device, "z8682", "Zilog Z8682")
/***************************************************************************
@@ -169,7 +170,6 @@ z8_device::z8_device(const machine_config &mconfig, device_type type, const char
, m_input_cb{{*this}, {*this}, {*this}, {*this}}
, m_output_cb{{*this}, {*this}, {*this}, {*this}}
, m_rom_size(rom_size)
- , m_input{0xff, 0xff, 0xff, 0x0f}
{
assert(((rom_size - 1) & rom_size) == 0);
}
@@ -215,23 +215,6 @@ z8681_device::z8681_device(const machine_config &mconfig, const char *tag, devic
}
-z8682_device::z8682_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : z8_device(mconfig, Z8682, tag, owner, clock, 0x800, true)
-{
-}
-
-ROM_START(z8682)
- // Zilog admits that this nominally ROMless type uses a "small internal ROM"
- ROM_REGION(0x0800, "internal", ROMREGION_ERASEFF)
- ROM_LOAD("testrom.bin", 0x0000, 0x0038, CRC(b2239f28) SHA1(9d27957ba0f15657eac5a7295157af6ee51cb261) BAD_DUMP) // typed in from "Z8 MCU Test Mode" application note
-ROM_END
-
-const tiny_rom_entry *z8682_device::device_rom_region() const
-{
- return ROM_NAME(z8682);
-}
-
-
std::unique_ptr<util::disasm_interface> z8_device::create_disassembler()
{
return std::make_unique<z8_disassembler>();
@@ -435,257 +418,43 @@ void z8_device::p2_write(uint8_t data)
m_output_cb[2](0, data & mask, mask);
}
-void z8_device::p3_update_output()
-{
- uint8_t output = m_output[3] & 0xf0;
-
- if ((m_tmr & Z8_TMR_TOUT_MASK) != Z8_TMR_TOUT_OFF)
- output = (output & ~Z8_P3_TOUT) | (m_tout ? Z8_P3_TOUT : 0);
- if ((m_p3m & Z8_P3M_P3_SERIAL) != 0)
- output = (output & ~Z8_P3_SOUT) | ((m_transmit_sr == 0 || BIT(m_transmit_sr, 0)) ? Z8_P3_SOUT : 0);
-
- if (m_p3_output != output)
- {
- m_output_cb[3](0, output, output ^ m_p3_output);
- m_p3_output = output;
- }
-}
-
uint8_t z8_device::p3_read()
{
uint8_t mask = 0x0f;
- uint8_t inputs = m_input[3] & m_input_cb[3](0, mask);
// TODO: special port 3 modes
//if (!(m_p3m & 0x7c))
//{
//}
- return (inputs & mask) | (m_p3_output & ~mask);
+ if (mask)
+ m_input[3] = m_input_cb[3](0, mask);
+
+ return (m_input[3] & mask) | (m_output[3] & ~mask);
}
void z8_device::p3_write(uint8_t data)
{
- m_output[3] = data & 0xf0;
+ uint8_t mask = 0xf0;
+
+ m_output[3] = data;
// TODO: special port 3 modes
//if (!(m_p3m & 0x7c))
//{
//}
- p3_update_output();
-}
-
-bool z8_device::get_serial_in()
-{
- return (m_input[3] & Z8_P3_SIN) != 0;
-}
-
-void z8_device::sio_receive()
-{
- if (m_receive_started)
- {
- m_receive_count = (m_receive_count + 1) & 15;
- if (m_receive_count == 8)
- {
- if (m_receive_sr == 0)
- {
- if (!get_serial_in())
- {
- // start bit validated
- m_receive_sr |= 1 << 9;
- m_receive_parity = false;
- }
- else
- {
- // false start bit
- m_receive_started = false;
- m_receive_count = 0;
- }
- }
- else
- {
- // shift in data, parity or stop bit
- m_receive_sr >>= 1;
- if (get_serial_in())
- m_receive_sr |= 1 << 9;
-
- if (BIT(m_receive_sr, 0))
- {
- // received full character
- m_receive_buffer = (m_receive_sr & 0x1fe) >> 1;
- request_interrupt(3);
- m_receive_started = false;
- m_receive_count = 0;
- }
- else
- {
- if (BIT(m_receive_sr, 9))
- m_receive_parity = !m_receive_parity;
-
- // parity replaces received bit 7 if selected
- if (BIT(m_receive_sr, 1) && (m_p3m & Z8_P3M_PARITY) != 0)
- {
- if (m_receive_parity)
- m_receive_sr |= 1 << 9;
- else
- m_receive_sr &= ~(1 << 9);
- }
- }
- }
- }
- }
- else
- {
- // start bit is high-low transition
- m_receive_sr >>= 1;
- if (get_serial_in())
- m_receive_sr |= 1 << 9;
- else if (BIT(m_receive_sr, 8))
- {
- m_receive_started = true;
- m_receive_sr = 0;
- m_receive_count = 0;
- }
- }
-}
-
-void z8_device::sio_transmit()
-{
- if (m_transmit_sr == 0)
- return;
-
- m_transmit_count = (m_transmit_count + 1) & 15;
- if (m_transmit_count == 0)
- {
- m_transmit_sr >>= 1;
- if (m_transmit_sr == 0)
- request_interrupt(4);
- else
- {
- // parity replaces received bit 7 if selected
- if ((m_transmit_sr >> 1) == 3 && (m_p3m & Z8_P3M_PARITY) != 0)
- {
- if (m_transmit_parity)
- m_transmit_sr |= 1;
- else
- m_transmit_sr &= ~1;
- }
- else if (BIT(m_transmit_sr, 0))
- m_transmit_parity = !m_transmit_parity;
-
- // serial output
- p3_update_output();
- }
- }
+ if (mask)
+ m_output_cb[3](0, data & mask, mask);
}
uint8_t z8_device::sio_read()
{
- return m_receive_buffer;
+ return 0xff;
}
void z8_device::sio_write(uint8_t data)
{
- // overwrite shift register with data + 1 start bit + 2 stop bits
- m_transmit_sr = (m_transmit_sr & 1) | (uint16_t(data) << 2) | (3 << 10);
- m_transmit_parity = false;
-
- // synchronize the shift clock
- m_transmit_count = 15;
-}
-
-template <int T>
-void z8_device::timer_start()
-{
- unsigned prescaler = (m_pre[T] >> 2) ? (m_pre[T] >> 2) : 64;
- unsigned full_count = (m_count[T] ? m_count[T] - 1 : 255) * prescaler + (m_pre_count[T] ? m_pre_count[T] : 64);
- m_internal_timer[T]->adjust(cycles_to_attotime(4 * full_count));
-}
-
-template <int T>
-void z8_device::timer_stop()
-{
- if (!m_internal_timer[T]->enabled())
- return;
-
- unsigned prescaler = (m_pre[T] >> 2) ? (m_pre[T] >> 2) : 64;
- unsigned remaining = attotime_to_cycles(m_internal_timer[T]->remaining() / 4);
-
- m_count[T] = remaining / prescaler + 1;
- m_pre_count[T] = (remaining % prescaler + 1) & 0x3f;
-
- m_internal_timer[T]->enable(false);
-}
-
-template <int T>
-void z8_device::timer_end()
-{
- if ((m_tmr & Z8_TMR_TOUT_MASK) == (T == 0 ? Z8_TMR_TOUT_T0 : Z8_TMR_TOUT_T1))
- tout_toggle();
-
- if (T == 0 && (m_p3m & Z8_P3M_P3_SERIAL) != 0)
- {
- sio_receive();
- sio_transmit();
- }
- else
- request_interrupt(4 + T);
-
- m_pre_count[T] = m_pre[T] >> 2;
- if (m_pre[T] & Z8_PRE0_COUNT_MODULO_N)
- m_count[T] = m_t[T];
- else
- m_tmr &= ~(T == 0 ? Z8_TMR_ENABLE_T0 : Z8_TMR_ENABLE_T1);
-}
-
-void z8_device::t1_trigger()
-{
- switch (m_tmr & Z8_TMR_TIN_MASK)
- {
- case Z8_TMR_TIN_EXTERNAL_CLK:
- m_pre_count[1]--;
- if (m_pre_count[1] == 0)
- {
- m_pre_count[1] = m_pre[1];
- if ((m_tmr & Z8_TMR_ENABLE_T1) != 0)
- {
- m_count[1]--;
- if (m_count[1] == 0)
- timer_end<1>();
- }
- }
- break;
-
- case Z8_TMR_TIN_GATE:
- timer_stop<1>();
- break;
-
- case Z8_TMR_TIN_TRIGGER:
- if (m_internal_timer[1]->enabled())
- break;
-
- case Z8_TMR_TIN_RETRIGGER:
- if ((m_tmr & Z8_TMR_ENABLE_T1) != 0)
- {
- m_count[1] = m_t[1];
- m_pre_count[1] = m_pre[1] >> 2;
- timer_start<1>();
- }
- break;
- }
-}
-
-void z8_device::tout_init()
-{
- m_tout = true;
- p3_update_output();
-}
-
-void z8_device::tout_toggle()
-{
- m_tout = !m_tout;
- p3_update_output();
}
uint8_t z8_device::tmr_read()
@@ -695,80 +464,28 @@ uint8_t z8_device::tmr_read()
void z8_device::tmr_write(uint8_t data)
{
- m_tmr = data & ~(Z8_TMR_LOAD_T0 | Z8_TMR_LOAD_T1); // actually reset on next internal clock
-
- bool t1_internal = (m_pre[1] & Z8_PRE1_INTERNAL_CLOCK) != 0;
- bool t0_load = (data & Z8_TMR_LOAD_T0) != 0;
- bool t1_load = (data & Z8_TMR_LOAD_T1) != 0;
- bool t0_enable = (data & Z8_TMR_ENABLE_T0) != 0;
- bool t1_enable = (data & Z8_TMR_ENABLE_T1) != 0;
+ m_tmr = data;
- if (!t1_internal && ((data & Z8_TMR_TIN_MASK) == Z8_TMR_TIN_GATE))
- {
- if ((m_input[3] & Z8_P3_TIN) != 0)
- t1_internal = true;
- else
- t1_enable = false;
- }
-
- if (t0_load)
+ if (data & Z8_TMR_LOAD_T0)
{
m_count[0] = m_t[0];
- m_pre_count[0] = m_pre[0] >> 2;
-
- if ((m_pre[0] & Z8_PRE0_COUNT_MODULO_N) != 0)
- {
- unsigned prescaler = (m_pre[0] >> 2) ? (m_pre[0] >> 2) : 64;
- unsigned count = (m_t[0] ? m_t[0] : 256) * prescaler;
- logerror("(%04X): Load T0 at %.2f Hz\n", m_ppc, clock() / 8.0 / count);
- }
-
- if ((data & Z8_TMR_TOUT_MASK) == Z8_TMR_TOUT_T0)
- tout_init();
+ m_t0_timer->adjust(attotime::zero, 0, cycles_to_attotime(4 * ((m_pre[0] >> 2) + 1)));
}
- if (t0_enable)
- {
- if (t0_load || !m_internal_timer[0]->enabled())
- timer_start<0>();
- }
- else
- timer_stop<0>();
+ m_t0_timer->enable(data & Z8_TMR_ENABLE_T0);
- if (t1_load)
+ if (data & Z8_TMR_LOAD_T1)
{
m_count[1] = m_t[1];
- m_pre_count[1] = m_pre[1] >> 2;
-
- if (t1_internal && (m_pre[1] & Z8_PRE0_COUNT_MODULO_N) != 0)
- {
- unsigned prescaler = (m_pre[1] >> 2) ? (m_pre[1] >> 2) : 64;
- unsigned count = (m_t[1] ? m_t[1] : 256) * prescaler;
- logerror("(%04X): Load T1 at %.2f Hz\n", m_ppc, clock() / 8.0 / count);
- }
-
- if ((data & Z8_TMR_TOUT_MASK) == Z8_TMR_TOUT_T1)
- tout_init();
+ m_t1_timer->adjust(attotime::zero, 0, cycles_to_attotime(4 * ((m_pre[1] >> 2) + 1)));
}
- if (t1_enable)
- {
- if (t1_internal && (t1_load || !m_internal_timer[1]->enabled()))
- timer_start<1>();
- }
- else
- timer_stop<1>();
+ m_t1_timer->enable(data & Z8_TMR_ENABLE_T1);
}
uint8_t z8_device::t0_read()
{
- if (!m_internal_timer[0]->enabled())
- return m_count[0];
-
- unsigned prescaler = (m_pre[0] >> 2) ? (m_pre[0] >> 2) : 64;
- unsigned remaining = attotime_to_cycles(m_internal_timer[0]->remaining() / 4);
-
- return remaining / prescaler + 1;
+ return m_count[0];
}
void z8_device::t0_write(uint8_t data)
@@ -778,13 +495,7 @@ void z8_device::t0_write(uint8_t data)
uint8_t z8_device::t1_read()
{
- if (!m_internal_timer[1]->enabled())
- return m_count[1];
-
- unsigned prescaler = (m_pre[1] >> 2) ? (m_pre[1] >> 2) : 64;
- unsigned remaining = attotime_to_cycles(m_internal_timer[1]->remaining() / 4);
-
- return remaining / prescaler + 1;
+ return m_count[1];
}
void z8_device::t1_write(uint8_t data)
@@ -794,28 +505,12 @@ void z8_device::t1_write(uint8_t data)
void z8_device::pre0_write(uint8_t data)
{
- if (m_internal_timer[0]->enabled())
- {
- timer_stop<0>();
- m_pre[0] = data;
- timer_start<0>();
- }
- else
- m_pre[0] = data;
+ m_pre[0] = data;
}
void z8_device::pre1_write(uint8_t data)
{
- bool was_enabled = m_internal_timer[1]->enabled();
- if (was_enabled)
- timer_stop<1>();
-
m_pre[1] = data;
-
- if ((data & Z8_PRE1_INTERNAL_CLOCK) != 0
- ? (m_tmr & Z8_TMR_ENABLE_T1) != 0
- : was_enabled && (m_tmr & Z8_TMR_TIN_MASK) != Z8_TMR_TIN_EXTERNAL_CLK)
- timer_start<1>();
}
void z8_device::p01m_write(uint8_t data)
@@ -830,16 +525,7 @@ void z8_device::p2m_write(uint8_t data)
void z8_device::p3m_write(uint8_t data)
{
- if ((data & Z8_P3M_P3_SERIAL) == 0)
- {
- m_transmit_sr = 0;
- m_transmit_count = 0;
- m_receive_started = false;
- m_receive_count = 0;
- }
-
m_p3m = data;
- p3_update_output();
}
void z8_device::ipr_write(uint8_t data)
@@ -919,12 +605,12 @@ void z8_device::register_pair_write(uint8_t offset, uint16_t data)
m_regs->write_word_unaligned(offset, data);
}
-uint8_t z8_device::get_working_register(int offset) const
+uint8_t z8_device::get_working_register(int offset)
{
return (m_rp & 0xf0) | (offset & 0x0f);
}
-uint8_t z8_device::get_register(uint8_t offset) const
+uint8_t z8_device::get_register(uint8_t offset)
{
if ((offset & 0xf0) == 0xe0)
return get_working_register(offset & 0x0f);
@@ -1152,17 +838,29 @@ const z8_device::z8_opcode_map z8_device::Z8601_OPCODE_MAP[256] =
TIMER CALLBACKS
***************************************************************************/
-template <int T>
-TIMER_CALLBACK_MEMBER(z8_device::timeout)
+TIMER_CALLBACK_MEMBER( z8_device::t0_tick )
{
- timer_end<T>();
+ m_count[0]--;
- if (m_pre[T] & Z8_PRE0_COUNT_MODULO_N)
- timer_start<T>();
- else
+ if (m_count[0] == 0)
{
- m_count[T] = 0;
- m_internal_timer[T]->enable(false);
+ m_count[0] = m_t[0];
+ m_t0_timer->adjust(attotime::zero, 0, cycles_to_attotime(4 * ((m_pre[0] >> 2) + 1)));
+ m_t0_timer->enable(m_pre[0] & Z8_PRE0_COUNT_MODULO_N);
+ request_interrupt(4);
+ }
+}
+
+TIMER_CALLBACK_MEMBER( z8_device::t1_tick )
+{
+ m_count[1]--;
+
+ if (m_count[1] == 0)
+ {
+ m_count[1] = m_t[1];
+ m_t1_timer->adjust(attotime::zero, 0, cycles_to_attotime(4 * ((m_pre[1] >> 2) + 1)));
+ m_t1_timer->enable(m_pre[1] & Z8_PRE0_COUNT_MODULO_N);
+ request_interrupt(5);
}
}
@@ -1202,7 +900,6 @@ void z8_device::device_start()
state_add(Z8_PRE1, "PRE1", m_pre[1]);
state_add(Z8_T1, "T1", m_t[1]);
state_add(Z8_TMR, "TMR", m_tmr);
- state_add(Z8_TOUT, "TOUT", m_tout);
for (int regnum = 0; regnum < 16; regnum++)
state_add(Z8_R0 + regnum, string_format("R%d", regnum).c_str(), m_fake_r[regnum]).callimport().callexport();
@@ -1215,16 +912,16 @@ void z8_device::device_start()
m_regs = &space(AS_IO);
/* allocate timers */
- m_internal_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z8_device::timeout<0>), this));
- m_internal_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z8_device::timeout<1>), this));
+ m_t0_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z8_device::t0_tick), this));
+ m_t1_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z8_device::t1_tick), this));
/* Clear state */
std::fill(std::begin(m_irq_line), std::end(m_irq_line), CLEAR_LINE);
+ std::fill(std::begin(m_input), std::end(m_input), 0);
std::fill(std::begin(m_output), std::end(m_output), 0);
std::fill(std::begin(m_t), std::end(m_t), 0);
std::fill(std::begin(m_count), std::end(m_count), 0);
std::fill(std::begin(m_pre), std::end(m_pre), 0);
- std::fill(std::begin(m_pre_count), std::end(m_pre_count), 0);
std::fill(std::begin(m_fake_r), std::end(m_fake_r), 0);
m_pc = 0;
m_ppc = 0;
@@ -1234,17 +931,7 @@ void z8_device::device_start()
m_p01m = 0;
m_p2m = 0;
m_p3m = 0;
- m_p3_output = 0;
m_tmr = 0;
- m_tout = true;
- m_transmit_sr = 0;
- m_transmit_count = 0;
- m_transmit_parity = false;
- m_receive_buffer = 0;
- m_receive_sr = 0;
- m_receive_count = 0;
- m_receive_parity = false;
- m_receive_started = false;
m_irq_taken = false;
m_irq_initialized = false;
@@ -1259,21 +946,10 @@ void z8_device::device_start()
save_item(NAME(m_p01m));
save_item(NAME(m_p2m));
save_item(NAME(m_p3m));
- save_item(NAME(m_p3_output));
save_item(NAME(m_tmr));
save_item(NAME(m_t));
- save_item(NAME(m_tout));
- save_item(NAME(m_transmit_sr));
- save_item(NAME(m_transmit_count));
- save_item(NAME(m_transmit_parity));
- save_item(NAME(m_receive_buffer));
- save_item(NAME(m_receive_sr));
- save_item(NAME(m_receive_count));
- save_item(NAME(m_receive_parity));
- save_item(NAME(m_receive_started));
save_item(NAME(m_count));
save_item(NAME(m_pre));
- save_item(NAME(m_pre_count));
save_item(NAME(m_irq_line));
save_item(NAME(m_irq_taken));
save_item(NAME(m_irq_initialized));
@@ -1303,7 +979,6 @@ void z8_device::take_interrupt(int irq)
// acknowledge the IRQ
m_irq &= ~(1 << irq);
- standard_irq_callback(irq);
// get the interrupt vector address
uint16_t vector = irq * 2;
@@ -1474,16 +1149,14 @@ void z8_device::device_reset()
m_imr &= ~Z8_IMR_ENABLE;
m_irq_initialized = false;
- m_pre[0] &= ~Z8_PRE0_COUNT_MODULO_N;
- m_pre[1] &= ~(Z8_PRE1_COUNT_MODULO_N | Z8_PRE1_INTERNAL_CLOCK);
- m_tmr = 0x00;
- timer_stop<0>();
- timer_stop<1>();
-
- m_output[3] = 0xf0;
p01m_write(0x4d);
p2m_write(0xff);
p3m_write(0x00);
+ p3_write(m_output[3] | 0xf0);
+
+ m_pre[0] &= ~Z8_PRE0_COUNT_MODULO_N;
+ m_pre[1] &= ~(Z8_PRE1_COUNT_MODULO_N | Z8_PRE1_INTERNAL_CLOCK);
+ tmr_write(0x00);
}
@@ -1507,7 +1180,7 @@ void z8_device::state_import(const device_state_entry &entry)
case Z8_R0: case Z8_R1: case Z8_R2: case Z8_R3: case Z8_R4: case Z8_R5: case Z8_R6: case Z8_R7: case Z8_R8: case Z8_R9: case Z8_R10: case Z8_R11: case Z8_R12: case Z8_R13: case Z8_R14: case Z8_R15:
{
auto dis = machine().disable_side_effects();
- register_write((m_rp & 0xf0) + (entry.index() - Z8_R0), m_fake_r[entry.index() - Z8_R0]);
+ register_write(m_rp + (entry.index() - Z8_R0), m_fake_r[entry.index() - Z8_R0]);
break;
}
@@ -1523,7 +1196,7 @@ void z8_device::state_export(const device_state_entry &entry)
case Z8_R0: case Z8_R1: case Z8_R2: case Z8_R3: case Z8_R4: case Z8_R5: case Z8_R6: case Z8_R7: case Z8_R8: case Z8_R9: case Z8_R10: case Z8_R11: case Z8_R12: case Z8_R13: case Z8_R14: case Z8_R15:
{
auto dis = machine().disable_side_effects();
- m_fake_r[entry.index() - Z8_R0] = register_read((m_rp & 0xf0) + (entry.index() - Z8_R0));
+ m_fake_r[entry.index() - Z8_R0] = register_read(m_rp + (entry.index() - Z8_R0));
break;
}
@@ -1551,60 +1224,29 @@ void z8_device::execute_set_input(int inputnum, int state)
{
switch ( inputnum )
{
- case INPUT_LINE_IRQ0:
- if (state != CLEAR_LINE && m_irq_line[0] == CLEAR_LINE)
- request_interrupt(0);
- m_irq_line[0] = state;
-
- if (state != CLEAR_LINE && (m_input[3] & Z8_P3_IRQ0) != 0)
- m_input[3] &= ~Z8_P3_IRQ0;
- else if (state == CLEAR_LINE && (m_input[3] & Z8_P3_IRQ0) == 0)
- m_input[3] |= Z8_P3_IRQ0;
-
- break;
-
- case INPUT_LINE_IRQ1:
- if (state != CLEAR_LINE && m_irq_line[1] == CLEAR_LINE)
- request_interrupt(1);
- m_irq_line[1] = state;
-
- if (state != CLEAR_LINE && (m_input[3] & Z8_P3_IRQ1) != 0)
- m_input[3] &= ~Z8_P3_IRQ1;
- else if (state == CLEAR_LINE && (m_input[3] & Z8_P3_IRQ1) == 0)
- m_input[3] |= Z8_P3_IRQ1;
-
- break;
-
- case INPUT_LINE_IRQ2:
- if (state != CLEAR_LINE && m_irq_line[2] == CLEAR_LINE)
- request_interrupt(2);
- m_irq_line[2] = state;
-
- if (state != CLEAR_LINE && (m_input[3] & Z8_P3_IRQ2) != 0)
- {
- m_input[3] &= ~Z8_P3_IRQ2;
- if ((m_pre[1] & Z8_PRE1_INTERNAL_CLOCK) == 0)
- t1_trigger();
- }
- else if (state == CLEAR_LINE && (m_input[3] & Z8_P3_IRQ2) == 0)
- {
- m_input[3] |= Z8_P3_IRQ2;
- if ((m_pre[1] & Z8_PRE1_INTERNAL_CLOCK) == 0 && (m_tmr & Z8_TMR_TIN_MASK) == Z8_TMR_TIN_GATE)
- timer_start<1>();
- }
+ case INPUT_LINE_IRQ0:
+ if (state != CLEAR_LINE && m_irq_line[0] == CLEAR_LINE)
+ request_interrupt(0);
+ m_irq_line[0] = state;
+ break;
- break;
+ case INPUT_LINE_IRQ1:
+ if (state != CLEAR_LINE && m_irq_line[1] == CLEAR_LINE)
+ request_interrupt(1);
+ m_irq_line[1] = state;
+ break;
- case INPUT_LINE_IRQ3:
- if (state != CLEAR_LINE && m_irq_line[3] == CLEAR_LINE && (m_p3m & Z8_P3M_P3_SERIAL) == 0)
- request_interrupt(3);
- m_irq_line[3] = state;
+ case INPUT_LINE_IRQ2:
+ if (state != CLEAR_LINE && m_irq_line[2] == CLEAR_LINE)
+ request_interrupt(2);
+ m_irq_line[2] = state;
+ break;
- if (state != CLEAR_LINE && (m_input[3] & Z8_P3_IRQ3) != 0)
- m_input[3] &= ~Z8_P3_IRQ3;
- else if (state == CLEAR_LINE && (m_input[3] & Z8_P3_IRQ3) == 0)
- m_input[3] |= Z8_P3_IRQ3;
+ case INPUT_LINE_IRQ3:
+ if (state != CLEAR_LINE && m_irq_line[3] == CLEAR_LINE)
+ request_interrupt(3);
+ m_irq_line[3] = state;
+ break;
- break;
}
}
diff --git a/src/devices/cpu/z8/z8.h b/src/devices/cpu/z8/z8.h
index c74f3ec839f..0bdd235d7c2 100644
--- a/src/devices/cpu/z8/z8.h
+++ b/src/devices/cpu/z8/z8.h
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
-// copyright-holders:Curt Coder, AJR
+// copyright-holders:Curt Coder
/**********************************************************************
Zilog Z8 Single-Chip MCU emulation
@@ -32,7 +32,7 @@ protected:
Z8_IMR, Z8_IRQ, Z8_IPR,
Z8_P0, Z8_P1, Z8_P2, Z8_P3,
Z8_P01M, Z8_P3M, Z8_P2M,
- Z8_PRE0, Z8_T0, Z8_PRE1, Z8_T1, Z8_TMR, Z8_TOUT,
+ Z8_PRE0, Z8_T0, Z8_PRE1, Z8_T1, Z8_TMR,
Z8_R0, Z8_R1, Z8_R2, Z8_R3, Z8_R4, Z8_R5, Z8_R6, Z8_R7, Z8_R8, Z8_R9, Z8_R10, Z8_R11, Z8_R12, Z8_R13, Z8_R14, Z8_R15
};
@@ -101,33 +101,18 @@ private:
uint8_t m_p01m; // port 0/1 mode
uint8_t m_p2m; // port 2 mode
uint8_t m_p3m; // port 3 mode
- uint8_t m_p3_output; // port 3 output (alternate functions included)
// timer registers
uint8_t m_tmr; // timer mode
uint8_t m_t[2]; // initial values
uint8_t m_count[2]; // current counts
uint8_t m_pre[2]; // prescalers
- uint8_t m_pre_count[2]; // prescaler counts
- bool m_tout; // toggle output
-
- // serial transmitter registers
- uint16_t m_transmit_sr; // transmitter shift register
- uint8_t m_transmit_count; // counter for transmitter timing
- bool m_transmit_parity; // transmitter parity calculation
-
- // serial receiver registers
- uint8_t m_receive_buffer; // received character
- uint16_t m_receive_sr; // receiver shift register
- uint8_t m_receive_count; // counter for receiver timing
- bool m_receive_parity; // receiver parity calculation
- bool m_receive_started; // true if receiver has seen start bit
// fake registers
uint8_t m_fake_r[16]; // fake working registers
// interrupts
- int m_irq_line[4];
+ int m_irq_line[4]; // IRQ line state
bool m_irq_taken;
bool m_irq_initialized; // IRQ must be unlocked by EI after reset
@@ -135,20 +120,11 @@ private:
int32_t m_icount; // instruction counter
// timers
- emu_timer *m_internal_timer[2];
-
- bool get_serial_in();
- void sio_receive();
- void sio_transmit();
-
- template <int T> void timer_start();
- template <int T> void timer_stop();
- template <int T> void timer_end();
- void t1_trigger();
- void tout_init();
- void tout_toggle();
+ emu_timer *m_t0_timer;
+ emu_timer *m_t1_timer;
- template <int T> TIMER_CALLBACK_MEMBER(timeout);
+ TIMER_CALLBACK_MEMBER( t0_tick );
+ TIMER_CALLBACK_MEMBER( t1_tick );
void request_interrupt(int irq);
void take_interrupt(int irq);
@@ -162,7 +138,6 @@ private:
void p2_write(uint8_t data);
uint8_t p3_read();
void p3_write(uint8_t data);
- void p3_update_output();
uint8_t sio_read();
void sio_write(uint8_t data);
uint8_t tmr_read();
@@ -198,8 +173,8 @@ private:
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_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;
+ inline uint8_t get_working_register(int offset);
+ inline uint8_t get_register(uint8_t offset);
inline uint8_t get_intermediate_register(int offset);
inline void stack_push_byte(uint8_t src);
inline void stack_push_word(uint16_t src);
@@ -421,16 +396,6 @@ public:
};
-class z8682_device : public z8_device
-{
-public:
- z8682_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-protected:
- const tiny_rom_entry *device_rom_region() const override;
-};
-
-
// Zilog Z8601
DECLARE_DEVICE_TYPE(Z8601, z8601_device)
@@ -446,7 +411,4 @@ DECLARE_DEVICE_TYPE(Z8671, z8671_device)
// Zilog Z8681 ROMless
DECLARE_DEVICE_TYPE(Z8681, z8681_device)
-// Zilog Z8682 ROMless (boot to 0812H)
-DECLARE_DEVICE_TYPE(Z8682, z8682_device)
-
#endif // MAME_CPU_Z8_Z8_H
diff --git a/src/devices/cpu/z8/z8dasm.cpp b/src/devices/cpu/z8/z8dasm.cpp
index 08e50ca1eae..35d18fab880 100644
--- a/src/devices/cpu/z8/z8dasm.cpp
+++ b/src/devices/cpu/z8/z8dasm.cpp
@@ -39,7 +39,6 @@ const char *const z8_disassembler::CONDITION_CODE[16] =
***************************************************************************/
#define r "R%u"
-#define rr "RR%u"
#define Ir "@R%u"
#define R "%02Xh"
#define RR "%02Xh"
@@ -65,7 +64,7 @@ const char *const z8_disassembler::CONDITION_CODE[16] =
#define arg_Ir(_value) ARG(Ir, _value)
#define arg_Irr(_value) ARG(Irr, _value & 0x0f)
#define arg_R(_value) if ((_value & 0xf0) == 0xe0) ARG(r, _value & 0x0f) else if ((_value < 4) || (_value >= 0xf0)) arg_name(_value) else ARG(R, _value)
-#define arg_RR(_value) if ((_value & 0xf0) == 0xe0) ARG(rr, _value & 0x0f) else ARG(R, _value)
+#define arg_RR(_value) if ((_value & 0xf0) == 0xe0) ARG(r, _value & 0x0f) else ARG(R, _value)
#define arg_IR(_value) if ((_value & 0xf0) == 0xe0) ARG(Ir, _value & 0x0f) else ARG(IR, _value)
#define arg_IRR(_value) if ((_value & 0xf0) == 0xe0) ARG(Irr, _value & 0x0f) else ARG(IRR, _value)
#define arg_IM(_value) ARG(IM, _value)
@@ -367,7 +366,7 @@ offs_t z8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_
case 0xf2: illegal; break;
case 0xf3: mnemonic("LD"); arg_Ir(B0H); arg_r(B0L); bytes(2); break;
case 0xf4: illegal; break;
- case 0xf5: mnemonic("LD"); arg_IR(B1); arg_R(B0); bytes(3); break;
+ case 0xf5: mnemonic("LD"); arg_IR(B0); arg_R(B1); bytes(3); break;
case 0xf6: illegal; break;
case 0xf7: illegal; break;
case 0xf8: mnemonic("LD"); arg_r(OPH); arg_R(B0); bytes(2); break;
diff --git a/src/devices/cpu/z80/kl5c80a12.cpp b/src/devices/cpu/z80/kl5c80a12.cpp
index a061f3e7cf3..44e1d9256b3 100644
--- a/src/devices/cpu/z80/kl5c80a12.cpp
+++ b/src/devices/cpu/z80/kl5c80a12.cpp
@@ -46,6 +46,5 @@ void kl5c80a12_device::device_reset()
/* CPU interface */
-void kl5c80a12_device::device_add_mconfig(machine_config &config)
-{
-}
+MACHINE_CONFIG_START(kl5c80a12_device::device_add_mconfig)
+MACHINE_CONFIG_END
diff --git a/src/devices/imagedev/bitbngr.h b/src/devices/imagedev/bitbngr.h
index 2a2a72dd9a6..5bd7392f1d9 100644
--- a/src/devices/imagedev/bitbngr.h
+++ b/src/devices/imagedev/bitbngr.h
@@ -48,6 +48,10 @@ private:
bool m_is_readonly;
};
+#define MCFG_BITBANGER_INTERFACE(_interface) \
+ downcast<bitbanger_device &>(*device).set_interface(_interface);
+#define MCFG_BITBANGER_READONLY(_readonly) \
+ downcast<bitbanger_device &>(*device).set_readonly(_readonly);
// device type definition
DECLARE_DEVICE_TYPE(BITBANGER, bitbanger_device)
diff --git a/src/devices/imagedev/cassette.h b/src/devices/imagedev/cassette.h
index aac43869d2a..830f65c99d2 100644
--- a/src/devices/imagedev/cassette.h
+++ b/src/devices/imagedev/cassette.h
@@ -129,4 +129,25 @@ DECLARE_DEVICE_TYPE(CASSETTE, cassette_image_device)
// device iterator
typedef device_type_iterator<cassette_image_device> cassette_device_iterator;
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+#define MCFG_CASSETTE_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, CASSETTE, 0)
+
+#define MCFG_CASSETTE_MODIFY(_tag) \
+ MCFG_DEVICE_MODIFY(_tag)
+
+#define MCFG_CASSETTE_FORMATS(_formats) \
+ downcast<cassette_image_device &>(*device).set_formats(_formats);
+
+#define MCFG_CASSETTE_CREATE_OPTS(_create_opts) \
+ downcast<cassette_image_device &>(*device).set_create_opts(_create_opts);
+
+#define MCFG_CASSETTE_DEFAULT_STATE(_state) \
+ downcast<cassette_image_device &>(*device).set_default_state((cassette_state) (_state));
+
+#define MCFG_CASSETTE_INTERFACE(_interface) \
+ downcast<cassette_image_device &>(*device).set_interface(_interface);
+
#endif // MAME_DEVICES_IMAGEDEV_CASSETTE_H
diff --git a/src/devices/imagedev/chd_cd.h b/src/devices/imagedev/chd_cd.h
index e3e980d9ea9..0be8a274cac 100644
--- a/src/devices/imagedev/chd_cd.h
+++ b/src/devices/imagedev/chd_cd.h
@@ -67,4 +67,15 @@ protected:
// device type definition
DECLARE_DEVICE_TYPE(CDROM, cdrom_image_device)
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+
+#define MCFG_CDROM_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, CDROM, 0)
+
+#define MCFG_CDROM_INTERFACE(_interface) \
+ downcast<cdrom_image_device &>(*device).set_interface(_interface);
+
#endif // MAME_DEVICES_IMAGEDEV_CHD_CD_H
diff --git a/src/devices/imagedev/diablo.h b/src/devices/imagedev/diablo.h
index 543d89d3438..2acc293a359 100644
--- a/src/devices/imagedev/diablo.h
+++ b/src/devices/imagedev/diablo.h
@@ -73,4 +73,20 @@ protected:
// device type definition
DECLARE_DEVICE_TYPE(DIABLO, diablo_image_device)
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_DIABLO_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, DIABLO, 0)
+
+#define MCFG_DIABLO_LOAD(_class,_method) \
+ downcast<diablo_image_device &>(*device).set_device_load(device_image_load_delegate(&DEVICE_IMAGE_LOAD_NAME(_class,_method), this));
+
+#define MCFG_DIABLO_UNLOAD(_class,_method) \
+ downcast<diablo_image_device &>(*device).set_device_unload(device_image_func_delegate(&DEVICE_IMAGE_UNLOAD_NAME(_class,_method), this));
+
+#define MCFG_DIABLO_INTERFACE(_interface) \
+ downcast<diablo_image_device &>(*device).set_interface(_interface);
+
#endif // MAME_DEVICES_IMAGEDEV_DIABLO_H
diff --git a/src/devices/imagedev/flopdrv.h b/src/devices/imagedev/flopdrv.h
index 5751365260d..cae694146b7 100644
--- a/src/devices/imagedev/flopdrv.h
+++ b/src/devices/imagedev/flopdrv.h
@@ -92,6 +92,9 @@ struct chrn_id
/* set if index has just occurred */
#define FLOPPY_DRIVE_INDEX 0x0020
+#define MCFG_LEGACY_FLOPPY_IDX_CB(_devcb) \
+ downcast<legacy_floppy_image_device &>(*device).set_out_idx_func(DEVCB_##_devcb);
+
class legacy_floppy_image_device : public device_t,
public device_image_interface
{
@@ -107,7 +110,7 @@ public:
~legacy_floppy_image_device();
void set_floppy_config(const floppy_interface *config) { m_config = config; }
- auto out_idx_cb() { return m_out_idx_func.bind(); }
+ template<class Object> devcb_base &set_out_idx_func(Object &&cb) { return m_out_idx_func.set_callback(std::forward<Object>(cb)); }
static void add_4drives(machine_config &mconfig, const floppy_interface *config)
{
@@ -117,12 +120,6 @@ public:
LEGACY_FLOPPY(mconfig, FLOPPY_3, 0, config);
}
- static void add_2drives(machine_config &mconfig, const floppy_interface *config)
- {
- LEGACY_FLOPPY(mconfig, FLOPPY_0, 0, config);
- LEGACY_FLOPPY(mconfig, FLOPPY_1, 0, config);
- }
-
virtual image_init_result call_load() override;
virtual const software_list_loader &get_software_list_loader() const override { return image_software_list_loader::instance(); }
virtual image_init_result call_create(int format_type, util::option_resolution *format_options) override;
@@ -253,4 +250,33 @@ legacy_floppy_image_device *floppy_get_device_by_type(running_machine &machine,i
int floppy_get_drive_by_type(legacy_floppy_image_device *image,int ftype);
int floppy_get_count(running_machine &machine);
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+
+#define MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ downcast<legacy_floppy_image_device &>(*device).set_floppy_config(&(_config));
+
+#define MCFG_LEGACY_FLOPPY_DRIVE_ADD(_tag, _config) \
+ MCFG_DEVICE_ADD(_tag, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config)
+
+#define MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_0, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_1, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_2, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_3, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config)
+
+#define MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_0, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_1, LEGACY_FLOPPY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config)
+
#endif // MAME_DEVICES_IMAGEDV_FLOPDRV_H
diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp
index 5a7c362f42a..70362e876fb 100644
--- a/src/devices/imagedev/floppy.cpp
+++ b/src/devices/imagedev/floppy.cpp
@@ -987,8 +987,9 @@ uint32_t floppy_image_device::get_variant() const
//===================================================================
// Floppy sound
//
-// In order to enable floppy sound you must call
-// enable_sound(true)
+// In order to enable floppy sound you must add the line
+// MCFG_FLOPPY_DRIVE_SOUND(true)
+// after MCFG_FLOPPY_DRIVE_ADD
// and you must put audio samples (44100Hz, mono) with names as
// shown in floppy_sample_names into the directory samples/floppy
// Sound will be disabled when these samples are missing.
diff --git a/src/devices/imagedev/floppy.h b/src/devices/imagedev/floppy.h
index 6223933c74e..51b588bfd3a 100644
--- a/src/devices/imagedev/floppy.h
+++ b/src/devices/imagedev/floppy.h
@@ -25,6 +25,19 @@
#include "sound/samples.h"
#include "softlist_dev.h"
+#define MCFG_FLOPPY_DRIVE_ADD(_tag, _slot_intf, _def_slot, _formats) \
+ MCFG_DEVICE_ADD(_tag, FLOPPY_CONNECTOR, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ static_cast<floppy_connector *>(device)->set_formats(_formats);
+
+#define MCFG_FLOPPY_DRIVE_ADD_FIXED(_tag, _slot_intf, _def_slot, _formats) \
+ MCFG_DEVICE_ADD(_tag, FLOPPY_CONNECTOR, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, true) \
+ static_cast<floppy_connector *>(device)->set_formats(_formats);
+
+#define MCFG_FLOPPY_DRIVE_SOUND(_doit) \
+ static_cast<floppy_connector *>(device)->enable_sound(_doit);
+
#define DECLARE_FLOPPY_FORMATS(_name) \
static const floppy_format_type _name []
diff --git a/src/devices/imagedev/harddriv.h b/src/devices/imagedev/harddriv.h
index 7b71d13d2c7..92a6b733275 100644
--- a/src/devices/imagedev/harddriv.h
+++ b/src/devices/imagedev/harddriv.h
@@ -25,11 +25,6 @@ class harddisk_image_device : public device_t,
{
public:
// construction/destruction
- harddisk_image_device(const machine_config &mconfig, const char *tag, device_t *owner, const char *intf)
- : harddisk_image_device(mconfig, tag, owner, (uint32_t)0)
- {
- set_interface(intf);
- }
harddisk_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
virtual ~harddisk_image_device();
diff --git a/src/devices/imagedev/mfmhd.cpp b/src/devices/imagedev/mfmhd.cpp
index 1d6d3574c07..6e95fcc9e64 100644
--- a/src/devices/imagedev/mfmhd.cpp
+++ b/src/devices/imagedev/mfmhd.cpp
@@ -205,7 +205,7 @@
This means that when we add a slot (the connector), we also have to
pass the desired parameters for the drive.
- MFM_HD_CONNECTOR(config, _tag, _slot_intf, _def_slot, _enc, _spinupms, _cache, _format);
+ MCFG_MFM_HARDDISK_CONN_ADD(_tag, _slot_intf, _def_slot, _enc, _spinupms, _cache, _format)
Specific parameters:
diff --git a/src/devices/imagedev/midiin.h b/src/devices/imagedev/midiin.h
index 8254c6965a0..b429bc4f65f 100644
--- a/src/devices/imagedev/midiin.h
+++ b/src/devices/imagedev/midiin.h
@@ -15,6 +15,9 @@
#include "diserial.h"
+#define MCFG_MIDIIN_INPUT_CB(_devcb) \
+ downcast<midiin_device &>(*device).set_input_callback(DEVCB_##_devcb);
+
/***************************************************************************
TYPE DEFINITIONS
@@ -28,7 +31,7 @@ public:
// construction/destruction
midiin_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto input_callback() { return m_input_cb.bind(); }
+ template <class Object> devcb_base &set_input_callback(Object &&cb) { return m_input_cb.set_callback(std::forward<Object>(cb)); }
// image-level overrides
virtual image_init_result call_load() override;
diff --git a/src/devices/imagedev/midiout.h b/src/devices/imagedev/midiout.h
index 159e71cab17..713c783b992 100644
--- a/src/devices/imagedev/midiout.h
+++ b/src/devices/imagedev/midiout.h
@@ -15,6 +15,14 @@
#include "diserial.h"
+/***************************************************************************
+ CONSTANTS
+***************************************************************************/
+
+
+#define MCFG_MIDIOUT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, MIDIOUT, 0)
+
/***************************************************************************
TYPE DEFINITIONS
diff --git a/src/devices/imagedev/printer.h b/src/devices/imagedev/printer.h
index 359faca8951..099d19cab9e 100644
--- a/src/devices/imagedev/printer.h
+++ b/src/devices/imagedev/printer.h
@@ -13,6 +13,8 @@
#pragma once
+#define MCFG_PRINTER_ONLINE_CB(_devcb) \
+ downcast<printer_image_device &>(*device).set_online_callback(DEVCB_##_devcb);
/***************************************************************************
TYPE DEFINITIONS
@@ -27,7 +29,7 @@ public:
// construction/destruction
printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto online_callback() { return m_online_cb.bind(); }
+ template <class Object> devcb_base &set_online_callback(Object &&cb) { return m_online_cb.set_callback(std::forward<Object>(cb)); }
// image-level overrides
virtual image_init_result call_load() override;
diff --git a/src/devices/imagedev/snapquik.cpp b/src/devices/imagedev/snapquik.cpp
index 4126077513c..0e24b9f81ba 100644
--- a/src/devices/imagedev/snapquik.cpp
+++ b/src/devices/imagedev/snapquik.cpp
@@ -28,6 +28,8 @@ snapshot_image_device::snapshot_image_device(const machine_config &mconfig, devi
device_image_interface(mconfig, *this),
m_file_extensions(nullptr),
m_interface(nullptr),
+ m_delay_seconds(0),
+ m_delay_attoseconds(0),
m_timer(nullptr)
{
}
@@ -65,7 +67,7 @@ void snapshot_image_device::device_start()
image_init_result snapshot_image_device::call_load()
{
/* adjust the timer */
- m_timer->adjust(m_delay,0);
+ m_timer->adjust(attotime(m_delay_seconds, m_delay_attoseconds),0);
return image_init_result::PASS;
}
diff --git a/src/devices/imagedev/snapquik.h b/src/devices/imagedev/snapquik.h
index 35873ad93e9..55eb7b703d6 100644
--- a/src/devices/imagedev/snapquik.h
+++ b/src/devices/imagedev/snapquik.h
@@ -11,8 +11,6 @@
#ifndef MAME_DEVICES_IMAGEDEV_SNAPQUIK_H
#define MAME_DEVICES_IMAGEDEV_SNAPQUIK_H
-#pragma once
-
#include "softlist_dev.h"
typedef delegate<image_init_result (device_image_interface &,const char *, int)> snapquick_load_delegate;
@@ -23,7 +21,7 @@ class snapshot_image_device : public device_t,
{
public:
// construction/destruction
- snapshot_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0U);
+ snapshot_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~snapshot_image_device();
void set_interface(const char *interface) { m_interface = interface; }
@@ -41,7 +39,8 @@ public:
virtual const char *image_interface() const override { return m_interface; }
virtual const char *file_extensions() const override { return m_file_extensions; }
- void set_handler(snapquick_load_delegate load, const char *ext, attotime delay = attotime::from_seconds(0)) { m_load = load; m_file_extensions = ext; m_delay = delay; };
+ TIMER_CALLBACK_MEMBER(process_snapshot_or_quickload);
+ void set_handler(snapquick_load_delegate load, const char *ext, seconds_t sec) { m_load = load; m_file_extensions = ext; m_delay_seconds = sec; };
protected:
snapshot_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -49,12 +48,11 @@ protected:
// device-level overrides
virtual void device_start() override;
- TIMER_CALLBACK_MEMBER(process_snapshot_or_quickload);
-
snapquick_load_delegate m_load; /* loading function */
const char * m_file_extensions; /* file extensions */
const char * m_interface;
- attotime m_delay; /* loading delay */
+ seconds_t m_delay_seconds; /* loading delay (seconds) */
+ attoseconds_t m_delay_attoseconds; /* loading delay (attoseconds) */
emu_timer *m_timer;
};
@@ -67,7 +65,7 @@ class quickload_image_device : public snapshot_image_device
{
public:
// construction/destruction
- quickload_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0U);
+ quickload_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual iodevice_t image_type() const override { return IO_QUICKLOAD; }
};
@@ -90,16 +88,16 @@ DECLARE_DEVICE_TYPE(QUICKLOAD, quickload_image_device)
#define QUICKLOAD_LOAD_MEMBER(_class,_name) image_init_result QUICKLOAD_LOAD_NAME(_class,_name)(device_image_interface &image, const char *file_type, int quickload_size)
#define QUICKLOAD_LOAD_DELEGATE(_class,_name) snapquick_load_delegate(&QUICKLOAD_LOAD_NAME(_class,_name), downcast<_class *>(device->owner()))
-#define MCFG_SNAPSHOT_ADD(_tag, _class, _load, ...) \
+#define MCFG_SNAPSHOT_ADD(_tag, _class, _load, _file_extensions, _delay) \
MCFG_DEVICE_ADD(_tag, SNAPSHOT, 0) \
- static_cast<snapshot_image_device *>(device)->set_handler(SNAPSHOT_LOAD_DELEGATE(_class,_load), __VA_ARGS__);
+ static_cast<snapshot_image_device *>(device)->set_handler(SNAPSHOT_LOAD_DELEGATE(_class,_load), _file_extensions, _delay);
#define MCFG_SNAPSHOT_INTERFACE(_interface) \
downcast<snapshot_image_device &>(*device).set_interface(_interface);
-#define MCFG_QUICKLOAD_ADD(_tag, _class, _load, ...) \
+#define MCFG_QUICKLOAD_ADD(_tag, _class, _load, _file_extensions, _delay) \
MCFG_DEVICE_ADD(_tag, QUICKLOAD, 0) \
- static_cast<quickload_image_device *>(device)->set_handler(QUICKLOAD_LOAD_DELEGATE(_class,_load), __VA_ARGS__);
+ static_cast<quickload_image_device *>(device)->set_handler(QUICKLOAD_LOAD_DELEGATE(_class,_load), _file_extensions, _delay);
#define MCFG_QUICKLOAD_INTERFACE(_interface) \
downcast<quickload_image_device &>(*device).set_interface(_interface);
diff --git a/src/devices/machine/6525tpi.cpp b/src/devices/machine/6525tpi.cpp
index 83d28fc0355..a82b09d104c 100644
--- a/src/devices/machine/6525tpi.cpp
+++ b/src/devices/machine/6525tpi.cpp
@@ -294,12 +294,12 @@ WRITE_LINE_MEMBER( tpi6525_device::i4_w )
}
}
-uint8_t tpi6525_device::pa_r()
+READ8_MEMBER( tpi6525_device::pa_r )
{
uint8_t data = m_in_a;
if (!m_in_pa_cb.isnull())
- data = m_in_pa_cb();
+ data = m_in_pa_cb(offset);
data = (data & ~m_ddr_a) | (m_ddr_a & m_port_a);
@@ -307,18 +307,18 @@ uint8_t tpi6525_device::pa_r()
}
-void tpi6525_device::pa_w(uint8_t data)
+WRITE8_MEMBER( tpi6525_device::pa_w )
{
m_in_a = data;
}
-uint8_t tpi6525_device::pb_r()
+READ8_MEMBER( tpi6525_device::pb_r )
{
uint8_t data = m_in_b;
if (!m_in_pb_cb.isnull())
- data = m_in_pb_cb();
+ data = m_in_pb_cb(offset);
data = (data & ~m_ddr_b) | (m_ddr_b & m_port_b);
@@ -326,18 +326,18 @@ uint8_t tpi6525_device::pb_r()
}
-void tpi6525_device::pb_w(uint8_t data)
+WRITE8_MEMBER( tpi6525_device::pb_w )
{
m_in_b = data;
}
-uint8_t tpi6525_device::pc_r()
+READ8_MEMBER( tpi6525_device::pc_r )
{
uint8_t data = m_in_c;
if (!m_in_pc_cb.isnull())
- data &= m_in_pc_cb();
+ data &= m_in_pc_cb(offset);
data = (data & ~m_ddr_c) | (m_ddr_c & m_port_c);
@@ -345,13 +345,13 @@ uint8_t tpi6525_device::pc_r()
}
-void tpi6525_device::pc_w(uint8_t data)
+WRITE8_MEMBER( tpi6525_device::pc_w )
{
m_in_c = data;
}
-uint8_t tpi6525_device::read(offs_t offset)
+READ8_MEMBER( tpi6525_device::read )
{
uint8_t data = 0xff;
@@ -466,7 +466,7 @@ uint8_t tpi6525_device::read(offs_t offset)
}
-void tpi6525_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( tpi6525_device::write )
{
DBG_LOG(machine(), 2, "tpi6525", ("%s write %.2x %.2x\n", tag(), offset, data));
diff --git a/src/devices/machine/6525tpi.h b/src/devices/machine/6525tpi.h
index 4052662d50a..5e1ec394fe4 100644
--- a/src/devices/machine/6525tpi.h
+++ b/src/devices/machine/6525tpi.h
@@ -53,8 +53,8 @@ public:
auto out_ca_cb() { return m_out_ca_cb.bind(); }
auto out_cb_cb() { return m_out_cb_cb.bind(); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( i0_w );
DECLARE_WRITE_LINE_MEMBER( i1_w );
@@ -62,12 +62,12 @@ public:
DECLARE_WRITE_LINE_MEMBER( i3_w );
DECLARE_WRITE_LINE_MEMBER( i4_w );
- uint8_t pa_r();
- uint8_t pb_r();
- uint8_t pc_r();
- void pa_w(uint8_t data);
- void pb_w(uint8_t data);
- void pc_w(uint8_t data);
+ DECLARE_READ8_MEMBER( pa_r );
+ DECLARE_READ8_MEMBER( pb_r );
+ DECLARE_READ8_MEMBER( pc_r );
+ DECLARE_WRITE8_MEMBER( pa_w );
+ DECLARE_WRITE8_MEMBER( pb_w );
+ DECLARE_WRITE8_MEMBER( pc_w );
WRITE_LINE_MEMBER( pb0_w ) { port_line_w(m_in_b, 0, state); }
WRITE_LINE_MEMBER( pb1_w ) { port_line_w(m_in_b, 1, state); }
diff --git a/src/devices/machine/68153bim.cpp b/src/devices/machine/68153bim.cpp
index 8df821a813e..30be9ea5e81 100644
--- a/src/devices/machine/68153bim.cpp
+++ b/src/devices/machine/68153bim.cpp
@@ -67,13 +67,12 @@ DEFINE_DEVICE_TYPE(EI68C153, ei68c153_device, "ei68c153", "EPIC
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void bim68153_device::device_add_mconfig(machine_config &config)
-{
- MC68153_CHANNEL(config, m_chn[0], 0);
- MC68153_CHANNEL(config, m_chn[1], 0);
- MC68153_CHANNEL(config, m_chn[2], 0);
- MC68153_CHANNEL(config, m_chn[3], 0);
-}
+MACHINE_CONFIG_START(bim68153_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(CHN0_TAG, MC68153_CHANNEL, 0)
+ MCFG_DEVICE_ADD(CHN1_TAG, MC68153_CHANNEL, 0)
+ MCFG_DEVICE_ADD(CHN2_TAG, MC68153_CHANNEL, 0)
+ MCFG_DEVICE_ADD(CHN3_TAG, MC68153_CHANNEL, 0)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/machine/6821pia.cpp b/src/devices/machine/6821pia.cpp
index 60efe473f19..3bf21c9483b 100644
--- a/src/devices/machine/6821pia.cpp
+++ b/src/devices/machine/6821pia.cpp
@@ -576,7 +576,7 @@ uint8_t pia6821_device::control_b_r()
// read
//-------------------------------------------------
-uint8_t pia6821_device::read(offs_t offset)
+uint8_t pia6821_device::reg_r(uint8_t offset)
{
uint8_t ret;
@@ -846,7 +846,7 @@ void pia6821_device::control_b_w(uint8_t data)
// write
//-------------------------------------------------
-void pia6821_device::write(offs_t offset, uint8_t data)
+void pia6821_device::reg_w(uint8_t offset, uint8_t data)
{
switch (offset & 0x03)
{
diff --git a/src/devices/machine/6821pia.h b/src/devices/machine/6821pia.h
index 8457399cf1a..b31bf03183c 100644
--- a/src/devices/machine/6821pia.h
+++ b/src/devices/machine/6821pia.h
@@ -55,10 +55,13 @@ public:
auto irqa_handler() { return m_irqa_handler.bind(); }
auto irqb_handler() { return m_irqb_handler.bind(); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
- uint8_t read_alt(offs_t offset) { return read(((offset << 1) & 0x02) | ((offset >> 1) & 0x01)); }
- void write_alt(offs_t offset, uint8_t data) { write(((offset << 1) & 0x02) | ((offset >> 1) & 0x01), data); }
+ uint8_t reg_r(uint8_t offset);
+ void reg_w(uint8_t offset, uint8_t data);
+
+ DECLARE_READ8_MEMBER( read ) { return reg_r(offset); }
+ DECLARE_WRITE8_MEMBER( write ) { reg_w(offset, data); }
+ DECLARE_READ8_MEMBER( read_alt ) { return reg_r(((offset << 1) & 0x02) | ((offset >> 1) & 0x01)); }
+ DECLARE_WRITE8_MEMBER( write_alt ) { reg_w(((offset << 1) & 0x02) | ((offset >> 1) & 0x01), data); }
uint8_t port_b_z_mask() const { return ~m_ddr_b; } // see first note in .c
void set_port_a_z_mask(uint8_t data) { m_port_a_z_mask = data; }// see second note in .c
diff --git a/src/devices/machine/68307.cpp b/src/devices/machine/68307.cpp
index ae13e090488..421d5f06da2 100644
--- a/src/devices/machine/68307.cpp
+++ b/src/devices/machine/68307.cpp
@@ -40,15 +40,14 @@ void m68307_cpu_device::m68307_internal_map(address_map &map)
}
-void m68307_cpu_device::device_add_mconfig(machine_config &config)
-{
- MC68681(config, m_duart, 16000000/4); // ?? Mhz - should be specified in inline config
- m_duart->irq_cb().set(FUNC(m68307_cpu_device::m68307_duart_irq_handler));
- m_duart->a_tx_cb().set(FUNC(m68307_cpu_device::m68307_duart_txa));
- m_duart->b_tx_cb().set(FUNC(m68307_cpu_device::m68307_duart_txb));
- m_duart->inport_cb().set(FUNC(m68307_cpu_device::m68307_duart_input_r));
- m_duart->outport_cb().set(FUNC(m68307_cpu_device::m68307_duart_output_w));
-}
+MACHINE_CONFIG_START(m68307_cpu_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("internal68681", MC68681, 16000000/4) // ?? Mhz - should be specified in inline config
+ MCFG_MC68681_IRQ_CALLBACK(WRITELINE(*this, m68307_cpu_device, m68307_duart_irq_handler))
+ MCFG_MC68681_A_TX_CALLBACK(WRITELINE(*this, m68307_cpu_device, m68307_duart_txa))
+ MCFG_MC68681_B_TX_CALLBACK(WRITELINE(*this, m68307_cpu_device, m68307_duart_txb))
+ MCFG_MC68681_INPORT_CALLBACK(READ8(*this, m68307_cpu_device, m68307_duart_input_r))
+ MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(*this, m68307_cpu_device, m68307_duart_output_w))
+MACHINE_CONFIG_END
m68307_cpu_device::m68307_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
@@ -90,14 +89,6 @@ void m68307_cpu_device::device_reset()
set_ipl(0);
}
-void m68307_cpu_device::m68k_reset_peripherals()
-{
- m_duart->reset();
-
- if (m_m68307MBUS) m_m68307MBUS->reset();
- if (m_m68307TIMER) m_m68307TIMER->reset();
-}
-
/* todo: is it possible to calculate the address map based on CS when they change
and install handlers? Going through this logic for every memory access is
diff --git a/src/devices/machine/68307.h b/src/devices/machine/68307.h
index 6d5ef10b61c..591d0c9cced 100644
--- a/src/devices/machine/68307.h
+++ b/src/devices/machine/68307.h
@@ -44,8 +44,6 @@ protected:
virtual uint32_t execute_min_cycles() const override { return 4; }
virtual uint32_t execute_max_cycles() const override { return 158; }
- virtual void m68k_reset_peripherals() override;
-
private:
void set_ipl(int level);
DECLARE_WRITE_LINE_MEMBER(timer0_interrupt);
diff --git a/src/devices/machine/68340.cpp b/src/devices/machine/68340.cpp
index bae8be35b62..e9f8ba7ba8e 100644
--- a/src/devices/machine/68340.cpp
+++ b/src/devices/machine/68340.cpp
@@ -262,12 +262,3 @@ void m68340_cpu_device::device_start()
m_int_ack_callback = device_irq_acknowledge_delegate(FUNC(m68340_cpu_device::int_ack), this);
}
-
-void m68340_cpu_device::m68k_reset_peripherals()
-{
- m_m68340SIM->module_reset();
- m_m68340DMA->module_reset();
- m_serial->module_reset();
- m_timer[0]->module_reset();
- m_timer[1]->module_reset();
-}
diff --git a/src/devices/machine/68340.h b/src/devices/machine/68340.h
index 23f3ed6b147..12af250c5b2 100644
--- a/src/devices/machine/68340.h
+++ b/src/devices/machine/68340.h
@@ -49,8 +49,6 @@ protected:
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void m68k_reset_peripherals() override;
-
private:
required_device<mc68340_serial_module_device> m_serial;
required_device_array<mc68340_timer_module_device, 2> m_timer;
diff --git a/src/devices/machine/68340dma.cpp b/src/devices/machine/68340dma.cpp
index 4a79a4504fc..6649aeb2a94 100644
--- a/src/devices/machine/68340dma.cpp
+++ b/src/devices/machine/68340dma.cpp
@@ -26,9 +26,4 @@ WRITE32_MEMBER( m68340_cpu_device::m68340_internal_dma_w )
void m68340_dma::reset()
{
- module_reset();
-}
-
-void m68340_dma::module_reset()
-{
}
diff --git a/src/devices/machine/68340dma.h b/src/devices/machine/68340dma.h
index 8bec4fb88a7..3a92b4e9a49 100644
--- a/src/devices/machine/68340dma.h
+++ b/src/devices/machine/68340dma.h
@@ -10,7 +10,6 @@ class m68340_dma
{
public:
void reset();
- void module_reset();
};
#endif // MAME_MACHINE_68340DMA_H
diff --git a/src/devices/machine/68340ser.cpp b/src/devices/machine/68340ser.cpp
index e0fc3b29fde..fcf6708305e 100644
--- a/src/devices/machine/68340ser.cpp
+++ b/src/devices/machine/68340ser.cpp
@@ -157,9 +157,4 @@ mc68340_serial_module_device::mc68340_serial_module_device(const machine_config
{
}
-void mc68340_serial_module_device::module_reset()
-{
- mc68340_duart_device::device_reset();
-}
-
DEFINE_DEVICE_TYPE(MC68340_SERIAL_MODULE, mc68340_serial_module_device, "mc68340sermod", "MC68340 Serial Module")
diff --git a/src/devices/machine/68340ser.h b/src/devices/machine/68340ser.h
index b9775f2ad86..e658d719c05 100644
--- a/src/devices/machine/68340ser.h
+++ b/src/devices/machine/68340ser.h
@@ -7,6 +7,11 @@
#include "machine/mc68681.h"
+// MCFG macros to hide the implementation
+#define MCFG_MC68340SER_IRQ_CALLBACK(_cb) MCFG_MC68681_IRQ_CALLBACK(_cb)
+#define MCFG_MC68340SER_A_TX_CALLBACK(_cb) MCFG_MC68681_A_TX_CALLBACK(_cb)
+#define MCFG_MC68340SER_B_TX_CALLBACK(_cb) MCFG_MC68681_B_TX_CALLBACK(_cb)
+
class m68340_cpu_device;
class mc68340_serial_module_device : public mc68340_duart_device
@@ -27,8 +32,6 @@ public:
uint8_t irq_vector() const { return m_ivr; }
uint8_t arbitrate(uint8_t level) const { return (irq_level() == level) ? (m_mcrl & REG_MCRL_ARBLV) : 0; }
- void module_reset();
-
protected:
m68340_cpu_device *m_cpu;
diff --git a/src/devices/machine/68340sim.cpp b/src/devices/machine/68340sim.cpp
index 3dbbfcb0733..cf299ba2b22 100644
--- a/src/devices/machine/68340sim.cpp
+++ b/src/devices/machine/68340sim.cpp
@@ -493,12 +493,6 @@ void m68340_sim::reset()
m_pit_irq = false;
}
-void m68340_sim::module_reset()
-{
- // SYS set in RSR, nothing else happens
- m_avr_rsr = (m_avr_rsr & 0xff00) | 0x02;
-}
-
/* do_tick_pit works on whole clock cycles, no flank support */
void m68340_cpu_device::do_tick_pit()
{
diff --git a/src/devices/machine/68340sim.h b/src/devices/machine/68340sim.h
index 34358e02eff..3c839984db2 100644
--- a/src/devices/machine/68340sim.h
+++ b/src/devices/machine/68340sim.h
@@ -35,7 +35,6 @@ public:
bool m_pit_irq;
void reset();
- void module_reset();
enum {
REG_MCR = 0x00,
diff --git a/src/devices/machine/68340tmu.cpp b/src/devices/machine/68340tmu.cpp
index 801a9802557..1ceaf65f600 100644
--- a/src/devices/machine/68340tmu.cpp
+++ b/src/devices/machine/68340tmu.cpp
@@ -308,16 +308,6 @@ void mc68340_timer_module_device::device_start()
m_tin_in_cb.resolve_safe();
}
-void mc68340_timer_module_device::device_reset()
-{
- module_reset();
-}
-
-void mc68340_timer_module_device::module_reset()
-{
- // TODO
-}
-
void mc68340_timer_module_device::do_timer_irq()
{
assert((m_sr & (REG_SR_TO | REG_SR_TG | REG_SR_TC)) != 0);
diff --git a/src/devices/machine/68340tmu.h b/src/devices/machine/68340tmu.h
index 8952632792b..0582debd475 100644
--- a/src/devices/machine/68340tmu.h
+++ b/src/devices/machine/68340tmu.h
@@ -14,6 +14,9 @@ class mc68340_timer_module_device : public device_t
public:
mc68340_timer_module_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ // device-level overrides
+ virtual void device_start() override;
+
READ16_MEMBER( read );
WRITE16_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( tin_w );
@@ -23,13 +26,7 @@ public:
uint8_t irq_vector() const { return m_ir & REG_IR_INTVEC; }
uint8_t arbitrate(uint8_t level) const { return (irq_level() == level) ? (m_mcr & REG_MCR_ARBLV) : 0; }
- void module_reset();
-
-protected:
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
+ protected:
m68340_cpu_device *m_cpu;
uint16_t m_mcr;
diff --git a/src/devices/machine/6840ptm.cpp b/src/devices/machine/6840ptm.cpp
index 36b2cd5002b..bf1e6f4adb1 100644
--- a/src/devices/machine/6840ptm.cpp
+++ b/src/devices/machine/6840ptm.cpp
@@ -423,7 +423,7 @@ void ptm6840_device::reload_count(int idx)
// read - Read Timer
//-------------------------------------------------
-uint8_t ptm6840_device::read(offs_t offset)
+READ8_MEMBER( ptm6840_device::read )
{
int val;
@@ -487,7 +487,7 @@ uint8_t ptm6840_device::read(offs_t offset)
// write - Write Timer
//-------------------------------------------------
-void ptm6840_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( ptm6840_device::write )
{
switch ( offset )
{
diff --git a/src/devices/machine/6840ptm.h b/src/devices/machine/6840ptm.h
index 2c913a97b4c..ad5859b771b 100644
--- a/src/devices/machine/6840ptm.h
+++ b/src/devices/machine/6840ptm.h
@@ -39,8 +39,8 @@ public:
void set_ext_clock(int counter, double clock); // set clock frequency
int ext_clock(int counter) const { return m_external_clock[counter]; } // get clock frequency
- void write(offs_t offset, uint8_t data);
- uint8_t read(offs_t offset);
+ DECLARE_WRITE8_MEMBER( write );
+ DECLARE_READ8_MEMBER( read );
void set_gate(int idx, int state);
DECLARE_WRITE_LINE_MEMBER( set_g1 );
diff --git a/src/devices/machine/6850acia.cpp b/src/devices/machine/6850acia.cpp
index 08e8459fd36..6527608bf0f 100644
--- a/src/devices/machine/6850acia.cpp
+++ b/src/devices/machine/6850acia.cpp
@@ -150,27 +150,24 @@ void acia6850_device::device_reset()
output_irq(1);
}
-uint8_t acia6850_device::status_r()
+READ8_MEMBER( acia6850_device::status_r )
{
uint8_t status = m_status;
- if (!machine().side_effects_disabled())
+ if (status & SR_CTS)
{
- if (status & SR_CTS)
- {
- status &= ~SR_TDRE;
- }
+ status &= ~SR_TDRE;
+ }
- if (m_dcd_irq_pending == DCD_IRQ_READ_STATUS)
- {
- m_dcd_irq_pending = DCD_IRQ_READ_DATA;
- }
+ if (m_dcd_irq_pending == DCD_IRQ_READ_STATUS)
+ {
+ m_dcd_irq_pending = DCD_IRQ_READ_DATA;
}
return status;
}
-void acia6850_device::control_w(uint8_t data)
+WRITE8_MEMBER( acia6850_device::control_w )
{
LOG("MC6850 '%s' Control: %02x\n", tag(), data);
@@ -240,7 +237,7 @@ void acia6850_device::update_irq()
output_irq(calculate_txirq() && calculate_rxirq());
}
-void acia6850_device::data_w(uint8_t data)
+WRITE8_MEMBER( acia6850_device::data_w )
{
LOG("MC6850 '%s' Data: %02x\n", tag(), data);
@@ -257,43 +254,40 @@ void acia6850_device::data_w(uint8_t data)
update_irq();
}
-uint8_t acia6850_device::data_r()
+READ8_MEMBER( acia6850_device::data_r )
{
- if (!machine().side_effects_disabled())
+ if (m_overrun_pending)
{
- if (m_overrun_pending)
- {
- m_status |= SR_OVRN;
- m_overrun_pending = false;
- }
- else
- {
- m_status &= ~SR_OVRN;
- m_status &= ~SR_RDRF;
- }
-
- if (m_dcd_irq_pending == DCD_IRQ_READ_DATA)
- {
- m_dcd_irq_pending = DCD_IRQ_NONE;
- }
+ m_status |= SR_OVRN;
+ m_overrun_pending = false;
+ }
+ else
+ {
+ m_status &= ~SR_OVRN;
+ m_status &= ~SR_RDRF;
+ }
- update_irq();
+ if (m_dcd_irq_pending == DCD_IRQ_READ_DATA)
+ {
+ m_dcd_irq_pending = DCD_IRQ_NONE;
}
+ update_irq();
+
return m_rdr;
}
-void acia6850_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( acia6850_device::write )
{
if (BIT(offset, 0))
- data_w(data);
+ data_w(space, 0, data);
else
- control_w(data);
+ control_w(space, 0, data);
}
-uint8_t acia6850_device::read(offs_t offset)
+READ8_MEMBER( acia6850_device::read )
{
- return BIT(offset, 0) ? data_r() : status_r();
+ return BIT(offset, 0) ? data_r(space, 0) : status_r(space, 0);
}
DECLARE_WRITE_LINE_MEMBER( acia6850_device::write_cts )
diff --git a/src/devices/machine/6850acia.h b/src/devices/machine/6850acia.h
index 4d99209d519..4c40e2dc69f 100644
--- a/src/devices/machine/6850acia.h
+++ b/src/devices/machine/6850acia.h
@@ -24,12 +24,12 @@ public:
auto rts_handler() { return m_rts_handler.bind(); }
auto irq_handler() { return m_irq_handler.bind(); }
- void control_w(uint8_t data);
- uint8_t status_r();
- void data_w(uint8_t data);
- uint8_t data_r();
- void write(offs_t offset, uint8_t data);
- uint8_t read(offs_t offset);
+ DECLARE_WRITE8_MEMBER( control_w );
+ DECLARE_READ8_MEMBER( status_r );
+ DECLARE_WRITE8_MEMBER( data_w );
+ DECLARE_READ8_MEMBER( data_r );
+ DECLARE_WRITE8_MEMBER( write );
+ DECLARE_READ8_MEMBER( read );
DECLARE_WRITE_LINE_MEMBER( write_cts );
DECLARE_WRITE_LINE_MEMBER( write_dcd );
diff --git a/src/devices/machine/74157.cpp b/src/devices/machine/74157.cpp
index 1dc7eb1289b..f5a68cc4465 100644
--- a/src/devices/machine/74157.cpp
+++ b/src/devices/machine/74157.cpp
@@ -35,7 +35,7 @@ DEFINE_DEVICE_TYPE(LS157_X2, ls157_x2_device, "ls157_x2", "74LS157 Quad 2-to-1 M
// ls157_device - constructor
//-------------------------------------------------
-ls157_device::ls157_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ls157_device::ls157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ls157_device(mconfig, LS157, tag, owner, clock, 0x0f)
{
}
@@ -58,7 +58,7 @@ ls157_device::ls157_device(const machine_config &mconfig, device_type type, cons
// ls157_x2_device - constructor
//-------------------------------------------------
-ls157_x2_device::ls157_x2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ls157_x2_device::ls157_x2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ls157_device(mconfig, LS157_X2, tag, owner, clock, 0xff)
{
}
@@ -92,7 +92,7 @@ void ls157_device::device_start()
// a_w -- write nibble to A1-A4
//-------------------------------------------------
-void ls157_device::a_w(u8 data)
+void ls157_device::write_a(u8 data)
{
m_a = data & m_data_mask;
update_output();
@@ -103,7 +103,7 @@ void ls157_device::a_w(u8 data)
// b_w -- write nibble to B1-B4
//-------------------------------------------------
-void ls157_device::b_w(u8 data)
+void ls157_device::write_b(u8 data)
{
m_b = data & m_data_mask;
update_output();
@@ -115,7 +115,7 @@ void ls157_device::b_w(u8 data)
// low nibble to B1-B4
//-------------------------------------------------
-void ls157_device::ab_w(u8 data)
+void ls157_device::write_ab(u8 data)
{
assert(m_data_mask == 0x0f);
m_a = data >> 4;
@@ -129,7 +129,7 @@ void ls157_device::ab_w(u8 data)
// low nibble to A1-A4
//-------------------------------------------------
-void ls157_device::ba_w(u8 data)
+void ls157_device::write_ba(u8 data)
{
assert(m_data_mask == 0x0f);
m_b = data >> 4;
@@ -143,7 +143,7 @@ void ls157_device::ba_w(u8 data)
// A1-A4 and write odd-numbered bits to B1-B4
//-------------------------------------------------
-void ls157_device::interleave_w(u8 data)
+void ls157_device::write_interleave(u8 data)
{
assert(m_data_mask == 0x0f);
m_b = bitswap<4>(data, 7, 5, 3, 1);
@@ -260,7 +260,7 @@ void ls157_device::update_output()
// DATA OUTPUTS
//**************************************************************************
-u8 ls157_device::output_r()
+READ8_MEMBER(ls157_device::output_r)
{
if (m_strobe)
return 0;
@@ -277,7 +277,7 @@ u8 ls157_device::output_r()
DEFINE_DEVICE_TYPE(HC157, hc157_device, "hc157", "74HC157 Quad 2-to-1 Multiplexer")
-hc157_device::hc157_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+hc157_device::hc157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ls157_device(mconfig, HC157, tag, owner, clock, 0x0f)
{
}
@@ -289,7 +289,7 @@ hc157_device::hc157_device(const machine_config &mconfig, const char *tag, devic
DEFINE_DEVICE_TYPE(HCT157, hct157_device, "hct157", "74HCT157 Quad 2-to-1 Multiplexer")
-hct157_device::hct157_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+hct157_device::hct157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ls157_device(mconfig, HCT157, tag, owner, clock, 0x0f)
{
}
diff --git a/src/devices/machine/74157.h b/src/devices/machine/74157.h
index 52875cc0a76..4bd4685546c 100644
--- a/src/devices/machine/74157.h
+++ b/src/devices/machine/74157.h
@@ -42,11 +42,16 @@ public:
auto out_callback() { return m_out_cb.bind(); }
// data writes
- void a_w(u8 data);
- void b_w(u8 data);
- void ab_w(u8 data);
- void ba_w(u8 data);
- void interleave_w(u8 data);
+ DECLARE_WRITE8_MEMBER(a_w) { write_a(data); }
+ void write_a(u8 data);
+ DECLARE_WRITE8_MEMBER(b_w) { write_b(data); }
+ void write_b(u8 data);
+ DECLARE_WRITE8_MEMBER(ab_w) { write_ab(data); }
+ void write_ab(u8 data);
+ DECLARE_WRITE8_MEMBER(ba_w) { write_ba(data); }
+ void write_ba(u8 data);
+ DECLARE_WRITE8_MEMBER(interleave_w) { write_interleave(data); }
+ void write_interleave(u8 data);
// data line writes
DECLARE_WRITE_LINE_MEMBER(a0_w);
@@ -63,7 +68,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(strobe_w);
// output read
- u8 output_r();
+ DECLARE_READ8_MEMBER(output_r);
protected:
ls157_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 mask);
diff --git a/src/devices/machine/74165.cpp b/src/devices/machine/74165.cpp
index 9ba4415d56c..d33033d5ab7 100644
--- a/src/devices/machine/74165.cpp
+++ b/src/devices/machine/74165.cpp
@@ -22,10 +22,9 @@ DEFINE_DEVICE_TYPE(TTL165, ttl165_device, "ttl165", "SN54/74165")
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void ttl165_device::device_add_mconfig(machine_config &config)
-{
- TIMER(config, m_timer).configure_generic(FUNC(ttl165_device::qh_output));
-}
+MACHINE_CONFIG_START(ttl165_device::device_add_mconfig)
+ MCFG_TIMER_DRIVER_ADD("timer", ttl165_device, qh_output)
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/machine/74166.cpp b/src/devices/machine/74166.cpp
index 1611b526762..07a9de653a5 100644
--- a/src/devices/machine/74166.cpp
+++ b/src/devices/machine/74166.cpp
@@ -22,10 +22,9 @@ DEFINE_DEVICE_TYPE(TTL166, ttl166_device, "ttl166", "SN54/74166")
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void ttl166_device::device_add_mconfig(machine_config &config)
-{
- TIMER(config, m_timer).configure_generic(FUNC(ttl166_device::qh_output));
-}
+MACHINE_CONFIG_START(ttl166_device::device_add_mconfig)
+ MCFG_TIMER_DRIVER_ADD("timer", ttl166_device, qh_output)
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/machine/7474.h b/src/devices/machine/7474.h
index 0f9d87fa5bf..0a6a678ddfb 100644
--- a/src/devices/machine/7474.h
+++ b/src/devices/machine/7474.h
@@ -45,6 +45,19 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_7474_OUTPUT_CB(_devcb) \
+ downcast<ttl7474_device &>(*device).set_output_cb(DEVCB_##_devcb);
+
+#define MCFG_7474_COMP_OUTPUT_CB(_devcb) \
+ downcast<ttl7474_device &>(*device).set_comp_output_cb(DEVCB_##_devcb);
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -58,6 +71,8 @@ public:
ttl7474_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration helpers
+ template <class Object> devcb_base &set_output_cb(Object &&cb) { return m_output_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_comp_output_cb(Object &&cb) { return m_comp_output_func.set_callback(std::forward<Object>(cb)); }
auto output_cb() { return m_output_func.bind(); }
auto comp_output_cb() { return m_comp_output_func.bind(); }
diff --git a/src/devices/machine/8042kbdc.cpp b/src/devices/machine/8042kbdc.cpp
index 541e7575b63..602435369ab 100644
--- a/src/devices/machine/8042kbdc.cpp
+++ b/src/devices/machine/8042kbdc.cpp
@@ -45,11 +45,9 @@ kbdc8042_device::kbdc8042_device(const machine_config &mconfig, const char *tag,
{
}
-void kbdc8042_device::device_add_mconfig(machine_config &config)
-{
- AT_KEYB(config, m_keyboard_dev, pc_keyboard_device::KEYBOARD_TYPE::AT, 1);
- m_keyboard_dev->keypress().set(FUNC(kbdc8042_device::keyboard_w));
-}
+MACHINE_CONFIG_START(kbdc8042_device::device_add_mconfig)
+ MCFG_AT_KEYB_ADD("at_keyboard", 1, WRITELINE(*this, kbdc8042_device, keyboard_w))
+MACHINE_CONFIG_END
/*-------------------------------------------------
@@ -71,9 +69,6 @@ void kbdc8042_device::device_start()
m_sending = 0;
m_last_write_to_control = 0;
m_status_read_mode = 0;
-
- m_update_timer = timer_alloc(TIMER_UPDATE);
- m_update_timer->adjust(attotime::never);
}
/*-------------------------------------------------
@@ -91,8 +86,6 @@ void kbdc8042_device::device_reset()
m_mouse_x = 0;
m_mouse_y = 0;
m_mouse_btn = 0;
-
- m_update_timer->adjust(attotime::from_hz(100), 0, attotime::from_hz(100));
}
void kbdc8042_device::at_8042_set_outport(uint8_t data, int initial)
@@ -202,14 +195,7 @@ void kbdc8042_device::at_8042_clear_keyboard_received()
m_mouse.received = 0;
}
-void kbdc8042_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- if (id == TIMER_UPDATE)
- {
- at_8042_check_keyboard();
- at_8042_check_mouse();
- }
-}
+
/* **************************************************************************
* Port 0x60 Input and Output Buffer (keyboard and mouse data)
diff --git a/src/devices/machine/8042kbdc.h b/src/devices/machine/8042kbdc.h
index 38bdbe3814a..f2e7fdfbf04 100644
--- a/src/devices/machine/8042kbdc.h
+++ b/src/devices/machine/8042kbdc.h
@@ -58,11 +58,8 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual ioport_constructor device_input_ports() const override;
- static const device_timer_id TIMER_UPDATE = 0;
-
private:
uint8_t m_inport;
uint8_t m_outport;
@@ -115,8 +112,6 @@ private:
uint16_t m_mouse_y;
uint8_t m_mouse_btn;
- emu_timer * m_update_timer;
-
DECLARE_WRITE_LINE_MEMBER( keyboard_w );
};
diff --git a/src/devices/machine/8364_paula.h b/src/devices/machine/8364_paula.h
index 412fe7679e6..c889a831b67 100644
--- a/src/devices/machine/8364_paula.h
+++ b/src/devices/machine/8364_paula.h
@@ -43,6 +43,18 @@
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_PAULA_MEM_READ_CB(_devcb) \
+ downcast<paula_8364_device &>(*device).set_mem_r_callback(DEVCB_##_devcb);
+
+#define MCFG_PAULA_INT_CB(_devcb) \
+ downcast<paula_8364_device &>(*device).set_int_w_callback(DEVCB_##_devcb);
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -55,6 +67,8 @@ public:
paula_8364_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration
+ template <class Object> devcb_base &set_mem_r_callback(Object &&cb) { return m_mem_r.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_int_w_callback(Object &&cb) { return m_int_w.set_callback(std::forward<Object>(cb)); }
auto mem_read_cb() { return m_mem_r.bind(); }
auto int_cb() { return m_int_w.bind(); }
diff --git a/src/devices/machine/adc0808.cpp b/src/devices/machine/adc0808.cpp
index 11aafe276fb..5f8aeb8f93c 100644
--- a/src/devices/machine/adc0808.cpp
+++ b/src/devices/machine/adc0808.cpp
@@ -156,7 +156,7 @@ void adc0808_device::device_timer(emu_timer &timer, device_timer_id id, int para
// INTERFACE
//**************************************************************************
-u8 adc0808_device::data_r()
+READ8_MEMBER( adc0808_device::data_r )
{
if (!machine().side_effects_disabled())
{
@@ -170,7 +170,7 @@ u8 adc0808_device::data_r()
return m_sar;
}
-void adc0808_device::address_w(u8 data)
+WRITE8_MEMBER( adc0808_device::address_w )
{
m_address = data & 7;
}
@@ -198,22 +198,22 @@ READ_LINE_MEMBER( adc0808_device::eoc_r )
return m_eoc;
}
-void adc0808_device::address_offset_start_w(offs_t offset, u8 data)
+WRITE8_MEMBER( adc0808_device::address_offset_start_w )
{
if (VERBOSE)
logerror("address_offset_start_w %02x %02x\n", offset, data);
start_w(1);
- address_w(offset);
+ address_w(space, 0, offset);
start_w(0);
}
-void adc0808_device::address_data_start_w(u8 data)
+WRITE8_MEMBER( adc0808_device::address_data_start_w )
{
if (VERBOSE)
- logerror("address_data_start_w %02x\n", data);
+ logerror("address_data_start_w %02x %02x\n", offset, data);
start_w(1);
- address_w(data);
+ address_w(space, 0, data);
start_w(0);
}
diff --git a/src/devices/machine/adc0808.h b/src/devices/machine/adc0808.h
index 1fa97aff47e..46943998dca 100644
--- a/src/devices/machine/adc0808.h
+++ b/src/devices/machine/adc0808.h
@@ -51,14 +51,14 @@ public:
auto eoc_ff_callback() { return m_eoc_ff_cb.bind(); }
template <std::size_t Bit> auto in_callback() { return m_in_cb[Bit].bind(); }
- u8 data_r();
- void address_w(u8 data);
+ DECLARE_READ8_MEMBER(data_r);
+ DECLARE_WRITE8_MEMBER(address_w);
DECLARE_WRITE_LINE_MEMBER(start_w);
DECLARE_READ_LINE_MEMBER(eoc_r);
// common hookups
- void address_offset_start_w(offs_t offset, u8 data); // start and ale connected, address to the address bus
- void address_data_start_w(u8 data); // start and ale connected, address to the data bus
+ DECLARE_WRITE8_MEMBER(address_offset_start_w); // start and ale connected, address to the address bus
+ DECLARE_WRITE8_MEMBER(address_data_start_w); // start and ale connected, address to the data bus
protected:
adc0808_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/machine/adc0844.cpp b/src/devices/machine/adc0844.cpp
index c3616035927..103702a8d14 100644
--- a/src/devices/machine/adc0844.cpp
+++ b/src/devices/machine/adc0844.cpp
@@ -182,14 +182,14 @@ void adc0848_device::device_timer(emu_timer &timer, device_timer_id id, int para
// INTERFACE
//**************************************************************************
-u8 adc0844_device::read()
+READ8_MEMBER( adc0844_device::read )
{
m_intr_cb(CLEAR_LINE);
return m_result;
}
-void adc0844_device::write(u8 data)
+WRITE8_MEMBER( adc0844_device::write )
{
m_intr_cb(CLEAR_LINE);
@@ -198,7 +198,7 @@ void adc0844_device::write(u8 data)
m_conversion_timer->adjust(attotime::from_usec(40));
}
-void adc0848_device::write(u8 data)
+WRITE8_MEMBER( adc0848_device::write )
{
m_intr_cb(CLEAR_LINE);
diff --git a/src/devices/machine/adc0844.h b/src/devices/machine/adc0844.h
index 51dff681f16..d20d9697a09 100644
--- a/src/devices/machine/adc0844.h
+++ b/src/devices/machine/adc0844.h
@@ -43,8 +43,8 @@ public:
auto ch3_callback() { return m_ch3_cb.bind(); }
auto ch4_callback() { return m_ch4_cb.bind(); }
- u8 read();
- virtual void write(u8 data);
+ DECLARE_READ8_MEMBER(read);
+ virtual DECLARE_WRITE8_MEMBER(write);
protected:
adc0844_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -78,7 +78,7 @@ public:
auto ch7_callback() { return m_ch7_cb.bind(); }
auto ch8_callback() { return m_ch8_cb.bind(); }
- virtual void write(u8 data) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
protected:
// device-level overrides
diff --git a/src/devices/machine/aic6250.cpp b/src/devices/machine/aic6250.cpp
index adf90fe99b5..769968569c8 100644
--- a/src/devices/machine/aic6250.cpp
+++ b/src/devices/machine/aic6250.cpp
@@ -41,14 +41,13 @@
#include "logmacro.h"
-DEFINE_DEVICE_TYPE(AIC6250, aic6250_device, "aic6250", "Adaptec AIC-6250 High-Performance SCSI Protocol Chip")
-DEFINE_DEVICE_TYPE(AIC6251A, aic6251a_device, "aic6251a", "Adaptec AIC-6251A Fast SCSI Protocol Chip")
+DEFINE_DEVICE_TYPE(AIC6250, aic6250_device, "aic6250", "Adaptec 6250 High-Performance SCSI Protocol Chip")
static char const *const nscsi_phase[] = { "DATA OUT", "DATA IN", "COMMAND", "STATUS", "*", "*", "MESSAGE OUT", "MESSAGE IN" };
static char const *const aic6250_phase[] = { "DATA OUT", "*", "DATA IN", "*", "COMMAND", "MESSAGE OUT", "STATUS", "MESSAGE IN" };
-aic6250_device::aic6250_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
- : nscsi_device(mconfig, type, tag, owner, clock)
+aic6250_device::aic6250_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : nscsi_device(mconfig, AIC6250, tag, owner, clock)
, m_int_cb(*this)
, m_breq_cb(*this)
, m_port_a_r_cb(*this)
@@ -58,16 +57,6 @@ aic6250_device::aic6250_device(const machine_config &mconfig, device_type type,
{
}
-aic6250_device::aic6250_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : aic6250_device(mconfig, AIC6250, tag, owner, clock)
-{
-}
-
-aic6251a_device::aic6251a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : aic6250_device(mconfig, AIC6251A, tag, owner, clock)
-{
-}
-
void aic6250_device::map(address_map &map)
{
map(0x0, 0x0).rw(FUNC(aic6250_device::dma_count_l_r), FUNC(aic6250_device::dma_count_l_w));
diff --git a/src/devices/machine/aic6250.h b/src/devices/machine/aic6250.h
index 2a4ba02d118..029c7f72dca 100644
--- a/src/devices/machine/aic6250.h
+++ b/src/devices/machine/aic6250.h
@@ -34,8 +34,6 @@ public:
void dma16_w(u16 data);
protected:
- aic6250_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
// standard device_interface overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -54,11 +52,11 @@ protected:
u8 status_reg_1_r();
u8 scsi_signal_reg_r();
u8 scsi_id_data_r();
- u8 source_dest_id_r() { return m_source_dest_id; }
+ u8 source_dest_id_r() { logerror("source_dest_id_r\n"); return m_source_dest_id; }
u8 memory_data_r();
u8 port_a_r();
u8 port_b_r();
- u8 scsi_latch_data_r() { return m_scsi_latch_data; }
+ u8 scsi_latch_data_r() { logerror("scsi_latch_data_r 0x%02x\n", m_scsi_latch_data); return m_scsi_latch_data; }
void dma_count_l_w(u8 data) { m_dma_count &= ~0x0000ff; m_dma_count |= (data << 0); }
void dma_count_m_w(u8 data) { m_dma_count &= ~0x00ff00; m_dma_count |= (data << 8); }
@@ -279,13 +277,6 @@ private:
util::fifo <u8, 8> m_fifo;
};
-class aic6251a_device : public aic6250_device
-{
-public:
- aic6251a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-};
-
DECLARE_DEVICE_TYPE(AIC6250, aic6250_device)
-DECLARE_DEVICE_TYPE(AIC6251A, aic6251a_device)
#endif // MAME_MACHINE_AIC6250_H
diff --git a/src/devices/machine/aicartc.h b/src/devices/machine/aicartc.h
index 71c8cdd55ad..757c0a58c1d 100644
--- a/src/devices/machine/aicartc.h
+++ b/src/devices/machine/aicartc.h
@@ -9,6 +9,13 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_AICARTC_ADD(_tag,_freq) \
+ MCFG_DEVICE_ADD(_tag, AICARTC, _freq)
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/devices/machine/akiko.cpp b/src/devices/machine/akiko.cpp
index eb5fa929059..0394750fe30 100644
--- a/src/devices/machine/akiko.cpp
+++ b/src/devices/machine/akiko.cpp
@@ -38,9 +38,8 @@ DEFINE_DEVICE_TYPE(AKIKO, akiko_device, "akiko", "CBM AKIKO")
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void akiko_device::device_add_mconfig(machine_config &config)
-{
-}
+MACHINE_CONFIG_START(akiko_device::device_add_mconfig)
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/machine/am9513.cpp b/src/devices/machine/am9513.cpp
index 6506510369f..c17ae1f09fe 100644
--- a/src/devices/machine/am9513.cpp
+++ b/src/devices/machine/am9513.cpp
@@ -1382,7 +1382,7 @@ void am9513_device::data_write(u16 data)
// read8 - 8-bit read access
//-------------------------------------------------
-u8 am9513_device::read8(offs_t offset)
+READ8_MEMBER(am9513_device::read8)
{
if (BIT(offset, 0))
return status_read();
@@ -1395,7 +1395,7 @@ u8 am9513_device::read8(offs_t offset)
// write8 - 8-bit write access
//-------------------------------------------------
-void am9513_device::write8(offs_t offset, u8 data)
+WRITE8_MEMBER(am9513_device::write8)
{
if (BIT(offset, 0))
{
@@ -1412,7 +1412,7 @@ void am9513_device::write8(offs_t offset, u8 data)
// read16 - 16-bit read access
//-------------------------------------------------
-u16 am9513_device::read16(offs_t offset)
+READ16_MEMBER(am9513_device::read16)
{
if (BIT(offset, 0))
return status_read() | 0xff00;
@@ -1429,7 +1429,7 @@ u16 am9513_device::read16(offs_t offset)
// write16 - 16-bit write access
//-------------------------------------------------
-void am9513_device::write16(offs_t offset, u16 data)
+WRITE16_MEMBER(am9513_device::write16)
{
if ((!bus_is_16_bit() || BIT(offset, 0)) && (data & 0xff00) != 0xff00)
logerror("Errant write of %02X to upper byte of %s register in %d-bit bus mode\n",
diff --git a/src/devices/machine/am9513.h b/src/devices/machine/am9513.h
index ea3fcfe6443..b591294d9b7 100644
--- a/src/devices/machine/am9513.h
+++ b/src/devices/machine/am9513.h
@@ -55,12 +55,12 @@ public:
auto fout_cb() { return m_fout_cb.bind(); }
// 8-bit data bus interface
- u8 read8(offs_t offset);
- void write8(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER(read8);
+ DECLARE_WRITE8_MEMBER(write8);
// 16-bit data bus interface
- u16 read16(offs_t offset);
- void write16(offs_t offset, u16 data);
+ DECLARE_READ16_MEMBER(read16);
+ DECLARE_WRITE16_MEMBER(write16);
// Source N inputs
DECLARE_WRITE_LINE_MEMBER(source1_w) { write_source(0, state); }
diff --git a/src/devices/machine/am9517a.cpp b/src/devices/machine/am9517a.cpp
index 5fda6ed486c..463f1c447ef 100644
--- a/src/devices/machine/am9517a.cpp
+++ b/src/devices/machine/am9517a.cpp
@@ -39,18 +39,6 @@
*/
-/*
- * The EISA_DMA device represents the 82C37A-compatible DMA devices present in
- * EISA bus systems, in particular those embedded within the i82357 Integrated
- * System Peripheral. The device supports 32 bit addressing, 32 bit data sizes,
- * and 24 bit transfer counts, allowing DMA across 64k boundaries. It also adds
- * stop registers, supporting ring-buffer memory arrangements.
- *
- * TODO
- * - stop registers
- * - 16/32-bit transfer sizes
- */
-
#include "emu.h"
#include "am9517a.h"
@@ -66,7 +54,6 @@
DEFINE_DEVICE_TYPE(AM9517A, am9517a_device, "am9517a", "AM9517A")
DEFINE_DEVICE_TYPE(V5X_DMAU, v5x_dmau_device, "v5x_dmau", "V5X DMAU")
DEFINE_DEVICE_TYPE(PCXPORT_DMAC, pcxport_dmac_device, "pcx_dmac", "PC Transporter DMAC")
-DEFINE_DEVICE_TYPE(EISA_DMA, eisa_dma_device, "eisa_dma", "EISA DMA")
//**************************************************************************
@@ -303,6 +290,8 @@ inline void am9517a_device::dma_advance()
{
bool msb_changed = false;
+ m_channel[m_current_channel].m_count--;
+
if (m_current_channel || !COMMAND_MEM_TO_MEM || !COMMAND_CH0_ADDRESS_HOLD)
{
if (MODE_ADDRESS_DECREMENT)
@@ -327,7 +316,7 @@ inline void am9517a_device::dma_advance()
}
}
- if (m_channel[m_current_channel].m_count-- == 0)
+ if (m_channel[m_current_channel].m_count == 0xffff)
{
end_of_process();
}
@@ -723,7 +712,7 @@ void am9517a_device::execute_run()
// read -
//-------------------------------------------------
-uint8_t am9517a_device::read(offs_t offset)
+READ8_MEMBER( am9517a_device::read )
{
uint8_t data = 0;
@@ -787,7 +776,7 @@ uint8_t am9517a_device::read(offs_t offset)
// write -
//-------------------------------------------------
-void am9517a_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( am9517a_device::write )
{
if (!BIT(offset, 3))
{
@@ -1024,7 +1013,7 @@ void v5x_dmau_device::device_reset()
}
-uint8_t v5x_dmau_device::read(offs_t offset)
+READ8_MEMBER(v5x_dmau_device::read)
{
uint8_t ret = 0;
int channel = m_selected_channel;
@@ -1108,7 +1097,7 @@ uint8_t v5x_dmau_device::read(offs_t offset)
return ret;
}
-void v5x_dmau_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(v5x_dmau_device::write)
{
int channel = m_selected_channel;
@@ -1119,12 +1108,12 @@ void v5x_dmau_device::write(offs_t offset, uint8_t data)
//m_buswidth = data & 0x02;
//if (data & 0x01)
// soft_reset();
- LOG("DMA: Initialise [%02x]\n", data);
+ logerror("DMA: Initialise [%02x]\n", data);
break;
case 0x01: // Channel
m_selected_channel = data & 0x03;
m_base = data & 0x04;
- LOG("DMA: Channel selected [%02x]\n", data);
+ logerror("DMA: Channel selected [%02x]\n", data);
break;
case 0x02: // Count (low)
m_channel[channel].m_base_count =
@@ -1132,7 +1121,7 @@ void v5x_dmau_device::write(offs_t offset, uint8_t data)
if (m_base == 0)
m_channel[channel].m_count =
(m_channel[channel].m_count & 0xff00) | data;
- LOG("DMA: Channel %i Counter set [%04x]\n", m_selected_channel, m_channel[channel].m_base_count);
+ logerror("DMA: Channel %i Counter set [%04x]\n", m_selected_channel, m_channel[channel].m_base_count);
break;
case 0x03: // Count (high)
m_channel[channel].m_base_count =
@@ -1140,7 +1129,7 @@ void v5x_dmau_device::write(offs_t offset, uint8_t data)
if (m_base == 0)
m_channel[channel].m_count =
(m_channel[channel].m_count & 0x00ff) | (data << 8);
- LOG("DMA: Channel %i Counter set [%04x]\n", m_selected_channel, m_channel[channel].m_base_count);
+ logerror("DMA: Channel %i Counter set [%04x]\n", m_selected_channel, m_channel[channel].m_base_count);
break;
case 0x04: // Address (low)
m_channel[channel].m_base_address =
@@ -1148,7 +1137,7 @@ void v5x_dmau_device::write(offs_t offset, uint8_t data)
if (m_base == 0)
m_channel[channel].m_address =
(m_channel[channel].m_address & 0xffffff00) | data;
- LOG("DMA: Channel %i Address set [%08x]\n", m_selected_channel, m_channel[channel].m_base_address);
+ logerror("DMA: Channel %i Address set [%08x]\n", m_selected_channel, m_channel[channel].m_base_address);
break;
case 0x05: // Address (mid)
m_channel[channel].m_base_address =
@@ -1156,7 +1145,7 @@ void v5x_dmau_device::write(offs_t offset, uint8_t data)
if (m_base == 0)
m_channel[channel].m_address =
(m_channel[channel].m_address & 0xffff00ff) | (data << 8);
- LOG("DMA: Channel %i Address set [%08x]\n", m_selected_channel, m_channel[channel].m_base_address);
+ logerror("DMA: Channel %i Address set [%08x]\n", m_selected_channel, m_channel[channel].m_base_address);
break;
case 0x06: // Address (high)
m_channel[channel].m_base_address =
@@ -1164,7 +1153,7 @@ void v5x_dmau_device::write(offs_t offset, uint8_t data)
if (m_base == 0)
m_channel[channel].m_address =
(m_channel[channel].m_address & 0xff00ffff) | (data << 16);
- LOG("DMA: Channel %i Address set [%08x]\n", m_selected_channel, m_channel[channel].m_base_address);
+ logerror("DMA: Channel %i Address set [%08x]\n", m_selected_channel, m_channel[channel].m_base_address);
break;
case 0x07: // Address (highest)
m_channel[channel].m_base_address =
@@ -1172,31 +1161,31 @@ void v5x_dmau_device::write(offs_t offset, uint8_t data)
if (m_base == 0)
m_channel[channel].m_address =
(m_channel[channel].m_address & 0x00ffffff) | (data << 24);
- LOG("DMA: Channel %i Address set [%08x]\n", m_selected_channel, m_channel[channel].m_base_address);
+ logerror("DMA: Channel %i Address set [%08x]\n", m_selected_channel, m_channel[channel].m_base_address);
break;
case 0x0a: // Mode control
m_channel[channel].m_mode = data;
// clear terminal count
m_status &= ~(1 << channel);
- LOG("DMA: Channel %i Mode control set [%02x]\n",m_selected_channel,m_channel[channel].m_mode);
+ logerror("DMA: Channel %i Mode control set [%02x]\n",m_selected_channel,m_channel[channel].m_mode);
break;
case 0x08: // Device control (low)
m_command = data;
- LOG("DMA: Device control low set [%02x]\n",data);
+ logerror("DMA: Device control low set [%02x]\n",data);
break;
case 0x09: // Device control (high)
m_command_high = data;
- LOG("DMA: Device control high set [%02x]\n",data);
+ logerror("DMA: Device control high set [%02x]\n",data);
break;
case 0x0e: // Request
//m_reg.request = data;
- LOG("(invalid) DMA: Request set [%02x]\n",data); // no software requests on the v53 integrated version
+ logerror("(invalid) DMA: Request set [%02x]\n",data); // no software requests on the v53 integrated version
break;
case 0x0f: // Mask
m_mask = data & 0x0f;
- LOG("DMA: Mask set [%02x]\n",data);
+ logerror("DMA: Mask set [%02x]\n",data);
break;
@@ -1309,17 +1298,3 @@ void pcxport_dmac_device::end_of_process()
m_state = STATE_SI;
}
-
-eisa_dma_device::eisa_dma_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : am9517a_device(mconfig, EISA_DMA, tag, owner, clock)
-{
-}
-
-void eisa_dma_device::device_start()
-{
- am9517a_device::device_start();
-
- m_address_mask = 0xffffffffU;
-
- save_item(NAME(m_stop));
-}
diff --git a/src/devices/machine/am9517a.h b/src/devices/machine/am9517a.h
index a1e9215d125..37390a930d3 100644
--- a/src/devices/machine/am9517a.h
+++ b/src/devices/machine/am9517a.h
@@ -61,8 +61,8 @@ public:
template <unsigned C> auto out_iow_callback() { return m_out_iow_cb[C].bind(); }
template <unsigned C> auto out_dack_callback() { return m_out_dack_cb[C].bind(); }
- virtual uint8_t read(offs_t offset);
- virtual void write(offs_t offset, uint8_t data);
+ virtual DECLARE_READ8_MEMBER( read );
+ virtual DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( hack_w );
DECLARE_WRITE_LINE_MEMBER( ready_w );
@@ -95,9 +95,9 @@ protected:
struct
{
uint32_t m_address;
- uint32_t m_count;
+ uint16_t m_count;
uint32_t m_base_address;
- uint32_t m_base_count;
+ uint16_t m_base_count;
uint8_t m_mode;
} m_channel[4];
@@ -149,8 +149,8 @@ public:
template <unsigned C> auto in_io16r_callback() { return m_in_io16r_cb[C].bind(); }
template <unsigned C> auto out_io16w_callback() { return m_out_io16w_cb[C].bind(); }
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER( read ) override;
+ virtual DECLARE_WRITE8_MEMBER( write ) override;
protected:
// device-level overrides
@@ -186,50 +186,11 @@ protected:
virtual void end_of_process() override;
};
-class eisa_dma_device : public am9517a_device
-{
-public:
- eisa_dma_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- template <unsigned Channel> u8 get_address_page() { return m_channel[Channel].m_address >> 16; }
- template <unsigned Channel> void set_address_page(u8 data)
- {
- m_channel[Channel].m_base_address = (m_channel[Channel].m_base_address & 0x0000ffffU) | (u32(data) << 16);
- m_channel[Channel].m_address = (m_channel[Channel].m_address & 0x0000ffffU) | (u32(data) << 16);
- }
-
- template <unsigned Channel> u8 get_address_page_high() { return m_channel[Channel].m_address >> 24; }
- template <unsigned Channel> void set_address_page_high(u8 data)
- {
- m_channel[Channel].m_base_address = (m_channel[Channel].m_base_address & 0x00ffffffU) | (u32(data) << 24);
- m_channel[Channel].m_address = (m_channel[Channel].m_address & 0x00ffffffU) | (u32(data) << 24);
- }
-
- template <unsigned Channel> u8 get_count_high() { return m_channel[Channel].m_count >> 16; }
- template <unsigned Channel> void set_count_high(u8 data)
- {
- m_channel[Channel].m_base_count = (m_channel[Channel].m_base_count & 0x0000ffffU) | (u32(data) << 16);
- m_channel[Channel].m_count = (m_channel[Channel].m_count & 0x0000ffffU) | (u32(data) << 16);
- }
- template <unsigned Channel> u32 get_stop() { return m_stop[Channel]; }
- template <unsigned Channel> void set_stop(offs_t offset, u32 data, u32 mem_mask)
- {
- mem_mask &= 0x00fffffcU;
- COMBINE_DATA(&m_stop[Channel]);
- }
-
-protected:
- virtual void device_start() override;
-
-private:
- u32 m_stop[4];
-};
// device type definition
DECLARE_DEVICE_TYPE(AM9517A, am9517a_device)
DECLARE_DEVICE_TYPE(V5X_DMAU, v5x_dmau_device)
DECLARE_DEVICE_TYPE(PCXPORT_DMAC, pcxport_dmac_device)
-DECLARE_DEVICE_TYPE(EISA_DMA, eisa_dma_device)
#endif // MAME_MACHINE_AM9517_H
diff --git a/src/devices/machine/am9519.cpp b/src/devices/machine/am9519.cpp
index be0b8c3da10..b1700b38492 100644
--- a/src/devices/machine/am9519.cpp
+++ b/src/devices/machine/am9519.cpp
@@ -103,7 +103,7 @@ IRQ_CALLBACK_MEMBER(am9519_device::iack_cb)
}
-u8 am9519_device::stat_r()
+READ8_MEMBER( am9519_device::stat_r )
{
u8 stat = 0;
for(int n = 0, irq = m_prio; n < 8; n++, irq = (irq + 1) & 7)
@@ -121,7 +121,7 @@ u8 am9519_device::stat_r()
return stat;
}
-u8 am9519_device::data_r()
+READ8_MEMBER( am9519_device::data_r )
{
switch((m_mode & 0x60) >> 5)
{
@@ -137,7 +137,7 @@ u8 am9519_device::data_r()
return 0;
}
-void am9519_device::cmd_w(u8 data)
+WRITE8_MEMBER( am9519_device::cmd_w )
{
m_cmd = data;
switch(data >> 3)
@@ -222,7 +222,7 @@ void am9519_device::cmd_w(u8 data)
set_timer();
}
-void am9519_device::data_w(u8 data)
+WRITE8_MEMBER( am9519_device::data_w )
{
if((m_cmd & 0xf0) >= 0xb0)
{
diff --git a/src/devices/machine/am9519.h b/src/devices/machine/am9519.h
index 315e0bd890d..ddd4925696b 100644
--- a/src/devices/machine/am9519.h
+++ b/src/devices/machine/am9519.h
@@ -36,10 +36,10 @@ public:
auto out_int_callback() { return m_out_int_func.bind(); }
- u8 stat_r();
- u8 data_r();
- void cmd_w(u8 data);
- void data_w(u8 data);
+ DECLARE_READ8_MEMBER( stat_r );
+ DECLARE_READ8_MEMBER( data_r );
+ DECLARE_WRITE8_MEMBER( cmd_w );
+ DECLARE_WRITE8_MEMBER( data_w );
u32 acknowledge();
DECLARE_WRITE_LINE_MEMBER( ireq0_w ) { set_irq_line(0, state); }
diff --git a/src/devices/machine/appldriv.h b/src/devices/machine/appldriv.h
index 6d23284f46a..1a396990167 100644
--- a/src/devices/machine/appldriv.h
+++ b/src/devices/machine/appldriv.h
@@ -63,4 +63,33 @@ private:
// device type definition
DECLARE_DEVICE_TYPE(FLOPPY_APPLE, apple525_floppy_image_device)
+#define MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \
+ downcast<apple525_floppy_image_device *>(device)->set_params(_dividend,_divisor);
+
+#define MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(_config,_dividend,_divisor) \
+ MCFG_DEVICE_ADD(FLOPPY_0, FLOPPY_APPLE, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \
+ MCFG_DEVICE_ADD(FLOPPY_1, FLOPPY_APPLE, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor)
+
+#define MCFG_LEGACY_FLOPPY_APPLE_4_DRIVES_ADD(_config,_dividend,_divisor) \
+ MCFG_DEVICE_ADD(FLOPPY_0, FLOPPY_APPLE, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \
+ MCFG_DEVICE_ADD(FLOPPY_1, FLOPPY_APPLE, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \
+ MCFG_DEVICE_ADD(FLOPPY_2, FLOPPY_APPLE, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \
+ MCFG_DEVICE_ADD(FLOPPY_3, FLOPPY_APPLE, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor)
+
+#define MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_REMOVE() \
+ MCFG_DEVICE_REMOVE(FLOPPY_0) \
+ MCFG_DEVICE_REMOVE(FLOPPY_1)
+
#endif // MAME_MACHINE_APPLDRIV_H
diff --git a/src/devices/machine/applefdc.h b/src/devices/machine/applefdc.h
index 87cc89f36dc..eede57199f7 100644
--- a/src/devices/machine/applefdc.h
+++ b/src/devices/machine/applefdc.h
@@ -124,12 +124,6 @@ private:
class applefdc_device : public applefdc_base_device
{
public:
- applefdc_device(const machine_config &mconfig, const char *tag, device_t *owner, const applefdc_interface *intrf)
- : applefdc_device(mconfig, tag, owner, (uint32_t)0)
- {
- set_config(intrf);
- }
-
applefdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
@@ -151,4 +145,30 @@ public:
iwm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
+
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_APPLEFDC_CONFIG(_intrf) \
+ downcast<applefdc_base_device &>(*device).set_config(&(_intrf));
+
+#define MCFG_APPLEFDC_ADD(_tag, _intrf) \
+ MCFG_DEVICE_ADD(_tag, APPLEFDC, 0) \
+ MCFG_APPLEFDC_CONFIG(_intrf)
+
+#define MCFG_APPLEFDC_MODIFY(_tag, _intrf) \
+ MCFG_DEVICE_MODIFY(_tag) \
+ MCFG_APPLEFDC_CONFIG(_intrf)
+
+#define MCFG_IWM_ADD(_tag, _intrf) \
+ MCFG_DEVICE_ADD(_tag, IWM, 0) \
+ MCFG_APPLEFDC_CONFIG(_intrf)
+
+#define MCFG_IWM_MODIFY(_tag, _intrf) \
+ MCFG_DEVICE_MODIFY(_tag) \
+ MCFG_APPLEFDC_CONFIG(_intrf)
+
+
#endif // MAME_MACHINE_APPLEFDC_H
diff --git a/src/devices/machine/at29x.cpp b/src/devices/machine/at29x.cpp
index 3f31e44c0a8..482faf24221 100644
--- a/src/devices/machine/at29x.cpp
+++ b/src/devices/machine/at29x.cpp
@@ -195,7 +195,7 @@ void at29x_device::sync_flags()
/*
read a byte from FEEPROM
*/
-uint8_t at29x_device::read(offs_t offset)
+READ8_MEMBER( at29x_device::read )
{
int reply;
@@ -271,7 +271,7 @@ uint8_t at29x_device::read(offs_t offset)
/*
Write a byte to FEEPROM
*/
-void at29x_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( at29x_device::write )
{
offset &= m_address_mask;
LOGMASKED(LOG_WRITE, "%05x <- %02x\n", offset, data);
diff --git a/src/devices/machine/at29x.h b/src/devices/machine/at29x.h
index 265ef1587c2..435bcaafabc 100644
--- a/src/devices/machine/at29x.h
+++ b/src/devices/machine/at29x.h
@@ -20,8 +20,8 @@ DECLARE_DEVICE_TYPE(AT29C040A, at29c040a_device)
class at29x_device : public device_t, public device_nvram_interface
{
public:
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
protected:
at29x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int memory_size, int device_id, int sector_size);
diff --git a/src/devices/machine/at_keybc.cpp b/src/devices/machine/at_keybc.cpp
index 5e6ac779569..aec9154a38f 100644
--- a/src/devices/machine/at_keybc.cpp
+++ b/src/devices/machine/at_keybc.cpp
@@ -74,8 +74,6 @@ ROM_START(at_kbc)
ROMX_LOAD("1503033.bin", 0x0000, 0x0800, CRC(5a81c0d2) SHA1(0100f8789fb4de74706ae7f9473a12ec2b9bd729), ROM_BIOS(0))
ROM_SYSTEM_BIOS(1, "ptl", "PTL 1986") // unknown controller BIOS, (c) 1985, 1986 PTL
ROMX_LOAD("yan25d05.bin", 0x0000, 0x0800, CRC(70c798f1) SHA1(ae9a79c7184a17331b70a50035ff63c757df094c), ROM_BIOS(1))
- ROM_SYSTEM_BIOS(2, "award15", "Award 1985 V1.5") // MIPS Rx2030 i8742 keyboard controller
- ROMX_LOAD("keyboard_1.5.bin", 0x0000, 0x0800, CRC(f86ba0f7) SHA1(1ad475451db35a76d929824c035d582279fbe3a3), ROM_BIOS(2))
ROM_END
ROM_START(ps2_kbc)
@@ -110,22 +108,22 @@ DEFINE_DEVICE_TYPE(PS2_KEYBOARD_CONTROLLER, ps2_keyboard_controller_device, "ps2
// KEYBOARD CONTROLLER DEVICE BASE
//**************************************************************************
-uint8_t at_kbc_device_base::data_r()
+READ8_MEMBER(at_kbc_device_base::data_r)
{
- return m_mcu->upi41_master_r(machine().dummy_space(), 0U);
+ return m_mcu->upi41_master_r(space, 0U);
}
-uint8_t at_kbc_device_base::status_r()
+READ8_MEMBER(at_kbc_device_base::status_r)
{
- return m_mcu->upi41_master_r(machine().dummy_space(), 1U);
+ return m_mcu->upi41_master_r(space, 1U);
}
-void at_kbc_device_base::data_w(uint8_t data)
+WRITE8_MEMBER(at_kbc_device_base::data_w)
{
machine().scheduler().synchronize(timer_expired_delegate(FUNC(at_kbc_device_base::write_data), this), unsigned(data));
}
-void at_kbc_device_base::command_w(uint8_t data)
+WRITE8_MEMBER(at_kbc_device_base::command_w)
{
machine().scheduler().synchronize(timer_expired_delegate(FUNC(at_kbc_device_base::write_command), this), unsigned(data));
}
@@ -265,7 +263,7 @@ ioport_constructor at_keyboard_controller_device::device_input_ports() const
return INPUT_PORTS_NAME(at_kbc);
}
-void at_keyboard_controller_device::p2_w(uint8_t data)
+WRITE8_MEMBER(at_keyboard_controller_device::p2_w)
{
set_hot_res(BIT(~data, 0));
set_gate_a20(BIT(data, 1));
@@ -279,11 +277,11 @@ void at_keyboard_controller_device::p2_w(uint8_t data)
// PS/2 KEYBOARD/MOUSE CONTROLLER DEVICE
//**************************************************************************
-uint8_t ps2_keyboard_controller_device::data_r()
+READ8_MEMBER(ps2_keyboard_controller_device::data_r)
{
set_kbd_irq(0U);
set_mouse_irq(0U);
- return m_mcu->upi41_master_r(machine().dummy_space(), 0U);
+ return m_mcu->upi41_master_r(space, 0U);
}
WRITE_LINE_MEMBER(ps2_keyboard_controller_device::mouse_clk_w)
@@ -385,12 +383,12 @@ TIMER_CALLBACK_MEMBER(ps2_keyboard_controller_device::set_mouse_data_in)
m_mouse_data_in = param ? 1U : 0U;
}
-uint8_t ps2_keyboard_controller_device::p1_r()
+READ8_MEMBER(ps2_keyboard_controller_device::p1_r)
{
return kbd_data_r() | (mouse_data_r() << 1) | 0xfcU;
}
-void ps2_keyboard_controller_device::p2_w(uint8_t data)
+WRITE8_MEMBER(ps2_keyboard_controller_device::p2_w)
{
set_hot_res(BIT(~data, 0));
set_gate_a20(BIT(data, 1));
diff --git a/src/devices/machine/at_keybc.h b/src/devices/machine/at_keybc.h
index 5ff11aa6ba1..77bf039a7a1 100644
--- a/src/devices/machine/at_keybc.h
+++ b/src/devices/machine/at_keybc.h
@@ -30,10 +30,10 @@ public:
auto kbd_data() { return m_kbd_data_cb.bind(); } // open collector with 10kΩ pull-up
// host interface
- virtual uint8_t data_r();
- virtual uint8_t status_r();
- void data_w(uint8_t data);
- void command_w(uint8_t data);
+ virtual DECLARE_READ8_MEMBER(data_r);
+ virtual DECLARE_READ8_MEMBER(status_r);
+ DECLARE_WRITE8_MEMBER(data_w);
+ DECLARE_WRITE8_MEMBER(command_w);
// inputs from keyboard
DECLARE_WRITE_LINE_MEMBER(kbd_clk_w);
@@ -93,7 +93,7 @@ protected:
private:
// MCU I/O handlers
- void p2_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER(p2_w);
};
@@ -112,7 +112,7 @@ public:
auto mouse_data() { return m_mouse_data_cb.bind(); } // open collector with 10kΩ pull-up
// host interface
- virtual uint8_t data_r() override;
+ virtual DECLARE_READ8_MEMBER(data_r) override;
// inputs from mouse
DECLARE_WRITE_LINE_MEMBER(mouse_clk_w);
@@ -143,8 +143,8 @@ private:
TIMER_CALLBACK_MEMBER(set_mouse_data_in);
// MCU I/O handlers
- uint8_t p1_r();
- void p2_w(uint8_t data);
+ DECLARE_READ8_MEMBER(p1_r);
+ DECLARE_WRITE8_MEMBER(p2_w);
devcb_write_line m_mouse_irq_cb;
devcb_write_line m_mouse_clk_cb, m_mouse_data_cb;
diff --git a/src/devices/machine/atapicdr.cpp b/src/devices/machine/atapicdr.cpp
index 33cb0cb154e..c13b6ff001e 100644
--- a/src/devices/machine/atapicdr.cpp
+++ b/src/devices/machine/atapicdr.cpp
@@ -30,11 +30,11 @@ atapi_fixed_cdrom_device::atapi_fixed_cdrom_device(const machine_config &mconfig
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void atapi_cdrom_device::device_add_mconfig(machine_config &config)
-{
- CDROM(config, "image").set_interface("cdrom");
- CDDA(config, "cdda");
-}
+MACHINE_CONFIG_START(atapi_cdrom_device::device_add_mconfig)
+ MCFG_CDROM_ADD("image")
+ MCFG_CDROM_INTERFACE("cdrom")
+ MCFG_DEVICE_ADD("cdda", CDDA)
+MACHINE_CONFIG_END
void atapi_cdrom_device::device_start()
{
diff --git a/src/devices/machine/ay31015.cpp b/src/devices/machine/ay31015.cpp
index 6ab1103b28a..b9cc6c74a9b 100644
--- a/src/devices/machine/ay31015.cpp
+++ b/src/devices/machine/ay31015.cpp
@@ -116,10 +116,14 @@ ay31015_device::ay31015_device(const machine_config &mconfig, device_type type,
m_rx_bit_count(0),
m_rx_parity(0),
m_rx_pulses(0),
+ m_rx_clock(0),
+ m_rx_timer(nullptr),
m_tx_data(0),
m_tx_buffer(0),
m_tx_parity(0),
m_tx_pulses(0),
+ m_tx_clock(0),
+ m_tx_timer(nullptr),
m_read_si_cb(*this),
m_write_so_cb(*this),
m_write_pe_cb(*this),
@@ -169,6 +173,14 @@ void ay31015_device::device_resolve_objects()
void ay31015_device::device_start()
{
+ m_rx_timer = timer_alloc(TIMER_RX);
+ m_rx_timer->adjust(attotime::never);
+ update_rx_timer();
+
+ m_tx_timer = timer_alloc(TIMER_TX);
+ m_tx_timer->adjust(attotime::never);
+ update_tx_timer();
+
save_item(NAME(m_pins));
save_item(NAME(m_control_reg));
save_item(NAME(m_status_reg));
@@ -182,12 +194,14 @@ void ay31015_device::device_start()
save_item(NAME(m_rx_bit_count));
save_item(NAME(m_rx_parity));
save_item(NAME(m_rx_pulses));
+ save_item(NAME(m_rx_clock));
save_item(NAME(m_tx_state));
save_item(NAME(m_tx_data));
save_item(NAME(m_tx_buffer));
save_item(NAME(m_tx_parity));
save_item(NAME(m_tx_pulses));
+ save_item(NAME(m_tx_clock));
}
//-------------------------------------------------
@@ -256,6 +270,14 @@ void ay31015_device::update_status_pins()
update_status_pin(STATUS_EOC, EOC, m_write_eoc_cb);
}
+void ay31015_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ if (id == TIMER_RX)
+ rx_process();
+ else if(id == TIMER_TX)
+ tx_process();
+}
+
/*************************************************** RECEIVE CONTROLS *************************************************/
@@ -710,6 +732,54 @@ int ay31015_device::get_output_pin( ay31015_device::output_pin pin )
}
+inline void ay31015_device::update_rx_timer()
+{
+ if (m_rx_clock > 0.0)
+ {
+ m_rx_timer->adjust(attotime::from_hz(m_rx_clock), 0, attotime::from_hz(m_rx_clock));
+ }
+ else
+ {
+ m_rx_timer->enable(0);
+ }
+}
+
+
+inline void ay31015_device::update_tx_timer()
+{
+ if (m_tx_clock > 0.0)
+ {
+ m_tx_timer->adjust(attotime::from_hz(m_tx_clock), 0, attotime::from_hz(m_tx_clock));
+ }
+ else
+ {
+ m_tx_timer->enable(0);
+ }
+}
+
+
+/*-------------------------------------------------
+ ay31015_set_receiver_clock - set receive clock
+-------------------------------------------------*/
+
+void ay31015_device::set_receiver_clock( double new_clock )
+{
+ m_rx_clock = new_clock;
+ update_rx_timer();
+}
+
+
+/*-------------------------------------------------
+ ay31015_set_transmitter_clock - set transmit clock
+-------------------------------------------------*/
+
+void ay31015_device::set_transmitter_clock( double new_clock )
+{
+ m_tx_clock = new_clock;
+ update_tx_timer();
+}
+
+
/*-------------------------------------------------
ay31015_get_received_data - return a byte to the computer
-------------------------------------------------*/
diff --git a/src/devices/machine/ay31015.h b/src/devices/machine/ay31015.h
index 42518cb9a85..497c6b6a9f9 100644
--- a/src/devices/machine/ay31015.h
+++ b/src/devices/machine/ay31015.h
@@ -20,6 +20,10 @@ class ay31015_device : public device_t
public:
ay31015_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ void set_tx_clock(double tx_clock) { m_tx_clock = tx_clock; }
+ void set_tx_clock(const XTAL &xtal) { set_tx_clock(xtal.dvalue()); }
+ void set_rx_clock(double rx_clock) { m_rx_clock = rx_clock; }
+ void set_rx_clock(const XTAL &xtal) { set_rx_clock(xtal.dvalue()); }
void set_auto_rdav(bool auto_rdav) { m_auto_rdav = auto_rdav; }
auto read_si_callback() { return m_read_si_cb.bind(); }
@@ -54,6 +58,12 @@ public:
DECLARE_READ_LINE_MEMBER(eoc_r) { return get_output_pin(EOC); }
DECLARE_READ_LINE_MEMBER(so_r) { return get_output_pin(SO); }
+ /* Set a new transmitter clock (new_clock is in Hz) */
+ void set_transmitter_clock( double new_clock );
+
+ /* Set a new receiver clock (new_clock is in Hz) */
+ void set_receiver_clock( double new_clock );
+
/* Reead the received data */
/* The received data is available on RD8-RD1 (pins 5-12) */
uint8_t get_received_data();
@@ -104,12 +114,16 @@ protected:
PREP_TIME
};
+ static constexpr device_timer_id TIMER_RX = 0;
+ static constexpr device_timer_id TIMER_TX = 1;
+
ay31015_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
void rx_process();
void tx_process();
@@ -123,6 +137,8 @@ protected:
void transfer_control_pins();
void set_input_pin(input_pin pin, int data);
int get_output_pin(output_pin pin);
+ inline void update_rx_timer();
+ inline void update_tx_timer();
int m_pins[41];
@@ -138,12 +154,16 @@ protected:
uint8_t m_rx_bit_count;
uint8_t m_rx_parity;
uint16_t m_rx_pulses; // total pulses left
+ double m_rx_clock; /* RCP - pin 17 */
+ emu_timer *m_rx_timer;
state_t m_tx_state;
uint8_t m_tx_data; // byte being sent
uint8_t m_tx_buffer; // next byte to send
uint8_t m_tx_parity;
uint16_t m_tx_pulses; // total pulses left
+ double m_tx_clock; /* TCP - pin 40 */
+ emu_timer *m_tx_timer;
devcb_read_line m_read_si_cb; // SI - pin 20 - This will be called whenever the SI pin is sampled. Optional
devcb_write_line m_write_so_cb; // SO - pin 25 - This will be called whenever data is put on the SO pin. Optional
diff --git a/src/devices/machine/bankdev.cpp b/src/devices/machine/bankdev.cpp
index e8e141ff7e6..8c10286ccfa 100644
--- a/src/devices/machine/bankdev.cpp
+++ b/src/devices/machine/bankdev.cpp
@@ -6,7 +6,7 @@
// device type definition
DEFINE_DEVICE_TYPE(ADDRESS_MAP_BANK, address_map_bank_device, "address_map_bank", "Address Map Bank")
-address_map_bank_device::address_map_bank_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+address_map_bank_device::address_map_bank_device( const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock )
: device_t(mconfig, ADDRESS_MAP_BANK, tag, owner, clock),
device_memory_interface(mconfig, *this),
m_endianness(ENDIANNESS_NATIVE),
@@ -46,42 +46,42 @@ void address_map_bank_device::amap64(address_map &map)
map(0x00000000, 0xffffffff).rw(FUNC(address_map_bank_device::read64), FUNC(address_map_bank_device::write64));
}
-void address_map_bank_device::write8(offs_t offset, u8 data)
+WRITE8_MEMBER(address_map_bank_device::write8)
{
m_program->write_byte(m_offset + offset, data);
}
-void address_map_bank_device::write16(offs_t offset, u16 data, u16 mem_mask)
+WRITE16_MEMBER(address_map_bank_device::write16)
{
m_program->write_word(m_offset + (offset << (m_shift+1)), data, mem_mask);
}
-void address_map_bank_device::write32(offs_t offset, u32 data, u32 mem_mask)
+WRITE32_MEMBER(address_map_bank_device::write32)
{
m_program->write_dword(m_offset + (offset << (m_shift+2)), data, mem_mask);
}
-void address_map_bank_device::write64(offs_t offset, u64 data, u64 mem_mask)
+WRITE64_MEMBER(address_map_bank_device::write64)
{
m_program->write_qword(m_offset + (offset << (m_shift+3)), data, mem_mask);
}
-u8 address_map_bank_device::read8(offs_t offset)
+READ8_MEMBER(address_map_bank_device::read8)
{
return m_program->read_byte(m_offset + offset);
}
-u16 address_map_bank_device::read16(offs_t offset, u16 mem_mask)
+READ16_MEMBER(address_map_bank_device::read16)
{
return m_program->read_word(m_offset + (offset << (m_shift+1)), mem_mask);
}
-u32 address_map_bank_device::read32(offs_t offset, u32 mem_mask)
+READ32_MEMBER(address_map_bank_device::read32)
{
return m_program->read_dword(m_offset + (offset << (m_shift+2)), mem_mask);
}
-u64 address_map_bank_device::read64(offs_t offset, u64 mem_mask)
+READ64_MEMBER(address_map_bank_device::read64)
{
return m_program->read_qword(m_offset + (offset << (m_shift+3)), mem_mask);
}
diff --git a/src/devices/machine/bankdev.h b/src/devices/machine/bankdev.h
index 05a3c2eb411..39bcfdcf08a 100644
--- a/src/devices/machine/bankdev.h
+++ b/src/devices/machine/bankdev.h
@@ -12,16 +12,16 @@ class address_map_bank_device :
{
public:
// construction/destruction
- address_map_bank_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
+ address_map_bank_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
// configuration helpers
template <typename... T> address_map_bank_device& set_map(T &&... args) { set_addrmap(0, std::forward<T>(args)...); return *this; }
address_map_bank_device& set_endianness(endianness_t endianness) { m_endianness = endianness; return *this; }
- address_map_bank_device& set_data_width(u8 data_width) { m_data_width = data_width; return *this; }
- address_map_bank_device& set_addr_width(u8 addr_width) { m_addr_width = addr_width; return *this; }
- address_map_bank_device& set_stride(u32 stride) { m_stride = stride; return *this; }
- address_map_bank_device& set_shift(u32 shift) { m_shift = shift; return *this; }
- address_map_bank_device& set_options(endianness_t endianness, u8 data_width, u8 addr_width, u32 stride = 1)
+ address_map_bank_device& set_data_width(uint8_t data_width) { m_data_width = data_width; return *this; }
+ address_map_bank_device& set_addr_width(uint8_t addr_width) { m_addr_width = addr_width; return *this; }
+ address_map_bank_device& set_stride(uint32_t stride) { m_stride = stride; return *this; }
+ address_map_bank_device& set_shift(uint32_t shift) { m_shift = shift; return *this; }
+ address_map_bank_device& set_options(endianness_t endianness, uint8_t data_width, uint8_t addr_width, uint32_t stride = 1)
{
set_endianness(endianness);
set_data_width(data_width);
@@ -32,25 +32,25 @@ public:
template <typename... T> address_map_bank_device& map(T &&... args) { set_addrmap(0, std::forward<T>(args)...); return *this; }
address_map_bank_device& endianness(endianness_t endianness) { m_endianness = endianness; return *this; }
- address_map_bank_device& data_width(u8 data_width) { m_data_width = data_width; return *this; }
- address_map_bank_device& addr_width(u8 addr_width) { m_addr_width = addr_width; return *this; }
- address_map_bank_device& stride(u32 stride) { m_stride = stride; return *this; }
- address_map_bank_device& shift(u32 shift) { m_shift = shift; return *this; }
+ address_map_bank_device& data_width(uint8_t data_width) { m_data_width = data_width; return *this; }
+ address_map_bank_device& addr_width(uint8_t addr_width) { m_addr_width = addr_width; return *this; }
+ address_map_bank_device& stride(uint32_t stride) { m_stride = stride; return *this; }
+ address_map_bank_device& shift(uint32_t shift) { m_shift = shift; return *this; }
void amap8(address_map &map);
void amap16(address_map &map);
void amap32(address_map &map);
void amap64(address_map &map);
- void write8(offs_t offset, u8 data);
- void write16(offs_t offset, u16 data, u16 mem_mask = 0xffff);
- void write32(offs_t offset, u32 data, u32 mem_mask = 0xffffffff);
- void write64(offs_t offset, u64 data, u64 mem_mask = ~u64(0));
+ DECLARE_WRITE8_MEMBER(write8);
+ DECLARE_WRITE16_MEMBER(write16);
+ DECLARE_WRITE32_MEMBER(write32);
+ DECLARE_WRITE64_MEMBER(write64);
- u8 read8(offs_t offset);
- u16 read16(offs_t offset, u16 mem_mask = 0xffff);
- u32 read32(offs_t offset, u32 mem_mask = 0xffffffff);
- u64 read64(offs_t offset, u64 mem_mask = ~u64(0));
+ DECLARE_READ8_MEMBER(read8);
+ DECLARE_READ16_MEMBER(read16);
+ DECLARE_READ32_MEMBER(read32);
+ DECLARE_READ64_MEMBER(read64);
void set_bank(offs_t offset);
@@ -64,9 +64,9 @@ protected:
private:
// internal state
endianness_t m_endianness;
- u8 m_data_width;
- u8 m_addr_width;
- u32 m_stride;
+ uint8_t m_data_width;
+ uint8_t m_addr_width;
+ uint32_t m_stride;
address_space_config m_program_config;
address_space *m_program;
offs_t m_offset;
diff --git a/src/devices/machine/clock.h b/src/devices/machine/clock.h
index 4bf0bed47a0..32989a15149 100644
--- a/src/devices/machine/clock.h
+++ b/src/devices/machine/clock.h
@@ -6,11 +6,17 @@
#pragma once
+#define MCFG_CLOCK_ADD(_tag, _clock) \
+ MCFG_DEVICE_ADD(_tag, CLOCK, _clock)
+
+#define MCFG_CLOCK_SIGNAL_HANDLER(_devcb) \
+ downcast<clock_device &>(*device).set_signal_handler(DEVCB_##_devcb);
+
class clock_device : public device_t
{
public:
+ template <class Object> devcb_base &set_signal_handler(Object &&cb) { return m_signal_handler.set_callback(std::forward<Object>(cb)); }
auto signal_handler() { return m_signal_handler.bind(); }
- DECLARE_READ_LINE_MEMBER(signal_r) { return m_signal; }
clock_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/machine/com8116.cpp b/src/devices/machine/com8116.cpp
index 06ebfb2f5b0..0a3da24042e 100644
--- a/src/devices/machine/com8116.cpp
+++ b/src/devices/machine/com8116.cpp
@@ -25,7 +25,6 @@ DEFINE_DEVICE_TYPE(COM8116, com8116_device, "com8116", "COM8116 Dual BRG")
DEFINE_DEVICE_TYPE(COM8116_003, com8116_003_device, "com8116_003", "COM8116-003 Dual BRG")
DEFINE_DEVICE_TYPE(COM5016_5, com5016_5_device, "com5016_5", "COM5016-5 Dual BRG")
DEFINE_DEVICE_TYPE(COM5016_013, com5016_013_device, "com5016_013", "COM5016-013 Dual BRG")
-DEFINE_DEVICE_TYPE(COM8116_020, com8116_020_device, "com8116_020", "COM8116-020 Dual BRG")
// Parts with T after the number do not have an internal oscillator and require an external clock source
// The SMC/COM 5xxx parts are all dual 5v/12v parts, while the 8xxx parts are 5v only
@@ -41,6 +40,7 @@ const int com8116_device::divisors_16X_5_0688MHz[16] =
// SMC/COM8116-003 and WD WD-1943-03
// from http://www.vintagecomputer.net/fjkraan/comp/divcomp/doc/SMC_BaudGen.pdf page 283 (pdf page 20)
// baud rates are 50, 75, 110, 134.5, 150, 200, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 9600, 19200
+// SMC/COM8116T-020 should have similar output rates, but clock is unknown and probably different
const int com8116_device::divisors_16X_6_01835MHz[16] =
{ 7523, 5015, 3420, 2797, 2508, 1881, 1254, 627, 313, 209, 188, 157, 104, 78, 39, 20 };
@@ -63,12 +63,6 @@ const int com8116_device::divisors_32X_5_0688MHz[16] =
const int com8116_device::divisors_16X_2_7648MHz[16] =
{ 3456, 2304, 1571, 1285, 1152, 864, 576, 288, 144, 96, 86, 72, 48, 36, 18, 9 };
-// SMC/COM8116T-020 (corrected from http://bitsavers.org/pdf/visualTechnology/Visual_100/MM-100-001-0A_Visual_100_and_Visual_400_Video_Display_Terminal_Maintenance_Manual_Sep1980.pdf (pdf page 99))
-// (75, 134.5 and 2000 baud divisors given as 1,807, 856 and 57, which do not match stated actual frequencies)
-// baud rates are 50, 75, 110, 134.5, 150, 200, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 9600, 19200
-const int com8116_device::divisors_16X_1_8432MHz[16] =
- { 2304, 1536, 1047, 857, 768, 576, 384, 192, 96, 64, 58, 48, 32, 24, 12, 6 };
-
// SMC/COM5026(T)-030 (non-standard serial rates, from http://bitsavers.informatik.uni-stuttgart.de/pdf/standardMicrosystems/_dataBooks/1979_StandardMicrosystems.pdf page 135)
const int com8116_device::divisors_16X_5_0688MHz_030[16] =
{ 731, 733, 735, 737, 741, 743, 745, 751, 6970, 5569, 5433, 4752, 4269, 1920, 1584, 301 };
@@ -126,11 +120,6 @@ com5016_013_device::com5016_013_device(const machine_config &mconfig, const char
{
}
-com8116_020_device::com8116_020_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- com8116_device(mconfig, COM8116_020, tag, owner, clock, divisors_16X_1_8432MHz)
-{
-}
-
//-------------------------------------------------
// device_start - device-specific startup
@@ -204,7 +193,7 @@ void com8116_device::device_timer(emu_timer &timer, device_timer_id id, int para
// str_w -
//-------------------------------------------------
-void com8116_device::str_w(uint8_t data)
+void com8116_device::write_str(uint8_t data)
{
int fr_divider = data & 0x0f;
int fr_clock = clock() / m_divisors[fr_divider];
@@ -219,7 +208,7 @@ void com8116_device::str_w(uint8_t data)
// stt_w -
//-------------------------------------------------
-void com8116_device::stt_w(uint8_t data)
+void com8116_device::write_stt(uint8_t data)
{
int ft_divider = data & 0x0f;
int ft_clock = clock() / m_divisors[ft_divider];
@@ -234,10 +223,10 @@ void com8116_device::stt_w(uint8_t data)
// str_stt_w -
//-------------------------------------------------
-void com8116_device::str_stt_w(uint8_t data)
+WRITE8_MEMBER(com8116_device::str_stt_w)
{
- str_w(data >> 4);
- stt_w(data & 0x0f);
+ write_str(data >> 4);
+ write_stt(data & 0x0f);
}
@@ -245,8 +234,8 @@ void com8116_device::str_stt_w(uint8_t data)
// stt_str_w -
//-------------------------------------------------
-void com8116_device::stt_str_w(uint8_t data)
+WRITE8_MEMBER(com8116_device::stt_str_w)
{
- stt_w(data >> 4);
- str_w(data & 0x0f);
+ write_stt(data >> 4);
+ write_str(data & 0x0f);
}
diff --git a/src/devices/machine/com8116.h b/src/devices/machine/com8116.h
index d073ceac91f..50c8849e2ee 100644
--- a/src/devices/machine/com8116.h
+++ b/src/devices/machine/com8116.h
@@ -43,10 +43,12 @@ public:
auto fr_handler() { return m_fr_handler.bind(); }
auto ft_handler() { return m_ft_handler.bind(); }
- void str_w(uint8_t data);
- void stt_w(uint8_t data);
- void str_stt_w(uint8_t data);
- void stt_str_w(uint8_t data);
+ void write_str(uint8_t data);
+ void write_stt(uint8_t data);
+ DECLARE_WRITE8_MEMBER(str_w) { write_str(data); }
+ DECLARE_WRITE8_MEMBER(stt_w) { write_stt(data); }
+ DECLARE_WRITE8_MEMBER(str_stt_w);
+ DECLARE_WRITE8_MEMBER(stt_str_w);
protected:
com8116_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const int *divisors);
@@ -56,7 +58,6 @@ protected:
static const int divisors_16X_4_9152MHz[16];
static const int divisors_32X_5_0688MHz[16];
static const int divisors_16X_2_7648MHz[16];
- static const int divisors_16X_1_8432MHz[16];
static const int divisors_16X_5_0688MHz_030[16];
static const int divisors_16X_4_6080MHz[16];
static const int divisors_16X_4_9152MHz_SY2661_1[16];
@@ -122,21 +123,10 @@ public:
};
-// ======================> com8116_020_device
-
-class com8116_020_device : public com8116_device
-{
-public:
- // construction/destruction
- com8116_020_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-};
-
-
// device type definition
DECLARE_DEVICE_TYPE(COM8116, com8116_device)
DECLARE_DEVICE_TYPE(COM8116_003, com8116_003_device)
DECLARE_DEVICE_TYPE(COM5016_5, com5016_5_device)
DECLARE_DEVICE_TYPE(COM5016_013, com5016_013_device)
-DECLARE_DEVICE_TYPE(COM8116_020, com8116_020_device)
#endif // MAME_MACHINE_COM8116_H
diff --git a/src/devices/machine/cr511b.cpp b/src/devices/machine/cr511b.cpp
index 6a4309f12c9..066f08575ac 100644
--- a/src/devices/machine/cr511b.cpp
+++ b/src/devices/machine/cr511b.cpp
@@ -23,13 +23,13 @@ DEFINE_DEVICE_TYPE(CR511B, cr511b_device, "cr511b", "CR-511-B CD-ROM drive")
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void cr511b_device::device_add_mconfig(machine_config &config)
-{
- CDROM(config, m_cdrom).set_interface("cdrom");
- CDDA(config, m_cdda);
- m_cdda->add_route(0, ":lspeaker", 1.0);
- m_cdda->add_route(1, ":rspeaker", 1.0);
-}
+MACHINE_CONFIG_START(cr511b_device::device_add_mconfig)
+ MCFG_CDROM_ADD("cdrom")
+ MCFG_CDROM_INTERFACE("cdrom")
+ MCFG_DEVICE_ADD("cdda", CDDA)
+ MCFG_SOUND_ROUTE(0, ":lspeaker", 1.0)
+ MCFG_SOUND_ROUTE(1, ":rspeaker", 1.0)
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/machine/cs4031.cpp b/src/devices/machine/cs4031.cpp
index 13ec9b90a6d..fb1ac37b698 100644
--- a/src/devices/machine/cs4031.cpp
+++ b/src/devices/machine/cs4031.cpp
@@ -263,19 +263,19 @@ void cs4031_device::device_start()
m_space->install_rom(0xffff0000, 0xffffffff, m_bios + 0xf0000);
// install i/o accesses
- m_space_io->install_readwrite_handler(0x0000, 0x000f, read8sm_delegate(FUNC(am9517a_device::read), &(*m_dma1)), write8sm_delegate(FUNC(am9517a_device::write), &(*m_dma1)), 0xffffffff);
+ m_space_io->install_readwrite_handler(0x0000, 0x000f, read8_delegate(FUNC(am9517a_device::read), &(*m_dma1)), write8_delegate(FUNC(am9517a_device::write), &(*m_dma1)), 0xffffffff);
m_space_io->install_readwrite_handler(0x0020, 0x0023, read8sm_delegate(FUNC(pic8259_device::read), &(*m_intc1)), write8sm_delegate(FUNC(pic8259_device::write), &(*m_intc1)), 0x0000ffff);
- m_space_io->install_write_handler(0x0020, 0x0023, write8smo_delegate(FUNC(cs4031_device::config_address_w), this), 0x00ff0000);
- m_space_io->install_readwrite_handler(0x0020, 0x0023, read8smo_delegate(FUNC(cs4031_device::config_data_r), this), write8smo_delegate(FUNC(cs4031_device::config_data_w), this), 0xff000000);
+ m_space_io->install_write_handler(0x0020, 0x0023, write8_delegate(FUNC(cs4031_device::config_address_w), this), 0x00ff0000);
+ m_space_io->install_readwrite_handler(0x0020, 0x0023, read8_delegate(FUNC(cs4031_device::config_data_r), this), write8_delegate(FUNC(cs4031_device::config_data_w), this), 0xff000000);
m_space_io->install_readwrite_handler(0x0040, 0x0043, read8sm_delegate(FUNC(pit8254_device::read), &(*m_ctc)), write8sm_delegate(FUNC(pit8254_device::write), &(*m_ctc)), 0xffffffff);
- m_space_io->install_readwrite_handler(0x0060, 0x0063, read8smo_delegate(FUNC(cs4031_device::keyb_data_r), this), write8smo_delegate(FUNC(cs4031_device::keyb_data_w), this), 0x000000ff);
- m_space_io->install_readwrite_handler(0x0060, 0x0063, read8smo_delegate(FUNC(cs4031_device::portb_r), this), write8smo_delegate(FUNC(cs4031_device::portb_w), this), 0x0000ff00);
- m_space_io->install_readwrite_handler(0x0064, 0x0067, read8smo_delegate(FUNC(cs4031_device::keyb_status_r), this), write8smo_delegate(FUNC(cs4031_device::keyb_command_w), this), 0x000000ff);
- m_space_io->install_readwrite_handler(0x0070, 0x0073, read8sm_delegate(FUNC(mc146818_device::read), &(*m_rtc)), write8sm_delegate(FUNC(cs4031_device::rtc_w), this), 0x0000ffff);
- m_space_io->install_readwrite_handler(0x0080, 0x008f, read8sm_delegate(FUNC(cs4031_device::dma_page_r), this), write8sm_delegate(FUNC(cs4031_device::dma_page_w), this), 0xffffffff);
- m_space_io->install_readwrite_handler(0x0090, 0x0093, read8smo_delegate(FUNC(cs4031_device::sysctrl_r), this), write8smo_delegate(FUNC(cs4031_device::sysctrl_w), this), 0x00ff0000);
+ m_space_io->install_readwrite_handler(0x0060, 0x0063, read8_delegate(FUNC(cs4031_device::keyb_data_r), this), write8_delegate(FUNC(cs4031_device::keyb_data_w), this), 0x000000ff);
+ m_space_io->install_readwrite_handler(0x0060, 0x0063, read8_delegate(FUNC(cs4031_device::portb_r), this), write8_delegate(FUNC(cs4031_device::portb_w), this), 0x0000ff00);
+ m_space_io->install_readwrite_handler(0x0064, 0x0067, read8_delegate(FUNC(cs4031_device::keyb_status_r), this), write8_delegate(FUNC(cs4031_device::keyb_command_w), this), 0x000000ff);
+ m_space_io->install_readwrite_handler(0x0070, 0x0073, read8_delegate(FUNC(mc146818_device::read), &(*m_rtc)), write8_delegate(FUNC(cs4031_device::rtc_w), this), 0x0000ffff);
+ m_space_io->install_readwrite_handler(0x0080, 0x008f, read8_delegate(FUNC(cs4031_device::dma_page_r), this), write8_delegate(FUNC(cs4031_device::dma_page_w), this), 0xffffffff);
+ m_space_io->install_readwrite_handler(0x0090, 0x0093, read8_delegate(FUNC(cs4031_device::sysctrl_r), this), write8_delegate(FUNC(cs4031_device::sysctrl_w), this), 0x00ff0000);
m_space_io->install_readwrite_handler(0x00a0, 0x00a3, read8sm_delegate(FUNC(pic8259_device::read), &(*m_intc2)), write8sm_delegate(FUNC(pic8259_device::write), &(*m_intc2)), 0x0000ffff);
- m_space_io->install_readwrite_handler(0x00c0, 0x00df, read8sm_delegate(FUNC(cs4031_device::dma2_r),this), write8sm_delegate(FUNC(cs4031_device::dma2_w),this), 0xffffffff);
+ m_space_io->install_readwrite_handler(0x00c0, 0x00df, read8_delegate(FUNC(cs4031_device::dma2_r),this), write8_delegate(FUNC(cs4031_device::dma2_w),this), 0xffffffff);
}
//-------------------------------------------------
@@ -328,7 +328,7 @@ offs_t cs4031_device::page_offset()
return 0xff0000;
}
-uint8_t cs4031_device::dma_read_byte(offs_t offset)
+READ8_MEMBER( cs4031_device::dma_read_byte )
{
if (m_dma_channel == -1)
return 0xff;
@@ -336,7 +336,7 @@ uint8_t cs4031_device::dma_read_byte(offs_t offset)
return m_space->read_byte(page_offset() + offset);
}
-void cs4031_device::dma_write_byte(offs_t offset, uint8_t data)
+WRITE8_MEMBER( cs4031_device::dma_write_byte )
{
if (m_dma_channel == -1)
return;
@@ -344,7 +344,7 @@ void cs4031_device::dma_write_byte(offs_t offset, uint8_t data)
m_space->write_byte(page_offset() + offset, data);
}
-uint8_t cs4031_device::dma_read_word(offs_t offset)
+READ8_MEMBER( cs4031_device::dma_read_word )
{
if (m_dma_channel == -1)
return 0xff;
@@ -355,7 +355,7 @@ uint8_t cs4031_device::dma_read_word(offs_t offset)
return result;
}
-void cs4031_device::dma_write_word(offs_t offset, uint8_t data)
+WRITE8_MEMBER( cs4031_device::dma_write_word )
{
if (m_dma_channel == -1)
return;
@@ -377,8 +377,6 @@ WRITE_LINE_MEMBER( cs4031_device::dma1_eop_w )
void cs4031_device::set_dma_channel(int channel, bool state)
{
- //m_write_dack(channel, state);
-
if (!state)
{
m_dma_channel = channel;
@@ -431,7 +429,7 @@ void cs4031_device::trigger_nmi()
}
}
-uint8_t cs4031_device::intc1_slave_ack_r(offs_t offset)
+READ8_MEMBER( cs4031_device::intc1_slave_ack_r )
{
if (offset == 2) // IRQ 2
return m_intc2->acknowledge();
@@ -478,13 +476,13 @@ WRITE_LINE_MEMBER( cs4031_device::ctc_out2_w )
// CHIPSET CONFIGURATION
//**************************************************************************
-void cs4031_device::config_address_w(uint8_t data)
+WRITE8_MEMBER( cs4031_device::config_address_w )
{
m_address = data;
m_address_valid = (m_address < 0x20) ? true : false;
}
-uint8_t cs4031_device::config_data_r()
+READ8_MEMBER( cs4031_device::config_data_r )
{
uint8_t result = 0xff;
@@ -501,7 +499,7 @@ uint8_t cs4031_device::config_data_r()
return result;
}
-void cs4031_device::config_data_w(uint8_t data)
+WRITE8_MEMBER( cs4031_device::config_data_w )
{
if (m_address_valid)
{
@@ -694,21 +692,21 @@ void cs4031_device::keyboard_gatea20(int state)
update_a20m();
}
-uint8_t cs4031_device::keyb_status_r()
+READ8_MEMBER( cs4031_device::keyb_status_r )
{
LOGKEYBOARD("cs4031_device::keyb_status_r\n");
- return m_keybc->status_r();
+ return m_keybc->status_r(space, 0);
}
-void cs4031_device::keyb_command_blocked_w(uint8_t data)
+WRITE8_MEMBER( cs4031_device::keyb_command_blocked_w )
{
// command is optionally blocked
if (!BIT(m_registers[SOFT_RESET_AND_GATEA20], 7))
- m_keybc->command_w(data);
+ m_keybc->command_w(space, 0, data);
}
-void cs4031_device::keyb_command_w(uint8_t data)
+WRITE8_MEMBER( cs4031_device::keyb_command_w )
{
LOGKEYBOARD("cs4031_device::keyb_command_w: %02x\n", data);
@@ -722,12 +720,12 @@ void cs4031_device::keyb_command_w(uint8_t data)
emulated_gatea20(1);
// self-test is never blocked
- m_keybc->command_w(data);
+ m_keybc->command_w(space, 0, data);
break;
case 0xd1:
m_keybc_d1_written = true;
- keyb_command_blocked_w(data);
+ keyb_command_blocked_w(space, 0, data);
break;
case 0xf0:
@@ -756,7 +754,7 @@ void cs4031_device::keyb_command_w(uint8_t data)
emulated_gatea20(1);
}
- keyb_command_blocked_w(data);
+ keyb_command_blocked_w(space, 0, data);
break;
@@ -765,28 +763,28 @@ void cs4031_device::keyb_command_w(uint8_t data)
if (m_keybc_data_blocked)
{
m_keybc_data_blocked = false;
- keyb_command_blocked_w(data);
+ keyb_command_blocked_w(space, 0, data);
}
else
- m_keybc->command_w(data);
+ m_keybc->command_w(space, 0, data);
break;
// everything else goes directly to the keyboard controller
default:
- m_keybc->command_w(data);
+ m_keybc->command_w(space, 0, data);
break;
}
}
-uint8_t cs4031_device::keyb_data_r()
+READ8_MEMBER( cs4031_device::keyb_data_r )
{
LOGKEYBOARD("cs4031_device::keyb_data_r\n");
- return m_keybc->data_r();
+ return m_keybc->data_r(space, 0);
}
-void cs4031_device::keyb_data_w(uint8_t data)
+WRITE8_MEMBER( cs4031_device::keyb_data_w )
{
LOGKEYBOARD("cs4031_device::keyb_data_w: %02x\n", data);
@@ -800,7 +798,7 @@ void cs4031_device::keyb_data_w(uint8_t data)
else
{
m_keybc_data_blocked = false;
- m_keybc->data_w(data);
+ m_keybc->data_w(space, 0, data);
}
}
@@ -839,7 +837,7 @@ WRITE_LINE_MEMBER( cs4031_device::kbrst_w )
1 - Fast Gate A20
*/
-void cs4031_device::sysctrl_w(uint8_t data)
+WRITE8_MEMBER( cs4031_device::sysctrl_w )
{
LOGIO("cs4031_device::sysctrl_w: %u\n", data);
@@ -855,7 +853,7 @@ void cs4031_device::sysctrl_w(uint8_t data)
m_cpureset = BIT(data, 0);
}
-uint8_t cs4031_device::sysctrl_r()
+READ8_MEMBER( cs4031_device::sysctrl_r )
{
uint8_t result = 0; // reserved bits read as 0?
@@ -885,7 +883,7 @@ uint8_t cs4031_device::sysctrl_r()
7 - Parity check latch (r) [not emulated]
*/
-uint8_t cs4031_device::portb_r()
+READ8_MEMBER( cs4031_device::portb_r )
{
if (0)
logerror("cs4031_device::portb_r: %02x\n", m_portb);
@@ -893,7 +891,7 @@ uint8_t cs4031_device::portb_r()
return m_portb;
}
-void cs4031_device::portb_w(uint8_t data)
+WRITE8_MEMBER( cs4031_device::portb_w )
{
if (0)
logerror("cs4031_device::portb_w: %02x\n", data);
@@ -919,7 +917,7 @@ void cs4031_device::portb_w(uint8_t data)
7 - NMI mask
6:0 - RTC address
*/
-void cs4031_device::rtc_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( cs4031_device::rtc_w )
{
if (0)
logerror("cs4031_device::rtc_w: %02x\n", data);
@@ -930,5 +928,5 @@ void cs4031_device::rtc_w(offs_t offset, uint8_t data)
data &= 0x7f;
}
- m_rtc->write(offset, data);
+ m_rtc->write(space, offset, data);
}
diff --git a/src/devices/machine/cs4031.h b/src/devices/machine/cs4031.h
index 3e554e91904..e8b6e314f93 100644
--- a/src/devices/machine/cs4031.h
+++ b/src/devices/machine/cs4031.h
@@ -59,23 +59,23 @@ public:
auto spkr() { return m_write_spkr.bind(); }
// internal io
- void config_address_w(uint8_t data);
- uint8_t config_data_r();
- void config_data_w(uint8_t data);
- uint8_t portb_r();
- void portb_w(uint8_t data);
- void rtc_w(offs_t offset, uint8_t data);
- void sysctrl_w(uint8_t data);
- uint8_t sysctrl_r();
- uint8_t dma_page_r(offs_t offset) { return m_dma_page[offset]; }
- void dma_page_w(offs_t offset, uint8_t data) { m_dma_page[offset] = data; }
- uint8_t dma2_r(offs_t offset) { return m_dma2->read(offset / 2); }
- void dma2_w(offs_t offset, uint8_t data) { m_dma2->write(offset / 2, data); }
- uint8_t keyb_data_r();
- void keyb_data_w(uint8_t data);
- uint8_t keyb_status_r();
- void keyb_command_w(uint8_t data);
- void keyb_command_blocked_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( config_address_w );
+ DECLARE_READ8_MEMBER( config_data_r );
+ DECLARE_WRITE8_MEMBER( config_data_w );
+ DECLARE_READ8_MEMBER( portb_r );
+ DECLARE_WRITE8_MEMBER( portb_w );
+ DECLARE_WRITE8_MEMBER( rtc_w );
+ DECLARE_WRITE8_MEMBER( sysctrl_w );
+ DECLARE_READ8_MEMBER( sysctrl_r );
+ DECLARE_READ8_MEMBER( dma_page_r ) { return m_dma_page[offset]; }
+ DECLARE_WRITE8_MEMBER( dma_page_w ) { m_dma_page[offset] = data; }
+ DECLARE_READ8_MEMBER( dma2_r ) { return m_dma2->read(space, offset / 2); }
+ DECLARE_WRITE8_MEMBER( dma2_w ) { m_dma2->write(space, offset / 2, data); }
+ DECLARE_READ8_MEMBER( keyb_data_r );
+ DECLARE_WRITE8_MEMBER( keyb_data_w );
+ DECLARE_READ8_MEMBER( keyb_status_r );
+ DECLARE_WRITE8_MEMBER( keyb_command_w );
+ DECLARE_WRITE8_MEMBER( keyb_command_blocked_w );
// input lines
DECLARE_WRITE_LINE_MEMBER( irq01_w ) { m_intc1->ir1_w(state); }
@@ -205,25 +205,25 @@ private:
uint8_t m_registers[0x20];
- uint8_t dma_read_byte(offs_t offset);
- void dma_write_byte(offs_t offset, uint8_t data);
- uint8_t dma_read_word(offs_t offset);
- void dma_write_word(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( dma_read_byte );
+ DECLARE_WRITE8_MEMBER( dma_write_byte );
+ DECLARE_READ8_MEMBER( dma_read_word );
+ DECLARE_WRITE8_MEMBER( dma_write_word );
DECLARE_WRITE_LINE_MEMBER( dma1_eop_w );
- uint8_t dma1_ior0_r() { return m_read_ior(0); }
- uint8_t dma1_ior1_r() { return m_read_ior(1); }
- uint8_t dma1_ior2_r() { return m_read_ior(2); }
- uint8_t dma1_ior3_r() { return m_read_ior(3); }
- uint8_t dma2_ior1_r() { uint16_t const result = m_read_ior(5); m_dma_high_byte = result >> 8; return result; }
- uint8_t dma2_ior2_r() { uint16_t const result = m_read_ior(6); m_dma_high_byte = result >> 8; return result; }
- uint8_t dma2_ior3_r() { uint16_t const result = m_read_ior(7); m_dma_high_byte = result >> 8; return result; }
- void dma1_iow0_w(uint8_t data) { m_write_iow(0, data, 0xffff); }
- void dma1_iow1_w(uint8_t data) { m_write_iow(1, data, 0xffff); }
- void dma1_iow2_w(uint8_t data) { m_write_iow(2, data, 0xffff); }
- void dma1_iow3_w(uint8_t data) { m_write_iow(3, data, 0xffff); }
- void dma2_iow1_w(uint8_t data) { m_write_iow(5, (m_dma_high_byte << 8) | data, 0xffff); }
- void dma2_iow2_w(uint8_t data) { m_write_iow(6, (m_dma_high_byte << 8) | data, 0xffff); }
- void dma2_iow3_w(uint8_t data) { m_write_iow(7, (m_dma_high_byte << 8) | data, 0xffff); }
+ DECLARE_READ8_MEMBER( dma1_ior0_r ) { return m_read_ior(0); }
+ DECLARE_READ8_MEMBER( dma1_ior1_r ) { return m_read_ior(1); }
+ DECLARE_READ8_MEMBER( dma1_ior2_r ) { return m_read_ior(2); }
+ DECLARE_READ8_MEMBER( dma1_ior3_r ) { return m_read_ior(3); }
+ DECLARE_READ8_MEMBER( dma2_ior1_r ) { uint16_t const result = m_read_ior(5); m_dma_high_byte = result >> 8; return result; }
+ DECLARE_READ8_MEMBER( dma2_ior2_r ) { uint16_t const result = m_read_ior(6); m_dma_high_byte = result >> 8; return result; }
+ DECLARE_READ8_MEMBER( dma2_ior3_r ) { uint16_t const result = m_read_ior(7); m_dma_high_byte = result >> 8; return result; }
+ DECLARE_WRITE8_MEMBER( dma1_iow0_w ) { m_write_iow(0, data, 0xffff); }
+ DECLARE_WRITE8_MEMBER( dma1_iow1_w ) { m_write_iow(1, data, 0xffff); }
+ DECLARE_WRITE8_MEMBER( dma1_iow2_w ) { m_write_iow(2, data, 0xffff); }
+ DECLARE_WRITE8_MEMBER( dma1_iow3_w ) { m_write_iow(3, data, 0xffff); }
+ DECLARE_WRITE8_MEMBER( dma2_iow1_w ) { m_write_iow(5, (m_dma_high_byte << 8) | data, 0xffff); }
+ DECLARE_WRITE8_MEMBER( dma2_iow2_w ) { m_write_iow(6, (m_dma_high_byte << 8) | data, 0xffff); }
+ DECLARE_WRITE8_MEMBER( dma2_iow3_w ) { m_write_iow(7, (m_dma_high_byte << 8) | data, 0xffff); }
DECLARE_WRITE_LINE_MEMBER( dma1_dack0_w ) { set_dma_channel(0, state); }
DECLARE_WRITE_LINE_MEMBER( dma1_dack1_w ) { set_dma_channel(1, state); }
DECLARE_WRITE_LINE_MEMBER( dma1_dack2_w ) { set_dma_channel(2, state); }
@@ -234,7 +234,7 @@ private:
DECLARE_WRITE_LINE_MEMBER( dma2_dack3_w ) { set_dma_channel(7, state); }
DECLARE_WRITE_LINE_MEMBER( dma2_hreq_w ) { m_write_hold(state); }
DECLARE_WRITE_LINE_MEMBER( intc1_int_w ) { m_write_intr(state); }
- uint8_t intc1_slave_ack_r(offs_t offset);
+ DECLARE_READ8_MEMBER( intc1_slave_ack_r );
DECLARE_WRITE_LINE_MEMBER( ctc_out1_w );
DECLARE_WRITE_LINE_MEMBER( ctc_out2_w );
};
diff --git a/src/devices/machine/diablo_hd.cpp b/src/devices/machine/diablo_hd.cpp
index 36c57cbd0d7..669285ccb08 100644
--- a/src/devices/machine/diablo_hd.cpp
+++ b/src/devices/machine/diablo_hd.cpp
@@ -1324,9 +1324,11 @@ void diablo_hd_device::device_start()
void diablo_hd_device::device_reset()
{
// free previous page cache
- for (int page = 0; page < m_pages; page++)
- if (m_cache[page])
- m_cache[page] = nullptr;
+ if (m_cache) {
+ for (int page = 0; page < m_pages; page++)
+ if (m_cache[page])
+ m_cache[page] = nullptr;
+ }
// free previous bits cache
if (m_bits) {
for (int page = 0; page < m_pages; page++)
@@ -1440,10 +1442,9 @@ void diablo_hd_device::device_timer(emu_timer &timer, device_timer_id id, int pa
}
}
-void diablo_hd_device::device_add_mconfig(machine_config &config)
-{
- DIABLO(config, "drive", 0);
-}
+MACHINE_CONFIG_START(diablo_hd_device::device_add_mconfig)
+ MCFG_DIABLO_ADD("drive")
+MACHINE_CONFIG_END
DEFINE_DEVICE_TYPE(DIABLO_HD, diablo_hd_device, "diablo_hd", "Diablo Disk")
diff --git a/src/devices/machine/diablo_hd.h b/src/devices/machine/diablo_hd.h
index 93915e628e3..41f206cc531 100644
--- a/src/devices/machine/diablo_hd.h
+++ b/src/devices/machine/diablo_hd.h
@@ -162,4 +162,7 @@ private:
void sector_mark_0();
};
+#define MCFG_DIABLO_DRIVES_ADD() \
+ MCFG_DEVICE_ADD(DIABLO_HD_0, DIABLO_HD, 3333333) \
+ MCFG_DEVICE_ADD(DIABLO_HD_1, DIABLO_HD, 3333333)
#endif // !defined(_DIABLO_HD_DEVICE_)
diff --git a/src/devices/machine/dp8390.h b/src/devices/machine/dp8390.h
index c13fe53e1d3..74b57f027d1 100644
--- a/src/devices/machine/dp8390.h
+++ b/src/devices/machine/dp8390.h
@@ -8,13 +8,38 @@
// device stuff
+#define MCFG_DP8390D_IRQ_CB(_devcb) \
+ downcast<dp8390_device &>(*device).set_irq_callback(DEVCB_##_devcb);
+
+#define MCFG_DP8390D_BREQ_CB(_devcb) \
+ downcast<dp8390_device &>(*device).set_breq_callback(DEVCB_##_devcb);
+
+#define MCFG_DP8390D_MEM_READ_CB(_devcb) \
+ downcast<dp8390_device &>(*device).set_mem_read_callback(DEVCB_##_devcb);
+
+#define MCFG_DP8390D_MEM_WRITE_CB(_devcb) \
+ downcast<dp8390_device &>(*device).set_mem_write_callback(DEVCB_##_devcb);
+
+#define MCFG_RTL8019A_IRQ_CB(_devcb) \
+ downcast<rtl8019a_device &>(*device).set_irq_callback(DEVCB_##_devcb);
+
+#define MCFG_RTL8019A_BREQ_CB(_devcb) \
+ downcast<rtl8019a_device &>(*device).set_breq_callback(DEVCB_##_devcb);
+
+#define MCFG_RTL8019A_MEM_READ_CB(_devcb) \
+ downcast<rtl8019a_device &>(*device).set_mem_read_callback(DEVCB_##_devcb);
+
+#define MCFG_RTL8019A_MEM_WRITE_CB(_devcb) \
+ downcast<rtl8019a_device &>(*device).set_mem_write_callback(DEVCB_##_devcb);
+
+
class dp8390_device : public device_t, public device_network_interface
{
public:
- auto irq_callback() { return m_irq_cb.bind(); }
- auto breq_callback() { return m_breq_cb.bind(); }
- auto mem_read_callback() { return m_mem_read_cb.bind(); }
- auto mem_write_callback() { return m_mem_write_cb.bind(); }
+ template <class Object> devcb_base &set_irq_callback(Object &&cb) { return m_irq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_breq_callback(Object &&cb) { return m_breq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_mem_read_callback(Object &&cb) { return m_mem_read_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_mem_write_callback(Object &&cb) { return m_mem_write_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE16_MEMBER( dp8390_w );
DECLARE_READ16_MEMBER( dp8390_r );
diff --git a/src/devices/machine/dp83932c.cpp b/src/devices/machine/dp83932c.cpp
index 82d70f02797..c8c7fcfcd9e 100644
--- a/src/devices/machine/dp83932c.cpp
+++ b/src/devices/machine/dp83932c.cpp
@@ -20,99 +20,112 @@
#define VERBOSE 0
#include "logmacro.h"
-DEFINE_DEVICE_TYPE(DP83932C, dp83932c_device, "dp83932c", "National Semiconductor DP83932C SONIC")
+DEFINE_DEVICE_TYPE(DP83932C_BE, dp83932c_be_device, "dp83932c_be", "National Semiconductor DP83932C SONIC (big)")
+DEFINE_DEVICE_TYPE(DP83932C_LE, dp83932c_le_device, "dp83932c_le", "National Semiconductor DP83932C SONIC (little)")
-dp83932c_device::dp83932c_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, DP83932C, tag, owner, clock)
+dp83932c_device::dp83932c_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, endianness_t endian)
+ : device_t(mconfig, type, tag, owner, clock)
+ , device_memory_interface(mconfig, *this)
, device_network_interface(mconfig, *this, 10.0f)
- , m_ram(*this, finder_base::DUMMY_TAG)
+ , m_space_config("shared", endian, 32, 32)
, m_out_int(*this)
{
}
+dp83932c_be_device::dp83932c_be_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : dp83932c_device(mconfig, DP83932C_BE, tag, owner, clock, ENDIANNESS_BIG)
+{
+}
+
+dp83932c_le_device::dp83932c_le_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : dp83932c_device(mconfig, DP83932C_LE, tag, owner, clock, ENDIANNESS_LITTLE)
+{
+}
+
void dp83932c_device::map(address_map &map)
{
- // datasheet uses unshifted register addresses
- int const shift = 1;
-
- // command and status registers
- map(0x00 << shift, (0x00 << shift) | 0x01).rw(FUNC(dp83932c_device::cr_r), FUNC(dp83932c_device::cr_w));
- //map(0x01 << shift, (0x01 << shift) | 0x01).rw(FUNC(dp83932c_device::dcr_r), FUNC(dp83932c_device::dcr_w));
- //map(0x02 << shift, (0x02 << shift) | 0x01).rw(FUNC(dp83932c_device::rcr_r), FUNC(dp83932c_device::rcr_w));
- map(0x03 << shift, (0x03 << shift) | 0x01).rw(FUNC(dp83932c_device::tcr_r), FUNC(dp83932c_device::tcr_w));
- //map(0x04 << shift, (0x04 << shift) | 0x01).rw(FUNC(dp83932c_device::imr_r), FUNC(dp83932c_device::imr_w));
- map(0x05 << shift, (0x05 << shift) | 0x01).rw(FUNC(dp83932c_device::isr_r), FUNC(dp83932c_device::isr_w));
-
- // transmit registers
- map(0x06 << shift, (0x06 << shift) | 0x01).rw(FUNC(dp83932c_device::utda_r), FUNC(dp83932c_device::utda_w));
- //map(0x07 << shift, (0x07 << shift) | 0x01).rw(FUNC(dp83932c_device::ctda_r), FUNC(dp83932c_device::ctda_w));
-
- // tps
- // tfc
- // tsa0
- // tsa1
- // tfs
-
- // receive registers
- //map(0x0d << shift, (0x0d << shift) | 0x01).rw(FUNC(dp83932c_device::urda_r), FUNC(dp83932c_device::urda_w));
- map(0x0e << shift, (0x0e << shift) | 0x01).rw(FUNC(dp83932c_device::crda_r), FUNC(dp83932c_device::crda_w));
-
- // crba0
- // crba1
- // rbwc0
- // rbwc1
- // eobc
- // urra
- // rsa
- // rea
- map(0x17 << shift, (0x17 << shift) | 0x01).rw(FUNC(dp83932c_device::rrp_r), FUNC(dp83932c_device::rrp_w));
- map(0x18 << shift, (0x18 << shift) | 0x01).rw(FUNC(dp83932c_device::rwp_r), FUNC(dp83932c_device::rwp_w));
- // trba0
- // trba1
- // tbwc0
- // tbwc1
- // addr0
- // addr1
- // llfa
- // ttda
- // cep
- // cap2
- // cap1
- // cap0
- map(0x25 << shift, (0x25 << shift) | 0x01).rw(FUNC(dp83932c_device::ce_r), FUNC(dp83932c_device::ce_w));
- // cdp
- // cdc
- // sr
- map(0x29 << shift, (0x29 << shift) | 0x01).rw(FUNC(dp83932c_device::wt0_r), FUNC(dp83932c_device::wt0_w));
- map(0x2a << shift, (0x2a << shift) | 0x01).rw(FUNC(dp83932c_device::wt1_r), FUNC(dp83932c_device::wt1_w));
- map(0x2b << shift, (0x2b << shift) | 0x01).rw(FUNC(dp83932c_device::rsc_r), FUNC(dp83932c_device::rsc_w));
- // crct
- map(0x2d << shift, (0x2d << shift) | 0x01).rw(FUNC(dp83932c_device::faet_r), FUNC(dp83932c_device::faet_w));
- // mpt
- // mdt
-
- // 30-3e internal use registers
- // dcr2
+/*
+ // command and status registers
+ map(0x00, 0x03).rw(FUNC(dp83932c_device::cr_r), FUNC(dp83932c_device::cr_w));
+ map(0x04, 0x07).rw(FUNC(dp83932c_device::dcr_r), FUNC(dp83932c_device::dcr_w));
+ map(0x08, 0x0b).rw(FUNC(dp83932c_device::rcr_r), FUNC(dp83932c_device::rcr_w));
+ map(0x0c, 0x0f).rw(FUNC(dp83932c_device::tcr_r), FUNC(dp83932c_device::tcr_w));
+ map(0x10, 0x13).rw(FUNC(dp83932c_device::imr_r), FUNC(dp83932c_device::imr_w));
+ map(0x14, 0x17).rw(FUNC(dp83932c_device::isr_r), FUNC(dp83932c_device::isr_w));
+
+ // transmit registers
+ map(0x18, 0x1b).rw(FUNC(dp83932c_device::utda_r), FUNC(dp83932c_device::utda_w));
+ map(0x1c, 0x1f).rw(FUNC(dp83932c_device::ctda_r), FUNC(dp83932c_device::ctda_w));
+
+ // tps
+ // tfc
+ // tsa0
+ // tsa1
+ // tfs
+
+ // receive registers
+ map(0x34, 0x37).rw(FUNC(dp83932c_device::urda_r), FUNC(dp83932c_device::urda_w));
+ map(0x38, 0x3b).rw(FUNC(dp83932c_device::crda_r), FUNC(dp83932c_device::crda_w));
+
+ // crba0
+ // crba1
+ // rbwc0
+ // rbwc1
+ // eobc
+ // urra
+ // rsa
+ // rea
+ // rrp
+ // rwp
+ // trba0
+ // trba1
+ // tbwc0
+ // tbwc1
+ // addr0
+ // addr1
+ // llfa
+ // ttda
+ // cep
+ // cap2
+ // cap1
+ // cap0
+ // ce
+ // cdp
+ // cdc
+ // sr
+ // wt0
+ // wt1
+ // rsc
+ // crct
+ // faet
+ // mpt
+ // mdt
+
+ // 30-3e internal use registers
+*/
}
void dp83932c_device::device_start()
{
+ m_space = &space(0);
m_out_int.resolve();
}
void dp83932c_device::device_reset()
{
- m_cr = RST | STP | RXDIS;
- m_tcr = NCRS | PTX;
- m_isr = 0;
- m_ce = 0;
- m_rsc = 0;
}
void dp83932c_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
}
+device_memory_interface::space_config_vector dp83932c_device::memory_space_config() const
+{
+ return space_config_vector {
+ std::make_pair(0, &m_space_config)
+ };
+}
+
void dp83932c_device::send_complete_cb(int result)
{
}
diff --git a/src/devices/machine/dp83932c.h b/src/devices/machine/dp83932c.h
index e608f7508a6..27f5ae60d85 100644
--- a/src/devices/machine/dp83932c.h
+++ b/src/devices/machine/dp83932c.h
@@ -6,113 +6,54 @@
#pragma once
-#include "machine/ram.h"
-
-class dp83932c_device
- : public device_t
- , public device_network_interface
+class dp83932c_device :
+ public device_t,
+ public device_memory_interface,
+ public device_network_interface
{
public:
- dp83932c_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- static constexpr feature_type imperfect_features() { return feature::LAN; }
-
- // configuration
- template <typename T> void set_ram(T &&tag) { m_ram.set_tag(std::forward<T>(tag)); }
+ // callback configuration
auto out_int_cb() { return m_out_int.bind(); }
void map(address_map &map);
protected:
+ dp83932c_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, endianness_t endian);
+
// device_t overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+ // device_memory_interface overrides
+ virtual space_config_vector memory_space_config() const override;
+
// device_network_interface overrides
virtual void send_complete_cb(int result) override;
virtual int recv_start_cb(u8 *buf, int length) override;
virtual void recv_complete_cb(int result) override;
- enum cr_mask : u16
- {
- HTX = 0x0001, // halt transmission
- TXP = 0x0002, // transmit packets
- RXDIS = 0x0004, // receiver disable
- RXEN = 0x0008, // receiver enable
- STP = 0x0010, // stop timer
- ST = 0x0020, // start timer
- RST = 0x0080, // software reset
- RRRA = 0x0100, // read rra
- LCAM = 0x0200, // load cam
-
- CR_WMASK = 0x03bf
- };
-
- enum tcr_mask : u16
- {
- PTX = 0x0001, // packet transmitted ok
- BCM = 0x0002, // byte count mismatch
- FU = 0x0004, // fifo underrun
- PMB = 0x0008, // packet monitored bad
- OWC = 0x0020, // out of window collision
- EXC = 0x0040, // excessive collisions
- CRSL = 0x0080, // crs lost
- NCRS = 0x0100, // no crs
- DEF = 0x0200, // deferred transmission
- EXD = 0x0400, // excessive deferral
- EXDIS = 0x1000, // disable excessive deferral timer
- CRCI = 0x2000, // crc inhibit
- POWC = 0x4000, // programmed out of window collision timer
- PINT = 0x8000, // programmable interrupt
-
- TCR_WMASK = 0xf000
- };
-
- u16 cr_r() { return m_cr; }
- u16 tcr_r() { return m_tcr; }
- u16 utda_r() { return m_utda; }
- u16 crda_r() { return m_crda; }
- u16 rrp_r() { return m_rrp; }
- u16 rwp_r() { return m_rwp; }
- u16 isr_r() { return m_isr; }
- u16 ce_r() { return m_ce; }
- u16 wt0_r() { return m_wt0; }
- u16 wt1_r() { return m_wt1; }
- u16 rsc_r() { return m_rsc; }
- u16 faet_r() { return m_faet; }
-
- void cr_w(u16 data) { m_cr = (data & CR_WMASK) | (m_cr & ~CR_WMASK); }
- void tcr_w(u16 data) { m_tcr = (data & TCR_WMASK) | (m_tcr & ~TCR_WMASK); }
- void utda_w(u16 data) { m_utda = data; }
- void crda_w(u16 data) { m_crda = data; }
- void rrp_w(u16 data) { m_rrp = data; }
- void rwp_w(u16 data) { m_rwp = data; }
- void isr_w(u16 data) { m_isr = data; }
- void ce_w(u16 data) { m_ce = data; }
- void wt0_w(u16 data) { m_wt0 = data; }
- void wt1_w(u16 data) { m_wt1 = data; }
- void rsc_w(u16 data) { m_rsc = data; }
- void faet_w(u16 data) { m_faet = ~data; }
-
private:
- required_device<ram_device> m_ram;
+ // device_memory_interface members
+ const address_space_config m_space_config;
+ address_space *m_space;
devcb_write_line m_out_int;
+};
+
+class dp83932c_be_device : public dp83932c_device
+{
+public:
+ dp83932c_be_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+};
- u16 m_cr;
- u16 m_tcr;
- u16 m_utda;
- u16 m_crda;
- u16 m_rrp;
- u16 m_rwp;
- u16 m_isr;
- u16 m_ce;
- u16 m_wt0;
- u16 m_wt1;
- u16 m_rsc;
- u16 m_faet;
+class dp83932c_le_device : public dp83932c_device
+{
+public:
+ dp83932c_le_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-DECLARE_DEVICE_TYPE(DP83932C, dp83932c_device)
+DECLARE_DEVICE_TYPE(DP83932C_BE, dp83932c_be_device)
+DECLARE_DEVICE_TYPE(DP83932C_LE, dp83932c_le_device)
#endif // MAME_MACHINE_DP83932C_H
diff --git a/src/devices/machine/ds1204.h b/src/devices/machine/ds1204.h
index 59dc5718989..12bc61657e4 100644
--- a/src/devices/machine/ds1204.h
+++ b/src/devices/machine/ds1204.h
@@ -13,6 +13,9 @@
#pragma once
+#define MCFG_DS1204_ADD( _tag ) \
+ MCFG_DEVICE_ADD( _tag, DS1204, 0 )
+
class ds1204_device : public device_t, public device_nvram_interface
{
public:
diff --git a/src/devices/machine/ds1205.h b/src/devices/machine/ds1205.h
index ad7432e1ac7..7f854d901fc 100644
--- a/src/devices/machine/ds1205.h
+++ b/src/devices/machine/ds1205.h
@@ -13,6 +13,9 @@
#pragma once
+#define MCFG_DS1205_ADD( _tag ) \
+ MCFG_DEVICE_ADD( _tag, DS1205, 0 )
+
class ds1205_device : public device_t, public device_nvram_interface
{
public:
diff --git a/src/devices/machine/ds128x.cpp b/src/devices/machine/ds128x.cpp
index 91e022e07e7..7a397aab303 100644
--- a/src/devices/machine/ds128x.cpp
+++ b/src/devices/machine/ds128x.cpp
@@ -10,12 +10,7 @@ DEFINE_DEVICE_TYPE(DS12885, ds12885_device, "ds12885", "DS12885 RTC/NVRAM")
//-------------------------------------------------
ds12885_device::ds12885_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ds12885_device(mconfig, DS12885, tag, owner, clock)
-{
-}
-
-ds12885_device::ds12885_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
- : mc146818_device(mconfig, type, tag, owner, clock)
+ : mc146818_device(mconfig, DS12885, tag, owner, clock)
{
}
@@ -28,54 +23,3 @@ int ds12885_device::get_timer_bypass()
return 22; // No tick
}
-
-DEFINE_DEVICE_TYPE(DS12885EXT, ds12885ext_device, "ds12885ext", "DS12885 RTC/NVRAM size 256 bytes")
-
-//-------------------------------------------------
-// ds12885ext_device - constructor
-//-------------------------------------------------
-
-ds12885ext_device::ds12885ext_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ds12885_device(mconfig, DS12885EXT, tag, owner, clock)
-{
-}
-
-//-------------------------------------------------
-// ds12885ext_device - handlers that allow acces to extended memory size
-//-------------------------------------------------
-
-uint8_t ds12885ext_device::read_extended(offs_t offset)
-{
- switch (offset)
- {
- case 0:
- case 1:
- return read(offset);
- break;
- case 2:
- case 3:
- return read(offset - 2);
- break;
- default:
- return 0xff;
- }
-}
-
-void ds12885ext_device::write_extended(offs_t offset, uint8_t data)
-{
- switch (offset)
- {
- case 0:
- write(offset, data & 127);
- break;
- case 1:
- write(offset, data);
- break;
- case 2:
- write(offset - 2, data);
- break;
- case 3:
- write(offset - 2, data);
- break;
- }
-}
diff --git a/src/devices/machine/ds128x.h b/src/devices/machine/ds128x.h
index 7ade1bfa431..671d3ee0a6f 100644
--- a/src/devices/machine/ds128x.h
+++ b/src/devices/machine/ds128x.h
@@ -5,8 +5,10 @@
#include "mc146818.h"
+#define MCFG_DS12885_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, DS12885, XTAL(32'768))
-// ======================> ds12885_device
+// ======================> mc146818_device
class ds12885_device : public mc146818_device
{
@@ -15,8 +17,6 @@ public:
ds12885_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 32'768);
protected:
- ds12885_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
virtual int data_size() override { return 128; }
virtual int get_timer_bypass() override;
};
@@ -24,23 +24,4 @@ protected:
// device type definition
DECLARE_DEVICE_TYPE(DS12885, ds12885_device)
-// ======================> ds12885ext_device
-
-class ds12885ext_device : public ds12885_device
-{
-public:
- // construction/destruction
- ds12885ext_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 32'768);
-
- // read/write access to extended ram
- uint8_t read_extended(offs_t offset);
- void write_extended(offs_t offset, uint8_t data);
-
-protected:
- virtual int data_size() override { return 256; }
-};
-
-// device type definition
-DECLARE_DEVICE_TYPE(DS12885EXT, ds12885ext_device)
-
#endif // MAME_MACHINE_DS128X_H
diff --git a/src/devices/machine/ds1315.cpp b/src/devices/machine/ds1315.cpp
index 2a574dca399..6b37957f9eb 100644
--- a/src/devices/machine/ds1315.cpp
+++ b/src/devices/machine/ds1315.cpp
@@ -87,17 +87,17 @@ static const uint8_t ds1315_pattern[] =
***************************************************************************/
// automated read, does all the work the real Dallas chip does
-uint8_t ds1315_device::read(offs_t offset)
+READ8_MEMBER( ds1315_device::read )
{
if (m_mode == DS_SEEK_MATCHING)
{
if (offset & 1)
{
- read_1();
+ read_1(space, 0);
}
else
{
- read_0();
+ read_0(space, 0);
}
if (offset & 4)
@@ -110,7 +110,7 @@ uint8_t ds1315_device::read(offs_t offset)
}
else if (m_mode == DS_CALENDAR_IO)
{
- return read_data();
+ return read_data(space, offset);
}
return 0xff; // shouldn't happen, but compilers don't know that
@@ -121,7 +121,7 @@ uint8_t ds1315_device::read(offs_t offset)
read_0 (actual data)
-------------------------------------------------*/
-uint8_t ds1315_device::read_0()
+READ8_MEMBER( ds1315_device::read_0 )
{
if (ds1315_pattern[m_count++] == 0)
{
@@ -145,7 +145,7 @@ uint8_t ds1315_device::read_0()
read_1 (actual data)
-------------------------------------------------*/
-uint8_t ds1315_device::read_1()
+READ8_MEMBER( ds1315_device::read_1 )
{
if (ds1315_pattern[m_count++] == 1)
{
@@ -163,7 +163,7 @@ uint8_t ds1315_device::read_1()
read_data
-------------------------------------------------*/
-uint8_t ds1315_device::read_data()
+READ8_MEMBER( ds1315_device::read_data )
{
uint8_t result;
@@ -228,7 +228,7 @@ void ds1315_device::fill_raw_data()
write_data
-------------------------------------------------*/
-uint8_t ds1315_device::write_data(offs_t offset)
+READ8_MEMBER(ds1315_device::write_data)
{
static int write_count;
if (write_count >= 64)
diff --git a/src/devices/machine/ds1315.h b/src/devices/machine/ds1315.h
index 720c4a08202..a5b70c38c76 100644
--- a/src/devices/machine/ds1315.h
+++ b/src/devices/machine/ds1315.h
@@ -24,12 +24,12 @@ public:
auto read_backing() { return m_backing_read.bind(); }
// this handler automates the bits 0/2 stuff
- uint8_t read(offs_t offset);
+ DECLARE_READ8_MEMBER(read);
- uint8_t read_0();
- uint8_t read_1();
- uint8_t read_data();
- uint8_t write_data(offs_t offset);
+ DECLARE_READ8_MEMBER(read_0);
+ DECLARE_READ8_MEMBER(read_1);
+ DECLARE_READ8_MEMBER(read_data);
+ DECLARE_READ8_MEMBER(write_data);
bool chip_enable();
void chip_reset();
diff --git a/src/devices/machine/ds75160a.h b/src/devices/machine/ds75160a.h
index bdc03e9dc99..2f2a2147a5e 100644
--- a/src/devices/machine/ds75160a.h
+++ b/src/devices/machine/ds75160a.h
@@ -25,6 +25,18 @@
#pragma once
+
+
+///*************************************************************************
+// INTERFACE CONFIGURATION MACROS
+///*************************************************************************
+
+#define MCFG_DS75160A_ADD(_tag, _read, _write) \
+ MCFG_DEVICE_ADD(_tag, DS75160A, 0) \
+ downcast<ds75160a_device *>(device)->set_callbacks(DEVCB_##_read, DEVCB_##_write);
+
+
+
///*************************************************************************
// TYPE DEFINITIONS
///*************************************************************************
diff --git a/src/devices/machine/f3853.cpp b/src/devices/machine/f3853.cpp
index 45511f334ab..f4713f3fa3a 100644
--- a/src/devices/machine/f3853.cpp
+++ b/src/devices/machine/f3853.cpp
@@ -1,29 +1,19 @@
// license:BSD-3-Clause
-// copyright-holders:Wilbert Pol, hap
+// copyright-holders:Wilbert Pol
/**********************************************************************
-Fairchild F3853 SMI, F3851 PSU, F3856 PSU, F38T56 PSU
+ Fairchild F3853 SRAM interface with integrated interrupt
+ controller and timer (SMI)
-This device only emulates the I/O, interrupt, timer functions. Not the
-low-level ROMC signals.
+ This chip is a timer shift register, basically the same as in the
+ F3851.
-F3853: Static memory interface with integrated interrupt controller and timer.
+ Based on a datasheet obtained from www.freetradezone.com
-The timer is an 8-bit linear feedback shift register:
-Feedback in0 = !((out3 ^ out4) ^ (out5 ^ out7))
-Interrupts are at 0xfe
-0xff stops the register (0xfe is never reached)
-
-F3851: Program Storage Unit, same timer and interrupt controller as F3853,
-but has 2 I/O ports instead of a programmable interrupt vector.
-
-F3856/F38T56 Program Storage Unit: similar interrupt controller, timer
-is more versatile, a simple downcounter instead of shift register.
-
-TODO:
-- emulate at lower level and place this stuff into devices/cpu/f8 folder
-- interrupt priority pin
-- 3856/38T56 timer pulse counter mode, event counter mode
+ 8-bit shift register:
+ Feedback in0 = !((out3 ^ out4) ^ (out5 ^ out7))
+ Interrupts are at 0xfe
+ 0xff stops the register (0xfe is never reached)
**********************************************************************/
@@ -31,60 +21,31 @@ TODO:
#include "f3853.h"
-// device type definition
-
-DEFINE_DEVICE_TYPE(F3853, f3853_device, "f3853_smi", "Fairchild F3853 SMI")
-DEFINE_DEVICE_TYPE(F3851, f3851_device, "f3851_psu", "Fairchild F3851 PSU")
-DEFINE_DEVICE_TYPE(F3856, f3856_device, "f3856_psu", "Fairchild F3856 PSU")
-DEFINE_DEVICE_TYPE(F38T56, f38t56_device, "f38t56_psu", "Fairchild F38T56 PSU")
-
-
-//-------------------------------------------------
-// constructor
-//-------------------------------------------------
-
-f3853_device::f3853_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) :
- device_t(mconfig, type, tag, owner, clock),
- m_int_req_callback(*this),
- m_pri_out_callback(*this),
- m_int_vector(0),
- m_prescaler(31),
- m_priority_line(false),
- m_external_interrupt_line(true)
-{ }
-
-f3853_device::f3853_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- f3853_device(mconfig, F3853, tag, owner, clock)
-{ }
-
-f3851_device::f3851_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) :
- f3853_device(mconfig, type, tag, owner, clock),
- m_read_port{{*this}, {*this}},
- m_write_port{{*this}, {*this}}
-{ }
-
-f3851_device::f3851_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- f3851_device(mconfig, F3851, tag, owner, clock)
-{ }
-
-f3856_device::f3856_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) :
- f3851_device(mconfig, type, tag, owner, clock)
-{ }
-
-f3856_device::f3856_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- f3856_device(mconfig, F3856, tag, owner, clock)
-{ }
-f38t56_device::f38t56_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- f3856_device(mconfig, F38T56, tag, owner, clock)
-{ }
+/***************************************************************************
+ IMPLEMENTATION
+***************************************************************************/
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+// device type definition
+DEFINE_DEVICE_TYPE(F3853, f3853_device, "f3853_device", "F3853 SMI")
//-------------------------------------------------
-// initialisation
+// f3853_device - constructor
//-------------------------------------------------
+f3853_device::f3853_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, F3853, tag, owner, clock)
+ , m_int_req_callback(*this)
+ , m_pri_out_callback(*this)
+ , m_priority_line(false)
+ , m_external_interrupt_line(true)
+{
+}
+
void f3853_device::device_resolve_objects()
{
m_int_req_callback.resolve_safe();
@@ -92,20 +53,12 @@ void f3853_device::device_resolve_objects()
m_int_daisy_chain_callback.bind_relative_to(*owner());
}
-void f3851_device::device_resolve_objects()
-{
- f3853_device::device_resolve_objects();
-
- // 2 I/O ports
- for (devcb_read8 &cb : m_read_port)
- cb.resolve_safe(0);
- for (devcb_write8 &cb : m_write_port)
- cb.resolve_safe();
-}
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
void f3853_device::device_start()
{
- // lookup table for 3851/3853 lfsr timer
uint8_t reg = 0xfe; // Known to get 0xfe after 255 cycles
for(int i = reg; i >= 0; i--)
{
@@ -115,62 +68,47 @@ void f3853_device::device_start()
m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(f3853_device::timer_callback),this));
- // zerofill (what's not in constructor)
- m_external_int_enable = false;
- m_timer_int_enable = false;
- m_request_flipflop = false;
-
- // register for savestates
save_item(NAME(m_int_vector));
- save_item(NAME(m_prescaler));
- save_item(NAME(m_external_int_enable));
- save_item(NAME(m_timer_int_enable));
+ save_item(NAME(m_external_enable));
+ save_item(NAME(m_timer_enable));
save_item(NAME(m_request_flipflop));
save_item(NAME(m_priority_line));
save_item(NAME(m_external_interrupt_line));
}
-void f3856_device::device_start()
-{
- f3853_device::device_start();
- m_timer_count = 0;
- m_timer_modulo = 0;
- m_timer_start = false;
-
- save_item(NAME(m_timer_count));
- save_item(NAME(m_timer_modulo));
- save_item(NAME(m_timer_start));
-}
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
void f3853_device::device_reset()
{
- // note that standalone peripherals don't have a reset pin, but 3870 does
+ m_int_vector = 0;
+ m_external_enable = false;
+ m_timer_enable = false;
+ m_request_flipflop = false;
+ m_external_interrupt_line = true;
+ set_interrupt_request_line();
- // clear ports at power-on
- for (int i = 0; i < 4; i++)
- write(machine().dummy_space(), i, 0);
+ m_timer->enable(false);
}
-//-------------------------------------------------
-// implementation
-//-------------------------------------------------
-
void f3853_device::set_interrupt_request_line()
{
m_int_req_callback(m_request_flipflop && !m_priority_line ? ASSERT_LINE : CLEAR_LINE);
}
+
IRQ_CALLBACK_MEMBER(f3853_device::int_acknowledge)
{
- if (m_external_int_enable && !m_priority_line && m_request_flipflop)
+ if (m_external_enable && !m_priority_line && m_request_flipflop)
{
m_request_flipflop = false;
set_interrupt_request_line();
return external_interrupt_vector();
}
- else if (m_timer_int_enable && !m_priority_line && m_request_flipflop)
+ else if (m_timer_enable && !m_priority_line && m_request_flipflop)
{
m_request_flipflop = false;
set_interrupt_request_line();
@@ -189,14 +127,14 @@ IRQ_CALLBACK_MEMBER(f3853_device::int_acknowledge)
void f3853_device::timer_start(uint8_t value)
{
- attotime period = (value != 0xff) ? attotime::from_hz(clock()) * (m_value_to_cycle[value] * m_prescaler) : attotime::never;
+ attotime period = (value != 0xff) ? attotime::from_hz(clock()) * (m_value_to_cycle[value]*31) : attotime::never;
m_timer->adjust(period);
}
TIMER_CALLBACK_MEMBER(f3853_device::timer_callback)
{
- if(m_timer_int_enable)
+ if(m_timer_enable)
{
m_request_flipflop = true;
set_interrupt_request_line();
@@ -204,10 +142,9 @@ TIMER_CALLBACK_MEMBER(f3853_device::timer_callback)
timer_start(0xfe);
}
-
WRITE_LINE_MEMBER(f3853_device::ext_int_w)
{
- if(m_external_interrupt_line && !state && m_external_int_enable)
+ if(m_external_interrupt_line && !state && m_external_enable)
{
m_request_flipflop = true;
}
@@ -224,201 +161,49 @@ WRITE_LINE_MEMBER(f3853_device::pri_in_w)
READ8_MEMBER(f3853_device::read)
{
- switch (offset & 3)
+ uint8_t data = 0;
+
+ switch (offset)
{
- // interrupt vector
case 0:
- return m_int_vector >> 8;
+ data = m_int_vector >> 8;
+ break;
+
case 1:
- return m_int_vector & 0xff;
+ data = m_int_vector & 0xff;
+ break;
- // interrupt control, timer: write-only
- default:
- return 0;
+ case 2: // Interrupt control; not readable
+ case 3: // Timer; not readable
+ break;
}
+
+ return data;
}
+
WRITE8_MEMBER(f3853_device::write)
{
- switch (offset & 3)
+ switch(offset)
{
- // interrupt vector
case 0:
m_int_vector = (data << 8) | (m_int_vector & 0x00ff);
break;
+
case 1:
m_int_vector = data | (m_int_vector & 0xff00);
break;
- // interrupt control
- case 2:
- m_external_int_enable = (data & 3) == 1;
- m_timer_int_enable = (data & 3) == 3;
+ case 2: //interrupt control
+ m_external_enable = ((data & 3) == 1);
+ m_timer_enable = ((data & 3) == 3);
set_interrupt_request_line();
break;
- // set timer
- case 3:
+ case 3: //timer
m_request_flipflop = false;
set_interrupt_request_line();
timer_start(data);
break;
}
}
-
-
-//-------------------------------------------------
-// f3851_device-specific handlers
-//-------------------------------------------------
-
-READ8_MEMBER(f3851_device::read)
-{
- switch (offset & 3)
- {
- // I/O ports
- case 0: case 1:
- return (m_read_port[offset & 1])(offs_t(offset & 1));
-
- // interrupt control, timer: write-only
- default:
- return 0;
- }
-}
-
-WRITE8_MEMBER(f3851_device::write)
-{
- switch (offset & 3)
- {
- // I/O ports
- case 0: case 1:
- (m_write_port[offset & 1])(offs_t(offset & 1), data);
- break;
-
- // interrupt control, timer: same as 3853
- case 2: case 3:
- f3853_device::write(space, offset, data);
- break;
- }
-}
-
-
-//-------------------------------------------------
-// f3856_device-specific handlers
-//-------------------------------------------------
-
-void f3856_device::timer_start(uint8_t value)
-{
- m_timer_count = value;
- attotime period = (m_timer_start) ? (attotime::from_hz(clock()) * m_prescaler) : attotime::never;
-
- m_timer->adjust(period);
-}
-
-TIMER_CALLBACK_MEMBER(f3856_device::timer_callback)
-{
- if (--m_timer_count == 0)
- {
- m_timer_count = m_timer_modulo;
- if (m_timer_int_enable)
- {
- m_request_flipflop = true;
- set_interrupt_request_line();
- }
- }
-
- timer_start(m_timer_count);
-}
-
-READ8_MEMBER(f3856_device::read)
-{
- switch (offset & 3)
- {
- // timer: active counter
- case 3:
- return m_timer_count;
-
- // other: same as 3851
- default:
- return f3851_device::read(space, offset);
- }
-}
-
-WRITE8_MEMBER(f3856_device::write)
-{
- switch (offset & 3)
- {
- // I/O ports: same as 3851
- case 0: case 1:
- f3851_device::write(space, offset, data);
- break;
-
- // interrupt/timer control
- case 2:
- {
- // timer prescaler
- static const u8 prescaler[8] = { 32, 128, 8, 2 };
- m_prescaler = prescaler[data >> 5 & 7];
-
- // start/stop timer
- bool prev = m_timer_start;
- m_timer_start = bool(~data & 0x10);
- if (m_timer_start != prev)
- timer_start(m_timer_count);
-
- // enable interrupts
- m_external_int_enable = (data & 3) == 1 || (data & 3) == 2;
- m_timer_int_enable = bool(data & 2);
- set_interrupt_request_line();
- break;
- }
-
- // set timer
- case 3:
- f3853_device::write(space, offset, data);
- break;
- }
-}
-
-
-//-------------------------------------------------
-// f38t56_device-specific handlers
-//-------------------------------------------------
-
-WRITE8_MEMBER(f38t56_device::write)
-{
- switch (offset & 3)
- {
- // I/O ports: same as 3851
- case 0: case 1:
- f3851_device::write(space, offset, data);
- break;
-
- // interrupt/timer control
- case 2:
- {
- // timer prescaler
- m_prescaler = 200;
- if (~data & 0x80) m_prescaler /= 20;
- if (~data & 0x40) m_prescaler /= 5;
- if (~data & 0x20) m_prescaler /= 2;
-
- // start/stop timer
- bool prev = m_timer_start;
- m_timer_start = bool(data & 8);
- if (m_timer_start != prev)
- timer_start(m_timer_count);
-
- // enable interrupts
- m_external_int_enable = bool(data & 1);
- m_timer_int_enable = bool(data & 2);
- set_interrupt_request_line();
- break;
- }
-
- // set timer
- case 3:
- m_timer_modulo = data;
- f3853_device::write(space, offset, data);
- break;
- }
-}
diff --git a/src/devices/machine/f3853.h b/src/devices/machine/f3853.h
index 762f46950fb..14c922871b1 100644
--- a/src/devices/machine/f3853.h
+++ b/src/devices/machine/f3853.h
@@ -1,67 +1,49 @@
// license:BSD-3-Clause
-// copyright-holders:Wilbert Pol, hap
-/*
-
- Fairchild F3853 SMI, F3851 PSU, F3856 PSU, F38T56 PSU
-
-*/
+// copyright-holders:Wilbert Pol
+/***************************************************************************
+
+ Fairchild F3853 SRAM interface with integrated interrupt
+ controller and timer
+
+ This chip is a timer shift register, basically the same as in the
+ F3851.
+
+****************************************************************************
+ _____ _____
+ Vgg 1 |* \_/ | 40 Vdd
+ PHI 2 | | 39 ROMC4
+ WRITE 3 | | 38 ROMC3
+ _INT REQ 4 | | 37 ROMC2
+ _PRI IN 5 | | 36 ROMC1
+ _RAM WRITE 6 | | 35 ROMC0
+ _EXT INT 7 | | 34 CPU READ
+ ADDR7 8 | | 33 REG DR
+ ADDR6 9 | | 32 ADDR15
+ ADDR5 10 | F3853 | 31 ADDR14
+ ADDR4 11 | | 30 ADDR13
+ ADDR3 12 | | 29 ADDR12
+ ADDR2 13 | | 28 ADDR11
+ ADDR1 14 | | 27 ADDR10
+ ADDR0 15 | | 26 ADDR9
+ DB0 16 | | 25 ADDR8
+ DB1 17 | | 24 DB7
+ DB2 18 | | 23 DB6
+ DB3 19 | | 22 DB5
+ Vss 20 |_____________| 21 DB4
+
+***************************************************************************/
#ifndef MAME_MACHINE_F3853_H
#define MAME_MACHINE_F3853_H
#pragma once
-// pinout reference
-
-/*
- _____ _____
- Vgg 1 |* \_/ | 40 Vdd
- PHI 2 | | 39 ROMC4
- WRITE 3 | | 38 ROMC3
- _INT REQ 4 | | 37 ROMC2
- _PRI IN 5 | | 36 ROMC1
- _RAM WRITE 6 | | 35 ROMC0
- _EXT INT 7 | | 34 CPU READ
- ADDR7 8 | | 33 REG DR
- ADDR6 9 | | 32 ADDR15
- ADDR5 10 | F3853 | 31 ADDR14
- ADDR4 11 | | 30 ADDR13
- ADDR3 12 | | 29 ADDR12
- ADDR2 13 | | 28 ADDR11
- ADDR1 14 | | 27 ADDR10
- ADDR0 15 | | 26 ADDR9
- DB0 16 | | 25 ADDR8
- DB1 17 | | 24 DB7
- DB2 18 | | 23 DB6
- DB3 19 | | 22 DB5
- Vss 20 |_____________| 21 DB4
-
- _____ _____
- _I/O B7 1 |* \_/ | 40 DB7
- _I/O A7 2 | | 39 DB6
- Vgg 3 | | 38 _I/O B6
- Vdd 4 | | 37 _I/O A6
- _EXT INT 5 | | 36 _I/O A5
- _PRI OUT 6 | | 35 _I/O B5
- WRITE 7 | | 34 DB5
- PHI 8 | | 33 DB4
- _INT REQ 9 | F3851 | 32 _I/O B4
- _PRI IN 10 | F3856 | 31 _I/O A4
- _DBDR 11 | F38T56 | 30 _I/O A3
- STROBE 12 | | 29 _I/O B3
- ROMC4 13 | | 28 DB3
- ROMC3 14 | | 27 DB2
- ROMC2 15 | | 26 _I/O B2
- ROMC1 16 | | 25 _I/O A2
- ROMC0 17 | | 24 _I/O A1
- Vss 18 | | 23 _I/O B1
- _I/O A0 19 | | 22 DB1
- _I/O B0 20 |_____________| 21 DB0
-
- F38T56 is internal in F3870
- note: STROBE is N/C on F3851
-*/
+/***************************************************************************
+ TYPE DEFINITIONS
+***************************************************************************/
+
+// ======================> f3853_device
class f3853_device : public device_t
{
@@ -73,38 +55,36 @@ public:
auto pri_out_callback() { return m_pri_out_callback.bind(); }
template<typename Object> void set_int_daisy_chain_callback(Object &&cb) { m_int_daisy_chain_callback = std::forward<Object>(cb); }
- virtual DECLARE_READ8_MEMBER(read);
- virtual DECLARE_WRITE8_MEMBER(write);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
DECLARE_WRITE_LINE_MEMBER(ext_int_w);
DECLARE_WRITE_LINE_MEMBER(pri_in_w);
- virtual TIMER_CALLBACK_MEMBER(timer_callback);
+ TIMER_CALLBACK_MEMBER(timer_callback);
IRQ_CALLBACK_MEMBER(int_acknowledge);
protected:
- f3853_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
// device-level overrides
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
+private:
uint16_t timer_interrupt_vector() const { return m_int_vector & ~uint16_t(0x0080); }
uint16_t external_interrupt_vector() const { return m_int_vector | uint16_t(0x0080); }
void set_interrupt_request_line();
- virtual void timer_start(uint8_t value);
+ void timer_start(uint8_t value);
devcb_write_line m_int_req_callback;
devcb_write_line m_pri_out_callback;
device_irq_acknowledge_delegate m_int_daisy_chain_callback;
uint16_t m_int_vector; // Bit 7 is set to 0 for timer interrupts, 1 for external interrupts
- u8 m_prescaler;
- bool m_external_int_enable;
- bool m_timer_int_enable;
+ bool m_external_enable;
+ bool m_timer_enable;
bool m_request_flipflop;
@@ -116,66 +96,8 @@ protected:
uint8_t m_value_to_cycle[0x100];
};
-class f3851_device : public f3853_device
-{
-public:
- f3851_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- // interrupt vector is a mask option on 3851 and 3856
- void set_int_vector(u16 vector) { m_int_vector = vector; }
-
- // bidirectional I/O ports A and B
- auto read_a() { return m_read_port[0].bind(); }
- auto read_b() { return m_read_port[1].bind(); }
- auto write_a() { return m_write_port[0].bind(); }
- auto write_b() { return m_write_port[1].bind(); }
-
- virtual DECLARE_READ8_MEMBER(read) override;
- virtual DECLARE_WRITE8_MEMBER(write) override;
-
-protected:
- f3851_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
- virtual void device_resolve_objects() override;
-
- devcb_read8 m_read_port[2];
- devcb_write8 m_write_port[2];
-};
-
-class f3856_device : public f3851_device
-{
-public:
- f3856_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- virtual DECLARE_READ8_MEMBER(read) override;
- virtual DECLARE_WRITE8_MEMBER(write) override;
-
- virtual TIMER_CALLBACK_MEMBER(timer_callback) override;
-
-protected:
- f3856_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
- virtual void device_start() override;
-
- virtual void timer_start(uint8_t value) override;
-
- u8 m_timer_count;
- u8 m_timer_modulo;
- bool m_timer_start;
-};
-
-class f38t56_device : public f3856_device
-{
-public:
- f38t56_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- virtual DECLARE_WRITE8_MEMBER(write) override;
-};
// device type definition
DECLARE_DEVICE_TYPE(F3853, f3853_device)
-DECLARE_DEVICE_TYPE(F3851, f3851_device)
-DECLARE_DEVICE_TYPE(F3856, f3856_device)
-DECLARE_DEVICE_TYPE(F38T56, f38t56_device)
#endif // MAME_MACHINE_F3853_H
diff --git a/src/devices/machine/fdc37c665gt.cpp b/src/devices/machine/fdc37c665gt.cpp
index f2df880d2e8..4c6f23651db 100644
--- a/src/devices/machine/fdc37c665gt.cpp
+++ b/src/devices/machine/fdc37c665gt.cpp
@@ -49,10 +49,9 @@ void fdc37c665gt_device::device_start()
{
}
-void fdc37c665gt_device::device_add_mconfig(machine_config &config)
-{
- NS16550(config, m_uart1, XTAL(24'000'000)/13);
- NS16550(config, m_uart2, XTAL(24'000'000)/13);
-}
+MACHINE_CONFIG_START(fdc37c665gt_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("uart1", NS16550, XTAL(24'000'000)/13)
+ MCFG_DEVICE_ADD("uart2", NS16550, XTAL(24'000'000)/13)
+MACHINE_CONFIG_END
DEFINE_DEVICE_TYPE(FDC37C665GT, fdc37c665gt_device, "fdc37c665gt", "FDC37C665GT")
diff --git a/src/devices/machine/fdc37c93x.cpp b/src/devices/machine/fdc37c93x.cpp
index 8ff5afc76d4..05c87fd38ef 100644
--- a/src/devices/machine/fdc37c93x.cpp
+++ b/src/devices/machine/fdc37c93x.cpp
@@ -639,12 +639,12 @@ void fdc37c93x_device::map_rtc(address_map &map)
READ8_MEMBER(fdc37c93x_device::rtc_read)
{
- return ds12885_rtcdev->read(offset);
+ return ds12885_rtcdev->read(space, offset, mem_mask);
}
WRITE8_MEMBER(fdc37c93x_device::rtc_write)
{
- ds12885_rtcdev->write(offset, data);
+ ds12885_rtcdev->write(space, offset, data, mem_mask);
}
void fdc37c93x_device::map_rtc_addresses()
diff --git a/src/devices/machine/gen_fifo.h b/src/devices/machine/gen_fifo.h
index 0ef98fb20c3..4db8a75d8c1 100644
--- a/src/devices/machine/gen_fifo.h
+++ b/src/devices/machine/gen_fifo.h
@@ -72,6 +72,13 @@
*/
+#define MCFG_GENERIC_FIFO_EMPTY_CALLBACK(_devcb) \
+ downcast<screen_device &>(*device).set_empty_cb(DEVCB_##_devcb);
+
+#define MCFG_GENERIC_FIFO_FULL_CALLBACK(_devcb) \
+ downcast<screen_device &>(*device).set_full_cb(DEVCB_##_devcb);
+
+
template<typename T> class generic_fifo_device_base : public device_t {
public:
/* The general setup. Call be called multiple times, clears the fifo. */
@@ -111,8 +118,8 @@ public:
void clear();
/* Callbacks signalling empty (true)/nonempty (false) and full (true)/nonfull (false) */
- auto empty_cb() { return m_empty_cb.bind(); }
- auto full_cb() { return m_full_cb.bind(); }
+ template<class Object> devcb_base &set_empty_cb(Object &&object) { return m_empty_cb.set_callback(std::forward<Object>(object)); }
+ template<class Object> devcb_base &set_full_cb(Object &&object) { return m_full_cb.set_callback(std::forward<Object>(object)); }
/* Get the fifo current size - Note that real hardware usually
can't do that. May be bigger that the fifo size if some extra
diff --git a/src/devices/machine/genpc.cpp b/src/devices/machine/genpc.cpp
index e626bf96b30..269c1915bb0 100644
--- a/src/devices/machine/genpc.cpp
+++ b/src/devices/machine/genpc.cpp
@@ -135,8 +135,6 @@ WRITE_LINE_MEMBER( ibm5160_mb_device::pc_dma8237_out_eop )
void ibm5160_mb_device::pc_select_dma_channel(int channel, bool state)
{
- m_isabus->dack_line_w(channel, state);
-
if(!state) {
m_dma_channel = channel;
if(m_cur_eop)
@@ -395,16 +393,8 @@ WRITE8_MEMBER( ibm5160_mb_device::pc_ppi_portb_w )
WRITE8_MEMBER( ibm5160_mb_device::nmi_enable_w )
{
m_nmi_enabled = BIT(data,7);
- if (!m_nmi_enabled)
- m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
-}
-
-WRITE_LINE_MEMBER( ibm5160_mb_device::iochck_w )
-{
- if (m_nmi_enabled && !state)
- m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
+ m_isabus->set_nmi_state(m_nmi_enabled);
}
-
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
@@ -420,9 +410,8 @@ DEFINE_DEVICE_TYPE(IBM5160_MOTHERBOARD, ibm5160_mb_device, "ibm5160_mb", "IBM 51
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void ibm5160_mb_device::device_add_mconfig(machine_config &config)
-{
- PIT8253(config, m_pit8253);
+MACHINE_CONFIG_START(ibm5160_mb_device::device_add_mconfig)
+ PIT8253(config, m_pit8253, 0);
m_pit8253->set_clk<0>(XTAL(14'318'181)/12.0); // heartbeat IRQ
m_pit8253->out_handler<0>().set(m_pic8259, FUNC(pic8259_device::ir0_w));
m_pit8253->set_clk<1>(XTAL(14'318'181)/12.0); // DRAM refresh
@@ -447,7 +436,7 @@ void ibm5160_mb_device::device_add_mconfig(machine_config &config)
m_dma8237->out_dack_callback<2>().set(FUNC(ibm5160_mb_device::pc_dack2_w));
m_dma8237->out_dack_callback<3>().set(FUNC(ibm5160_mb_device::pc_dack3_w));
- PIC8259(config, m_pic8259);
+ PIC8259(config, m_pic8259, 0);
m_pic8259->out_int_callback().set(FUNC(ibm5160_mb_device::pic_int_w));
I8255A(config, m_ppi8255, 0);
@@ -456,8 +445,7 @@ void ibm5160_mb_device::device_add_mconfig(machine_config &config)
m_ppi8255->in_pc_callback().set(FUNC(ibm5160_mb_device::pc_ppi_portc_r));
ISA8(config, m_isabus, 0);
- m_isabus->set_memspace(":maincpu", AS_PROGRAM);
- m_isabus->set_iospace(":maincpu", AS_IO);
+ m_isabus->set_cputag(":maincpu");
m_isabus->irq2_callback().set(m_pic8259, FUNC(pic8259_device::ir2_w));
m_isabus->irq3_callback().set(m_pic8259, FUNC(pic8259_device::ir3_w));
m_isabus->irq4_callback().set(m_pic8259, FUNC(pic8259_device::ir4_w));
@@ -467,16 +455,15 @@ void ibm5160_mb_device::device_add_mconfig(machine_config &config)
m_isabus->drq1_callback().set(m_dma8237, FUNC(am9517a_device::dreq1_w));
m_isabus->drq2_callback().set(m_dma8237, FUNC(am9517a_device::dreq2_w));
m_isabus->drq3_callback().set(m_dma8237, FUNC(am9517a_device::dreq3_w));
- m_isabus->iochck_callback().set(FUNC(ibm5160_mb_device::iochck_w));
- PC_KBDC(config, m_pc_kbdc, 0);
- m_pc_kbdc->out_clock_cb().set(FUNC(ibm5160_mb_device::keyboard_clock_w));
- m_pc_kbdc->out_data_cb().set(FUNC(ibm5160_mb_device::keyboard_data_w));
+ MCFG_DEVICE_ADD("pc_kbdc", PC_KBDC, 0)
+ MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(*this, ibm5160_mb_device, keyboard_clock_w))
+ MCFG_PC_KBDC_OUT_DATA_CB(WRITELINE(*this, ibm5160_mb_device, keyboard_data_w))
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 1.00);
-}
+MACHINE_CONFIG_END
static INPUT_PORTS_START( ibm5160_mb )
@@ -608,18 +595,18 @@ DEFINE_DEVICE_TYPE(IBM5150_MOTHERBOARD, ibm5150_mb_device, "ibm5150_mb", "IBM 51
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void ibm5150_mb_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(ibm5150_mb_device::device_add_mconfig)
ibm5160_mb_device::device_add_mconfig(config);
- subdevice<pc_kbdc_device>("pc_kbdc")->out_clock_cb().set(FUNC(ibm5150_mb_device::keyboard_clock_w));
+ MCFG_DEVICE_MODIFY("pc_kbdc")
+ MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(*this, ibm5150_mb_device, keyboard_clock_w))
m_ppi8255->out_pb_callback().set(FUNC(ibm5150_mb_device::pc_ppi_portb_w));
m_ppi8255->in_pc_callback().set(FUNC(ibm5150_mb_device::pc_ppi_portc_r));
- CASSETTE(config, m_cassette);
- m_cassette->set_default_state(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED);
-}
+ MCFG_CASSETTE_ADD( "cassette" )
+ MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
@@ -785,15 +772,15 @@ DEFINE_DEVICE_TYPE(EC1841_MOTHERBOARD, ec1841_mb_device, "ec1841_mb", "EC-1840 m
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void ec1841_mb_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(ec1841_mb_device::device_add_mconfig)
ibm5160_mb_device::device_add_mconfig(config);
m_ppi8255->out_pb_callback().set(FUNC(ec1841_mb_device::pc_ppi_portb_w));
m_ppi8255->in_pc_callback().set(FUNC(ec1841_mb_device::pc_ppi_portc_r));
- subdevice<pc_kbdc_device>("pc_kbdc")->out_clock_cb().set(FUNC(ec1841_mb_device::keyboard_clock_w));
-}
+ MCFG_DEVICE_MODIFY("pc_kbdc")
+ MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(*this, ec1841_mb_device, keyboard_clock_w))
+MACHINE_CONFIG_END
static INPUT_PORTS_START( ec1841_mb )
PORT_START("DSW0") /* SA1 */
@@ -911,13 +898,12 @@ pc_noppi_mb_device::pc_noppi_mb_device(const machine_config &mconfig, device_typ
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void pc_noppi_mb_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(pc_noppi_mb_device::device_add_mconfig)
ibm5160_mb_device::device_add_mconfig(config);
- config.device_remove("pc_kbdc");
- config.device_remove("ppi8255");
-}
+ MCFG_DEVICE_REMOVE("pc_kbdc")
+ MCFG_DEVICE_REMOVE("ppi8255")
+MACHINE_CONFIG_END
static INPUT_PORTS_START( pc_noppi_mb )
INPUT_PORTS_END
diff --git a/src/devices/machine/genpc.h b/src/devices/machine/genpc.h
index e222b975873..4c412a9a720 100644
--- a/src/devices/machine/genpc.h
+++ b/src/devices/machine/genpc.h
@@ -23,6 +23,11 @@
#include "bus/pc_kbd/pc_kbdc.h"
+#define MCFG_IBM5160_MOTHERBOARD_ADD(_tag, _cputag) \
+ MCFG_DEVICE_ADD(_tag, IBM5160_MOTHERBOARD, 0) \
+ downcast<ibm5160_mb_device &>(*device).set_cputag(_cputag); \
+ (*device->subdevice<isa8_device>("isa")).set_cputag(_cputag);
+
// ======================> ibm5160_mb_device
class ibm5160_mb_device : public device_t
{
@@ -31,12 +36,7 @@ public:
ibm5160_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration
- template <typename T> void set_cputag(T &&tag)
- {
- m_maincpu.set_tag(std::forward<T>(tag));
- subdevice<isa8_device>("isa")->set_memspace(std::forward<T>(tag), AS_PROGRAM);
- subdevice<isa8_device>("isa")->set_iospace(std::forward<T>(tag), AS_IO);
- }
+ void set_cputag(const char *tag) { m_maincpu.set_tag(tag); }
void map(address_map &map);
@@ -119,7 +119,6 @@ protected:
DECLARE_WRITE_LINE_MEMBER( pc_dack1_w );
DECLARE_WRITE_LINE_MEMBER( pc_dack2_w );
DECLARE_WRITE_LINE_MEMBER( pc_dack3_w );
- DECLARE_WRITE_LINE_MEMBER( iochck_w );
void pc_select_dma_channel(int channel, bool state);
};
@@ -129,6 +128,11 @@ protected:
DECLARE_DEVICE_TYPE(IBM5160_MOTHERBOARD, ibm5160_mb_device)
+#define MCFG_IBM5150_MOTHERBOARD_ADD(_tag, _cputag) \
+ MCFG_DEVICE_ADD(_tag, IBM5150_MOTHERBOARD, 0) \
+ downcast<ibm5150_mb_device &>(*device).set_cputag(_cputag); \
+ (*device->subdevice<isa8_device>("isa")).set_cputag(_cputag);
+
// ======================> ibm5150_mb_device
class ibm5150_mb_device : public ibm5160_mb_device
{
@@ -158,6 +162,12 @@ private:
// device type definition
DECLARE_DEVICE_TYPE(IBM5150_MOTHERBOARD, ibm5150_mb_device)
+
+#define MCFG_EC1841_MOTHERBOARD_ADD(_tag, _cputag) \
+ MCFG_DEVICE_ADD(_tag, EC1841_MOTHERBOARD, 0) \
+ downcast<ec1841_mb_device &>(*device).set_cputag(_cputag); \
+ (*device->subdevice<isa8_device>("isa")).set_cputag(_cputag);
+
class ec1841_mb_device : public ibm5160_mb_device
{
public:
@@ -179,13 +189,16 @@ private:
DECLARE_DEVICE_TYPE(EC1841_MOTHERBOARD, ec1841_mb_device)
+#define MCFG_PCNOPPI_MOTHERBOARD_ADD(_tag, _cputag) \
+ MCFG_DEVICE_ADD(_tag, PCNOPPI_MOTHERBOARD, 0) \
+ downcast<pc_noppi_mb_device &>(*device).set_cputag(_cputag); \
+ (*device->subdevice<isa8_device>("isa")).set_cputag(_cputag);
class pc_noppi_mb_device : public ibm5160_mb_device
{
public:
// construction/destruction
pc_noppi_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
uint8_t pit_out2() { return m_pit_out2; } // helper for near-clones with multifunction ics instead of 8255s
void map(address_map &map);
diff --git a/src/devices/machine/hdc92x4.cpp b/src/devices/machine/hdc92x4.cpp
index 4354711738f..e7c42d31452 100644
--- a/src/devices/machine/hdc92x4.cpp
+++ b/src/devices/machine/hdc92x4.cpp
@@ -4265,7 +4265,7 @@ uint16_t hdc92x4_device::encode_a1_hd()
Read a byte of data from the controller
The address (offset) encodes the C/D* line (command and /data)
*/
-uint8_t hdc92x4_device::read(offs_t offset)
+READ8_MEMBER( hdc92x4_device::read )
{
uint8_t reply;
if ((offset & 1) == 0)
@@ -4300,7 +4300,7 @@ uint8_t hdc92x4_device::read(offs_t offset)
The operation terminates immediately, and the controller picks up the
values stored in this phase at a later time.
*/
-void hdc92x4_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( hdc92x4_device::write )
{
if ((offset & 1) == 0)
{
diff --git a/src/devices/machine/hdc92x4.h b/src/devices/machine/hdc92x4.h
index c4850ffa103..e0c25d1a524 100644
--- a/src/devices/machine/hdc92x4.h
+++ b/src/devices/machine/hdc92x4.h
@@ -45,8 +45,8 @@ public:
};
// Accessors from the CPU side
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( reset );
DECLARE_WRITE_LINE_MEMBER( dmaack );
diff --git a/src/devices/machine/i2cmem.cpp b/src/devices/machine/i2cmem.cpp
index 34e75569a49..94670ff5326 100644
--- a/src/devices/machine/i2cmem.cpp
+++ b/src/devices/machine/i2cmem.cpp
@@ -58,14 +58,8 @@ static inline void ATTR_PRINTF( 3, 4 ) verboselog( device_t *device, int n_level
//**************************************************************************
// device type definition
-DEFINE_DEVICE_TYPE(I2CMEM, i2cmem_device, "i2cmem", "I2C Memory")
-DEFINE_DEVICE_TYPE(I2C_X2404P, i2c_x2404p_device, "x2404p", "X2404P I2C Memory")
-DEFINE_DEVICE_TYPE(I2C_24C01, i2c_24c01_device, "24c01", "24C01 I2C Memory")
-DEFINE_DEVICE_TYPE(I2C_24C02, i2c_24c02_device, "24c02", "24C02 I2C Memory")
-DEFINE_DEVICE_TYPE(I2C_24C08, i2c_24c08_device, "24c08", "24C08 I2C Memory")
-DEFINE_DEVICE_TYPE(I2C_24C16, i2c_24c16_device, "24c16", "24C16 I2C Memory")
-DEFINE_DEVICE_TYPE(I2C_24C16A, i2c_24c16a_device, "24c16a", "24C16A I2C Memory")
-DEFINE_DEVICE_TYPE(I2C_24C64, i2c_24c64_device, "24c64", "24C64 I2C Memory")
+DEFINE_DEVICE_TYPE(I2CMEM, i2cmem_device, "i2cmem", "I2C Memory")
+DEFINE_DEVICE_TYPE(X2404P, x2404p_device, "x2404p", "X2404P I2C Memory")
//**************************************************************************
// LIVE DEVICE
@@ -75,76 +69,36 @@ DEFINE_DEVICE_TYPE(I2C_24C64, i2c_24c64_device, "24c64", "24C64 I2C Memory")
// i2cmem_device - constructor
//-------------------------------------------------
-i2cmem_device::i2cmem_device(
- const machine_config &mconfig,
- device_type type,
- const char *tag,
- device_t *owner,
- uint32_t clock,
- int page_size,
- int data_size) :
- device_t(mconfig, type, tag, owner, clock),
+i2cmem_device::i2cmem_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_nvram_interface(mconfig, *this),
m_region(*this, DEVICE_SELF),
- m_slave_address(I2CMEM_SLAVE_ADDRESS),
- m_page_size(page_size),
- m_data_size(data_size),
- m_scl(0),
- m_sdaw(0),
- m_e0(0),
- m_e1(0),
- m_e2(0),
- m_wc(0),
- m_sdar(1),
- m_state(STATE_IDLE),
- m_shift(0),
- m_byteaddr(0),
- m_page_offset(0),
- m_page_written_size(0),
- m_in_write(false)
+ m_slave_address( I2CMEM_SLAVE_ADDRESS ),
+ m_page_size( 0 ),
+ m_data_size( 0 ),
+ m_scl( 0 ),
+ m_sdaw( 0 ),
+ m_e0( 0 ),
+ m_e1( 0 ),
+ m_e2( 0 ),
+ m_wc( 0 ),
+ m_sdar( 1 ),
+ m_state( STATE_IDLE ),
+ m_shift( 0 ),
+ m_byteaddr( 0 )
{
- // these memories work off the I2C clock only
- assert(!clock);
}
-i2cmem_device::i2cmem_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2CMEM, tag, owner, clock, 0, 0)
+i2cmem_device::i2cmem_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : i2cmem_device(mconfig, I2CMEM, tag, owner, clock)
{
}
-i2c_x2404p_device::i2c_x2404p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_X2404P, tag, owner, clock, 8, 0x200)
-{
-}
-
-i2c_24c01_device::i2c_24c01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_24C01, tag, owner, clock, 4, 0x80)
-{
-}
-
-i2c_24c02_device::i2c_24c02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_24C02, tag, owner, clock, 4, 0x100)
-{
-}
-
-i2c_24c08_device::i2c_24c08_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_24C08, tag, owner, clock, 0, 0x400)
-{
-}
-
-i2c_24c16_device::i2c_24c16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_24C16, tag, owner, clock, 8, 0x800)
-{
-}
-
-i2c_24c16a_device::i2c_24c16a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_24C16A, tag, owner, clock, 0, 0x800)
-{
-}
-
-i2c_24c64_device::i2c_24c64_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_24C64, tag, owner, clock, 8, 0x2000)
+x2404p_device::x2404p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : i2cmem_device(mconfig, X2404P, tag, owner, clock)
{
+ set_page_size(8);
+ set_data_size(0x200);
}
//-------------------------------------------------
@@ -168,9 +122,6 @@ void i2cmem_device::device_start()
save_item( NAME(m_shift) );
save_item( NAME(m_devsel) );
save_item( NAME(m_byteaddr) );
- save_item( NAME(m_in_write) );
- save_item( NAME(m_page_offset) );
- save_item( NAME(m_page_written_size) );
save_pointer( &m_data[0], "m_data", m_data_size );
if ( m_page_size > 0 )
{
@@ -185,7 +136,6 @@ void i2cmem_device::device_start()
void i2cmem_device::device_reset()
{
- m_in_write = false;
}
@@ -287,15 +237,6 @@ WRITE_LINE_MEMBER( i2cmem_device::write_sda )
{
if( m_sdaw )
{
- if( m_in_write )
- {
- int base = data_offset();
- int root = base & ~( m_page_size - 1);
- for( int i=0; i < m_page_written_size; i++)
- m_data[root | ((base + i) & (m_page_size - 1))] = m_page[i];
- m_in_write = false;
- verboselog( this, 1, "data[ %04x to %04x ] = %x bytes\n", base, root | ((base + m_page_written_size - 1) & (m_page_size - 1)), m_page_written_size );
- }
verboselog( this, 1, "stop\n" );
m_state = STATE_IDLE;
}
@@ -360,7 +301,6 @@ WRITE_LINE_MEMBER( i2cmem_device::write_scl )
case STATE_BYTEADDR:
m_byteaddr = m_shift;
m_page_offset = 0;
- m_page_written_size = 0;
verboselog( this, 1, "byteaddr %02x\n", m_byteaddr );
@@ -375,16 +315,23 @@ WRITE_LINE_MEMBER( i2cmem_device::write_scl )
}
else if( m_page_size > 0 )
{
- m_in_write = true;
m_page[ m_page_offset ] = m_shift;
verboselog( this, 1, "page[ %04x ] <- %02x\n", m_page_offset, m_page[ m_page_offset ] );
m_page_offset++;
if( m_page_offset == m_page_size )
+ {
+ int offset = data_offset() & ~( m_page_size - 1 );
+
+ verboselog( this, 1, "data[ %04x to %04x ] = page\n", offset, offset + m_page_size - 1 );
+
+ for( int i = 0; i < m_page_size; i++ )
+ {
+ m_data[offset + i] = m_page[ i ];
+ }
+
m_page_offset = 0;
- m_page_written_size++;
- if( m_page_written_size > m_page_size)
- m_page_written_size = m_page_size;
+ }
}
else
{
diff --git a/src/devices/machine/i2cmem.h b/src/devices/machine/i2cmem.h
index c912709871d..d67fa463c2e 100644
--- a/src/devices/machine/i2cmem.h
+++ b/src/devices/machine/i2cmem.h
@@ -23,6 +23,61 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_I2CMEM_ADD( _tag ) \
+ MCFG_DEVICE_ADD( _tag, I2CMEM, 0 )
+
+#define MCFG_I2CMEM_ADDRESS( address ) \
+ downcast<i2cmem_device &>(*device).set_address(address);
+#define MCFG_I2CMEM_PAGE_SIZE( page_size ) \
+ downcast<i2cmem_device &>(*device).set_page_size(page_size);
+#define MCFG_I2CMEM_DATA_SIZE(data_size) \
+ downcast<i2cmem_device &>(*device).set_data_size(data_size);
+#define MCFG_I2CMEM_E0(e0) \
+ downcast<i2cmem_device &>(*device).set_e0(e0);
+#define MCFG_I2CMEM_E1(e1) \
+ downcast<i2cmem_device &>(*device).set_e1(e1);
+#define MCFG_I2CMEM_E2(e2) \
+ downcast<i2cmem_device &>(*device).set_e2(e2);
+#define MCFG_I2CMEM_WC(wc) \
+ downcast<i2cmem_device &>(*device).set_wc(wc);
+
+#define MCFG_X2404P_ADD( _tag ) \
+ MCFG_I2CMEM_ADD( _tag ) \
+ MCFG_I2CMEM_PAGE_SIZE(8) \
+ MCFG_I2CMEM_DATA_SIZE(0x200)
+
+#define MCFG_24C01_ADD( _tag ) \
+ MCFG_I2CMEM_ADD( _tag ) \
+ MCFG_I2CMEM_PAGE_SIZE(4) \
+ MCFG_I2CMEM_DATA_SIZE(0x80)
+
+#define MCFG_24C02_ADD( _tag ) \
+ MCFG_I2CMEM_ADD( _tag ) \
+ MCFG_I2CMEM_PAGE_SIZE(4) \
+ MCFG_I2CMEM_DATA_SIZE(0x100)
+
+#define MCFG_24C08_ADD( _tag ) \
+ MCFG_I2CMEM_ADD( _tag ) \
+ MCFG_I2CMEM_DATA_SIZE(0x400)
+
+#define MCFG_24C16_ADD( _tag ) \
+ MCFG_I2CMEM_ADD( _tag ) \
+ MCFG_I2CMEM_PAGE_SIZE(8) \
+ MCFG_I2CMEM_DATA_SIZE(0x800)
+
+#define MCFG_24C16A_ADD( _tag ) \
+ MCFG_I2CMEM_ADD( _tag ) \
+ MCFG_I2CMEM_DATA_SIZE(0x800)
+
+#define MCFG_24C64_ADD( _tag ) \
+ MCFG_I2CMEM_ADD( _tag ) \
+ MCFG_I2CMEM_PAGE_SIZE(8) \
+ MCFG_I2CMEM_DATA_SIZE(0x2000)
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -55,7 +110,7 @@ public:
protected:
// construction/destruction
- i2cmem_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int page_size, int data_size);
+ i2cmem_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock = 0);
// device-level overrides
virtual void device_start() override;
@@ -92,33 +147,17 @@ protected:
int m_byteaddr;
std::vector<uint8_t> m_page;
int m_page_offset;
- int m_page_written_size;
- bool m_in_write;
};
-#define DECLARE_I2C_DEVICE(name) \
- class i2c_##name##_device : public i2cmem_device \
- { \
- public: \
- i2c_##name##_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); \
- };
-
-DECLARE_I2C_DEVICE(x2404p)
-DECLARE_I2C_DEVICE(24c01)
-DECLARE_I2C_DEVICE(24c02)
-DECLARE_I2C_DEVICE(24c08)
-DECLARE_I2C_DEVICE(24c16);
-DECLARE_I2C_DEVICE(24c16a);
-DECLARE_I2C_DEVICE(24c64);
+class x2404p_device : public i2cmem_device
+{
+public:
+ // construction/destruction
+ x2404p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+};
// device type definition
-DECLARE_DEVICE_TYPE(I2CMEM, i2cmem_device)
-DECLARE_DEVICE_TYPE(I2C_X2404P, i2c_x2404p_device)
-DECLARE_DEVICE_TYPE(I2C_24C01, i2c_24c01_device)
-DECLARE_DEVICE_TYPE(I2C_24C02, i2c_24c02_device)
-DECLARE_DEVICE_TYPE(I2C_24C08, i2c_24c08_device)
-DECLARE_DEVICE_TYPE(I2C_24C16, i2c_24c16_device)
-DECLARE_DEVICE_TYPE(I2C_24C16A, i2c_24c16a_device)
-DECLARE_DEVICE_TYPE(I2C_24C64, i2c_24c64_device)
+DECLARE_DEVICE_TYPE(I2CMEM, i2cmem_device)
+DECLARE_DEVICE_TYPE(X2404P, x2404p_device)
#endif // MAME_MACHINE_I2CMEM_H
diff --git a/src/devices/machine/i7220.cpp b/src/devices/machine/i7220.cpp
index 0e86dc081bb..8543d9f61f2 100644
--- a/src/devices/machine/i7220.cpp
+++ b/src/devices/machine/i7220.cpp
@@ -29,16 +29,17 @@
#include "i7220.h"
-//#define LOG_GENERAL (1U << 0) //defined in logmacro.h already
-#define LOG_REGISTER (1U << 1)
-#define LOG_DEBUG (1U << 2)
+#define VERBOSE_DBG 2 /* general debug messages */
-//#define VERBOSE (LOG_DEBUG)
-//#define LOG_OUTPUT_FUNC printf
-#include "logmacro.h"
-
-#define LOGREG(...) LOGMASKED(LOG_REGISTER, __VA_ARGS__)
-#define LOGDBG(...) LOGMASKED(LOG_DEBUG, __VA_ARGS__)
+#define DBG_LOG(N,M,A) \
+ do { \
+ if(VERBOSE_DBG>=N) \
+ { \
+ if( M ) \
+ logerror("%11.6f at %s: %-10s",machine().time().as_double(),machine().describe_context(),(char*)M ); \
+ logerror A; \
+ } \
+ } while (0)
// device type definition
@@ -223,8 +224,8 @@ void i7220_device::start_command(int cmd)
// NFC bits in BLR MSB must be set to 0001 before issuing this command.
// MBM GROUP SELECT bits in the AR must select the last MBM in the system.
case C_INIT:
- LOG("BMC INIT: BLR %04x (NFC %d pages %d) AR %04x (MBM %d addr %03x) ER %02d\n",
- m_blr, blr_nfc, blr_count, m_ar, ar_mbm, ar_addr, m_regs[R_ER]);
+ DBG_LOG(1, "BMC", ("INIT: BLR %04x (NFC %d pages %d) AR %04x (MBM %d addr %03x) ER %02d\n",
+ m_blr, blr_nfc, blr_count, m_ar, ar_mbm, ar_addr, m_regs[R_ER]));
if (blr_nfc != 2)
{
command_fail_start(bi);
@@ -241,8 +242,8 @@ void i7220_device::start_command(int cmd)
// all parametric registers must be properly set up before issuing Read Bubble Data command
case C_READ:
- LOG("BMC RBD: BLR %04x (NFC %d pages %d) AR %04x (MBM %d addr %03x) ER %02d\n",
- m_blr, blr_nfc, blr_count, m_ar, ar_mbm, ar_addr, m_regs[R_ER]);
+ DBG_LOG(1, "BMC", ("RBD: BLR %04x (NFC %d pages %d) AR %04x (MBM %d addr %03x) ER %02d\n",
+ m_blr, blr_nfc, blr_count, m_ar, ar_mbm, ar_addr, m_regs[R_ER]));
if (ar_mbm >= m_data_size || blr_nfc != 2)
{
command_fail_start(bi);
@@ -254,8 +255,8 @@ void i7220_device::start_command(int cmd)
break;
case C_WRITE:
- LOG("BMC WBD: BLR %04x (NFC %d pages %d) AR %04x (MBM %d addr %03x) ER %02d\n",
- m_blr, blr_nfc, blr_count, m_ar, ar_mbm, ar_addr, m_regs[R_ER]);
+ DBG_LOG(1, "BMC", ("WBD: BLR %04x (NFC %d pages %d) AR %04x (MBM %d addr %03x) ER %02d\n",
+ m_blr, blr_nfc, blr_count, m_ar, ar_mbm, ar_addr, m_regs[R_ER]));
if (ar_mbm >= m_data_size || blr_nfc != 2)
{
command_fail_start(bi);
@@ -338,7 +339,7 @@ void i7220_device::general_continue(bubble_info &bi)
break;
default:
- LOG("BMC general_continue on unknown main-state %d\n", bi.main_state);
+ DBG_LOG(1,"BMC",("general_continue on unknown main-state %d\n", bi.main_state));
break;
}
}
@@ -388,7 +389,7 @@ void i7220_device::command_fail_continue(bubble_info &bi)
return;
default:
- LOG("BMC fail unknown sub-state %d\n", bi.sub_state);
+ DBG_LOG(1,"BMC",("fail unknown sub-state %d\n", bi.sub_state));
return;
}
}
@@ -422,7 +423,7 @@ void i7220_device::init_continue(bubble_info &bi)
return;
default:
- LOG("BMC init unknown sub-state %d\n", bi.sub_state);
+ DBG_LOG(1,"BMC",("init unknown sub-state %d\n", bi.sub_state));
return;
}
}
@@ -462,7 +463,7 @@ void i7220_device::read_fsa_continue(bubble_info &bi)
return;
default:
- LOG("BMC read fsa unknown sub-state %d\n", bi.sub_state);
+ DBG_LOG(1,"BMC",("read fsa unknown sub-state %d\n", bi.sub_state));
return;
}
}
@@ -496,7 +497,7 @@ void i7220_device::read_data_continue(bubble_info &bi)
break;
case WAIT_FSA_REPLY:
- LOGDBG("BMC read data: ct %02d limit %02d\n", bi.counter, bi.limit);
+ DBG_LOG(3,"BMC",("read data: ct %02d limit %02d\n", bi.counter, bi.limit));
if (bi.counter < bi.limit)
{
for (int a = 0; a < 32; a++)
@@ -514,7 +515,7 @@ void i7220_device::read_data_continue(bubble_info &bi)
return;
default:
- LOG("BMC read data unknown sub-state %d\n", bi.sub_state);
+ DBG_LOG(1,"BMC",("read data unknown sub-state %d\n", bi.sub_state));
return;
}
}
@@ -542,7 +543,7 @@ void i7220_device::write_data_continue(bubble_info &bi)
return;
case WAIT_FIFO:
- LOGDBG("BMC write data: fifo %02d ct %02d limit %02d\n", m_fifo_size, bi.counter, bi.limit);
+ DBG_LOG(3,"BMC",("write data: fifo %02d ct %02d limit %02d\n", m_fifo_size, bi.counter, bi.limit));
if (m_fifo_size >= 32)
{
for (int a = 0; a < 32; a++)
@@ -564,7 +565,7 @@ void i7220_device::write_data_continue(bubble_info &bi)
return;
default:
- LOG("BMC write data unknown sub-state %d\n", bi.sub_state);
+ DBG_LOG(1,"BMC",("write data unknown sub-state %d\n", bi.sub_state));
return;
}
}
@@ -585,14 +586,14 @@ READ8_MEMBER(i7220_device::read)
if (m_rac)
{
data = m_regs[m_rac];
- LOGREG("BMC R reg @ %02x == %02x\n", m_rac, data);
+ DBG_LOG(2, "BMC", ("R reg @ %02x == %02x\n", m_rac, data));
m_rac++;
m_rac &= 15;
}
else
{
data = fifo_pop();
- LOGREG("BMC R fifo == %02x\n", data);
+ DBG_LOG(2, "BMC", ("R fifo == %02x\n", data));
}
break;
@@ -625,8 +626,8 @@ READ8_MEMBER(i7220_device::read)
data |= SR_FIFO;
}
}
- LOGREG("BMC R status == %02x (phase %d state %d:%d fifo %d drq %d)\n",
- data, main_phase, bi.main_state, bi.sub_state, m_fifo_size, drq);
+ DBG_LOG(2, "BMC", ("R status == %02x (phase %d state %d:%d fifo %d drq %d)\n",
+ data, main_phase, bi.main_state, bi.sub_state, m_fifo_size, drq));
if (main_phase == PHASE_RESULT)
{
main_phase = PHASE_IDLE;
@@ -634,7 +635,7 @@ READ8_MEMBER(i7220_device::read)
break;
}
- LOGDBG("BMC R @ %d == %02x\n", offset, data);
+ DBG_LOG(3, "BMC", ("R @ %d == %02x\n", offset, data));
return data;
}
@@ -664,14 +665,14 @@ WRITE8_MEMBER( i7220_device::write )
"Software Reset"
};
- LOGDBG("BMC W @ %d <- %02x\n", offset, data);
+ DBG_LOG(3, "BMC", ("W @ %d <- %02x\n", offset, data));
switch (offset & 1)
{
case 0:
if (m_rac)
{
- LOGREG("BMC W reg @ %02x <- %02x\n", m_rac, data);
+ DBG_LOG(2, "BMC", ("W reg @ %02x <- %02x\n", m_rac, data));
m_regs[m_rac] = data;
update_regs();
m_rac++;
@@ -679,7 +680,7 @@ WRITE8_MEMBER( i7220_device::write )
}
else
{
- LOGREG("BMC W fifo <- %02x\n", data);
+ DBG_LOG(2, "BMC", ("W fifo <- %02x\n", data));
fifo_push(data);
}
break;
@@ -694,7 +695,7 @@ WRITE8_MEMBER( i7220_device::write )
m_cmdr = data & 15;
if (main_phase == PHASE_IDLE)
{
- LOG("BMC command %02x '%s'\n", data, commands[m_cmdr]);
+ DBG_LOG(1, "BMC", ("command %02x '%s'\n", data, commands[m_cmdr]));
main_phase = PHASE_CMD;
start_command(m_cmdr);
}
diff --git a/src/devices/machine/i8087.cpp b/src/devices/machine/i8087.cpp
index e137ae105e4..15d5e51bea2 100644
--- a/src/devices/machine/i8087.cpp
+++ b/src/devices/machine/i8087.cpp
@@ -169,7 +169,7 @@ DEFINE_DEVICE_TYPE(I8087, i8087_device, "i8087", "Intel 8087")
i8087_device::i8087_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, type, tag, owner, clock),
- m_space(*this, finder_base::DUMMY_TAG, -1),
+ device_memory_interface(mconfig, *this),
m_int_handler(*this),
m_busy_handler(*this)
{
@@ -180,6 +180,13 @@ i8087_device::i8087_device(const machine_config &mconfig, const char *tag, devic
{
}
+device_memory_interface::space_config_vector i8087_device::memory_space_config() const
+{
+ return space_config_vector {
+ std::make_pair(AS_PROGRAM, &m_space_config),
+ };
+}
+
void i8087_device::device_start()
{
save_item(NAME(m_reg[0].high));
@@ -215,6 +222,11 @@ void i8087_device::device_start()
build_opcode_table();
}
+void i8087_device::device_config_complete()
+{
+ m_space_config = address_space_config("program", ENDIANNESS_LITTLE, m_data_width, 20);
+}
+
void i8087_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
m_busy_handler(1);
diff --git a/src/devices/machine/i8087.h b/src/devices/machine/i8087.h
index 9344ca2e68e..290b9a95b16 100644
--- a/src/devices/machine/i8087.h
+++ b/src/devices/machine/i8087.h
@@ -10,12 +10,12 @@
DECLARE_DEVICE_TYPE(I8087, i8087_device)
-class i8087_device : public device_t
+class i8087_device : public device_t,
+ public device_memory_interface
{
public:
i8087_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
- template <class Object> void set_space_88(Object &&tag, int spacenum) { m_space.set_tag(std::forward<Object>(tag), spacenum); m_space.set_data_width(8); }
- template <class Object> void set_space_86(Object &&tag, int spacenum) { m_space.set_tag(std::forward<Object>(tag), spacenum); m_space.set_data_width(16); }
+ void set_data_width(u8 data_width) { m_data_width = data_width; }
auto irq() { return m_int_handler.bind(); }
auto busy() { return m_busy_handler.bind(); }
@@ -26,13 +26,13 @@ protected:
i8087_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
virtual void device_start() override;
virtual void device_reset() override;
+ virtual void device_config_complete() override;
+ virtual space_config_vector memory_space_config() const override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
- address_space &space() { return *m_space; }
-
typedef void (i8087_device::*x87_func)(u8 modrm);
- required_address_space m_space;
+ address_space_config m_space_config;
devcb_write_line m_int_handler;
devcb_write_line m_busy_handler;
emu_timer *m_timer;
@@ -45,6 +45,7 @@ private:
u16 m_cw;
u16 m_sw;
u16 m_tw;
+ int m_data_width;
int m_icount;
x87_func m_opcode_table_d8[256];
diff --git a/src/devices/machine/i8155.cpp b/src/devices/machine/i8155.cpp
index b5027368633..779874a244d 100644
--- a/src/devices/machine/i8155.cpp
+++ b/src/devices/machine/i8155.cpp
@@ -406,7 +406,7 @@ void i8155_device::device_timer(emu_timer &timer, device_timer_id id, int param,
// io_r - register read
//-------------------------------------------------
-uint8_t i8155_device::io_r(offs_t offset)
+READ8_MEMBER( i8155_device::io_r )
{
uint8_t data = 0;
@@ -539,7 +539,7 @@ void i8155_device::register_w(int offset, uint8_t data)
// io_w - register write
//-------------------------------------------------
-void i8155_device::io_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( i8155_device::io_w )
{
register_w(offset, data);
}
@@ -549,7 +549,7 @@ void i8155_device::io_w(offs_t offset, uint8_t data)
// memory_r - internal RAM read
//-------------------------------------------------
-uint8_t i8155_device::memory_r(offs_t offset)
+READ8_MEMBER( i8155_device::memory_r )
{
return m_ram[offset & 0xff];
}
@@ -559,7 +559,7 @@ uint8_t i8155_device::memory_r(offs_t offset)
// memory_w - internal RAM write
//-------------------------------------------------
-void i8155_device::memory_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( i8155_device::memory_w )
{
m_ram[offset & 0xff] = data;
}
@@ -569,7 +569,7 @@ void i8155_device::memory_w(offs_t offset, uint8_t data)
// ale_w - address latch write
//-------------------------------------------------
-void i8155_device::ale_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( i8155_device::ale_w )
{
// I/O / memory select
m_io_m = BIT(offset, 0);
@@ -580,21 +580,21 @@ void i8155_device::ale_w(offs_t offset, uint8_t data)
//-------------------------------------------------
-// data_r - memory or I/O read
+// read - memory or I/O read
//-------------------------------------------------
-uint8_t i8155_device::data_r()
+READ8_MEMBER( i8155_device::read )
{
uint8_t data = 0;
switch (m_io_m)
{
case MEMORY:
- data = memory_r(m_ad);
+ data = memory_r(space, m_ad);
break;
case IO:
- data = io_r(m_ad);
+ data = io_r(space, m_ad);
break;
}
@@ -603,19 +603,19 @@ uint8_t i8155_device::data_r()
//-------------------------------------------------
-// data_w - memory or I/O write
+// write - memory or I/O write
//-------------------------------------------------
-void i8155_device::data_w(uint8_t data)
+WRITE8_MEMBER( i8155_device::write )
{
switch (m_io_m)
{
case MEMORY:
- memory_w(m_ad, data);
+ memory_w(space, m_ad, data);
break;
case IO:
- io_w(m_ad, data);
+ io_w(space, m_ad, data);
break;
}
}
diff --git a/src/devices/machine/i8155.h b/src/devices/machine/i8155.h
index 2d6e49b2063..a17692211e6 100644
--- a/src/devices/machine/i8155.h
+++ b/src/devices/machine/i8155.h
@@ -55,15 +55,15 @@ public:
auto out_pc_callback() { return m_out_pc_cb.bind(); }
auto out_to_callback() { return m_out_to_cb.bind(); }
- uint8_t io_r(offs_t offset);
- void io_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( io_r );
+ DECLARE_WRITE8_MEMBER( io_w );
- uint8_t memory_r(offs_t offset);
- void memory_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( memory_r );
+ DECLARE_WRITE8_MEMBER( memory_w );
- void ale_w(offs_t offset, uint8_t data);
- uint8_t data_r();
- void data_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( ale_w );
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
protected:
i8155_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/machine/i82357.cpp b/src/devices/machine/i82357.cpp
deleted file mode 100644
index 9b3be9c0905..00000000000
--- a/src/devices/machine/i82357.cpp
+++ /dev/null
@@ -1,307 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Patrick Mackinlay
-
-/*
- * An implementation of the Intel 82357 Integrated System Peripheral.
- *
- * This device was one part of the 3-chip Intel 82350 EISA bus chipset.
- *
- * Sources:
- *
- * http://bitsavers.org/components/intel/_dataBooks/1996_Intel_Peripheral_Components.pdf
- *
- * TODO
- * - expose everything to an actual EISA bus
- * - 32-bit dma functionality
- *
- */
-
-#include "emu.h"
-#include "i82357.h"
-
-#define LOG_GENERAL (1U << 0)
-
-//#define VERBOSE (LOG_GENERAL)
-
-#include "logmacro.h"
-
-DEFINE_DEVICE_TYPE(I82357, i82357_device, "i82357", "Intel 82357 Integrated System Peripheral")
-
-i82357_device::i82357_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, I82357, tag, owner, clock)
- , m_pic(*this, "pic%u", 0)
- , m_pit(*this, "pit%u", 0)
- , m_dma(*this, "dma%u", 0)
- , m_out_rtc(*this)
- , m_out_nmi(*this)
- , m_out_spkr(*this)
-{
-}
-
-void i82357_device::device_add_mconfig(machine_config &config)
-{
- PIC8259(config, m_pic[0], 0);
- m_pic[0]->in_sp_callback().set_constant(1);
- m_pic[0]->read_slave_ack_callback().set(
- [this](offs_t offset)
- {
- if (offset == 2)
- return m_pic[1]->acknowledge();
-
- return u32(0);
- });
-
- PIC8259(config, m_pic[1], 0);
- m_pic[1]->out_int_callback().set(m_pic[0], FUNC(pic8259_device::ir2_w));
- m_pic[1]->in_sp_callback().set_constant(0);
-
- PIT8254(config, m_pit[0], 0);
- PIT8254(config, m_pit[1], 0);
-
- // timer 1 counter 0: system timer
- m_pit[0]->set_clk<0>(clock() / 12);
- m_pit[0]->out_handler<0>().set(m_pic[0], FUNC(pic8259_device::ir0_w));
-
- // timer 1 counter 1: refresh request
- m_pit[0]->set_clk<1>(clock() / 12);
- m_pit[0]->out_handler<1>().set(
- [this](int state)
- {
- // FIXME: not accurate, but good enough to pass diagnostic
- if (state)
- m_nmi_reg ^= NMI_REFRESH;
-
- m_pit[1]->write_gate2(state);
- });
-
- // timer 1 counter 2: speaker
- m_pit[0]->set_clk<2>(clock() / 12);
- m_pit[0]->out_handler<2>().set(
- [this](int state)
- {
- if (state)
- m_nmi_reg |= NMI_T1C2_STATE;
- else
- m_nmi_reg &= ~NMI_T1C2_STATE;
-
- m_out_spkr((m_nmi_reg & NMI_T1C2_STATE) && (m_nmi_reg & NMI_SPEAKER_DATA));
- });
-
- // timer 2 counter 0: fail-safe timer
- m_pit[1]->set_clk<0>(clock() / 48);
- m_pit[1]->out_handler<0>().set(
- [this](int state)
- {
- if (state && (m_nmi_ext & NMI_EXT_EN_FAILSAFE))
- {
- m_nmi_ext |= NMI_EXT_FAILSAFE;
-
- m_nmi_check->adjust(attotime::zero);
- }
- });
-
- // timer 2 counter 1: does not exist
-
- // timer 2 counter 2: cpu speed control
- m_pit[1]->set_clk<2>(8_MHz_XTAL);
- //m_pit[1]->out_handler<2>().set();
-
- EISA_DMA(config, m_dma[0], clock() / 3);
- EISA_DMA(config, m_dma[1], clock() / 3);
- m_dma[1]->out_dack_callback<0>().set(m_dma[0], FUNC(eisa_dma_device::hack_w)).invert();
-}
-
-void i82357_device::map(address_map &map)
-{
- map(0x000, 0x00f).rw(m_dma[0], FUNC(eisa_dma_device::read), FUNC(eisa_dma_device::write));
- map(0x020, 0x021).rw(m_pic[0], FUNC(pic8259_device::read), FUNC(pic8259_device::write));
- map(0x040, 0x043).rw(m_pit[0], FUNC(pit8254_device::read), FUNC(pit8254_device::write));
- map(0x048, 0x04b).rw(m_pit[1], FUNC(pit8254_device::read), FUNC(pit8254_device::write));
-
- // FIXME: also 0x065 - "NMI Status"
- map(0x061, 0x061).rw(FUNC(i82357_device::nmi_reg_r), FUNC(i82357_device::nmi_reg_w));
-
- // NMI Enable Register (0x70, 72, 74, 76)
- map(0x070, 0x077).lw8("nmi_rtc",
- [this](address_space &space, offs_t offset, u8 data)
- {
- m_nmi_enabled = !BIT(data, 7);
-
- m_out_rtc(space, 0, data & 0x7f);
-
- m_nmi_check->adjust(attotime::zero);
- }).umask64(0xff);
-
- map(0x081, 0x081).rw(m_dma[0], FUNC(eisa_dma_device::get_address_page<2>), FUNC(eisa_dma_device::set_address_page<2>));
- map(0x082, 0x082).rw(m_dma[0], FUNC(eisa_dma_device::get_address_page<3>), FUNC(eisa_dma_device::set_address_page<3>));
- map(0x083, 0x083).rw(m_dma[0], FUNC(eisa_dma_device::get_address_page<1>), FUNC(eisa_dma_device::set_address_page<1>));
- map(0x087, 0x087).rw(m_dma[0], FUNC(eisa_dma_device::get_address_page<0>), FUNC(eisa_dma_device::set_address_page<0>));
- map(0x089, 0x089).rw(m_dma[1], FUNC(eisa_dma_device::get_address_page<2>), FUNC(eisa_dma_device::set_address_page<2>));
- map(0x08a, 0x08a).rw(m_dma[1], FUNC(eisa_dma_device::get_address_page<3>), FUNC(eisa_dma_device::set_address_page<3>));
- map(0x08b, 0x08b).rw(m_dma[1], FUNC(eisa_dma_device::get_address_page<1>), FUNC(eisa_dma_device::set_address_page<1>));
- map(0x08f, 0x08f).rw(m_dma[1], FUNC(eisa_dma_device::get_address_page<0>), FUNC(eisa_dma_device::set_address_page<0>));
-
- // TODO: also 0xa4, a8, ac, b0, b4, b8, bc
- map(0x0a0, 0x0a1).rw(m_pic[1], FUNC(pic8259_device::read), FUNC(pic8259_device::write));
- map(0x0c0, 0x0df).rw(m_dma[1], FUNC(eisa_dma_device::read), FUNC(eisa_dma_device::write)).umask16(0x00ff);
-
- map(0x401, 0x401).rw(m_dma[0], FUNC(eisa_dma_device::get_count_high<0>), FUNC(eisa_dma_device::set_count_high<0>));
- map(0x403, 0x403).rw(m_dma[0], FUNC(eisa_dma_device::get_count_high<1>), FUNC(eisa_dma_device::set_count_high<1>));
- map(0x405, 0x405).rw(m_dma[0], FUNC(eisa_dma_device::get_count_high<2>), FUNC(eisa_dma_device::set_count_high<2>));
- map(0x407, 0x407).rw(m_dma[0], FUNC(eisa_dma_device::get_count_high<3>), FUNC(eisa_dma_device::set_count_high<3>));
-
- //map(0x40a, 0x40a); // DMA1 Set Chaining Mode (w)/Interrupt Status (r)
- //map(0x40b, 0x40b); // DMA1 Ext Write Mode (w)
- //map(0x40c, 0x40c); // Chain Buffer Control
- //map(0x40d, 0x40d); // Stepping Level Register (ro)
- //map(0x40e, 0x40e); // ISP Test Register
- //map(0x40f, 0x40f); // ISP Test Register
-
- map(0x461, 0x461).rw(FUNC(i82357_device::nmi_ext_r), FUNC(i82357_device::nmi_ext_w));
- map(0x462, 0x462).lw8("nmi_ioport",
- [this](u8 data)
- {
- if (m_nmi_ext & NMI_EXT_EN_IOPORT)
- {
- m_nmi_ext |= NMI_EXT_IOPORT;
-
- m_nmi_check->adjust(attotime::zero);
- }
- });
- //map(0x464, 0x464); // Last 32-bit bus master granted (L)
-
- map(0x481, 0x481).rw(m_dma[0], FUNC(eisa_dma_device::get_address_page_high<2>), FUNC(eisa_dma_device::set_address_page_high<2>));
- map(0x482, 0x482).rw(m_dma[0], FUNC(eisa_dma_device::get_address_page_high<3>), FUNC(eisa_dma_device::set_address_page_high<3>));
- map(0x483, 0x483).rw(m_dma[0], FUNC(eisa_dma_device::get_address_page_high<1>), FUNC(eisa_dma_device::set_address_page_high<1>));
- map(0x487, 0x487).rw(m_dma[0], FUNC(eisa_dma_device::get_address_page_high<0>), FUNC(eisa_dma_device::set_address_page_high<0>));
- map(0x489, 0x489).rw(m_dma[1], FUNC(eisa_dma_device::get_address_page_high<2>), FUNC(eisa_dma_device::set_address_page_high<2>));
- map(0x48a, 0x48a).rw(m_dma[1], FUNC(eisa_dma_device::get_address_page_high<3>), FUNC(eisa_dma_device::set_address_page_high<3>));
- map(0x48b, 0x48b).rw(m_dma[1], FUNC(eisa_dma_device::get_address_page_high<1>), FUNC(eisa_dma_device::set_address_page_high<1>));
- map(0x48f, 0x48f).rw(m_dma[1], FUNC(eisa_dma_device::get_address_page_high<0>), FUNC(eisa_dma_device::set_address_page_high<0>));
-
- map(0x4c2, 0x4c2).rw(m_dma[1], FUNC(eisa_dma_device::get_count_high<0>), FUNC(eisa_dma_device::set_count_high<0>));
- map(0x4c6, 0x4c6).rw(m_dma[1], FUNC(eisa_dma_device::get_count_high<1>), FUNC(eisa_dma_device::set_count_high<1>));
- map(0x4ca, 0x4ca).rw(m_dma[1], FUNC(eisa_dma_device::get_count_high<2>), FUNC(eisa_dma_device::set_count_high<2>));
- map(0x4ce, 0x4ce).rw(m_dma[1], FUNC(eisa_dma_device::get_count_high<3>), FUNC(eisa_dma_device::set_count_high<3>));
- map(0x4d0, 0x4d1).lrw8("elcr",
- [this](offs_t offset) { return m_elcr[offset]; },
- [this](offs_t offset, u8 data) { m_elcr[offset] = data; });
-
- //map(0x4d4, 0x4d4); // DMA2 Set Chaining Mode
- //map(0x4d6, 0x4d6); // DMA2 Ext Write Mode Register
-
- map(0x4e0, 0x4e3).rw(m_dma[0], FUNC(eisa_dma_device::get_stop<0>), FUNC(eisa_dma_device::set_stop<0>));
- map(0x4e4, 0x4e7).rw(m_dma[0], FUNC(eisa_dma_device::get_stop<1>), FUNC(eisa_dma_device::set_stop<1>));
- map(0x4e8, 0x4eb).rw(m_dma[0], FUNC(eisa_dma_device::get_stop<2>), FUNC(eisa_dma_device::set_stop<2>));
- map(0x4ec, 0x4ef).rw(m_dma[0], FUNC(eisa_dma_device::get_stop<3>), FUNC(eisa_dma_device::set_stop<3>));
-
- map(0x4f0, 0x4f3).rw(m_dma[1], FUNC(eisa_dma_device::get_stop<0>), FUNC(eisa_dma_device::set_stop<0>)); // reserved
- map(0x4f4, 0x4f7).rw(m_dma[1], FUNC(eisa_dma_device::get_stop<1>), FUNC(eisa_dma_device::set_stop<1>));
- map(0x4f8, 0x4fb).rw(m_dma[1], FUNC(eisa_dma_device::get_stop<2>), FUNC(eisa_dma_device::set_stop<2>));
- map(0x4fc, 0x4ff).rw(m_dma[1], FUNC(eisa_dma_device::get_stop<3>), FUNC(eisa_dma_device::set_stop<3>));
-}
-
-void i82357_device::device_start()
-{
- m_out_rtc.resolve_safe();
- m_out_nmi.resolve_safe();
- m_out_spkr.resolve_safe();
-
- m_nmi_check = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(i82357_device::nmi_check), this));
-}
-
-void i82357_device::device_reset()
-{
- m_elcr[0] = 0;
- m_elcr[1] = 0;
-
- m_nmi_enabled = true;
- m_nmi_reg = 0;
- m_nmi_ext = 0;
-
- m_nmi_check->adjust(attotime::zero);
-}
-
-void i82357_device::nmi_reg_w(u8 data)
-{
- m_pit[0]->write_gate2(!!(data & NMI_T1C2_GATE));
-
- // clear parity nmi
- if (data & NMI_PARITY_DISABLE)
- m_nmi_reg &= ~NMI_PARITY;
-
- // clear iochk nmi
- if (data & NMI_IOCHK_DISABLE)
- m_nmi_reg &= ~NMI_IOCHK;
-
- m_nmi_reg = (m_nmi_reg & ~NMI_WMASK) | (data & NMI_WMASK);
-
- // update speaker state
- m_out_spkr((m_nmi_reg & NMI_T1C2_STATE) && (m_nmi_reg & NMI_SPEAKER_DATA));
-
- m_nmi_check->adjust(attotime::zero);
-}
-
-void i82357_device::nmi_ext_w(u8 data)
-{
- if (!(data & NMI_EXT_EN_IOPORT))
- m_nmi_ext &= ~NMI_EXT_IOPORT;
-
- if (!(data & NMI_EXT_EN_TIMEOUT))
- m_nmi_ext &= ~NMI_EXT_TIMEOUT;
-
- if (!(data & NMI_EXT_EN_FAILSAFE))
- m_nmi_ext &= ~NMI_EXT_FAILSAFE;
-
- m_nmi_ext = (m_nmi_ext & ~NMI_EXT_WMASK) | (data & NMI_EXT_WMASK);
-
- m_nmi_check->adjust(attotime::zero);
-}
-
-WRITE_LINE_MEMBER(i82357_device::in_iochk)
-{
- if (!state && !(m_nmi_reg & NMI_PARITY_DISABLE))
- {
- m_nmi_reg |= NMI_IOCHK;
-
- m_nmi_check->adjust(attotime::zero);
- }
- else
- m_nmi_reg &= ~NMI_IOCHK;
-}
-
-WRITE_LINE_MEMBER(i82357_device::in_parity)
-{
- if (!state && !(m_nmi_reg & NMI_IOCHK_DISABLE))
- {
- m_nmi_reg |= NMI_PARITY;
-
- m_nmi_check->adjust(attotime::zero);
- }
- else
- m_nmi_reg &= ~NMI_PARITY;
-}
-
-TIMER_CALLBACK_MEMBER(i82357_device::nmi_check)
-{
- if (m_nmi_enabled)
- {
- if ((m_nmi_reg & NMI_NMI) || (m_nmi_ext & NMI_EXT_NMI))
- {
- if (!m_out_nmi_asserted)
- {
- m_out_nmi_asserted = true;
- m_out_nmi(1);
- }
-
- return;
- }
- }
-
- // disabled or no source
- if (m_out_nmi_asserted)
- {
- m_out_nmi_asserted = false;
- m_out_nmi(0);
- }
-}
diff --git a/src/devices/machine/i82357.h b/src/devices/machine/i82357.h
deleted file mode 100644
index 3c5a7756061..00000000000
--- a/src/devices/machine/i82357.h
+++ /dev/null
@@ -1,91 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Patrick Mackinlay
-
-#ifndef MAME_MACHINE_I82357_H
-#define MAME_MACHINE_I82357_H
-
-#pragma once
-
-#include "machine/pic8259.h"
-#include "machine/pit8253.h"
-#include "machine/am9517a.h"
-
-class i82357_device : public device_t
-{
-public:
- i82357_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
- auto out_rtc_cb() { return m_out_rtc.bind(); }
- auto out_int_cb() { return subdevice<pic8259_device>("pic0")->out_int_callback(); }
- auto out_nmi_cb() { return m_out_nmi.bind(); }
- auto out_spkr_cb() { return m_out_spkr.bind(); }
-
- u32 eisa_irq_ack() { return m_pic[0]->acknowledge(); }
-
- DECLARE_WRITE_LINE_MEMBER(in_iochk);
- DECLARE_WRITE_LINE_MEMBER(in_parity);
-
- void map(address_map &map);
-
-protected:
- // standard device_t overrides
- virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_start() override;
- virtual void device_reset() override;
-
- void nmi_reg_w(u8 data);
- void nmi_ext_w(u8 data);
- u8 nmi_reg_r() { return m_nmi_reg; }
- u8 nmi_ext_r() { return m_nmi_ext; }
-
- TIMER_CALLBACK_MEMBER(nmi_check);
-
-private:
- required_device_array<pic8259_device, 2> m_pic;
- required_device_array<pit8254_device, 2> m_pit;
- required_device_array<eisa_dma_device, 2> m_dma;
-
- devcb_write8 m_out_rtc;
- devcb_write_line m_out_nmi;
- devcb_write_line m_out_spkr;
-
- enum nmi_reg_mask : u8
- {
- NMI_T1C2_GATE = 0x01,
- NMI_SPEAKER_DATA = 0x02,
- NMI_PARITY_DISABLE = 0x04,
- NMI_IOCHK_DISABLE = 0x08,
- NMI_REFRESH = 0x10,
- NMI_T1C2_STATE = 0x20,
- NMI_IOCHK = 0x40,
- NMI_PARITY = 0x80,
-
- NMI_WMASK = 0x0f,
- NMI_NMI = 0xc0,
- };
- enum nmi_ext_mask : u8
- {
- NMI_EXT_BUS_RESET = 0x01, // bus reset (read/write)
- NMI_EXT_EN_IOPORT = 0x02,
- NMI_EXT_EN_FAILSAFE = 0x04,
- NMI_EXT_EN_TIMEOUT = 0x08,
- NMI_EXT_8US_TIMEOUT = 0x10, // 8us EISA bus master timeout occurred
- NMI_EXT_IOPORT = 0x20, // NMI I/O port interrupt pending
- NMI_EXT_TIMEOUT = 0x40, // EISA bus master timeout occurred, NMI requested
- NMI_EXT_FAILSAFE = 0x80, // Fail-safe timer is active, NMI requested
-
- NMI_EXT_WMASK = 0x0f,
- NMI_EXT_NMI = 0xe0,
- };
- u8 m_elcr[2];
-
- emu_timer *m_nmi_check;
- bool m_out_nmi_asserted;
- bool m_nmi_enabled;
- u8 m_nmi_reg;
- u8 m_nmi_ext;
-};
-
-DECLARE_DEVICE_TYPE(I82357, i82357_device)
-
-#endif // MAME_MACHINE_I82357_H
diff --git a/src/devices/machine/i82371sb.cpp b/src/devices/machine/i82371sb.cpp
index b149d98a48f..579d678906a 100644
--- a/src/devices/machine/i82371sb.cpp
+++ b/src/devices/machine/i82371sb.cpp
@@ -49,7 +49,7 @@ void i82371sb_isa_device::internal_io_map(address_map &map)
void i82371sb_isa_device::device_add_mconfig(machine_config &config)
{
- PIT8254(config, m_pit8254);
+ PIT8254(config, m_pit8254, 0);
m_pit8254->set_clk<0>(4772720/4); // heartbeat IRQ
m_pit8254->out_handler<0>().set(FUNC(i82371sb_isa_device::at_pit8254_out0_changed));
m_pit8254->set_clk<1>(4772720/4); // DRAM refresh
@@ -90,12 +90,12 @@ void i82371sb_isa_device::device_add_mconfig(machine_config &config)
m_dma8237_2->out_dack_callback<2>().set(FUNC(i82371sb_isa_device::pc_dack6_w));
m_dma8237_2->out_dack_callback<3>().set(FUNC(i82371sb_isa_device::pc_dack7_w));
- PIC8259(config, m_pic8259_master);
+ PIC8259(config, m_pic8259_master, 0);
m_pic8259_master->out_int_callback().set_inputline(m_maincpu, 0);
m_pic8259_master->in_sp_callback().set_constant(1);
m_pic8259_master->read_slave_ack_callback().set(FUNC(i82371sb_isa_device::get_slave_ack));
- PIC8259(config, m_pic8259_slave);
+ PIC8259(config, m_pic8259_slave, 0);
m_pic8259_slave->out_int_callback().set(m_pic8259_master, FUNC(pic8259_device::ir2_w));
m_pic8259_slave->in_sp_callback().set_constant(0);
@@ -104,8 +104,7 @@ void i82371sb_isa_device::device_add_mconfig(machine_config &config)
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50);
ISA16(config, m_isabus, 0);
- m_isabus->set_memspace(":maincpu", AS_PROGRAM);
- m_isabus->set_iospace(":maincpu", AS_IO);
+ m_isabus->set_cputag(":maincpu");
m_isabus->irq3_callback().set(FUNC(i82371sb_isa_device::pc_irq3_w));
m_isabus->irq4_callback().set(FUNC(i82371sb_isa_device::pc_irq4_w));
m_isabus->irq5_callback().set(FUNC(i82371sb_isa_device::pc_irq5_w));
@@ -124,7 +123,6 @@ void i82371sb_isa_device::device_add_mconfig(machine_config &config)
m_isabus->drq5_callback().set(m_dma8237_2, FUNC(am9517a_device::dreq1_w));
m_isabus->drq6_callback().set(m_dma8237_2, FUNC(am9517a_device::dreq2_w));
m_isabus->drq7_callback().set(m_dma8237_2, FUNC(am9517a_device::dreq3_w));
- m_isabus->iochck_callback().set(FUNC(i82371sb_isa_device::iochck_w));
}
i82371sb_isa_device::i82371sb_isa_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
@@ -658,8 +656,6 @@ WRITE_LINE_MEMBER( i82371sb_isa_device::at_dma8237_out_eop )
void i82371sb_isa_device::pc_select_dma_channel(int channel, bool state)
{
- m_isabus->dack_line_w(channel, state);
-
if(!state) {
m_dma_channel = channel;
if(m_cur_eop)
@@ -822,24 +818,17 @@ WRITE8_MEMBER( i82371sb_isa_device::at_portb_w )
m_pit8254->write_gate2(BIT(data, 0));
at_speaker_set_spkrdata( BIT(data, 1));
m_channel_check = BIT(data, 3);
- if (m_channel_check)
- m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
-}
-
-WRITE_LINE_MEMBER( i82371sb_isa_device::iochck_w )
-{
- if (!state && !m_channel_check && m_nmi_enabled)
- m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
+ m_isabus->set_nmi_state((m_nmi_enabled==0) && (m_channel_check==0));
}
READ8_MEMBER( i82371sb_isa_device::at_dma8237_2_r )
{
- return m_dma8237_2->read(offset / 2);
+ return m_dma8237_2->read( space, offset / 2);
}
WRITE8_MEMBER( i82371sb_isa_device::at_dma8237_2_w )
{
- m_dma8237_2->write(offset / 2, data);
+ m_dma8237_2->write( space, offset / 2, data);
}
READ8_MEMBER(i82371sb_isa_device::eisa_irq_read)
diff --git a/src/devices/machine/i82371sb.h b/src/devices/machine/i82371sb.h
index 5d79eec29ef..ea7976ad845 100644
--- a/src/devices/machine/i82371sb.h
+++ b/src/devices/machine/i82371sb.h
@@ -146,7 +146,6 @@ private:
DECLARE_WRITE8_MEMBER(at_page8_w);
DECLARE_READ8_MEMBER(at_portb_r);
DECLARE_WRITE8_MEMBER(at_portb_w);
- DECLARE_WRITE_LINE_MEMBER(iochck_w);
DECLARE_READ8_MEMBER(ide_read_cs1_r);
DECLARE_WRITE8_MEMBER(ide_write_cs1_w);
DECLARE_READ8_MEMBER(ide2_read_cs1_r);
diff --git a/src/devices/machine/i8251.cpp b/src/devices/machine/i8251.cpp
index 1c3189d8f8f..773262b617e 100644
--- a/src/devices/machine/i8251.cpp
+++ b/src/devices/machine/i8251.cpp
@@ -674,11 +674,9 @@ uint8_t i8251_device::data_r()
{
LOG("read data: %02x, STATUS=%02x\n",m_rx_data,m_status);
/* reading clears */
- if (!machine().side_effects_disabled())
- {
- m_status &= ~I8251_STATUS_RX_READY;
- update_rx_ready();
- }
+ m_status &= ~I8251_STATUS_RX_READY;
+
+ update_rx_ready();
return m_rx_data;
}
diff --git a/src/devices/machine/i8251.h b/src/devices/machine/i8251.h
index f8b92725b05..4e2773c3e40 100644
--- a/src/devices/machine/i8251.h
+++ b/src/devices/machine/i8251.h
@@ -54,7 +54,10 @@ public:
DECLARE_READ_LINE_MEMBER(txrdy_r);
-protected:
+ /// TODO: REMOVE THIS
+ void receive_character(uint8_t ch);
+
+ /// TODO: this shouldn't be public
enum
{
I8251_STATUS_FRAMING_ERROR = 0x20,
@@ -65,6 +68,7 @@ protected:
I8251_STATUS_TX_READY = 0x01
};
+protected:
i8251_device(
const machine_config &mconfig,
device_type type,
@@ -79,8 +83,6 @@ protected:
void command_w(uint8_t data);
void mode_w(uint8_t data);
- void receive_character(uint8_t ch);
-
void update_rx_ready();
void update_tx_ready();
void update_tx_empty();
diff --git a/src/devices/machine/i8271.cpp b/src/devices/machine/i8271.cpp
index 1bac233f955..3a309c4ea16 100644
--- a/src/devices/machine/i8271.cpp
+++ b/src/devices/machine/i8271.cpp
@@ -132,7 +132,7 @@ void i8271_device::set_floppy(floppy_image_device *flop)
flop->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(&i8271_device::index_callback, this));
}
-uint8_t i8271_device::sr_r()
+READ8_MEMBER(i8271_device::sr_r)
{
uint32_t ret = (irq ? SR_IRQ : 0);
switch(main_phase) {
@@ -151,13 +151,11 @@ uint8_t i8271_device::sr_r()
return ret;
}
-uint8_t i8271_device::rr_r()
+READ8_MEMBER(i8271_device::rr_r)
{
- if (!machine().side_effects_disabled()) {
- if (main_phase == PHASE_RESULT)
- main_phase = PHASE_IDLE;
- set_irq(false);
- }
+ if(main_phase == PHASE_RESULT)
+ main_phase = PHASE_IDLE;
+ set_irq(false);
return rr;
}
@@ -166,32 +164,31 @@ void i8271_device::set_rate(int rate)
cur_rate = rate;
}
-uint8_t i8271_device::read(offs_t offset)
+READ8_MEMBER(i8271_device::read)
{
switch(offset & 0x03) {
- case 0x00: return sr_r();
- case 0x01: return rr_r();
+ case 0x00: return sr_r(space, 0);
+ case 0x01: return rr_r(space, 0);
}
return 0xff;
}
-void i8271_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(i8271_device::write)
{
switch(offset & 0x03) {
- case 0x00: cmd_w(data); break;
- case 0x01: param_w(data); break;
- case 0x02: reset_w(data); break;
+ case 0x00: cmd_w(space, 0, data); break;
+ case 0x01: param_w(space, 0, data); break;
+ case 0x02: reset_w(space, 0, data); break;
}
}
-uint8_t i8271_device::data_r()
+READ8_MEMBER(i8271_device::data_r)
{
- if (!machine().side_effects_disabled())
- set_drq(false);
+ set_drq(false);
return dma_data;
}
-void i8271_device::data_w(uint8_t data)
+WRITE8_MEMBER(i8271_device::data_w)
{
if(drq) {
set_drq(false);
@@ -199,7 +196,7 @@ void i8271_device::data_w(uint8_t data)
}
}
-void i8271_device::cmd_w(uint8_t data)
+WRITE8_MEMBER(i8271_device::cmd_w)
{
if(main_phase == PHASE_IDLE) {
command[0] = data;
@@ -214,7 +211,7 @@ void i8271_device::cmd_w(uint8_t data)
}
}
-void i8271_device::param_w(uint8_t data)
+WRITE8_MEMBER(i8271_device::param_w)
{
if(main_phase == PHASE_CMD) {
command[command_pos++] = data;
diff --git a/src/devices/machine/i8271.h b/src/devices/machine/i8271.h
index 88e9a6146e6..701085f58d4 100644
--- a/src/devices/machine/i8271.h
+++ b/src/devices/machine/i8271.h
@@ -24,10 +24,10 @@ public:
auto hdl_wr_callback() { return hdl_cb.bind(); }
auto opt_wr_callback() { return opt_cb.bind(); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
- uint8_t data_r();
- void data_w(uint8_t data);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
+ DECLARE_READ8_MEMBER (data_r);
+ DECLARE_WRITE8_MEMBER(data_w);
void ready_w(bool val);
@@ -228,11 +228,11 @@ private:
C_INCOMPLETE
};
- uint8_t sr_r();
- uint8_t rr_r();
- void reset_w(uint8_t data) { if(data == 1) soft_reset(); }
- void cmd_w(uint8_t data);
- void param_w(uint8_t data);
+ DECLARE_READ8_MEMBER (sr_r);
+ DECLARE_READ8_MEMBER (rr_r);
+ DECLARE_WRITE8_MEMBER(reset_w) { if(data == 1) soft_reset(); }
+ DECLARE_WRITE8_MEMBER(cmd_w);
+ DECLARE_WRITE8_MEMBER(param_w);
void delay_cycles(emu_timer *tm, int cycles);
void set_drq(bool state);
diff --git a/src/devices/machine/idectrl.cpp b/src/devices/machine/idectrl.cpp
index 45f6ab6f703..b8ab541fc8d 100644
--- a/src/devices/machine/idectrl.cpp
+++ b/src/devices/machine/idectrl.cpp
@@ -222,7 +222,6 @@ DEFINE_DEVICE_TYPE(BUS_MASTER_IDE_CONTROLLER, bus_master_ide_controller_device,
bus_master_ide_controller_device::bus_master_ide_controller_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
ide_controller_32_device(mconfig, BUS_MASTER_IDE_CONTROLLER, tag, owner, clock),
- m_dma_space(*this, finder_base::DUMMY_TAG, -1, 32),
m_dma_address(0),
m_dma_bytes_left(0),
m_dma_descriptor(0),
@@ -240,7 +239,17 @@ void bus_master_ide_controller_device::device_start()
ide_controller_32_device::device_start();
/* find the bus master space */
- m_dma_address_xor = (m_dma_space->endianness() == ENDIANNESS_LITTLE) ? 0 : 3;
+ if (m_bmcpu != nullptr)
+ {
+ device_t *bmtarget = machine().device(m_bmcpu);
+ if (bmtarget == nullptr)
+ throw emu_fatalerror("IDE controller '%s' bus master target '%s' doesn't exist!", tag(), m_bmcpu);
+ device_memory_interface *memory;
+ if (!bmtarget->interface(memory))
+ throw emu_fatalerror("IDE controller '%s' bus master target '%s' has no memory!", tag(), m_bmcpu);
+ m_dma_space = &memory->space(m_bmspace);
+ m_dma_address_xor = (m_dma_space->endianness() == ENDIANNESS_LITTLE) ? 0 : 3;
+ }
save_item(NAME(m_dma_address));
save_item(NAME(m_dma_bytes_left));
diff --git a/src/devices/machine/idectrl.h b/src/devices/machine/idectrl.h
index c0e84e3c562..3a0886a5185 100644
--- a/src/devices/machine/idectrl.h
+++ b/src/devices/machine/idectrl.h
@@ -105,7 +105,7 @@ class bus_master_ide_controller_device : public ide_controller_32_device
{
public:
bus_master_ide_controller_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
- template <typename T> void set_bus_master_space(T &&bmtag, int bmspace) { m_dma_space.set_tag(std::forward<T>(bmtag), bmspace); }
+ void set_bus_master_space(const char *bmcpu, uint32_t bmspace) { m_bmcpu = bmcpu; m_bmspace = bmspace; }
template <typename T> bus_master_ide_controller_device &master(T &&opts, const char *dflt = nullptr, bool fixed = false)
{
@@ -140,7 +140,9 @@ protected:
private:
void execute_dma();
- required_address_space m_dma_space;
+ const char *m_bmcpu;
+ uint32_t m_bmspace;
+ address_space *m_dma_space;
uint8_t m_dma_address_xor;
offs_t m_dma_address;
diff --git a/src/devices/machine/idehd.cpp b/src/devices/machine/idehd.cpp
index 1f4be38d491..b9f6ddbbe70 100644
--- a/src/devices/machine/idehd.cpp
+++ b/src/devices/machine/idehd.cpp
@@ -869,7 +869,6 @@ uint8_t ide_hdd_device::calculate_status()
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void ide_hdd_device::device_add_mconfig(machine_config &config)
-{
- HARDDISK(config, "image");
-}
+MACHINE_CONFIG_START(ide_hdd_device::device_add_mconfig)
+ MCFG_HARDDISK_ADD( "image" )
+MACHINE_CONFIG_END
diff --git a/src/devices/machine/ie15.cpp b/src/devices/machine/ie15.cpp
index 65a71ae23c3..4f1a8a25bfc 100644
--- a/src/devices/machine/ie15.cpp
+++ b/src/devices/machine/ie15.cpp
@@ -568,25 +568,25 @@ static GFXDECODE_START( gfx_ie15 )
GFXDECODE_ENTRY("chargen", 0x0000, ie15_charlayout, 0, 1)
GFXDECODE_END
-void ie15_device::ie15core(machine_config &config)
-{
+MACHINE_CONFIG_START(ie15_device::ie15core)
/* Basic machine hardware */
- IE15_CPU(config, m_maincpu, XTAL(30'800'000)/10);
- m_maincpu->set_addrmap(AS_PROGRAM, &ie15_device::ie15_mem);
- m_maincpu->set_addrmap(AS_IO, &ie15_device::ie15_io);
+ MCFG_DEVICE_ADD("maincpu", IE15_CPU, XTAL(30'800'000)/10)
+ MCFG_DEVICE_PROGRAM_MAP(ie15_mem)
+ MCFG_DEVICE_IO_MAP(ie15_io)
config.set_default_layout(layout_ie15);
/* Devices */
- IE15_KEYBOARD(config, m_keyboard, 0).keyboard_cb().set(FUNC(ie15_device::kbd_put));
+ IE15_KEYBOARD(config, m_keyboard, 0)
+ .keyboard_cb().set(FUNC(ie15_device::kbd_put));
RS232_PORT(config, m_rs232, default_rs232_devices, "null_modem");
m_rs232->rxd_handler().set(FUNC(ie15_device::serial_rx_callback));
SPEAKER(config, "mono").front_center();
- BEEP(config, m_beeper, 2400);
- m_beeper->add_route(ALL_OUTPUTS, "mono", 0.15);
-}
+ MCFG_DEVICE_ADD("beeper", BEEP, 2400)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
+MACHINE_CONFIG_END
/* ROM definition */
ROM_START( ie15 )
@@ -603,20 +603,18 @@ ROM_START( ie15 )
ROM_LOAD("chargen-15ie.bin", 0x0000, 0x0800, CRC(ed16bf6b) SHA1(6af9fb75f5375943d5c0ce9ed408e0fb4621b17e))
ROM_END
-void ie15_device::device_add_mconfig(machine_config &config)
-{
- SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
- m_screen->set_color(rgb_t::green());
- m_screen->set_screen_update(FUNC(ie15_device::screen_update));
- m_screen->set_raw(XTAL(30'800'000)/2,
+MACHINE_CONFIG_START(ie15_device::device_add_mconfig)
+ MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::green())
+ MCFG_SCREEN_UPDATE_DRIVER(ie15_device, screen_update)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(30'800'000)/2,
IE15_TOTAL_HORZ, IE15_HORZ_START, IE15_HORZ_START+IE15_DISP_HORZ,
IE15_TOTAL_VERT, IE15_VERT_START, IE15_VERT_START+IE15_DISP_VERT);
ie15core(config);
- GFXDECODE(config, "gfxdecode", "palette", gfx_ie15);
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ie15)
PALETTE(config, "palette", palette_device::MONOCHROME);
-}
+MACHINE_CONFIG_END
ioport_constructor ie15_device::device_input_ports() const
{
diff --git a/src/devices/machine/ie15_kbd.cpp b/src/devices/machine/ie15_kbd.cpp
index 79a4bb86aad..13ee3ea5744 100644
--- a/src/devices/machine/ie15_kbd.cpp
+++ b/src/devices/machine/ie15_kbd.cpp
@@ -122,9 +122,8 @@ const tiny_rom_entry *ie15_keyboard_device::device_rom_region() const
return ROM_NAME( ie15_keyboard );
}
-void ie15_keyboard_device::device_add_mconfig(machine_config &config)
-{
-}
+MACHINE_CONFIG_START(ie15_keyboard_device::device_add_mconfig)
+MACHINE_CONFIG_END
void ie15_keyboard_device::device_start()
diff --git a/src/devices/machine/input_merger.h b/src/devices/machine/input_merger.h
index aa5e66cc1f1..53af1a38cfd 100644
--- a/src/devices/machine/input_merger.h
+++ b/src/devices/machine/input_merger.h
@@ -15,6 +15,27 @@
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_INPUT_MERGER_ANY_HIGH(_tag) \
+ MCFG_DEVICE_ADD(_tag, INPUT_MERGER_ANY_HIGH, 0)
+
+#define MCFG_INPUT_MERGER_ALL_HIGH(_tag) \
+ MCFG_DEVICE_ADD(_tag, INPUT_MERGER_ALL_HIGH, 0)
+
+#define MCFG_INPUT_MERGER_ANY_LOW(_tag) \
+ MCFG_DEVICE_ADD(_tag, INPUT_MERGER_ANY_LOW, 0)
+
+#define MCFG_INPUT_MERGER_ALL_LOW(_tag) \
+ MCFG_DEVICE_ADD(_tag, INPUT_MERGER_ALL_LOW, 0)
+
+#define MCFG_INPUT_MERGER_OUTPUT_HANDLER(_devcb) \
+ downcast<input_merger_device &>(*device).set_output_handler(DEVCB_##_devcb);
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -23,6 +44,7 @@ class input_merger_device : public device_t
{
public:
// callback
+ template <class Object> devcb_base &set_output_handler(Object &&cb) { return m_output_handler.set_callback(std::forward<Object>(cb)); }
auto output_handler() { return m_output_handler.bind(); }
// input lines
diff --git a/src/devices/machine/ins8154.cpp b/src/devices/machine/ins8154.cpp
index 11943cdee2c..8a134000f3f 100644
--- a/src/devices/machine/ins8154.cpp
+++ b/src/devices/machine/ins8154.cpp
@@ -1,24 +1,21 @@
// license:GPL-2.0+
// copyright-holders:Dirk Best
-/******************************************************************************
+/***************************************************************************
National Semiconductor INS8154
N-Channel 128-by-8 Bit RAM Input/Output (RAM I/O)
TODO: Strobed modes
- TODO: Check the ODRx register for where to get pin values, _cb() vs m_out_x
-*******************************************************************************/
+***************************************************************************/
#include "emu.h"
#include "ins8154.h"
-#define LOG_BITS (1U << 1)
-//#define VERBOSE (LOG_BITS) // (LOG_GENERAL|LOG_BITS)
+#define VERBOSE 1
#include "logmacro.h"
-#define LOGBITS(...) LOGMASKED(LOG_BITS, __VA_ARGS__)
/***************************************************************************
CONSTANTS
@@ -78,7 +75,6 @@ void ins8154_device::device_start()
save_item(NAME(m_mdr));
save_item(NAME(m_odra));
save_item(NAME(m_odrb));
- save_item(NAME(m_ram));
}
@@ -98,7 +94,7 @@ void ins8154_device::device_reset()
}
-uint8_t ins8154_device::read_io(offs_t offset)
+READ8_MEMBER(ins8154_device::ins8154_r)
{
uint8_t val = 0xff;
@@ -123,23 +119,17 @@ uint8_t ins8154_device::read_io(offs_t offset)
break;
default:
- val = 0;
- if (offset < 0x08) // Read a bit in Port A
+ if (offset < 0x08)
{
if (!m_in_a_cb.isnull())
- {
- //val = (m_in_a_cb(0) << (8 - offset)) & 0x80;
- val = (m_in_a_cb(0) & ~m_odra & (1 << (offset & 0x07))) ? 0x80 : 0x00;
- }
- LOGBITS("%s: INS8154 Port A read bit %02x: %02x\n", machine().describe_context(), offset & 0x07, val);
+ val = (m_in_a_cb(0) << (8 - offset)) & 0x80;
+ m_in_a = val;
}
- else // Read a bit in Port B
+ else
{
if (!m_in_b_cb.isnull())
- {
- val = (m_in_b_cb(0) & ~m_odrb & (1 << (offset & 0x07))) ? 0x80 : 0x00;
- }
- LOGBITS("%s: INS8154 Port B read bit %02x: %02x\n", machine().describe_context(), offset & 0x07, val);
+ val = (m_in_b_cb(0) << (8 - (offset >> 4))) & 0x80;
+ m_in_b = val;
}
break;
}
@@ -147,12 +137,7 @@ uint8_t ins8154_device::read_io(offs_t offset)
return val;
}
-uint8_t ins8154_device::read_ram(offs_t offset)
-{
- return m_ram[offset & 0x7f];
-}
-
-void ins8154_device::porta_w(uint8_t data)
+WRITE8_MEMBER(ins8154_device::ins8154_porta_w)
{
m_out_a = data;
@@ -161,9 +146,8 @@ void ins8154_device::porta_w(uint8_t data)
m_out_a_cb(offs_t(0), (data & m_odra) | (m_odra ^ 0xff));
}
-void ins8154_device::portb_w(uint8_t data)
+WRITE8_MEMBER(ins8154_device::ins8154_portb_w)
{
- LOG("%s: INS8154 Write PortB %02x with odrb: %02x\n", machine().describe_context(), data, m_odrb);
m_out_b = data;
/* Test if any pins are set as outputs */
@@ -171,7 +155,7 @@ void ins8154_device::portb_w(uint8_t data)
m_out_b_cb(offs_t(0), (data & m_odrb) | (m_odrb ^ 0xff));
}
-void ins8154_device::write_io(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ins8154_device::ins8154_w)
{
if (offset > 0x24)
{
@@ -182,11 +166,11 @@ void ins8154_device::write_io(offs_t offset, uint8_t data)
switch (offset)
{
case 0x20:
- porta_w(data);
+ ins8154_porta_w(space, 0, data);
break;
case 0x21:
- portb_w(data);
+ ins8154_portb_w(space, 0, data);
break;
case 0x22:
@@ -209,35 +193,18 @@ void ins8154_device::write_io(offs_t offset, uint8_t data)
{
/* Set bit */
if (offset < 0x08)
- {
- LOGBITS("%s: INS8154 Port A set bit %02x\n", machine().describe_context(), offset & 0x07);
- porta_w(m_out_a |= (1 << (offset & 0x07)));
- }
+ ins8154_porta_w(space, 0, m_out_a |= offset & 0x07);
else
- {
- LOGBITS("%s: INS8154 Port B set bit %02x\n", machine().describe_context(), offset & 0x07);
- portb_w(m_out_b |= (1 << (offset & 0x07)));
- }
+ ins8154_portb_w(space, 0, m_out_b |= (offset >> 4) & 0x07);
}
else
{
/* Clear bit */
if (offset < 0x08)
- {
- LOGBITS("%s: INS8154 Port A clear bit %02x\n", machine().describe_context(), offset & 0x07);
- porta_w(m_out_a & ~(1 << (offset & 0x07)));
- }
+ ins8154_porta_w(space, 0, m_out_a & ~(offset & 0x07));
else
- {
- LOGBITS("%s: INS8154 Port B clear bit %02x\n", machine().describe_context(), offset & 0x07);
- portb_w(m_out_b & ~(1 << (offset & 0x07)));
- }
+ ins8154_portb_w(space, 0, m_out_b & ~((offset >> 4) & 0x07));
}
break;
}
}
-
-void ins8154_device::write_ram(offs_t offset, uint8_t data)
-{
- m_ram[offset & 0x7f] = data;
-}
diff --git a/src/devices/machine/ins8154.h b/src/devices/machine/ins8154.h
index 2ce40ec9e70..5ba94ab9cda 100644
--- a/src/devices/machine/ins8154.h
+++ b/src/devices/machine/ins8154.h
@@ -47,13 +47,11 @@ public:
auto out_b() { return m_out_b_cb.bind(); }
auto out_irq() { return m_out_irq_cb.bind(); }
- uint8_t read_io(offs_t offset);
- void write_io(offs_t offset, uint8_t data);
- uint8_t read_ram(offs_t offset);
- void write_ram(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( ins8154_r );
+ DECLARE_WRITE8_MEMBER( ins8154_w );
- void porta_w(uint8_t data);
- void portb_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( ins8154_porta_w );
+ DECLARE_WRITE8_MEMBER( ins8154_portb_w );
protected:
// device-level overrides
@@ -79,9 +77,6 @@ private:
uint8_t m_mdr; /* Mode Definition Register */
uint8_t m_odra; /* Output Definition Register Port A */
uint8_t m_odrb; /* Output Definition Register Port B */
-
- /* on-board RAM */
- uint8_t m_ram[0x80];
};
diff --git a/src/devices/machine/ins8250.cpp b/src/devices/machine/ins8250.cpp
index d127ce0e40d..88262cdbac2 100644
--- a/src/devices/machine/ins8250.cpp
+++ b/src/devices/machine/ins8250.cpp
@@ -390,8 +390,6 @@ WRITE8_MEMBER( ins8250_uart_device::ins8250_w )
if ( m_regs.msr & 0x0f )
trigger_int(COM_INT_PENDING_MODEM_STATUS_REGISTER);
- else
- clear_int(COM_INT_PENDING_MODEM_STATUS_REGISTER);
break;
case 7:
m_regs.scr = data;
diff --git a/src/devices/machine/intelfsh.h b/src/devices/machine/intelfsh.h
index edaa23d69f6..7dcf9f7e173 100644
--- a/src/devices/machine/intelfsh.h
+++ b/src/devices/machine/intelfsh.h
@@ -102,8 +102,8 @@ class intelfsh8_device : public intelfsh_device
{
public:
// public interface
- uint8_t read(offs_t offset) { return read_full(offset); }
- void write(offs_t offset, uint8_t data) { write_full(offset, data); }
+ DECLARE_READ8_MEMBER(read) { return read_full(offset); }
+ DECLARE_WRITE8_MEMBER(write) { write_full(offset, data); }
uint8_t read_raw(offs_t offset) { return m_data[offset]; }
void write_raw(offs_t offset, uint8_t data) { m_data[offset] = data; }
@@ -120,8 +120,8 @@ class intelfsh16_device : public intelfsh_device
{
public:
// public interface
- uint16_t read(offs_t offset) { return read_full(offset); }
- void write(offs_t offset, uint16_t data) { write_full(offset, data); }
+ DECLARE_READ16_MEMBER(read) { return read_full(offset); }
+ DECLARE_WRITE16_MEMBER(write) { write_full(offset, data); }
uint16_t read_raw(offs_t offset) { return m_data[offset*2] | (m_data[offset*2+1] << 8); }
void write_raw(offs_t offset, uint16_t data) { m_data[offset*2] = data; m_data[offset*2+1] = data >> 8; }
diff --git a/src/devices/machine/k054321.cpp b/src/devices/machine/k054321.cpp
index 592bc74582a..21e02e9042f 100644
--- a/src/devices/machine/k054321.cpp
+++ b/src/devices/machine/k054321.cpp
@@ -11,7 +11,7 @@
/*
The 054321 is a sound communication latch/volume manager chip, that
- is integrated into the 054544 and 054986A hybrid chips. The hybrid
+ is integrated into the 054544 and 05489A hybrid chips. The hybrid
chips also include the DACs, capacitors, etc needed for the audio
output.
diff --git a/src/devices/machine/keyboard.cpp b/src/devices/machine/keyboard.cpp
index 52502597227..03e73f3ac05 100644
--- a/src/devices/machine/keyboard.cpp
+++ b/src/devices/machine/keyboard.cpp
@@ -9,10 +9,10 @@ or for the case of a computer with an inbuilt (not serial) ascii keyboard.
Example of usage in a driver.
-In the machine config function:
+In MACHINE_CONFIG
- generic_keyboard_device &kbd(GENERIC_KEYBOARD(config, KEYBOARD_TAG, 0));
- kbd.set_keyboard_callback(FUNC(xxx_state::kbd_put));
+ MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0)
+ MCFG_GENERIC_KEYBOARD_CB(WRITE8(*this, xxx_state, kbd_put))
In the code:
diff --git a/src/devices/machine/ldp1000.h b/src/devices/machine/ldp1000.h
index b3f420afb6e..1f3140f14e8 100644
--- a/src/devices/machine/ldp1000.h
+++ b/src/devices/machine/ldp1000.h
@@ -15,6 +15,13 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_LASERDISC_LDP1000_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, SONY_LDP1000, 0)
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/devices/machine/ldp1450.h b/src/devices/machine/ldp1450.h
index 67a429845e1..3ef9fab0939 100644
--- a/src/devices/machine/ldp1450.h
+++ b/src/devices/machine/ldp1450.h
@@ -15,6 +15,13 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_LASERDISC_LDP1450_ADD(_tag, clock) \
+ MCFG_DEVICE_ADD(_tag, SONY_LDP1450, clock)
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/devices/machine/ldpr8210.h b/src/devices/machine/ldpr8210.h
index fc0a28d6d26..f142229314c 100644
--- a/src/devices/machine/ldpr8210.h
+++ b/src/devices/machine/ldpr8210.h
@@ -23,6 +23,8 @@
#define MCFG_LASERDISC_PR8210_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, PIONEER_PR8210, 0)
+#define MCFG_LASERDISC_SIMUTREK_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, SIMUTREK_SPECIAL, 0)
//**************************************************************************
diff --git a/src/devices/machine/ldstub.cpp b/src/devices/machine/ldstub.cpp
index c0c9a7ac05a..9d3dab58ce3 100644
--- a/src/devices/machine/ldstub.cpp
+++ b/src/devices/machine/ldstub.cpp
@@ -17,8 +17,8 @@
//**************************************************************************
// device type definition
-DEFINE_DEVICE_TYPE(PIONEER_PR7820, pioneer_pr7820_device, "pr7820", "Pioneer PR-7820")
-DEFINE_DEVICE_TYPE(PHILIPS_22VP932, philips_22vp932_device, "22vp932", "Philips 22VP932")
+DEFINE_DEVICE_TYPE(PIONEER_PR7820, pioneer_pr7820_device, "pr7820", "Pioneer PR-7820")
+DEFINE_DEVICE_TYPE(PHILLIPS_22VP932, phillips_22vp932_device, "22vp932", "Phillips 22VP932")
pioneer_pr7820_device::pioneer_pr7820_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
@@ -27,7 +27,7 @@ pioneer_pr7820_device::pioneer_pr7820_device(const machine_config &mconfig, cons
}
-philips_22vp932_device::philips_22vp932_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : laserdisc_device(mconfig, PHILIPS_22VP932, tag, owner, clock)
+phillips_22vp932_device::phillips_22vp932_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : laserdisc_device(mconfig, PHILLIPS_22VP932, tag, owner, clock)
{
}
diff --git a/src/devices/machine/ldstub.h b/src/devices/machine/ldstub.h
index 9fbc756b240..4bf463b897d 100644
--- a/src/devices/machine/ldstub.h
+++ b/src/devices/machine/ldstub.h
@@ -17,12 +17,23 @@
//**************************************************************************
+// DEVICE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_LASERDISC_PR7820_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, PIONEER_PR7820, 0)
+#define MCFG_LASERDISC_22VP932_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, PHILLIPS_22VP932, 0)
+
+
+//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
// device type definition
-DECLARE_DEVICE_TYPE(PIONEER_PR7820, pioneer_pr7820_device)
-DECLARE_DEVICE_TYPE(PHILIPS_22VP932, philips_22vp932_device)
+DECLARE_DEVICE_TYPE(PIONEER_PR7820, pioneer_pr7820_device)
+DECLARE_DEVICE_TYPE(PHILLIPS_22VP932, phillips_22vp932_device)
+
//**************************************************************************
@@ -52,13 +63,13 @@ protected:
};
-// ======================> philips_22vp932_device
+// ======================> phillips_22vp932_device
-class philips_22vp932_device : public laserdisc_device
+class phillips_22vp932_device : public laserdisc_device
{
public:
// construction/destruction
- philips_22vp932_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ phillips_22vp932_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// input/output
uint8_t data_r() { return 0; }
diff --git a/src/devices/machine/ldv1000.cpp b/src/devices/machine/ldv1000.cpp
index 4f7a0196e40..4a9b1295b75 100644
--- a/src/devices/machine/ldv1000.cpp
+++ b/src/devices/machine/ldv1000.cpp
@@ -272,8 +272,7 @@ const tiny_rom_entry *pioneer_ldv1000_device::device_rom_region() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void pioneer_ldv1000_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(pioneer_ldv1000_device::device_add_mconfig)
Z80(config, m_z80_cpu, XTAL(5'000'000)/2);
m_z80_cpu->set_daisy_config(daisy_chain);
m_z80_cpu->set_addrmap(AS_PROGRAM, &pioneer_ldv1000_device::ldv1000_map);
@@ -292,7 +291,7 @@ void pioneer_ldv1000_device::device_add_mconfig(machine_config &config)
ldvppi1.in_pa_callback().set(FUNC(pioneer_ldv1000_device::ppi1_porta_r));
ldvppi1.out_pb_callback().set(FUNC(pioneer_ldv1000_device::ppi1_portb_w));
ldvppi1.out_pc_callback().set(FUNC(pioneer_ldv1000_device::ppi1_portc_w));
-}
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/machine/ldv1000.h b/src/devices/machine/ldv1000.h
index 55516da36fe..661d0a44f0b 100644
--- a/src/devices/machine/ldv1000.h
+++ b/src/devices/machine/ldv1000.h
@@ -26,6 +26,10 @@
#define MCFG_LASERDISC_LDV1000_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, PIONEER_LDV1000, 0)
+#define MCFG_LASERDISC_LDV1000_COMMAND_STROBE_CB(_cb) \
+ downcast<pioneer_ldv1000_device *>(device)->set_command_strobe_callback(DEVCB_##_cb);
+
+
//**************************************************************************
// GLOBAL VARIABLES
@@ -49,7 +53,7 @@ public:
// construction/destruction
pioneer_ldv1000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto command_strobe_callback() { return m_command_strobe_cb.bind(); }
+ template <class cmd_strobe_cb> devcb_base &set_command_strobe_callback(cmd_strobe_cb &&latch) { return m_command_strobe_cb.set_callback(std::forward<cmd_strobe_cb>(latch)); }
// input and output
void data_w(uint8_t data);
diff --git a/src/devices/machine/ldvp931.cpp b/src/devices/machine/ldvp931.cpp
index 4bcb74e1b6a..7a688736a93 100644
--- a/src/devices/machine/ldvp931.cpp
+++ b/src/devices/machine/ldvp931.cpp
@@ -45,7 +45,7 @@
//**************************************************************************
// devices
-DEFINE_DEVICE_TYPE(PHILIPS_22VP931, philips_22vp931_device, "22vp931", "Philips 22VP931")
+DEFINE_DEVICE_TYPE(PHILLIPS_22VP931, phillips_22vp931_device, "22vp931", "Phillips 22VP931")
@@ -53,12 +53,12 @@ DEFINE_DEVICE_TYPE(PHILIPS_22VP931, philips_22vp931_device, "22vp931", "Philips
// 22VP931 ROM AND MACHINE INTERFACES
//**************************************************************************
-void philips_22vp931_device::vp931_portmap(address_map &map)
+void phillips_22vp931_device::vp931_portmap(address_map &map)
{
- map(0x00, 0x00).mirror(0xcf).rw(FUNC(philips_22vp931_device::i8049_keypad_r), FUNC(philips_22vp931_device::i8049_output0_w));
- map(0x10, 0x10).mirror(0xcf).rw(FUNC(philips_22vp931_device::i8049_unknown_r), FUNC(philips_22vp931_device::i8049_output1_w));
- map(0x20, 0x20).mirror(0xcf).rw(FUNC(philips_22vp931_device::i8049_datic_r), FUNC(philips_22vp931_device::i8049_lcd_w));
- map(0x30, 0x30).mirror(0xcf).rw(FUNC(philips_22vp931_device::i8049_from_controller_r), FUNC(philips_22vp931_device::i8049_to_controller_w));
+ map(0x00, 0x00).mirror(0xcf).rw(FUNC(phillips_22vp931_device::i8049_keypad_r), FUNC(phillips_22vp931_device::i8049_output0_w));
+ map(0x10, 0x10).mirror(0xcf).rw(FUNC(phillips_22vp931_device::i8049_unknown_r), FUNC(phillips_22vp931_device::i8049_output1_w));
+ map(0x20, 0x20).mirror(0xcf).rw(FUNC(phillips_22vp931_device::i8049_datic_r), FUNC(phillips_22vp931_device::i8049_lcd_w));
+ map(0x30, 0x30).mirror(0xcf).rw(FUNC(phillips_22vp931_device::i8049_from_controller_r), FUNC(phillips_22vp931_device::i8049_to_controller_w));
}
@@ -70,15 +70,15 @@ ROM_END
//**************************************************************************
-// PHILIPS 22VP931 IMPLEMENTATION
+// PHILLIPS 22VP931 IMPLEMENTATION
//**************************************************************************
//-------------------------------------------------
-// philips_22vp931_device - constructor
+// phillips_22vp931_device - constructor
//-------------------------------------------------
-philips_22vp931_device::philips_22vp931_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : laserdisc_device(mconfig, PHILIPS_22VP931, tag, owner, clock),
+phillips_22vp931_device::phillips_22vp931_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : laserdisc_device(mconfig, PHILLIPS_22VP931, tag, owner, clock),
m_i8049_cpu(*this, "vp931"),
m_tracktimer(nullptr),
m_i8049_out0(0),
@@ -103,7 +103,7 @@ philips_22vp931_device::philips_22vp931_device(const machine_config &mconfig, co
// reset_w - write to the reset line
//-------------------------------------------------
-void philips_22vp931_device::reset_w(uint8_t data)
+void phillips_22vp931_device::reset_w(uint8_t data)
{
// control the CPU state
m_i8049_cpu->set_input_line(INPUT_LINE_RESET, data);
@@ -119,7 +119,7 @@ void philips_22vp931_device::reset_w(uint8_t data)
// 22VP931
//-------------------------------------------------
-uint8_t philips_22vp931_device::data_r()
+uint8_t phillips_22vp931_device::data_r()
{
// if data is pending, clear the pending flag and notify any callbacks
if (m_tocontroller_pending)
@@ -139,7 +139,7 @@ uint8_t philips_22vp931_device::data_r()
// device_start - device initialization
//-------------------------------------------------
-void philips_22vp931_device::device_start()
+void phillips_22vp931_device::device_start()
{
// pass through to the parent
laserdisc_device::device_start();
@@ -153,7 +153,7 @@ void philips_22vp931_device::device_start()
// device_reset - device reset
//-------------------------------------------------
-void philips_22vp931_device::device_reset()
+void phillips_22vp931_device::device_reset()
{
// pass through to the parent
laserdisc_device::device_reset();
@@ -185,7 +185,7 @@ void philips_22vp931_device::device_reset()
// device
//-------------------------------------------------
-void philips_22vp931_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+void phillips_22vp931_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
@@ -276,7 +276,7 @@ void philips_22vp931_device::device_timer(emu_timer &timer, device_timer_id id,
// ROM region definitions
//-------------------------------------------------
-const tiny_rom_entry *philips_22vp931_device::device_rom_region() const
+const tiny_rom_entry *phillips_22vp931_device::device_rom_region() const
{
return ROM_NAME(vp931);
}
@@ -286,16 +286,16 @@ const tiny_rom_entry *philips_22vp931_device::device_rom_region() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void philips_22vp931_device::device_add_mconfig(machine_config &config)
+void phillips_22vp931_device::device_add_mconfig(machine_config &config)
{
I8049(config, m_i8049_cpu, XTAL(11'000'000));
- m_i8049_cpu->set_addrmap(AS_IO, &philips_22vp931_device::vp931_portmap);
- m_i8049_cpu->p1_in_cb().set(FUNC(philips_22vp931_device::i8049_port1_r));
- m_i8049_cpu->p1_out_cb().set(FUNC(philips_22vp931_device::i8049_port1_w));
- m_i8049_cpu->p2_in_cb().set(FUNC(philips_22vp931_device::i8049_port2_r));
- m_i8049_cpu->p2_out_cb().set(FUNC(philips_22vp931_device::i8049_port2_w));
- m_i8049_cpu->t0_in_cb().set(FUNC(philips_22vp931_device::i8049_t0_r));
- m_i8049_cpu->t1_in_cb().set(FUNC(philips_22vp931_device::i8049_t1_r));
+ m_i8049_cpu->set_addrmap(AS_IO, &phillips_22vp931_device::vp931_portmap);
+ m_i8049_cpu->p1_in_cb().set(FUNC(phillips_22vp931_device::i8049_port1_r));
+ m_i8049_cpu->p1_out_cb().set(FUNC(phillips_22vp931_device::i8049_port1_w));
+ m_i8049_cpu->p2_in_cb().set(FUNC(phillips_22vp931_device::i8049_port2_r));
+ m_i8049_cpu->p2_out_cb().set(FUNC(phillips_22vp931_device::i8049_port2_w));
+ m_i8049_cpu->t0_in_cb().set(FUNC(phillips_22vp931_device::i8049_t0_r));
+ m_i8049_cpu->t1_in_cb().set(FUNC(phillips_22vp931_device::i8049_t1_r));
}
@@ -304,7 +304,7 @@ void philips_22vp931_device::device_add_mconfig(machine_config &config)
// start of the blanking period
//-------------------------------------------------
-void philips_22vp931_device::player_vsync(const vbi_metadata &vbi, int fieldnum, const attotime &curtime)
+void phillips_22vp931_device::player_vsync(const vbi_metadata &vbi, int fieldnum, const attotime &curtime)
{
// reset our command counter (debugging only)
m_cmdcount = 0;
@@ -320,7 +320,7 @@ void philips_22vp931_device::player_vsync(const vbi_metadata &vbi, int fieldnum,
// the first visible line of the frame
//-------------------------------------------------
-int32_t philips_22vp931_device::player_update(const vbi_metadata &vbi, int fieldnum, const attotime &curtime)
+int32_t phillips_22vp931_device::player_update(const vbi_metadata &vbi, int fieldnum, const attotime &curtime)
{
// set the first VBI timer to go at the start of line 16
timer_set(screen().time_until_pos(16*2), TID_VBI_DATA_FETCH, LASERDISC_CODE_LINE16 << 2);
@@ -335,7 +335,7 @@ int32_t philips_22vp931_device::player_update(const vbi_metadata &vbi, int field
// and other bits
//-------------------------------------------------
-WRITE8_MEMBER( philips_22vp931_device::i8049_output0_w )
+WRITE8_MEMBER( phillips_22vp931_device::i8049_output0_w )
{
/*
$80 = n/c
@@ -374,7 +374,7 @@ WRITE8_MEMBER( philips_22vp931_device::i8049_output0_w )
// i8049_output1_w - controls scanning behaviors
//-------------------------------------------------
-WRITE8_MEMBER( philips_22vp931_device::i8049_output1_w )
+WRITE8_MEMBER( phillips_22vp931_device::i8049_output1_w )
{
/*
$80 = n/c
@@ -418,7 +418,7 @@ WRITE8_MEMBER( philips_22vp931_device::i8049_output1_w )
// i8049_lcd_w - vestigial LCD frame display
//-------------------------------------------------
-WRITE8_MEMBER( philips_22vp931_device::i8049_lcd_w )
+WRITE8_MEMBER( phillips_22vp931_device::i8049_lcd_w )
{
/*
Frame number is written as 5 digits here; however, it is not actually
@@ -431,7 +431,7 @@ WRITE8_MEMBER( philips_22vp931_device::i8049_lcd_w )
// i8049_unknown_r - unknown input port
//-------------------------------------------------
-READ8_MEMBER( philips_22vp931_device::i8049_unknown_r )
+READ8_MEMBER( phillips_22vp931_device::i8049_unknown_r )
{
// only bit $80 is checked and its effects are minor
return 0x00;
@@ -443,7 +443,7 @@ READ8_MEMBER( philips_22vp931_device::i8049_unknown_r )
// controls
//-------------------------------------------------
-READ8_MEMBER( philips_22vp931_device::i8049_keypad_r )
+READ8_MEMBER( phillips_22vp931_device::i8049_keypad_r )
{
/*
From the code, this is apparently a vestigial keypad with basic controls:
@@ -465,7 +465,7 @@ READ8_MEMBER( philips_22vp931_device::i8049_keypad_r )
// DATIC circuit
//-------------------------------------------------
-READ8_MEMBER( philips_22vp931_device::i8049_datic_r )
+READ8_MEMBER( phillips_22vp931_device::i8049_datic_r )
{
return m_daticval;
}
@@ -476,7 +476,7 @@ READ8_MEMBER( philips_22vp931_device::i8049_datic_r )
// external controller wrote
//-------------------------------------------------
-READ8_MEMBER( philips_22vp931_device::i8049_from_controller_r )
+READ8_MEMBER( phillips_22vp931_device::i8049_from_controller_r )
{
// clear the pending flag and return the data
m_fromcontroller_pending = false;
@@ -489,7 +489,7 @@ READ8_MEMBER( philips_22vp931_device::i8049_from_controller_r )
// the external controller
//-------------------------------------------------
-WRITE8_MEMBER( philips_22vp931_device::i8049_to_controller_w )
+WRITE8_MEMBER( phillips_22vp931_device::i8049_to_controller_w )
{
// set the pending flag and stash the data
m_tocontroller_pending = true;
@@ -508,7 +508,7 @@ WRITE8_MEMBER( philips_22vp931_device::i8049_to_controller_w )
// i8049_port1_r - read the 8048 I/O port 1
//-------------------------------------------------
-READ8_MEMBER( philips_22vp931_device::i8049_port1_r )
+READ8_MEMBER( phillips_22vp931_device::i8049_port1_r )
{
/*
$80 = P17 = (in) unsure
@@ -527,7 +527,7 @@ READ8_MEMBER( philips_22vp931_device::i8049_port1_r )
// i8049_port1_w - write the 8048 I/O port 1
//-------------------------------------------------
-WRITE8_MEMBER( philips_22vp931_device::i8049_port1_w )
+WRITE8_MEMBER( phillips_22vp931_device::i8049_port1_w )
{
/*
$10 = P14 = (out) D104 -> /SPEED
@@ -598,7 +598,7 @@ WRITE8_MEMBER( philips_22vp931_device::i8049_port1_w )
// i8049_port2_r - read from the 8048 I/O port 2
//-------------------------------------------------
-READ8_MEMBER( philips_22vp931_device::i8049_port2_r )
+READ8_MEMBER( phillips_22vp931_device::i8049_port2_r )
{
/*
$80 = P27 = (in) set/reset latch; set by FOC LS, reset by IGR
@@ -619,7 +619,7 @@ READ8_MEMBER( philips_22vp931_device::i8049_port2_r )
// i8049_port2_w - write the 8048 I/O port 2
//-------------------------------------------------
-WRITE8_MEMBER( philips_22vp931_device::i8049_port2_w )
+WRITE8_MEMBER( phillips_22vp931_device::i8049_port2_w )
{
/*
$40 = P26 = (out) cleared while data is sent back & forth; set afterwards
@@ -633,7 +633,7 @@ WRITE8_MEMBER( philips_22vp931_device::i8049_port2_w )
// connected to the DATIC's data strobe line
//-------------------------------------------------
-READ_LINE_MEMBER( philips_22vp931_device::i8049_t0_r )
+READ_LINE_MEMBER( phillips_22vp931_device::i8049_t0_r )
{
return m_datastrobe;
}
@@ -645,7 +645,7 @@ READ_LINE_MEMBER( philips_22vp931_device::i8049_t0_r )
// to count the number of tracks advanced
//-------------------------------------------------
-READ_LINE_MEMBER( philips_22vp931_device::i8049_t1_r )
+READ_LINE_MEMBER( phillips_22vp931_device::i8049_t1_r )
{
return m_trackstate;
}
diff --git a/src/devices/machine/ldvp931.h b/src/devices/machine/ldvp931.h
index fd69f52429e..0bf2e263558 100644
--- a/src/devices/machine/ldvp931.h
+++ b/src/devices/machine/ldvp931.h
@@ -18,11 +18,19 @@
//**************************************************************************
+// DEVICE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_LASERDISC_22VP931_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, PHILLIPS_22VP931, 0)
+
+
+//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
// device type definition
-DECLARE_DEVICE_TYPE(PHILIPS_22VP931, philips_22vp931_device)
+DECLARE_DEVICE_TYPE(PHILLIPS_22VP931, phillips_22vp931_device)
@@ -30,17 +38,17 @@ DECLARE_DEVICE_TYPE(PHILIPS_22VP931, philips_22vp931_device)
// TYPE DEFINITIONS
//**************************************************************************
-// ======================> philips_22vp931_device
+// ======================> phillips_22vp931_device
// base _22vp931 class
-class philips_22vp931_device : public laserdisc_device
+class phillips_22vp931_device : public laserdisc_device
{
public:
// types
- typedef delegate<void (philips_22vp931_device &, int)> data_ready_delegate;
+ typedef delegate<void (phillips_22vp931_device &, int)> data_ready_delegate;
// construction/destruction
- philips_22vp931_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ phillips_22vp931_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// input and output
void data_w(uint8_t data) { synchronize(TID_DEFERRED_DATA, data); }
diff --git a/src/devices/machine/legscsi.h b/src/devices/machine/legscsi.h
index 229580bc0bf..fee1b333061 100644
--- a/src/devices/machine/legscsi.h
+++ b/src/devices/machine/legscsi.h
@@ -7,6 +7,8 @@
#include "bus/scsi/scsihle.h"
+#define MCFG_LEGACY_SCSI_PORT(_tag) \
+ downcast<legacy_scsi_host_adapter &>(*device).set_scsi_port(_tag);
class legacy_scsi_host_adapter : public device_t
{
diff --git a/src/devices/machine/mb8421.cpp b/src/devices/machine/mb8421.cpp
index e6344843f92..a5b08f5ea90 100644
--- a/src/devices/machine/mb8421.cpp
+++ b/src/devices/machine/mb8421.cpp
@@ -129,14 +129,14 @@ void mb8421_master_device::update_intr(offs_t offset)
// (write to 7FF asserts INTR)
//-------------------------------------------------
-void mb8421_device::left_w(offs_t offset, u8 data)
+WRITE8_MEMBER(mb8421_device::left_w)
{
offset &= 0x7ff;
m_ram[offset] = data;
update_intr<read_or_write::WRITE, false>(offset);
}
-void mb8421_mb8431_16_device::left_w(offs_t offset, u16 data, u16 mem_mask)
+WRITE16_MEMBER(mb8421_mb8431_16_device::left_w)
{
offset &= 0x7ff;
COMBINE_DATA(&m_ram[offset]);
@@ -148,14 +148,14 @@ void mb8421_mb8431_16_device::left_w(offs_t offset, u16 data, u16 mem_mask)
// (read from 7FE acknowledges INTL)
//-------------------------------------------------
-u8 mb8421_device::left_r(offs_t offset)
+READ8_MEMBER(mb8421_device::left_r)
{
offset &= 0x7ff;
update_intr<read_or_write::READ, false>(offset);
return m_ram[offset];
}
-u16 mb8421_mb8431_16_device::left_r(offs_t offset, u16 mem_mask)
+READ16_MEMBER(mb8421_mb8431_16_device::left_r)
{
offset &= 0x7ff;
update_intr<read_or_write::READ, false>(offset);
@@ -167,14 +167,14 @@ u16 mb8421_mb8431_16_device::left_r(offs_t offset, u16 mem_mask)
// (write to 7FE asserts INTL)
//-------------------------------------------------
-void mb8421_device::right_w(offs_t offset, u8 data)
+WRITE8_MEMBER(mb8421_device::right_w)
{
offset &= 0x7ff;
m_ram[offset] = data;
update_intr<read_or_write::WRITE, true>(offset);
}
-void mb8421_mb8431_16_device::right_w(offs_t offset, u16 data, u16 mem_mask)
+WRITE16_MEMBER(mb8421_mb8431_16_device::right_w)
{
offset &= 0x7ff;
COMBINE_DATA(&m_ram[offset]);
@@ -186,14 +186,14 @@ void mb8421_mb8431_16_device::right_w(offs_t offset, u16 data, u16 mem_mask)
// (read from 7FF acknowledges INTR)
//-------------------------------------------------
-u8 mb8421_device::right_r(offs_t offset)
+READ8_MEMBER(mb8421_device::right_r)
{
offset &= 0x7ff;
update_intr<read_or_write::READ, true>(offset);
return m_ram[offset];
}
-u16 mb8421_mb8431_16_device::right_r(offs_t offset, u16 mem_mask)
+READ16_MEMBER(mb8421_mb8431_16_device::right_r)
{
offset &= 0x7ff;
update_intr<read_or_write::READ, true>(offset);
diff --git a/src/devices/machine/mb8421.h b/src/devices/machine/mb8421.h
index 00e8f8d207f..4ef0a010c9b 100644
--- a/src/devices/machine/mb8421.h
+++ b/src/devices/machine/mb8421.h
@@ -108,10 +108,10 @@ public:
u8 peek(offs_t offset) const { return m_ram[offset & 0x7ff]; }
- void left_w(offs_t offset, u8 data);
- u8 left_r(offs_t offset);
- void right_w(offs_t offset, u8 data);
- u8 right_r(offs_t offset);
+ DECLARE_WRITE8_MEMBER(left_w);
+ DECLARE_READ8_MEMBER(left_r);
+ DECLARE_WRITE8_MEMBER(right_w);
+ DECLARE_READ8_MEMBER(right_r);
protected:
mb8421_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
@@ -140,10 +140,10 @@ public:
u16 peek(offs_t offset) const { return m_ram[offset & 0x7ff]; }
- void left_w(offs_t offset, u16 data, u16 mem_mask = 0xffff);
- u16 left_r(offs_t offset, u16 mem_mask = 0xffff);
- void right_w(offs_t offset, u16 data, u16 mem_mask = 0xffff);
- u16 right_r(offs_t offset, u16 mem_mask = 0xffff);
+ DECLARE_WRITE16_MEMBER(left_w);
+ DECLARE_READ16_MEMBER(left_r);
+ DECLARE_WRITE16_MEMBER(right_w);
+ DECLARE_READ16_MEMBER(right_r);
protected:
// device-level overrides
diff --git a/src/devices/machine/mc146818.cpp b/src/devices/machine/mc146818.cpp
index 1259e1502ca..990d6f3ec35 100644
--- a/src/devices/machine/mc146818.cpp
+++ b/src/devices/machine/mc146818.cpp
@@ -510,7 +510,7 @@ void mc146818_device::update_irq()
// read - I/O handler for reading
//-------------------------------------------------
-uint8_t mc146818_device::read(offs_t offset)
+READ8_MEMBER( mc146818_device::read )
{
uint8_t data = 0;
switch (offset)
@@ -520,14 +520,14 @@ uint8_t mc146818_device::read(offs_t offset)
break;
case 1:
- data = read_direct(m_index);
+ data = read_direct(space, m_index);
break;
}
return data;
}
-uint8_t mc146818_device::read_direct(offs_t offset)
+READ8_MEMBER( mc146818_device::read_direct )
{
uint8_t data = 0;
@@ -569,7 +569,7 @@ uint8_t mc146818_device::read_direct(offs_t offset)
// write - I/O handler for writing
//-------------------------------------------------
-void mc146818_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mc146818_device::write )
{
switch (offset)
{
@@ -578,12 +578,12 @@ void mc146818_device::write(offs_t offset, uint8_t data)
break;
case 1:
- write_direct(m_index, data);
+ write_direct(space, m_index, data);
break;
}
}
-void mc146818_device::write_direct(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mc146818_device::write_direct )
{
LOG("mc146818_port_w(): offset=0x%02x data=0x%02x\n", offset, data);
diff --git a/src/devices/machine/mc146818.h b/src/devices/machine/mc146818.h
index b1431964dde..499698a84cd 100644
--- a/src/devices/machine/mc146818.h
+++ b/src/devices/machine/mc146818.h
@@ -39,12 +39,12 @@ public:
void set_binary_year(int bin) { m_binyear = bin; }
// read/write access
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
// direct-mapped read/write access
- uint8_t read_direct(offs_t offset);
- void write_direct(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read_direct );
+ DECLARE_WRITE8_MEMBER( write_direct );
protected:
mc146818_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/machine/mc6843.h b/src/devices/machine/mc6843.h
index 63052970edb..29f3b862bda 100644
--- a/src/devices/machine/mc6843.h
+++ b/src/devices/machine/mc6843.h
@@ -15,6 +15,8 @@
#include "imagedev/flopdrv.h"
+#define MCFG_MC6843_IRQ_CALLBACK(_write) \
+ downcast<mc6843_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
class mc6843_device : public device_t
{
diff --git a/src/devices/machine/mc6852.cpp b/src/devices/machine/mc6852.cpp
index 6d5a9876153..d2021a450a2 100644
--- a/src/devices/machine/mc6852.cpp
+++ b/src/devices/machine/mc6852.cpp
@@ -147,7 +147,7 @@ void mc6852_device::rcv_complete()
// read -
//-------------------------------------------------
-uint8_t mc6852_device::read(offs_t offset)
+READ8_MEMBER( mc6852_device::read )
{
uint8_t data = 0;
@@ -156,8 +156,7 @@ uint8_t mc6852_device::read(offs_t offset)
if (m_rx_fifo.size() > 0)
{
data = m_rx_fifo.front();
- if (!machine().side_effects_disabled())
- m_rx_fifo.pop();
+ m_rx_fifo.pop();
}
}
else
@@ -173,7 +172,7 @@ uint8_t mc6852_device::read(offs_t offset)
// write -
//-------------------------------------------------
-void mc6852_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mc6852_device::write )
{
if (BIT(offset, 0))
{
diff --git a/src/devices/machine/mc6852.h b/src/devices/machine/mc6852.h
index 3f05182ed6f..798529db3ef 100644
--- a/src/devices/machine/mc6852.h
+++ b/src/devices/machine/mc6852.h
@@ -32,6 +32,30 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MC6852_RX_CLOCK(_clock) \
+ downcast<mc6852_device &>(*device).set_rx_clock(_clock);
+
+#define MCFG_MC6852_TX_CLOCK(_clock) \
+ downcast<mc6852_device &>(*device).set_tx_clock(_clock);
+
+#define MCFG_MC6852_TX_DATA_CALLBACK(_write) \
+ downcast<mc6852_device &>(*device).set_tx_data_wr_callback(DEVCB_##_write);
+
+#define MCFG_MC6852_IRQ_CALLBACK(_write) \
+ downcast<mc6852_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
+
+#define MCFG_MC6852_SM_DTR_CALLBACK(_write) \
+ downcast<mc6852_device &>(*device).set_sm_dtr_wr_callback(DEVCB_##_write);
+
+#define MCFG_MC6852_TUF_CALLBACK(_write) \
+ downcast<mc6852_device &>(*device).set_tuf_wr_callback(DEVCB_##_write);
+
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -46,14 +70,18 @@ public:
void set_rx_clock(int clock) { m_rx_clock = clock; }
void set_tx_clock(int clock) { m_tx_clock = clock; }
+ template <class Object> devcb_base &set_tx_data_wr_callback(Object &&cb) { return m_write_tx_data.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_irq_wr_callback(Object &&cb) { return m_write_irq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_sm_dtr_wr_callback(Object &&cb) { return m_write_sm_dtr.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_tuf_wr_callback(Object &&cb) { return m_write_tuf.set_callback(std::forward<Object>(cb)); }
auto tx_data_callback() { return m_write_tx_data.bind(); }
auto irq_callback() { return m_write_irq.bind(); }
auto sm_dtr_callback() { return m_write_sm_dtr.bind(); }
auto tuf_callback() { return m_write_tuf.bind(); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( rx_data_w ) { device_serial_interface::rx_w(state); }
DECLARE_WRITE_LINE_MEMBER( rx_clk_w ) { rx_clock_w(state); }
diff --git a/src/devices/machine/mc6854.cpp b/src/devices/machine/mc6854.cpp
index acaa74b0cf9..43e09eba5d2 100644
--- a/src/devices/machine/mc6854.cpp
+++ b/src/devices/machine/mc6854.cpp
@@ -809,7 +809,7 @@ void mc6854_device::update_sr1( )
-uint8_t mc6854_device::read(offs_t offset)
+READ8_MEMBER( mc6854_device::read )
{
switch ( offset )
{
@@ -850,7 +850,7 @@ uint8_t mc6854_device::read(offs_t offset)
-void mc6854_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mc6854_device::write )
{
switch ( offset )
{
diff --git a/src/devices/machine/mc6854.h b/src/devices/machine/mc6854.h
index 0f90544336b..99f09f5d3a7 100644
--- a/src/devices/machine/mc6854.h
+++ b/src/devices/machine/mc6854.h
@@ -40,8 +40,8 @@ public:
}
/* interface to CPU via address/data bus*/
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
/* low-level, bit-based interface */
DECLARE_WRITE_LINE_MEMBER( set_rx );
diff --git a/src/devices/machine/mc68681.cpp b/src/devices/machine/mc68681.cpp
index a3a3b480979..b60567aa3f7 100644
--- a/src/devices/machine/mc68681.cpp
+++ b/src/devices/machine/mc68681.cpp
@@ -268,25 +268,22 @@ void xr68c681_device::device_reset()
m_XTXA = m_XRXA = m_XTXB = m_XRXB = false;
}
-void duart_base_device::device_add_mconfig(machine_config &config)
-{
- DUART_CHANNEL(config, CHANA_TAG, 0);
- DUART_CHANNEL(config, CHANB_TAG, 0);
-}
-
-void sc28c94_device::device_add_mconfig(machine_config &config)
-{
- DUART_CHANNEL(config, CHANA_TAG, 0);
- DUART_CHANNEL(config, CHANB_TAG, 0);
- DUART_CHANNEL(config, CHANC_TAG, 0);
- DUART_CHANNEL(config, CHAND_TAG, 0);
-}
-
-void mc68340_duart_device::device_add_mconfig(machine_config &config)
-{
- DUART_CHANNEL(config, CHANA_TAG, 0);
- DUART_CHANNEL(config, CHANB_TAG, 0);
-}
+MACHINE_CONFIG_START(duart_base_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(CHANA_TAG, DUART_CHANNEL, 0)
+ MCFG_DEVICE_ADD(CHANB_TAG, DUART_CHANNEL, 0)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(sc28c94_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(CHANA_TAG, DUART_CHANNEL, 0)
+ MCFG_DEVICE_ADD(CHANB_TAG, DUART_CHANNEL, 0)
+ MCFG_DEVICE_ADD(CHANC_TAG, DUART_CHANNEL, 0)
+ MCFG_DEVICE_ADD(CHAND_TAG, DUART_CHANNEL, 0)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(mc68340_duart_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(CHANA_TAG, DUART_CHANNEL, 0)
+ MCFG_DEVICE_ADD(CHANB_TAG, DUART_CHANNEL, 0)
+MACHINE_CONFIG_END
void duart_base_device::update_interrupts()
{
diff --git a/src/devices/machine/mc68681.h b/src/devices/machine/mc68681.h
index 50e5cdd1489..ea4fd63e3af 100644
--- a/src/devices/machine/mc68681.h
+++ b/src/devices/machine/mc68681.h
@@ -7,6 +7,32 @@
#include "diserial.h"
+#define MCFG_MC68681_IRQ_CALLBACK(_cb) \
+ downcast<duart_base_device &>(*device).set_irq_cb(DEVCB_##_cb);
+
+#define MCFG_MC68681_A_TX_CALLBACK(_cb) \
+ downcast<duart_base_device &>(*device).set_a_tx_cb(DEVCB_##_cb);
+
+#define MCFG_MC68681_B_TX_CALLBACK(_cb) \
+ downcast<duart_base_device &>(*device).set_b_tx_cb(DEVCB_##_cb);
+
+// deprecated: use ipX_w() instead
+#define MCFG_MC68681_INPORT_CALLBACK(_cb) \
+ downcast<duart_base_device &>(*device).set_inport_cb(DEVCB_##_cb);
+
+#define MCFG_MC68681_OUTPORT_CALLBACK(_cb) \
+ downcast<duart_base_device &>(*device).set_outport_cb(DEVCB_##_cb);
+
+#define MCFG_MC68681_SET_EXTERNAL_CLOCKS(_a, _b, _c, _d) \
+ downcast<duart_base_device &>(*device).set_clocks(_a, _b, _c, _d);
+
+// SC28C94 specific callbacks
+#define MCFG_SC28C94_C_TX_CALLBACK(_cb) \
+ downcast<sc28c94_device &>(*device).set_c_tx_cb(DEVCB_##_cb);
+
+#define MCFG_SC28C94_D_TX_CALLBACK(_cb) \
+ downcast<sc28c94_device &>(*device).set_d_tx_cb(DEVCB_##_cb);
+
#define MC68681_RX_FIFO_SIZE 3
// forward declaration
@@ -101,10 +127,15 @@ public:
DECLARE_WRITE_LINE_MEMBER(rx_a_w) { m_chanA->device_serial_interface::rx_w((uint8_t)state); }
DECLARE_WRITE_LINE_MEMBER(rx_b_w) { m_chanB->device_serial_interface::rx_w((uint8_t)state); }
+ template <class Object> devcb_base &set_irq_cb(Object &&cb) { return write_irq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_a_tx_cb(Object &&cb) { return write_a_tx.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_b_tx_cb(Object &&cb) { return write_b_tx.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_inport_cb(Object &&cb) { return read_inport.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_outport_cb(Object &&cb) { return write_outport.set_callback(std::forward<Object>(cb)); }
auto irq_cb() { return write_irq.bind(); }
auto a_tx_cb() { return write_a_tx.bind(); }
auto b_tx_cb() { return write_b_tx.bind(); }
- auto inport_cb() { return read_inport.bind(); } // deprecated: use ipX_w() instead
+ auto inport_cb() { return read_inport.bind(); }
auto outport_cb() { return write_outport.bind(); }
// new-style push handlers for input port bits
@@ -216,8 +247,8 @@ class sc28c94_device : public duart_base_device
public:
sc28c94_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto c_tx_cb() { return write_c_tx.bind(); }
- auto d_tx_cb() { return write_d_tx.bind(); }
+ template <class Object> devcb_base &set_c_tx_cb(Object &&cb) { return write_c_tx.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_d_tx_cb(Object &&cb) { return write_d_tx.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE_LINE_MEMBER(rx_c_w) { m_chanC->device_serial_interface::rx_w((uint8_t)state); }
DECLARE_WRITE_LINE_MEMBER(rx_d_w) { m_chanD->device_serial_interface::rx_w((uint8_t)state); }
diff --git a/src/devices/machine/mccs1850.h b/src/devices/machine/mccs1850.h
index 62b7f5d5afc..bd7771bc6a0 100644
--- a/src/devices/machine/mccs1850.h
+++ b/src/devices/machine/mccs1850.h
@@ -25,6 +25,22 @@
#include "dirtc.h"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MCCS1850_INT_CALLBACK(_write) \
+ downcast<mccs1850_device &>(*device).set_int_wr_callback(DEVCB_##_write);
+
+#define MCFG_MCCS1850_PSE_CALLBACK(_write) \
+ downcast<mccs1850_device &>(*device).set_pse_wr_callback(DEVCB_##_write);
+
+#define MCFG_MCCS1850_NUC_CALLBACK(_write) \
+ downcast<mccs1850_device &>(*device).set_nuc_wr_callback(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -39,9 +55,9 @@ public:
// construction/destruction
mccs1850_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto int_wr_callback() { return int_cb.bind(); }
- auto pse_wr_callback() { return pse_cb.bind(); }
- auto nuc_wr_callback() { return nuc_cb.bind(); }
+ template <class Object> devcb_base &set_int_wr_callback(Object &&cb) { return int_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_pse_wr_callback(Object &&cb) { return pse_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_nuc_wr_callback(Object &&cb) { return nuc_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE_LINE_MEMBER( ce_w );
DECLARE_WRITE_LINE_MEMBER( sck_w );
diff --git a/src/devices/machine/mcf5206e.cpp b/src/devices/machine/mcf5206e.cpp
index cea38ca7f0f..085afac92ec 100644
--- a/src/devices/machine/mcf5206e.cpp
+++ b/src/devices/machine/mcf5206e.cpp
@@ -826,7 +826,7 @@ DEFINE_DEVICE_TYPE(MCF5206E_PERIPHERAL, mcf5206e_peripheral_device, "mcf5206e_pe
mcf5206e_peripheral_device::mcf5206e_peripheral_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MCF5206E_PERIPHERAL, tag, owner, clock),
device_memory_interface(mconfig, *this),
- m_space_config("coldfire_regs", ENDIANNESS_BIG, 32,10, 0, address_map_constructor(FUNC(mcf5206e_peripheral_device::coldfire_regs_map), this))
+ m_space_config("coldfire_regs", ENDIANNESS_BIG, 32,10, 0, address_map_constructor(), address_map_constructor(FUNC(mcf5206e_peripheral_device::coldfire_regs_map), this))
{
}
diff --git a/src/devices/machine/mcf5206e.h b/src/devices/machine/mcf5206e.h
index a910849a25d..3bf54bbefd5 100644
--- a/src/devices/machine/mcf5206e.h
+++ b/src/devices/machine/mcf5206e.h
@@ -12,6 +12,15 @@
#pragma once
+
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_MCF5206E_PERIPHERAL_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, MCF5206E_PERIPHERAL, 0)
+
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
diff --git a/src/devices/machine/meters.h b/src/devices/machine/meters.h
index c9a11790931..1a349f82485 100644
--- a/src/devices/machine/meters.h
+++ b/src/devices/machine/meters.h
@@ -15,6 +15,9 @@
#pragma once
+#define MCFG_METERS_NUMBER(_number) \
+ downcast<meters_device &>(*device).set_number_meters(_number);
+
class meters_device : public device_t
{
public:
@@ -24,7 +27,7 @@ public:
meters_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void set_number(int number) { m_number_mtr = number; }
+ void set_number_meters(int number) { m_number_mtr = number; }
int update(int id, int state);
int GetActivity(int id);
diff --git a/src/devices/machine/microtch.h b/src/devices/machine/microtch.h
index 0cb486aa3f1..592b0a669da 100644
--- a/src/devices/machine/microtch.h
+++ b/src/devices/machine/microtch.h
@@ -13,14 +13,15 @@ class microtouch_device :
{
public:
microtouch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <class Object> devcb_base &set_stx_callback(Object &&cb) { return m_out_stx_func.set_callback(std::forward<Object>(cb)); }
auto stx() { return m_out_stx_func.bind(); }
virtual ioport_constructor device_input_ports() const override;
DECLARE_WRITE_LINE_MEMBER(rx) { device_serial_interface::rx_w(state); }
DECLARE_INPUT_CHANGED_MEMBER(touch);
- typedef device_delegate<int (int *, int *)> touch_cb;
- template <typename... T> void set_touch_callback(T &&... args) { m_out_touch_cb = touch_cb(std::forward<T>(args)...); }
+ typedef delegate<int (int *, int *)> touch_cb;
+ template <typename Object> void set_touch_callback(Object &&cb) { m_out_touch_cb = std::forward<Object>(cb); }
protected:
virtual void device_start() override;
@@ -72,4 +73,11 @@ private:
DECLARE_DEVICE_TYPE(MICROTOUCH, microtouch_device)
+#define MCFG_MICROTOUCH_ADD(_tag, _clock, _devcb) \
+ MCFG_DEVICE_ADD(_tag, MICROTOUCH, _clock) \
+ downcast<microtouch_device &>(*device).set_stx_callback(DEVCB_##_devcb);
+
+#define MCFG_MICROTOUCH_TOUCH_CB(_class, _touch_cb) \
+ downcast<microtouch_device &>(*device).set_touch_callback(microtouch_device::touch_cb(&_class::_touch_cb, this));
+
#endif // MAME_MACHINE_MICROTCH_H
diff --git a/src/devices/machine/mm5740.h b/src/devices/machine/mm5740.h
index 1896f568e4c..e28fbdc0956 100644
--- a/src/devices/machine/mm5740.h
+++ b/src/devices/machine/mm5740.h
@@ -80,6 +80,23 @@ Vgg 18 -12V
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MM5740_MATRIX_X1(_cb) downcast<mm5740_device &>(*device).set_x_cb<0>(DEVCB_##_cb);
+#define MCFG_MM5740_MATRIX_X2(_cb) downcast<mm5740_device &>(*device).set_x_cb<1>(DEVCB_##_cb);
+#define MCFG_MM5740_MATRIX_X3(_cb) downcast<mm5740_device &>(*device).set_x_cb<2>(DEVCB_##_cb);
+#define MCFG_MM5740_MATRIX_X4(_cb) downcast<mm5740_device &>(*device).set_x_cb<3>(DEVCB_##_cb);
+#define MCFG_MM5740_MATRIX_X5(_cb) downcast<mm5740_device &>(*device).set_x_cb<4>(DEVCB_##_cb);
+#define MCFG_MM5740_MATRIX_X6(_cb) downcast<mm5740_device &>(*device).set_x_cb<5>(DEVCB_##_cb);
+#define MCFG_MM5740_MATRIX_X7(_cb) downcast<mm5740_device &>(*device).set_x_cb<6>(DEVCB_##_cb);
+#define MCFG_MM5740_MATRIX_X8(_cb) downcast<mm5740_device &>(*device).set_x_cb<7>(DEVCB_##_cb);
+#define MCFG_MM5740_MATRIX_X9(_cb) downcast<mm5740_device &>(*device).set_x_cb<8>(DEVCB_##_cb);
+#define MCFG_MM5740_SHIFT_CB(_cb) downcast<mm5740_device &>(*device).set_shift_cb(DEVCB_##_cb);
+#define MCFG_MM5740_CONTROL_CB(_cb) downcast<mm5740_device &>(*device).set_control_cb(DEVCB_##_cb);
+#define MCFG_MM5740_DATA_READY_CB(_cb) downcast<mm5740_device &>(*device).set_data_ready_cb(DEVCB_##_cb);
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -94,11 +111,22 @@ public:
// public interface
uint16_t b_r();
- template <unsigned N> auto x_cb() { return m_read_x[N].bind(); }
- auto shift_cb() { return m_read_shift.bind(); }
- auto control_cb() { return m_read_control.bind(); }
- auto data_ready_cb() { return m_write_data_ready.bind(); }
-
+ template <unsigned N, typename Object> devcb_base &set_x_cb(Object &&cb)
+ {
+ return m_read_x[N].set_callback(std::forward<Object>(cb));
+ }
+ template <typename Object> devcb_base &set_shift_cb(Object &&cb)
+ {
+ return m_read_shift.set_callback(std::forward<Object>(cb));
+ }
+ template <typename Object> devcb_base &set_control_cb(Object &&cb)
+ {
+ return m_read_control.set_callback(std::forward<Object>(cb));
+ }
+ template <typename Object> devcb_base &set_data_ready_cb(Object &&cb)
+ {
+ return m_write_data_ready.set_callback(std::forward<Object>(cb));
+ }
static uint32_t calc_effective_clock_key_debounce(uint32_t capacitance);
protected:
diff --git a/src/devices/machine/mm58167.cpp b/src/devices/machine/mm58167.cpp
index f226590e9d2..22b49f4a7dd 100644
--- a/src/devices/machine/mm58167.cpp
+++ b/src/devices/machine/mm58167.cpp
@@ -180,7 +180,7 @@ void mm58167_device::update_rtc()
m_milliseconds = (bcd_to_integer(m_regs[R_CNT_HUNDTENTHS]) * 10) + (bcd_to_integer(m_regs[R_CNT_MILLISECONDS] >> 4) % 10);
}
-uint8_t mm58167_device::read(offs_t offset)
+READ8_MEMBER(mm58167_device::read)
{
// printf("read reg %x = %02x\n", offset, m_regs[offset]);
@@ -196,7 +196,7 @@ uint8_t mm58167_device::read(offs_t offset)
return m_regs[offset];
}
-void mm58167_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(mm58167_device::write)
{
// printf("%02x to reg %x\n", data, offset);
diff --git a/src/devices/machine/mm58167.h b/src/devices/machine/mm58167.h
index c12b151b676..2c6bb5add34 100644
--- a/src/devices/machine/mm58167.h
+++ b/src/devices/machine/mm58167.h
@@ -15,6 +15,14 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MM58167_IRQ_CALLBACK(_cb) \
+ downcast<mm58167_device &>(*device).set_irq_cb(DEVCB_##_cb);
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -27,9 +35,10 @@ public:
// construction/destruction
mm58167_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
+ template <class Object> devcb_base &set_irq_cb(Object &&wr) { return m_irq_w.set_callback(std::forward<Object>(wr)); }
auto irq() { return m_irq_w.bind(); }
devcb_write_line m_irq_w;
diff --git a/src/devices/machine/mm58274c.cpp b/src/devices/machine/mm58274c.cpp
index c7e7f49a78e..61904923326 100644
--- a/src/devices/machine/mm58274c.cpp
+++ b/src/devices/machine/mm58274c.cpp
@@ -152,7 +152,7 @@ attotime mm58274c_device::interrupt_period_table(int val)
}
}
-uint8_t mm58274c_device::read(offs_t offset)
+READ8_MEMBER( mm58274c_device::read )
{
int reply;
@@ -242,7 +242,7 @@ uint8_t mm58274c_device::read(offs_t offset)
}
-void mm58274c_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mm58274c_device::write )
{
offset &= 0xf;
data &= 0xf;
diff --git a/src/devices/machine/mm58274c.h b/src/devices/machine/mm58274c.h
index c6fcbee3c46..cee2df48db9 100644
--- a/src/devices/machine/mm58274c.h
+++ b/src/devices/machine/mm58274c.h
@@ -16,8 +16,8 @@ public:
void set_day1(int day) { m_day1 = day; }
void set_mode_and_day(int mode, int day) { m_mode24 = mode; m_day1 = day; }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
TIMER_CALLBACK_MEMBER(rtc_increment_cb);
TIMER_CALLBACK_MEMBER(rtc_interrupt_cb);
@@ -30,7 +30,7 @@ protected:
private:
// internal state
- // Initialization of the clock chip:
+ // Initializion the clock chip:
// m_day1 must be set to a value from 0 (sunday), 1 (monday)...
// to 6 (saturday) and is needed to correctly retrieve the
// day-of-week from the host system clock.
@@ -66,4 +66,15 @@ private:
DECLARE_DEVICE_TYPE(MM58274C, mm58274c_device)
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_MM58274C_MODE24(_mode) \
+ downcast<mm58274c_device &>(*device).set_mode24(_mode);
+
+#define MCFG_MM58274C_DAY1(_day) \
+ downcast<mm58274c_device &>(*device).set_day1(_day);
+
#endif // MAME_MACHINE_MM58274C_H
diff --git a/src/devices/machine/mm74c922.h b/src/devices/machine/mm74c922.h
index dce81dd40dc..bd448c2eb22 100644
--- a/src/devices/machine/mm74c922.h
+++ b/src/devices/machine/mm74c922.h
@@ -36,6 +36,38 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MM74C922_OSC(_value) \
+ downcast<mm74c922_device &>(*device).set_cap_osc(_value);
+
+#define MCFG_MM74C922_DEBOUNCE(_value) \
+ downcast<mm74c922_device &>(*device).set_cap_debounce(_value);
+
+#define MCFG_MM74C922_DA_CALLBACK(_write) \
+ downcast<mm74c922_device &>(*device).set_da_wr_callback(DEVCB_##_write);
+
+#define MCFG_MM74C922_X1_CALLBACK(_read) \
+ downcast<mm74c922_device &>(*device).set_x1_rd_callback(DEVCB_##_read);
+
+#define MCFG_MM74C922_X2_CALLBACK(_read) \
+ downcast<mm74c922_device &>(*device).set_x2_rd_callback(DEVCB_##_read);
+
+#define MCFG_MM74C922_X3_CALLBACK(_read) \
+ downcast<mm74c922_device &>(*device).set_x3_rd_callback(DEVCB_##_read);
+
+#define MCFG_MM74C922_X4_CALLBACK(_read) \
+ downcast<mm74c922_device &>(*device).set_x4_rd_callback(DEVCB_##_read);
+
+#define MCFG_MM74C922_X5_CALLBACK(_read) \
+ downcast<mm74c922_device &>(*device).set_x5_rd_callback(DEVCB_##_read);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -51,12 +83,12 @@ public:
void set_cap_osc(double value) { m_cap_osc = value; }
void set_cap_debounce(double value) { m_cap_debounce = value; }
- auto da_wr_callback() { return m_write_da.bind(); }
- auto x1_rd_callback() { return m_read_x1.bind(); }
- auto x2_rd_callback() { return m_read_x2.bind(); }
- auto x3_rd_callback() { return m_read_x3.bind(); }
- auto x4_rd_callback() { return m_read_x4.bind(); }
- auto x5_rd_callback() { return m_read_x5.bind(); }
+ template <class Object> devcb_base &set_da_wr_callback(Object &&cb) { return m_write_da.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_x1_rd_callback(Object &&cb) { return m_read_x1.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_x2_rd_callback(Object &&cb) { return m_read_x2.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_x3_rd_callback(Object &&cb) { return m_read_x3.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_x4_rd_callback(Object &&cb) { return m_read_x4.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_x5_rd_callback(Object &&cb) { return m_read_x5.set_callback(std::forward<Object>(cb)); }
uint8_t read();
diff --git a/src/devices/machine/mos6526.cpp b/src/devices/machine/mos6526.cpp
index e1f40b109c1..9df653c4c5f 100644
--- a/src/devices/machine/mos6526.cpp
+++ b/src/devices/machine/mos6526.cpp
@@ -788,7 +788,7 @@ void mos6526_device::execute_run()
// read -
//-------------------------------------------------
-uint8_t mos6526_device::read(offs_t offset)
+READ8_MEMBER( mos6526_device::read )
{
uint8_t data = 0;
@@ -926,7 +926,7 @@ uint8_t mos6526_device::read(offs_t offset)
return data;
}
-uint8_t mos8520_device::read(offs_t offset)
+READ8_MEMBER( mos8520_device::read )
{
uint8_t data;
@@ -947,7 +947,7 @@ uint8_t mos8520_device::read(offs_t offset)
break;
default:
- data = mos6526_device::read(offset);
+ data = mos6526_device::read(space, offset);
}
return data;
@@ -957,7 +957,7 @@ uint8_t mos8520_device::read(offs_t offset)
// write -
//-------------------------------------------------
-void mos6526_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mos6526_device::write )
{
switch (offset & 0x0f)
{
@@ -1099,12 +1099,12 @@ void mos6526_device::write(offs_t offset, uint8_t data)
}
}
-void mos8520_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mos8520_device::write )
{
switch (offset & 0x0f)
{
default:
- mos6526_device::write(offset, data);
+ mos6526_device::write(space, offset, data);
break;
case TOD_MIN:
diff --git a/src/devices/machine/mos6526.h b/src/devices/machine/mos6526.h
index 33ccc6dd26d..07001edf4d6 100644
--- a/src/devices/machine/mos6526.h
+++ b/src/devices/machine/mos6526.h
@@ -61,6 +61,41 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MOS6526_TOD(_clock) \
+ downcast<mos6526_device &>(*device).set_tod_clock(_clock);
+
+#define MCFG_MOS6526_IRQ_CALLBACK(_write) \
+ downcast<mos6526_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
+
+#define MCFG_MOS6526_CNT_CALLBACK(_write) \
+ downcast<mos6526_device &>(*device).set_cnt_wr_callback(DEVCB_##_write);
+
+#define MCFG_MOS6526_SP_CALLBACK(_write) \
+ downcast<mos6526_device &>(*device).set_sp_wr_callback(DEVCB_##_write);
+
+#define MCFG_MOS6526_PA_INPUT_CALLBACK(_read) \
+ downcast<mos6526_device &>(*device).set_pa_rd_callback(DEVCB_##_read);
+
+#define MCFG_MOS6526_PA_OUTPUT_CALLBACK(_write) \
+ downcast<mos6526_device &>(*device).set_pa_wr_callback(DEVCB_##_write);
+
+#define MCFG_MOS6526_PB_INPUT_CALLBACK(_read) \
+ downcast<mos6526_device &>(*device).set_pb_rd_callback(DEVCB_##_read);
+
+#define MCFG_MOS6526_PB_OUTPUT_CALLBACK(_write) \
+ downcast<mos6526_device &>(*device).set_pb_wr_callback(DEVCB_##_write);
+
+#define MCFG_MOS6526_PC_CALLBACK(_write) \
+ downcast<mos6526_device &>(*device).set_pc_wr_callback(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -76,6 +111,14 @@ public:
void set_tod_clock(int clock) { m_tod_clock = clock; }
+ template <class Object> devcb_base &set_irq_wr_callback(Object &&cb) { return m_write_irq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_cnt_wr_callback(Object &&cb) { return m_write_cnt.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_sp_wr_callback(Object &&cb) { return m_write_sp.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_pa_rd_callback(Object &&cb) { return m_read_pa.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_pa_wr_callback(Object &&cb) { return m_write_pa.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_pb_rd_callback(Object &&cb) { return m_read_pb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_pb_wr_callback(Object &&cb) { return m_write_pb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_pc_wr_callback(Object &&cb) { return m_write_pc.set_callback(std::forward<Object>(cb)); }
auto irq_wr_callback() { return m_write_irq.bind(); }
auto cnt_wr_callback() { return m_write_cnt.bind(); }
auto sp_wr_callback() { return m_write_sp.bind(); }
@@ -85,11 +128,13 @@ public:
auto pb_wr_callback() { return m_write_pb.bind(); }
auto pc_wr_callback() { return m_write_pc.bind(); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
- uint8_t pa_r() { return m_pa; }
- uint8_t pb_r() { return m_pb; }
+ uint8_t read_pa() { return m_pa; }
+ DECLARE_READ8_MEMBER( pa_r ) { return m_pa; }
+ uint8_t read_pb() { return m_pb; }
+ DECLARE_READ8_MEMBER( pb_r ) { return m_pb; }
DECLARE_READ_LINE_MEMBER( sp_r ) { return m_sp; }
DECLARE_WRITE_LINE_MEMBER( sp_w );
@@ -228,8 +273,8 @@ class mos8520_device : public mos6526_device
public:
mos8520_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
protected:
virtual inline void clock_tod() override;
@@ -243,8 +288,8 @@ class mos5710_device : public mos6526_device
public:
mos5710_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- //uint8_t read(offs_t offset);
- //void write(offs_t offset, uint8_t data);
+ //DECLARE_READ8_MEMBER( read );
+ //DECLARE_WRITE8_MEMBER( write );
};
diff --git a/src/devices/machine/mos6530.h b/src/devices/machine/mos6530.h
index 6bbeb8db9de..cc930fa8613 100644
--- a/src/devices/machine/mos6530.h
+++ b/src/devices/machine/mos6530.h
@@ -48,10 +48,10 @@ class mos6530_device : public device_t
public:
mos6530_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto in_pa_callback() { return m_in_pa_cb.bind(); }
- auto out_pa_callback() { return m_out_pa_cb.bind(); }
- auto in_pb_callback() { return m_in_pb_cb.bind(); }
- auto out_pb_callback() { return m_out_pb_cb.bind(); }
+ template <class Object> devcb_base &set_in_pa_callback(Object &&cb) { return m_in_pa_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_pa_callback(Object &&cb) { return m_out_pa_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_in_pb_callback(Object &&cb) { return m_in_pb_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_pb_callback(Object &&cb) { return m_out_pb_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -108,4 +108,17 @@ private:
DECLARE_DEVICE_TYPE(MOS6530, mos6530_device)
+
+#define MCFG_MOS6530_IN_PA_CB(_devcb) \
+ downcast<mos6530_device &>(*device).set_in_pa_callback(DEVCB_##_devcb);
+
+#define MCFG_MOS6530_OUT_PA_CB(_devcb) \
+ downcast<mos6530_device &>(*device).set_out_pa_callback(DEVCB_##_devcb);
+
+#define MCFG_MOS6530_IN_PB_CB(_devcb) \
+ downcast<mos6530_device &>(*device).set_in_pb_callback(DEVCB_##_devcb);
+
+#define MCFG_MOS6530_OUT_PB_CB(_devcb) \
+ downcast<mos6530_device &>(*device).set_out_pb_callback(DEVCB_##_devcb);
+
#endif // MAME_MACHINE_MOS6530_H
diff --git a/src/devices/machine/mos6530n.h b/src/devices/machine/mos6530n.h
index 0042a73e429..a5dfd3ee6fe 100644
--- a/src/devices/machine/mos6530n.h
+++ b/src/devices/machine/mos6530n.h
@@ -57,6 +57,125 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MOS6530n_IRQ_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_irq_wr_callback(DEVCB_##_write);
+
+#define MCFG_MOS6530n_IN_PA_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pa_rd_callback(DEVCB_##_read);
+
+#define MCFG_MOS6530n_OUT_PA_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pa_wr_callback(DEVCB_##_write);
+
+#define MCFG_MOS6530n_IN_PB_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pb_rd_callback(DEVCB_##_read);
+
+#define MCFG_MOS6530n_OUT_PB_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pb_wr_callback(DEVCB_##_write);
+
+#define MCFG_MOS6530n_IN_PA0_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pa_rd_callback<0>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PA1_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pa_rd_callback<1>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PA2_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pa_rd_callback<2>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PA3_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pa_rd_callback<3>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PA4_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pa_rd_callback<4>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PA5_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pa_rd_callback<5>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PA6_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pa_rd_callback<6>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PA7_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pa_rd_callback<7>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_OUT_PA0_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pa_wr_callback<0>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PA1_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pa_wr_callback<1>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PA2_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pa_wr_callback<2>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PA3_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pa_wr_callback<3>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PA4_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pa_wr_callback<4>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PA5_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pa_wr_callback<5>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PA6_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pa_wr_callback<6>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PA7_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pa_wr_callback<7>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_IN_PB0_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pb_rd_callback<0>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PB1_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pb_rd_callback<1>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PB2_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pb_rd_callback<2>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PB3_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pb_rd_callback<3>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PB4_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pb_rd_callback<4>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PB5_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pb_rd_callback<5>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PB6_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pb_rd_callback<6>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_IN_PB7_CB(_read) \
+ downcast<mos6530_device_base &>(*device).set_pb_rd_callback<7>(DEVCB_##_read);
+
+#define MCFG_MOS6530n_OUT_PB0_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pb_wr_callback<0>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PB1_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pb_wr_callback<1>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PB2_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pb_wr_callback<2>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PB3_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pb_wr_callback<3>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PB4_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pb_wr_callback<4>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PB5_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pb_wr_callback<5>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PB6_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pb_wr_callback<6>(DEVCB_##_write);
+
+#define MCFG_MOS6530n_OUT_PB7_CB(_write) \
+ downcast<mos6530_device_base &>(*device).set_pb_wr_callback<7>(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -66,6 +185,15 @@
class mos6530_device_base : public device_t
{
public:
+ template <class Object> devcb_base &set_irq_wr_callback(Object &&cb) { return m_irq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_pa_rd_callback(Object &&cb) { return m_in8_pa_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_pa_wr_callback(Object &&cb) { return m_out8_pa_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_pb_rd_callback(Object &&cb) { return m_in8_pb_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_pb_wr_callback(Object &&cb) { return m_out8_pb_cb.set_callback(std::forward<Object>(cb)); }
+ template <unsigned N, class Object> devcb_base &set_pa_rd_callback(Object &&cb) { return m_in_pa_cb[N].set_callback(std::forward<Object>(cb)); }
+ template <unsigned N, class Object> devcb_base &set_pa_wr_callback(Object &&cb) { return m_out_pa_cb[N].set_callback(std::forward<Object>(cb)); }
+ template <unsigned N, class Object> devcb_base &set_pb_rd_callback(Object &&cb) { return m_in_pb_cb[N].set_callback(std::forward<Object>(cb)); }
+ template <unsigned N, class Object> devcb_base &set_pb_wr_callback(Object &&cb) { return m_out_pb_cb[N].set_callback(std::forward<Object>(cb)); }
auto irq_wr_callback() { return m_irq_cb.bind(); }
auto pa_rd_callback() { return m_in8_pa_cb.bind(); }
auto pa_wr_callback() { return m_out8_pa_cb.bind(); }
diff --git a/src/devices/machine/mos6551.cpp b/src/devices/machine/mos6551.cpp
index f9edbd39cee..37bb874aaf4 100644
--- a/src/devices/machine/mos6551.cpp
+++ b/src/devices/machine/mos6551.cpp
@@ -63,11 +63,10 @@ const int mos6551_device::transmitter_controls[4][3] =
{0, 1, 1}
};
-void mos6551_device::device_add_mconfig(machine_config &config)
-{
- CLOCK(config, m_internal_clock, 0);
- m_internal_clock->signal_handler().set(FUNC(mos6551_device::internal_clock));
-}
+MACHINE_CONFIG_START(mos6551_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("clock", CLOCK, 0)
+ MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, mos6551_device, internal_clock))
+MACHINE_CONFIG_END
void mos6551_device::device_start()
@@ -271,8 +270,7 @@ void mos6551_device::update_divider()
uint8_t mos6551_device::read_rdr()
{
- if (!machine().side_effects_disabled())
- m_status &= ~(SR_PARITY_ERROR | SR_FRAMING_ERROR | SR_OVERRUN | SR_RDRF);
+ m_status &= ~(SR_PARITY_ERROR | SR_FRAMING_ERROR | SR_OVERRUN | SR_RDRF);
return m_rdr;
}
@@ -280,18 +278,15 @@ uint8_t mos6551_device::read_status()
{
uint8_t status = m_status;
- if (!machine().side_effects_disabled())
+ if (m_cts)
{
- if (m_cts)
- {
- status &= ~SR_TDRE;
- }
+ status &= ~SR_TDRE;
+ }
- if (m_irq_state != 0)
- {
- m_irq_state = 0;
- update_irq();
- }
+ if (m_irq_state != 0)
+ {
+ m_irq_state = 0;
+ update_irq();
}
return status;
@@ -379,8 +374,11 @@ void mos6551_device::write_command(uint8_t data)
update_divider();
}
-uint8_t mos6551_device::read(offs_t offset)
+READ8_MEMBER( mos6551_device::read )
{
+ if (machine().side_effects_disabled())
+ return 0xff;
+
switch (offset & 0x03)
{
case 0:
@@ -398,7 +396,7 @@ uint8_t mos6551_device::read(offs_t offset)
}
}
-void mos6551_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mos6551_device::write )
{
switch (offset & 0x03)
{
diff --git a/src/devices/machine/mos6551.h b/src/devices/machine/mos6551.h
index b7afabfa603..626c17fd0b2 100644
--- a/src/devices/machine/mos6551.h
+++ b/src/devices/machine/mos6551.h
@@ -33,7 +33,7 @@
class mos6551_device : public device_t
{
public:
- mos6551_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ mos6551_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
auto irq_handler() { return m_irq_handler.bind(); }
auto txd_handler() { return m_txd_handler.bind(); }
@@ -41,8 +41,8 @@ public:
auto rts_handler() { return m_rts_handler.bind(); }
auto dtr_handler() { return m_dtr_handler.bind(); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
DECLARE_WRITE_LINE_MEMBER(write_xtal1); // txc
DECLARE_WRITE_LINE_MEMBER(write_rxd);
diff --git a/src/devices/machine/mos6702.cpp b/src/devices/machine/mos6702.cpp
index 1b552054cb4..a5fa3d4c088 100644
--- a/src/devices/machine/mos6702.cpp
+++ b/src/devices/machine/mos6702.cpp
@@ -49,7 +49,7 @@ void mos6702_device::device_start()
// read -
//-------------------------------------------------
-uint8_t mos6702_device::read(offs_t offset)
+READ8_MEMBER( mos6702_device::read )
{
return 0;
}
@@ -59,6 +59,6 @@ uint8_t mos6702_device::read(offs_t offset)
// write -
//-------------------------------------------------
-void mos6702_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mos6702_device::write )
{
}
diff --git a/src/devices/machine/mos6702.h b/src/devices/machine/mos6702.h
index ab1ea945e6e..4e7ef027b6e 100644
--- a/src/devices/machine/mos6702.h
+++ b/src/devices/machine/mos6702.h
@@ -25,6 +25,16 @@
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MOS6702_ADD(tag, clock) \
+ MCFG_DEVICE_ADD(tag, MOS6702, clock)
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -37,8 +47,8 @@ public:
// construction/destruction
mos6702_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
protected:
// device-level overrides
diff --git a/src/devices/machine/mos8706.h b/src/devices/machine/mos8706.h
index a3a6247bf5a..36cb6d55d5d 100644
--- a/src/devices/machine/mos8706.h
+++ b/src/devices/machine/mos8706.h
@@ -29,6 +29,17 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MOS8706_ADD(tag, clock) \
+ MCFG_DEVICE_ADD((tag), MOS8706, (clock))
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/devices/machine/mos8722.cpp b/src/devices/machine/mos8722.cpp
index 0364460b63e..b55d8393a9f 100644
--- a/src/devices/machine/mos8722.cpp
+++ b/src/devices/machine/mos8722.cpp
@@ -171,7 +171,7 @@ uint8_t mos8722_device::read(offs_t offset, uint8_t data)
// write - register write
//-------------------------------------------------
-void mos8722_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mos8722_device::write )
{
if (MCR_C64) return;
diff --git a/src/devices/machine/mos8722.h b/src/devices/machine/mos8722.h
index 2b80aa846c2..e5d32d4e4ea 100644
--- a/src/devices/machine/mos8722.h
+++ b/src/devices/machine/mos8722.h
@@ -57,7 +57,7 @@ public:
auto sense40() { return m_read_sense40.bind(); }
uint8_t read(offs_t offset, uint8_t data);
- void write(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER( write );
DECLARE_READ_LINE_MEMBER( fsdir_r );
diff --git a/src/devices/machine/mos8726.cpp b/src/devices/machine/mos8726.cpp
index e1f167d70d3..0c2286788a7 100644
--- a/src/devices/machine/mos8726.cpp
+++ b/src/devices/machine/mos8726.cpp
@@ -90,7 +90,7 @@ void mos8726_device::execute_run()
// read -
//-------------------------------------------------
-uint8_t mos8726_device::read(offs_t offset)
+READ8_MEMBER( mos8726_device::read )
{
uint8_t data = 0;
@@ -102,7 +102,7 @@ uint8_t mos8726_device::read(offs_t offset)
// write -
//-------------------------------------------------
-void mos8726_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mos8726_device::write )
{
}
diff --git a/src/devices/machine/mos8726.h b/src/devices/machine/mos8726.h
index 90b78ec8412..8435bf0f544 100644
--- a/src/devices/machine/mos8726.h
+++ b/src/devices/machine/mos8726.h
@@ -47,6 +47,17 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MOS8726_ADD(tag) \
+ MCFG_DEVICE_ADD((tag), MOS8726, 1000000) // dummy clock
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -60,8 +71,8 @@ public:
// construction/destruction
mos8726_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( bs_w );
diff --git a/src/devices/machine/mpu401.cpp b/src/devices/machine/mpu401.cpp
index 48cc04b455d..578ad206721 100644
--- a/src/devices/machine/mpu401.cpp
+++ b/src/devices/machine/mpu401.cpp
@@ -81,8 +81,7 @@ DEFINE_DEVICE_TYPE(MPU401, mpu401_device, "mpu401", "Roland MPU-401 I/O box")
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void mpu401_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(mpu401_device::device_add_mconfig)
M6801(config, m_ourcpu, 4000000); /* 4 MHz as per schematics */
m_ourcpu->set_addrmap(AS_PROGRAM, &mpu401_device::mpu401_map);
m_ourcpu->in_p1_cb().set(FUNC(mpu401_device::port1_r));
@@ -91,10 +90,11 @@ void mpu401_device::device_add_mconfig(machine_config &config)
m_ourcpu->out_p2_cb().set(FUNC(mpu401_device::port2_w));
m_ourcpu->out_ser_tx_cb().set(MIDIOUT_TAG, FUNC(midi_port_device::write_txd));
- MIDI_PORT(config, MIDIIN_TAG, midiin_slot, "midiin").rxd_handler().set(DEVICE_SELF, FUNC(mpu401_device::midi_rx_w));
+ MCFG_MIDI_PORT_ADD(MIDIIN_TAG, midiin_slot, "midiin")
+ MCFG_MIDI_RX_HANDLER(WRITELINE(DEVICE_SELF, mpu401_device, midi_rx_w))
- MIDI_PORT(config, MIDIOUT_TAG, midiout_slot, "midiout");
-}
+ MCFG_MIDI_PORT_ADD(MIDIOUT_TAG, midiout_slot, "midiout")
+MACHINE_CONFIG_END
//-------------------------------------------------
// rom_region - device-specific ROM region
diff --git a/src/devices/machine/msm58321.h b/src/devices/machine/msm58321.h
index d5b7a5d78c3..1842b4f2036 100644
--- a/src/devices/machine/msm58321.h
+++ b/src/devices/machine/msm58321.h
@@ -39,6 +39,32 @@
#include "dirtc.h"
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MSM58321_D0_HANDLER(_devcb) \
+ downcast<msm58321_device &>(*device).set_d0_handler(DEVCB_##_devcb);
+
+#define MCFG_MSM58321_D1_HANDLER(_devcb) \
+ downcast<msm58321_device &>(*device).set_d1_handler(DEVCB_##_devcb);
+
+#define MCFG_MSM58321_D2_HANDLER(_devcb) \
+ downcast<msm58321_device &>(*device).set_d2_handler(DEVCB_##_devcb);
+
+#define MCFG_MSM58321_D3_HANDLER(_devcb) \
+ downcast<msm58321_device &>(*device).set_d3_handler(DEVCB_##_devcb);
+
+#define MCFG_MSM58321_BUSY_HANDLER(_devcb) \
+ downcast<msm58321_device &>(*device).set_busy_handler(DEVCB_##_devcb);
+
+#define MCFG_MSM58321_YEAR0(_year0) \
+ downcast<msm58321_device &>(*device).set_year0(_year0);
+
+#define MCFG_MSM58321_DEFAULT_24H(_default_24h) \
+ downcast<msm58321_device &>(*device).set_default_24h(_default_24h);
+
// ======================> msm58321_device
class msm58321_device : public device_t,
@@ -50,6 +76,11 @@ public:
msm58321_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration helpers
+ template <class Object> devcb_base &set_d0_handler(Object &&cb) { return m_d0_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_d1_handler(Object &&cb) { return m_d1_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_d2_handler(Object &&cb) { return m_d2_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_d3_handler(Object &&cb) { return m_d3_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_busy_handler(Object &&cb) { return m_busy_handler.set_callback(std::forward<Object>(cb)); }
auto d0_handler() { return m_d0_handler.bind(); }
auto d1_handler() { return m_d1_handler.bind(); }
auto d2_handler() { return m_d2_handler.bind(); }
diff --git a/src/devices/machine/msm6242.h b/src/devices/machine/msm6242.h
index 430bbbc10f0..bd6bd89403e 100644
--- a/src/devices/machine/msm6242.h
+++ b/src/devices/machine/msm6242.h
@@ -40,6 +40,10 @@
#include "dirtc.h"
+#define MCFG_MSM6242_OUT_INT_HANDLER(_devcb) \
+ downcast<msm6242_device &>(*device).set_out_int_handler(DEVCB_##_devcb);
+
+
// ======================> msm6242_device
class msm6242_device : public device_t, public device_rtc_interface
@@ -48,6 +52,7 @@ public:
// construction/destruction
msm6242_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <class Object> devcb_base &set_out_int_handler(Object &&cb) { return m_out_int_handler.set_callback(std::forward<Object>(cb)); }
auto out_int_handler() { return m_out_int_handler.bind(); }
// I/O operations
diff --git a/src/devices/machine/myb3k_kbd.h b/src/devices/machine/myb3k_kbd.h
index 34c2c5cc414..747289a53f1 100644
--- a/src/devices/machine/myb3k_kbd.h
+++ b/src/devices/machine/myb3k_kbd.h
@@ -14,6 +14,9 @@
is responsible for storing the byte into the serial/parallell converter
(that can be read through IN from port 0x04) and then trigger an interrupt.
+ MCFG_DEVICE_ADD("myb3k_keyboard", MYB3K_KEYBOARD, 0)
+ MCFG_MYB3K_KEYBOARD_CB(PUT(myb3k_state, kbd_set_data_and_interrupt))
+
**********************************************************************/
#ifndef MAME_MACHINE_MYB3K_KBD_H
@@ -21,6 +24,11 @@
#pragma once
+#define MYB3K_KBD_CB_PUT(cls, fnc) myb3k_keyboard_device::output_delegate((&cls::fnc), (#cls "::" #fnc), DEVICE_SELF, ((cls *)nullptr))
+#define MYB3K_KBD_CB_DEVPUT(tag, cls, fnc) myb3k_keyboard_device::output_delegate((&cls::fnc), (#cls "::" #fnc), (tag), ((cls *)nullptr))
+
+#define MCFG_MYB3K_KEYBOARD_CB(cb) downcast<myb3k_keyboard_device &>(*device).set_keyboard_callback((MYB3K_KBD_CB_##cb));
+
DECLARE_DEVICE_TYPE(MYB3K_KEYBOARD, myb3k_keyboard_device)
DECLARE_DEVICE_TYPE(JB3000_KEYBOARD, jb3000_keyboard_device)
DECLARE_DEVICE_TYPE(STEPONE_KEYBOARD, stepone_keyboard_device)
@@ -43,18 +51,7 @@ public:
TIMER_ID_SECOND_BYTE
};
- template <class FunctionClass>
- void set_keyboard_callback(void (FunctionClass::*callback)(u8 character), const char *name)
- {
- set_keyboard_callback(output_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr)));
- }
- // FIXME: this should be aware of current device for resolving the tag
- template <class FunctionClass>
- void set_keyboard_callback(const char *devname, void (FunctionClass::*callback)(u8 character), const char *name)
- {
- set_keyboard_callback(output_delegate(callback, name, devname, static_cast<FunctionClass *>(nullptr)));
- }
- void set_keyboard_callback(output_delegate callback) { m_keyboard_cb = callback; }
+ template <class Object> void set_keyboard_callback(Object &&cb) { m_keyboard_cb = std::forward<Object>(cb); }
protected:
myb3k_keyboard_device(
diff --git a/src/devices/machine/ncr5380.h b/src/devices/machine/ncr5380.h
index 9d9d7b96617..b2f7e4f2509 100644
--- a/src/devices/machine/ncr5380.h
+++ b/src/devices/machine/ncr5380.h
@@ -36,6 +36,8 @@ enum
// device stuff
+#define MCFG_NCR5380_IRQ_CB(_devcb) \
+ downcast<ncr5380_device &>(*device).set_irq_callback(DEVCB_##_devcb);
class ncr5380_device : public legacy_scsi_host_adapter
{
@@ -43,6 +45,7 @@ public:
// construction/destruction
ncr5380_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <class Object> devcb_base &set_irq_callback(Object &&cb) { return m_irq_cb.set_callback(std::forward<Object>(cb)); }
auto irq_callback() { return m_irq_cb.bind(); }
// our API
diff --git a/src/devices/machine/ncr5380n.cpp b/src/devices/machine/ncr5380n.cpp
index e5132603609..4d09a910e46 100644
--- a/src/devices/machine/ncr5380n.cpp
+++ b/src/devices/machine/ncr5380n.cpp
@@ -288,12 +288,12 @@ void ncr5380n_device::delay_cycles(int cycles)
tm->adjust(clocks_to_attotime(cycles));
}
-uint8_t ncr5380n_device::scsidata_r()
+READ8_MEMBER(ncr5380n_device::scsidata_r)
{
return scsi_bus->data_r();
}
-void ncr5380n_device::outdata_w(uint8_t data)
+WRITE8_MEMBER(ncr5380n_device::outdata_w)
{
m_outdata = data;
@@ -304,12 +304,12 @@ void ncr5380n_device::outdata_w(uint8_t data)
}
}
-uint8_t ncr5380n_device::icmd_r()
+READ8_MEMBER(ncr5380n_device::icmd_r)
{
return m_icommand;
}
-void ncr5380n_device::icmd_w(uint8_t data)
+WRITE8_MEMBER(ncr5380n_device::icmd_w)
{
// asserting to drive the data bus?
if ((data & IC_DBUS) && !(m_icommand & IC_DBUS))
@@ -340,12 +340,12 @@ void ncr5380n_device::icmd_w(uint8_t data)
delay(2);
}
-uint8_t ncr5380n_device::mode_r()
+READ8_MEMBER(ncr5380n_device::mode_r)
{
return m_mode;
}
-void ncr5380n_device::mode_w(uint8_t data)
+WRITE8_MEMBER(ncr5380n_device::mode_w)
{
// logerror("%s: mode_w %02x (%s)\n", tag(), data, machine().describe_context());
// arbitration bit being set?
@@ -373,13 +373,13 @@ void ncr5380n_device::mode_w(uint8_t data)
m_mode = data;
}
-uint8_t ncr5380n_device::command_r()
+READ8_MEMBER(ncr5380n_device::command_r)
{
// logerror("%s: command_r %02x (%s)\n", tag(), m_tcommand, machine().describe_context());
return m_tcommand;
}
-void ncr5380n_device::command_w(uint8_t data)
+WRITE8_MEMBER(ncr5380n_device::command_w)
{
// logerror("%s: command_w %02x (%s)\n", tag(), data, machine().describe_context());
m_tcommand = data;
@@ -413,7 +413,7 @@ void ncr5380n_device::check_irq()
#endif
}
-uint8_t ncr5380n_device::status_r()
+READ8_MEMBER(ncr5380n_device::status_r)
{
uint32_t ctrl = scsi_bus->ctrl_r();
uint8_t res = status |
@@ -429,11 +429,11 @@ uint8_t ncr5380n_device::status_r()
return res;
}
-void ncr5380n_device::selenable_w(uint8_t data)
+WRITE8_MEMBER(ncr5380n_device::selenable_w)
{
}
-uint8_t ncr5380n_device::busandstatus_r()
+READ8_MEMBER(ncr5380n_device::busandstatus_r)
{
uint32_t ctrl = scsi_bus->ctrl_r();
uint8_t res = m_busstatus |
@@ -445,28 +445,28 @@ uint8_t ncr5380n_device::busandstatus_r()
return res;
}
-void ncr5380n_device::startdmasend_w(uint8_t data)
+WRITE8_MEMBER(ncr5380n_device::startdmasend_w)
{
logerror("%02x to start dma send\n", data);
drq_set();
}
-uint8_t ncr5380n_device::indata_r()
+READ8_MEMBER(ncr5380n_device::indata_r)
{
return dma_r();
}
-void ncr5380n_device::startdmatargetrx_w(uint8_t data)
+WRITE8_MEMBER(ncr5380n_device::startdmatargetrx_w)
{
logerror("%02x to start dma target Rx\n", data);
}
-uint8_t ncr5380n_device::resetparityirq_r()
+READ8_MEMBER(ncr5380n_device::resetparityirq_r)
{
return 0;
}
-void ncr5380n_device::startdmainitrx_w(uint8_t data)
+WRITE8_MEMBER(ncr5380n_device::startdmainitrx_w)
{
// logerror("%02x to start dma initiator Rx\n", data);
recv_byte();
@@ -518,73 +518,73 @@ void ncr5380n_device::drq_clear()
}
}
-uint8_t ncr5380n_device::read(offs_t offset)
+READ8_MEMBER(ncr5380n_device::read)
{
switch (offset & 7)
{
- case 0:
- return scsidata_r();
+ case 0:
+ return scsidata_r(space, offset);
- case 1:
- return icmd_r();
+ case 1:
+ return icmd_r(space, offset);
- case 2:
- return mode_r();
+ case 2:
+ return mode_r(space, offset);
- case 3:
- return command_r();
+ case 3:
+ return command_r(space, offset);
- case 4:
- return status_r();
+ case 4:
+ return status_r(space, offset);
- case 5:
- return busandstatus_r();
+ case 5:
+ return busandstatus_r(space, offset);
- case 6:
- return indata_r();
+ case 6:
+ return indata_r(space, offset);
- case 7:
- return resetparityirq_r();
+ case 7:
+ return resetparityirq_r(space, offset);
}
return 0xff;
}
-void ncr5380n_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ncr5380n_device::write)
{
// logerror("%x to 5380 @ %x\n", data, offset);
switch (offset & 7)
{
- case 0:
- outdata_w(data);
- break;
+ case 0:
+ outdata_w(space, offset, data);
+ break;
- case 1:
- icmd_w(data);
- break;
+ case 1:
+ icmd_w(space, offset, data);
+ break;
- case 2:
- mode_w(data);
- break;
+ case 2:
+ mode_w(space, offset, data);
+ break;
- case 3:
- command_w(data);
- break;
+ case 3:
+ command_w(space, offset, data);
+ break;
- case 4:
- selenable_w(data);
- break;
+ case 4:
+ selenable_w(space, offset, data);
+ break;
- case 5:
- startdmasend_w(data);
- break;
+ case 5:
+ startdmasend_w(space, offset, data);
+ break;
- case 6:
- startdmatargetrx_w(data);
- break;
+ case 6:
+ startdmatargetrx_w(space, offset, data);
+ break;
- case 7:
- startdmainitrx_w(data);
- break;
+ case 7:
+ startdmainitrx_w(space, offset, data);
+ break;
}
}
diff --git a/src/devices/machine/ncr5380n.h b/src/devices/machine/ncr5380n.h
index 365df032419..973616c65a3 100644
--- a/src/devices/machine/ncr5380n.h
+++ b/src/devices/machine/ncr5380n.h
@@ -15,6 +15,11 @@
#include "machine/nscsi_bus.h"
+#define MCFG_NCR5380N_IRQ_HANDLER(_devcb) \
+ downcast<ncr5380n_device &>(*device).set_irq_handler(DEVCB_##_devcb);
+
+#define MCFG_NCR5380N_DRQ_HANDLER(_devcb) \
+ downcast<ncr5380n_device &>(*device).set_drq_handler(DEVCB_##_devcb);
class ncr5380n_device : public nscsi_device
{
@@ -22,11 +27,11 @@ public:
ncr5380n_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration helpers
- auto irq_handler() { return m_irq_handler.bind(); }
- auto drq_handler() { return m_drq_handler.bind(); }
+ template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_drq_handler(Object &&cb) { return m_drq_handler.set_callback(std::forward<Object>(cb)); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
uint8_t dma_r();
void dma_w(uint8_t val);
@@ -198,22 +203,22 @@ private:
void map(address_map &map);
- uint8_t scsidata_r();
- void outdata_w(uint8_t data);
- uint8_t icmd_r();
- void icmd_w(uint8_t data);
- uint8_t mode_r();
- void mode_w(uint8_t data);
- uint8_t command_r();
- void command_w(uint8_t data);
- uint8_t status_r();
- void selenable_w(uint8_t data);
- uint8_t busandstatus_r();
- void startdmasend_w(uint8_t data);
- uint8_t indata_r();
- void startdmatargetrx_w(uint8_t data);
- uint8_t resetparityirq_r();
- void startdmainitrx_w(uint8_t data);
+ DECLARE_READ8_MEMBER(scsidata_r);
+ DECLARE_WRITE8_MEMBER(outdata_w);
+ DECLARE_READ8_MEMBER(icmd_r);
+ DECLARE_WRITE8_MEMBER(icmd_w);
+ DECLARE_READ8_MEMBER(mode_r);
+ DECLARE_WRITE8_MEMBER(mode_w);
+ DECLARE_READ8_MEMBER(command_r);
+ DECLARE_WRITE8_MEMBER(command_w);
+ DECLARE_READ8_MEMBER(status_r);
+ DECLARE_WRITE8_MEMBER(selenable_w);
+ DECLARE_READ8_MEMBER(busandstatus_r);
+ DECLARE_WRITE8_MEMBER(startdmasend_w);
+ DECLARE_READ8_MEMBER(indata_r);
+ DECLARE_WRITE8_MEMBER(startdmatargetrx_w);
+ DECLARE_READ8_MEMBER(resetparityirq_r);
+ DECLARE_WRITE8_MEMBER(startdmainitrx_w);
devcb_write_line m_irq_handler;
devcb_write_line m_drq_handler;
diff --git a/src/devices/machine/ncr5385.cpp b/src/devices/machine/ncr5385.cpp
index 6c1f4a3bb4e..d5cd98a4a5f 100644
--- a/src/devices/machine/ncr5385.cpp
+++ b/src/devices/machine/ncr5385.cpp
@@ -34,7 +34,7 @@ void ncr5385_device::device_reset()
m_diag_status_reg = DIAG_COMPLETE;
}
-void ncr5385_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ncr5385_device::write)
{
switch (offset)
{
@@ -96,7 +96,7 @@ void ncr5385_device::write(offs_t offset, uint8_t data)
}
}
-uint8_t ncr5385_device::read(offs_t offset)
+READ8_MEMBER(ncr5385_device::read)
{
switch (offset)
{
diff --git a/src/devices/machine/ncr5385.h b/src/devices/machine/ncr5385.h
index a1dec052045..3a60ca0a6c8 100644
--- a/src/devices/machine/ncr5385.h
+++ b/src/devices/machine/ncr5385.h
@@ -44,6 +44,14 @@
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_NCR5385_INT_CB(_int) \
+ downcast<ncr5385_device &>(*device).set_int_callback(DEVCB_##_int);
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -56,10 +64,11 @@ public:
// construction/destruction
ncr5385_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <class Object> devcb_base &set_int_callback(Object &&cb) { return m_int.set_callback(std::forward<Object>(cb)); }
auto irq() { return m_int.bind(); }
- void write(offs_t offset, uint8_t data);
- uint8_t read(offs_t offset);
+ DECLARE_WRITE8_MEMBER(write);
+ DECLARE_READ8_MEMBER(read);
protected:
// device-level overrides
diff --git a/src/devices/machine/ncr5390.cpp b/src/devices/machine/ncr5390.cpp
index 10b7510d707..62c62a038b6 100644
--- a/src/devices/machine/ncr5390.cpp
+++ b/src/devices/machine/ncr5390.cpp
@@ -1,12 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
-/*
- * TODO
- * - 16 bit dma order, alignment and last byte handling
- * - clean up variable naming and protection
- */
-
#include "emu.h"
#include "ncr5390.h"
@@ -20,10 +14,9 @@
#define DELAY_HACK
-DEFINE_DEVICE_TYPE(NCR5390, ncr5390_device, "ncr5390", "NCR 5390 SCSI Controller")
-DEFINE_DEVICE_TYPE(NCR53C90A, ncr53c90a_device, "ncr53c90a", "NCR 53C90A Advanced SCSI Controller")
-DEFINE_DEVICE_TYPE(NCR53C94, ncr53c94_device, "ncr53c94", "NCR 53C94 Advanced SCSI Controller")
-DEFINE_DEVICE_TYPE(NCR53CF94, ncr53cf94_device, "ncr53cf94", "NCR 53CF94-2 Fast SCSI Controller") // TODO: differences not emulated
+DEFINE_DEVICE_TYPE(NCR5390, ncr5390_device, "ncr5390", "NCR 5390 SCSI")
+DEFINE_DEVICE_TYPE(NCR53C90A, ncr53c90a_device, "ncr53c90a", "NCR 53C90A SCSI")
+DEFINE_DEVICE_TYPE(NCR53C94, ncr53c94_device, "ncr53c94", "NCR 53C94 SCSI")
void ncr5390_device::map(address_map &map)
{
@@ -40,38 +33,38 @@ void ncr5390_device::map(address_map &map)
map(0x9, 0x9).w(FUNC(ncr5390_device::clock_w));
}
-uint8_t ncr5390_device::read(offs_t offset)
+READ8_MEMBER(ncr5390_device::read)
{
switch (offset)
{
- case 0: return tcounter_lo_r();
- case 1: return tcounter_hi_r();
- case 2: return fifo_r();
- case 3: return command_r();
- case 4: return status_r();
- case 5: return istatus_r();
- case 6: return seq_step_r();
- case 7: return fifo_flags_r();
- case 8: return conf_r();
- default: return 0xff;
+ case 0: return tcounter_lo_r(space, 0);
+ case 1: return tcounter_hi_r(space, 0);
+ case 2: return fifo_r(space, 0);
+ case 3: return command_r(space, 0);
+ case 4: return status_r(space, 0);
+ case 5: return istatus_r(space, 0);
+ case 6: return seq_step_r(space, 0);
+ case 7: return fifo_flags_r(space, 0);
+ case 8: return conf_r(space, 0);
+ default: return 0;
}
}
-void ncr5390_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ncr5390_device::write)
{
switch (offset)
{
- case 0: tcount_lo_w(data); break;
- case 1: tcount_hi_w(data); break;
- case 2: fifo_w(data); break;
- case 3: command_w(data); break;
- case 4: bus_id_w(data); break;
- case 5: timeout_w(data); break;
- case 6: sync_period_w(data); break;
- case 7: sync_offset_w(data); break;
- case 8: conf_w(data); break;
- case 9: clock_w(data); break;
- case 10: test_w(data); break;
+ case 0: tcount_lo_w(space, 0, data); break;
+ case 1: tcount_hi_w(space, 0, data); break;
+ case 2: fifo_w(space, 0, data); break;
+ case 3: command_w(space, 0, data); break;
+ case 4: bus_id_w(space, 0, data); break;
+ case 5: timeout_w(space, 0, data); break;
+ case 6: sync_period_w(space, 0, data); break;
+ case 7: sync_offset_w(space, 0, data); break;
+ case 8: conf_w(space, 0, data); break;
+ case 9: clock_w(space, 0, data); break;
+ case 10: test_w(space, 0, data); break;
default: break;
}
}
@@ -83,18 +76,18 @@ void ncr53c90a_device::map(address_map &map)
map(0xb, 0xb).rw(FUNC(ncr53c90a_device::conf2_r), FUNC(ncr53c90a_device::conf2_w));
}
-uint8_t ncr53c90a_device::read(offs_t offset)
+READ8_MEMBER(ncr53c90a_device::read)
{
if (offset == 11)
- return conf2_r();
- return ncr5390_device::read(offset);
+ return conf2_r(space, 0);
+ return ncr5390_device::read(space, offset);
}
-void ncr53c90a_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ncr53c90a_device::write)
{
if (offset == 11)
- return conf2_w(data);
- ncr5390_device::write(offset, data);
+ return conf2_w(space, 0, data);
+ ncr5390_device::write(space, offset, data);
}
void ncr53c94_device::map(address_map &map)
@@ -105,21 +98,21 @@ void ncr53c94_device::map(address_map &map)
map(0xf, 0xf).w(FUNC(ncr53c94_device::fifo_align_w));
}
-uint8_t ncr53c94_device::read(offs_t offset)
+READ8_MEMBER(ncr53c94_device::read)
{
if (offset == 12)
- return conf3_r();
- return ncr53c90a_device::read(offset);
+ return conf3_r(space, 0);
+ return ncr53c90a_device::read(space, offset);
}
-void ncr53c94_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ncr53c94_device::write)
{
if (offset == 11)
- conf3_w(data);
+ conf3_w(space, 0, data);
else if (offset == 15)
- fifo_align_w(data);
+ fifo_align_w(space, 0, data);
else
- ncr53c90a_device::write(offset, data);
+ ncr53c90a_device::write(space, offset, data);
}
ncr5390_device::ncr5390_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
@@ -148,19 +141,8 @@ ncr53c90a_device::ncr53c90a_device(const machine_config &mconfig, const char *ta
}
ncr53c94_device::ncr53c94_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ncr53c94_device(mconfig, NCR53C94, tag, owner, clock)
-{
-}
-
-ncr53c94_device::ncr53c94_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
- : ncr53c90a_device(mconfig, type, tag, owner, clock)
+ : ncr53c90a_device(mconfig, NCR53C94, tag, owner, clock)
, config3(0)
- , m_busmd(BUSMD_0)
-{
-}
-
-ncr53cf94_device::ncr53cf94_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ncr53c94_device(mconfig, NCR53CF94, tag, owner, clock)
{
}
@@ -195,7 +177,10 @@ void ncr5390_device::device_start()
m_irq_handler.resolve_safe();
m_drq_handler.resolve_safe();
+ tcount = 0;
+ tcounter = 0;
config = 0;
+ status = 0;
bus_id = 0;
select_timeout = 0;
tm = timer_alloc(0);
@@ -211,28 +196,26 @@ void ncr5390_device::device_reset()
sync_offset = 0;
seq = 0;
config &= 7;
- status = 0;
+ status &= 0x90;
istatus = 0;
irq = false;
m_irq_handler(irq);
+ reset_soft();
+}
+void ncr5390_device::reset_soft()
+{
state = IDLE;
scsi_bus->ctrl_wait(scsi_refid, S_SEL|S_BSY|S_RST, S_ALL);
+ status &= 0xef;
drq = false;
test_mode = false;
m_drq_handler(drq);
-
- scsi_bus->ctrl_w(scsi_refid, 0, S_RST);
- tcount = 0;
- tcounter = 0;
-
reset_disconnect();
}
void ncr5390_device::reset_disconnect()
{
- scsi_bus->ctrl_w(scsi_refid, 0, ~S_RST);
-
command_pos = 0;
command_length = 0;
memset(command, 0, sizeof(command));
@@ -275,17 +258,6 @@ void ncr5390_device::step(bool timeout)
case IDLE:
break;
- case BUSRESET_WAIT_INT:
- state = IDLE;
- scsi_bus->ctrl_w(scsi_refid, 0, S_RST);
- reset_disconnect();
-
- if (!(config & 0x40)) {
- istatus |= I_SCSI_RESET;
- check_irq();
- }
- break;
-
case ARB_COMPLETE << SUB_SHIFT: {
if(!timeout)
break;
@@ -295,7 +267,7 @@ void ncr5390_device::step(bool timeout)
if(win != scsi_id) {
scsi_bus->data_w(scsi_refid, 0);
scsi_bus->ctrl_w(scsi_refid, 0, S_ALL);
- fatalerror("ncr5390_device::step need to wait for bus free\n");
+ fatalerror("need to wait for bus free\n");
}
state = (state & STATE_MASK) | (ARB_ASSERT_SEL << SUB_SHIFT);
scsi_bus->ctrl_w(scsi_refid, S_SEL, S_SEL);
@@ -435,13 +407,15 @@ void ncr5390_device::step(bool timeout)
case DISC_SEL_ARBITRATION_INIT:
// wait until a command is in the fifo
- if (!fifo_pos) {
+ if (!fifo_pos && dma_command && !(status & S_TC0)) {
// dma starts after bus arbitration/selection is complete
- check_drq();
+ dma_set(DMA_OUT);
+ step(false);
break;
}
- command_length = fifo_pos + tcounter;
+ // "with atn" variants have a message byte before the command descriptor
+ command_length = (c == CD_SELECT) ? derive_msg_size(fifo[0]) : 1;
state = DISC_SEL_ARBITRATION;
step(false);
break;
@@ -475,6 +449,7 @@ void ncr5390_device::step(bool timeout)
seq = 1;
function_bus_complete();
} else {
+ command_length = derive_msg_size(fifo[0]);
state = DISC_SEL_WAIT_REQ;
}
break;
@@ -485,8 +460,6 @@ void ncr5390_device::step(bool timeout)
if((ctrl & S_PHASE_MASK) != S_PHASE_COMMAND) {
if(!command_length)
seq = 4;
- else
- seq = 2;
scsi_bus->ctrl_wait(scsi_refid, 0, S_REQ);
function_bus_complete();
break;
@@ -707,7 +680,7 @@ void ncr5390_device::function_bus_complete()
state = IDLE;
istatus |= I_FUNCTION|I_BUS;
dma_set(DMA_NONE);
- check_drq();
+ drq_clear();
check_irq();
}
@@ -717,7 +690,7 @@ void ncr5390_device::function_complete()
state = IDLE;
istatus |= I_FUNCTION;
dma_set(DMA_NONE);
- check_drq();
+ drq_clear();
check_irq();
}
@@ -727,7 +700,7 @@ void ncr5390_device::bus_complete()
state = IDLE;
istatus |= I_BUS;
dma_set(DMA_NONE);
- check_drq();
+ drq_clear();
check_irq();
}
@@ -744,25 +717,25 @@ void ncr5390_device::delay_cycles(int cycles)
tm->adjust(clocks_to_attotime(cycles));
}
-uint8_t ncr5390_device::tcounter_lo_r()
+READ8_MEMBER(ncr5390_device::tcounter_lo_r)
{
LOG("tcounter_lo_r %02x (%s)\n", tcounter & 0xff, machine().describe_context());
return tcounter;
}
-void ncr5390_device::tcount_lo_w(uint8_t data)
+WRITE8_MEMBER(ncr5390_device::tcount_lo_w)
{
tcount = (tcount & 0xff00) | data;
LOG("tcount_lo_w %02x (%s)\n", data, machine().describe_context());
}
-uint8_t ncr5390_device::tcounter_hi_r()
+READ8_MEMBER(ncr5390_device::tcounter_hi_r)
{
LOG("tcounter_hi_r %02x (%s)\n", tcounter >> 8, machine().describe_context());
return tcounter >> 8;
}
-void ncr5390_device::tcount_hi_w(uint8_t data)
+WRITE8_MEMBER(ncr5390_device::tcount_hi_w)
{
tcount = (tcount & 0x00ff) | (data << 8);
LOG("tcount_hi_w %02x (%s)\n", data, machine().describe_context());
@@ -773,17 +746,19 @@ uint8_t ncr5390_device::fifo_pop()
uint8_t r = fifo[0];
fifo_pos--;
memmove(fifo, fifo+1, fifo_pos);
- check_drq();
+ if((!fifo_pos) && dma_dir == DMA_OUT && !(status & S_TC0))
+ drq_set();
return r;
}
void ncr5390_device::fifo_push(uint8_t val)
{
fifo[fifo_pos++] = val;
- check_drq();
+ if(!drq && dma_dir == DMA_IN && !(status & S_TC0))
+ drq_set();
}
-uint8_t ncr5390_device::fifo_r()
+READ8_MEMBER(ncr5390_device::fifo_r)
{
uint8_t r;
if(fifo_pos) {
@@ -796,20 +771,20 @@ uint8_t ncr5390_device::fifo_r()
return r;
}
-void ncr5390_device::fifo_w(uint8_t data)
+WRITE8_MEMBER(ncr5390_device::fifo_w)
{
LOGMASKED(LOG_FIFO, "fifo_w 0x%02x fifo_pos %d (%s)\n", data, fifo_pos, machine().describe_context());
if(fifo_pos != 16)
fifo[fifo_pos++] = data;
}
-uint8_t ncr5390_device::command_r()
+READ8_MEMBER(ncr5390_device::command_r)
{
LOG("command_r (%s)\n", machine().describe_context());
return command[0];
}
-void ncr5390_device::command_w(uint8_t data)
+WRITE8_MEMBER(ncr5390_device::command_w)
{
LOG("command_w %02x command_pos %d (%s)\n", data, command_pos, machine().describe_context());
if(command_pos == 2) {
@@ -859,8 +834,6 @@ void ncr5390_device::start_command()
// clear transfer count zero flag when counter is reloaded
status &= ~S_TC0;
}
- else
- tcounter = 0;
switch(c) {
case CM_NOP:
@@ -881,9 +854,13 @@ void ncr5390_device::start_command()
case CM_RESET_BUS:
LOGMASKED(LOG_COMMAND, "Reset SCSI bus\n");
- state = BUSRESET_WAIT_INT;
- scsi_bus->ctrl_w(scsi_refid, S_RST, S_RST);
- delay(130);
+ reset_soft();
+ // FIXME: this interrupt should be generated when the reset is reflected
+ // back into the device, and not when the device starts the scsi reset
+ if (!(config & 0x40)) {
+ istatus = I_SCSI_RESET;
+ check_irq();
+ }
break;
case CD_RESELECT:
@@ -901,7 +878,6 @@ void ncr5390_device::start_command()
"Select with ATN and stop sequence\n");
seq = 0;
state = DISC_SEL_ARBITRATION_INIT;
- dma_set(dma_command ? DMA_OUT : DMA_NONE);
arbitrate();
break;
@@ -920,7 +896,6 @@ void ncr5390_device::start_command()
state = INIT_XFR;
xfr_phase = scsi_bus->ctrl_r() & S_PHASE_MASK;
dma_set(dma_command ? ((xfr_phase & S_INP) ? DMA_IN : DMA_OUT) : DMA_NONE);
- check_drq();
step(false);
break;
@@ -961,14 +936,8 @@ void ncr5390_device::start_command()
command_pop_and_chain();
break;
- case CI_RESET_ATN:
- LOGMASKED(LOG_COMMAND, "Reset ATN\n");
- scsi_bus->ctrl_w(scsi_refid, 0, S_ATN);
- command_pop_and_chain();
- break;
-
default:
- fatalerror("ncr5390_device::start_command unimplemented command %02x\n", c);
+ fatalerror("start unimplemented command %02x\n", c);
}
}
@@ -984,6 +953,12 @@ bool ncr5390_device::check_valid_command(uint8_t cmd)
return false;
}
+int ncr5390_device::derive_msg_size(uint8_t msg_id)
+{
+ const static int sizes[8] = { 6, 10, 6, 6, 6, 12, 6, 10 };
+ return sizes[msg_id >> 5];
+}
+
void ncr5390_device::arbitrate()
{
state = (state & STATE_MASK) | (ARB_COMPLETE << SUB_SHIFT);
@@ -1001,7 +976,7 @@ void ncr5390_device::check_irq()
}
-uint8_t ncr5390_device::status_r()
+READ8_MEMBER(ncr5390_device::status_r)
{
uint32_t ctrl = scsi_bus->ctrl_r();
uint8_t res = status | (ctrl & S_MSG ? 4 : 0) | (ctrl & S_CTL ? 2 : 0) | (ctrl & S_INP ? 1 : 0);
@@ -1010,13 +985,13 @@ uint8_t ncr5390_device::status_r()
return res;
}
-void ncr5390_device::bus_id_w(uint8_t data)
+WRITE8_MEMBER(ncr5390_device::bus_id_w)
{
bus_id = data & 7;
LOG("bus_id=%d\n", bus_id);
}
-uint8_t ncr5390_device::istatus_r()
+READ8_MEMBER(ncr5390_device::istatus_r)
{
uint8_t res = istatus;
@@ -1034,39 +1009,39 @@ uint8_t ncr5390_device::istatus_r()
return res;
}
-void ncr5390_device::timeout_w(uint8_t data)
+WRITE8_MEMBER(ncr5390_device::timeout_w)
{
LOG("timeout_w 0x%02x\n", data);
select_timeout = data;
}
-uint8_t ncr5390_device::seq_step_r()
+READ8_MEMBER(ncr5390_device::seq_step_r)
{
LOG("seq_step_r %d (%s)\n", seq, machine().describe_context());
return seq;
}
-void ncr5390_device::sync_period_w(uint8_t data)
+WRITE8_MEMBER(ncr5390_device::sync_period_w)
{
sync_period = data & 0x1f;
}
-uint8_t ncr5390_device::fifo_flags_r()
+READ8_MEMBER(ncr5390_device::fifo_flags_r)
{
return fifo_pos;
}
-void ncr5390_device::sync_offset_w(uint8_t data)
+WRITE8_MEMBER(ncr5390_device::sync_offset_w)
{
sync_offset = data & 0x0f;
}
-uint8_t ncr5390_device::conf_r()
+READ8_MEMBER(ncr5390_device::conf_r)
{
return config;
}
-void ncr5390_device::conf_w(uint8_t data)
+WRITE8_MEMBER(ncr5390_device::conf_w)
{
config = data;
scsi_id = data & 7;
@@ -1076,13 +1051,13 @@ void ncr5390_device::conf_w(uint8_t data)
test_mode = true;
}
-void ncr5390_device::test_w(uint8_t data)
+WRITE8_MEMBER(ncr5390_device::test_w)
{
if (test_mode)
logerror("test_w %d (%s) - test mode not implemented\n", data, machine().describe_context());
}
-void ncr5390_device::clock_w(uint8_t data)
+WRITE8_MEMBER(ncr5390_device::clock_w)
{
clock_conv = data & 0x07;
}
@@ -1090,17 +1065,16 @@ void ncr5390_device::clock_w(uint8_t data)
void ncr5390_device::dma_set(int dir)
{
dma_dir = dir;
-
- // account for data already in the fifo
- if (dir == DMA_OUT && fifo_pos)
- decrement_tcounter(fifo_pos);
+ if(dma_dir == DMA_OUT && fifo_pos != 16 && ((tcounter > fifo_pos) || !tcounter))
+ drq_set();
}
void ncr5390_device::dma_w(uint8_t val)
{
fifo_push(val);
decrement_tcounter();
- check_drq();
+ if(fifo_pos == 16 || (status & S_TC0))
+ drq_clear();
step(false);
}
@@ -1108,41 +1082,34 @@ uint8_t ncr5390_device::dma_r()
{
uint8_t r = fifo_pop();
decrement_tcounter();
- check_drq();
+ if(!fifo_pos || (status & S_TC0))
+ drq_clear();
step(false);
return r;
}
-void ncr5390_device::check_drq()
+void ncr5390_device::drq_set()
{
- bool drq_state = drq;
-
- switch (dma_dir) {
- case DMA_NONE:
- drq_state = false;
- break;
-
- case DMA_IN: // device to memory
- drq_state = !(status & S_TC0) && fifo_pos;
- break;
-
- case DMA_OUT: // memory to device
- drq_state = !(status & S_TC0) && fifo_pos < 16;
- break;
+ if(!drq) {
+ drq = true;
+ m_drq_handler(drq);
}
+}
- if (drq_state != drq) {
- drq = drq_state;
+void ncr5390_device::drq_clear()
+{
+ if(drq) {
+ drq = false;
m_drq_handler(drq);
}
}
-void ncr5390_device::decrement_tcounter(int count)
+void ncr5390_device::decrement_tcounter()
{
if (!dma_command)
return;
- tcounter -= count;
+ tcounter--;
if (tcounter == 0)
status |= S_TC0;
}
@@ -1175,14 +1142,14 @@ void ncr53c90a_device::device_start()
ncr5390_device::device_start();
}
-void ncr53c90a_device::device_reset()
+void ncr53c90a_device::reset_soft()
{
config2 = 0;
- ncr5390_device::device_reset();
+ ncr5390_device::reset_soft();
}
-uint8_t ncr53c90a_device::status_r()
+READ8_MEMBER(ncr53c90a_device::status_r)
{
uint32_t ctrl = scsi_bus->ctrl_r();
uint8_t res = (irq ? S_INTERRUPT : 0) | status | (ctrl & S_MSG ? 4 : 0) | (ctrl & S_CTL ? 2 : 0) | (ctrl & S_INP ? 1 : 0);
@@ -1213,75 +1180,9 @@ void ncr53c94_device::device_start()
ncr53c90a_device::device_start();
}
-void ncr53c94_device::device_reset()
+void ncr53c94_device::reset_soft()
{
config3 = 0;
- ncr53c90a_device::device_reset();
-}
-
-u16 ncr53c94_device::dma16_r()
-{
- // check fifo underflow
- if (fifo_pos < 2)
- fatalerror("ncr53c94_device::dma16_r fifo_pos %d\n", fifo_pos);
-
- // pop two bytes from fifo
- u16 const data = (fifo[0] << 8) | fifo[1];
- fifo_pos -= 2;
- memmove(fifo, fifo + 2, fifo_pos);
-
- // update drq
- decrement_tcounter(2);
- check_drq();
-
- step(false);
-
- return data;
-}
-
-void ncr53c94_device::dma16_w(u16 data)
-{
- // check fifo overflow
- if (fifo_pos > 14)
- fatalerror("ncr53c94_device::dma16_w fifo_pos %d\n", fifo_pos);
-
- // push two bytes into fifo
- fifo[fifo_pos++] = data >> 8;
- fifo[fifo_pos++] = data;
-
- // update drq
- decrement_tcounter(2);
- check_drq();
-
- step(false);
-}
-
-void ncr53c94_device::check_drq()
-{
- if (m_busmd != BUSMD_0)
- {
- bool drq_state = drq;
-
- switch (dma_dir) {
- case DMA_NONE:
- drq_state = false;
- break;
-
- case DMA_IN: // device to memory
- drq_state = !(status & S_TC0) && fifo_pos > 1;
- break;
-
- case DMA_OUT: // memory to device
- drq_state = !(status & S_TC0) && fifo_pos < 15;
- break;
- }
-
- if (drq_state != drq) {
- drq = drq_state;
- m_drq_handler(drq);
- }
- }
- else
- ncr5390_device::check_drq();
+ ncr53c90a_device::reset_soft();
}
diff --git a/src/devices/machine/ncr5390.h b/src/devices/machine/ncr5390.h
index 7cc2469bde5..bf301bed266 100644
--- a/src/devices/machine/ncr5390.h
+++ b/src/devices/machine/ncr5390.h
@@ -7,46 +7,59 @@
#include "machine/nscsi_bus.h"
+#define MCFG_NCR5390_IRQ_HANDLER(_devcb) \
+ downcast<ncr5390_device &>(*device).set_irq_handler(DEVCB_##_devcb);
+
+#define MCFG_NCR5390_DRQ_HANDLER(_devcb) \
+ downcast<ncr5390_device &>(*device).set_drq_handler(DEVCB_##_devcb);
+
class ncr5390_device : public nscsi_device
{
public:
ncr5390_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration helpers
+ template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_drq_handler(Object &&cb) { return m_drq_handler.set_callback(std::forward<Object>(cb)); }
+
auto irq_handler_cb() { return m_irq_handler.bind(); }
auto drq_handler_cb() { return m_drq_handler.bind(); }
virtual void map(address_map &map);
- uint8_t tcounter_lo_r();
- void tcount_lo_w(uint8_t data);
- uint8_t tcounter_hi_r();
- void tcount_hi_w(uint8_t data);
- uint8_t fifo_r();
- void fifo_w(uint8_t data);
- uint8_t command_r();
- void command_w(uint8_t data);
- virtual uint8_t status_r();
- void bus_id_w(uint8_t data);
- uint8_t istatus_r();
- void timeout_w(uint8_t data);
- uint8_t seq_step_r();
- void sync_period_w(uint8_t data);
- uint8_t fifo_flags_r();
- void sync_offset_w(uint8_t data);
- uint8_t conf_r();
- void conf_w(uint8_t data);
- void test_w(uint8_t data);
- void clock_w(uint8_t data);
-
- virtual uint8_t read(offs_t offset);
- virtual void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(tcounter_lo_r);
+ DECLARE_WRITE8_MEMBER(tcount_lo_w);
+ DECLARE_READ8_MEMBER(tcounter_hi_r);
+ DECLARE_WRITE8_MEMBER(tcount_hi_w);
+ DECLARE_READ8_MEMBER(fifo_r);
+ DECLARE_WRITE8_MEMBER(fifo_w);
+ DECLARE_READ8_MEMBER(command_r);
+ DECLARE_WRITE8_MEMBER(command_w);
+ virtual DECLARE_READ8_MEMBER(status_r);
+ DECLARE_WRITE8_MEMBER(bus_id_w);
+ DECLARE_READ8_MEMBER(istatus_r);
+ DECLARE_WRITE8_MEMBER(timeout_w);
+ DECLARE_READ8_MEMBER(seq_step_r);
+ DECLARE_WRITE8_MEMBER(sync_period_w);
+ DECLARE_READ8_MEMBER(fifo_flags_r);
+ DECLARE_WRITE8_MEMBER(sync_offset_w);
+ DECLARE_READ8_MEMBER(conf_r);
+ DECLARE_WRITE8_MEMBER(conf_w);
+ DECLARE_WRITE8_MEMBER(test_w);
+ DECLARE_WRITE8_MEMBER(clock_w);
+
+ virtual DECLARE_READ8_MEMBER(read);
+ virtual DECLARE_WRITE8_MEMBER(write);
virtual void scsi_ctrl_changed() override;
uint8_t dma_r();
void dma_w(uint8_t val);
+ // memory mapped wrappers for dma read/write
+ DECLARE_READ8_MEMBER(mdma_r) { return dma_r(); }
+ DECLARE_WRITE8_MEMBER(mdma_w) { dma_w(data); }
+
protected:
ncr5390_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -207,11 +220,13 @@ protected:
bool test_mode;
void dma_set(int dir);
- virtual void check_drq();
+ void drq_set();
+ void drq_clear();
void start_command();
void step(bool timeout);
virtual bool check_valid_command(uint8_t cmd);
+ int derive_msg_size(uint8_t msg_id);
void function_complete();
void function_bus_complete();
void bus_complete();
@@ -220,6 +235,10 @@ protected:
void command_pop_and_chain();
void check_irq();
+protected:
+ virtual void reset_soft();
+
+private:
void reset_disconnect();
uint8_t fifo_pop();
@@ -230,7 +249,7 @@ protected:
void delay(int cycles);
void delay_cycles(int cycles);
- void decrement_tcounter(int count = 1);
+ void decrement_tcounter();
devcb_write_line m_irq_handler;
devcb_write_line m_drq_handler;
@@ -243,19 +262,19 @@ public:
virtual void map(address_map &map) override;
- virtual uint8_t status_r() override;
+ virtual DECLARE_READ8_MEMBER(status_r) override;
- uint8_t conf2_r() { return config2; };
- void conf2_w(uint8_t data) { config2 = data; };
+ DECLARE_READ8_MEMBER(conf2_r) { return config2; };
+ DECLARE_WRITE8_MEMBER(conf2_w) { config2 = data; };
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
protected:
ncr53c90a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_start() override;
- virtual void device_reset() override;
+ virtual void reset_soft() override;
virtual bool check_valid_command(uint8_t cmd) override;
@@ -264,18 +283,6 @@ protected:
S_INTERRUPT = 0x80,
};
- enum conf2_mask : u8
- {
- PGDP = 0x01, // pass through/generate data parity
- PGRP = 0x02, // pass through/generate register parity
- ACDPE = 0x04, // abort on command/data parity error
- S2FE = 0x08, // scsi-2 features enable
- TSDR = 0x10, // tri-state dma request
- SBO = 0x20, // select byte order
- LSP = 0x40, // latch scsi phase
- DAE = 0x80, // data alignment enable
- };
-
private:
u8 config2;
};
@@ -285,56 +292,26 @@ class ncr53c94_device : public ncr53c90a_device
public:
ncr53c94_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- enum busmd_t : u8
- {
- BUSMD_0 = 0, // single bus: 8-bit host, 8 bit dma
- BUSMD_1 = 1, // single bus: 8 bit host, 16 bit dma
- BUSMD_2 = 2, // two buses: 8 bit multiplexed host, 16 bit dma
- BUSMD_3 = 3, // two buses: 8 bit host, 16 bit dma
- };
- void set_busmd(busmd_t const busmd) { m_busmd = busmd; }
-
virtual void map(address_map &map) override;
- uint8_t conf3_r() { return config3; };
- void conf3_w(uint8_t data) { config3 = data; };
- void fifo_align_w(uint8_t data) { fifo_align = data; };
-
- virtual uint8_t read(offs_t offset) override;
- virtual void write(offs_t offset, uint8_t data) override;
+ DECLARE_READ8_MEMBER(conf3_r) { return config3; };
+ DECLARE_WRITE8_MEMBER(conf3_w) { config3 = data; };
+ DECLARE_WRITE8_MEMBER(fifo_align_w) { fifo_align = data; };
- u16 dma16_r();
- void dma16_w(u16 data);
+ virtual DECLARE_READ8_MEMBER(read) override;
+ virtual DECLARE_WRITE8_MEMBER(write) override;
protected:
- ncr53c94_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
- enum conf3_mask : u8
- {
- BS8 = 0x01, // burst size 8
- MDM = 0x02, // modify dma mode
- LBTM = 0x04, // last byte transfer mode
- };
-
virtual void device_start() override;
- virtual void device_reset() override;
- virtual void check_drq() override;
+ virtual void reset_soft() override;
private:
u8 config3;
u8 fifo_align;
- busmd_t m_busmd;
-};
-
-class ncr53cf94_device : public ncr53c94_device
-{
-public:
- ncr53cf94_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
DECLARE_DEVICE_TYPE(NCR5390, ncr5390_device)
DECLARE_DEVICE_TYPE(NCR53C90A, ncr53c90a_device)
DECLARE_DEVICE_TYPE(NCR53C94, ncr53c94_device)
-DECLARE_DEVICE_TYPE(NCR53CF94, ncr53cf94_device)
#endif // MAME_MACHINE_NCR5390_H
diff --git a/src/devices/machine/ncr539x.cpp b/src/devices/machine/ncr539x.cpp
index 09e0bee9f21..58c69a16ad1 100644
--- a/src/devices/machine/ncr539x.cpp
+++ b/src/devices/machine/ncr539x.cpp
@@ -280,7 +280,7 @@ void ncr539x_device::device_timer(emu_timer &timer, device_timer_id tid, int par
}
}
-uint8_t ncr539x_device::read(offs_t offset)
+READ8_MEMBER( ncr539x_device::read )
{
uint8_t rv = 0;
@@ -412,7 +412,7 @@ uint8_t ncr539x_device::read(offs_t offset)
return rv;
}
-void ncr539x_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( ncr539x_device::write )
{
//if (offset != 2)
LOG("539x: Write %02x @ %s (%02x) (%s)\n", data, wrregs[offset], offset, machine().describe_context());
diff --git a/src/devices/machine/ncr539x.h b/src/devices/machine/ncr539x.h
index 8172f4ea5f2..8caa26c25a1 100644
--- a/src/devices/machine/ncr539x.h
+++ b/src/devices/machine/ncr539x.h
@@ -14,6 +14,11 @@
// device stuff
+#define MCFG_NCR539X_OUT_IRQ_CB(_devcb) \
+ downcast<ncr539x_device &>(*device).set_out_irq_callback(DEVCB_##_devcb);
+
+#define MCFG_NCR539X_OUT_DRQ_CB(_devcb) \
+ downcast<ncr539x_device &>(*device).set_out_drq_callback(DEVCB_##_devcb);
class ncr539x_device : public legacy_scsi_host_adapter
{
@@ -21,12 +26,14 @@ public:
// construction/destruction
ncr539x_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <class Object> devcb_base &set_out_irq_callback(Object &&cb) { return m_out_irq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_out_drq_callback(Object &&cb) { return m_out_drq_cb.set_callback(std::forward<Object>(cb)); }
auto irq_callback() { return m_out_irq_cb.bind(); }
auto drq_callback() { return m_out_drq_cb.bind(); }
// our API
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
void dma_read_data(int bytes, uint8_t *pData);
void dma_write_data(int bytes, uint8_t *pData);
diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp
index 3e7580be5b9..648d435ace8 100644
--- a/src/devices/machine/netlist.cpp
+++ b/src/devices/machine/netlist.cpp
@@ -49,16 +49,21 @@ DEFINE_DEVICE_TYPE(NETLIST_STREAM_OUTPUT, netlist_mame_stream_output_device, "nl
// Special netlist extension devices ....
// ----------------------------------------------------------------------------------------
-class netlist_mame_device::netlist_mame_callbacks_t : public netlist::callbacks_t
+class netlist_mame_device::netlist_mame_t : public netlist::netlist_t
{
public:
- netlist_mame_callbacks_t(netlist_mame_device &parent)
- : netlist::callbacks_t()
+ netlist_mame_t(netlist_mame_device &parent, const pstring &aname)
+ : netlist::netlist_t(aname)
, m_parent(parent)
{
}
+ running_machine &machine() { return m_parent.machine(); }
+
+
+ netlist_mame_device &parent() { return m_parent; }
+
protected:
void vlog(const plib::plog_level &l, const pstring &ls) const override
{
@@ -90,24 +95,6 @@ private:
};
-class netlist_mame_device::netlist_mame_t : public netlist::netlist_t
-{
-public:
-
- netlist_mame_t(netlist_mame_device &parent, const pstring &aname)
- : netlist::netlist_t(aname, plib::make_unique<netlist_mame_device::netlist_mame_callbacks_t>(parent))
- , m_parent(parent)
- {
- }
-
- running_machine &machine() { return m_parent.machine(); }
- netlist_mame_device &parent() { return m_parent; }
-
-private:
- netlist_mame_device &m_parent;
-};
-
-
namespace {
// ----------------------------------------------------------------------------------------
@@ -117,13 +104,13 @@ namespace {
class NETLIB_NAME(analog_callback) : public netlist::device_t
{
public:
- NETLIB_NAME(analog_callback)(netlist::netlist_state_t &anetlist, const pstring &name)
+ NETLIB_NAME(analog_callback)(netlist::netlist_t &anetlist, const pstring &name)
: device_t(anetlist, name)
, m_in(*this, "IN")
, m_cpu_device(nullptr)
, m_last(*this, "m_last", 0)
{
- m_cpu_device = downcast<netlist_mame_cpu_device *>(&static_cast<netlist_mame_device::netlist_mame_t &>(exec()).parent());
+ m_cpu_device = downcast<netlist_mame_cpu_device *>(&downcast<netlist_mame_device::netlist_mame_t &>(netlist()).parent());
}
ATTR_COLD void reset() override
@@ -144,7 +131,7 @@ public:
// avoid calls due to noise
if (std::fabs(cur - m_last) > 1e-6)
{
- m_cpu_device->update_icount(exec().time());
+ m_cpu_device->update_time_x();
m_callback(cur, m_cpu_device->local_time());
m_cpu_device->check_mame_abort_slice();
m_last = cur;
@@ -165,13 +152,13 @@ private:
class NETLIB_NAME(logic_callback) : public netlist::device_t
{
public:
- NETLIB_NAME(logic_callback)(netlist::netlist_state_t &anetlist, const pstring &name)
+ NETLIB_NAME(logic_callback)(netlist::netlist_t &anetlist, const pstring &name)
: device_t(anetlist, name)
, m_in(*this, "IN")
, m_cpu_device(nullptr)
, m_last(*this, "m_last", 0)
{
- m_cpu_device = downcast<netlist_mame_cpu_device *>(&static_cast<netlist_mame_device::netlist_mame_t &>(exec()).parent());
+ m_cpu_device = downcast<netlist_mame_cpu_device *>(&downcast<netlist_mame_device::netlist_mame_t &>(netlist()).parent());
}
ATTR_COLD void reset() override
@@ -186,13 +173,13 @@ public:
NETLIB_UPDATEI()
{
- netlist::netlist_sig_t cur = m_in();
+ netlist_sig_t cur = m_in();
// FIXME: make this a parameter
// avoid calls due to noise
if (cur != m_last)
{
- m_cpu_device->update_icount(exec().time());
+ m_cpu_device->update_time_x();
m_callback(cur, m_cpu_device->local_time());
m_cpu_device->check_mame_abort_slice();
m_last = cur;
@@ -203,10 +190,9 @@ private:
netlist::logic_input_t m_in;
netlist_mame_logic_output_device::output_delegate m_callback;
netlist_mame_cpu_device *m_cpu_device;
- netlist::state_var<netlist::netlist_sig_t> m_last;
+ netlist::state_var<netlist_sig_t> m_last;
};
-
// ----------------------------------------------------------------------------------------
// Extensions to interface netlist with MAME code ....
// ----------------------------------------------------------------------------------------
@@ -214,26 +200,22 @@ private:
class netlist_source_memregion_t : public netlist::source_t
{
public:
- netlist_source_memregion_t(device_t &dev, pstring name)
- : netlist::source_t(), m_dev(dev), m_name(name)
+ netlist_source_memregion_t(netlist::setup_t &setup, pstring name)
+ : netlist::source_t(setup), m_name(name)
{
}
- virtual plib::unique_ptr<plib::pistream> stream(const pstring &name) override;
+ virtual std::unique_ptr<plib::pistream> stream(const pstring &name) override;
private:
- device_t &m_dev;
pstring m_name;
};
class netlist_data_memregions_t : public netlist::source_t
{
public:
- netlist_data_memregions_t(device_t &dev);
+ netlist_data_memregions_t(netlist::setup_t &setup);
- virtual plib::unique_ptr<plib::pistream> stream(const pstring &name) override;
-
-private:
- device_t &m_dev;
+ virtual std::unique_ptr<plib::pistream> stream(const pstring &name) override;
};
@@ -241,31 +223,30 @@ private:
// memregion source support
// ----------------------------------------------------------------------------------------
-plib::unique_ptr<plib::pistream> netlist_source_memregion_t::stream(const pstring &name)
+std::unique_ptr<plib::pistream> netlist_source_memregion_t::stream(const pstring &name)
{
- //memory_region *mem = static_cast<netlist_mame_device::netlist_mame_t &>(setup().setup().exec()).machine().root_device().memregion(m_name.c_str());
- memory_region *mem = m_dev.machine().root_device().memregion(m_name.c_str());
- return plib::make_unique<plib::pimemstream>(mem->base(), mem->bytes());
+ memory_region *mem = downcast<netlist_mame_device::netlist_mame_t &>(setup().netlist()).machine().root_device().memregion(m_name.c_str());
+ return plib::make_unique_base<plib::pistream, plib::pimemstream>(mem->base(), mem->bytes());
}
-netlist_data_memregions_t::netlist_data_memregions_t(device_t &dev)
- : netlist::source_t(netlist::source_t::DATA), m_dev(dev)
+netlist_data_memregions_t::netlist_data_memregions_t(netlist::setup_t &setup)
+ : netlist::source_t(setup, netlist::source_t::DATA)
{
}
-plib::unique_ptr<plib::pistream> netlist_data_memregions_t::stream(const pstring &name)
+std::unique_ptr<plib::pistream> netlist_data_memregions_t::stream(const pstring &name)
{
- //memory_region *mem = static_cast<netlist_mame_device::netlist_mame_t &>(setup().setup().exec()).parent().memregion(name.c_str());
- memory_region *mem = m_dev.memregion(name.c_str());
+ memory_region *mem = downcast<netlist_mame_device::netlist_mame_t &>(setup().netlist()).parent().memregion(name.c_str());
+ //memory_region *mem = downcast<netlist_mame_t &>(setup().netlist()).machine().root_device().memregion(name.c_str());
if (mem != nullptr)
{
- return plib::make_unique<plib::pimemstream>(mem->base(), mem->bytes());
+ return plib::make_unique_base<plib::pistream, plib::pimemstream>(mem->base(), mem->bytes());
}
else
{
// This should be the last data provider being called - last resort
fatalerror("data named %s not found in device rom regions\n", name.c_str());
- return plib::unique_ptr<plib::pistream>(nullptr);
+ return std::unique_ptr<plib::pistream>(nullptr);
}
}
@@ -280,55 +261,44 @@ plib::unique_ptr<plib::pistream> netlist_data_memregions_t::stream(const pstring
class NETLIB_NAME(sound_out) : public netlist::device_t
{
public:
- NETLIB_NAME(sound_out)(netlist::netlist_state_t &anetlist, const pstring &name)
+ NETLIB_NAME(sound_out)(netlist::netlist_t &anetlist, const pstring &name)
: netlist::device_t(anetlist, name)
, m_channel(*this, "CHAN", 0)
, m_mult(*this, "MULT", 1000.0)
, m_offset(*this, "OFFSET", 0.0)
, m_buffer(nullptr)
- , m_bufsize(0)
- , m_sample_time(netlist::netlist_time::from_hz(1)) //sufficiently big enough
+ , m_sample(netlist::netlist_time::from_hz(1)) //sufficiently big enough
, m_in(*this, "IN")
, m_cur(0.0)
, m_last_pos(0)
- , m_last_buffer_time(*this, "m_last_buffer", netlist::netlist_time::zero())
+ , m_last_buffer(*this, "m_last_buffer", netlist::netlist_time::zero())
{
}
- //static const int BUFSIZE = 2048;
+ static const int BUFSIZE = 2048;
ATTR_COLD void reset() override
{
m_cur = 0.0;
m_last_pos = 0;
- m_last_buffer_time = netlist::netlist_time::zero();
+ m_last_buffer = netlist::netlist_time::zero();
}
ATTR_HOT void sound_update(const netlist::netlist_time &upto)
{
- int pos = (upto - m_last_buffer_time) / m_sample_time;
- if (pos > m_bufsize)
- throw emu_fatalerror("sound %s: pos %d exceeded bufsize %d\n", name().c_str(), pos, m_bufsize);
+ int pos = (upto - m_last_buffer) / m_sample;
+ if (pos >= BUFSIZE)
+ netlist().log().fatal("sound {1}: exceeded BUFSIZE\n", name().c_str());
while (m_last_pos < pos )
{
m_buffer[m_last_pos++] = (stream_sample_t) m_cur;
}
}
- ATTR_HOT void sound_update_fill(int samples)
- {
- if (samples > m_bufsize)
- throw emu_fatalerror("sound %s: pos %d exceeded bufsize %d\n", name().c_str(), samples, m_bufsize);
- while (m_last_pos < samples )
- {
- m_buffer[m_last_pos++] = (stream_sample_t) m_cur;
- }
- }
-
NETLIB_UPDATEI()
{
nl_double val = m_in() * m_mult() + m_offset();
- sound_update(exec().time());
+ sound_update(netlist().time());
/* ignore spikes */
if (std::abs(val) < 32767.0)
m_cur = val;
@@ -343,22 +313,21 @@ public:
ATTR_HOT void buffer_reset(const netlist::netlist_time &upto)
{
m_last_pos = 0;
- m_last_buffer_time = upto;
+ m_last_buffer = upto;
+ m_cur = 0.0;
}
netlist::param_int_t m_channel;
netlist::param_double_t m_mult;
netlist::param_double_t m_offset;
stream_sample_t *m_buffer;
- int m_bufsize;
-
- netlist::netlist_time m_sample_time;
+ netlist::netlist_time m_sample;
private:
netlist::analog_input_t m_in;
double m_cur;
int m_last_pos;
- netlist::state_var<netlist::netlist_time> m_last_buffer_time;
+ netlist::state_var<netlist::netlist_time> m_last_buffer;
};
// ----------------------------------------------------------------------------------------
@@ -368,57 +337,58 @@ private:
class NETLIB_NAME(sound_in) : public netlist::device_t
{
public:
-
- static const int MAX_INPUT_CHANNELS = 16;
-
- NETLIB_NAME(sound_in)(netlist::netlist_state_t &anetlist, const pstring &name)
+ NETLIB_NAME(sound_in)(netlist::netlist_t &anetlist, const pstring &name)
: netlist::device_t(anetlist, name)
- , m_inc(netlist::netlist_time::from_nsec(1))
, m_feedback(*this, "FB") // clock part
, m_Q(*this, "Q")
, m_pos(0)
- , m_num_channels(0)
+ , m_num_channel(0)
{
connect(m_feedback, m_Q);
+ m_inc = netlist::netlist_time::from_nsec(1);
+
for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
{
- m_channels[i].m_param_name = netlist::pool().make_poolptr<netlist::param_str_t>(*this, plib::pfmt("CHAN{1}")(i), "");
- m_channels[i].m_param_mult = netlist::pool().make_poolptr<netlist::param_double_t>(*this, plib::pfmt("MULT{1}")(i), 1.0);
- m_channels[i].m_param_offset = netlist::pool().make_poolptr<netlist::param_double_t>(*this, plib::pfmt("OFFSET{1}")(i), 0.0);
+ m_param_name[i] = std::make_unique<netlist::param_str_t>(*this, plib::pfmt("CHAN{1}")(i), "");
+ m_param_mult[i] = std::make_unique<netlist::param_double_t>(*this, plib::pfmt("MULT{1}")(i), 1.0);
+ m_param_offset[i] = std::make_unique<netlist::param_double_t>(*this, plib::pfmt("OFFSET{1}")(i), 0.0);
}
}
+ static const int MAX_INPUT_CHANNELS = 10;
+
ATTR_COLD void reset() override
{
m_pos = 0;
- for (auto & elem : m_channels)
- elem.m_buffer = nullptr;
+ for (auto & elem : m_buffer)
+ elem = nullptr;
}
- ATTR_COLD void resolve()
+ ATTR_COLD int resolve()
{
m_pos = 0;
for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
{
- if ((*m_channels[i].m_param_name)() != pstring(""))
+ if ((*m_param_name[i])() != pstring(""))
{
- if (i != m_num_channels)
- state().log().fatal("sound input numbering has to be sequential!");
- m_num_channels++;
- m_channels[i].m_param = dynamic_cast<netlist::param_double_t *>(setup().find_param((*m_channels[i].m_param_name)(), true));
+ if (i != m_num_channel)
+ netlist().log().fatal("sound input numbering has to be sequential!");
+ m_num_channel++;
+ m_param[i] = dynamic_cast<netlist::param_double_t *>(setup().find_param((*m_param_name[i])(), true));
}
}
+ return m_num_channel;
}
NETLIB_UPDATEI()
{
- for (int i=0; i<m_num_channels; i++)
+ for (int i=0; i<m_num_channel; i++)
{
- if (m_channels[i].m_buffer == nullptr)
+ if (m_buffer[i] == nullptr)
break; // stop, called outside of stream_update
- const nl_double v = m_channels[i].m_buffer[m_pos];
- m_channels[i].m_param->setTo(v * (*m_channels[i].m_param_mult)() + (*m_channels[i].m_param_offset)());
+ const nl_double v = m_buffer[i][m_pos];
+ m_param[i]->setTo(v * (*m_param_mult[i])() + (*m_param_offset[i])());
}
m_pos++;
m_Q.net().toggle_and_push_to_queue(m_inc);
@@ -430,25 +400,19 @@ public:
m_pos = 0;
}
- struct channel
- {
- netlist::pool_owned_ptr<netlist::param_str_t> m_param_name;
- netlist::param_double_t *m_param;
- stream_sample_t *m_buffer;
- netlist::pool_owned_ptr<netlist::param_double_t> m_param_mult;
- netlist::pool_owned_ptr<netlist::param_double_t> m_param_offset;
- };
- channel m_channels[MAX_INPUT_CHANNELS];
+ std::unique_ptr<netlist::param_str_t> m_param_name[MAX_INPUT_CHANNELS];
+ netlist::param_double_t *m_param[MAX_INPUT_CHANNELS];
+ stream_sample_t *m_buffer[MAX_INPUT_CHANNELS];
+ std::unique_ptr<netlist::param_double_t> m_param_mult[MAX_INPUT_CHANNELS];
+ std::unique_ptr<netlist::param_double_t> m_param_offset[MAX_INPUT_CHANNELS];
netlist::netlist_time m_inc;
- int num_channels() { return m_num_channels; }
-
private:
netlist::logic_input_t m_feedback;
netlist::logic_output_t m_Q;
int m_pos;
- int m_num_channels;
+ int m_num_channel;
};
@@ -467,25 +431,26 @@ private:
netlist::setup_t &netlist_mame_device::setup()
{
- return m_netlist->nlstate().setup();
+ return m_netlist->setup();
}
-void netlist_mame_device::register_memregion_source(netlist::nlparse_t &setup, device_t &dev, const char *name)
+void netlist_mame_device::register_memregion_source(netlist::setup_t &setup, const char *name)
{
- setup.register_source(plib::make_unique<netlist_source_memregion_t>(dev, pstring(name)));
+ setup.register_source(plib::make_unique_base<netlist::source_t, netlist_source_memregion_t>(setup, pstring(name, pstring::UTF8)));
}
void netlist_mame_analog_input_device::write(const double val)
{
- m_value_for_device_timer = val * m_mult + m_offset;
- if (m_value_for_device_timer != (*m_param)())
- synchronize(0, 0, &m_value_for_device_timer);
-}
-
-void netlist_mame_analog_input_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- update_to_current_time();
- m_param->setTo(*((double *) ptr));
+ if (is_sound_device())
+ {
+ update_to_current_time();
+ m_param->setTo(val * m_mult + m_offset);
+ }
+ else
+ {
+ // FIXME: use device timer ....
+ m_param->setTo(val * m_mult + m_offset);
+ }
}
void netlist_mame_int_input_device::write(const uint32_t val)
@@ -504,13 +469,15 @@ void netlist_mame_logic_input_device::write(const uint32_t val)
void netlist_mame_int_input_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- update_to_current_time();
+ if (is_sound_device())
+ update_to_current_time();
m_param->setTo(param);
}
void netlist_mame_logic_input_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- update_to_current_time();
+ if (is_sound_device())
+ update_to_current_time();
m_param->setTo(param);
}
@@ -533,7 +500,7 @@ void netlist_mame_cpu_device::state_string_export(const device_state_entry &entr
if (entry.index() & 1)
str = string_format("%10.6f", *((double *)entry.dataptr()));
else
- str = string_format("%d", *((netlist::netlist_sig_t *)entry.dataptr()));
+ str = string_format("%d", *((netlist_sig_t *)entry.dataptr()));
}
}
@@ -561,7 +528,7 @@ netlist_mame_analog_input_device::netlist_mame_analog_input_device(const machine
void netlist_mame_analog_input_device::device_start()
{
LOGDEVCALLS("start\n");
- netlist::param_t *p = this->nl_owner().setup().find_param(pstring(m_param_name));
+ netlist::param_t *p = this->nl_owner().setup().find_param(pstring(m_param_name, pstring::UTF8));
m_param = dynamic_cast<netlist::param_double_t *>(p);
if (m_param == nullptr)
{
@@ -593,17 +560,16 @@ void netlist_mame_analog_output_device::set_params(const char *in_name, output_d
m_delegate = std::move(adelegate);
}
-void netlist_mame_analog_output_device::custom_netlist_additions(netlist::netlist_state_t &nlstate)
+void netlist_mame_analog_output_device::custom_netlist_additions(netlist::setup_t &setup)
{
- const pstring pin(m_in);
+ const pstring pin(m_in, pstring::UTF8);
pstring dname = pstring("OUT_") + pin;
- pstring dfqn = nlstate.setup().build_fqn(dname);
m_delegate.bind_relative_to(owner()->machine().root_device());
- auto dev = netlist::pool().make_poolptr<NETLIB_NAME(analog_callback)>(nlstate, dfqn);
+ plib::owned_ptr<netlist::device_t> dev = plib::owned_ptr<netlist::device_t>::Create<NETLIB_NAME(analog_callback)>(setup.netlist(), setup.build_fqn(dname));
static_cast<NETLIB_NAME(analog_callback) *>(dev.get())->register_callback(std::move(m_delegate));
- nlstate.add_dev(dfqn, std::move(dev));
- nlstate.setup().register_link(dname + ".IN", pin);
+ setup.netlist().register_dev(std::move(dev));
+ setup.register_link(dname + ".IN", pin);
}
void netlist_mame_analog_output_device::device_start()
@@ -629,18 +595,16 @@ void netlist_mame_logic_output_device::set_params(const char *in_name, output_de
m_delegate = std::move(adelegate);
}
-void netlist_mame_logic_output_device::custom_netlist_additions(netlist::netlist_state_t &nlstate)
+void netlist_mame_logic_output_device::custom_netlist_additions(netlist::setup_t &setup)
{
- pstring pin(m_in);
+ pstring pin(m_in, pstring::UTF8);
pstring dname = "OUT_" + pin;
- pstring dfqn = nlstate.setup().build_fqn(dname);
-
m_delegate.bind_relative_to(owner()->machine().root_device());
- auto dev = netlist::pool().make_poolptr<NETLIB_NAME(logic_callback)>(nlstate, dfqn);
+ plib::owned_ptr<netlist::device_t> dev = plib::owned_ptr<netlist::device_t>::Create<NETLIB_NAME(logic_callback)>(setup.netlist(), setup.build_fqn(dname));
static_cast<NETLIB_NAME(logic_callback) *>(dev.get())->register_callback(std::move(m_delegate));
- nlstate.add_dev(dfqn, std::move(dev));
- nlstate.setup().register_link(dname + ".IN", pin);
+ setup.netlist().register_dev(std::move(dev));
+ setup.register_link(dname + ".IN", pin);
}
void netlist_mame_logic_output_device::device_start()
@@ -674,7 +638,7 @@ void netlist_mame_int_input_device::set_params(const char *param_name, const uin
void netlist_mame_int_input_device::device_start()
{
LOGDEVCALLS("start\n");
- netlist::param_t *p = downcast<netlist_mame_device *>(this->owner())->setup().find_param(pstring(m_param_name));
+ netlist::param_t *p = downcast<netlist_mame_device *>(this->owner())->setup().find_param(pstring(m_param_name, pstring::UTF8));
m_param = dynamic_cast<netlist::param_int_t *>(p);
if (m_param == nullptr)
{
@@ -705,7 +669,7 @@ void netlist_mame_logic_input_device::set_params(const char *param_name, const u
void netlist_mame_logic_input_device::device_start()
{
LOGDEVCALLS("start\n");
- netlist::param_t *p = downcast<netlist_mame_device *>(this->owner())->setup().find_param(pstring(m_param_name));
+ netlist::param_t *p = downcast<netlist_mame_device *>(this->owner())->setup().find_param(pstring(m_param_name, pstring::UTF8));
m_param = dynamic_cast<netlist::param_logic_t *>(p);
if (m_param == nullptr)
{
@@ -736,7 +700,7 @@ void netlist_mame_ram_pointer_device::set_params(const char *param_name)
void netlist_mame_ram_pointer_device::device_start()
{
LOGDEVCALLS("start\n");
- netlist::param_t *p = downcast<netlist_mame_device *>(this->owner())->setup().find_param(pstring(m_param_name));
+ netlist::param_t *p = downcast<netlist_mame_device *>(this->owner())->setup().find_param(pstring(m_param_name, pstring::UTF8));
m_param = dynamic_cast<netlist::param_ptr_t *>(p);
if (m_param == nullptr)
{
@@ -769,17 +733,17 @@ void netlist_mame_stream_input_device::device_start()
LOGDEVCALLS("start\n");
}
-void netlist_mame_stream_input_device::custom_netlist_additions(netlist::netlist_state_t &nlstate)
+void netlist_mame_stream_input_device::custom_netlist_additions(netlist::setup_t &setup)
{
- if (!nlstate.setup().device_exists("STREAM_INPUT"))
- nlstate.setup().register_dev("NETDEV_SOUND_IN", "STREAM_INPUT");
+ if (!setup.device_exists("STREAM_INPUT"))
+ setup.register_dev("NETDEV_SOUND_IN", "STREAM_INPUT");
pstring sparam = plib::pfmt("STREAM_INPUT.CHAN{1}")(m_channel);
- nlstate.setup().register_param(sparam, pstring(m_param_name));
+ setup.register_param(sparam, pstring(m_param_name, pstring::UTF8));
sparam = plib::pfmt("STREAM_INPUT.MULT{1}")(m_channel);
- nlstate.setup().register_param(sparam, m_mult);
+ setup.register_param(sparam, m_mult);
sparam = plib::pfmt("STREAM_INPUT.OFFSET{1}")(m_channel);
- nlstate.setup().register_param(sparam, m_offset);
+ setup.register_param(sparam, m_offset);
}
// ----------------------------------------------------------------------------------------
@@ -805,18 +769,18 @@ void netlist_mame_stream_output_device::device_start()
LOGDEVCALLS("start\n");
}
-void netlist_mame_stream_output_device::custom_netlist_additions(netlist::netlist_state_t &nlstate)
+void netlist_mame_stream_output_device::custom_netlist_additions(netlist::setup_t &setup)
{
//NETLIB_NAME(sound_out) *snd_out;
pstring sname = plib::pfmt("STREAM_OUT_{1}")(m_channel);
//snd_out = dynamic_cast<NETLIB_NAME(sound_out) *>(setup.register_dev("nld_sound_out", sname));
- nlstate.setup().register_dev("NETDEV_SOUND_OUT", sname);
+ setup.register_dev("NETDEV_SOUND_OUT", sname);
- nlstate.setup().register_param(sname + ".CHAN" , m_channel);
- nlstate.setup().register_param(sname + ".MULT", m_mult);
- nlstate.setup().register_param(sname + ".OFFSET", m_offset);
- nlstate.setup().register_link(sname + ".IN", pstring(m_out_name));
+ setup.register_param(sname + ".CHAN" , m_channel);
+ setup.register_param(sname + ".MULT", m_mult);
+ setup.register_param(sname + ".OFFSET", m_offset);
+ setup.register_link(sname + ".IN", pstring(m_out_name, pstring::UTF8));
}
@@ -833,6 +797,7 @@ netlist_mame_device::netlist_mame_device(const machine_config &mconfig, device_t
: device_t(mconfig, type, tag, owner, clock)
, m_icount(0)
, m_old(netlist::netlist_time::zero())
+ , m_netlist(nullptr)
, m_setup_func(nullptr)
{
}
@@ -842,6 +807,12 @@ netlist_mame_device::~netlist_mame_device()
LOGDEVCALLS("~netlist_mame_device\n");
}
+void netlist_mame_device::set_constructor(void (*setup_func)(netlist::setup_t &))
+{
+ if (LOG_DEV_CALLS) logerror("set_constructor\n");
+ m_setup_func = setup_func;
+}
+
void netlist_mame_device::device_config_complete()
{
LOGDEVCALLS("device_config_complete %s\n", this->mconfig().gamedrv().name);
@@ -859,7 +830,7 @@ void netlist_mame_device::device_start()
//printf("clock is %d\n", clock());
- m_netlist = netlist::pool().make_poolptr<netlist_mame_t>(*this, "netlist");
+ m_netlist = global_alloc(netlist_mame_t(*this, "netlist"));
// register additional devices
@@ -872,12 +843,12 @@ void netlist_mame_device::device_start()
if( sdev != nullptr )
{
LOGDEVCALLS("Preparse subdevice %s/%s\n", d.name(), d.shortname());
- sdev->pre_parse_action(m_netlist->nlstate());
+ sdev->pre_parse_action(setup());
}
}
/* add default data provider for roms */
- setup().register_source(plib::make_unique<netlist_data_memregions_t>(*this));
+ setup().register_source(plib::make_unique_base<netlist::source_t, netlist_data_memregions_t>(setup()));
m_setup_func(setup());
@@ -888,15 +859,15 @@ void netlist_mame_device::device_start()
if( sdev != nullptr )
{
LOGDEVCALLS("Found subdevice %s/%s\n", d.name(), d.shortname());
- sdev->custom_netlist_additions(m_netlist->nlstate());
+ sdev->custom_netlist_additions(setup());
}
}
- setup().prepare_to_run();
+ netlist().start();
- netlist().nlstate().save(*this, m_rem, this->name(), "m_rem");
- netlist().nlstate().save(*this, m_div, this->name(), "m_div");
- netlist().nlstate().save(*this, m_old, this->name(), "m_old");
+ netlist().save(*this, m_rem, "m_rem");
+ netlist().save(*this, m_div, "m_div");
+ netlist().save(*this, m_old, "m_old");
save_state();
@@ -925,26 +896,29 @@ void netlist_mame_device::device_stop()
{
LOGDEVCALLS("device_stop\n");
netlist().stop();
+
+ global_free(m_netlist);
+ m_netlist = nullptr;
}
ATTR_COLD void netlist_mame_device::device_post_load()
{
LOGDEVCALLS("device_post_load\n");
- netlist().run_state_manager().post_load();
- netlist().nlstate().rebuild_lists();
+ netlist().state().post_load();
+ netlist().rebuild_lists();
}
ATTR_COLD void netlist_mame_device::device_pre_save()
{
LOGDEVCALLS("device_pre_save\n");
- netlist().run_state_manager().pre_save();
+ netlist().state().pre_save();
}
-void netlist_mame_device::update_icount(netlist::netlist_time time)
+void netlist_mame_device::update_time_x()
{
- const netlist::netlist_time newt(time);
+ const netlist::netlist_time newt(netlist().time());
const netlist::netlist_time delta(newt - m_old + m_rem);
const uint64_t d = delta / m_div;
m_old = newt;
@@ -960,7 +934,7 @@ void netlist_mame_device::check_mame_abort_slice()
ATTR_COLD void netlist_mame_device::save_state()
{
- for (auto const & s : netlist().run_state_manager().save_list())
+ for (auto const & s : netlist().state().save_list())
{
netlist().log().debug("saving state for {1}\n", s->m_name.c_str());
if (s->m_dt.is_float)
@@ -1023,18 +997,17 @@ void netlist_mame_cpu_device::device_start()
state_add(STATE_GENPC, "GENPC", m_genPC).noshow();
state_add(STATE_GENPCBASE, "CURPC", m_genPC).noshow();
- int index = 0;
- for (auto &n : netlist().nlstate().nets())
+ for (int i=0; i < netlist().m_nets.size(); i++)
{
+ netlist::detail::net_t *n = netlist().m_nets[i].get();
if (n->is_logic())
{
- state_add(index, n->name().c_str(), *(downcast<netlist::logic_net_t &>(*n).Q_state_ptr()));
+ state_add(i*2, n->name().c_str(), *downcast<netlist::logic_net_t *>(n)->Q_state_ptr());
}
else
{
- state_add(index, n->name().c_str(), *(downcast<netlist::analog_net_t &>(*n).Q_Analog_state_ptr()));
+ state_add(i*2+1, n->name().c_str(), *downcast<netlist::analog_net_t *>(n)->Q_Analog_state_ptr());
}
- index++;
}
// set our instruction counter
@@ -1059,8 +1032,10 @@ ATTR_COLD uint64_t netlist_mame_cpu_device::execute_cycles_to_clocks(uint64_t cy
ATTR_HOT void netlist_mame_cpu_device::execute_run()
{
+ bool check_debugger = ((device_t::machine().debug_flags & DEBUG_FLAG_ENABLED) != 0);
+ // debugging
//m_ppc = m_pc; // copy PC to previous PC
- if (debugger_enabled())
+ if (check_debugger)
{
while (m_icount > 0)
{
@@ -1068,13 +1043,13 @@ ATTR_HOT void netlist_mame_cpu_device::execute_run()
m_genPC &= 255;
debugger_instruction_hook(m_genPC);
netlist().process_queue(m_div);
- update_icount(netlist().time());
+ update_time_x();
}
}
else
{
netlist().process_queue(m_div * m_icount);
- update_icount(netlist().time());
+ update_time_x();
}
}
@@ -1114,8 +1089,11 @@ offs_t netlist_disassembler::disassemble(std::ostream &stream, offs_t pc, const
netlist_mame_sound_device::netlist_mame_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: netlist_mame_device(mconfig, NETLIST_SOUND, tag, owner, clock)
, device_sound_interface(mconfig, *this)
+ , m_out{nullptr}
, m_in(nullptr)
, m_stream(nullptr)
+ , m_num_inputs(0)
+ , m_num_outputs(0)
{
}
@@ -1127,45 +1105,44 @@ void netlist_mame_sound_device::device_start()
// Configure outputs
- std::vector<nld_sound_out *> outdevs = netlist().nlstate().get_device_list<nld_sound_out>();
+ std::vector<nld_sound_out *> outdevs = netlist().get_device_list<nld_sound_out>();
if (outdevs.size() == 0)
fatalerror("No output devices");
- //m_num_outputs = outdevs.size();
+ m_num_outputs = outdevs.size();
/* resort channels */
- for (auto &outdev : outdevs)
+ for (int i=0; i < MAX_OUT; i++) m_out[i] = nullptr;
+ for (int i=0; i < m_num_outputs; i++)
{
- int chan = outdev->m_channel();
+ int chan = outdevs[i]->m_channel();
- netlist().log().verbose("Output %s on channel %d", outdev->name(), chan);
+ netlist().log().verbose("Output %d on channel %d", i, chan);
- if (chan < 0 || chan >= outdevs.size())
+ if (chan < 0 || chan >= MAX_OUT || chan >= outdevs.size())
fatalerror("illegal channel number");
- m_out[chan] = outdev;
- m_out[chan]->m_sample_time = netlist::netlist_time::from_hz(clock());
+ m_out[chan] = outdevs[i];
+ m_out[chan]->m_sample = netlist::netlist_time::from_hz(clock());
m_out[chan]->m_buffer = nullptr;
- m_out[chan]->m_bufsize = 0;
}
// Configure inputs
- // FIXME: The limitation to one input device seems artificial.
- // We should allow multiple devices with one channel each.
+ m_num_inputs = 0;
m_in = nullptr;
- std::vector<nld_sound_in *> indevs = netlist().nlstate().get_device_list<nld_sound_in>();
+ std::vector<nld_sound_in *> indevs = netlist().get_device_list<nld_sound_in>();
if (indevs.size() > 1)
fatalerror("A maximum of one input device is allowed!");
if (indevs.size() == 1)
{
m_in = indevs[0];
- m_in->resolve();
+ m_num_inputs = m_in->resolve();
m_in->m_inc = netlist::netlist_time::from_hz(clock());
}
/* initialize the stream(s) */
- m_stream = machine().sound().stream_alloc(*this, m_in ? m_in->num_channels() : 0, m_out.size(), clock());
+ m_stream = machine().sound().stream_alloc(*this, m_num_inputs, m_num_outputs, clock());
}
@@ -1178,21 +1155,17 @@ void netlist_mame_sound_device::nl_register_devices()
void netlist_mame_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
{
-
- for (auto &e : m_out)
+ for (int i=0; i < m_num_outputs; i++)
{
- e.second->m_buffer = outputs[e.first];
- e.second->m_bufsize = samples;
+ m_out[i]->m_buffer = outputs[i];
}
+ if (m_num_inputs)
+ m_in->buffer_reset();
- if (m_in)
+ for (int i=0; i < m_num_inputs; i++)
{
- m_in->buffer_reset();
- for (int i=0; i < m_in->num_channels(); i++)
- {
- m_in->m_channels[i].m_buffer = inputs[i];
- }
+ m_in->m_buffer[i] = inputs[i];
}
netlist::netlist_time cur(netlist().time());
@@ -1201,9 +1174,9 @@ void netlist_mame_sound_device::sound_stream_update(sound_stream &stream, stream
cur += (m_div * samples);
- for (auto &e : m_out)
+ for (int i=0; i < m_num_outputs; i++)
{
- e.second->sound_update_fill(samples);
- e.second->buffer_reset(cur);
+ m_out[i]->sound_update(cur);
+ m_out[i]->buffer_reset(cur);
}
}
diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h
index 639223d2842..36bdcb0c415 100644
--- a/src/devices/machine/netlist.h
+++ b/src/devices/machine/netlist.h
@@ -11,19 +11,16 @@
#ifndef MAME_MACHINE_NETLIST_H
#define MAME_MACHINE_NETLIST_H
-#include <functional>
-
-#include "../../lib/netlist/nltypes.h"
+#include "netlist/nl_time.h"
class nld_sound_out;
class nld_sound_in;
namespace netlist {
class setup_t;
- class netlist_state_t;
- class nlparse_t;
- template <typename T>
- class param_num_t;
+ class param_double_t;
+ class param_int_t;
+ class param_logic_t;
class param_ptr_t;
}
@@ -34,9 +31,6 @@ namespace netlist {
#define MCFG_NETLIST_SETUP(_setup) \
downcast<netlist_mame_device &>(*device).set_constructor(NETLIST_NAME(_setup));
-#define MCFG_NETLIST_SETUP_MEMBER(_obj, _setup) \
- downcast<netlist_mame_device &>(*device).set_constructor(_obj, _setup);
-
#define MCFG_NETLIST_ANALOG_INPUT(_basetag, _tag, _name) \
MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_ANALOG_INPUT, 0) \
downcast<netlist_mame_analog_input_device &>(*device).set_name(_name);
@@ -85,10 +79,9 @@ namespace netlist {
#define NETLIST_ANALOG_PORT_CHANGED(_base, _tag) \
PORT_CHANGED_MEMBER(_base ":" _tag, netlist_mame_analog_input_device, input_changed, 0)
-/* This macro can only be called from device member */
#define MEMREGION_SOURCE(_name) \
- netlist_mame_device::register_memregion_source(setup, *this, _name);
+ netlist_mame_device::register_memregion_source(setup, _name);
#define NETDEV_ANALOG_CALLBACK_MEMBER(_name) \
void _name(const double data, const attotime &time)
@@ -106,32 +99,21 @@ class netlist_mame_device : public device_t
{
public:
class netlist_mame_t;
- class netlist_mame_callbacks_t;
-
- using func_type = std::function<void(netlist::nlparse_t &)>;
// construction/destruction
netlist_mame_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~netlist_mame_device();
- void set_constructor(void (*setup_func)(netlist::nlparse_t &))
- {
- m_setup_func = func_type(setup_func);
- }
-
- template <typename T, typename F>
- void set_constructor(T *obj, F && f)
- {
- m_setup_func = std::move(std::bind(std::forward<F>(f), obj, std::placeholders::_1));
- }
+ void set_constructor(void (*setup_func)(netlist::setup_t &));
ATTR_HOT inline netlist::setup_t &setup();
ATTR_HOT inline netlist_mame_t &netlist() { return *m_netlist; }
- ATTR_HOT void update_icount(netlist::netlist_time time);
+ ATTR_HOT inline const netlist::netlist_time last_time_update() { return m_old; }
+ ATTR_HOT void update_time_x();
ATTR_HOT void check_mame_abort_slice();
- static void register_memregion_source(netlist::nlparse_t &setup, device_t &dev, const char *name);
+ static void register_memregion_source(netlist::setup_t &setup, const char *name);
int m_icount;
@@ -160,9 +142,9 @@ private:
netlist::netlist_time m_rem;
netlist::netlist_time m_old;
- netlist::pool_owned_ptr<netlist_mame_t> m_netlist;
+ netlist_mame_t * m_netlist;
- func_type m_setup_func;
+ void (*m_setup_func)(netlist::setup_t &);
};
// ----------------------------------------------------------------------------------------
@@ -249,9 +231,13 @@ protected:
virtual void device_start() override;
private:
- std::map<int, nld_sound_out *> m_out;
+ static constexpr int MAX_OUT = 10;
+ nld_sound_out *m_out[MAX_OUT];
nld_sound_in *m_in;
sound_stream *m_stream;
+ int m_num_inputs;
+ int m_num_outputs;
+
};
// ----------------------------------------------------------------------------------------
@@ -269,16 +255,14 @@ public:
{
}
- virtual void custom_netlist_additions(netlist::netlist_state_t &nlstate) { }
- virtual void pre_parse_action(netlist::netlist_state_t &nlstate) { }
+ virtual void custom_netlist_additions(netlist::setup_t &setup) { }
+ virtual void pre_parse_action(netlist::setup_t &setup) { }
inline netlist_mame_device &nl_owner() const { return *m_owner; }
- inline void update_to_current_time()
- {
- if (m_sound != nullptr)
- m_sound->get_stream()->update();
- }
+ inline bool is_sound_device() const { return bool(m_sound); }
+
+ inline void update_to_current_time() { m_sound->get_stream()->update(); }
void set_mult_offset(const double mult, const double offset);
@@ -322,13 +306,11 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
- netlist::param_num_t<double> *m_param;
+ netlist::param_double_t *m_param;
bool m_auto_port;
const char *m_param_name;
- double m_value_for_device_timer;
};
// ----------------------------------------------------------------------------------------
@@ -348,7 +330,7 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void custom_netlist_additions(netlist::netlist_state_t &nlstate) override;
+ virtual void custom_netlist_additions(netlist::setup_t &setup) override;
private:
const char *m_in;
@@ -380,7 +362,7 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void custom_netlist_additions(netlist::netlist_state_t &nlstate) override;
+ virtual void custom_netlist_additions(netlist::setup_t &setup) override;
private:
const char *m_in;
@@ -420,7 +402,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
- netlist::param_num_t<int> *m_param;
+ netlist::param_int_t *m_param;
uint32_t m_mask;
uint32_t m_shift;
const char *m_param_name;
@@ -459,7 +441,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
- netlist::param_num_t<bool> *m_param;
+ netlist::param_logic_t *m_param;
uint32_t m_shift;
const char *m_param_name;
};
@@ -509,7 +491,7 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void custom_netlist_additions(netlist::netlist_state_t &nlstate) override;
+ virtual void custom_netlist_additions(netlist::setup_t &setup) override;
private:
uint32_t m_channel;
const char *m_param_name;
@@ -535,7 +517,7 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void custom_netlist_additions(netlist::netlist_state_t &nlstate) override;
+ virtual void custom_netlist_additions(netlist::setup_t &setup) override;
private:
uint32_t m_channel;
diff --git a/src/devices/machine/nmc9306.h b/src/devices/machine/nmc9306.h
index 07aa6b36db0..097742685aa 100644
--- a/src/devices/machine/nmc9306.h
+++ b/src/devices/machine/nmc9306.h
@@ -19,6 +19,17 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_NMC9306_ADD(tag) \
+ MCFG_DEVICE_ADD((tag), NMC9306, 0)
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/devices/machine/nsc810.cpp b/src/devices/machine/nsc810.cpp
index 96a13e7b696..bf06c34d9dc 100644
--- a/src/devices/machine/nsc810.cpp
+++ b/src/devices/machine/nsc810.cpp
@@ -118,7 +118,7 @@ void nsc810_device::device_timer(emu_timer &timer, device_timer_id id, int param
}
}
-uint8_t nsc810_device::read(offs_t offset)
+READ8_MEMBER(nsc810_device::read)
{
uint8_t res = 0xff;
@@ -191,7 +191,7 @@ uint8_t nsc810_device::read(offs_t offset)
return res;
}
-void nsc810_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(nsc810_device::write)
{
uint32_t rate;
diff --git a/src/devices/machine/nsc810.h b/src/devices/machine/nsc810.h
index 520591208f7..bebeb8f82a6 100644
--- a/src/devices/machine/nsc810.h
+++ b/src/devices/machine/nsc810.h
@@ -16,38 +16,24 @@ class nsc810_device : public device_t
{
public:
// construction/destruction
- nsc810_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t clk0, uint32_t clk1)
- : nsc810_device(mconfig, tag, owner, clock)
- {
- set_timer0_clock(clk0);
- set_timer1_clock(clk1);
- }
-
- nsc810_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, const XTAL &clk0, const XTAL &clk1)
- : nsc810_device(mconfig, tag, owner, clock)
- {
- set_timer0_clock(clk0.value());
- set_timer1_clock(clk1.value());
- }
-
nsc810_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto portA_read_callback() { return m_portA_r.bind(); }
- auto portB_read_callback() { return m_portB_r.bind(); }
- auto portC_read_callback() { return m_portC_r.bind(); }
- auto portA_write_callback() { return m_portA_w.bind(); }
- auto portB_write_callback() { return m_portB_w.bind(); }
- auto portC_write_callback() { return m_portC_w.bind(); }
- auto timer0_callback() { return m_timer0_out.bind(); }
- auto timer1_callback() { return m_timer1_out.bind(); }
+ template <class Object> devcb_base &set_portA_read_callback(Object &&cb) { return m_portA_r.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_portB_read_callback(Object &&cb) { return m_portB_r.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_portC_read_callback(Object &&cb) { return m_portC_r.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_portA_write_callback(Object &&cb) { return m_portA_w.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_portB_write_callback(Object &&cb) { return m_portB_w.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_portC_write_callback(Object &&cb) { return m_portC_w.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_timer0_callback(Object &&cb) { return m_timer0_out.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_timer1_callback(Object &&cb) { return m_timer1_out.set_callback(std::forward<Object>(cb)); }
void set_timer0_clock(uint32_t clk) { m_timer0_clock = clk; }
void set_timer0_clock(const XTAL &clk) { set_timer0_clock(clk.value()); }
void set_timer1_clock(uint32_t clk) { m_timer1_clock = clk; }
void set_timer1_clock(const XTAL &clk) { set_timer1_clock(clk.value()); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
protected:
virtual void device_start() override;
@@ -116,6 +102,35 @@ private:
};
};
+#define MCFG_NSC810_ADD(_tag, _t0clk, _t1clk) \
+ MCFG_DEVICE_ADD(_tag, NSC810, 0) \
+ downcast<nsc810_device *>(device)->set_timer0_clock(_t0clk); \
+ downcast<nsc810_device *>(device)->set_timer1_clock(_t1clk);
+
+#define MCFG_NSC810_PORTA_READ(_read) \
+ downcast<nsc810_device &>(*device).set_portA_read_callback(DEVCB_##_read);
+
+#define MCFG_NSC810_PORTB_READ(_read) \
+ downcast<nsc810_device &>(*device).set_portB_read_callback(DEVCB_##_read);
+
+#define MCFG_NSC810_PORTC_READ(_read) \
+ downcast<nsc810_device &>(*device).set_portC_read_callback(DEVCB_##_read);
+
+#define MCFG_NSC810_PORTA_WRITE(_write) \
+ downcast<nsc810_device &>(*device).set_portA_write_callback(DEVCB_##_write);
+
+#define MCFG_NSC810_PORTB_WRITE(_write) \
+ downcast<nsc810_device &>(*device).set_portB_write_callback(DEVCB_##_write);
+
+#define MCFG_NSC810_PORTC_WRITE(_write) \
+ downcast<nsc810_device &>(*device).set_portC_write_callback(DEVCB_##_write);
+
+#define MCFG_NSC810_TIMER0_OUT(_write) \
+ downcast<nsc810_device &>(*device).set_timer0_callback(DEVCB_##_write);
+
+#define MCFG_NSC810_TIMER1_OUT(_write) \
+ downcast<nsc810_device &>(*device).set_timer1_callback(DEVCB_##_write);
+
// device type definition
DECLARE_DEVICE_TYPE(NSC810, nsc810_device)
diff --git a/src/devices/machine/nscsi_bus.cpp b/src/devices/machine/nscsi_bus.cpp
index ef3c0dd9f9a..328dd7239bd 100644
--- a/src/devices/machine/nscsi_bus.cpp
+++ b/src/devices/machine/nscsi_bus.cpp
@@ -3,15 +3,13 @@
#include "emu.h"
#include "nscsi_bus.h"
-#define LOG_GENERAL (1U << 0)
-#define LOG_UNSUPPORTED (1U << 1)
-#define LOG_STATE (1U << 2)
-#define LOG_CONTROL (1U << 3)
-#define LOG_DATA (1U << 4)
-#define LOG_DATA_SENT (1U << 5)
+#define LOG_GENERAL (1U << 0)
+#define LOG_STATE (1U << 1)
+#define LOG_CONTROL (1U << 2)
+#define LOG_DATA (1U << 3)
//#define VERBOSE (LOG_GENERAL | LOG_STATE | LOG_CONTROL | LOG_DATA)
-#define VERBOSE (LOG_UNSUPPORTED | LOG_DATA_SENT)
+#define VERBOSE 0
#include "logmacro.h"
@@ -442,7 +440,7 @@ void nscsi_full_device::step(bool timeout)
break;
}
- if(scsi_command_done(scsi_cmdbuf[0], data_buffer_pos)) {
+ if(command_done()) {
scsi_cmdsize = data_buffer_pos;
scsi_bus->ctrl_wait(scsi_refid, 0, S_ACK);
scsi_command();
@@ -509,17 +507,18 @@ void nscsi_full_device::target_send_buffer_byte()
target_send_byte(scsi_get_data(data_buffer_id, data_buffer_pos++));
}
-bool nscsi_full_device::scsi_command_done(uint8_t command, uint8_t length)
+bool nscsi_full_device::command_done()
{
- if(!length)
+ if(!data_buffer_pos)
return false;
- switch(command >> 5) {
- case 0: return length == 6;
- case 1: return length == 10;
- case 2: return length == 10;
+ uint8_t h = scsi_cmdbuf[0];
+ switch(h >> 5) {
+ case 0: return data_buffer_pos == 6;
+ case 1: return data_buffer_pos == 10;
+ case 2: return data_buffer_pos == 10;
case 3: return true;
case 4: return true;
- case 5: return length == 12;
+ case 5: return data_buffer_pos == 12;
case 6: return true;
case 7: return true;
}
@@ -563,17 +562,6 @@ void nscsi_full_device::scsi_status_complete(uint8_t st)
void nscsi_full_device::scsi_data_in(int buf, int size)
{
- if((VERBOSE & LOG_DATA_SENT) && buf == 0) {
- std::string dt = "";
- int sz = size;
- if(sz > 50)
- sz = 50;
- for(int i=0; i<sz; i++)
- dt += util::string_format(" %02x", scsi_cmdbuf[i]);
- if(size > sz)
- dt += " ...";
- LOGMASKED(LOG_DATA_SENT, "Sending data (%d)%s\n", size, dt);
- }
control *c;
c = buf_control_push();
c->action = BC_DATA_IN;
@@ -595,28 +583,31 @@ void nscsi_full_device::sense(bool deferred, uint8_t key, uint8_t asc, uint8_t a
memset(scsi_sense_buffer, 0, sizeof(scsi_sense_buffer));
scsi_sense_buffer[0] = deferred ? 0x71 : 0x70;
scsi_sense_buffer[2] = key;
- scsi_sense_buffer[7] = sizeof(scsi_sense_buffer) - 8;
scsi_sense_buffer[12] = asc;
scsi_sense_buffer[13] = ascq;
}
void nscsi_full_device::scsi_unknown_command()
{
- std::string txt = util::string_format("Unhandled command %s (%d):", command_names[scsi_cmdbuf[0]], scsi_cmdsize);
+ LOG("Unhandled command %s", command_names[scsi_cmdbuf[0]]);
for(int i=0; i != scsi_cmdsize; i++)
- txt += util::string_format(" %02x", scsi_cmdbuf[i]);
- LOGMASKED(LOG_UNSUPPORTED, "%s\n", txt);
+ logerror(" %02x", scsi_cmdbuf[i]);
+ logerror("\n");
scsi_status_complete(SS_CHECK_CONDITION);
- sense(false, SK_ILLEGAL_REQUEST);
+ sense(false, 5);
}
void nscsi_full_device::scsi_command()
{
switch(scsi_cmdbuf[0]) {
case SC_REQUEST_SENSE:
- LOG("command REQUEST SENSE alloc=%d\n", scsi_cmdbuf[4]);
- scsi_data_in(SBUF_SENSE, scsi_cmdbuf[4] ? std::min(scsi_cmdbuf[4], u8(sizeof(scsi_sense_buffer))) : 4);
+ LOG("command REQUEST SENSE\n");
+ /*
+ * Targets shall be capable of returning eighteen bytes of data in
+ * response to a REQUEST SENSE command.
+ */
+ scsi_data_in(SBUF_SENSE, 18);
scsi_status_complete(SS_GOOD);
break;
default:
@@ -632,10 +623,10 @@ void nscsi_full_device::scsi_message()
return;
}
- std::string txt = "Unknown message";
+ LOG("Unknown message");
for(int i=0; i != scsi_cmdsize; i++)
- txt += util::string_format(" %02x", scsi_cmdbuf[i]);
- LOGMASKED(LOG_UNSUPPORTED, "%s\n", txt);
+ logerror(" %02x", scsi_cmdbuf[i]);
+ logerror("\n");
}
int nscsi_full_device::get_lun(int def)
@@ -649,7 +640,9 @@ int nscsi_full_device::get_lun(int def)
void nscsi_full_device::bad_lun()
{
scsi_status_complete(SS_CHECK_CONDITION);
- sense(false, SK_ILLEGAL_REQUEST, SK_ASC_LOGICAL_UNIT_NOT_SUPPORTED);
+
+ // key:illegal request, asc:logical unit not supported
+ sense(false, 5, 0x25);
}
// Arbitration delay (2.4us)
diff --git a/src/devices/machine/nscsi_bus.h b/src/devices/machine/nscsi_bus.h
index 244eda94fe8..5e7d7dcecab 100644
--- a/src/devices/machine/nscsi_bus.h
+++ b/src/devices/machine/nscsi_bus.h
@@ -6,12 +6,19 @@
#pragma once
+#define MCFG_NSCSI_BUS_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, NSCSI_BUS, 0)
+
+#define MCFG_NSCSI_ADD(_tag, _slot_intf, _def_slot, _fixed) \
+ MCFG_DEVICE_ADD(_tag, NSCSI_CONNECTOR, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed)
+
class nscsi_device;
class nscsi_bus_device : public device_t
{
public:
- nscsi_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ nscsi_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void ctrl_w(int refid, uint32_t lines, uint32_t mask);
void data_w(int refid, uint32_t lines);
@@ -42,19 +49,10 @@ private:
};
class nscsi_connector: public device_t,
- public device_slot_interface
+ public device_slot_interface
{
public:
- template <typename T>
- nscsi_connector(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt, bool fixed = false)
- : nscsi_connector(mconfig, tag, owner, 0)
- {
- option_reset();
- opts(*this);
- set_default_option(dflt);
- set_fixed(fixed);
- }
- nscsi_connector(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ nscsi_connector(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~nscsi_connector();
nscsi_device *get_device();
@@ -169,9 +167,7 @@ protected:
// SCSI addtional sense code qualifiers
enum {
- SK_ASC_INVALID_FIELD_IN_CDB = 0x24,
- SK_ASC_LOGICAL_UNIT_NOT_SUPPORTED = 0x25,
- SK_ASC_MEDIUM_NOT_PRESENT = 0x3a
+ SK_ASC_MEDIUM_NOT_PRESENT = 0x3a
};
// SCSI commands
@@ -308,7 +304,6 @@ protected:
virtual void scsi_message();
virtual void scsi_command();
- virtual bool scsi_command_done(uint8_t command, uint8_t length);
void scsi_unknown_command();
void scsi_status_complete(uint8_t st);
@@ -449,6 +444,7 @@ private:
void target_recv_byte();
void target_send_byte(uint8_t val);
void target_send_buffer_byte();
+ bool command_done();
};
diff --git a/src/devices/machine/nscsi_cb.h b/src/devices/machine/nscsi_cb.h
index 575e8f19298..b5156935a98 100644
--- a/src/devices/machine/nscsi_cb.h
+++ b/src/devices/machine/nscsi_cb.h
@@ -8,20 +8,48 @@
#include "machine/nscsi_bus.h"
+#define MCFG_NSCSICB_RST_HANDLER(_line) \
+ downcast<nscsi_callback_device *>(device)->set_rst_callback(DEVCB_##_line);
+
+#define MCFG_NSCSICB_ATN_HANDLER(_line) \
+ downcast<nscsi_callback_device *>(device)->set_atn_callback(DEVCB_##_line);
+
+#define MCFG_NSCSICB_ACK_HANDLER(_line) \
+ downcast<nscsi_callback_device *>(device)->set_ack_callback(DEVCB_##_line);
+
+#define MCFG_NSCSICB_REQ_HANDLER(_line) \
+ downcast<nscsi_callback_device *>(device)->set_req_callback(DEVCB_##_line);
+
+#define MCFG_NSCSICB_MSG_HANDLER(_line) \
+ downcast<nscsi_callback_device *>(device)->set_msg_callback(DEVCB_##_line);
+
+#define MCFG_NSCSICB_IO_HANDLER(_line) \
+ downcast<nscsi_callback_device *>(device)->set_io_callback(DEVCB_##_line);
+
+#define MCFG_NSCSICB_CD_HANDLER(_line) \
+ downcast<nscsi_callback_device *>(device)->set_cd_callback(DEVCB_##_line);
+
+#define MCFG_NSCSICB_SEL_HANDLER(_line) \
+ downcast<nscsi_callback_device *>(device)->set_sel_callback(DEVCB_##_line);
+
+#define MCFG_NSCSICB_BSY_HANDLER(_line) \
+ downcast<nscsi_callback_device *>(device)->set_bsy_callback(DEVCB_##_line);
+
+
class nscsi_callback_device : public nscsi_device
{
public:
nscsi_callback_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto rst_callback() { return m_write_rst.bind(); }
- auto atn_callback() { return m_write_atn.bind(); }
- auto ack_callback() { return m_write_ack.bind(); }
- auto req_callback() { return m_write_req.bind(); }
- auto msg_callback() { return m_write_msg.bind(); }
- auto io_callback() { return m_write_io.bind(); }
- auto cd_callback() { return m_write_cd.bind(); }
- auto sel_callback() { return m_write_sel.bind(); }
- auto bsy_callback() { return m_write_bsy.bind(); }
+ template <class Line> devcb_base &set_rst_callback(Line &&cb) { return m_write_rst.set_callback(std::forward<Line>(cb)); }
+ template <class Line> devcb_base &set_atn_callback(Line &&cb) { return m_write_atn.set_callback(std::forward<Line>(cb)); }
+ template <class Line> devcb_base &set_ack_callback(Line &&cb) { return m_write_ack.set_callback(std::forward<Line>(cb)); }
+ template <class Line> devcb_base &set_req_callback(Line &&cb) { return m_write_req.set_callback(std::forward<Line>(cb)); }
+ template <class Line> devcb_base &set_msg_callback(Line &&cb) { return m_write_msg.set_callback(std::forward<Line>(cb)); }
+ template <class Line> devcb_base &set_io_callback(Line &&cb) { return m_write_io.set_callback(std::forward<Line>(cb)); }
+ template <class Line> devcb_base &set_cd_callback(Line &&cb) { return m_write_cd.set_callback(std::forward<Line>(cb)); }
+ template <class Line> devcb_base &set_sel_callback(Line &&cb) { return m_write_sel.set_callback(std::forward<Line>(cb)); }
+ template <class Line> devcb_base &set_bsy_callback(Line &&cb) { return m_write_bsy.set_callback(std::forward<Line>(cb)); }
virtual void scsi_ctrl_changed() override;
diff --git a/src/devices/machine/nscsi_cd.cpp b/src/devices/machine/nscsi_cd.cpp
index 0446c600e9f..fc1898eecd5 100644
--- a/src/devices/machine/nscsi_cd.cpp
+++ b/src/devices/machine/nscsi_cd.cpp
@@ -7,7 +7,6 @@
#include "logmacro.h"
DEFINE_DEVICE_TYPE(NSCSI_CDROM, nscsi_cdrom_device, "scsi_cdrom", "SCSI CD-ROM")
-DEFINE_DEVICE_TYPE(NSCSI_CDROM_SGI, nscsi_cdrom_sgi_device, "scsi_cdrom_sgi", "SCSI CD-ROM SGI")
DEFINE_DEVICE_TYPE(NSCSI_RRD45, nscsi_dec_rrd45_device, "nrrd45", "RRD45 CD-ROM (New)")
DEFINE_DEVICE_TYPE(NSCSI_XM3301, nscsi_toshiba_xm3301_device, "nxm3301", "XM-3301TA CD-ROM (New)")
DEFINE_DEVICE_TYPE(NSCSI_XM5301SUN, nscsi_toshiba_xm5301_sun_device, "nxm5301sun", "XM-5301B Sun 4x CD-ROM (New)")
@@ -20,11 +19,6 @@ nscsi_cdrom_device::nscsi_cdrom_device(const machine_config &mconfig, const char
{
}
-nscsi_cdrom_sgi_device::nscsi_cdrom_sgi_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- nscsi_cdrom_device(mconfig, NSCSI_CDROM_SGI, tag, owner, "Sony", "CDU-76S", "1.0", 0x00, 0x05)
-{
-}
-
nscsi_dec_rrd45_device::nscsi_dec_rrd45_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
nscsi_cdrom_device(mconfig, NSCSI_RRD45, tag, owner, "DEC ", "RRD45 (C) DEC ", "0436", 0x98, 0x02)
{
@@ -82,19 +76,10 @@ void nscsi_cdrom_device::device_reset()
cur_sector = -1;
}
-void nscsi_cdrom_device::device_add_mconfig(machine_config &config)
-{
- CDROM(config, image).set_interface("cdrom");
-}
-
-int nscsi_cdrom_device::to_msf(int frame)
-{
- int m = frame / (75 * 60);
- int s = (frame / 75) % 60;
- int f = frame % 75;
-
- return (m << 16) | (s << 8) | f;
-}
+MACHINE_CONFIG_START(nscsi_cdrom_device::device_add_mconfig)
+ MCFG_CDROM_ADD("image")
+ MCFG_CDROM_INTERFACE("cdrom")
+MACHINE_CONFIG_END
void nscsi_cdrom_device::set_block_size(u32 block_size)
{
@@ -208,16 +193,21 @@ void nscsi_cdrom_device::scsi_command()
* is returned with sense data ILLEGAL REQUEST and LOGICAL UNIT NOT
* SUPPORTED.
*/
+ if(lun) {
+ bad_lun();
+ return;
+ }
+
int page = scsi_cmdbuf[2];
int size = scsi_cmdbuf[4];
switch(page) {
case 0:
std::fill_n(scsi_cmdbuf, 36, 0);
- if (lun != 0)
- scsi_cmdbuf[0] = 0x7f;
- else
- scsi_cmdbuf[0] = 0x05; // device is present, device is CD/DVD (MMC-3)
+ // vendor and product information must be padded with spaces
+ std::fill_n(&scsi_cmdbuf[8], 28, 0x20);
+
+ scsi_cmdbuf[0] = 0x05; // device is present, device is CD/DVD (MMC-3)
scsi_cmdbuf[1] = 0x80; // media is removable
scsi_cmdbuf[2] = compliance; // device complies with SPC-3 standard
scsi_cmdbuf[3] = 0x02; // response data format = SPC-3 standard
@@ -226,12 +216,6 @@ void nscsi_cdrom_device::scsi_command()
strncpy((char *)&scsi_cmdbuf[8], manufacturer, 8);
strncpy((char *)&scsi_cmdbuf[16], product, 16);
strncpy((char *)&scsi_cmdbuf[32], revision, 4);
-
- // vendor and product information must be padded with spaces
- for(int i = 8; i < 36; i++)
- if(scsi_cmdbuf[i] == 0)
- scsi_cmdbuf[i] = 0x20;
-
if(size > 36)
size = 36;
scsi_data_in(SBUF_MAIN, size);
@@ -257,48 +241,6 @@ void nscsi_cdrom_device::scsi_command()
scsi_status_complete(SS_GOOD);
break;
- case SC_RECIEVE_DIAG_RES: {
- LOG("command RECIEVE DIAGNOSTICS RESULTS");
- int size = (scsi_cmdbuf[3] << 8) | scsi_cmdbuf[4];
- int pos = 0;
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 6;
- scsi_cmdbuf[pos++] = 0; // ROM is OK
- scsi_cmdbuf[pos++] = 0; // RAM is OK
- scsi_cmdbuf[pos++] = 0; // Data buffer is OK
- scsi_cmdbuf[pos++] = 0; // Interface is OK
- scsi_cmdbuf[pos++] = 0;
- if(size > pos)
- size = pos;
- scsi_data_in(0, size);
- scsi_status_complete(SS_GOOD);
- break;
- }
-
- case SC_SEND_DIAGNOSTICS: {
- LOG("command SEND DIAGNOSTICS");
- int size = (scsi_cmdbuf[3] << 8) | scsi_cmdbuf[4];
- if(scsi_cmdbuf[1] & 4) {
- // Self-test
- scsi_status_complete(SS_GOOD);
- break;
- }
- int pos = 0;
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 6;
- scsi_cmdbuf[pos++] = 0; // ROM is OK
- scsi_cmdbuf[pos++] = 0; // RAM is OK
- scsi_cmdbuf[pos++] = 0; // Data buffer is OK
- scsi_cmdbuf[pos++] = 0; // Interface is OK
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 0;
- if(size > pos)
- size = pos;
- scsi_data_in(0, size);
- scsi_status_complete(SS_GOOD);
- break;
- }
-
case SC_READ_CAPACITY: {
if(!cdrom) {
return_no_cd();
@@ -308,7 +250,7 @@ void nscsi_cdrom_device::scsi_command()
LOG("command READ CAPACITY\n");
// get the last used block on the disc
- const u32 temp = cdrom_get_track_start(cdrom, 0xaa) * (bytes_per_sector / bytes_per_block) - 1;
+ const uint32_t temp = cdrom_get_track_start(cdrom, 0xaa) * (bytes_per_sector / bytes_per_block) - 1;
scsi_cmdbuf[0] = (temp>>24) & 0xff;
scsi_cmdbuf[1] = (temp>>16) & 0xff;
@@ -325,15 +267,16 @@ void nscsi_cdrom_device::scsi_command()
}
case SC_READ_10:
- lba = (scsi_cmdbuf[2]<<24) | (scsi_cmdbuf[3]<<16) | (scsi_cmdbuf[4]<<8) | scsi_cmdbuf[5];
- blocks = (scsi_cmdbuf[7] << 8) | scsi_cmdbuf[8];
-
- LOG("command READ EXTENDED start=%08x blocks=%04x\n", lba, blocks);
if(!cdrom) {
return_no_cd();
break;
}
+ lba = (scsi_cmdbuf[2]<<24) | (scsi_cmdbuf[3]<<16) | (scsi_cmdbuf[4]<<8) | scsi_cmdbuf[5];
+ blocks = (scsi_cmdbuf[7] << 8) | scsi_cmdbuf[8];
+
+ LOG("command READ EXTENDED start=%08x blocks=%04x\n", lba, blocks);
+
scsi_data_in(2, blocks*bytes_per_block);
scsi_status_complete(SS_GOOD);
break;
@@ -354,7 +297,7 @@ void nscsi_cdrom_device::scsi_command()
scsi_cmdbuf[pos++] = 0x80; // WP, cache
// get the last used block on the disc
- const u32 temp = cdrom_get_track_start(cdrom, 0xaa) * (bytes_per_sector / bytes_per_block) - 1;
+ const uint32_t temp = cdrom_get_track_start(cdrom, 0xaa) * (bytes_per_sector / bytes_per_block) - 1;
scsi_cmdbuf[pos++] = 0x08; // Block descriptor length
scsi_cmdbuf[pos++] = 0x00; // density code
@@ -366,11 +309,10 @@ void nscsi_cdrom_device::scsi_command()
scsi_cmdbuf[pos++] = (bytes_per_block>>8)&0xff;
scsi_cmdbuf[pos++] = (bytes_per_block & 0xff);
- bool fail = false;
int pmax = page == 0x3f ? 0x3e : page;
int pmin = page == 0x3f ? 0x00 : page;
- for(int p=pmax; p >= pmin; p--) {
- switch(p) {
+ for(int page=pmax; page >= pmin; page--) {
+ switch(page) {
case 0x00: // Vendor specific (does not require page format)
scsi_cmdbuf[pos++] = 0x80; // PS, page id
scsi_cmdbuf[pos++] = 0x02; // Page length
@@ -398,10 +340,7 @@ void nscsi_cdrom_device::scsi_command()
break;
default:
- if (page != 0x3f) {
- LOG("mode sense page %02x unhandled\n", p);
- fail = true;
- }
+ LOG("mode sense page %02x unhandled\n", page);
break;
}
}
@@ -409,13 +348,8 @@ void nscsi_cdrom_device::scsi_command()
if(pos > size)
pos = size;
- if (!fail) {
- scsi_data_in(0, pos);
- scsi_status_complete(SS_GOOD);
- } else {
- scsi_status_complete(SS_CHECK_CONDITION);
- sense(false, SK_ILLEGAL_REQUEST, SK_ASC_INVALID_FIELD_IN_CDB);
- }
+ scsi_data_in(0, pos);
+ scsi_status_complete(SS_GOOD);
break;
}
@@ -425,186 +359,10 @@ void nscsi_cdrom_device::scsi_command()
scsi_status_complete(SS_GOOD);
break;
- case SC_READ_TOC_PMA_ATIP: {
- /*
- Track numbers are problematic here: 0 = lead-in, 0xaa = lead-out.
- That makes sense in terms of how real-world CDs are referred to, but
- our internal routines for tracks use "0" as track 1. That probably
- should be fixed...
- */
- static const char *const format_names[16] = {
- "TOC",
- "Session info",
- "Full TOC",
- "PMA",
- "ATIP"
- "Reserved 5",
- "Reserved 6",
- "Reserved 7",
- "Reserved 8",
- "Reserved 9",
- "Reserved 10",
- "Reserved 11",
- "Reserved 12",
- "Reserved 13",
- "Reserved 14",
- "Reserved 15"
- };
-
- bool msf = (scsi_cmdbuf[1] & 0x2) != 0;
- u16 size = (scsi_cmdbuf[7] << 7) | scsi_cmdbuf[8];
- u8 format = scsi_cmdbuf[2] & 15;
-
- /// SFF8020 legacy format field (see T10/1836-D Revision 2g page 643)
- if(!format)
- format = (scsi_cmdbuf[9] >> 6) & 3;
-
- LOG("command READ TOC PMA ATIP, format %s msf=%d size=%d\n", format_names[format], msf, size);
-
- int pos = 0;
- switch (format) {
- case 0: {
- int start_track = scsi_cmdbuf[6];
- int end_track = cdrom_get_last_track(cdrom);
-
- int tracks;
- if(start_track == 0)
- tracks = end_track + 1;
- else if(start_track <= end_track)
- tracks = (end_track - start_track) + 2;
- else if(start_track <= 0xaa)
- tracks = 1;
- else
- tracks = 0;
-
- int len = 2 + (tracks * 8);
-
- // the returned TOC DATA LENGTH must be the full amount,
- // regardless of how much we're able to pass back due to size
- scsi_cmdbuf[pos++] = (len>>8) & 0xff;
- scsi_cmdbuf[pos++] = (len & 0xff);
- scsi_cmdbuf[pos++] = 1;
- scsi_cmdbuf[pos++] = cdrom_get_last_track(cdrom);
-
- if (start_track == 0)
- start_track = 1;
-
- for(int i = 0; i < tracks; i++) {
- int track = start_track + i;
- int cdrom_track = track - 1;
- if(i == tracks-1) {
- track = 0xaa;
- cdrom_track = 0xaa;
- }
-
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = cdrom_get_adr_control(cdrom, cdrom_track);
- scsi_cmdbuf[pos++] = track;
- scsi_cmdbuf[pos++] = 0;
-
- u32 tstart = cdrom_get_track_start(cdrom, cdrom_track);
-
- if(msf)
- tstart = to_msf(tstart+150);
-
- scsi_cmdbuf[pos++] = (tstart>>24) & 0xff;
- scsi_cmdbuf[pos++] = (tstart>>16) & 0xff;
- scsi_cmdbuf[pos++] = (tstart>>8) & 0xff;
- scsi_cmdbuf[pos++] = (tstart & 0xff);
- }
- break;
- }
-
- case 1: {
- int len = 2 + (8 * 1);
-
- scsi_cmdbuf[pos++] = (len>>8) & 0xff;
- scsi_cmdbuf[pos++] = (len & 0xff);
- scsi_cmdbuf[pos++] = 1;
- scsi_cmdbuf[pos++] = 1;
-
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = cdrom_get_adr_control(cdrom, 0);
- scsi_cmdbuf[pos++] = 1;
- scsi_cmdbuf[pos++] = 0;
-
- u32 tstart = cdrom_get_track_start(cdrom, 0);
-
- if (msf)
- tstart = to_msf(tstart+150);
-
- scsi_cmdbuf[pos++] = (tstart>>24) & 0xff;
- scsi_cmdbuf[pos++] = (tstart>>16) & 0xff;
- scsi_cmdbuf[pos++] = (tstart>>8) & 0xff;
- scsi_cmdbuf[pos++] = (tstart & 0xff);
- break;
- }
-
- default:
- LOG("Unhandled format %d\n", format_names[format]);
- break;
- }
-
- if(pos) {
- if(pos > size)
- pos = size;
-
- scsi_data_in(0, pos);
- scsi_status_complete(SS_GOOD);
- } else {
- // report unit attention condition
- scsi_status_complete(SS_CHECK_CONDITION);
- sense(false, SK_ILLEGAL_REQUEST);
- break;
- }
- break;
- }
-
default:
- nscsi_full_device::scsi_command();
- break;
- }
-}
-
-enum sgi_scsi_command_e : uint8_t {
- /*
- * The SGI supplied CD-ROM drives (and possibly those from some other vendors)
- * identify themselves as hard disk drives at poweron, and after SCSI bus resets,
- * until issued a vendor specific command (0xc9). This is done because older
- * systems would otherwise be unable to boot and load miniroots from CD, due to
- * their design (they attempted to protect the user from booting from
- * "ridiculous" devices, long before CD-ROM drives existed). The SGI drives are
- * sent a command to "revert" to CD-ROM inquiry information during boot if on
- * a SCSI bus handled by the PROM, but not all possible buses are handled by all
- * PROMs; additionally, a SCSI bus reset causes the CD-ROM drives to revert to
- * the poweron default, and this could happen before the hardware inventory code
- * in the kernel runs, if there are SCSI problems.
- */
- SGI_HD2CDROM = 0xc9,
-};
-
-void nscsi_cdrom_sgi_device::scsi_command()
-{
- switch (scsi_cmdbuf[0]) {
- case SGI_HD2CDROM:
- LOG("command SGI_HD2CDROM");
- // No need to do anything (yet). Just acknowledge the command.
- scsi_status_complete(SS_GOOD);
- break;
+ logerror("unhandled command %02x\n", scsi_cmdbuf[0]);
- default:
- nscsi_cdrom_device::scsi_command();
+ nscsi_full_device::scsi_command();
break;
}
}
-
-bool nscsi_cdrom_sgi_device::scsi_command_done(uint8_t command, uint8_t length)
-{
- switch (command) {
- case SGI_HD2CDROM:
- return length == 10;
-
- default:
- return nscsi_full_device::scsi_command_done(command, length);
- }
-}
diff --git a/src/devices/machine/nscsi_cd.h b/src/devices/machine/nscsi_cd.h
index 48097cea42f..f3ce871c70a 100644
--- a/src/devices/machine/nscsi_cd.h
+++ b/src/devices/machine/nscsi_cd.h
@@ -54,17 +54,6 @@ private:
uint8_t compliance;
void return_no_cd();
- static int to_msf(int frame);
-};
-
-class nscsi_cdrom_sgi_device : public nscsi_cdrom_device
-{
-public:
- nscsi_cdrom_sgi_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
-
-protected:
- virtual void scsi_command() override;
- virtual bool scsi_command_done(uint8_t command, uint8_t length) override;
};
class nscsi_dec_rrd45_device : public nscsi_cdrom_device
@@ -104,7 +93,6 @@ public:
};
DECLARE_DEVICE_TYPE(NSCSI_CDROM, nscsi_cdrom_device)
-DECLARE_DEVICE_TYPE(NSCSI_CDROM_SGI, nscsi_cdrom_sgi_device)
DECLARE_DEVICE_TYPE(NSCSI_RRD45, nscsi_dec_rrd45_device)
DECLARE_DEVICE_TYPE(NSCSI_XM3301, nscsi_toshiba_xm3301_device)
DECLARE_DEVICE_TYPE(NSCSI_XM5301SUN, nscsi_toshiba_xm5301_sun_device)
diff --git a/src/devices/machine/nscsi_hd.cpp b/src/devices/machine/nscsi_hd.cpp
index 6684942c9d6..c83a2c17ef9 100644
--- a/src/devices/machine/nscsi_hd.cpp
+++ b/src/devices/machine/nscsi_hd.cpp
@@ -20,7 +20,7 @@ nscsi_harddisk_device::nscsi_harddisk_device(const machine_config &mconfig, cons
}
nscsi_harddisk_device::nscsi_harddisk_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
- nscsi_full_device(mconfig, type, tag, owner, clock), image(*this, "image"), harddisk(nullptr), lba(0), cur_lba(0), blocks(0), bytes_per_sector(0)
+ nscsi_full_device(mconfig, type, tag, owner, clock), harddisk(nullptr), lba(0), cur_lba(0), blocks(0), bytes_per_sector(0)
{
}
@@ -37,7 +37,8 @@ void nscsi_harddisk_device::device_start()
void nscsi_harddisk_device::device_reset()
{
nscsi_full_device::device_reset();
- harddisk = image->get_hard_disk_file();
+ harddisk_image_device *hd = subdevice<harddisk_image_device>("image");
+ harddisk = hd->get_hard_disk_file();
if(!harddisk) {
scsi_id = -1;
bytes_per_sector = 0;
@@ -45,17 +46,18 @@ void nscsi_harddisk_device::device_reset()
const hard_disk_info *hdinfo = hard_disk_get_info(harddisk);
bytes_per_sector = hdinfo->sectorbytes;
- chd_file *chd = image->get_chd_file();
+ chd_file *chd = hd->get_chd_file();
if(chd != nullptr)
chd->read_metadata(HARD_DISK_IDENT_METADATA_TAG, 0, m_inquiry_data);
}
cur_lba = -1;
}
-void nscsi_harddisk_device::device_add_mconfig(machine_config &config)
-{
- HARDDISK(config, image).set_interface("scsi_hdd");
-}
+MACHINE_CONFIG_START(nscsi_harddisk_device::device_add_mconfig)
+ MCFG_HARDDISK_ADD("image")
+ MCFG_HARDDISK_INTERFACE("scsi_hdd")
+MACHINE_CONFIG_END
+
uint8_t nscsi_harddisk_device::scsi_get_data(int id, int pos)
{
@@ -90,9 +92,9 @@ void nscsi_harddisk_device::scsi_put_data(int id, int pos, uint8_t data)
int offset = pos % bytes_per_sector;
block[offset] = data;
- cur_lba = lba + pos / bytes_per_sector;
+ int clba = lba + pos / bytes_per_sector;
if(offset == bytes_per_sector-1) {
- if(!hard_disk_write(harddisk, cur_lba, block))
+ if(!hard_disk_write(harddisk, clba, block))
LOG("HD WRITE ERROR !\n");
}
}
@@ -166,8 +168,8 @@ void nscsi_harddisk_device::scsi_command()
// Apple HD SC setup utility needs to see this
strcpy((char *)&scsi_cmdbuf[8], " SEAGATE");
- strcpy((char *)&scsi_cmdbuf[16], " ST225N");
- strcpy((char *)&scsi_cmdbuf[32], "1.00");
+ strcpy((char *)&scsi_cmdbuf[15], " ST225N");
+ strcpy((char *)&scsi_cmdbuf[31], "1.00");
scsi_cmdbuf[36] = 0x00; // # of extents high
scsi_cmdbuf[37] = 0x08; // # of extents low
scsi_cmdbuf[38] = 0x00; // group 0 commands 0-1f
@@ -228,10 +230,8 @@ void nscsi_harddisk_device::scsi_command()
int pmax = page == 0x3f ? 0x3e : page;
int pmin = page == 0x3f ? 0x00 : page;
-
- bool fail = false;
- for(int p=pmax; p >= pmin; p--) {
- switch(p) {
+ for(int page=pmax; page >= pmin; page--) {
+ switch(page) {
case 0x00: // Unit attention parameters page (weird)
scsi_cmdbuf[pos++] = 0x80; // PS, page id
scsi_cmdbuf[pos++] = 0x02; // Page length
@@ -239,40 +239,6 @@ void nscsi_harddisk_device::scsi_command()
scsi_cmdbuf[pos++] = 0x00; // Double meh
break;
- case 0x01: // read-write error recovery page
- scsi_cmdbuf[pos++] = 0x01; // !PS, page id
- scsi_cmdbuf[pos++] = 0x0a; // page length
- scsi_cmdbuf[pos++] = 0; // various bits
- scsi_cmdbuf[pos++] = 0; // read retry count
- scsi_cmdbuf[pos++] = 0; // correction span
- scsi_cmdbuf[pos++] = 0; // head offset count
- scsi_cmdbuf[pos++] = 0; // data strobe offset count
- scsi_cmdbuf[pos++] = 0; // reserved
- scsi_cmdbuf[pos++] = 0; // write retry count
- scsi_cmdbuf[pos++] = 0; // reserved
- scsi_cmdbuf[pos++] = 0; // recovery time limit (msb)
- scsi_cmdbuf[pos++] = 0; // recovery time limit (lsb)
- break;
-
- case 0x02: // disconnect-reconnect page
- scsi_cmdbuf[pos++] = 0x02; // !PS, page id
- scsi_cmdbuf[pos++] = 0x0e; // page length
- scsi_cmdbuf[pos++] = 0; // buffer full ratio
- scsi_cmdbuf[pos++] = 0; // buffer empty ratio
- scsi_cmdbuf[pos++] = 0; // bus inactivity limit (msb)
- scsi_cmdbuf[pos++] = 0; // bus inactivity limit (lsb)
- scsi_cmdbuf[pos++] = 0; // disconnect time limit (msb)
- scsi_cmdbuf[pos++] = 0; // disconnect time limit (lsb)
- scsi_cmdbuf[pos++] = 0; // connect time limit (msb)
- scsi_cmdbuf[pos++] = 0; // connect time limit (lsb)
- scsi_cmdbuf[pos++] = 0; // maximum burst size (msb)
- scsi_cmdbuf[pos++] = 0; // maximum burst size (lsb)
- scsi_cmdbuf[pos++] = 0; // reserved
- scsi_cmdbuf[pos++] = 0; // reserved
- scsi_cmdbuf[pos++] = 0; // reserved
- scsi_cmdbuf[pos++] = 0; // reserved
- break;
-
case 0x03: { // Format parameters page
scsi_cmdbuf[pos++] = 0x83; // PS, page id
scsi_cmdbuf[pos++] = 0x16; // Page length
@@ -329,21 +295,6 @@ void nscsi_harddisk_device::scsi_command()
break;
}
- case 0x08: // caching page
- scsi_cmdbuf[pos++] = 0x08; // !PS, page id
- scsi_cmdbuf[pos++] = 0x0a; // page length
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 0;
- break;
-
case 0x30: { // Apple firmware ID page
scsi_cmdbuf[pos++] = 0xb0; // cPS, page id
scsi_cmdbuf[pos++] = 0x16; // Page length
@@ -373,25 +324,16 @@ void nscsi_harddisk_device::scsi_command()
}
default:
- if (page != 0x3f) {
- LOG("mode sense page %02x unhandled\n", page);
- fail = true;
- }
+ LOG("mode sense page %02x unhandled\n", page);
break;
}
}
+ scsi_cmdbuf[0] = pos;
+ if(pos > size)
+ pos = size;
- if (!fail) {
- scsi_cmdbuf[0] = pos;
- if (pos > size)
- pos = size;
-
- scsi_data_in(0, pos);
- scsi_status_complete(SS_GOOD);
- } else {
- scsi_status_complete(SS_CHECK_CONDITION);
- sense(false, SK_ILLEGAL_REQUEST, SK_ASC_INVALID_FIELD_IN_CDB);
- }
+ scsi_data_in(0, pos);
+ scsi_status_complete(SS_GOOD);
break;
}
@@ -400,48 +342,6 @@ void nscsi_harddisk_device::scsi_command()
scsi_status_complete(SS_GOOD);
break;
- case SC_RECIEVE_DIAG_RES: {
- LOG("command RECIEVE DIAGNOSTICS RESULTS");
- int size = (scsi_cmdbuf[3] << 8) | scsi_cmdbuf[4];
- int pos = 0;
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 6;
- scsi_cmdbuf[pos++] = 0; // ROM is OK
- scsi_cmdbuf[pos++] = 0; // RAM is OK
- scsi_cmdbuf[pos++] = 0; // Data buffer is OK
- scsi_cmdbuf[pos++] = 0; // Interface is OK
- scsi_cmdbuf[pos++] = 0;
- if(size > pos)
- size = pos;
- scsi_data_in(0, size);
- scsi_status_complete(SS_GOOD);
- break;
- }
-
- case SC_SEND_DIAGNOSTICS: {
- LOG("command SEND DIAGNOSTICS");
- int size = (scsi_cmdbuf[3] << 8) | scsi_cmdbuf[4];
- if(scsi_cmdbuf[1] & 4) {
- // Self-test
- scsi_status_complete(SS_GOOD);
- break;
- }
- int pos = 0;
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 6;
- scsi_cmdbuf[pos++] = 0; // ROM is OK
- scsi_cmdbuf[pos++] = 0; // RAM is OK
- scsi_cmdbuf[pos++] = 0; // Data buffer is OK
- scsi_cmdbuf[pos++] = 0; // Interface is OK
- scsi_cmdbuf[pos++] = 0;
- scsi_cmdbuf[pos++] = 0;
- if(size > pos)
- size = pos;
- scsi_data_in(0, size);
- scsi_status_complete(SS_GOOD);
- break;
- }
-
case SC_READ_CAPACITY: {
LOG("command READ CAPACITY\n");
@@ -503,11 +403,6 @@ void nscsi_harddisk_device::scsi_command()
scsi_status_complete(SS_GOOD);
break;
- case SC_MODE_SELECT_6:
- LOG("command MODE SELECT\n");
- scsi_status_complete(SS_GOOD);
- break;
-
default:
LOG("command %02x ***UNKNOWN***\n", scsi_cmdbuf[0]);
nscsi_full_device::scsi_command();
diff --git a/src/devices/machine/nscsi_hd.h b/src/devices/machine/nscsi_hd.h
index 5ddbf3e8519..19dfe55c0e5 100644
--- a/src/devices/machine/nscsi_hd.h
+++ b/src/devices/machine/nscsi_hd.h
@@ -6,7 +6,7 @@
#pragma once
#include "machine/nscsi_bus.h"
-#include "imagedev/harddriv.h"
+#include "harddisk.h"
class nscsi_harddisk_device : public nscsi_full_device
{
@@ -24,7 +24,6 @@ protected:
virtual uint8_t scsi_get_data(int id, int pos) override;
virtual void scsi_put_data(int buf, int offset, uint8_t data) override;
- required_device<harddisk_image_device> image;
uint8_t block[512];
hard_disk_file *harddisk;
int lba, cur_lba, blocks;
diff --git a/src/devices/machine/output_latch.h b/src/devices/machine/output_latch.h
index 2498be7f63f..c915b4c7207 100644
--- a/src/devices/machine/output_latch.h
+++ b/src/devices/machine/output_latch.h
@@ -6,11 +6,36 @@
#pragma once
+#define MCFG_OUTPUT_LATCH_BIT0_HANDLER(_devcb) \
+ downcast<output_latch_device &>(*device).set_bit_handler<0>(DEVCB_##_devcb);
+
+#define MCFG_OUTPUT_LATCH_BIT1_HANDLER(_devcb) \
+ downcast<output_latch_device &>(*device).set_bit_handler<1>(DEVCB_##_devcb);
+
+#define MCFG_OUTPUT_LATCH_BIT2_HANDLER(_devcb) \
+ downcast<output_latch_device &>(*device).set_bit_handler<2>(DEVCB_##_devcb);
+
+#define MCFG_OUTPUT_LATCH_BIT3_HANDLER(_devcb) \
+ downcast<output_latch_device &>(*device).set_bit_handler<3>(DEVCB_##_devcb);
+
+#define MCFG_OUTPUT_LATCH_BIT4_HANDLER(_devcb) \
+ downcast<output_latch_device &>(*device).set_bit_handler<4>(DEVCB_##_devcb);
+
+#define MCFG_OUTPUT_LATCH_BIT5_HANDLER(_devcb) \
+ downcast<output_latch_device &>(*device).set_bit_handler<5>(DEVCB_##_devcb);
+
+#define MCFG_OUTPUT_LATCH_BIT6_HANDLER(_devcb) \
+ downcast<output_latch_device &>(*device).set_bit_handler<6>(DEVCB_##_devcb);
+
+#define MCFG_OUTPUT_LATCH_BIT7_HANDLER(_devcb) \
+ downcast<output_latch_device &>(*device).set_bit_handler<7>(DEVCB_##_devcb);
+
class output_latch_device : public device_t
{
public:
output_latch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ template <unsigned Bit, class Object> devcb_base &set_bit_handler(Object &&cb) { return m_bit_handlers[Bit].set_callback(std::forward<Object>(cb)); }
template <unsigned Bit> auto bit_handler() { return m_bit_handlers[Bit].bind(); }
void write(uint8_t data);
diff --git a/src/devices/machine/pc_fdc.cpp b/src/devices/machine/pc_fdc.cpp
index 8f48da0f505..601c4c813c5 100644
--- a/src/devices/machine/pc_fdc.cpp
+++ b/src/devices/machine/pc_fdc.cpp
@@ -157,7 +157,7 @@ uint8_t pc_fdc_family_device::do_dir_r()
WRITE8_MEMBER( pc_fdc_xt_device::dor_fifo_w)
{
- fdc->fifo_w(data);
+ fdc->fifo_w(space, 0, data, mem_mask);
dor_w(space, 0, data, mem_mask);
}
diff --git a/src/devices/machine/pc_lpt.cpp b/src/devices/machine/pc_lpt.cpp
index 0d43fbc6eeb..b0f97871e87 100644
--- a/src/devices/machine/pc_lpt.cpp
+++ b/src/devices/machine/pc_lpt.cpp
@@ -46,8 +46,7 @@ void pc_lpt_device::device_reset()
m_cent_ctrl_out->write(m_control);
}
-void pc_lpt_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(pc_lpt_device::device_add_mconfig)
centronics_device &centronics(CENTRONICS(config, "centronics", centronics_devices, "printer"));
centronics.set_data_input_buffer(m_cent_data_in);
centronics.fault_handler().set(m_cent_status_in, FUNC(input_buffer_device::write_bit3));
@@ -65,8 +64,7 @@ void pc_lpt_device::device_add_mconfig(machine_config &config)
INPUT_BUFFER(config, m_cent_ctrl_in);
INPUT_BUFFER(config, m_cent_status_in);
- OUTPUT_LATCH(config, m_cent_data_out);
- centronics.set_output_latch(*m_cent_data_out);
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
OUTPUT_LATCH(config, m_cent_ctrl_out);
m_cent_ctrl_out->bit_handler<0>().set("centronics", FUNC(centronics_device::write_strobe));
@@ -74,7 +72,7 @@ void pc_lpt_device::device_add_mconfig(machine_config &config)
m_cent_ctrl_out->bit_handler<2>().set("centronics", FUNC(centronics_device::write_init));
m_cent_ctrl_out->bit_handler<3>().set("centronics", FUNC(centronics_device::write_select_in));
m_cent_ctrl_out->bit_handler<4>().set(FUNC(pc_lpt_device::write_irq_enabled));
-}
+MACHINE_CONFIG_END
READ8_MEMBER( pc_lpt_device::data_r )
diff --git a/src/devices/machine/pckeybrd.h b/src/devices/machine/pckeybrd.h
index 42a443226f5..7ee6c5c2c14 100644
--- a/src/devices/machine/pckeybrd.h
+++ b/src/devices/machine/pckeybrd.h
@@ -20,11 +20,12 @@
class pc_keyboard_device : public device_t
{
public:
- pc_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ pc_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8_MEMBER(read);
DECLARE_WRITE_LINE_MEMBER(enable);
+ template <class Object> devcb_base &set_keypress_callback(Object &&cb) { return m_out_keypress_func.set_callback(std::forward<Object>(cb)); }
auto keypress() { return m_out_keypress_func.bind(); }
enum class KEYBOARD_TYPE
@@ -76,13 +77,7 @@ private:
class at_keyboard_device : public pc_keyboard_device
{
public:
- at_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, KEYBOARD_TYPE type, int default_set)
- : at_keyboard_device(mconfig, tag, owner, 0)
- {
- set_type(type, default_set);
- }
-
- at_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ at_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_WRITE8_MEMBER( write );
@@ -119,4 +114,18 @@ INPUT_PORTS_EXTERN( at_keyboard );
DECLARE_DEVICE_TYPE(PC_KEYB, pc_keyboard_device)
DECLARE_DEVICE_TYPE(AT_KEYB, at_keyboard_device)
+#define MCFG_PC_KEYB_ADD(_tag, _cb) \
+ MCFG_DEVICE_ADD(_tag, PC_KEYB, 0) \
+ downcast<pc_keyboard_device &>(*device).set_keypress_callback(DEVCB_##_cb);
+
+#define MCFG_AT_KEYB_ADD(_tag, _def_set, _cb) \
+ MCFG_DEVICE_ADD(_tag, AT_KEYB, 0) \
+ downcast<at_keyboard_device &>(*device).set_type(pc_keyboard_device::KEYBOARD_TYPE::AT, _def_set); \
+ downcast<pc_keyboard_device &>(*device).set_keypress_callback(DEVCB_##_cb);
+
+#define MCFG_AT_MF2_KEYB_ADD(_tag, _def_set, _cb) \
+ MCFG_DEVICE_ADD(_tag, AT_KEYB, 0) \
+ downcast<at_keyboard_device &>(*device).set_type(pc_keyboard_device::KEYBOARD_TYPE_MF2, _def_set); \
+ downcast<pc_keyboard_device &>(*device).set_keypress_callback(DEVCB_##_cb);
+
#endif // MAME_MACHINE_PCKEYBRD_H
diff --git a/src/devices/machine/pdc.cpp b/src/devices/machine/pdc.cpp
index 20b0c627dc5..99964762548 100644
--- a/src/devices/machine/pdc.cpp
+++ b/src/devices/machine/pdc.cpp
@@ -261,7 +261,7 @@ void pdc_device::device_add_mconfig(machine_config &config)
Z80(config, m_pdccpu, XTAL(10'000'000) / 2);
m_pdccpu->set_addrmap(AS_PROGRAM, &pdc_device::pdc_mem);
m_pdccpu->set_addrmap(AS_IO, &pdc_device::pdc_io);
- //config.m_perfect_cpu_quantum = subtag(M6502_TAG);
+ //MCFG_QUANTUM_PERFECT_CPU(M6502_TAG)
/* Floppy Disk Controller - uPD765a - NEC D765AC-2 */
UPD765A(config, m_fdc, 4'000'000, true, true);
@@ -279,7 +279,6 @@ void pdc_device::device_add_mconfig(machine_config &config)
m_dma8237->out_eop_callback().set(FUNC(pdc_device::i8237_eop_w));
m_dma8237->in_memr_callback().set(FUNC(pdc_device::i8237_dma_mem_r));
m_dma8237->out_memw_callback().set(FUNC(pdc_device::i8237_dma_mem_w));
- //m_dma8237->out_dack_callback<0>().set(m_fdc, FUNC(upd765a_device::dack_w));
m_dma8237->in_ior_callback<0>().set(FUNC(pdc_device::i8237_fdc_dma_r));
m_dma8237->out_iow_callback<0>().set(FUNC(pdc_device::i8237_fdc_dma_w));
m_dma8237->in_ior_callback<1>().set(FUNC(pdc_device::m68k_dma_r));
diff --git a/src/devices/machine/pic8259.h b/src/devices/machine/pic8259.h
index 298ef1debea..0b85efd9ac1 100644
--- a/src/devices/machine/pic8259.h
+++ b/src/devices/machine/pic8259.h
@@ -31,7 +31,7 @@
class pic8259_device : public device_t
{
public:
- pic8259_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ pic8259_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
auto out_int_callback() { return m_out_int_func.bind(); } // Interrupt request output to CPU or master 8259 (active high)
auto in_sp_callback() { return m_in_sp_func.bind(); } // Slave program select (VCC = master; GND = slave; pin becomes EN output in buffered mode)
@@ -118,7 +118,7 @@ private:
class v5x_icu_device : public pic8259_device
{
public:
- v5x_icu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ v5x_icu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
virtual bool is_x86() const override { return true; }
diff --git a/src/devices/machine/pit8253.cpp b/src/devices/machine/pit8253.cpp
index 7d52572ba89..6e6f86e5b0e 100644
--- a/src/devices/machine/pit8253.cpp
+++ b/src/devices/machine/pit8253.cpp
@@ -74,12 +74,11 @@ fe2010_pit_device::fe2010_pit_device(const machine_config &mconfig, const char *
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void pit8253_device::device_add_mconfig(machine_config &config)
-{
- PIT_COUNTER(config, "counter0", 0);
- PIT_COUNTER(config, "counter1", 0);
- PIT_COUNTER(config, "counter2", 0);
-}
+MACHINE_CONFIG_START(pit8253_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("counter0", PIT_COUNTER, 0)
+ MCFG_DEVICE_ADD("counter1", PIT_COUNTER, 0)
+ MCFG_DEVICE_ADD("counter2", PIT_COUNTER, 0)
+MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/devices/machine/pit8253.h b/src/devices/machine/pit8253.h
index 77f0bf552f9..eebee4edbb3 100644
--- a/src/devices/machine/pit8253.h
+++ b/src/devices/machine/pit8253.h
@@ -104,7 +104,7 @@ class pit8253_device : public device_t
public:
// construction/destruction
- pit8253_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ pit8253_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration helpers
template <unsigned N> void set_clk(double clk) { m_clk[N] = clk; }
@@ -157,7 +157,7 @@ DECLARE_DEVICE_TYPE(PIT8253, pit8253_device)
class pit8254_device : public pit8253_device
{
public:
- pit8254_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ pit8254_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
virtual void readback_command(uint8_t data) override;
@@ -168,7 +168,7 @@ DECLARE_DEVICE_TYPE(PIT8254, pit8254_device)
class fe2010_pit_device : public pit8253_device
{
public:
- fe2010_pit_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ fe2010_pit_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
DECLARE_DEVICE_TYPE(FE2010_PIT, fe2010_pit_device)
diff --git a/src/devices/machine/pla.h b/src/devices/machine/pla.h
index b614a968b36..7e4672b7860 100644
--- a/src/devices/machine/pla.h
+++ b/src/devices/machine/pla.h
@@ -11,6 +11,24 @@
#pragma once
+///*************************************************************************
+// INTERFACE CONFIGURATION MACROS
+///*************************************************************************
+
+#define MCFG_PLA_ADD(tag, inputs, outputs, terms) \
+ MCFG_DEVICE_ADD((tag), PLA, 0) \
+ downcast<pla_device &>(*device).set_num_inputs((inputs)); \
+ downcast<pla_device &>(*device).set_num_outputs((outputs)); \
+ downcast<pla_device &>(*device).set_num_terms((terms));
+
+#define MCFG_PLA_INPUTMASK(mask) \
+ downcast<pla_device &>(*device).set_inputmask((mask));
+
+#define MCFG_PLA_FILEFORMAT(format) \
+ downcast<pla_device &>(*device).set_format((pla_device::FMT::format));
+
+
+// macros for known (and used) devices
// 82S100, 82S101, PLS100, PLS101
// 16x48x8 PLA, 28-pin:
@@ -30,7 +48,8 @@
F4 13 | | 16 F2
GND 14 |_____________| 15 F3
*/
-
+#define MCFG_PLS100_ADD(tag) \
+ MCFG_DEVICE_ADD((tag), PLS100)
///*************************************************************************
// TYPE DEFINITIONS
diff --git a/src/devices/machine/pxa255.cpp b/src/devices/machine/pxa255.cpp
index 5a65f1542ae..0e96fec2b27 100644
--- a/src/devices/machine/pxa255.cpp
+++ b/src/devices/machine/pxa255.cpp
@@ -1222,20 +1222,20 @@ uint32_t pxa255_periphs_device::screen_update(screen_device &screen, bitmap_rgb3
return 0;
}
-void pxa255_periphs_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_refresh_hz(60);
- screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
- screen.set_size(1024, 1024);
- screen.set_visarea(0, 295, 0, 479);
- screen.set_screen_update(FUNC(pxa255_periphs_device::screen_update));
-
- PALETTE(config, m_palette).set_entries(256);
+MACHINE_CONFIG_START(pxa255_periphs_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_REFRESH_RATE(60)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
+ MCFG_SCREEN_SIZE(1024, 1024)
+ MCFG_SCREEN_VISIBLE_AREA(0, 295, 0, 479)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, pxa255_periphs_device, screen_update)
+ MCFG_PALETTE_ADD(m_palette, 256)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
- DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, "lspeaker", 1.0);
- DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, "rspeaker", 1.0);
-}
+ MCFG_DEVICE_ADD(m_dmadac[0], DMADAC)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
+ MCFG_DEVICE_ADD(m_dmadac[1], DMADAC)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
+MACHINE_CONFIG_END
diff --git a/src/devices/machine/rtc65271.cpp b/src/devices/machine/rtc65271.cpp
index 9ccc83997bf..f44cc8255fc 100644
--- a/src/devices/machine/rtc65271.cpp
+++ b/src/devices/machine/rtc65271.cpp
@@ -346,12 +346,12 @@ uint8_t rtc65271_device::read(int xramsel, offs_t offset)
return reply;
}
-uint8_t rtc65271_device::rtc_r(offs_t offset)
+READ8_MEMBER( rtc65271_device::rtc_r )
{
return read(0, offset );
}
-uint8_t rtc65271_device::xram_r(offs_t offset)
+READ8_MEMBER( rtc65271_device::xram_r )
{
return read(1, offset );
}
@@ -436,12 +436,12 @@ void rtc65271_device::write(int xramsel, offs_t offset, uint8_t data)
}
}
-void rtc65271_device::rtc_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( rtc65271_device::rtc_w )
{
write(0, offset, data );
}
-void rtc65271_device::xram_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( rtc65271_device::xram_w )
{
write(1, offset, data );
}
diff --git a/src/devices/machine/rtc65271.h b/src/devices/machine/rtc65271.h
index 1a69b518839..65ee8233675 100644
--- a/src/devices/machine/rtc65271.h
+++ b/src/devices/machine/rtc65271.h
@@ -21,10 +21,10 @@ public:
auto interrupt_cb() { return m_interrupt_cb.bind(); }
- uint8_t rtc_r(offs_t offset);
- uint8_t xram_r(offs_t offset);
- void rtc_w(offs_t offset, uint8_t data);
- void xram_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( rtc_r );
+ DECLARE_READ8_MEMBER( xram_r );
+ DECLARE_WRITE8_MEMBER( rtc_w );
+ DECLARE_WRITE8_MEMBER( xram_w );
protected:
// device-level overrides
diff --git a/src/devices/machine/scc2698b.cpp b/src/devices/machine/scc2698b.cpp
index 8a362e26d45..1f6c537f52d 100644
--- a/src/devices/machine/scc2698b.cpp
+++ b/src/devices/machine/scc2698b.cpp
@@ -768,8 +768,7 @@ attotime scc2698b_device::generate_baudrate(int block, int tx, int table_index)
-void scc2698b_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(scc2698b_device::device_add_mconfig)
for (required_device<scc2698b_channel> &channel : m_channel)
SCC2698B_CHANNEL(config, channel, 0);
-}
+MACHINE_CONFIG_END
diff --git a/src/devices/machine/scnxx562.cpp b/src/devices/machine/scnxx562.cpp
index c3bfbfacc5d..9ccf996782c 100644
--- a/src/devices/machine/scnxx562.cpp
+++ b/src/devices/machine/scnxx562.cpp
@@ -126,11 +126,10 @@ DEFINE_DEVICE_TYPE(DUSCC68C562, duscc68c562_device, "duscc68c562", "Philips
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void duscc_device::device_add_mconfig(machine_config &config)
-{
- DUSCC_CHANNEL(config, CHANA_TAG, 0);
- DUSCC_CHANNEL(config, CHANB_TAG, 0);
-}
+MACHINE_CONFIG_START(duscc_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(CHANA_TAG, DUSCC_CHANNEL, 0)
+ MCFG_DEVICE_ADD(CHANB_TAG, DUSCC_CHANNEL, 0)
+MACHINE_CONFIG_END
//**************************************************************************
// LIVE DEVICE
diff --git a/src/devices/machine/sis85c496.cpp b/src/devices/machine/sis85c496.cpp
index 87b01edf2e6..186c4894b8d 100644
--- a/src/devices/machine/sis85c496.cpp
+++ b/src/devices/machine/sis85c496.cpp
@@ -45,8 +45,7 @@ void sis85c496_host_device::internal_io_map(address_map &map)
map(0x00e0, 0x00ef).noprw();
}
-void sis85c496_host_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(sis85c496_host_device::device_add_mconfig)
PIT8254(config, m_pit8254, 0);
m_pit8254->set_clk<0>(4772720/4); // heartbeat IRQ
m_pit8254->out_handler<0>().set(FUNC(sis85c496_host_device::at_pit8254_out0_changed));
@@ -104,10 +103,10 @@ void sis85c496_host_device::device_add_mconfig(machine_config &config)
m_keybc->kbd_clk().set("pc_kbdc", FUNC(pc_kbdc_device::clock_write_from_mb));
m_keybc->kbd_data().set("pc_kbdc", FUNC(pc_kbdc_device::data_write_from_mb));
- PC_KBDC(config, m_pc_kbdc, 0);
- m_pc_kbdc->out_clock_cb().set("keybc", FUNC(at_keyboard_controller_device::kbd_clk_w));
- m_pc_kbdc->out_data_cb().set("keybc", FUNC(at_keyboard_controller_device::kbd_data_w));
- PC_KBDC_SLOT(config, "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL).set_pc_kbdc_slot(subdevice("pc_kbdc"));
+ MCFG_DEVICE_ADD("pc_kbdc", PC_KBDC, 0)
+ MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE("keybc", at_keyboard_controller_device, kbd_clk_w))
+ MCFG_PC_KBDC_OUT_DATA_CB(WRITELINE("keybc", at_keyboard_controller_device, kbd_data_w))
+ MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL)
DS12885(config, m_ds12885);
m_ds12885->irq().set(m_pic8259_slave, FUNC(pic8259_device::ir0_w));
@@ -116,7 +115,7 @@ void sis85c496_host_device::device_add_mconfig(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50);
-}
+MACHINE_CONFIG_END
sis85c496_host_device::sis85c496_host_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
@@ -493,8 +492,6 @@ WRITE_LINE_MEMBER( sis85c496_host_device::at_dma8237_out_eop )
void sis85c496_host_device::pc_select_dma_channel(int channel, bool state)
{
- //m_isabus->dack_line_w(channel, state);
-
if(!state) {
m_dma_channel = channel;
//if(m_cur_eop)
@@ -544,19 +541,19 @@ WRITE8_MEMBER( sis85c496_host_device::at_portb_w )
READ8_MEMBER( sis85c496_host_device::at_dma8237_2_r )
{
- return m_dma8237_2->read( offset / 2);
+ return m_dma8237_2->read( space, offset / 2);
}
WRITE8_MEMBER( sis85c496_host_device::at_dma8237_2_w )
{
- m_dma8237_2->write( offset / 2, data);
+ m_dma8237_2->write( space, offset / 2, data);
}
READ8_MEMBER( sis85c496_host_device::at_keybc_r )
{
switch (offset)
{
- case 0: return m_keybc->data_r();
+ case 0: return m_keybc->data_r(space, 0);
case 1: return at_portb_r(space, 0);
}
@@ -567,7 +564,7 @@ WRITE8_MEMBER( sis85c496_host_device::at_keybc_w )
{
switch (offset)
{
- case 0: m_keybc->data_w(data); break;
+ case 0: m_keybc->data_w(space, 0, data); break;
case 1: at_portb_w(space, 0, data); break;
}
}
@@ -578,10 +575,10 @@ WRITE8_MEMBER( sis85c496_host_device::write_rtc )
if (offset==0) {
m_nmi_enabled = BIT(data,7);
//m_isabus->set_nmi_state((m_nmi_enabled==0) && (m_channel_check==0));
- m_ds12885->write(0,data);
+ m_ds12885->write(space,0,data);
}
else {
- m_ds12885->write(offset,data);
+ m_ds12885->write(space,offset,data);
}
}
diff --git a/src/devices/machine/smc91c9x.cpp b/src/devices/machine/smc91c9x.cpp
index 359a69eefdb..e081c2c6a17 100644
--- a/src/devices/machine/smc91c9x.cpp
+++ b/src/devices/machine/smc91c9x.cpp
@@ -4,29 +4,92 @@
SMC91C9X ethernet controller implementation
- by Aaron Giles, Ted Green
+ by Aaron Giles, Jean-François DEL NERO
-***************************************************************************/
+***************************************************************************
+
+ Notes:
+ * Connected mode working
+
+**************************************************************************/
#include "emu.h"
#include "smc91c9x.h"
-#include <sstream>
-#include <iomanip>
+// Needed for netdev_count???
+#include "osdnet.h"
+
/***************************************************************************
DEBUGGING
***************************************************************************/
-#define LOG_GENERAL (1U << 0)
-#define LOG_PACKETS (1U << 1)
-#define LOG_TX (1U << 2)
-#define LOG_RX (1U << 3)
-#define LOG_FILTER (1U << 4)
-//#define VERBOSE (LOG_GENERAL | LOG_PACKETS | LOG_TX | LOG_RX | LOG_FILTER)
+//#define VERBOSE 1
#include "logmacro.h"
#define DISPLAY_STATS (0)
+
+
+/***************************************************************************
+ CONSTANTS
+***************************************************************************/
+
+/* Ethernet registers - bank 0 */
+#define EREG_TCR (0*8 + 0)
+#define EREG_EPH_STATUS (0*8 + 1)
+#define EREG_RCR (0*8 + 2)
+#define EREG_COUNTER (0*8 + 3)
+#define EREG_MIR (0*8 + 4)
+#define EREG_MCR (0*8 + 5)
+#define EREG_BANK (0*8 + 7)
+
+/* Ethernet registers - bank 1 */
+#define EREG_CONFIG (1*8 + 0)
+#define EREG_BASE (1*8 + 1)
+#define EREG_IA0_1 (1*8 + 2)
+#define EREG_IA2_3 (1*8 + 3)
+#define EREG_IA4_5 (1*8 + 4)
+#define EREG_GENERAL_PURP (1*8 + 5)
+#define EREG_CONTROL (1*8 + 6)
+
+/* Ethernet registers - bank 2 */
+#define EREG_MMU_COMMAND (2*8 + 0)
+#define EREG_PNR_ARR (2*8 + 1)
+#define EREG_FIFO_PORTS (2*8 + 2)
+#define EREG_POINTER (2*8 + 3)
+#define EREG_DATA_0 (2*8 + 4)
+#define EREG_DATA_1 (2*8 + 5)
+#define EREG_INTERRUPT (2*8 + 6)
+
+/* Ethernet registers - bank 3 */
+#define EREG_MT0_1 (3*8 + 0)
+#define EREG_MT2_3 (3*8 + 1)
+#define EREG_MT4_5 (3*8 + 2)
+#define EREG_MT6_7 (3*8 + 3)
+#define EREG_MGMT (3*8 + 4)
+#define EREG_REVISION (3*8 + 5)
+#define EREG_ERCV (3*8 + 6)
+
+/* Ethernet MMU commands */
+#define ECMD_NOP 0
+#define ECMD_ALLOCATE 2
+#define ECMD_RESET_MMU 4
+#define ECMD_REMOVE_TOPFRAME_RX 6
+#define ECMD_REMOVE_TOPFRAME_TX 7
+#define ECMD_REMOVE_RELEASE_TOPFRAME_RX 8
+#define ECMD_RELEASE_PACKET 10
+#define ECMD_ENQUEUE_PACKET 12
+#define ECMD_RESET_FIFOS 14
+
+/* Ethernet interrupt bits */
+#define EINT_RCV 0x01
+#define EINT_TX 0x02
+#define EINT_TX_EMPTY 0x04
+#define EINT_ALLOC 0x08
+#define EINT_RX_OVRN 0x10
+#define EINT_EPH 0x20
+#define EINT_ERCV 0x40
+
/* Ethernet register names */
static const char *const ethernet_regname[64] =
{
@@ -44,93 +107,73 @@ static const char *const ethernet_regname[64] =
DEVICE INTERFACE
***************************************************************************/
-DEFINE_DEVICE_TYPE(SMC91C94, smc91c94_device, "smc91c94", "SMC91C94 Ethernet Controller")
-
-smc91c94_device::smc91c94_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : smc91c9x_device(mconfig, SMC91C94, tag, owner, clock, dev_type::SMC91C94)
-{
- m_num_ebuf = 18;
-}
-
-DEFINE_DEVICE_TYPE(SMC91C96, smc91c96_device, "smc91c96", "SMC91C96 Ethernet Controller")
-
-smc91c96_device::smc91c96_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : smc91c9x_device(mconfig, SMC91C96, tag, owner, clock, dev_type::SMC91C96)
-{
- m_num_ebuf = 24;
-}
-
-smc91c9x_device::smc91c9x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, dev_type device_type)
+smc91c9x_device::smc91c9x_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_network_interface(mconfig, *this, 10.0f)
- , m_device_type(device_type)
- , m_num_ebuf(16)
, m_irq_handler(*this)
, m_link_unconnected(false)
{
}
-const u8 smc91c9x_device::ETH_BROADCAST[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-const u8 smc91c9x_device::WMS_OUI[] = { 0x00, 0xA0, 0xAF };
-
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void smc91c9x_device::device_start()
{
- // Allocate main buffer
- m_buffer = std::make_unique<u8[]>(ETHER_BUFFER_SIZE * m_num_ebuf);
-
// TX timer
- m_tx_poll = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(smc91c9x_device::tx_poll), this));
+ m_tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(smc91c9x_device::send_frame), this));
m_irq_handler.resolve_safe();
- // These registers don't get cleared on reset
- m_reg[B1_CONFIG] = 0x0030; m_regmask[B1_CONFIG] = 0x17c6;
- m_reg[B1_BASE] = 0x1866; m_regmask[B1_BASE] = 0xfffe;
-
- m_reg[B1_IA0_1] = 0x0000; m_regmask[B1_IA0_1] = 0xffff;
- m_reg[B1_IA2_3] = 0x0000; m_regmask[B1_IA2_3] = 0xffff;
- m_reg[B1_IA4_5] = 0x0000; m_regmask[B1_IA4_5] = 0xffff;
-
- // Revision is set based on chip type
- m_regmask[B3_REVISION] = 0x0000;
- if (m_device_type == dev_type::SMC91C94)
- m_reg[B3_REVISION] = 0x3345;
- else if (m_device_type == dev_type::SMC91C96)
- m_reg[B3_REVISION] = 0x3346;
- else
- fatalerror("device_start: Unknown device type\n");
-
/* register ide states */
save_item(NAME(m_reg));
save_item(NAME(m_regmask));
save_item(NAME(m_irq_state));
- save_pointer(NAME(m_buffer), ETHER_BUFFER_SIZE * m_num_ebuf);
+ save_item(NAME(m_buffer));
save_item(NAME(m_sent));
save_item(NAME(m_recd));
save_item(NAME(m_alloc_rx));
save_item(NAME(m_alloc_tx));
- save_item(NAME(m_tx_active));
- save_item(NAME(m_rx_active));
- save_item(NAME(m_tx_retry_count));
- save_item(NAME(m_rx_hash));
- save_item(NAME(m_loopback_result));
-
- // Circular FIFOs
- save_item(NAME(m_queued_tx));
- save_item(NAME(m_queued_tx_h));
- save_item(NAME(m_queued_tx_t));
- save_item(NAME(m_completed_tx));
- save_item(NAME(m_completed_tx_h));
- save_item(NAME(m_completed_tx_t));
- save_item(NAME(m_completed_rx));
- save_item(NAME(m_completed_rx_h));
- save_item(NAME(m_completed_rx_t));
+ // Save vector data for proper save state restoration
+ save_item(NAME(m_comp_rx_data));
+ save_item(NAME(m_comp_tx_data));
+ save_item(NAME(m_trans_tx_data));
+ // Save vector sizes for proper save state restoration
+ save_item(NAME(m_comp_tx_size));
+ save_item(NAME(m_comp_rx_size));
+ save_item(NAME(m_trans_tx_size));
+}
+
+// Save state presave to save vector sizes
+void smc91c9x_device::device_pre_save()
+{
+ m_comp_tx_size = m_comp_tx.size();
+ m_comp_rx_size = m_comp_rx.size();
+ m_trans_tx_size = m_trans_tx.size();
+ memcpy(m_comp_rx_data, m_comp_rx.data(), m_comp_rx_size * sizeof(u32));
+ memcpy(m_comp_tx_data, m_comp_tx.data(), m_comp_tx_size * sizeof(u32));
+ memcpy(m_trans_tx_data, m_trans_tx.data(), m_trans_tx_size * sizeof(u32));
+
+ //osd_printf_info("Save: comp_tx: %d comp_rx: %d trans_tx: %d\n", m_comp_tx_size, m_comp_rx_size, m_trans_tx_size);
+ //if (m_comp_tx_size)
+ // osd_printf_info("comp_tx packet: %d\n", m_comp_tx.front());
}
+// Save state preload to restore vector sizes
+void smc91c9x_device::device_post_load()
+{
+ m_comp_tx.resize(m_comp_tx_size);
+ m_comp_rx.resize(m_comp_rx_size);
+ m_trans_tx.resize(m_trans_tx_size);
+ memcpy(m_comp_rx.data(), m_comp_rx_data, m_comp_rx_size * sizeof(u32));
+ memcpy(m_comp_tx.data(), m_comp_tx_data, m_comp_tx_size * sizeof(u32));
+ memcpy(m_trans_tx.data(), m_trans_tx_data, m_trans_tx_size * sizeof(u32));
+
+ //osd_printf_info("Restore: comp_tx: %d comp_rx: %d trans_tx: %d\n", m_comp_tx_size, m_comp_rx_size, m_trans_tx_size);
+ //if (m_comp_tx_size)
+ // osd_printf_info("comp_tx size: %lu comp_tx packet: %d array_data: %d\n", m_comp_tx.size(), m_comp_tx.front(), m_comp_tx_data[0]);
+}
//-------------------------------------------------
// device_reset - device-specific reset
@@ -138,43 +181,75 @@ void smc91c9x_device::device_start()
void smc91c9x_device::device_reset()
{
+ std::fill(std::begin(m_reg), std::end(m_reg), 0);
+
+ std::fill(std::begin(m_regmask), std::end(m_regmask), 0);
+
m_irq_state = 0;
m_sent = 0;
m_recd = 0;
- m_tx_active = 0;
- m_rx_active = 0;
- m_tx_retry_count = 0;
-
- m_reg[B0_TCR] = 0x0000; m_regmask[B0_TCR] = 0x3d87;
- m_reg[B0_EPH_STATUS] = 0x0000; m_regmask[B0_EPH_STATUS] = 0x0000;
- m_reg[B0_RCR] = 0x0000; m_regmask[B0_RCR] = 0xc307;
- m_reg[B0_COUNTER] = 0x0000; m_regmask[B0_COUNTER] = 0x0000;
- m_reg[B0_MIR] = 0x1212; m_regmask[B0_MIR] = 0x0000;
- m_reg[B0_MCR] = 0x3300; m_regmask[B0_MCR] = 0x00ff;
- m_reg[B0_BANK] = 0x3300; m_regmask[B0_BANK] = 0x0007;
-
- m_reg[B1_GENERAL_PURP] = 0x0000; m_regmask[B1_GENERAL_PURP] = 0xffff;
- m_reg[B1_CONTROL] = 0x0100; m_regmask[B1_CONTROL] = 0x68e7;
-
- m_reg[B2_MMU_COMMAND] = 0x0000; m_regmask[B2_MMU_COMMAND] = 0x00e7;
- m_reg[B2_PNR_ARR] = 0x8000; m_regmask[B2_PNR_ARR] = 0x00ff;
- m_reg[B2_FIFO_PORTS] = 0x8080; m_regmask[B2_FIFO_PORTS] = 0x0000;
- m_reg[B2_POINTER] = 0x0000; m_regmask[B2_POINTER] = 0xf7ff;
- m_reg[B2_DATA_0] = 0x0000; m_regmask[B2_DATA_0] = 0xffff;
- m_reg[B2_DATA_1] = 0x0000; m_regmask[B2_DATA_1] = 0xffff;
- m_reg[B2_INTERRUPT] = 0x0004; m_regmask[B2_INTERRUPT] = 0x7f00;
-
- m_reg[B3_MT0_1] = 0x0000; m_regmask[B3_MT0_1] = 0xffff;
- m_reg[B3_MT2_3] = 0x0000; m_regmask[B3_MT2_3] = 0xffff;
- m_reg[B3_MT4_5] = 0x0000; m_regmask[B3_MT4_5] = 0xffff;
- m_reg[B3_MT6_7] = 0x0000; m_regmask[B3_MT6_7] = 0xffff;
- m_reg[B3_MGMT] = 0x3030; m_regmask[B3_MGMT] = 0x0f0f;
-
- m_reg[B3_ERCV] = 0x331f; m_regmask[B3_ERCV] = 0x009f;
+ m_reg[EREG_TCR] = 0x0000; m_regmask[EREG_TCR] = 0x3d87;
+ m_reg[EREG_EPH_STATUS] = 0x0000; m_regmask[EREG_EPH_STATUS] = 0x0000;
+ m_reg[EREG_RCR] = 0x0000; m_regmask[EREG_RCR] = 0xc307;
+ m_reg[EREG_COUNTER] = 0x0000; m_regmask[EREG_COUNTER] = 0x0000;
+ m_reg[EREG_MIR] = 0x1212; m_regmask[EREG_MIR] = 0x0000;
+ m_reg[EREG_MCR] = 0x3300; m_regmask[EREG_MCR] = 0x00ff;
+ m_reg[EREG_BANK] = 0x3300; m_regmask[EREG_BANK] = 0x0007;
+
+ m_reg[EREG_CONFIG] = 0x0030; m_regmask[EREG_CONFIG] = 0x17c6;
+ m_reg[EREG_BASE] = 0x1866; m_regmask[EREG_BASE] = 0xfffe;
+
+ // Default MAC
+ m_reg[EREG_IA0_1] = 0x1300; m_regmask[EREG_IA0_1] = 0xffff;
+ m_reg[EREG_IA2_3] = 0x12F7; m_regmask[EREG_IA2_3] = 0xffff;
+ m_reg[EREG_IA4_5] = 0x5634; m_regmask[EREG_IA4_5] = 0xffff;
+
+ m_reg[EREG_GENERAL_PURP] = 0x0000; m_regmask[EREG_GENERAL_PURP] = 0xffff;
+ m_reg[EREG_CONTROL] = 0x0100; m_regmask[EREG_CONTROL] = 0x68e7;
+
+ m_reg[EREG_MMU_COMMAND] = 0x0000; m_regmask[EREG_MMU_COMMAND] = 0x00e7;
+ m_reg[EREG_PNR_ARR] = 0x8000; m_regmask[EREG_PNR_ARR] = 0x00ff;
+ m_reg[EREG_FIFO_PORTS] = 0x8080; m_regmask[EREG_FIFO_PORTS] = 0x0000;
+ m_reg[EREG_POINTER] = 0x0000; m_regmask[EREG_POINTER] = 0xf7ff;
+ m_reg[EREG_DATA_0] = 0x0000; m_regmask[EREG_DATA_0] = 0xffff;
+ m_reg[EREG_DATA_1] = 0x0000; m_regmask[EREG_DATA_1] = 0xffff;
+ m_reg[EREG_INTERRUPT] = 0x0004; m_regmask[EREG_INTERRUPT] = 0x7f00;
+
+ m_reg[EREG_MT0_1] = 0x0000; m_regmask[EREG_MT0_1] = 0xffff;
+ m_reg[EREG_MT2_3] = 0x0000; m_regmask[EREG_MT2_3] = 0xffff;
+ m_reg[EREG_MT4_5] = 0x0000; m_regmask[EREG_MT4_5] = 0xffff;
+ m_reg[EREG_MT6_7] = 0x0000; m_regmask[EREG_MT6_7] = 0xffff;
+ m_reg[EREG_MGMT] = 0x3030; m_regmask[EREG_MGMT] = 0x0f0f;
+ // TODO: Revision should be set based on chip type
+ m_reg[EREG_REVISION] = 0x3345; m_regmask[EREG_REVISION] = 0x0000;
+ m_reg[EREG_ERCV] = 0x331f; m_regmask[EREG_ERCV] = 0x009f;
update_ethernet_irq();
+ m_tx_timer->reset();
+
+ // Setup real network if enabled
+ m_network_available = false;
+ if (netdev_count()) {
+ m_network_available = true;
+ osd_list_network_adapters();
+ unsigned char const *const mac = (const unsigned char *)get_mac();
+ if (VERBOSE & LOG_GENERAL)
+ {
+ logerror("MAC : ");
+ for (int i = 0; i < ETHERNET_ADDR_SIZE; i++)
+ logerror("%.2X", mac[i]);
+
+ logerror("\n");
+ }
+
+ set_promisc(true);
+ // Interface MAC
+ m_reg[EREG_IA0_1] = mac[0] | (mac[1] << 8);
+ m_reg[EREG_IA2_3] = mac[2] | (mac[3] << 8);
+ m_reg[EREG_IA4_5] = mac[4] | (mac[5] << 8);
+ }
// Reset MMU
mmu_reset();
@@ -186,36 +261,39 @@ void smc91c9x_device::mmu_reset()
m_alloc_rx = 0;
m_alloc_tx = 0;
- // Reset fifos.
- reset_tx_fifos();
- reset_completed_rx();
+ // Flush fifos.
+ clear_tx_fifo();
+ clear_rx_fifo();
update_ethernet_irq();
}
-void smc91c9x_device::reset_tx_fifos()
+DEFINE_DEVICE_TYPE(SMC91C94, smc91c94_device, "smc91c94", "SMC91C94 Ethernet Controller")
+
+smc91c94_device::smc91c94_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : smc91c9x_device(mconfig, SMC91C94, tag, owner, clock)
+{
+}
+
+DEFINE_DEVICE_TYPE(SMC91C96, smc91c96_device, "smc91c96", "SMC91C96 Ethernet Controller")
+
+smc91c96_device::smc91c96_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : smc91c9x_device(mconfig, SMC91C96, tag, owner, clock)
{
- // Disable transmit timer
- m_tx_poll->enable(false);
- // Reset transmit queue
- reset_queued_tx();
- // Reset completion FIFOs
- reset_completed_tx();
}
bool smc91c9x_device::alloc_req(const int tx, int &packet_num)
{
u32 curr_alloc = m_alloc_rx | m_alloc_tx;
- for (int index = 0; index < m_num_ebuf; index++)
- {
- if (!(curr_alloc & (1 << index)))
- {
+ for (int index = 0; index < ETHER_BUFFERS; index++) {
+ if (!(curr_alloc & (1 << index))) {
packet_num = index;
- if (tx)
+ if (tx) {
m_alloc_tx |= 1 << index;
- else
+ } else {
m_alloc_rx |= 1 << index;
+ }
return true;
}
}
@@ -226,8 +304,7 @@ bool smc91c9x_device::alloc_req(const int tx, int &packet_num)
void smc91c9x_device::alloc_release(const int packet_num)
{
int clear_mask = ~(1 << packet_num);
- if (!((m_alloc_tx | m_alloc_rx) & (1 << packet_num)))
- {
+ if (!((m_alloc_tx | m_alloc_rx) & (1 << packet_num))) {
logerror("alloc_release: Trying to release a non-allocated packet. packet_num: %02x alloc_tx: %04x alloc_rx: %04x\n",
packet_num, m_alloc_tx, m_alloc_rx);
}
@@ -235,448 +312,338 @@ void smc91c9x_device::alloc_release(const int packet_num)
m_alloc_rx &= clear_mask;
}
-/***************************************************************************
- INTERNAL HELPERS
-***************************************************************************/
-
-/*-------------------------------------------------
- update_ethernet_irq - update the IRQ state
--------------------------------------------------*/
-
-void smc91c9x_device::update_ethernet_irq()
+void smc91c9x_device::clear_tx_fifo()
{
- // Check tx completion fifo empty
- if (empty_completed_tx())
- m_reg[B2_INTERRUPT] &= ~EINT_TX;
- else
- m_reg[B2_INTERRUPT] |= EINT_TX;
+ // Clear transmit timer
+ m_tx_timer->reset();
+ // Reset transmit queue
+ m_trans_tx.clear();
+ // Reset completion FIFOs
+ m_comp_tx.clear();
+}
- // Check rx completion fifo empty
- if (empty_completed_rx())
- m_reg[B2_INTERRUPT] &= ~EINT_RCV;
- else
- m_reg[B2_INTERRUPT] |= EINT_RCV;
+void smc91c9x_device::clear_rx_fifo()
+{
+ // Clear recieve FIFO
+ m_comp_rx.clear();
+}
- uint8_t const mask = m_reg[B2_INTERRUPT] >> 8;
- uint8_t const state = m_reg[B2_INTERRUPT] & 0xff;
+int smc91c9x_device::is_broadcast(const uint8_t *mac_address)
+{
+ int i;
+ i = 0;
- /* update the IRQ state */
- uint8_t new_state = mask & state;
- if (m_irq_state ^ new_state)
+ while(mac_address[i] == 0xFF)
{
- LOG("update_ethernet_irq: old: %02x new: %02x\n", m_irq_state, new_state);
- m_irq_state = new_state;
- m_irq_handler(m_irq_state ? ASSERT_LINE : CLEAR_LINE);
+ i++;
}
-}
+ if ( i == 6 )
+ return 1;
-/*-------------------------------------------------
- update_stats - draw statistics
--------------------------------------------------*/
-
-void smc91c9x_device::update_stats()
-{
- if ( DISPLAY_STATS )
- popmessage("Sent:%d Rec'd:%d", m_sent, m_recd);
+ return 0;
}
-/*-------------------------------------------------
-dump_bytes - Print packet bytes
--------------------------------------------------*/
-void smc91c9x_device::dump_bytes(u8 *buf, int length)
+int smc91c9x_device::ethernet_packet_is_for_me(const uint8_t *mac_address)
{
- if (VERBOSE & LOG_PACKETS)
- {
- std::stringstream ss_bytes;
- ss_bytes << std::hex << std::setfill('0');
- for (int i = 0; i < length; i++)
- {
- ss_bytes << std::setw(2) << (int) buf[i];
- // Send newline every 16 bytes and at the end
- if ((i & 0xf) == 0xf || i == length - 1)
- {
- LOGMASKED(LOG_PACKETS, "%s\n", ss_bytes.str());
- ss_bytes.str("");
- }
- else
- ss_bytes << " ";
- }
- }
-}
+ // tcpdump -i eth0 -q ether host 08:00:1e:01:ae:a5 or ether broadcast or ether dst 09:00:1e:00:00:00 or ether dst 09:00:1e:00:00:01
+ // wireshark filter: eth.addr eq 08:00:1e:01:ae:a5 or eth.dst eq ff:ff:ff:ff:ff:ff or eth.dst eq 09:00:1e:00:00:00 or eth.dst eq 09:00:1e:00:00:01
-/*-------------------------------------------------
-address_filter - Filter the received packet
--------------------------------------------------*/
+ int i;
-int smc91c9x_device::address_filter(u8 *buf)
-{
- if (m_reg[B0_RCR] & PRMS)
- {
- // TODO: 91C94 doesn't receive it's own transmisson when not in full duplex
- LOGMASKED(LOG_FILTER, "address_filter accepted (promiscuous mode)\n");
- return ADDR_UNICAST;
- }
- else if (buf[0] & 1)
+ LOG("\n");
+
+ if (VERBOSE & LOG_GENERAL)
{
- // broadcast
- if (!memcmp(ETH_BROADCAST, buf, 6))
+ for ( i = 0 ; i < ETHERNET_ADDR_SIZE ; i++ )
{
- LOGMASKED(LOG_FILTER, "address_filter accepted (broadcast) %02x-%02x-%02x-%02x-%02x-%02x\n",
- buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
-
- return ADDR_BROADCAST;
+ logerror("%.2X", ((u8 *)&m_reg[EREG_IA0_1])[i]);
}
-
- // multicast
- /*
- * Multicast address matching is performed by computing the fcs crc of
- * the destination address, and then using the upper 6 bits as an index
- * into the 64-bit logical address filter.
- */
- // Check for all multicast bit
- if (m_reg[B0_RCR] & ALMUL)
- return ADDR_MULTICAST;
-
- u32 const crc = util::crc32_creator::simple(buf, 6);
- // The hash is based on the top 6 MSBs of the CRC
- // The CRC needs to be inverted and reflected
- m_rx_hash = 0x0;
- for (int i = 0; i < 6; i++)
- m_rx_hash |= (((~crc) >> i) & 1) << (5 - i);
- u64 multicast_addr = *(u64*)&m_reg[B3_MT0_1];
- if (BIT(multicast_addr, m_rx_hash))
+ logerror("=");
+ for ( i = 0 ; i < ETHERNET_ADDR_SIZE ; i++ )
{
- LOGMASKED(LOG_FILTER, "address_filter accepted (multicast address match) %02x-%02x-%02x-%02x-%02x-%02x\n",
- buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
-
- return ADDR_MULTICAST;
+ logerror("%.2X",mac_address[i]);
}
- LOGMASKED(LOG_FILTER, "address_filter rejected multicast %02x-%02x-%02x-%02x-%02x-%02x crc: %08x hash: %02x multi: %16ullx\n",
- buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], crc, m_rx_hash, *(u64*)&m_reg[B3_MT0_1]);
+ logerror("?");
}
- else
- {
- // unicast
- if (!memcmp(&m_reg[B1_IA0_1], buf, 6))
- {
- LOGMASKED(LOG_FILTER, "address_filter accepted (physical address match)\n");
- return ADDR_UNICAST;
- }
+ // skip Ethernet broadcast packets if RECV_BROAD is not set
+ if (is_broadcast(mac_address))
+ {
+ LOG(" -- Broadcast rx\n");
+ return 2;
}
- return ADDR_NOMATCH;
-}
-/*-------------------------------------------------
-recv_start_cb - Start receiving packet
- A return value of 0 will stop rx processing in dinetwork device
- Any other value will be sent to the recv_complete_cb
--------------------------------------------------*/
-
-int smc91c9x_device::recv_start_cb(u8 *buf, int length)
-{
- // check internal loopback
- if (m_reg[B0_TCR] & (EPH_LOOP | LOOP))
+ if (memcmp(mac_address, &m_reg[EREG_IA0_1], ETHERNET_ADDR_SIZE) == 0)
{
- LOGMASKED(LOG_RX, "receive internal loopback mode, external packet discarded\n");
-
- return 0;
+ LOG(" -- Address Match\n");
+ return 1;
}
- // discard bad length packets
- if (length < 64 || length > 256*6 - 6)
- {
- LOGMASKED(LOG_RX, "received bad length packet length %d discarded\n", length);
+ LOG(" -- Not Matching\n");
- return 0;
- }
+ return 0;
+}
- // discard packets not from WMS
- if (memcmp(WMS_OUI, &buf[6], 3))
- {
- LOGMASKED(LOG_RX, "received non-WMS packet OUI: %02x:%02x:%02x length %d discarded\n", buf[6], buf[7], buf[8], length);
+/***************************************************************************
+ recv_cb - receive callback - receive and process an ethernet packet
+ ***************************************************************************/
- return 0;
- }
+void smc91c9x_device::recv_cb(uint8_t *data, int length)
+{
+ LOG("recv_cb : %d/0x%x\n",length,length);
- // Check for active transmission
- if (m_tx_active)
- {
- // TODO: Update collision counters
- LOGMASKED(LOG_RX, "transmit active COLLISION, rx packet length %d discarded\n", length);
+ int const isforme = ethernet_packet_is_for_me( data );
- return 0;
+ if (isforme==1 && (length >= ETHERNET_ADDR_SIZE) && (VERBOSE & LOG_GENERAL))
+ {
+ logerror("RX: ");
+ for (int i = 0; i < ETHERNET_ADDR_SIZE; i++)
+ logerror("%.2X", data[i]);
- }
+ logerror(" ");
- return receive(buf, length);
-}
+ for (int i = 0; i < length-ETHERNET_ADDR_SIZE; i++)
+ logerror("%.2X", data[ETHERNET_ADDR_SIZE + i]);
-/*-------------------------------------------------
-receive - Receive data into buffer
- Returns the buffer packet number + 1 if successful
--------------------------------------------------*/
+ logerror(" - IsForMe %d - %d/0x%x bytes\n", isforme, length, length);
+ }
-int smc91c9x_device::receive(u8 *buf, int length)
-{
- // check receiver enabled
- if (!(m_reg[B0_RCR] & RXEN))
+ if ( (length < ETHERNET_ADDR_SIZE || !isforme) && !(m_reg[EREG_RCR] & 0x0102) )
{
- LOGMASKED(LOG_RX, "receive disabled, external packet discarded\n");
+ LOG("\n");
- return -1;
+ // skip packet
+ return;
}
- // address filter
- int filter = address_filter(buf);
- if (filter == ADDR_NOMATCH)
- return -1;
-
- LOGMASKED(LOG_RX, "receive packet length %d\n", length);
- dump_bytes(buf, length);
+ /* signal a receive */
// Try to request a packet number
int packet_num;
- if (!alloc_req(0, packet_num))
- {
- logerror("recv_cb: Couldn't allocate memory for receive packet\n");
- return -2;
+ if (!alloc_req(0, packet_num)) {
+ logerror("recv_cb: Couldn't allocate a receive packet\n");
+ return;
}
- m_rx_active = 1;
+ /* compute the packet length */
- // build up the packet
- uint8_t *const packet = &m_buffer[packet_num * ETHER_BUFFER_SIZE];
+ if ( ( length < ( ETHER_BUFFER_SIZE - ( 2+2+2 ) ) ) )
+ {
+ uint8_t *const packet = &m_buffer[ packet_num * ETHER_BUFFER_SIZE];
- // Strip CRC
- if (m_reg[B0_RCR] & STRIP_CRC)
- length -= 4;
+ int dst = 0;
- // Copy received payload
- memcpy(&packet[4], buf, length);
+ // build up the packet
- // Status word
- u16 *rx_status = (u16*)&packet[0];
- *rx_status = 0x0000;
+ // Status word
+ packet[dst++] = 0x00;
- // set the broadcast flag
- if (filter == ADDR_BROADCAST)
- *rx_status |= BRODCAST;
+ // set the broadcast flag
+ if ( isforme == 2 )
+ packet[dst++] |= 0x40;
+ else
+ packet[dst++] = 0x00;
- // set the multicast flag and hash
- if (filter == ADDR_MULTICAST)
- {
- *rx_status |= (m_rx_hash << 1) | MULTCAST;
- }
+ //bytes count
+ packet[dst++] = 0x00;
+ packet[dst++] = 0x00;
- // Calculate buffer length and set control byte
- u16 buf_length;
+ memcpy(&packet[dst], data, length );
+ dst += length;
- if (length & 1)
- {
- // ODD Frame
- *rx_status |= ODDFRM;
- packet[length + 4] = EBUF_RX_ALWAYS | EBUF_ODD; // Control
- buf_length = length + 5;
- }
- else
- {
- packet[length + 4] = 0x00; // Pad
- packet[length + 5] = EBUF_RX_ALWAYS; // Control
- buf_length = length + 6;
- }
+ if ( dst & 1 )
+ {
+ // ODD Frame
+ packet[dst++] = 0x40 | 0x20; // Control
+ }
+ else
+ {
+ packet[dst++] = 0x00; // Pad
+ packet[dst++] = 0x40 | 0x00; // Control
+ }
- // Set buffer length word
- *(u16*)&packet[2] = buf_length;
+ //dst += 2;
- return packet_num + 1;
-}
+ dst &= 0x7FF;
-/*-------------------------------------------------
-recv_complete_cb - End of receive
--------------------------------------------------*/
+ packet[2] = (dst&0xFF);
+ packet[3] = (dst) >> 8;
-void smc91c9x_device::recv_complete_cb(int result)
-{
- if (result > 0)
- {
// Push packet number to rx completion fifo
- push_completed_rx(result - 1);
+ m_comp_rx.push_back(packet_num);
}
- // Couldn't allocate memory
- else if (result == -2)
+ else
{
- m_reg[B2_INTERRUPT] |= EINT_ALLOC;
+ LOG("Rejected ! Fifo Full ?");
}
update_ethernet_irq();
- m_rx_active = 0;
+ LOG("\n");
}
+/***************************************************************************
+ INTERNAL HELPERS
+***************************************************************************/
+
/*-------------------------------------------------
- tx_poll - Starts transmit
+ update_ethernet_irq - update the IRQ state
-------------------------------------------------*/
-TIMER_CALLBACK_MEMBER(smc91c9x_device::tx_poll)
+void smc91c9x_device::update_ethernet_irq()
{
- // Check for active RX and delay if necessary
- if (m_rx_active)
- {
- // TODO: Implement correct CSMA/CD algorithm
- m_tx_poll->adjust(attotime::from_usec(40));
- m_tx_retry_count++;
- LOGMASKED(LOG_TX, "tx_poll: Delaying TX due to active RX retry_count = %d\n", m_tx_retry_count);
- }
- // Check if TX is enabled and packet is queued
- else if ((m_reg[B0_TCR] & TXENA) && !empty_queued_tx())
- {
- // Reset retry count
- m_tx_retry_count = 0;
+ // Check tx completion fifo empty
+ if (m_comp_tx.empty())
+ m_reg[EREG_INTERRUPT] &= ~EINT_TX;
+ else
+ m_reg[EREG_INTERRUPT] |= EINT_TX;
- // Get the packet number from the transmit fifo
- const int packet_num = curr_queued_tx();
- uint8_t *const tx_buffer = &m_buffer[packet_num * ETHER_BUFFER_SIZE];
+ // Check rx completion fifo empty
+ if (m_comp_rx.empty())
+ m_reg[EREG_INTERRUPT] &= ~EINT_RCV;
+ else
+ m_reg[EREG_INTERRUPT] |= EINT_RCV;
- // Get the length and control fields from buffer
- u16 length = (*(u16*)&tx_buffer[2]) & 0x7ff;
- const u8 control = tx_buffer[length - 1];
+ uint8_t const mask = m_reg[EREG_INTERRUPT] >> 8;
+ uint8_t const state = m_reg[EREG_INTERRUPT] & 0xff;
- // Remove [pad], control
- if (control & EBUF_ODD)
- length -= 1;
- else
- length -= 2;
- // Add padding up to CRC area
- // take into account status & length removal (-4) and crc addtion (+4)
- while (length < 64 + 4 - 4 && (m_reg[B0_TCR] & PAD_EN))
- tx_buffer[length++] = 0x00;
+ /* update the IRQ state */
+ uint8_t new_state = mask & state;
+ if (m_irq_state ^ new_state)
+ {
+ LOG("update_ethernet_irq: old: %02x new: %02x\n", m_irq_state, new_state);
+ m_irq_state = new_state;
+ m_irq_handler(m_irq_state ? ASSERT_LINE : CLEAR_LINE);
+ }
+}
- // Add CRC
- // TODO: Calculate CRC
- if (1 && ((control & EBUF_CRC) || !(m_reg[B0_TCR] & NOCRC)))
- {
- tx_buffer[length++] = 0x11;
- tx_buffer[length++] = 0x22;
- tx_buffer[length++] = 0x33;
- tx_buffer[length++] = 0x44;
- }
- // Remove status, length
- length -= 4;
+/*-------------------------------------------------
+ update_stats - draw statistics
+-------------------------------------------------*/
- // Reset the EPH register */
- m_reg[B0_EPH_STATUS] &= LINK_OK;
+void smc91c9x_device::update_stats()
+{
+ if ( DISPLAY_STATS )
+ popmessage("Sent:%d Rec'd:%d", m_sent, m_recd);
+}
- // Send the frame
- m_tx_active = 1;
- m_tx_poll->enable(false);
- LOGMASKED(LOG_TX, "Start sending packet %d length = %d time: %s\n", packet_num, length, machine().scheduler().time().as_string());
- dump_bytes(&tx_buffer[4], length);
+/*-------------------------------------------------
+ send_frame - push a frame to the interface
+-------------------------------------------------*/
- // Write loopback data and save result
- if (m_reg[B0_TCR] & (EPH_LOOP | LOOP | FDUPLX))
- m_loopback_result = receive(&tx_buffer[4], length);
- else
- m_loopback_result = 0;
+TIMER_CALLBACK_MEMBER(smc91c9x_device::send_frame)
+{
+ // Get the packet number from the transmit fifo
+ const int packet_num = m_trans_tx.front();
+ uint8_t *const tx_buffer = &m_buffer[packet_num * ETHER_BUFFER_SIZE];
- // Local loopback isn't sent to cable
- //if ((m_reg[B0_TCR] & (EPH_LOOP | LOOP) || (get_interface() < 0 && (m_reg[B0_TCR] & FDUPLX))))
- if (m_reg[B0_TCR] & (EPH_LOOP | LOOP))
- send_complete_cb(length);
- else
- send(&tx_buffer[4], length);
+ // Pop the transmit fifo
+ m_trans_tx.erase(m_trans_tx.begin());
- }
-}
+ /* update the EPH register */
+ m_reg[EREG_EPH_STATUS] = 0x0001;
-/*-------------------------------------------------
-send_complete_cb - Called after transmit complete
--------------------------------------------------*/
+ if (is_broadcast(&tx_buffer[4]))
+ m_reg[EREG_EPH_STATUS] |= 0x0040;
+
+ // Check tx completion fifo empty
+ if (m_trans_tx.empty())
+ m_reg[EREG_INTERRUPT] |= EINT_TX_EMPTY;
-void smc91c9x_device::send_complete_cb(int result)
-{
m_sent++;
+
update_stats();
- // Pop the packet number from the transmit fifo
- const int packet_num = pop_queued_tx();
- uint8_t *const tx_buffer = &m_buffer[packet_num * ETHER_BUFFER_SIZE];
+ int buffer_len = ((tx_buffer[3] << 8) | tx_buffer[2]) & 0x7ff;
+ // Remove status, length, [pad], control
+ if (tx_buffer[buffer_len - 1] & 0x20)
+ buffer_len -= 5;
+ else
+ buffer_len -= 6;
+ // Add padding
+ if (buffer_len < 64 && (m_reg[EREG_TCR] & 0x0080)) {
+ while (buffer_len < 64)
+ tx_buffer[4 + buffer_len++] = 0x00;
+ }
+ if (VERBOSE & LOG_GENERAL)
+ {
+ logerror("TX: ");
+ for (int i = 0; i < ETHERNET_ADDR_SIZE; i++)
+ logerror("%.2X", tx_buffer[4 + i]);
- LOGMASKED(LOG_TX, "End sending packet %d result = %d time: %s\n", packet_num, result, machine().scheduler().time().as_string());
+ logerror(" ");
- /* update the EPH register */
- m_reg[B0_EPH_STATUS] |= TX_SUC;
+ for (int i = ETHERNET_ADDR_SIZE; i < buffer_len; i++)
+ logerror("%.2X", tx_buffer[4 + i]);
- // Set LINK_OK in status
- if (0 && !(m_reg[B0_EPH_STATUS] & LINK_OK))
- {
- m_reg[B0_EPH_STATUS] |= LINK_OK;
- // Set a ethernet phy status interrupt
- m_reg[B2_INTERRUPT] |= EINT_EPH;
+ logerror("--- %d/0x%x bytes\n", buffer_len, buffer_len);
}
- // Set Tx broadcast flag
- if (!memcmp(ETH_BROADCAST, &tx_buffer[4], 6))
- m_reg[B0_EPH_STATUS] |= LTX_BRD;
+ if (buffer_len > 4)
+ {
+ if (m_link_unconnected)
+ {
+ // Set lost carrier
+ if (m_reg[EREG_TCR] & 0x0400)
+ {
+ m_reg[EREG_EPH_STATUS] |= 0x400;
+ // Clear Tx Enable on error
+ m_reg[EREG_TCR] &= ~0x1;
+ }
- // Check tx queued fifo empty
- if (empty_queued_tx())
- m_reg[B2_INTERRUPT] |= EINT_TX_EMPTY;
+ // Set signal quality error
+ if (m_reg[EREG_TCR] & 0x1000)
+ {
+ m_reg[EREG_EPH_STATUS] |= 0x20;
+ // Clear Tx Enable on error
+ m_reg[EREG_TCR] &= ~0x1;
+ }
- // Set no-transmission flags
- if (m_link_unconnected)
- {
- //m_reg[B0_EPH_STATUS] &= ~LINK_OK;
- //m_reg[B0_EPH_STATUS] &= ~TX_SUC;
+ // Set a ethernet phy status interrupt
+ m_reg[EREG_INTERRUPT] |= EINT_EPH;
- // Set lost carrier
- if (m_reg[B0_TCR] & MON_CSN)
- {
- m_reg[B0_EPH_STATUS] |= LOST_CARR;
- // Clear Tx Enable on error
- m_reg[B0_TCR] &= ~TXENA;
+ // TODO: Is it necessary to clear FIFOs on error?
+ // Flush fifos.
+ //clear_tx_fifo();
+ //clear_rx_fifo();
}
-
- // Set signal quality error
- if (m_reg[B0_TCR] & STP_SQET)
+ else
{
- m_reg[B0_EPH_STATUS] |= SQET;
- // Clear Tx Enable on error
- m_reg[B0_TCR] &= ~TXENA;
- }
+ // Send the frame
+ if (!send(&tx_buffer[4], buffer_len))
+ {
+ // FIXME: failed to send the Ethernet packet
+ //logerror("failed to send Ethernet packet\n");
+ //LOG(this,("read_command_port(): !!! failed to send Ethernet packet"));
+ }
- // Set a ethernet phy status interrupt
- m_reg[B2_INTERRUPT] |= EINT_EPH;
+ // Loopback if loopback is set or fduplx is set
+ // TODO: Figure out correct size
+ // TODO: Check for addtional filter options for FDUPLX mode
+ if ((m_reg[EREG_TCR] & 0x2002) || (m_network_available && (m_reg[EREG_TCR] & 0x0800)))
+ recv_cb(&tx_buffer[4], buffer_len);
+ }
}
-
// Update status in the transmit word
- *(u16*)&tx_buffer[0] = m_reg[B0_EPH_STATUS];
+ tx_buffer[0] = m_reg[EREG_EPH_STATUS];
+ tx_buffer[1] = m_reg[EREG_EPH_STATUS] >> 8;
// Push the packet number onto the tx completion fifo
- push_completed_tx(packet_num);
+ m_comp_tx.push_back(packet_num);
update_ethernet_irq();
- // Loopback if loopback is set or fduplx is set
- if (m_loopback_result)
- {
- //int rx_result = receive(&tx_buffer[4], result);
- recv_complete_cb(m_loopback_result);
+ // If there is more packets to transmit then set the tx timer
+ if ((m_reg[EREG_TCR] & 0x1) && !m_trans_tx.empty()) {
+ // Shortest packet (64 bytes @ 10Mbps = 50us)
+ m_tx_timer->adjust(attotime::from_usec(50));
}
-
- // If there is more packets to transmit then start the tx polling
- if ((m_reg[B0_TCR] & TXENA) && !empty_queued_tx())
- {
- m_tx_poll->adjust(attotime::from_usec(10));
- }
-
- m_tx_active = 0;
}
/*-------------------------------------------------
@@ -695,48 +662,53 @@ void smc91c9x_device::process_command(uint16_t data)
LOG(" ALLOCATE MEMORY FOR TX (%d)", (data & 7));
{
int packet_num;
- if (alloc_req(1, packet_num))
- {
+ if (alloc_req(1, packet_num)) {
LOG(" packet_num = %02x\n", (packet_num));
// Set ARR register
- m_reg[B2_PNR_ARR] &= ~0xff00;
- m_reg[B2_PNR_ARR] |= packet_num << 8;
- m_reg[B2_INTERRUPT] |= EINT_ALLOC;
+ m_reg[EREG_PNR_ARR] &= ~0xff00;
+ m_reg[EREG_PNR_ARR] |= packet_num << 8;
+ m_reg[EREG_INTERRUPT] |= EINT_ALLOC;
update_ethernet_irq();
}
- else
- {
+ else {
logerror("ECMD_ALLOCATE: Couldn't allocate TX memory\n");
}
}
break;
case ECMD_RESET_MMU:
+ /*
+ 0100
+ - RESET MMU TO INITIAL STATE -
+ Frees all memory allocations, clears relevant
+ interrupts, resets packet FIFO pointers.
+ */
+
LOG(" RESET MMU\n");
mmu_reset();
break;
case ECMD_REMOVE_TOPFRAME_TX:
LOG(" REMOVE FRAME FROM TX FIFO\n");
- if (empty_completed_tx())
+ if (m_comp_tx.empty())
logerror("process_command: Trying to remove entry from empty tx completion fifo\n");
else
- pop_completed_tx();
+ m_comp_tx.erase(m_comp_tx.begin());
break;
case ECMD_REMOVE_RELEASE_TOPFRAME_RX:
- LOG(" REMOVE AND RELEASE FRAME FROM RX FIFO (PACK_NUM=%d)\n", curr_completed_rx());
+ LOG(" REMOVE AND RELEASE FRAME FROM RX FIFO (PACK_NUM=%d)\n", m_comp_rx.front());
// Release memory allocation
- alloc_release(curr_completed_rx());
+ alloc_release(m_comp_rx.front());
// Fall through
case ECMD_REMOVE_TOPFRAME_RX:
LOG(" REMOVE FRAME FROM RX FIFO\n");
// remove entry from rx completion queue
- if (empty_completed_rx())
+ if (m_comp_rx.empty())
logerror("process_command: Trying to remove entry from empty rx completion fifo\n");
else
- pop_completed_rx();
+ m_comp_rx.erase(m_comp_rx.begin());
update_ethernet_irq();
m_recd++;
@@ -745,7 +717,7 @@ void smc91c9x_device::process_command(uint16_t data)
case ECMD_RELEASE_PACKET:
{
- const int packet_number = m_reg[B2_PNR_ARR] & 0xff;
+ const int packet_number = m_reg[EREG_PNR_ARR] & 0xff;
alloc_release(packet_number);
LOG(" RELEASE SPECIFIC PACKET %d\n", packet_number);
}
@@ -754,31 +726,33 @@ void smc91c9x_device::process_command(uint16_t data)
case ECMD_ENQUEUE_PACKET:
LOG(" ENQUEUE TX PACKET ");
- if (m_reg[B0_TCR] & TXENA)
+ if (m_reg[EREG_TCR] & 0x0001) // TX EN ?
{
- const int packet_number = m_reg[B2_PNR_ARR] & 0xff;
+ const int packet_number = m_reg[EREG_PNR_ARR] & 0xff;
LOG("(PACKET_NUM=%d)\n", packet_number);
// Push packet number to tx transmit fifo
- push_queued_tx(packet_number);
- // Start timer to send frame if not already transmitting
- if (!m_tx_active && !m_tx_poll->enabled())
- {
- m_tx_poll->adjust(attotime::from_usec(10));
- LOG("Start polling time: %s\n", machine().scheduler().time().as_string());
- }
+ m_trans_tx.push_back(packet_number);
+ // Calculate transmit time
+ //uint8_t *const tx_buffer = &m_buffer[packet_number * ETHER_BUFFER_SIZE];
+ //int buffer_len = ((tx_buffer[3] << 8) | tx_buffer[2]) & 0x7ff;
+ //buffer_len -= 6;
+ //int usec = ((buffer_len * 8) / 10) + 1;
+ // Shortest packet (64 bytes @ 10Mbps = 50us)
+ m_tx_timer->adjust(attotime::from_usec(50));
}
break;
case ECMD_RESET_FIFOS:
LOG(" RESET TX FIFOS\n");
// Flush fifos.
- reset_tx_fifos();
+ clear_tx_fifo();
break;
}
// Set Busy (clear on next read)
- m_reg[B2_MMU_COMMAND] |= 0x0001;
-
+ m_reg[EREG_MMU_COMMAND] |= 0x0001;
+ //LOG("process_command: TxQ: %d TxComp: %d RxComp: %d TxAlloc: %04x RxAlloc: %04x\n",
+ // m_trans_tx.size(), m_comp_tx.size(), m_comp_rx.size(), m_alloc_tx, m_alloc_rx);
}
@@ -797,60 +771,60 @@ READ16_MEMBER( smc91c9x_device::read )
/* determine the effective register */
offset %= 8;
- if ( offset != B0_BANK )
- offset += 8 * (m_reg[B0_BANK] & 7);
+ if ( offset != EREG_BANK )
+ offset += 8 * (m_reg[EREG_BANK] & 7);
result = m_reg[offset];
switch (offset)
{
- case B2_MMU_COMMAND:
+ case EREG_MMU_COMMAND:
// Clear busy
- m_reg[B2_MMU_COMMAND] &= ~0x0001;
+ m_reg[EREG_MMU_COMMAND] &= ~0x0001;
break;
- case B2_PNR_ARR:
+ case EREG_PNR_ARR:
if ( ACCESSING_BITS_8_15 )
{
- m_reg[B2_INTERRUPT] &= ~EINT_ALLOC;
+ m_reg[EREG_INTERRUPT] &= ~EINT_ALLOC;
update_ethernet_irq();
}
break;
- case B2_FIFO_PORTS:
+ case EREG_FIFO_PORTS:
result = 0;
- if (!empty_completed_tx())
- result |= curr_completed_tx();
+ if (!m_comp_tx.empty())
+ result |= m_comp_tx.front();
else
result |= 0x80;
- if (!empty_completed_rx())
- result |= curr_completed_rx() << 8;
+ if (!m_comp_rx.empty())
+ result |= m_comp_rx.front() << 8;
else
result |= 0x80 << 8;
break;
- case B2_DATA_0: /* data register */
- case B2_DATA_1: /* data register */
+ case EREG_DATA_0: /* data register */
+ case EREG_DATA_1: /* data register */
{
uint8_t *buffer;
- int addr = m_reg[B2_POINTER] & 0x7ff;
+ int addr = m_reg[EREG_POINTER] & 0x7ff;
- if ( m_reg[B2_POINTER] & 0x8000 )
- buffer = &m_buffer[curr_completed_rx() * ETHER_BUFFER_SIZE];
+ if ( m_reg[EREG_POINTER] & 0x8000 )
+ buffer = &m_buffer[m_comp_rx.front() * ETHER_BUFFER_SIZE];
else
- buffer = &m_buffer[(m_reg[B2_PNR_ARR] & 0x1f) * ETHER_BUFFER_SIZE];;
+ buffer = &m_buffer[(m_reg[EREG_PNR_ARR] & 0x1f) * ETHER_BUFFER_SIZE];;
result = buffer[addr++];
if ( ACCESSING_BITS_8_15 )
result |= buffer[addr++] << 8;
- if ( m_reg[B2_POINTER] & 0x4000 )
- m_reg[B2_POINTER] = (m_reg[B2_POINTER] & ~0x7ff) | (addr & 0x7ff);
+ if ( m_reg[EREG_POINTER] & 0x4000 )
+ m_reg[EREG_POINTER] = (m_reg[EREG_POINTER] & ~0x7ff) | (addr & 0x7ff);
break;
}
}
- if (offset != B0_BANK)
+ if (offset != EREG_BANK)
LOG("%s:smc91c9x_r(%s) = %04X & %04X\n", machine().describe_context(), ethernet_regname[offset], result, mem_mask);
return result;
}
@@ -864,12 +838,12 @@ WRITE16_MEMBER( smc91c9x_device::write )
{
/* determine the effective register */
offset %= 8;
- if (offset != B0_BANK)
- offset += 8 * (m_reg[B0_BANK] & 7);
+ if (offset != EREG_BANK)
+ offset += 8 * (m_reg[EREG_BANK] & 7);
/* update the data generically */
- if (offset != B0_BANK && offset < sizeof(m_reg))
+ if (offset != EREG_BANK && offset < sizeof(m_reg))
LOG("%s:smc91c9x_w(%s) = [%04X]<-%04X & (%04X & %04X)\n", machine().describe_context(), ethernet_regname[offset], offset, data, mem_mask , m_regmask[offset]);
mem_mask &= m_regmask[offset];
@@ -878,62 +852,49 @@ WRITE16_MEMBER( smc91c9x_device::write )
/* handle it */
switch (offset)
{
- case B0_TCR: /* transmit control register */
+ case EREG_TCR: /* transmit control register */
// Setting Tx Enable clears some status and interrupts
- if ( data & TXENA )
- {
- if (m_reg[B0_EPH_STATUS] & (LOST_CARR | SQET | LATCOL | E16COL))
- {
- m_reg[B0_EPH_STATUS] &= ~(LOST_CARR | SQET | LATCOL | E16COL);
- m_reg[B2_INTERRUPT] &= ~EINT_EPH;
- update_ethernet_irq();
- }
- }
- if (VERBOSE & LOG_GENERAL)
- {
- if (data & FDSE) LOG(" FDSE\n");
- if (data & EPH_LOOP) LOG(" EPH LOOP\n");
- if (data & STP_SQET) LOG(" STP SQET\n");
- if (data & FDUPLX) LOG(" FDUPLX\n");
- if (data & MON_CSN) LOG(" MON_CSN\n");
- if (data & NOCRC) LOG(" NOCRC\n");
- if (data & PAD_EN) LOG(" PAD_EN\n");
- if (data & FORCOL) LOG(" FORCOL\n");
- if (data & LOOP) LOG(" LOOP\n");
- if (data & TXENA) LOG(" TXENA\n");
+ if ( data & 0x1 ) {
+ m_reg[EREG_EPH_STATUS] &= ~0x420;
+ m_reg[EREG_INTERRUPT] &= ~EINT_EPH;
+ update_ethernet_irq();
}
+
+ if (data & 0x2000) LOG(" EPH LOOP\n");
+ if (data & 0x1000) LOG(" STP SQET\n");
+ if (data & 0x0800) LOG(" FDUPLX\n");
+ if (data & 0x0400) LOG(" MON_CSN\n");
+ if (data & 0x0100) LOG(" NOCRC\n");
+ if (data & 0x0080) LOG(" PAD_EN\n");
+ if (data & 0x0004) LOG(" FORCOL\n");
+ if (data & 0x0002) LOG(" LOOP\n");
+ if (data & 0x0001) LOG(" TXENA\n");
break;
- case B0_RCR: /* receive control register */
+ case EREG_RCR: /* receive control register */
- if ( data & SOFT_RST)
+ if ( data & 0x8000 )
{
- reset();
+ clear_rx_fifo();
+ clear_tx_fifo();
}
- if ( !(data & RXEN) )
- {
- reset_completed_rx();
- }
- if (data & RXEN)
+ if ( !(data & 0x0100) )
{
- // Set LINK_OK in status
- m_reg[B0_EPH_STATUS] |= LINK_OK;
+ clear_rx_fifo();
}
- if (VERBOSE & LOG_GENERAL)
- {
- if (data & SOFT_RST) LOG(" SOFT RST\n");
- if (data & FILT_CAR) LOG(" FILT_CAR\n");
- if (data & STRIP_CRC) LOG(" STRIP CRC\n");
- if (data & RXEN) LOG(" RXEN\n");
- if (data & ALMUL) LOG(" ALMUL\n");
- if (data & PRMS) LOG(" PRMS\n");
- if (data & RX_ABORT) LOG(" RX_ABORT\n");
- }
+ if (data & 0x8000) reset();
+ if (data & 0x8000) LOG(" SOFT RST\n");
+ if (data & 0x4000) LOG(" FILT_CAR\n");
+ if (data & 0x0200) LOG(" STRIP CRC\n");
+ if (data & 0x0100) LOG(" RXEN\n");
+ if (data & 0x0004) LOG(" ALMUL\n");
+ if (data & 0x0002) LOG(" PRMS\n");
+ if (data & 0x0001) LOG(" RX_ABORT\n");
break;
- case B1_CONFIG: /* configuration register */
+ case EREG_CONFIG: /* configuration register */
if (data & 0x1000) LOG(" NO WAIT\n");
if (data & 0x0400) LOG(" FULL STEP\n");
if (data & 0x0200) LOG(" SET SQLCH\n");
@@ -944,86 +905,64 @@ WRITE16_MEMBER( smc91c9x_device::write )
if (data & 0x0002) LOG(" INT SEL0\n");
break;
- case B1_BASE: /* base address register */
+ case EREG_BASE: /* base address register */
LOG(" base = $%04X\n", (data & 0xe000) | ((data & 0x1f00) >> 3));
LOG(" romsize = %d\n", ((data & 0xc0) >> 6));
LOG(" romaddr = $%05X\n", ((data & 0x3e) << 13));
break;
- case B1_IA4_5:
- set_promisc(m_reg[B0_RCR] & PRMS);
- set_mac((char *)&m_reg[B1_IA0_1]);
-
- break;
-
- case B1_CONTROL: /* control register */
- // Clearing LE_EN clears interrupt from LINK_OK status change
- if (!(data & LE_ENABLE))
- {
- m_reg[B2_INTERRUPT] &= ~EINT_EPH;
- update_ethernet_irq();
- }
- if (0 && (data & LE_ENABLE))
- {
- if (m_reg[B0_EPH_STATUS] & LINK_OK)
- {
- m_reg[B0_EPH_STATUS] &= ~(LINK_OK);
- m_reg[B2_INTERRUPT] &= ~EINT_EPH;
- update_ethernet_irq();
- }
- }
- if (VERBOSE & LOG_GENERAL)
- {
- if (data & RCV_BAD) LOG(" RCV_BAD\n");
- if (data & PWRDN) LOG(" PWRDN\n");
- if (data & WAKEUP_EN) LOG(" WAKEUP ENABLE\n");
- if (data & AUTO_RELEASE) LOG(" AUTO RELEASE\n");
- if (data & LE_ENABLE) LOG(" LE ENABLE\n");
- if (data & CR_ENABLE) LOG(" CR ENABLE\n");
- if (data & TE_ENABLE) LOG(" TE ENABLE\n");
- if (data & EEPROM_SEL) LOG(" EEPROM SELECT\n");
- if (data & RELOAD) LOG(" RELOAD\n");
- if (data & STORE) LOG(" STORE\n");
- }
+ case EREG_CONTROL: /* control register */
+ if (data & 0x4000) LOG(" RCV_BAD\n");
+ if (data & 0x2000) LOG(" PWRDN\n");
+ if (data & 0x0800) LOG(" AUTO RELEASE\n");
+ if (data & 0x0080) LOG(" LE ENABLE\n");
+ if (data & 0x0040) LOG(" CR ENABLE\n");
+ if (data & 0x0020) LOG(" TE ENABLE\n");
+ if (data & 0x0004) LOG(" EEPROM SELECT\n");
+ if (data & 0x0002) LOG(" RELOAD\n");
+ if (data & 0x0001) LOG(" STORE\n");
break;
- case B2_MMU_COMMAND: /* command register */
+ case EREG_MMU_COMMAND: /* command register */
process_command(data);
break;
- case B2_DATA_0: /* data register */
- case B2_DATA_1: /* data register */
+ case EREG_DATA_0: /* data register */
+ case EREG_DATA_1: /* data register */
{
uint8_t *buffer;
- int addr = m_reg[B2_POINTER] & PTR;
+ int addr = m_reg[EREG_POINTER] & 0x7ff;
- if (m_reg[B2_POINTER] & RCV)
- buffer = &m_buffer[curr_completed_rx() * ETHER_BUFFER_SIZE];
+ if (m_reg[EREG_POINTER] & 0x8000)
+ buffer = &m_buffer[m_comp_rx.front() * ETHER_BUFFER_SIZE];
else
- buffer = &m_buffer[(m_reg[B2_PNR_ARR] & 0x1f) * ETHER_BUFFER_SIZE];;
+ buffer = &m_buffer[(m_reg[EREG_PNR_ARR] & 0x1f) * ETHER_BUFFER_SIZE];;
+ // TODO: Should be checking if incr is set
buffer[addr++] = data;
if ( ACCESSING_BITS_8_15 )
buffer[addr++] = data >> 8;
- if ( m_reg[B2_POINTER] & AUTO_INCR)
- m_reg[B2_POINTER] = (m_reg[B2_POINTER] & ~PTR) | (addr & PTR);
+ if ( m_reg[EREG_POINTER] & 0x4000 )
+ m_reg[EREG_POINTER] = (m_reg[EREG_POINTER] & ~0x7ff) | (addr & 0x7ff);
break;
}
- case B2_INTERRUPT:
+ case EREG_INTERRUPT:
// Pop tx fifo packet from completion fifo if clear tx int is set
- if (m_reg[B2_INTERRUPT] & data & EINT_TX)
- {
- if (empty_completed_tx())
+ if (m_reg[EREG_INTERRUPT] & data & EINT_TX) {
+ if (m_comp_tx.empty()) {
logerror("write: Trying to remove an entry from empty tx completion fifo\n");
- else
- {
- LOG("Removing tx completion packet_num = %d\n", curr_completed_tx());
- pop_completed_tx();
}
+ else {
+ LOG("Removing tx completion packet_num = %d\n", m_comp_tx.front());
+ m_comp_tx.erase(m_comp_tx.begin());
+ }
+ }
+ // Clear TX_EMPTY interrupt if clear tx empty bit is set
+ if (m_reg[EREG_INTERRUPT] & data & EINT_TX_EMPTY) {
+ m_reg[EREG_INTERRUPT] &= ~EINT_TX_EMPTY;
}
- // Clear interrupts
- m_reg[B2_INTERRUPT] &= ~(data & (EINT_ERCV | EINT_RX_OVRN | EINT_TX_EMPTY | EINT_TX));
+ m_reg[EREG_INTERRUPT] &= ~(data & 0x56);
update_ethernet_irq();
break;
}
diff --git a/src/devices/machine/smc91c9x.h b/src/devices/machine/smc91c9x.h
index b84f6070ef7..79fb52fcd0d 100644
--- a/src/devices/machine/smc91c9x.h
+++ b/src/devices/machine/smc91c9x.h
@@ -4,15 +4,13 @@
SMC91C9X ethernet controller implementation
- by Aaron Giles, Ted Green
+ by Aaron Giles, Jean-François DEL NERO
**************************************************************************/
#ifndef MAME_MACHINE_SMC91C9X_H
#define MAME_MACHINE_SMC91C9X_H
-#pragma once
-
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
@@ -24,206 +22,39 @@ public:
DECLARE_READ16_MEMBER( read );
DECLARE_WRITE16_MEMBER( write );
+ TIMER_CALLBACK_MEMBER(send_frame);
+ virtual void recv_cb(uint8_t *data, int length) override;
void set_link_connected(bool connected) { m_link_unconnected = !connected; };
protected:
- enum class dev_type {
- SMC91C94,
- SMC91C96
- };
-
- smc91c9x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, dev_type device_type);
+ smc91c9x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- // device_network_interface overrides
- virtual void send_complete_cb(int result) override;
- virtual int recv_start_cb(u8 *buf, int length) override;
- virtual void recv_complete_cb(int result) override;
-
- void dump_bytes(u8 *buf, int length);
- int address_filter(u8 *buf);
- int receive(u8 *buf, int length);
-
- TIMER_CALLBACK_MEMBER(tx_poll);
-
- const dev_type m_device_type;
- unsigned m_num_ebuf;
+ virtual void device_pre_save(void) override;
+ virtual void device_post_load(void) override;
private:
- // Ethernet registers - bank 0
- enum bank0_addr : u8 {
- B0_TCR = (0 * 8 + 0),
- B0_EPH_STATUS = (0 * 8 + 1),
- B0_RCR = (0 * 8 + 2),
- B0_COUNTER = (0 * 8 + 3),
- B0_MIR = (0 * 8 + 4),
- B0_MCR = (0 * 8 + 5),
- B0_BANK = (0 * 8 + 7)
- };
-
- // Ethernet registers - bank 1
- enum bank1_addr : u8 {
- B1_CONFIG = (1 * 8 + 0),
- B1_BASE = (1 * 8 + 1),
- B1_IA0_1 = (1 * 8 + 2),
- B1_IA2_3 = (1 * 8 + 3),
- B1_IA4_5 = (1 * 8 + 4),
- B1_GENERAL_PURP = (1 * 8 + 5),
- B1_CONTROL = (1 * 8 + 6)
- };
-
- // Ethernet registers - bank 2
- enum bank2_addr : u8 {
- B2_MMU_COMMAND = (2 * 8 + 0),
- B2_PNR_ARR = (2 * 8 + 1),
- B2_FIFO_PORTS = (2 * 8 + 2),
- B2_POINTER = (2 * 8 + 3),
- B2_DATA_0 = (2 * 8 + 4),
- B2_DATA_1 = (2 * 8 + 5),
- B2_INTERRUPT = (2 * 8 + 6)
- };
-
- // Ethernet registers - bank 3
- enum bank3_addr : u8 {
- B3_MT0_1 = (3 * 8 + 0),
- B3_MT2_3 = (3 * 8 + 1),
- B3_MT4_5 = (3 * 8 + 2),
- B3_MT6_7 = (3 * 8 + 3),
- B3_MGMT = (3 * 8 + 4),
- B3_REVISION = (3 * 8 + 5),
- B3_ERCV = (3 * 8 + 6)
- };
-
- // Ethernet MMU commands
- enum mmu_cmd : u8 {
- ECMD_NOP = 0,
- ECMD_ALLOCATE = 2,
- ECMD_RESET_MMU = 4,
- ECMD_REMOVE_TOPFRAME_RX = 6,
- ECMD_REMOVE_TOPFRAME_TX = 7,
- ECMD_REMOVE_RELEASE_TOPFRAME_RX = 8,
- ECMD_RELEASE_PACKET = 10,
- ECMD_ENQUEUE_PACKET = 12,
- ECMD_RESET_FIFOS = 14
- };
-
- // Ethernet interrupt bits
- enum eint_def : u8 {
- EINT_RCV = 0x01,
- EINT_TX = 0x02,
- EINT_TX_EMPTY = 0x04,
- EINT_ALLOC = 0x08,
- EINT_RX_OVRN = 0x10,
- EINT_EPH = 0x20,
- EINT_ERCV = 0x40, // 91c92 only
- EINT_TX_IDLE = 0x80 // 91c94 only
- };
-
- // Address filter return codes
- enum addr_filter_def : int {
- ADDR_NOMATCH = 0,
- ADDR_UNICAST = 1,
- ADDR_BROADCAST = 2,
- ADDR_MULTICAST = 3
- };
-
- // Rx/Tx control bits
- enum control_mask : u8 {
- EBUF_RX_ALWAYS = 0x40, // Always set on receive buffer control byte
- EBUF_ODD = 0x20, // Odd number of data payload bytes
- EBUF_CRC = 0x10 // Tx add CRC
- };
-
- // Receive buffer status
- enum rx_status_mask : u16 {
- ALGNERR = 0x8000,
- BRODCAST = 0x4000,
- BADCRC = 0x2000,
- ODDFRM = 0x1000,
- TOOLNG = 0x0800, // Received fram is longer than 1518 bytes on cable
- TOOSHORT = 0x0400, // Received fram is shorter than 64 bytes on cable
- HASHVALUE = 0x007e,
- MULTCAST = 0x0001
- };
-
- // EPH Status bits
- enum eph_mask : u16 {
- LINK_OK = 0x4000, // State of link integrity test
- CTR_ROL = 0x1000, // Counter roll Over
- EXC_DEF = 0x0800, // Excessive deferral
- LOST_CARR = 0x0400, // Lost carrier sense
- LATCOL = 0x0200, // Late collisions detected
- WAKEUP = 0x0100, // Magic packet received
- TX_DEFER = 0x0080, // Transmit deferred
- LTX_BRD = 0x0040, // Last transmit frame was a broadcast
- SQET = 0x0020, // Signal Quality Error Test
- E16COL = 0x0010, // 16 collisions reached
- LTX_MULT = 0x0008, // Last transmit frame was a multicast
- MULCOL = 0x0004, // Multiple collisions detected
- SNGLCOL = 0x0002, // Single collision detected
- TX_SUC = 0x0001 // Last transmit frame was successful
- };
-
- // CTR register bits
- enum ctr_mask : u16 {
- RCV_BAD = 0x4000, // Receive bad CRC packets
- PWRDN = 0x2000, // Power down ethernet
- WAKEUP_EN = 0x1000, // Enable magic packet wakeup
- AUTO_RELEASE = 0x0800, // Release transmit packets on good transmission
- LE_ENABLE = 0x0080, // Link Error enable
- CR_ENABLE = 0x0040, // Counter Roll over enable
- TE_ENABLE = 0x0020, // Transmit Error enable
- EEPROM_SEL = 0x0004, // EEPROM address
- RELOAD = 0x0002, // Reload config from EEPROM
- STORE = 0x0001 // Store config to EEPROM
- };
-
- // Transmit Control Register bits
- enum tcr_mask : u16 {
- FDSE = 0x8000,
- EPH_LOOP = 0x2000,
- STP_SQET = 0x1000,
- FDUPLX = 0x0800,
- MON_CSN = 0x0400,
- NOCRC = 0x0100,
- PAD_EN = 0x0080,
- FORCOL = 0x0004,
- LOOP = 0x0002,
- TXENA = 0x0001
- };
-
- // Receive Control Register bits
- enum rcr_mask : u16 {
- SOFT_RST = 0x8000,
- FILT_CAR = 0x4000,
- STRIP_CRC = 0x0200,
- RXEN = 0x0100,
- ALMUL = 0x0004,
- PRMS = 0x0002,
- RX_ABORT = 0x0001
- };
-
- // Pointer Register bits
- enum pointer_mask : u16 {
- RCV = 0x8000,
- AUTO_INCR = 0x4000,
- READ = 0x2000,
- PTR = 0x07ff
- };
-
- static constexpr unsigned ETHER_BUFFER_SIZE = 256 * 6;
- static const u8 ETH_BROADCAST[];
- static const u8 WMS_OUI[];
+ static constexpr unsigned ETHER_BUFFER_SIZE = 2048;
+ // TODO: 96 device is larger
+ static constexpr unsigned ETHER_BUFFERS = 16;
+ static constexpr unsigned ETHERNET_ADDR_SIZE = 6;
- // mmu
+ // external network is present
+ bool m_network_available;
+ // mmu
// The bits in these vectors indicate a packet has been allocated
u32 m_alloc_rx, m_alloc_tx;
-
+ std::vector<u32> m_comp_tx, m_comp_rx;
+ // Fifo for allocated (queued) transmit packets
+ std::vector<u32> m_trans_tx;
+ // Save vector data and sizes for proper save state restoration
+ u32 m_comp_tx_data[ETHER_BUFFERS], m_comp_rx_data[ETHER_BUFFERS], m_trans_tx_data[ETHER_BUFFERS];
+ u32 m_comp_tx_size, m_comp_rx_size, m_trans_tx_size;
// Requests a packet allocation and returns true
// and sets the packet number if successful
bool alloc_req(const int tx, int &packet_num);
@@ -246,56 +77,23 @@ private:
uint8_t m_irq_state;
// Main memory
- std::unique_ptr<u8[]> m_buffer;
+ uint8_t m_buffer[ETHER_BUFFER_SIZE * ETHER_BUFFERS];
/* counters */
uint32_t m_sent;
uint32_t m_recd;
- emu_timer* m_tx_poll;
+ emu_timer* m_tx_timer;
- int m_tx_active;
- int m_rx_active;
- int m_tx_retry_count;
- u8 m_rx_hash;
- u8 m_loopback_result;
+ int ethernet_packet_is_for_me(const uint8_t *mac_address);
+ int is_broadcast(const uint8_t *mac_address);
void update_ethernet_irq();
void update_stats();
void process_command(uint16_t data);
- void reset_tx_fifos();
-
- // TODO: Make circular fifo a separate device
- // Simple circular FIFO, power of 2 size, no over/under run checking
- static constexpr unsigned FIFO_SIZE = 1 << 5;
-
- // FIFO for allocated (queued) transmit packets
- u8 m_queued_tx[FIFO_SIZE];
- int m_queued_tx_h, m_queued_tx_t;
- void reset_queued_tx() { m_queued_tx_t = m_queued_tx_h = 0; };
- void push_queued_tx(const u8 &data) { m_queued_tx[m_queued_tx_h++] = data; m_queued_tx_h &= FIFO_SIZE - 1; };
- u8 pop_queued_tx() { u8 val = m_queued_tx[m_queued_tx_t++]; m_queued_tx_t &= FIFO_SIZE - 1; return val; };
- bool empty_queued_tx() const { return m_queued_tx_h == m_queued_tx_t; };
- u8 curr_queued_tx() const { return m_queued_tx[m_queued_tx_t]; };
-
- // FIFO for completed transmit packets
- u8 m_completed_tx[FIFO_SIZE];
- int m_completed_tx_h, m_completed_tx_t;
- void reset_completed_tx() { m_completed_tx_t = m_completed_tx_h = 0; };
- void push_completed_tx(const u8 &data) { m_completed_tx[m_completed_tx_h++] = data; m_completed_tx_h &= FIFO_SIZE - 1; };
- u8 pop_completed_tx() { u8 val = m_completed_tx[m_completed_tx_t++]; m_completed_tx_t &= FIFO_SIZE - 1; return val; };
- bool empty_completed_tx() const { return m_completed_tx_h == m_completed_tx_t; };
- u8 curr_completed_tx() const { return m_completed_tx[m_completed_tx_t]; };
-
- // FIFO for completed receive packets
- u8 m_completed_rx[FIFO_SIZE];
- int m_completed_rx_h, m_completed_rx_t;
- void reset_completed_rx() { m_completed_rx_t = m_completed_rx_h = 0; };
- void push_completed_rx(const u8 &data) { m_completed_rx[m_completed_rx_h++] = data; m_completed_rx_h &= FIFO_SIZE - 1; };
- u8 pop_completed_rx() { u8 val = m_completed_rx[m_completed_rx_t++]; m_completed_rx_t &= FIFO_SIZE - 1; return val; };
- bool empty_completed_rx() const { return m_completed_rx_h == m_completed_rx_t; };
- u8 curr_completed_rx() const { return m_completed_rx[m_completed_rx_t]; };
+ void clear_tx_fifo();
+ void clear_rx_fifo();
};
diff --git a/src/devices/machine/smpc.cpp b/src/devices/machine/smpc.cpp
index c62e65e1703..042fc06d590 100644
--- a/src/devices/machine/smpc.cpp
+++ b/src/devices/machine/smpc.cpp
@@ -205,7 +205,7 @@ void smpc_hle_device::smpc_regs(address_map &map)
smpc_hle_device::smpc_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SMPC_HLE, tag, owner, clock),
device_memory_interface(mconfig, *this),
- m_space_config("regs", ENDIANNESS_LITTLE, 8, 7, 0, address_map_constructor(FUNC(smpc_hle_device::smpc_regs), this)),
+ m_space_config("regs", ENDIANNESS_LITTLE, 8, 7, 0, address_map_constructor(), address_map_constructor(FUNC(smpc_hle_device::smpc_regs), this)),
m_mini_nvram(*this, "smem"),
m_mshres(*this),
m_mshnmi(*this),
diff --git a/src/devices/machine/sonydriv.h b/src/devices/machine/sonydriv.h
index 322db3f3342..b6e4358eadb 100644
--- a/src/devices/machine/sonydriv.h
+++ b/src/devices/machine/sonydriv.h
@@ -58,4 +58,22 @@ protected:
// device type definition
DECLARE_DEVICE_TYPE(FLOPPY_SONY, sonydriv_floppy_image_device)
+#define MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_0, FLOPPY_SONY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_1, FLOPPY_SONY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config)
+
+#define MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADDITIONAL_ADD(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_2, FLOPPY_SONY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_DEVICE_ADD(FLOPPY_3, FLOPPY_SONY, 0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config)
+
+#define MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_MODIFY(_config) \
+ MCFG_DEVICE_MODIFY(FLOPPY_0) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config) \
+ MCFG_DEVICE_MODIFY(FLOPPY_1) \
+ MCFG_LEGACY_FLOPPY_CONFIG(_config)
+
#endif // MAME_MACHINE_SONYDRIV_H
diff --git a/src/devices/machine/spg110.cpp b/src/devices/machine/spg110.cpp
deleted file mode 100644
index 9f9256f4b27..00000000000
--- a/src/devices/machine/spg110.cpp
+++ /dev/null
@@ -1,669 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Haywood
-/*****************************************************************************
-
- SunPlus SPG110-series SoC peripheral emulation
-
- 0032xx looks like it could be the same as 003dxx on spg2xx
- but the video seems to have differences, and data
- is fetched from private buffers filled by DMA instead of
- main space? tile attributes different? palette format different
-
-**********************************************************************/
-
-#include "emu.h"
-#include "spg110.h"
-
-DEFINE_DEVICE_TYPE(SPG110, spg110_device, "spg110", "SPG110 System-on-a-Chip")
-
-spg110_device::spg110_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_memory_interface(mconfig, *this)
- , m_space_config("spg110", ENDIANNESS_BIG, 16, 32, 0, address_map_constructor(FUNC(spg110_device::map_video), this))
- , m_cpu(*this, finder_base::DUMMY_TAG)
- , m_screen(*this, finder_base::DUMMY_TAG)
- , m_palette(*this, "palette")
- , m_gfxdecode(*this, "gfxdecode")
- , m_palram(*this, "palram")
- , m_spg_io(*this, "spg_io")
- , m_porta_out(*this)
- , m_portb_out(*this)
- , m_portc_out(*this)
- , m_porta_in(*this)
- , m_portb_in(*this)
- , m_portc_in(*this)
- , m_adc_in{{*this}, {*this}}
- , m_chip_sel(*this)
-{
-}
-
-template<spg110_device::flipx_t FlipX>
-void spg110_device::blit(const rectangle &cliprect, uint32_t line, uint32_t xoff, uint32_t yoff, uint32_t attr, uint32_t ctrl, uint32_t bitmap_addr, uint16_t tile)
-{
- address_space &space = m_cpu->space(AS_PROGRAM);
-
- int32_t h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT);
- int32_t w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT);
-
- uint32_t yflipmask = attr & TILE_Y_FLIP ? h - 1 : 0;
-
- uint32_t nc = ((attr & 0x0003) + 1) << 1;
-
- uint32_t palette_offset = (attr & 0x0f00) >> 4;
-
- palette_offset >>= nc;
- palette_offset <<= nc;
-
- uint32_t bits_per_row = nc * w / 16;
- uint32_t words_per_tile = bits_per_row * h;
- uint32_t m = bitmap_addr + words_per_tile * tile + bits_per_row * (line ^ yflipmask);
- uint32_t bits = 0;
- uint32_t nbits = 0;
- uint32_t y = line;
-
- int yy = (yoff + y) & 0x1ff;
- if (yy >= 0x01c0)
- yy -= 0x0200;
-
- if (yy > 240 || yy < 0)
- return;
-
- int y_index = yy * 320;
-
- for (int32_t x = FlipX ? (w - 1) : 0; FlipX ? x >= 0 : x < w; FlipX ? x-- : x++)
- {
- int xx = xoff + x;
-
- bits <<= nc;
-
- if (nbits < nc)
- {
- uint16_t b = space.read_word(m++ & 0x3fffff);
- //b = (b << 8) | (b >> 8);
- bits |= b << (nc - nbits);
- nbits += 16;
- }
- nbits -= nc;
-
- uint32_t pal = palette_offset + (bits >> 16);
- bits &= 0xffff;
-
- xx &= 0x01ff;
- if (xx >= 0x01c0)
- xx -= 0x0200;
-
- if (xx >= 0 && xx < 320)
- {
- // TODO, this is completely wrong for this palette system
- int pix_index = xx + y_index;
- uint16_t rawpal = m_palram[pal];
- const pen_t *pens = m_palette->pens();
- uint32_t paldata = pens[pal];
-
- if (!(rawpal & 0x8000))
- {
- m_screenbuf[pix_index] = paldata;
- }
- }
- }
-}
-
-void spg110_device::blit_page(const rectangle &cliprect, uint32_t scanline, int depth, uint32_t bitmap_addr, uint16_t *regs)
-{
- uint32_t xscroll = regs[0];
- uint32_t yscroll = regs[1];
- uint32_t attr = regs[2];
- uint32_t ctrl = regs[3];
- uint32_t tilemap = regs[4];
- uint32_t palette_map = regs[5];
- address_space &space2 = this->space(0);
-
- if (!(ctrl & PAGE_ENABLE_MASK))
- {
- return;
- }
-
- if (((attr & PAGE_DEPTH_FLAG_MASK) >> PAGE_DEPTH_FLAG_SHIFT) != depth)
- {
- return;
- }
-
- uint32_t tile_h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT);
- uint32_t tile_w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT);
-
- uint32_t tile_count_x = 512 / tile_w;
-
- uint32_t bitmap_y = (scanline + yscroll) & 0xff;
- uint32_t y0 = bitmap_y / tile_h;
- uint32_t tile_scanline = bitmap_y % tile_h;
- uint32_t tile_address = tile_count_x * y0;
-
- for (uint32_t x0 = 0; x0 < tile_count_x; x0++, tile_address++)
- {
- uint32_t yy = ((tile_h * y0 - yscroll + 0x10) & 0xff) - 0x10;
- uint32_t xx = (tile_w * x0 - xscroll) & 0x1ff;
- uint16_t tile = (ctrl & PAGE_WALLPAPER_MASK) ? space2.read_word(tilemap*2) : space2.read_word((tilemap + tile_address)*2);
- uint16_t palette = 0;
-
- if (!tile)
- continue;
-
- palette = space2.read_word(palette_map + tile_address / 2);
- if (x0 & 1)
- palette = (palette & 0xff00) >> 8;
- else
- palette = (palette & 0x00ff);
-
-
- bool flip_x = 0;//(tileattr & TILE_X_FLIP);
-
- if (flip_x)
- blit<FlipXOn>(cliprect, tile_scanline, xx, yy, attr, ctrl, bitmap_addr, tile);
- else
- blit<FlipXOff>(cliprect, tile_scanline, xx, yy, attr, ctrl, bitmap_addr, tile);
-
- }
-}
-
-
-/* correct, 4bpp gfxs */
-static const gfx_layout charlayout =
-{
- 8,8,
- RGN_FRAC(1,1),
- 4,
- { STEP4(0,1) },
- { 0*4,1*4,2*4,3*4,4*4,5*4,6*4,7*4 },
- { STEP8(0,4*8) },
- 8*8*4
-};
-
-static const gfx_layout charlayout6 =
-{
- 8,8,
- RGN_FRAC(1,1),
- 6,
- { 0,1,2,3,4,5 },
- { STEP8(0,6) },
- { STEP8(0,6*8) },
- 8*8*6
-};
-
-static const gfx_layout char16layout =
-{
- 16,16,
- RGN_FRAC(1,1),
- 4,
- { STEP4(0,1) },
- { 0*4,1*4,2*4,3*4,4*4,5*4,6*4,7*4, 8*4,9*4,10*4,11*4,12*4,13*4,14*4,15*4 },
- { STEP16(0,4*16) },
- 16*16*4
-};
-
-static const gfx_layout char32layout =
-{
- 32,32,
- RGN_FRAC(1,1),
- 4,
- { STEP4(0,1) },
- { STEP32(0,4) },
- { STEP32(0,4*32) },
- 32*32*4
-};
-
-
-
-static GFXDECODE_START( gfx )
- GFXDECODE_ENTRY( ":maincpu", 0, charlayout, 0, 16 )
- GFXDECODE_ENTRY( ":maincpu", 0, char16layout, 0, 16 )
- GFXDECODE_ENTRY( ":maincpu", 0, char32layout, 0, 16 )
- GFXDECODE_ENTRY( ":maincpu", 0, charlayout6, 0, 16 ) // correct for lots of the tiles inc. startup text
-GFXDECODE_END
-
-void spg110_device::configure_spg_io(spg2xx_io_device* io)
-{
- io->porta_in().set(FUNC(spg110_device::porta_r));
- io->portb_in().set(FUNC(spg110_device::portb_r));
- io->portc_in().set(FUNC(spg110_device::portc_r));
- io->porta_out().set(FUNC(spg110_device::porta_w));
- io->portb_out().set(FUNC(spg110_device::portb_w));
- io->portc_out().set(FUNC(spg110_device::portc_w));
- io->adc_in<0>().set(FUNC(spg110_device::adc_r<0>));
- io->adc_in<1>().set(FUNC(spg110_device::adc_r<1>));
- io->chip_select().set(FUNC(spg110_device::cs_w));
-// io->pal_read_callback().set(FUNC(spg110_device::get_pal_r));
-// io->write_timer_irq_callback().set(FUNC(spg110_device::timerirq_w));
-// io->write_uart_adc_irq_callback().set(FUNC(spg110_device::uartirq_w));
-// io->write_external_irq_callback().set(FUNC(spg110_device::extirq_w));
-// io->write_ffrq_tmr1_irq_callback().set(FUNC(spg110_device::ffreq1_w));
-// io->write_ffrq_tmr2_irq_callback().set(FUNC(spg110_device::ffreq2_w));
-}
-
-void spg110_device::device_add_mconfig(machine_config &config)
-{
-// PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x100);
-// PALETTE(config, m_palette).set_format(palette_device::RGB_565, 0x100);
-// PALETTE(config, m_palette).set_format(palette_device::IRGB_4444, 0x100);
-// PALETTE(config, m_palette).set_format(palette_device::RGBI_4444, 0x100);
-// PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x100);
- PALETTE(config, m_palette, palette_device::BLACK, 256);
-
- GFXDECODE(config, m_gfxdecode, m_palette, gfx);
-
- SPG24X_IO(config, m_spg_io, DERIVED_CLOCK(1, 1), m_cpu, m_screen);
- configure_spg_io(m_spg_io);
-
-}
-
-
-device_memory_interface::space_config_vector spg110_device::memory_space_config() const
-{
- return space_config_vector {
- std::make_pair(0, &m_space_config)
- };
-}
-
-spg110_device::spg110_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : spg110_device(mconfig, SPG110, tag, owner, clock)
-{
-}
-
-// irq source or similar?
-READ16_MEMBER(spg110_device::spg110_2063_r)
-{
- // checks for bits 0x20 and 0x08 in the IRQ function (all IRQs point to the same place)
- return 0x0008;
-}
-
-WRITE16_MEMBER(spg110_device::spg110_2063_w)
-{
- // writes 0x28, probably clears the IRQ / IRQ sources? 0x63 is the same offset for this in spg2xx but bits used seem to be different
- m_cpu->set_state_unsynced(UNSP_IRQ0_LINE, CLEAR_LINE);
-}
-
-
-WRITE16_MEMBER(spg110_device::spg110_201c_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2020_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2042_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2031_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2032_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2033_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2034_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2035_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2036_w) { COMBINE_DATA(&m_2036_scroll); }
-WRITE16_MEMBER(spg110_device::spg110_2039_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2037_w) { }
-WRITE16_MEMBER(spg110_device::spg110_203c_w) { }
-WRITE16_MEMBER(spg110_device::spg110_203d_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2045_w) { }
-
-
-WRITE16_MEMBER(spg110_device::spg110_2028_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2029_w) { }
-
-READ16_MEMBER(spg110_device::spg110_2028_r) { return 0x0000; }
-READ16_MEMBER(spg110_device::spg110_2029_r) { return 0x0000; }
-
-
-WRITE16_MEMBER(spg110_device::spg110_2050_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2051_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2052_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2053_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2054_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2055_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2056_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2057_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2058_w) { }
-WRITE16_MEMBER(spg110_device::spg110_2059_w) { }
-WRITE16_MEMBER(spg110_device::spg110_205a_w) { }
-WRITE16_MEMBER(spg110_device::spg110_205b_w) { }
-WRITE16_MEMBER(spg110_device::spg110_205c_w) { }
-WRITE16_MEMBER(spg110_device::spg110_205d_w) { }
-WRITE16_MEMBER(spg110_device::spg110_205e_w) { }
-WRITE16_MEMBER(spg110_device::spg110_205f_w) { }
-
-WRITE16_MEMBER(spg110_device::dma_unk_2061_w) { COMBINE_DATA(&m_dma_unk_2061); }
-WRITE16_MEMBER(spg110_device::dma_dst_step_w) { COMBINE_DATA(&m_dma_dst_step); }
-WRITE16_MEMBER(spg110_device::dma_unk_2067_w) { COMBINE_DATA(&m_dma_unk_2067); }
-WRITE16_MEMBER(spg110_device::dma_src_step_w) { COMBINE_DATA(&m_dma_src_step); }
-
-WRITE16_MEMBER(spg110_device::dma_dst_w) { COMBINE_DATA(&m_dma_dst); }
-WRITE16_MEMBER(spg110_device::dma_src_w) { COMBINE_DATA(&m_dma_src); }
-
-WRITE16_MEMBER(spg110_device::dma_len_trigger_w)
-{
- int length = data & 0x1fff;
-
- // this is presumably a counter that underflows to 0x1fff, because that's what the wait loop waits for?
- logerror("%s: (trigger len) %04x with values (unk) %04x (dststep) %04x (unk) %04x (src step) %04x | (dst) %04x (src) %04x\n", machine().describe_context(), data, m_dma_unk_2061, m_dma_dst_step, m_dma_unk_2067, m_dma_src_step, m_dma_dst, m_dma_src);
-
- if ((m_dma_unk_2061!=0x0000) || (m_dma_unk_2067 != 0x0000))
- fatalerror("unknown DMA params are not zero!\n");
-
- int source = m_dma_src;
- int dest = m_dma_dst;
-
- for (int i = 0; i < length; i++)
- {
- address_space &mem = m_cpu->space(AS_PROGRAM);
- uint16_t val = mem.read_word(source);
-
- this->space(0).write_word(dest * 2, val, 0xffff);
-
- source+=m_dma_src_step;
- dest+=m_dma_dst_step;
- }
-}
-
-READ16_MEMBER(spg110_device::dma_len_status_r)
-{
- return 0x1fff; // DMA related?
-}
-
-READ16_MEMBER(spg110_device::spg110_2037_r) { return 0x0000; }
-READ16_MEMBER(spg110_device::spg110_2042_r) { return 0x0000; }
-
-
-WRITE16_MEMBER(spg110_device::spg110_3100_w) { }
-WRITE16_MEMBER(spg110_device::spg110_3101_w) { }
-WRITE16_MEMBER(spg110_device::spg110_3102_w) { }
-WRITE16_MEMBER(spg110_device::spg110_3104_w) { }
-WRITE16_MEMBER(spg110_device::spg110_3105_w) { }
-WRITE16_MEMBER(spg110_device::spg110_3106_w) { }
-WRITE16_MEMBER(spg110_device::spg110_3107_w) { }
-WRITE16_MEMBER(spg110_device::spg110_3108_w) { }
-WRITE16_MEMBER(spg110_device::spg110_3109_w) { }
-WRITE16_MEMBER(spg110_device::spg110_310b_w) { }
-WRITE16_MEMBER(spg110_device::spg110_310c_w) { }
-WRITE16_MEMBER(spg110_device::spg110_310d_w) { }
-
-READ16_MEMBER(spg110_device::spg110_310f_r) { return 0x0000; }
-
-READ16_MEMBER(spg110_device::tmap0_regs_r) { return tmap0_regs[offset]; }
-READ16_MEMBER(spg110_device::tmap1_regs_r) { return tmap1_regs[offset]; }
-
-void spg110_device::tilemap_write_regs(int which, uint16_t* regs, int regno, uint16_t data)
-{
- switch (regno)
- {
- case 0x0: // Page X scroll
- logerror("video_w: Page %d X Scroll = %04x\n", which, data & 0x01ff);
- regs[regno] = data & 0x01ff;
- break;
-
- case 0x1: // Page Y scroll
- logerror("video_w: Page %d Y Scroll = %04x\n", which, data & 0x00ff);
- regs[regno] = data & 0x00ff;
- break;
-
- case 0x2: // Page Attributes
- // 'depth' (aka z value) can't be depth here as it is on spg2xx, or the scores in attract will be behind the table, it really seems to be per attribute bit instead
-
- logerror("video_w: Page %d Attributes = %04x (Depth:%d, Palette:%d, VSize:%d, HSize:%d, FlipY:%d, FlipX:%d, BPP:%d)\n", which, data
- , (data >> 12) & 3, (data >> 8) & 15, 8 << ((data >> 6) & 3), 8 << ((data >> 4) & 3), BIT(data, 3), BIT(data, 2), 2 * ((data & 3) + 1));
- regs[regno] = data;
- break;
-
- case 0x3: // Page Control
- logerror("video_w: Page %d Control = %04x (Blend:%d, HiColor:%d, RowScroll:%d, Enable:%d, Wallpaper:%d, RegSet:%d, Bitmap:%d)\n", which, data
- , BIT(data, 8), BIT(data, 7), BIT(data, 4), BIT(data, 3), BIT(data, 2), BIT(data, 1), BIT(data, 0));
- regs[regno] = data;
- break;
-
- case 0x4: // Page Tile Address
- logerror("video_w: Page %d Tile Address = %04x\n", which, data);
- regs[regno] = data;
- break;
-
- case 0x5: // Page Attribute Address
- logerror("video_w: Page %d Attribute Address = %04x\n", which, data);
- regs[regno] = data;
- break;
- }
-}
-
-
-WRITE16_MEMBER(spg110_device::tmap0_regs_w)
-{
- tilemap_write_regs(0, tmap0_regs,offset,data);
-}
-
-
-WRITE16_MEMBER(spg110_device::tmap1_regs_w)
-{
- tilemap_write_regs(1, tmap1_regs,offset,data);
-}
-
-void spg110_device::map(address_map &map)
-{
- map(0x000000, 0x000fff).ram();
-
-
- // vregs are at 2000?
- map(0x002010, 0x002015).rw(FUNC(spg110_device::tmap0_regs_r), FUNC(spg110_device::tmap0_regs_w));
- map(0x002016, 0x00201b).rw(FUNC(spg110_device::tmap1_regs_r), FUNC(spg110_device::tmap1_regs_w));
-
- map(0x00201c, 0x00201c).w(FUNC(spg110_device::spg110_201c_w));
-
- map(0x002020, 0x002020).w(FUNC(spg110_device::spg110_2020_w));
-
- map(0x002028, 0x002028).rw(FUNC(spg110_device::spg110_2028_r), FUNC(spg110_device::spg110_2028_w));
- map(0x002029, 0x002029).rw(FUNC(spg110_device::spg110_2029_r), FUNC(spg110_device::spg110_2029_w));
-
- map(0x002031, 0x002031).w(FUNC(spg110_device::spg110_2031_w)); // sometimes 14a?
- map(0x002032, 0x002032).w(FUNC(spg110_device::spg110_2032_w)); // always 14a?
- map(0x002033, 0x002033).w(FUNC(spg110_device::spg110_2033_w));
- map(0x002034, 0x002034).w(FUNC(spg110_device::spg110_2034_w));
- map(0x002035, 0x002035).w(FUNC(spg110_device::spg110_2035_w));
- map(0x002036, 0x002036).w(FUNC(spg110_device::spg110_2036_w)); // possible scroll register?
- map(0x002037, 0x002037).rw(FUNC(spg110_device::spg110_2037_r), FUNC(spg110_device::spg110_2037_w));
-
- map(0x002039, 0x002039).w(FUNC(spg110_device::spg110_2039_w));
-
- map(0x00203c, 0x00203c).w(FUNC(spg110_device::spg110_203c_w));
-
- map(0x00203d, 0x00203d).w(FUNC(spg110_device::spg110_203d_w)); // possible scroll register?
-
- map(0x002042, 0x002042).rw(FUNC(spg110_device::spg110_2042_r),FUNC(spg110_device::spg110_2042_w));
-
- map(0x002045, 0x002045).w(FUNC(spg110_device::spg110_2045_w));
-
- // seems to be 16 entries for.. something?
- map(0x002050, 0x002050).w(FUNC(spg110_device::spg110_2050_w));
- map(0x002051, 0x002051).w(FUNC(spg110_device::spg110_2051_w));
- map(0x002052, 0x002052).w(FUNC(spg110_device::spg110_2052_w));
- map(0x002053, 0x002053).w(FUNC(spg110_device::spg110_2053_w));
- map(0x002054, 0x002054).w(FUNC(spg110_device::spg110_2054_w));
- map(0x002055, 0x002055).w(FUNC(spg110_device::spg110_2055_w));
- map(0x002056, 0x002056).w(FUNC(spg110_device::spg110_2056_w));
- map(0x002057, 0x002057).w(FUNC(spg110_device::spg110_2057_w));
- map(0x002058, 0x002058).w(FUNC(spg110_device::spg110_2058_w));
- map(0x002059, 0x002059).w(FUNC(spg110_device::spg110_2059_w));
- map(0x00205a, 0x00205a).w(FUNC(spg110_device::spg110_205a_w));
- map(0x00205b, 0x00205b).w(FUNC(spg110_device::spg110_205b_w));
- map(0x00205c, 0x00205c).w(FUNC(spg110_device::spg110_205c_w));
- map(0x00205d, 0x00205d).w(FUNC(spg110_device::spg110_205d_w));
- map(0x00205e, 0x00205e).w(FUNC(spg110_device::spg110_205e_w));
- map(0x00205f, 0x00205f).w(FUNC(spg110_device::spg110_205f_w));
-
- //map(0x002010, 0x00205f).ram();
-
- // everything (dma? and interrupt flag?!)
- map(0x002060, 0x002060).w(FUNC(spg110_device::dma_dst_w));
- map(0x002061, 0x002061).w(FUNC(spg110_device::dma_unk_2061_w));
- map(0x002062, 0x002062).rw(FUNC(spg110_device::dma_len_status_r),FUNC(spg110_device::dma_len_trigger_w));
- map(0x002063, 0x002063).rw(FUNC(spg110_device::spg110_2063_r),FUNC(spg110_device::spg110_2063_w)); // this looks like interrupt stuff and is checked in the irq like an irq source, but why in the middle of what otherwise look like some kind of DMA?
- map(0x002064, 0x002064).w(FUNC(spg110_device::dma_dst_step_w));
- map(0x002066, 0x002066).w(FUNC(spg110_device::dma_src_w));
- map(0x002067, 0x002067).w(FUNC(spg110_device::dma_unk_2067_w));
- map(0x002068, 0x002068).w(FUNC(spg110_device::dma_src_step_w));
-
- map(0x002200, 0x0022ff).ram(); // looks like per-pen brightness or similar? strange because palette isn't memory mapped here
-
- map(0x003000, 0x00307f).ram(); // sound registers? seems to be 8 long entries, only uses up to 0x7f?
- map(0x003080, 0x0030ff).ram();
-
- map(0x003100, 0x003100).w(FUNC(spg110_device::spg110_3100_w));
- map(0x003101, 0x003101).w(FUNC(spg110_device::spg110_3101_w));
- map(0x003102, 0x003102).w(FUNC(spg110_device::spg110_3102_w));
-
- map(0x003104, 0x003104).w(FUNC(spg110_device::spg110_3104_w));
- map(0x003105, 0x003105).w(FUNC(spg110_device::spg110_3105_w));
- map(0x003106, 0x003106).w(FUNC(spg110_device::spg110_3106_w));
- map(0x003107, 0x003107).w(FUNC(spg110_device::spg110_3107_w));
- map(0x003108, 0x003108).w(FUNC(spg110_device::spg110_3108_w));
- map(0x003109, 0x003109).w(FUNC(spg110_device::spg110_3109_w));
-
- map(0x00310b, 0x00310b).w(FUNC(spg110_device::spg110_310b_w));
- map(0x00310c, 0x00310c).w(FUNC(spg110_device::spg110_310c_w));
- map(0x00310d, 0x00310d).w(FUNC(spg110_device::spg110_310d_w));
-
- map(0x00310f, 0x00310f).r(FUNC(spg110_device::spg110_310f_r));
-
- // 0032xx looks like it could be the same as 003d00 on spg2xx
- map(0x003200, 0x00322f).rw(m_spg_io, FUNC(spg2xx_io_device::io_r), FUNC(spg2xx_io_device::io_w));
-}
-
-// this seems to be a different, non-cpu mapped space only accessible via the DMA?
-void spg110_device::map_video(address_map &map)
-{
- // are these addresses hardcoded, or can they move (in which case tilemap system isn't really suitable)
- map(0x00000, 0x03fff).ram(); // 2fff?
-
- map(0x04000, 0x04fff).ram(); // seems to be 3 blocks, almost certainly spritelist
-
-// map(0x08000, 0x081ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // probably? format unknown tho
- map(0x08000, 0x081ff).ram().share("palram");
-}
-
-
-/*
-TIMER_CALLBACK_MEMBER(spg110_device::test_timer)
-{
- //
-}
-*/
-
-
-
-void spg110_device::device_start()
-{
-// m_test_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg110_device::test_timer), this));
- save_item(NAME(m_dma_src_step));
- save_item(NAME(m_dma_dst_step));
- save_item(NAME(m_dma_unk_2061));
- save_item(NAME(m_dma_unk_2067));
- save_item(NAME(m_dma_dst));
- save_item(NAME(m_dma_src));
- save_item(NAME(m_bg_scrollx));
- save_item(NAME(m_bg_scrolly));
- save_item(NAME(m_2036_scroll));
-
- m_porta_out.resolve_safe();
- m_portb_out.resolve_safe();
- m_portc_out.resolve_safe();
- m_porta_in.resolve_safe(0);
- m_portb_in.resolve_safe(0);
- m_portc_in.resolve_safe(0);
- m_adc_in[0].resolve_safe(0x0fff);
- m_adc_in[1].resolve_safe(0x0fff);
- m_chip_sel.resolve_safe();
-
-}
-
-void spg110_device::device_reset()
-{
- m_dma_src_step = 0;
- m_dma_dst_step = 0;
- m_dma_unk_2061 = 0;
- m_dma_unk_2067 = 0;
- m_dma_dst = 0;
- m_dma_src = 0;
- m_bg_scrollx = 0;
- m_bg_scrolly = 0;
- m_2036_scroll = 0;
-}
-
-double spg110_device::hue2rgb(double p, double q, double t)
-{
- if (t < 0) t += 1;
- if (t > 1) t -= 1;
- if (t < 1 / 6.0f) return p + (q - p) * 6 * t;
- if (t < 1 / 2.0f) return q;
- if (t < 2 / 3.0f) return p + (q - p) * (2 / 3.0f - t) * 6;
- return p;
-}
-
-uint32_t spg110_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
-{
- // Palette, this is still wrong!
- int offs = 0;
- for (int index = 0;index < 256; index++)
- {
- uint16_t dat = m_palram[offs++];
-
- // llll lsss sshh hhhh
- int l_raw = (dat & 0xf800) >> 11;
- int sl_raw = (dat & 0x07c0) >> 6;
- int h_raw = (dat & 0x003f) >> 0;
-
- double l = (double)l_raw / 31.0f;
- double s = (double)sl_raw / 31.0f;
- double h = (double)h_raw / 47.0f;
-
- double r, g, b;
-
- if (s == 0) {
- r = g = b = l; // greyscale
- } else {
- double q = l < 0.5f ? l * (1 + s) : l + s - l * s;
- double p = 2 * l - q;
- r = hue2rgb(p, q, h + 1/3.0f);
- g = hue2rgb(p, q, h);
- b = hue2rgb(p, q, h - 1/3.0f);
- }
-
- int r_real = r * 255.0f;
- int g_real = g * 255.0f;
- int b_real = b * 255.0f;
-
- m_palette->set_pen_color(index, r_real, g_real, b_real);
- }
-
- memset(&m_screenbuf[320 * cliprect.min_y], 0, 4 * 320 * ((cliprect.max_y - cliprect.min_y) + 1));
-
- const uint32_t page1_addr = 0;//0x40 * m_video_regs[0x20];
- const uint32_t page2_addr = 0;//0x40 * m_video_regs[0x21];
- uint16_t *page1_regs = tmap0_regs;
- uint16_t *page2_regs = tmap1_regs;
-
- for (uint32_t scanline = (uint32_t)cliprect.min_y; scanline <= (uint32_t)cliprect.max_y; scanline++)
- {
- for (int i = 0; i < 4; i++)
- {
- blit_page(cliprect, scanline, i, page2_addr, page2_regs);
- blit_page(cliprect, scanline, i, page1_addr, page1_regs);
- //blit_sprites(cliprect, scanline, i);
- }
- }
-
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
- {
- uint32_t *dest = &bitmap.pix32(y, cliprect.min_x);
- uint32_t *src = &m_screenbuf[cliprect.min_x + 320 * y];
- memcpy(dest, src, sizeof(uint32_t) * ((cliprect.max_x - cliprect.min_x) + 1));
- }
-
- return 0;
-}
-
-WRITE_LINE_MEMBER(spg110_device::vblank)
-{
- if (!state)
- {
- m_cpu->set_state_unsynced(UNSP_IRQ0_LINE, ASSERT_LINE);
- // m_test_timer->adjust(attotime::from_usec(100), 0);
- }
-
- return;
-}
diff --git a/src/devices/machine/spg110.h b/src/devices/machine/spg110.h
deleted file mode 100644
index 64464e1ba9d..00000000000
--- a/src/devices/machine/spg110.h
+++ /dev/null
@@ -1,220 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Haywood
-
-#ifndef MAME_MACHINE_SPG110_H
-#define MAME_MACHINE_SPG110_H
-
-#pragma once
-
-//#include "spg2xx.h"
-#include "cpu/unsp/unsp.h"
-#include "emupal.h"
-#include "spg2xx_io.h"
-
-
-class spg110_device : public device_t, public device_memory_interface
-
-{
-public:
- spg110_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
- spg110_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- template <typename T, typename U>
- spg110_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag, U &&screen_tag)
- : spg110_device(mconfig, tag, owner, clock)
- {
- m_cpu.set_tag(std::forward<T>(cpu_tag));
- m_screen.set_tag(std::forward<U>(screen_tag));
- }
-
- void map(address_map &map);
- void map_video(address_map &map);
-
- double hue2rgb(double p, double q, double t);
- uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- DECLARE_WRITE_LINE_MEMBER(vblank);
-
- auto porta_out() { return m_porta_out.bind(); }
- auto portb_out() { return m_portb_out.bind(); }
- auto portc_out() { return m_portc_out.bind(); }
- auto porta_in() { return m_porta_in.bind(); }
- auto portb_in() { return m_portb_in.bind(); }
- auto portc_in() { return m_portc_in.bind(); }
-
- template <size_t Line> auto adc_in() { return m_adc_in[Line].bind(); }
-
- auto chip_select() { return m_chip_sel.bind(); }
-
-protected:
- virtual void device_start() override;
- virtual void device_reset() override;
-
- virtual void device_add_mconfig(machine_config &config) override;
-
- virtual space_config_vector memory_space_config() const override;
-
- address_space_config m_space_config;
-
-private:
- enum
- {
- PAGE_ENABLE_MASK = 0x0008,
- PAGE_WALLPAPER_MASK = 0x0004,
-
- PAGE_DEPTH_FLAG_MASK = 0x3000,
- PAGE_DEPTH_FLAG_SHIFT = 12,
- PAGE_TILE_HEIGHT_MASK = 0x00c0,
- PAGE_TILE_HEIGHT_SHIFT = 6,
- PAGE_TILE_WIDTH_MASK = 0x0030,
- PAGE_TILE_WIDTH_SHIFT = 4,
-
- TILE_X_FLIP = 0x0004,
- TILE_Y_FLIP = 0x0008
- };
-
- enum flipx_t : bool
- {
- FlipXOff = false,
- FlipXOn = true
- };
-
- required_device<unsp_device> m_cpu;
- required_device<screen_device> m_screen;
- required_device<palette_device> m_palette;
- required_device<gfxdecode_device> m_gfxdecode;
- required_shared_ptr<uint16_t> m_palram;
- required_device<spg2xx_io_device> m_spg_io;
-
- //TIMER_CALLBACK_MEMBER(test_timer);
- //emu_timer *m_test_timer;
-
-
- DECLARE_WRITE16_MEMBER(spg110_201c_w);
- DECLARE_WRITE16_MEMBER(spg110_2020_w);
-
- DECLARE_WRITE16_MEMBER(spg110_2028_w);
- DECLARE_WRITE16_MEMBER(spg110_2029_w);
-
- DECLARE_READ16_MEMBER(spg110_2028_r);
- DECLARE_READ16_MEMBER(spg110_2029_r);
-
- DECLARE_WRITE16_MEMBER(spg110_2031_w);
- DECLARE_WRITE16_MEMBER(spg110_2032_w);
- DECLARE_WRITE16_MEMBER(spg110_2033_w);
- DECLARE_WRITE16_MEMBER(spg110_2034_w);
- DECLARE_WRITE16_MEMBER(spg110_2035_w);
- DECLARE_WRITE16_MEMBER(spg110_2036_w);
- DECLARE_WRITE16_MEMBER(spg110_2037_w);
- DECLARE_WRITE16_MEMBER(spg110_2039_w);
-
- DECLARE_WRITE16_MEMBER(spg110_203c_w);
- DECLARE_WRITE16_MEMBER(spg110_203d_w);
-
- DECLARE_WRITE16_MEMBER(spg110_2042_w);
-
- DECLARE_WRITE16_MEMBER(spg110_2045_w);
-
- DECLARE_WRITE16_MEMBER(spg110_2050_w);
- DECLARE_WRITE16_MEMBER(spg110_2051_w);
- DECLARE_WRITE16_MEMBER(spg110_2052_w);
- DECLARE_WRITE16_MEMBER(spg110_2053_w);
- DECLARE_WRITE16_MEMBER(spg110_2054_w);
- DECLARE_WRITE16_MEMBER(spg110_2055_w);
- DECLARE_WRITE16_MEMBER(spg110_2056_w);
- DECLARE_WRITE16_MEMBER(spg110_2057_w);
- DECLARE_WRITE16_MEMBER(spg110_2058_w);
- DECLARE_WRITE16_MEMBER(spg110_2059_w);
- DECLARE_WRITE16_MEMBER(spg110_205a_w);
- DECLARE_WRITE16_MEMBER(spg110_205b_w);
- DECLARE_WRITE16_MEMBER(spg110_205c_w);
- DECLARE_WRITE16_MEMBER(spg110_205d_w);
- DECLARE_WRITE16_MEMBER(spg110_205e_w);
- DECLARE_WRITE16_MEMBER(spg110_205f_w);
-
-
- DECLARE_READ16_MEMBER(spg110_2037_r);
- DECLARE_READ16_MEMBER(spg110_2042_r);
-
- DECLARE_WRITE16_MEMBER(dma_dst_w);
- DECLARE_WRITE16_MEMBER(dma_unk_2061_w);
- DECLARE_WRITE16_MEMBER(dma_len_trigger_w);
- DECLARE_WRITE16_MEMBER(spg110_2063_w);
- DECLARE_WRITE16_MEMBER(dma_dst_step_w);
- DECLARE_WRITE16_MEMBER(dma_src_w);
- DECLARE_WRITE16_MEMBER(dma_unk_2067_w);
- DECLARE_WRITE16_MEMBER(dma_src_step_w);
-
- DECLARE_READ16_MEMBER(dma_len_status_r);
- DECLARE_READ16_MEMBER(spg110_2063_r);
-
- DECLARE_WRITE16_MEMBER(spg110_3100_w);
-
- DECLARE_WRITE16_MEMBER(spg110_3101_w);
- DECLARE_WRITE16_MEMBER(spg110_3102_w);
- DECLARE_WRITE16_MEMBER(spg110_3104_w);
- DECLARE_WRITE16_MEMBER(spg110_3105_w);
- DECLARE_WRITE16_MEMBER(spg110_3106_w);
- DECLARE_WRITE16_MEMBER(spg110_3107_w);
- DECLARE_WRITE16_MEMBER(spg110_3108_w);
- DECLARE_WRITE16_MEMBER(spg110_3109_w);
-
- DECLARE_WRITE16_MEMBER(spg110_310b_w);
- DECLARE_WRITE16_MEMBER(spg110_310c_w);
- DECLARE_WRITE16_MEMBER(spg110_310d_w);
-
- DECLARE_READ16_MEMBER(spg110_310f_r);
-
- DECLARE_READ16_MEMBER(tmap0_regs_r);
- DECLARE_READ16_MEMBER(tmap1_regs_r);
- DECLARE_WRITE16_MEMBER(tmap0_regs_w);
- DECLARE_WRITE16_MEMBER(tmap1_regs_w);
-
- uint16_t tmap0_regs[0x6];
- uint16_t tmap1_regs[0x6];
-
- uint16_t m_dma_src_step;
- uint16_t m_dma_dst_step;
- uint16_t m_dma_unk_2061;
- uint16_t m_dma_unk_2067;
-
- uint16_t m_dma_dst;
- uint16_t m_dma_src;
-
- uint16_t m_bg_scrollx;
- uint16_t m_bg_scrolly;
- uint16_t m_2036_scroll;
-
- void tilemap_write_regs(int which, uint16_t* regs, int regno, uint16_t data);
-
- template<flipx_t FlipX>
- void blit(const rectangle &cliprect, uint32_t line, uint32_t xoff, uint32_t yoff, uint32_t attr, uint32_t ctrl, uint32_t bitmap_addr, uint16_t tile);
- void blit_page(const rectangle &cliprect, uint32_t scanline, int depth, uint32_t bitmap_addr, uint16_t *regs);
- uint32_t m_screenbuf[320 * 240];
-
- devcb_write16 m_porta_out;
- devcb_write16 m_portb_out;
- devcb_write16 m_portc_out;
- devcb_read16 m_porta_in;
- devcb_read16 m_portb_in;
- devcb_read16 m_portc_in;
-
- devcb_read16 m_adc_in[2];
-
- devcb_write8 m_chip_sel;
-
- DECLARE_READ16_MEMBER(porta_r) { return m_porta_in(); };
- DECLARE_READ16_MEMBER(portb_r) { return m_portb_in(); };
- DECLARE_READ16_MEMBER(portc_r) { return m_portc_in(); };
- DECLARE_WRITE16_MEMBER(porta_w) { m_porta_out(offset, data, mem_mask); };
- DECLARE_WRITE16_MEMBER(portb_w) { m_portb_out(offset, data, mem_mask); };
- DECLARE_WRITE16_MEMBER(portc_w) { m_portc_out(offset, data, mem_mask); };
- template <size_t Line> DECLARE_READ16_MEMBER(adc_r) { return m_adc_in[Line](); };
- DECLARE_WRITE8_MEMBER(cs_w) { m_chip_sel(offset, data, mem_mask); };
- DECLARE_READ16_MEMBER(get_pal_r) { return 0; /*m_pal_flag;*/ };
- void configure_spg_io(spg2xx_io_device* io);
-
-};
-
-DECLARE_DEVICE_TYPE(SPG110, spg110_device)
-
-#endif // MAME_MACHINE_SPG110_H
diff --git a/src/devices/machine/spg2xx.cpp b/src/devices/machine/spg2xx.cpp
index 3a3a22abac3..a325346558d 100644
--- a/src/devices/machine/spg2xx.cpp
+++ b/src/devices/machine/spg2xx.cpp
@@ -17,38 +17,57 @@
DEFINE_DEVICE_TYPE(SPG24X, spg24x_device, "spg24x", "SPG240-series System-on-a-Chip")
DEFINE_DEVICE_TYPE(SPG28X, spg28x_device, "spg28x", "SPG280-series System-on-a-Chip")
+#define LOG_IO_READS (1U << 1)
+#define LOG_IO_WRITES (1U << 2)
#define LOG_UNKNOWN_IO (1U << 3)
#define LOG_IRQS (1U << 4)
#define LOG_VLINES (1U << 5)
+#define LOG_GPIO (1U << 6)
+#define LOG_UART (1U << 7)
+#define LOG_I2C (1U << 8)
#define LOG_DMA (1U << 9)
+#define LOG_SEGMENT (1U << 10)
+#define LOG_WATCHDOG (1U << 11)
+#define LOG_TIMERS (1U << 12)
+#define LOG_SPU_READS (1U << 13)
+#define LOG_SPU_WRITES (1U << 14)
+#define LOG_UNKNOWN_SPU (1U << 15)
+#define LOG_CHANNEL_READS (1U << 16)
+#define LOG_CHANNEL_WRITES (1U << 17)
+#define LOG_ENVELOPES (1U << 18)
+#define LOG_SAMPLES (1U << 19)
+#define LOG_RAMPDOWN (1U << 20)
+#define LOG_BEAT (1U << 21)
#define LOG_PPU_READS (1U << 22)
#define LOG_PPU_WRITES (1U << 23)
#define LOG_UNKNOWN_PPU (1U << 24)
-#define LOG_IO (LOG_IRQS | LOG_DMA | LOG_UNKNOWN_IO)
+#define LOG_IO (LOG_IO_READS | LOG_IO_WRITES | LOG_IRQS | LOG_GPIO | LOG_UART | LOG_I2C | LOG_DMA | LOG_TIMERS | LOG_UNKNOWN_IO)
+#define LOG_CHANNELS (LOG_CHANNEL_READS | LOG_CHANNEL_WRITES)
+#define LOG_SPU (LOG_SPU_READS | LOG_SPU_WRITES | LOG_UNKNOWN_SPU | LOG_CHANNEL_READS | LOG_CHANNEL_WRITES \
+ | LOG_ENVELOPES | LOG_SAMPLES | LOG_RAMPDOWN | LOG_BEAT)
#define LOG_PPU (LOG_PPU_READS | LOG_PPU_WRITES | LOG_UNKNOWN_PPU)
-#define LOG_ALL (LOG_IO | LOG_PPU | LOG_VLINES )
+#define LOG_ALL (LOG_IO | LOG_SPU | LOG_PPU | LOG_VLINES | LOG_SEGMENT)
-#define VERBOSE (0)
+#define VERBOSE (LOG_UART | LOG_UNKNOWN_IO)
#include "logmacro.h"
#define SPG_DEBUG_VIDEO (0)
+#define SPG_DEBUG_AUDIO (0)
+#define IO_IRQ_ENABLE m_io_regs[0x21]
+#define IO_IRQ_STATUS m_io_regs[0x22]
#define VIDEO_IRQ_ENABLE m_video_regs[0x62]
#define VIDEO_IRQ_STATUS m_video_regs[0x63]
spg2xx_device::spg2xx_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_mixer_interface(mconfig, *this, 2)
- , m_spg_audio(*this, "spgaudio")
- , m_spg_io(*this, "spgio")
- , m_rowscrolloffset(15)
+ , device_sound_interface(mconfig, *this)
, m_porta_out(*this)
, m_portb_out(*this)
, m_portc_out(*this)
, m_porta_in(*this)
, m_portb_in(*this)
, m_portc_in(*this)
- , m_adc_in{{*this}, {*this}}
, m_eeprom_w(*this)
, m_eeprom_r(*this)
, m_uart_tx(*this)
@@ -78,234 +97,212 @@ void spg2xx_device::map(address_map &map)
map(0x002900, 0x002aff).ram().share("scrollram");
map(0x002b00, 0x002bff).ram().share("paletteram");
map(0x002c00, 0x002fff).ram().share("spriteram");
- map(0x003000, 0x0031ff).rw(m_spg_audio, FUNC(spg2xx_audio_device::audio_r), FUNC(spg2xx_audio_device::audio_w));
- map(0x003200, 0x0033ff).rw(m_spg_audio, FUNC(spg2xx_audio_device::audio_phase_r), FUNC(spg2xx_audio_device::audio_phase_w));
- map(0x003400, 0x0037ff).rw(m_spg_audio, FUNC(spg2xx_audio_device::audio_ctrl_r), FUNC(spg2xx_audio_device::audio_ctrl_w));
- map(0x003d00, 0x003d2f).rw(m_spg_io, FUNC(spg2xx_io_device::io_r), FUNC(spg2xx_io_device::io_w));
- map(0x003d30, 0x003dff).rw(m_spg_io, FUNC(spg2xx_io_device::io_extended_r), FUNC(spg2xx_io_device::io_extended_w));
- map(0x003e00, 0x003e03).rw(FUNC(spg2xx_device::dma_r), FUNC(spg2xx_device::dma_w));
+ map(0x003000, 0x0037ff).rw(FUNC(spg2xx_device::audio_r), FUNC(spg2xx_device::audio_w));
+ map(0x003d00, 0x003eff).rw(FUNC(spg2xx_device::io_r), FUNC(spg2xx_device::io_w));
}
void spg2xx_device::device_start()
{
- for (uint8_t i = 0; i < 32; i++)
- {
- m_rgb5_to_rgb8[i] = (i << 3) | (i >> 2);
- }
- for (uint16_t i = 0; i < 0x8000; i++)
- {
- m_rgb555_to_rgb888[i] = (m_rgb5_to_rgb8[(i >> 10) & 0x1f] << 16) |
- (m_rgb5_to_rgb8[(i >> 5) & 0x1f] << 8) |
- (m_rgb5_to_rgb8[(i >> 0) & 0x1f] << 0);
- }
m_porta_out.resolve_safe();
m_portb_out.resolve_safe();
m_portc_out.resolve_safe();
m_porta_in.resolve_safe(0);
m_portb_in.resolve_safe(0);
m_portc_in.resolve_safe(0);
- m_adc_in[0].resolve_safe(0x0fff);
- m_adc_in[1].resolve_safe(0x0fff);
m_eeprom_w.resolve_safe();
m_eeprom_r.resolve_safe(0);
m_uart_tx.resolve_safe();
m_chip_sel.resolve_safe();
+ m_tmb1 = timer_alloc(TIMER_TMB1);
+ m_tmb2 = timer_alloc(TIMER_TMB2);
+ m_tmb1->adjust(attotime::never);
+ m_tmb2->adjust(attotime::never);
+
m_screenpos_timer = timer_alloc(TIMER_SCREENPOS);
m_screenpos_timer->adjust(attotime::never);
- save_item(NAME(m_hide_page0));
- save_item(NAME(m_hide_page1));
- save_item(NAME(m_hide_sprites));
- save_item(NAME(m_debug_sprites));
- save_item(NAME(m_debug_blit));
- save_item(NAME(m_debug_palette));
- save_item(NAME(m_sprite_index_to_debug));
+ m_audio_beat = timer_alloc(TIMER_BEAT);
+ m_audio_beat->adjust(attotime::never);
- save_item(NAME(m_dma_regs));
+ m_stream = stream_alloc(0, 2, 44100);
- save_item(NAME(m_video_regs));
- save_item(NAME(m_sprite_limit));
- save_item(NAME(m_pal_flag));
+ m_channel_debug = -1;
}
void spg2xx_device::device_reset()
{
+ memset(m_audio_regs, 0, 0x800 * sizeof(uint16_t));
+ memset(m_sample_shift, 0, 16);
+ memset(m_sample_count, 0, sizeof(uint32_t) * 16);
+ memset(m_sample_addr, 0, sizeof(uint32_t) * 16);
+ memset(m_channel_rate, 0, sizeof(double) * 16);
+ memset(m_channel_rate_accum, 0, sizeof(double) * 16);
+ memset(m_rampdown_frame, 0, sizeof(uint32_t) * 16);
+ memset(m_envclk_frame, 4, sizeof(uint32_t) * 16);
+ memset(m_envelope_addr, 0, sizeof(uint32_t) * 16);
+
memset(m_video_regs, 0, 0x100 * sizeof(uint16_t));
- memset(m_dma_regs, 0, 0x4 * sizeof(uint16_t));
+ memset(m_io_regs, 0, 0x200 * sizeof(uint16_t));
+
+ m_io_regs[0x23] = 0x0028;
+ m_uart_rx_available = false;
+ memset(m_uart_rx_fifo, 0, ARRAY_LENGTH(m_uart_rx_fifo));
+ m_uart_rx_fifo_start = 0;
+ m_uart_rx_fifo_end = 0;
+ m_uart_rx_fifo_count = 0;
m_video_regs[0x36] = 0xffff;
m_video_regs[0x37] = 0xffff;
m_video_regs[0x3c] = 0x0020;
- m_video_regs[0x42] = 0x0001;
m_hide_page0 = false;
m_hide_page1 = false;
m_hide_sprites = false;
m_debug_sprites = false;
m_debug_blit = false;
- m_debug_palette = false;
m_sprite_index_to_debug = 0;
-}
+ m_debug_samples = false;
+ m_debug_rates = false;
+ m_audio_curr_beat_base_count = 0;
-WRITE_LINE_MEMBER(spg2xx_device::audioirq_w)
-{
- m_cpu->set_state_unsynced(UNSP_IRQ4_LINE, state);
-}
+ m_audio_regs[AUDIO_CHANNEL_REPEAT] = 0x3f;
+ m_audio_regs[AUDIO_CHANNEL_ENV_MODE] = 0x3f;
-WRITE_LINE_MEMBER(spg2xx_device::timerirq_w)
-{
- m_cpu->set_state_unsynced(UNSP_IRQ2_LINE, state);
+ m_audio_beat->adjust(attotime::from_ticks(4, 281250), 0, attotime::from_ticks(4, 281250));
}
-WRITE_LINE_MEMBER(spg2xx_device::uartirq_w)
-{
- m_cpu->set_state_unsynced(UNSP_IRQ3_LINE, state);
-}
-WRITE_LINE_MEMBER(spg2xx_device::extirq_w)
-{
- m_cpu->set_state_unsynced(UNSP_IRQ5_LINE, state);
-}
+/*************************
+* Video Hardware *
+*************************/
-WRITE_LINE_MEMBER(spg2xx_device::ffreq1_w)
+inline uint8_t spg2xx_device::expand_rgb5_to_rgb8(uint8_t val)
{
- m_cpu->set_state_unsynced(UNSP_IRQ6_LINE, state);
+ uint8_t temp = val & 0x1f;
+ return (temp << 3) | (temp >> 2);
}
-WRITE_LINE_MEMBER(spg2xx_device::ffreq2_w)
+// Perform a lerp between a and b
+inline uint8_t spg2xx_device::mix_channel(uint8_t bottom, uint8_t top)
{
- m_cpu->set_state_unsynced(UNSP_IRQ7_LINE, state);
+ uint8_t alpha = (m_video_regs[0x2a] & 3) << 6;
+ return ((256 - alpha) * bottom + alpha * top) >> 8;
}
-
-
-READ16_MEMBER(spg2xx_device::space_r)
+void spg2xx_device::mix_pixel(uint32_t offset, uint16_t rgb)
{
- address_space &cpuspace = m_cpu->space(AS_PROGRAM);
- return cpuspace.read_word(offset);
+ m_screenbuf[offset].r = mix_channel(m_screenbuf[offset].r, expand_rgb5_to_rgb8(rgb >> 10));
+ m_screenbuf[offset].g = mix_channel(m_screenbuf[offset].g, expand_rgb5_to_rgb8(rgb >> 5));
+ m_screenbuf[offset].b = mix_channel(m_screenbuf[offset].b, expand_rgb5_to_rgb8(rgb));
}
-/*************************
-* Video Hardware *
-*************************/
-
-// Perform a lerp between a and b
-inline uint8_t spg2xx_device::mix_channel(uint8_t bottom, uint8_t top)
+void spg2xx_device::set_pixel(uint32_t offset, uint16_t rgb)
{
- uint8_t alpha = (m_video_regs[0x2a] & 3) << 6;
- return ((256 - alpha) * bottom + alpha * top) >> 8;
+ m_screenbuf[offset].r = expand_rgb5_to_rgb8(rgb >> 10);
+ m_screenbuf[offset].g = expand_rgb5_to_rgb8(rgb >> 5);
+ m_screenbuf[offset].b = expand_rgb5_to_rgb8(rgb);
}
-template<spg2xx_device::blend_enable_t Blend, spg2xx_device::rowscroll_enable_t RowScroll, spg2xx_device::flipx_t FlipX>
-void spg2xx_device::blit(const rectangle &cliprect, uint32_t line, uint32_t xoff, uint32_t yoff, uint32_t attr, uint32_t ctrl, uint32_t bitmap_addr, uint16_t tile)
+void spg2xx_device::blit(const rectangle &cliprect, uint32_t xoff, uint32_t yoff, uint32_t attr, uint32_t ctrl, uint32_t bitmap_addr, uint16_t tile)
{
address_space &space = m_cpu->space(AS_PROGRAM);
- int32_t h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT);
- int32_t w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT);
+ uint32_t h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT);
+ uint32_t w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT);
uint32_t yflipmask = attr & TILE_Y_FLIP ? h - 1 : 0;
+ uint32_t xflipmask = attr & TILE_X_FLIP ? w - 1 : 0;
uint32_t nc = ((attr & 0x0003) + 1) << 1;
uint32_t palette_offset = (attr & 0x0f00) >> 4;
- if (SPG_DEBUG_VIDEO && m_debug_blit)
+ if (m_debug_blit && SPG_DEBUG_VIDEO)
{
- printf("s:%d line:%d xy:%08x,%08x attr:%08x ctrl:%08x bitmap_addr:%08x tile:%04x\n", cliprect.min_x, line, xoff, yoff, attr, ctrl, bitmap_addr, tile);
- printf("hw:%d,%d f:%d,%d yfm:%d ncols:%d pobs:%02x ", w, h, (attr & TILE_X_FLIP) ? 1 : 0, (attr & TILE_Y_FLIP) ? 1 : 0, yflipmask, nc, palette_offset);
+ printf("xy:%08x,%08x attr:%08x ctrl:%08x bitmap_addr:%08x tile:%04x\n", xoff, yoff, attr, ctrl, bitmap_addr, tile);
+ printf("hw:%d,%d f:%d,%d fm:%d,%d ncols:%d pobs:%02x ", w, h, (attr & TILE_X_FLIP) ? 1 : 0, (attr & TILE_Y_FLIP) ? 1 : 0, xflipmask, yflipmask, nc, palette_offset);
}
palette_offset >>= nc;
palette_offset <<= nc;
- if (SPG_DEBUG_VIDEO && m_debug_blit)
+ if (m_debug_blit && SPG_DEBUG_VIDEO)
{
printf("poas:%02x\n", palette_offset);
}
- uint32_t bits_per_row = nc * w / 16;
- uint32_t words_per_tile = bits_per_row * h;
- uint32_t m = bitmap_addr + words_per_tile * tile + bits_per_row * (line ^ yflipmask);
+ uint32_t m = bitmap_addr + nc * w*h / 16 * tile;
uint32_t bits = 0;
uint32_t nbits = 0;
- uint32_t y = line;
-
- int yy = (yoff + y) & 0x1ff;
- if (yy >= 0x01c0)
- yy -= 0x0200;
- if (yy > 240 || yy < 0)
- return;
-
- if (SPG_DEBUG_VIDEO && m_debug_blit)
- printf("%3d:\n", yy);
-
- int y_index = yy * 320;
-
- for (int32_t x = FlipX ? (w - 1) : 0; FlipX ? x >= 0 : x < w; FlipX ? x-- : x++)
+ for (uint32_t y = 0; y < h; y++)
{
- int xx = xoff + x;
+ int yy = (yoff + (y ^ yflipmask)) & 0x1ff;
+ if (yy >= 0x01c0)
+ yy -= 0x0200;
- bits <<= nc;
- if (SPG_DEBUG_VIDEO && m_debug_blit)
- printf(" %08x:%d ", bits, nbits);
- if (nbits < nc)
- {
- uint16_t b = space.read_word(m++ & 0x3fffff);
- b = (b << 8) | (b >> 8);
- bits |= b << (nc - nbits);
- nbits += 16;
- if (SPG_DEBUG_VIDEO && m_debug_blit)
- printf("(%04x:%08x:%d) ", b, bits, nbits);
- }
- nbits -= nc;
+ if (m_debug_blit && SPG_DEBUG_VIDEO)
+ printf("%3d:\n", yy);
- uint32_t pal = palette_offset + (bits >> 16);
- if (SPG_DEBUG_VIDEO && m_debug_blit)
- printf("%02x:%02x:%04x ", bits >> 16, pal, bits & 0xffff);
- bits &= 0xffff;
+ for (uint32_t x = 0; x < w; x++)
+ {
+ int xx = xoff + (x ^ xflipmask);
- if (RowScroll)
- xx -= (int16_t)m_scrollram[(yy + m_rowscrolloffset) & 0x1ff];
+ bits <<= nc;
+ if (m_debug_blit && SPG_DEBUG_VIDEO)
+ printf(" %08x:%d ", bits, nbits);
+ if (nbits < nc)
+ {
+ uint16_t b = space.read_word(m++ & 0x3fffff);
+ b = (b << 8) | (b >> 8);
+ bits |= b << (nc - nbits);
+ nbits += 16;
+ if (m_debug_blit && SPG_DEBUG_VIDEO)
+ printf("(%04x:%08x:%d) ", b, bits, nbits);
+ }
+ nbits -= nc;
- xx &= 0x01ff;
- if (xx >= 0x01c0)
- xx -= 0x0200;
+ uint32_t pal = palette_offset + (bits >> 16);
+ if (m_debug_blit && SPG_DEBUG_VIDEO)
+ printf("%02x:%02x:%04x ", bits >> 16, pal, bits & 0xffff);
+ bits &= 0xffff;
- if (xx >= 0 && xx < 320)
- {
- int pix_index = xx + y_index;
+ if ((ctrl & 0x0010) && yy < 240)
+ xx -= (int16_t)m_scrollram[yy + 15];
- uint16_t rgb = m_paletteram[pal];
- if (SPG_DEBUG_VIDEO && m_debug_blit)
- printf("rgb:%04x ", rgb);
+ xx &= 0x01ff;
+ if (xx >= 0x01c0)
+ xx -= 0x0200;
- if (!(rgb & 0x8000))
+ if (xx >= 0 && xx < 320 && yy >= 0 && yy < 240)
{
- if (Blend)
+ uint16_t rgb = m_paletteram[pal];
+ if (m_debug_blit && SPG_DEBUG_VIDEO)
+ printf("rgb:%04x ", rgb);
+ if (!(rgb & 0x8000))
{
- if (SPG_DEBUG_VIDEO && m_debug_blit)
- printf("M\n");
- m_screenbuf[pix_index] = (mix_channel((uint8_t)(m_screenbuf[pix_index] >> 16), m_rgb5_to_rgb8[(rgb >> 10) & 0x1f]) << 16) |
- (mix_channel((uint8_t)(m_screenbuf[pix_index] >> 8), m_rgb5_to_rgb8[(rgb >> 5) & 0x1f]) << 8) |
- (mix_channel((uint8_t)(m_screenbuf[pix_index] >> 0), m_rgb5_to_rgb8[rgb & 0x1f]));
+ if (attr & 0x4000 || ctrl & 0x0100)
+ {
+ if (m_debug_blit && SPG_DEBUG_VIDEO)
+ printf("M\n");
+ mix_pixel(xx + 320 * yy, rgb);
+ }
+ else
+ {
+ if (m_debug_blit && SPG_DEBUG_VIDEO)
+ printf("S\n");
+ set_pixel(xx + 320 * yy, rgb);
+ }
}
- else
+ else if (m_debug_blit && SPG_DEBUG_VIDEO)
{
- if (SPG_DEBUG_VIDEO && m_debug_blit)
- printf("S\n");
- m_screenbuf[pix_index] = m_rgb555_to_rgb888[rgb];
+ printf("X\n");
}
}
- else if (SPG_DEBUG_VIDEO && m_debug_blit)
- {
- printf("X\n");
- }
}
}
}
-void spg2xx_device::blit_page(const rectangle &cliprect, uint32_t scanline, int depth, uint32_t bitmap_addr, uint16_t *regs)
+void spg2xx_device::blit_page(const rectangle &cliprect, int depth, uint32_t bitmap_addr, uint16_t *regs)
{
uint32_t xscroll = regs[0];
uint32_t yscroll = regs[1];
@@ -325,98 +322,62 @@ void spg2xx_device::blit_page(const rectangle &cliprect, uint32_t scanline, int
return;
}
- uint32_t tile_h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT);
- uint32_t tile_w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT);
-
- uint32_t tile_count_x = 512 / tile_w;
+ uint32_t h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT);
+ uint32_t w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT);
- uint32_t bitmap_y = (scanline + yscroll) & 0xff;
- uint32_t y0 = bitmap_y / tile_h;
- uint32_t tile_scanline = bitmap_y % tile_h;
- uint32_t tile_address = tile_count_x * y0;
- if (SPG_DEBUG_VIDEO && machine().input().code_pressed(KEYCODE_H))
- printf("s:%3d | baddr:%08x | yscr:%3d | bity:%3d | y0:%2d | ts:%2d\n", scanline, bitmap_addr, yscroll, bitmap_y, y0, tile_scanline);
+ uint32_t hn = 256 / h;
+ uint32_t wn = 512 / w;
- if (SPG_DEBUG_VIDEO && machine().input().code_pressed(KEYCODE_EQUALS))
- m_debug_blit = true;
- for (uint32_t x0 = 0; x0 < tile_count_x; x0++, tile_address++)
+ for (uint32_t y0 = 0; y0 < hn; y0++)
{
- uint32_t yy = ((tile_h * y0 - yscroll + 0x10) & 0xff) - 0x10;
- uint32_t xx = (tile_w * x0 - xscroll) & 0x1ff;
- uint16_t tile = (ctrl & PAGE_WALLPAPER_MASK) ? space.read_word(tilemap) : space.read_word(tilemap + tile_address);
- uint16_t palette = 0;
+ for (uint32_t x0 = 0; x0 < wn; x0++)
+ {
+ uint16_t tile = (ctrl & PAGE_WALLPAPER_MASK) ? space.read_word(tilemap) : space.read_word(tilemap + x0 + wn * y0);
+ uint16_t palette = 0;
+ uint32_t xx, yy;
- if (!tile)
- continue;
+ if (!tile)
+ {
+ continue;
+ }
- palette = (ctrl & PAGE_WALLPAPER_MASK) ? space.read_word(palette_map) : space.read_word(palette_map + tile_address / 2);
- if (x0 & 1)
- palette >>= 8;
+ palette = space.read_word(palette_map + (x0 + wn * y0) / 2);
+ if (x0 & 1)
+ {
+ palette >>= 8;
+ }
- uint32_t tileattr = attr;
- uint32_t tilectrl = ctrl;
- if ((ctrl & 2) == 0)
- { // -(1) bld(1) flip(2) pal(4)
- tileattr &= ~0x000c;
- tileattr |= (palette >> 2) & 0x000c; // flip
+ uint32_t tileattr = attr;
+ uint32_t tilectrl = ctrl;
+ if ((ctrl & 2) == 0)
+ { // -(1) bld(1) flip(2) pal(4)
+ tileattr &= ~0x000c;
+ tileattr |= (palette >> 2) & 0x000c; // flip
- tileattr &= ~0x0f00;
- tileattr |= (palette << 8) & 0x0f00; // palette
+ tileattr &= ~0x0f00;
+ tileattr |= (palette << 8) & 0x0f00; // palette
- tilectrl &= ~0x0100;
- tilectrl |= (palette << 2) & 0x0100; // blend
- }
+ tilectrl &= ~0x0100;
+ tilectrl |= (palette << 2) & 0x0100; // blend
+ }
- bool blend = (tileattr & 0x4000 || tilectrl & 0x0100);
- bool row_scroll = (tilectrl & 0x0010);
- bool flip_x = (tileattr & TILE_X_FLIP);
+ yy = ((h*y0 - yscroll + 0x10) & 0xff) - 0x10;
+ xx = (w*x0 - xscroll) & 0x1ff;
- if (blend)
- {
- if (row_scroll)
- {
- if (flip_x)
- blit<BlendOn, RowScrollOn, FlipXOn>(cliprect, tile_scanline, xx, yy, tileattr, tilectrl, bitmap_addr, tile);
- else
- blit<BlendOn, RowScrollOn, FlipXOff>(cliprect, tile_scanline, xx, yy, tileattr, tilectrl, bitmap_addr, tile);
- }
- else
- {
- if (flip_x)
- blit<BlendOn, RowScrollOff, FlipXOn>(cliprect, tile_scanline, xx, yy, tileattr, tilectrl, bitmap_addr, tile);
- else
- blit<BlendOn, RowScrollOff, FlipXOff>(cliprect, tile_scanline, xx, yy, tileattr, tilectrl, bitmap_addr, tile);
- }
- }
- else
- {
- if (row_scroll)
- {
- if (flip_x)
- blit<BlendOff, RowScrollOn, FlipXOn>(cliprect, tile_scanline, xx, yy, tileattr, tilectrl, bitmap_addr, tile);
- else
- blit<BlendOff, RowScrollOn, FlipXOff>(cliprect, tile_scanline, xx, yy, tileattr, tilectrl, bitmap_addr, tile);
- }
- else
- {
- if (flip_x)
- blit<BlendOff, RowScrollOff, FlipXOn>(cliprect, tile_scanline, xx, yy, tileattr, tilectrl, bitmap_addr, tile);
- else
- blit<BlendOff, RowScrollOff, FlipXOff>(cliprect, tile_scanline, xx, yy, tileattr, tilectrl, bitmap_addr, tile);
- }
+ blit(cliprect, xx, yy, tileattr, tilectrl, bitmap_addr, tile);
}
}
- if (SPG_DEBUG_VIDEO && machine().input().code_pressed(KEYCODE_EQUALS))
- m_debug_blit = false;
}
-void spg2xx_device::blit_sprite(const rectangle &cliprect, uint32_t scanline, int depth, uint32_t base_addr)
+void spg2xx_device::blit_sprite(const rectangle &cliprect, int depth, uint32_t base_addr)
{
+ address_space &space = m_cpu->space(AS_PROGRAM);
uint32_t bitmap_addr = 0x40 * m_video_regs[0x22];
- uint16_t tile = m_spriteram[base_addr + 0];
- int16_t x = m_spriteram[base_addr + 1];
- int16_t y = m_spriteram[base_addr + 2];
- uint16_t attr = m_spriteram[base_addr + 3];
+
+ uint16_t tile = space.read_word(base_addr + 0);
+ int16_t x = space.read_word(base_addr + 1);
+ int16_t y = space.read_word(base_addr + 2);
+ uint16_t attr = space.read_word(base_addr + 3);
if (!tile)
{
@@ -428,68 +389,32 @@ void spg2xx_device::blit_sprite(const rectangle &cliprect, uint32_t scanline, in
return;
}
- const uint32_t h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT);
- const uint32_t w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT);
-
if (!(m_video_regs[0x42] & SPRITE_COORD_TL_MASK))
{
- x = (160 + x) - w / 2;
- y = (120 - y) - (h / 2) + 8;
- }
+ x = 160 + x;
+ y = 120 - y;
- x &= 0x01ff;
- y &= 0x01ff;
+ uint32_t h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT);
+ uint32_t w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT);
- uint32_t tile_line = ((scanline - y) + 0x200) % h;
- int16_t test_y = (y + tile_line) & 0x1ff;
- if (test_y >= 0x01c0)
- test_y -= 0x0200;
-
- if (test_y != scanline)
- {
- return;
+ x -= (w / 2);
+ y -= (h / 2) - 8;
}
- bool blend = (attr & 0x4000);
- bool flip_x = (attr & TILE_X_FLIP);
+ x &= 0x01ff;
+ y &= 0x01ff;
#if SPG_DEBUG_VIDEO
if (m_debug_sprites && machine().input().code_pressed(KEYCODE_MINUS))
m_debug_blit = true;
- if (blend)
- {
- if (flip_x)
- blit<BlendOn, RowScrollOff, FlipXOn>(cliprect, tile_line, x, y, attr, 0, bitmap_addr, tile);
- else
- blit<BlendOn, RowScrollOff, FlipXOff>(cliprect, tile_line, x, y, attr, 0, bitmap_addr, tile);
- }
- else
- {
- if (flip_x)
- blit<BlendOff, RowScrollOff, FlipXOn>(cliprect, tile_line, x, y, attr, 0, bitmap_addr, tile);
- else
- blit<BlendOff, RowScrollOff, FlipXOff>(cliprect, tile_line, x, y, attr, 0, bitmap_addr, tile);
- }
+ blit(cliprect, x, y, attr, 0, bitmap_addr, tile);
m_debug_blit = false;
#else
- if (blend)
- {
- if (flip_x)
- blit<BlendOn, RowScrollOff, FlipXOn>(cliprect, tile_line, x, y, attr, 0, bitmap_addr, tile);
- else
- blit<BlendOn, RowScrollOff, FlipXOff>(cliprect, tile_line, x, y, attr, 0, bitmap_addr, tile);
- }
- else
- {
- if (flip_x)
- blit<BlendOff, RowScrollOff, FlipXOn>(cliprect, tile_line, x, y, attr, 0, bitmap_addr, tile);
- else
- blit<BlendOff, RowScrollOff, FlipXOff>(cliprect, tile_line, x, y, attr, 0, bitmap_addr, tile);
- }
+ blit(cliprect, x, y, attr, 0, bitmap_addr, tile);
#endif
}
-void spg2xx_device::blit_sprites(const rectangle &cliprect, uint32_t scanline, int depth)
+void spg2xx_device::blit_sprites(const rectangle &cliprect, int depth)
{
if (!(m_video_regs[0x42] & SPRITE_ENABLE_MASK))
{
@@ -502,13 +427,13 @@ void spg2xx_device::blit_sprites(const rectangle &cliprect, uint32_t scanline, i
#endif
for (uint32_t n = 0; n < m_sprite_limit; n++)
{
- blit_sprite(cliprect, scanline, depth, 4 * n);
+ blit_sprite(cliprect, depth, 0x2c00 + 4 * n);
}
#if SPG_DEBUG_VIDEO
}
else
{
- blit_sprite(cliprect, scanline, depth, 4 * m_sprite_index_to_debug);
+ blit_sprite(cliprect, depth, 0x2c00 + 4 * m_sprite_index_to_debug);
}
#endif
}
@@ -522,13 +447,12 @@ void spg2xx_device::apply_saturation(const rectangle &cliprect)
const float sat_adjust = (0xff - (m_video_regs[0x3c] & 0x00ff)) / (float)(0xff - 0x20);
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{
- uint32_t *src = &m_screenbuf[cliprect.min_x + 320 * y];
+ rgbtriad_t *src = &m_screenbuf[cliprect.min_x + 320 * y];
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
{
- const uint32_t src_rgb = *src;
- const float src_r = (uint8_t)(src_rgb >> 16) * s_u8_to_float;
- const float src_g = (uint8_t)(src_rgb >> 8) * s_u8_to_float;
- const float src_b = (uint8_t)(src_rgb >> 0) * s_u8_to_float;
+ const float src_r = src->r * s_u8_to_float;
+ const float src_g = src->g * s_u8_to_float;
+ const float src_b = src->b * s_u8_to_float;
const float luma = src_r * s_gray_r + src_g * s_gray_g + src_b * s_gray_b;
const float adjusted_r = luma + (src_r - luma) * sat_adjust;
const float adjusted_g = luma + (src_g - luma) * sat_adjust;
@@ -536,55 +460,50 @@ void spg2xx_device::apply_saturation(const rectangle &cliprect)
const int integer_r = (int)floor(adjusted_r * 255.0f);
const int integer_g = (int)floor(adjusted_g * 255.0f);
const int integer_b = (int)floor(adjusted_b * 255.0f);
- *src++ = (integer_r > 255 ? 0xff0000 : (integer_r < 0 ? 0 : ((uint8_t)integer_r << 16))) |
- (integer_g > 255 ? 0x00ff00 : (integer_g < 0 ? 0 : ((uint8_t)integer_g << 8))) |
- (integer_b > 255 ? 0x0000ff : (integer_b < 0 ? 0 : (uint8_t)integer_b));
+ src->r = integer_r > 255 ? 255 : (integer_r < 0 ? 0 : (uint8_t)integer_r);
+ src->g = integer_g > 255 ? 255 : (integer_g < 0 ? 0 : (uint8_t)integer_g);
+ src->b = integer_b > 255 ? 255 : (integer_b < 0 ? 0 : (uint8_t)integer_b);
+ src++;
}
}
}
void spg2xx_device::apply_fade(const rectangle &cliprect)
{
- const uint16_t fade_offset = m_video_regs[0x30];
+ const uint16_t fade_offset = m_video_regs[0x30] << 1;
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{
- uint32_t *src = &m_screenbuf[cliprect.min_x + 320 * y];
+ rgbtriad_t *src = &m_screenbuf[cliprect.min_x + 320 * y];
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
{
- const uint32_t src_rgb = *src;
- const uint8_t src_r = (src_rgb >> 16) & 0xff;
- const uint8_t src_g = (src_rgb >> 8) & 0xff;
- const uint8_t src_b = (src_rgb >> 0) & 0xff;
- const uint8_t r = src_r - fade_offset;
- const uint8_t g = src_g - fade_offset;
- const uint8_t b = src_b - fade_offset;
- *src++ = (r > src_r ? 0 : (r << 16)) |
- (g > src_g ? 0 : (g << 8)) |
- (b > src_b ? 0 : (b << 0));
+ const uint16_t r = (uint16_t)src->r - fade_offset;
+ const uint16_t g = (uint16_t)src->g - fade_offset;
+ const uint16_t b = (uint16_t)src->b - fade_offset;
+ src->r = (r > src->r ? 0 : r);
+ src->g = (g > src->g ? 0 : g);
+ src->b = (b > src->b ? 0 : b);
+ src++;
}
}
}
uint32_t spg2xx_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- memset(&m_screenbuf[320 * cliprect.min_y], 0, 4 * 320 * ((cliprect.max_y - cliprect.min_y) + 1));
+ memset(&m_screenbuf[320 * cliprect.min_y], 0, 3 * 320 * ((cliprect.max_y - cliprect.min_y) + 1));
const uint32_t page1_addr = 0x40 * m_video_regs[0x20];
const uint32_t page2_addr = 0x40 * m_video_regs[0x21];
uint16_t *page1_regs = m_video_regs + 0x10;
uint16_t *page2_regs = m_video_regs + 0x16;
- for (uint32_t scanline = (uint32_t)cliprect.min_y; scanline <= (uint32_t)cliprect.max_y; scanline++)
+ for (int i = 0; i < 4; i++)
{
- for (int i = 0; i < 4; i++)
- {
- if (!SPG_DEBUG_VIDEO || !m_hide_page0)
- blit_page(cliprect, scanline, i, page1_addr, page1_regs);
- if (!SPG_DEBUG_VIDEO || !m_hide_page1)
- blit_page(cliprect, scanline, i, page2_addr, page2_regs);
- if (!SPG_DEBUG_VIDEO || !m_hide_sprites)
- blit_sprites(cliprect, scanline, i);
- }
+ if (!m_hide_page0)
+ blit_page(cliprect, i, page1_addr, page1_regs);
+ if (!m_hide_page1)
+ blit_page(cliprect, i, page2_addr, page2_regs);
+ if (!m_hide_sprites)
+ blit_sprites(cliprect, i);
}
if ((m_video_regs[0x3c] & 0x00ff) != 0x0020)
@@ -597,30 +516,15 @@ uint32_t spg2xx_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma
apply_fade(cliprect);
}
+ bitmap.fill(0, cliprect);
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{
uint32_t *dest = &bitmap.pix32(y, cliprect.min_x);
- uint32_t *src = &m_screenbuf[cliprect.min_x + 320 * y];
- memcpy(dest, src, sizeof(uint32_t) * ((cliprect.max_x - cliprect.min_x) + 1));
- }
-
- if (SPG_DEBUG_VIDEO && m_debug_palette)
- {
- for (int y = cliprect.min_y; y <= cliprect.max_y && y < 128; y++)
+ rgbtriad_t *src = &m_screenbuf[cliprect.min_x + 320 * y];
+ for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
{
- const uint16_t high_nybble = (y / 8) << 4;
- uint32_t *dest = &bitmap.pix32(y, cliprect.min_x);
- for (int x = cliprect.min_x; x <= cliprect.max_x && x < 256; x++)
- {
- const uint16_t low_nybble = x / 16;
- const uint16_t palette_entry = high_nybble | low_nybble;
- const uint16_t color = m_paletteram[palette_entry];
- if (!(color & 0x8000))
- {
- *dest = m_rgb555_to_rgb888[color & 0x7fff];
- }
- dest++;
- }
+ *dest++ = (src->r << 16) | (src->g << 8) | src->b;
+ src++;
}
}
@@ -632,22 +536,15 @@ void spg2xx_device::do_sprite_dma(uint32_t len)
address_space &mem = m_cpu->space(AS_PROGRAM);
uint32_t src = m_video_regs[0x70] & 0x3fff;
- uint32_t dst = m_video_regs[0x71];
+ uint32_t dst = (m_video_regs[0x71] & 0x3ff) + 0x2c00;
for (uint32_t j = 0; j < len; j++)
{
- m_spriteram[(dst + j) & 0x3ff] = mem.read_word(src + j);
+ mem.write_word(dst + j, mem.read_word(src + j));
}
m_video_regs[0x72] = 0;
- if (VIDEO_IRQ_ENABLE & 4)
- {
- const uint16_t old = VIDEO_IRQ_STATUS;
- VIDEO_IRQ_STATUS |= 4;
- const uint16_t changed = old ^ (VIDEO_IRQ_ENABLE & VIDEO_IRQ_STATUS);
- if (changed)
- check_video_irq();
- }
+ VIDEO_IRQ_STATUS |= 4;
}
READ16_MEMBER(spg2xx_device::video_r)
@@ -841,12 +738,9 @@ WRITE16_MEMBER(spg2xx_device::video_w)
break;
case 0x72: // Sprite DMA Length
- {
LOGMASKED(LOG_DMA, "video_w: Sprite DMA Length = %04x\n", data & 0x03ff);
- uint16_t length = data & 0x3ff;
- do_sprite_dma(length ? length : 0x400);
+ do_sprite_dma(data & 0x3ff);
break;
- }
default:
LOGMASKED(LOG_UNKNOWN_PPU, "video_w: Unknown register %04x = %04x\n", 0x2800 + offset, data);
@@ -858,12 +752,7 @@ WRITE16_MEMBER(spg2xx_device::video_w)
WRITE_LINE_MEMBER(spg2xx_device::vblank)
{
if (!state)
- {
- VIDEO_IRQ_STATUS &= ~1;
- LOGMASKED(LOG_IRQS, "Setting video IRQ status to %04x\n", VIDEO_IRQ_STATUS);
- check_video_irq();
return;
- }
#if SPG_DEBUG_VIDEO
if (machine().input().code_pressed_once(KEYCODE_5))
@@ -878,22 +767,38 @@ WRITE_LINE_MEMBER(spg2xx_device::vblank)
m_sprite_index_to_debug--;
if (machine().input().code_pressed_once(KEYCODE_0))
m_sprite_index_to_debug++;
- if (machine().input().code_pressed_once(KEYCODE_L))
- m_debug_palette = !m_debug_palette;
#endif
- if (VIDEO_IRQ_ENABLE & 1)
+#if SPG_DEBUG_AUDIO
+ if (machine().input().code_pressed_once(KEYCODE_3))
+ m_debug_samples = !m_debug_samples;
+ if (machine().input().code_pressed_once(KEYCODE_4))
+ m_debug_rates = !m_debug_rates;
+ if (machine().input().code_pressed_once(KEYCODE_1))
{
- VIDEO_IRQ_STATUS |= 1;
- LOGMASKED(LOG_IRQS, "Setting video IRQ status to %04x\n", VIDEO_IRQ_STATUS);
- check_video_irq();
+ m_channel_debug--;
+ if (m_channel_debug < -1)
+ m_channel_debug = 15;
}
+ if (machine().input().code_pressed_once(KEYCODE_2))
+ {
+ m_channel_debug++;
+ if (m_channel_debug == 16)
+ m_channel_debug = -1;
+ }
+#endif
+
+ const uint16_t old = VIDEO_IRQ_ENABLE & VIDEO_IRQ_STATUS;
+ VIDEO_IRQ_STATUS |= 1;
+ LOGMASKED(LOG_IRQS, "Setting video IRQ status to %04x\n", VIDEO_IRQ_STATUS);
+ const uint16_t changed = old ^ (VIDEO_IRQ_ENABLE & VIDEO_IRQ_STATUS);
+ if (changed)
+ check_video_irq();
}
void spg2xx_device::check_video_irq()
{
- LOGMASKED(LOG_IRQS, "%ssserting IRQ0 (%04x, %04x)\n", (VIDEO_IRQ_STATUS & VIDEO_IRQ_ENABLE) ? "A" : "Dea", VIDEO_IRQ_STATUS, VIDEO_IRQ_ENABLE);
- m_cpu->set_state_unsynced(UNSP_IRQ0_LINE, (VIDEO_IRQ_STATUS & VIDEO_IRQ_ENABLE) ? ASSERT_LINE : CLEAR_LINE);
+ m_cpu->set_input_line(UNSP_IRQ0_LINE, (VIDEO_IRQ_STATUS & VIDEO_IRQ_ENABLE) ? ASSERT_LINE : CLEAR_LINE);
}
@@ -901,66 +806,588 @@ void spg2xx_device::check_video_irq()
* Machine Hardware *
*************************/
-READ16_MEMBER(spg2xx_device::dma_r)
+void spg2xx_device::uart_rx(uint8_t data)
{
- uint16_t val = m_dma_regs[offset];
+ if (!m_uart_rx_available)
+ {
+ if (BIT(m_io_regs[0x30], 6))
+ {
+ m_io_regs[0x36] = data;
+ if (BIT(m_io_regs[0x30], 0))
+ {
+ IO_IRQ_STATUS |= 0x0100;
+ check_irqs(0x0100);
+ }
+ m_uart_rx_available = true;
+ }
+ }
+ else if (m_uart_rx_fifo_count == ARRAY_LENGTH(m_uart_rx_fifo))
+ {
+ m_io_regs[0x37] |= 0x4000;
+ }
+ else
+ {
+ m_uart_rx_fifo[m_uart_rx_fifo_end] = data;
+ m_uart_rx_fifo_end = (m_uart_rx_fifo_end + 1) % ARRAY_LENGTH(m_uart_rx_fifo);
+ m_uart_rx_fifo_count++;
+ }
+}
+
+READ16_MEMBER(spg2xx_device::io_r)
+{
+ static const char *const gpioregs[] = { "GPIO Data Port", "GPIO Buffer Port", "GPIO Direction Port", "GPIO Attribute Port", "GPIO IRQ/Latch Port" };
+ static const char gpioports[] = { 'A', 'B', 'C' };
+
+ uint16_t val = m_io_regs[offset];
+
switch (offset)
{
+ case 0x01: case 0x06: case 0x0b: // GPIO Data Port A/B/C
+ do_gpio(offset);
+ LOGMASKED(LOG_GPIO, "io_r: %s %c = %04x\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset]);
+ val = m_io_regs[offset];
+ break;
+
+ case 0x02: case 0x03: case 0x04: case 0x05:
+ case 0x07: case 0x08: case 0x09: case 0x0a:
+ case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Other GPIO regs
+ LOGMASKED(LOG_GPIO, "io_r: %s %c = %04x\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset]);
+ break;
+
+ case 0x10: // Timebase Control
+ LOGMASKED(LOG_IO_READS, "io_r: Timebase Control = %04x\n", val);
+ break;
- case 0x000: // DMA Source (L)
- LOGMASKED(LOG_DMA, "dma_r: DMA Source (lo) = %04x\n", val);
+ case 0x1c: // Video line counter
+ val = m_screen->vpos();
+ LOGMASKED(LOG_VLINES, "io_r: Video Line = %04x\n", val);
break;
- case 0x001: // DMA Source (H)
- LOGMASKED(LOG_DMA, "dma_r: DMA Source (hi) = %04x\n", val);
+ case 0x20: // System Control
+ LOGMASKED(LOG_IO_READS, "io_r: System Control = %04x\n", val);
break;
- case 0x002: // DMA Length
- LOGMASKED(LOG_DMA, "dma_r: DMA Length = %04x\n", 0);
+ case 0x21: // IRQ Control
+ LOGMASKED(LOG_IRQS, "io_r: I/O IRQ Control = %04x\n", val);
+ break;
+
+ case 0x22: // IRQ Status
+ LOGMASKED(LOG_IRQS, "io_r: I/O IRQ Status = %04x\n", val);
+ break;
+
+ case 0x23: // External Memory Control
+ LOGMASKED(LOG_IO_READS, "io_r: Ext. Memory Control = %04x\n", val);
+ break;
+
+ case 0x25: // ADC Control
+ LOGMASKED(LOG_IO_READS, "io_r: ADC Control = %04x\n", val);
+ break;
+
+ case 0x27: // ADC Data
+ m_io_regs[0x27] = 0;
+ LOGMASKED(LOG_IO_READS, "io_r: ADC Data = %04x\n", val);
+ break;
+
+ case 0x29: // Wakeup Source
+ LOGMASKED(LOG_IO_READS, "io_r: Wakeup Source = %04x\n", val);
+ break;
+
+ case 0x2b:
+ LOGMASKED(LOG_IO_READS, "io_r: NTSC/PAL = %04x\n", m_pal_flag);
+ return m_pal_flag;
+
+ case 0x2c: case 0x2d: // PRNG 0/1
+ val = machine().rand() & 0x0000ffff;
+ LOGMASKED(LOG_IO_READS, "io_r: PRNG %d = %04x\n", offset - 0x2c, val);
+ break;
+
+ case 0x2e: // FIQ Source Select
+ LOGMASKED(LOG_IRQS, "io_r: FIQ Source Select = %04x\n", val);
+ break;
+
+ case 0x2f: // Data Segment
+ val = m_cpu->state_int(UNSP_SR) >> 10;
+ LOGMASKED(LOG_SEGMENT, "io_r: Data Segment = %04x\n", val);
+ break;
+
+ case 0x31: // UART Status
+ val |= (m_uart_rx_available ? 0x81 : 0);
+ LOGMASKED(LOG_UART, "io_r: UART Status = %04x\n", val);
+ break;
+
+ case 0x36: // UART RX Data
+ if (m_uart_rx_available)
+ {
+ if (m_uart_rx_fifo_count)
+ {
+ m_io_regs[0x36] = m_uart_rx_fifo[m_uart_rx_fifo_start];
+ m_uart_rx_fifo_start = (m_uart_rx_fifo_start + 1) % ARRAY_LENGTH(m_uart_rx_fifo);
+ m_uart_rx_fifo_count--;
+ }
+ else
+ {
+ m_uart_rx_available = false;
+ }
+ }
+ else
+ {
+ m_io_regs[0x37] |= 0x2000;
+ }
+ LOGMASKED(LOG_UART, "%s: io_r: UART Rx Data = %04x\n", machine().describe_context(), val);
+ break;
+
+ case 0x37: // UART Rx FIFO Control
+ val &= ~0x0070;
+ val |= (m_uart_rx_available ? 7 : 0) << 4;
+ LOGMASKED(LOG_UART, "io_r: UART Rx FIFO Control = %04x\n", val);
+ break;
+
+ case 0x59: // I2C Status
+ LOGMASKED(LOG_I2C, "io_r: I2C Status = %04x\n", val);
+ break;
+
+ case 0x5e: // I2C Data In
+ LOGMASKED(LOG_I2C, "io_r: I2C Data In = %04x\n", val);
+ break;
+
+ case 0x100: // DMA Source (L)
+ LOGMASKED(LOG_DMA, "io_r: DMA Source (lo) = %04x\n", val);
+ break;
+
+ case 0x101: // DMA Source (H)
+ LOGMASKED(LOG_DMA, "io_r: DMA Source (hi) = %04x\n", val);
+ break;
+
+ case 0x102: // DMA Length
+ LOGMASKED(LOG_DMA, "io_r: DMA Length = %04x\n", 0);
val = 0;
break;
- case 0x003: // DMA Destination
- LOGMASKED(LOG_DMA, "dma_r: DMA Dest = %04x\n", val);
+ case 0x103: // DMA Destination
+ LOGMASKED(LOG_DMA, "io_r: DMA Dest = %04x\n", val);
break;
default:
- LOGMASKED(LOG_UNKNOWN_IO, "dma_r: Unknown register %04x\n", 0x3d00 + offset);
+ LOGMASKED(LOG_UNKNOWN_IO, "io_r: Unknown register %04x\n", 0x3d00 + offset);
break;
}
return val;
}
+void spg2xx_device::update_porta_special_modes()
+{
+ static const char* const s_pa_special[4][16] =
+ {
+ // Input, Special 0
+ // Input, Special 1
+ // Output, Special 0
+ // Output, Special 1
+
+ { "LP", "ExtClk2", "ExtClk1", "-", "SDA", "SlvRDY", "-", "-", "SPICLK", "-", "RxD", "SPISSB", "-", "-", "-", "-" },
+ { "-", "-", "-", "SCK", "-", "SWS", "-", "-", "-", "-", "-", "-", "IRQ2B", "-", "-", "IRQ1B" },
+ { "-", "-", "-", "SCK", "SDA", "SWS", "-", "-", "SPICLK", "TxD", "-", "SPISSB", "TAPWM", "TM1", "TBPWM", "TM2" },
+ { "CSB3", "CSB2", "CSB1", "SCK", "SDA", "VSYNC", "HSYNC", "SYSCLK3", "SPICLK", "TxD", "SWS", "SPISSB", "-", "VSYNC", "HSYNC", "CSYNC" },
+ };
+ for (int bit = 15; bit >= 0; bit--)
+ {
+ if (!BIT(m_io_regs[0x05], bit))
+ continue;
+ uint8_t type = (BIT(m_io_regs[0x03], bit) << 1) | BIT(m_io_regs[0x00], 0);
+ LOGMASKED(LOG_GPIO, " Bit %2d: %s\n", bit, s_pa_special[type][bit]);
+ }
+}
+
+void spg2xx_device::update_portb_special_modes()
+{
+ static const char* const s_pb_special[4][8] =
+ {
+ // Input, Special 0
+ // Input, Special 1
+ // Output, Special 0
+ // Output, Special 1
+
+ { "-", "-", "-", "-", "-", "-", "SDA", "SlvRDY" },
+ { "-", "-", "-", "-", "-", "-", "SDA", "SlvRDY" },
+ { "VSYNC", "HSYNC", "CSYNC", "-", "-", "SCK", "SDA", "SWS" },
+ { "CSB3", "CSB2", "CSB1", "TBPWM", "TM2", "-", "-", "SYSCLK2" },
+ };
+ for (int bit = 7; bit >= 0; bit--)
+ {
+ if (!BIT(m_io_regs[0x0a], bit))
+ continue;
+ uint8_t type = (BIT(m_io_regs[0x08], bit) << 1) | BIT(m_io_regs[0x00], 1);
+ LOGMASKED(LOG_GPIO, " Bit %2d: %s\n", bit, s_pb_special[type][bit]);
+ }
+}
-WRITE16_MEMBER(spg2xx_device::dma_w)
+WRITE16_MEMBER(spg2xx_device::io_w)
{
+ static const char *const gpioregs[] = { "GPIO Data Port", "GPIO Buffer Port", "GPIO Direction Port", "GPIO Attribute Port", "GPIO IRQ/Latch Port" };
+ static const char gpioports[3] = { 'A', 'B', 'C' };
+
switch (offset)
{
- case 0x000: // DMA Source (lo)
- LOGMASKED(LOG_DMA, "dma_w: DMA Source (lo) = %04x\n", data);
- m_dma_regs[offset] = data;
+ case 0x00: // GPIO special function select
+ {
+ LOGMASKED(LOG_GPIO, "io_w: GPIO Configuration = %04x (IOBWake:%d, IOAWake:%d, IOBSpecSel:%d, IOASpecSel:%d)\n", data
+ , BIT(data, 4), BIT(data, 3), BIT(data, 1), BIT(data, 0));
+ const uint16_t old = m_io_regs[offset];
+ m_io_regs[offset] = data;
+ const uint16_t changed = old ^ data;
+ if (BIT(changed, 0))
+ update_porta_special_modes();
+ if (BIT(changed, 1))
+ update_portb_special_modes();
break;
+ }
- case 0x001: // DMA Source (hi)
- LOGMASKED(LOG_DMA, "dma_w: DMA Source (hi) = %04x\n", data);
- m_dma_regs[offset] = data;
+ case 0x01: case 0x06: case 0x0b: // GPIO data, port A/B/C
+ offset++;
+ // Intentional fallthrough - we redirect data register writes to the buffer register.
+
+ case 0x02: case 0x04: // Port A
+ case 0x07: case 0x09: // Port B
+ case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Port C
+ LOGMASKED(LOG_GPIO, "io_w: %s %c = %04x\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], data);
+ m_io_regs[offset] = data;
+ do_gpio(offset);
+ break;
+
+ case 0x03: // Port A Direction
+ LOGMASKED(LOG_GPIO, "io_w: GPIO Direction Port A = %04x\n", data);
+ m_io_regs[offset] = data;
+ update_porta_special_modes();
+ do_gpio(offset);
break;
- case 0x002: // DMA Length
- LOGMASKED(LOG_DMA, "dma_w: DMA Length = %04x\n", data);
- if (!(data & 0xc000)) // jak_dora writes 0xffff here which ends up trashing registers etc. why? such writes can't be valid
- do_cpu_dma(data);
+ case 0x08: // Port B Direction
+ LOGMASKED(LOG_GPIO, "io_w: GPIO Direction Port B = %04x\n", data);
+ m_io_regs[offset] = data;
+ update_portb_special_modes();
+ do_gpio(offset);
break;
- case 0x003: // DMA Destination
- LOGMASKED(LOG_DMA, "dma_w: DMA Dest = %04x\n", data);
- m_dma_regs[offset] = data;
+ case 0x05: // Port A Special
+ LOGMASKED(LOG_GPIO, "io_w: Port A Special Function Select: %04x\n", data);
+ m_io_regs[offset] = data;
+ update_porta_special_modes();
+ break;
+
+ case 0x0a: // Port B Special
+ LOGMASKED(LOG_GPIO, "io_w: Port B Special Function Select: %04x\n", data);
+ m_io_regs[offset] = data;
+ update_portb_special_modes();
+ break;
+
+ case 0x10: // Timebase Control
+ {
+ static const char* const s_tmb1_sel[2][4] =
+ {
+ { "8Hz", "16Hz", "32Hz", "64Hz" },
+ { "12kHz", "24kHz", "40kHz", "40kHz" }
+ };
+ static const char* const s_tmb2_sel[2][4] =
+ {
+ { "128Hz", "256Hz", "512Hz", "1024Hz" },
+ { "105kHz", "210kHz", "420kHz", "840kHz" }
+ };
+ static const uint32_t s_tmb1_freq[2][4] =
+ {
+ { 8, 16, 32, 64 },
+ { 12000, 24000, 40000, 40000 }
+ };
+ static const uint32_t s_tmb2_freq[2][4] =
+ {
+ { 128, 256, 512, 1024 },
+ { 105000, 210000, 420000, 840000 }
+ };
+ LOGMASKED(LOG_IO_WRITES, "io_w: Timebase Control = %04x (Source:%s, TMB2:%s, TMB1:%s)\n", data,
+ BIT(data, 4) ? "27MHz" : "32768Hz", s_tmb2_sel[BIT(data, 4)][(data >> 2) & 3], s_tmb1_sel[BIT(data, 4)][data & 3]);
+ const uint16_t old = m_io_regs[offset];
+ m_io_regs[offset] = data;
+ const uint16_t changed = old ^ m_io_regs[offset];
+ if (changed & 0x001f)
+ {
+ const uint8_t hifreq = BIT(data, 4);
+ if (changed & 0x0013)
+ {
+ const uint32_t freq = s_tmb1_freq[hifreq][data & 3];
+ m_tmb1->adjust(attotime::from_hz(freq), 0, attotime::from_hz(freq));
+ }
+ if (changed & 0x001c)
+ {
+ const uint32_t freq = s_tmb2_freq[hifreq][(data >> 2) & 3];
+ m_tmb2->adjust(attotime::from_hz(freq), 0, attotime::from_hz(freq));
+ }
+ }
+ break;
+ }
+
+ case 0x11: // Timebase Clear
+ LOGMASKED(LOG_IO_WRITES, "io_w: Timebase Clear = %04x\n", data);
+ break;
+
+ case 0x20: // System Control
+ {
+ static const char* const s_sysclk[4] = { "13.5MHz", "27MHz", "27MHz NoICE", "54MHz" };
+ static const char* const s_lvd_voltage[4] = { "2.7V", "2.9V", "3.1V", "3.3V" };
+ static const char* const s_weak_strong[2] = { "Weak", "Strong" };
+ LOGMASKED(LOG_IO_WRITES, "io_w: System Control = %04x (Watchdog:%d, Sleep:%d, SysClk:%s, SysClkInv:%d, LVROutEn:%d, LVREn:%d\n"
+ , data, BIT(data, 15), BIT(data, 14), s_sysclk[(data >> 12) & 3], BIT(data, 11), BIT(data, 9), BIT(data, 8));
+ LOGMASKED(LOG_IO_WRITES, " LVDEn:%d, LVDVoltSel:%s, 32kHzDisable:%d, StrWkMode:%s, VDACDisable:%d, ADACDisable:%d, ADACOutDisable:%d)\n"
+ , BIT(data, 7), s_lvd_voltage[(data >> 5) & 3], BIT(data, 4), s_weak_strong[BIT(data, 3)], BIT(data, 2), BIT(data, 1), BIT(data, 0));
+ m_io_regs[offset] = data;
+ break;
+ }
+
+ case 0x21: // IRQ Enable
+ {
+ LOGMASKED(LOG_IRQS, "io_w: IRQ Enable = %04x\n", data);
+ const uint16_t old = IO_IRQ_ENABLE & IO_IRQ_STATUS;
+ m_io_regs[offset] = data;
+ const uint16_t changed = old ^ (IO_IRQ_ENABLE & IO_IRQ_STATUS);
+ if (changed)
+ check_irqs(changed);
+ break;
+ }
+
+ case 0x22: // IRQ Acknowledge
+ {
+ LOGMASKED(LOG_IRQS, "io_w: IRQ Acknowledge = %04x\n", data);
+ const uint16_t old = IO_IRQ_STATUS;
+ IO_IRQ_STATUS &= ~data;
+ const uint16_t changed = old ^ (IO_IRQ_ENABLE & IO_IRQ_STATUS);
+ if (changed)
+ check_irqs(changed);
+ break;
+ }
+
+ case 0x23: // External Memory Control
+ {
+ static const char* const s_bus_arb[8] =
+ {
+ "Forbidden", "Forbidden", "Forbidden", "Forbidden", "Forbidden", "1:SPU/2:PPU/3:CPU", "Forbidden", "1:PPU/2:SPU/3:CPU"
+ };
+ static const char* const s_addr_decode[4] =
+ {
+ "ROMCSB: 4000-3fffff, CSB1: ---, CSB2: ---, CSB3: ---",
+ "ROMCSB: 4000-1fffff, CSB1: 200000-3fffff, CSB2: ---, CSB3: ---",
+ "ROMCSB: 4000-0fffff, CSB1: 100000-1fffff, CSB2: 200000-2fffff, CSB3: 300000-3fffff",
+ "ROMCSB: 4000-0fffff, CSB1: 100000-1fffff, CSB2: 200000-2fffff, CSB3: 300000-3fffff"
+ };
+ static const char* const s_ram_decode[16] =
+ {
+ "None", "None", "None", "None", "None", "None", "None", "None",
+ "4KW, 3ff000-3fffff\n",
+ "8KW, 3fe000-3fffff\n",
+ "16KW, 3fc000-3fffff\n",
+ "32KW, 3f8000-3fffff\n",
+ "64KW, 3f0000-3fffff\n",
+ "128KW, 3e0000-3fffff\n",
+ "256KW, 3c0000-3fffff\n",
+ "512KW, 380000-3fffff\n"
+ };
+ LOGMASKED(LOG_IO_WRITES, "io_w: Ext. Memory Control (not yet implemented) = %04x:\n", data);
+ LOGMASKED(LOG_IO_WRITES, " WaitStates:%d, BusArbPrio:%s\n", (data >> 1) & 3, s_bus_arb[(data >> 3) & 7]);
+ LOGMASKED(LOG_IO_WRITES, " ROMAddrDecode:%s\n", s_addr_decode[(data >> 6) & 3]);
+ LOGMASKED(LOG_IO_WRITES, " RAMAddrDecode:%s\n", s_ram_decode[(data >> 8) & 15]);
+ m_chip_sel((data >> 6) & 3);
+ m_io_regs[offset] = data;
+ break;
+ }
+
+ case 0x24: // Watchdog
+ LOGMASKED(LOG_WATCHDOG, "io_w: Watchdog Pet = %04x\n", data);
+ break;
+
+ case 0x25: // ADC Control
+ {
+ LOGMASKED(LOG_IO_WRITES, "io_w: ADC Control = %04x\n", data);
+ //const uint16_t changed = m_io_regs[offset] ^ data;
+ m_io_regs[offset] = data;
+ //if (BIT(changed, 12) && BIT(data, 12) && !BIT(m_io_regs[offset], 1))
+ {
+ //m_io_regs[0x27] = 0x80ff;
+ //const uint16_t old = IO_IRQ_STATUS;
+ //IO_IRQ_STATUS |= 0x2000;
+ //const uint16_t changed = IO_IRQ_STATUS ^ old;
+ //if (changed)
+ //check_irqs(changed);
+ }
+ break;
+ }
+
+ case 0x28: // Sleep Mode
+ LOGMASKED(LOG_IO_WRITES, "io_w: Sleep Mode (%s enter value) = %04x\n", data == 0xaa55 ? "valid" : "invalid", data);
+ m_io_regs[offset] = data;
+ break;
+
+ case 0x29: // Wakeup Source
+ {
+ m_io_regs[offset] = data;
+ static const char* const s_sources[8] =
+ {
+ "TMB1", "TMB2", "2Hz", "4Hz", "1024Hz", "2048Hz", "4096Hz", "Key"
+ };
+
+ LOGMASKED(LOG_IO_WRITES, "io_w: Wakeup Source = %04x:\n", data);
+ bool comma = false;
+ char buf[1024];
+ int char_idx = 0;
+ for (int i = 7; i >= 0; i--)
+ {
+ if (BIT(data, i))
+ {
+ char_idx += sprintf(&buf[char_idx], "%s%s", comma ? ", " : "", s_sources[i]);
+ comma = true;
+ }
+ }
+ buf[char_idx] = 0;
+ LOGMASKED(LOG_IO_WRITES, " %s\n", buf);
+ break;
+ }
+
+ case 0x2e: // FIQ Source Select
+ {
+ static const char* const s_fiq_select[8] =
+ {
+ "PPU", "SPU Channel", "Timer A", "Timer B", "UART/SPI", "External", "Reserved", "None"
+ };
+ LOGMASKED(LOG_IRQS, "io_w: FIQ Source Select (not yet implemented) = %04x, %s\n", data, s_fiq_select[data & 7]);
+ m_io_regs[offset] = data;
+ break;
+ }
+
+ case 0x2f: // Data Segment
+ {
+ uint16_t ds = m_cpu->state_int(UNSP_SR);
+ m_cpu->set_state_int(UNSP_SR, (ds & 0x03ff) | ((data & 0x3f) << 10));
+ LOGMASKED(LOG_SEGMENT, "io_w: Data Segment = %04x\n", data);
+ break;
+ }
+
+ case 0x30: // UART Control
+ {
+ static const char* const s_9th_bit[4] = { "0", "1", "Odd", "Even" };
+ LOGMASKED(LOG_UART, "io_w: UART Control = %04x (TxEn:%d, RxEn:%d, Bits:%d, MultiProc:%d, 9thBit:%s, TxIntEn:%d, RxIntEn:%d\n", data
+ , BIT(data, 7), BIT(data, 6), BIT(data, 5) ? 9 : 8, BIT(data, 4), s_9th_bit[(data >> 2) & 3], BIT(data, 1), BIT(data, 0));
+ const uint16_t changed = m_io_regs[offset] ^ data;
+ m_io_regs[offset] = data;
+ if (!BIT(data, 6))
+ {
+ m_uart_rx_available = false;
+ m_io_regs[0x36] = 0;
+ }
+ if (BIT(changed, 7) && BIT(data, 7))
+ {
+ m_io_regs[0x31] |= 0x0002;
+ }
+ break;
+ }
+
+ case 0x31: // UART Status
+ LOGMASKED(LOG_UART, "io_w: UART Status = %04x\n", data);
+ m_io_regs[offset] &= ~data;
+ break;
+
+ case 0x33: // UART Baud Rate (low byte)
+ case 0x34: // UART Baud Rate (high byte)
+ {
+ m_io_regs[offset] = data;
+ const uint32_t divisor = 16 * (0x10000 - ((m_io_regs[0x34] << 8) | m_io_regs[0x33]));
+ LOGMASKED(LOG_UART, "io_w: UART Baud Rate (%s byte): Baud rate = %d\n", offset == 0x33 ? "low" : "high", 27000000 / divisor);
+ break;
+ }
+
+ case 0x35: // UART TX Data
+ LOGMASKED(LOG_UART, "io_w: UART Tx Data = %02x\n", data & 0x00ff);
+ m_io_regs[offset] = data;
+ m_uart_tx((uint8_t)data);
+ m_io_regs[0x31] |= 2;
+ break;
+
+ case 0x36: // UART RX Data
+ LOGMASKED(LOG_UART, "io_w: UART Rx Data (read-only) = %04x\n", data);
+ break;
+
+ case 0x37: // UART Rx FIFO Control
+ LOGMASKED(LOG_UART, "io_w: UART Rx FIFO Control = %04x (Reset:%d, Overrun:%d, Underrun:%d, Count:%d, Threshold:%d)\n", data
+ , BIT(data, 15), BIT(data, 14), BIT(data, 13), (data >> 4) & 7, data & 7);
+ if (data & 0x8000)
+ {
+ m_uart_rx_available = false;
+ m_io_regs[0x36] = 0;
+ }
+ m_io_regs[offset] &= ~data & 0x6000;
+ m_io_regs[offset] &= ~0x0007;
+ m_io_regs[offset] |= data & 0x0007;
+ break;
+
+ case 0x58: // I2C Command
+ LOGMASKED(LOG_I2C, "io_w: I2C Command = %04x\n", data);
+ m_io_regs[offset] = data;
+ do_i2c();
+ break;
+
+ case 0x59: // I2C Status / Acknowledge
+ LOGMASKED(LOG_I2C, "io_w: I2C Acknowledge = %04x\n", data);
+ m_io_regs[offset] &= ~data;
+ break;
+
+ case 0x5a: // I2C Access Mode
+ LOGMASKED(LOG_I2C, "io_w: I2C Access Mode = %04x\n", data);
+ m_io_regs[offset] = data;
+ break;
+
+ case 0x5b: // I2C Device Address
+ LOGMASKED(LOG_I2C, "io_w: I2C Device Address = %04x\n", data);
+ m_io_regs[offset] = data;
+ break;
+
+ case 0x5c: // I2C Sub-Address
+ LOGMASKED(LOG_I2C, "io_w: I2C Sub-Address = %04x\n", data);
+ m_io_regs[offset] = data;
+ break;
+
+ case 0x5d: // I2C Data Out
+ LOGMASKED(LOG_I2C, "io_w: I2C Data Out = %04x\n", data);
+ m_io_regs[offset] = data;
+ break;
+
+ case 0x5e: // I2C Data In
+ LOGMASKED(LOG_I2C, "io_w: I2C Data In = %04x\n", data);
+ m_io_regs[offset] = data;
+ break;
+
+ case 0x5f: // I2C Controller Mode
+ LOGMASKED(LOG_I2C, "io_w: I2C Controller Mode = %04x\n", data);
+ m_io_regs[offset] = data;
+ break;
+
+ case 0x100: // DMA Source (lo)
+ LOGMASKED(LOG_DMA, "io_w: DMA Source (lo) = %04x\n", data);
+ m_io_regs[offset] = data;
+ break;
+
+ case 0x101: // DMA Source (hi)
+ LOGMASKED(LOG_DMA, "io_w: DMA Source (hi) = %04x\n", data);
+ m_io_regs[offset] = data;
+ break;
+
+ case 0x103: // DMA Destination
+ LOGMASKED(LOG_DMA, "io_w: DMA Dest = %04x\n", data);
+ m_io_regs[offset] = data;
+ break;
+
+ case 0x102: // DMA Length
+ LOGMASKED(LOG_DMA, "io_w: DMA Length = %04x\n", data);
+ do_cpu_dma(data);
break;
default:
- LOGMASKED(LOG_UNKNOWN_IO, "dma_w: Unknown register %04x = %04x\n", 0x3d00 + offset, data);
- m_dma_regs[offset] = data;
+ LOGMASKED(LOG_UNKNOWN_IO, "io_w: Unknown register %04x = %04x\n", 0x3d00 + offset, data);
+ m_io_regs[offset] = data;
break;
}
}
@@ -969,29 +1396,145 @@ void spg2xx_device::device_timer(emu_timer &timer, device_timer_id id, int param
{
switch (id)
{
+ case TIMER_TMB1:
+ {
+ LOGMASKED(LOG_TIMERS, "TMB1 elapsed, setting IRQ Status bit 0 (old:%04x, new:%04x, enable:%04x)\n", IO_IRQ_STATUS, IO_IRQ_STATUS | 1, IO_IRQ_ENABLE);
+ IO_IRQ_STATUS |= 1;
+ check_irqs(0x0001);
+ break;
+ }
+
+ case TIMER_TMB2:
+ {
+ LOGMASKED(LOG_TIMERS, "TMB2 elapsed, setting IRQ Status bit 1 (old:%04x, new:%04x, enable:%04x)\n", IO_IRQ_STATUS, IO_IRQ_STATUS | 2, IO_IRQ_ENABLE);
+ IO_IRQ_STATUS |= 2;
+ check_irqs(0x0002);
+ break;
+ }
+
case TIMER_SCREENPOS:
{
- if (VIDEO_IRQ_ENABLE & 2)
+ const uint16_t old = VIDEO_IRQ_ENABLE & VIDEO_IRQ_STATUS;
+ VIDEO_IRQ_STATUS |= 2;
+ const uint16_t changed = old ^ (VIDEO_IRQ_ENABLE & VIDEO_IRQ_STATUS);
+ if (changed)
{
- VIDEO_IRQ_STATUS |= 2;
check_video_irq();
}
m_screen->update_partial(m_screen->vpos());
+ break;
+ }
- // fire again, jak_dbz pinball needs this
- m_screenpos_timer->adjust(m_screen->time_until_pos(m_video_regs[0x36], m_video_regs[0x37] << 1));
+ case TIMER_BEAT:
+ {
+ audio_frame_tick();
break;
}
}
}
+void spg2xx_device::check_irqs(const uint16_t changed)
+{
+ // {
+ // m_cpu->set_input_line(UNSP_IRQ1_LINE, ASSERT_LINE);
+ // }
+
+ if (changed & 0x0c00) // Timer A, Timer B IRQ
+ {
+ LOGMASKED(LOG_IRQS, "%ssserting IRQ2 (%04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b));
+ m_cpu->set_input_line(UNSP_IRQ2_LINE, (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0c00) ? ASSERT_LINE : CLEAR_LINE);
+ }
+
+ if (changed & 0x2100) // UART, ADC IRQ
+ {
+ LOGMASKED(LOG_IRQS, "%ssserting IRQ3 (%04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b));
+ m_cpu->set_input_line(UNSP_IRQ3_LINE, (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x2100) ? ASSERT_LINE : CLEAR_LINE);
+ }
+
+ if (changed & (AUDIO_BIS_MASK | AUDIO_BIE_MASK)) // Beat IRQ
+ {
+ if ((m_audio_regs[AUDIO_BEAT_COUNT] & (AUDIO_BIS_MASK | AUDIO_BIE_MASK)) == (AUDIO_BIS_MASK | AUDIO_BIE_MASK))
+ {
+ LOGMASKED(LOG_BEAT, "Asserting beat IRQ\n");
+ m_cpu->set_input_line(UNSP_IRQ4_LINE, ASSERT_LINE);
+ }
+ else
+ {
+ LOGMASKED(LOG_BEAT, "Clearing beat IRQ\n");
+ m_cpu->set_input_line(UNSP_IRQ4_LINE, CLEAR_LINE);
+ }
+ }
+
+ if (changed & 0x1200) // External IRQ
+ {
+ LOGMASKED(LOG_IRQS, "%ssserting IRQ5 (%04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b));
+ m_cpu->set_input_line(UNSP_IRQ5_LINE, (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x1200) ? ASSERT_LINE : CLEAR_LINE);
+ }
+
+ if (changed & 0x0070) // 1024Hz, 2048Hz, 4096Hz IRQ
+ {
+ LOGMASKED(LOG_IRQS, "%ssserting IRQ6 (%04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b));
+ m_cpu->set_input_line(UNSP_IRQ6_LINE, (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0070) ? ASSERT_LINE : CLEAR_LINE);
+ }
+
+ if (changed & 0x008b) // TMB1, TMB2, 4Hz, key change IRQ
+ {
+ LOGMASKED(LOG_IRQS, "%ssserting IRQ7 (%04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b));
+ m_cpu->set_input_line(UNSP_IRQ7_LINE, (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b) ? ASSERT_LINE : CLEAR_LINE);
+ }
+}
+
+void spg2xx_device::do_gpio(uint32_t offset)
+{
+ uint32_t index = (offset - 1) / 5;
+ uint16_t buffer = m_io_regs[5 * index + 2];
+ uint16_t dir = m_io_regs[5 * index + 3];
+ uint16_t attr = m_io_regs[5 * index + 4];
+ uint16_t special = m_io_regs[5 * index + 5];
+
+ uint16_t push = dir;
+ uint16_t pull = (~dir) & (~attr);
+ uint16_t what = (buffer & (push | pull));
+ what ^= (dir & ~attr);
+ what &= ~special;
+
+ switch (index)
+ {
+ case 0:
+ m_porta_out(0, what, push &~ special);
+ what = (what & ~pull) | (m_porta_in(0, pull &~ special) & pull);
+ break;
+ case 1:
+ m_portb_out(0, what, push &~ special);
+ what = (what & ~pull) | (m_portb_in(0, pull &~ special) & pull);
+ break;
+ case 2:
+ m_portc_out(0, what, push &~ special);
+ what = (what & ~pull) | (m_portc_in(0, pull &~ special) & pull);
+ break;
+ }
+
+ m_io_regs[5 * index + 1] = what;
+}
+
+void spg2xx_device::do_i2c()
+{
+ const uint16_t addr = ((m_io_regs[0x5b] & 0x06) << 7) | (uint8_t)m_io_regs[0x5c];
+
+ if (m_io_regs[0x58] & 0x40) // Serial EEPROM read
+ m_io_regs[0x5e] = m_eeprom_r(addr);
+ else
+ m_eeprom_w(addr, m_io_regs[0x5d]);
+
+ m_io_regs[0x59] |= 1;
+}
void spg2xx_device::do_cpu_dma(uint32_t len)
{
address_space &mem = m_cpu->space(AS_PROGRAM);
- uint32_t src = ((m_dma_regs[0x001] & 0x3f) << 16) | m_dma_regs[0x000];
- uint32_t dst = m_dma_regs[0x003] & 0x3fff;
+ uint32_t src = ((m_io_regs[0x101] & 0x3f) << 16) | m_io_regs[0x100];
+ uint32_t dst = m_io_regs[0x103] & 0x3fff;
for (uint32_t j = 0; j < len; j++)
{
@@ -999,56 +1542,1128 @@ void spg2xx_device::do_cpu_dma(uint32_t len)
}
src += len;
- m_dma_regs[0x000] = (uint16_t)src;
- m_dma_regs[0x001] = (src >> 16) & 0x3f;
- m_dma_regs[0x002] = 0;
- m_dma_regs[0x003] = (dst + len) & 0x3fff;
+ m_io_regs[0x100] = (uint16_t)src;
+ m_io_regs[0x101] = (src >> 16) & 0x3f;
+ m_io_regs[0x102] = 0;
+ m_io_regs[0x103] = (dst + len) & 0x3fff;
+}
+
+/***********************
+* Audio Hardware *
+***********************/
+
+READ16_MEMBER(spg2xx_device::audio_r)
+{
+ const uint16_t channel = (offset & 0x00f0) >> 4;
+ uint16_t data = m_audio_regs[offset];
+
+ if (offset >= 0x400)
+ {
+ switch (offset)
+ {
+ case AUDIO_CHANNEL_ENABLE:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Channel Enable: %04x\n", data);
+ break;
+
+ case AUDIO_MAIN_VOLUME:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Main Volume: %04x\n", data);
+ break;
+
+ case AUDIO_CHANNEL_FIQ_ENABLE:
+ LOGMASKED(LOG_SPU_READS | LOG_IRQS, "audio_r: Channel FIQ Enable: %04x\n", data);
+ break;
+
+ case AUDIO_CHANNEL_FIQ_STATUS:
+ LOGMASKED(LOG_SPU_READS | LOG_IRQS, "audio_r: Channel FIQ Acknowledge: %04x\n", data);
+ break;
+
+ case AUDIO_BEAT_BASE_COUNT:
+ LOGMASKED(LOG_SPU_READS | LOG_BEAT, "audio_r: Beat Base Count: %04x\n", data);
+ break;
+
+ case AUDIO_BEAT_COUNT:
+ LOGMASKED(LOG_SPU_READS | LOG_BEAT, "audio_r: Beat Count: %04x\n", data);
+ break;
+
+ case AUDIO_ENVCLK0:
+ case AUDIO_ENVCLK1:
+ LOGMASKED(LOG_SPU_READS | LOG_ENVELOPES, "audio_r: Envelope Interval %d (lo): %04x\n", offset == AUDIO_ENVCLK0 ? 0 : 1, data);
+ break;
+
+ case AUDIO_ENVCLK0_HIGH:
+ case AUDIO_ENVCLK1_HIGH:
+ LOGMASKED(LOG_SPU_READS | LOG_ENVELOPES, "audio_r: Envelope Interval %d (hi): %04x\n", offset == AUDIO_ENVCLK0_HIGH ? 0 : 1, data);
+ break;
+
+ case AUDIO_ENV_RAMP_DOWN:
+ LOGMASKED(LOG_SPU_READS | LOG_RAMPDOWN, "audio_r: Envelope Fast Ramp Down: %04x\n", data);
+ break;
+
+ case AUDIO_CHANNEL_STOP:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Channel Stop Status: %04x\n", data);
+ break;
+
+ case AUDIO_CHANNEL_ZERO_CROSS:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Channel Zero-Cross Enable: %04x\n", data);
+ break;
+
+ case AUDIO_CONTROL:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Control: %04x\n", data);
+ break;
+
+ case AUDIO_COMPRESS_CTRL:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Compressor Control: %04x\n", data);
+ break;
+
+ case AUDIO_CHANNEL_STATUS:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Channel Status: %04x\n", data);
+ break;
+
+ case AUDIO_WAVE_IN_L:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Wave In (L) / FIFO Write Data: %04x\n", data);
+ break;
+
+ case AUDIO_WAVE_IN_R:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Wave In (R) / Software Channel FIFO IRQ Control: %04x\n", data);
+ break;
+
+ case AUDIO_WAVE_OUT_L:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Wave Out (L): %04x\n", data);
+ break;
+
+ case AUDIO_WAVE_OUT_R:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Wave Out (R): %04x\n", data);
+ break;
+
+ case AUDIO_CHANNEL_REPEAT:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Channel Repeat Enable: %04x\n", data);
+ break;
+
+ case AUDIO_CHANNEL_ENV_MODE:
+ LOGMASKED(LOG_SPU_READS | LOG_ENVELOPES, "audio_r: Channel Envelope Enable: %04x\n", data);
+ break;
+
+ case AUDIO_CHANNEL_TONE_RELEASE:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Channel Tone Release Enable: %04x\n", data);
+ break;
+
+ case AUDIO_CHANNEL_ENV_IRQ:
+ LOGMASKED(LOG_SPU_READS | LOG_IRQS, "audio_r: Channel Envelope IRQ Status: %04x\n", data);
+ break;
+
+ case AUDIO_CHANNEL_PITCH_BEND:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Channel Pitch Bend Enable: %04x\n", data);
+ break;
+
+ case AUDIO_SOFT_PHASE:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Software Channel Phase: %04x\n", data);
+ break;
+
+ case AUDIO_ATTACK_RELEASE:
+ LOGMASKED(LOG_SPU_READS, "audio_r: Attack/Release Time Control: %04x\n", data);
+ break;
+
+ case AUDIO_EQ_CUTOFF10:
+ LOGMASKED(LOG_SPU_READS, "audio_r: EQ Cutoff Frequency 0/1: %04x\n", data);
+ break;
+
+ case AUDIO_EQ_CUTOFF32:
+ LOGMASKED(LOG_SPU_READS, "audio_r: EQ Cutoff Frequency 2/3: %04x\n", data);
+ break;
+
+ case AUDIO_EQ_GAIN10:
+ LOGMASKED(LOG_SPU_READS, "audio_r: EQ Cutoff Gain 0/1: %04x\n", data);
+ break;
+
+ case AUDIO_EQ_GAIN32:
+ LOGMASKED(LOG_SPU_READS, "audio_r: EQ Cutoff Gain 2/3: %04x\n", data);
+ break;
+
+ default:
+ LOGMASKED(LOG_UNKNOWN_SPU, "audio_r: Unknown register %04x = %04x\n", 0x3000 + offset, data);
+ break;
+ }
+ }
+ else if (channel < 16)
+ {
+ switch (offset & AUDIO_CHAN_OFFSET_MASK)
+ {
+ case AUDIO_WAVE_ADDR:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Wave Addr (lo): %04x\n", channel, data);
+ break;
+
+ case AUDIO_MODE:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Mode: %04x (ADPCM:%d, 16M:%d, TONE:%d, LADDR_HI:%04x, WADDR_HI:%04x)\n", channel, data,
+ get_adpcm_bit(channel), get_16bit_bit(channel), get_tone_mode(channel), get_loop_addr_high(channel), get_wave_addr_high(channel));
+ break;
+
+ case AUDIO_LOOP_ADDR:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Loop Addr: %04x\n", channel, data);
+ break;
+
+ case AUDIO_PAN_VOL:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Pan/Vol: %04x (PAN:%02x, VOL:%02x)\n", channel, data,
+ get_pan(channel), get_volume(channel));
+ break;
+
+ case AUDIO_ENVELOPE0:
+ LOGMASKED(LOG_CHANNEL_READS | LOG_ENVELOPES, "audio_r: Channel %d: Envelope0: %04x (RPTPER:%d, TARGET:%02x, SIGN:%d, INC:%02x)\n", channel, data,
+ get_repeat_period_bit(channel), get_envelope_target(channel), get_envelope_sign_bit(channel), get_envelope_inc(channel));
+ break;
+
+ case AUDIO_ENVELOPE_DATA:
+ LOGMASKED(LOG_CHANNEL_READS | LOG_ENVELOPES, "audio_r: Channel %d: Envelope Data: %04x (CNT:%d, EDD:%02x)\n", channel, data,
+ get_envelope_count(channel), get_edd(channel));
+ break;
+
+ case AUDIO_ENVELOPE1:
+ LOGMASKED(LOG_CHANNEL_READS | LOG_ENVELOPES, "audio_r: Channel %d: Envelope1 Data: %04x (RPTCNT:%02x, RPT:%d, LOAD:%02x)\n", channel, data,
+ get_envelope_repeat_count(channel), get_envelope_repeat_bit(channel), get_envelope_load(channel));
+ break;
+
+ case AUDIO_ENVELOPE_ADDR_HIGH:
+ LOGMASKED(LOG_CHANNEL_READS | LOG_ENVELOPES, "audio_r: Channel %d: Envelope Addr (hi): %04x (IRQADDR:%03x, IRQEN:%d, EADDR_HI:%02x)\n", channel, data,
+ get_audio_irq_addr(channel), get_audio_irq_enable_bit(channel), get_envelope_addr_high(channel));
+ break;
+
+ case AUDIO_ENVELOPE_ADDR:
+ LOGMASKED(LOG_CHANNEL_READS | LOG_ENVELOPES, "audio_r: Channel %d: Envelope Addr (lo): %04x \n", channel, data);
+ break;
+
+ case AUDIO_WAVE_DATA_PREV:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Wave Data Prev: %04x \n", channel, data);
+ break;
+
+ case AUDIO_ENVELOPE_LOOP_CTRL:
+ LOGMASKED(LOG_CHANNEL_READS | LOG_ENVELOPES, "audio_r: Channel %d: Envelope Loop Ctrl: %04x (RDOFFS:%02x, EAOFFS:%03x)\n", channel, data,
+ get_rampdown_offset(channel), get_envelope_eaoffset(channel));
+ break;
+
+ case AUDIO_WAVE_DATA:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Wave Data: %04x\n", channel, data);
+ break;
+
+ case AUDIO_ADPCM_SEL:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: ADPCM Sel: %04x (ADPCM36:%d, POINTNUM:%02x\n", channel, data,
+ get_adpcm36_bit(channel), get_point_number(channel));
+ break;
+
+ case AUDIO_PHASE_HIGH:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Phase High: %04x\n", channel, data);
+ break;
+
+ case AUDIO_PHASE_ACCUM_HIGH:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Phase Accum High: %04x\n", channel, data);
+ break;
+
+ case AUDIO_TARGET_PHASE_HIGH:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Target Phase High: %04x\n", channel, data);
+ break;
+
+ case AUDIO_RAMP_DOWN_CLOCK:
+ LOGMASKED(LOG_CHANNEL_READS | LOG_RAMPDOWN, "audio_r: Channel %d: Rampdown Clock: %04x\n", channel, data);
+ break;
+
+ case AUDIO_PHASE:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Phase: %04x\n", channel, data);
+ break;
+
+ case AUDIO_PHASE_ACCUM:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Phase Accum: %04x\n", channel, data);
+ break;
+
+ case AUDIO_TARGET_PHASE:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Target Phase: %04x\n", channel, data);
+ break;
+
+ case AUDIO_PHASE_CTRL:
+ LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Phase Ctrl: %04x (TIMESTEP:%d, SIGN:%d, OFFSET:%03x\n", channel, data,
+ get_phase_time_step(channel), get_phase_sign_bit(channel), get_phase_offset(channel));
+ break;
+
+ default:
+ LOGMASKED(LOG_UNKNOWN_SPU, "audio_r: Unknown register %04x\n", 0x3000 + offset);
+ break;
+ }
+ }
+ else if (channel >= 16)
+ {
+ LOGMASKED(LOG_UNKNOWN_SPU, "audio_r: Trying to read from channel %d\n", channel);
+ }
+ return data;
}
-void spg2xx_device::configure_spg_io(spg2xx_io_device* io)
+WRITE16_MEMBER(spg2xx_device::audio_w)
{
- io->porta_in().set(FUNC(spg2xx_device::porta_r));
- io->portb_in().set(FUNC(spg2xx_device::portb_r));
- io->portc_in().set(FUNC(spg2xx_device::portc_r));
- io->porta_out().set(FUNC(spg2xx_device::porta_w));
- io->portb_out().set(FUNC(spg2xx_device::portb_w));
- io->portc_out().set(FUNC(spg2xx_device::portc_w));
- io->adc_in<0>().set(FUNC(spg2xx_device::adc_r<0>));
- io->adc_in<1>().set(FUNC(spg2xx_device::adc_r<1>));
- io->eeprom_w().set(FUNC(spg2xx_device::eepromx_w));
- io->eeprom_r().set(FUNC(spg2xx_device::eepromx_r));
- io->uart_tx().set(FUNC(spg2xx_device::tx_w));
- io->chip_select().set(FUNC(spg2xx_device::cs_w));
- io->pal_read_callback().set(FUNC(spg2xx_device::get_pal_r));
- io->write_timer_irq_callback().set(FUNC(spg2xx_device::timerirq_w));
- io->write_uart_adc_irq_callback().set(FUNC(spg2xx_device::uartirq_w));
- io->write_external_irq_callback().set(FUNC(spg2xx_device::extirq_w));
- io->write_ffrq_tmr1_irq_callback().set(FUNC(spg2xx_device::ffreq1_w));
- io->write_ffrq_tmr2_irq_callback().set(FUNC(spg2xx_device::ffreq2_w));
+ const uint16_t channel = (offset & 0x00f0) >> 4;
+
+ if (offset >= 0x400)
+ {
+ switch (offset)
+ {
+ case AUDIO_CHANNEL_ENABLE:
+ {
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Channel Enable: %04x\n", data);
+ const uint16_t changed = m_audio_regs[AUDIO_CHANNEL_ENABLE] ^ data;
+ for (uint32_t channel_bit = 0; channel_bit < 16; channel_bit++)
+ {
+ const uint16_t mask = 1 << channel_bit;
+ if (!(changed & mask))
+ continue;
+
+ if (data & mask)
+ {
+ if (!(m_audio_regs[AUDIO_CHANNEL_STATUS] & mask))
+ {
+ LOGMASKED(LOG_SPU_WRITES, "Enabling channel %d\n", channel_bit);
+ m_audio_regs[offset] |= mask;
+ if (!(m_audio_regs[AUDIO_CHANNEL_STOP] & mask))
+ {
+ LOGMASKED(LOG_SPU_WRITES, "Stop not set, starting playback on channel %d, mask %04x\n", channel_bit, mask);
+ m_audio_regs[AUDIO_CHANNEL_STATUS] |= mask;
+ m_sample_addr[channel_bit] = get_wave_addr(channel_bit);
+ m_envelope_addr[channel_bit] = get_envelope_addr(channel_bit);
+ set_envelope_count(channel, get_envelope_load(channel));
+ }
+ m_adpcm[channel_bit].reset();
+ m_sample_shift[channel_bit] = 0;
+ m_sample_count[channel_bit] = 0;
+ }
+ }
+ else
+ {
+ m_audio_regs[offset] &= ~mask;
+ m_audio_regs[AUDIO_CHANNEL_STATUS] &= ~mask;
+ m_audio_regs[AUDIO_CHANNEL_STOP] |= mask;
+ m_audio_regs[AUDIO_CHANNEL_TONE_RELEASE] &= ~mask;
+ }
+ }
+ break;
+ }
+
+ case AUDIO_MAIN_VOLUME:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Main Volume: %04x\n", data);
+ m_audio_regs[offset] = data & AUDIO_MAIN_VOLUME_MASK;
+ break;
+
+ case AUDIO_CHANNEL_FIQ_ENABLE:
+ LOGMASKED(LOG_SPU_WRITES | LOG_IRQS, "audio_w: Channel FIQ Enable: %04x\n", data);
+ m_audio_regs[offset] = data & AUDIO_CHANNEL_FIQ_ENABLE_MASK;
+ break;
+
+ case AUDIO_CHANNEL_FIQ_STATUS:
+ LOGMASKED(LOG_SPU_WRITES | LOG_IRQS, "audio_w: Channel FIQ Acknowledge: %04x\n", data);
+ m_audio_regs[offset] &= ~(data & AUDIO_CHANNEL_FIQ_STATUS_MASK);
+ break;
+
+ case AUDIO_BEAT_BASE_COUNT:
+ LOGMASKED(LOG_SPU_WRITES | LOG_BEAT, "audio_w: Beat Base Count: %04x\n", data);
+ m_audio_regs[offset] = data & AUDIO_BEAT_BASE_COUNT_MASK;
+ m_audio_curr_beat_base_count = m_audio_regs[offset];
+ break;
+
+ case AUDIO_BEAT_COUNT:
+ {
+ LOGMASKED(LOG_SPU_WRITES | LOG_BEAT, "audio_w: Beat Count: %04x\n", data);
+ const uint16_t old = m_audio_regs[offset];
+ m_audio_regs[offset] &= ~(data & AUDIO_BIS_MASK);
+ m_audio_regs[offset] &= AUDIO_BIS_MASK;
+ m_audio_regs[offset] |= data & ~AUDIO_BIS_MASK;
+ const uint16_t changed = old ^ m_audio_regs[offset];
+ if (data == 0xc000 && m_audio_regs[offset])
+ {
+ }
+ if (changed & (AUDIO_BIS_MASK | AUDIO_BIE_MASK))
+ {
+ LOGMASKED(LOG_BEAT, "BIS mask changed, updating IRQ\n");
+ check_irqs(changed & (AUDIO_BIS_MASK | AUDIO_BIE_MASK));
+ }
+ break;
+ }
+
+ case AUDIO_ENVCLK0:
+ case AUDIO_ENVCLK1:
+ {
+ LOGMASKED(LOG_SPU_WRITES | LOG_ENVELOPES, "audio_w: Envelope Interval %d (lo): %04x\n", offset == AUDIO_ENVCLK0 ? 0 : 1, data);
+ const uint16_t old = m_audio_regs[offset];
+ m_audio_regs[offset] = data;
+ const uint16_t changed = old ^ m_audio_regs[offset];
+
+ if (!changed)
+ break;
+
+ const uint8_t channel_offset = offset == AUDIO_ENVCLK0 ? 0 : 8;
+ for (uint8_t channel_bit = 0; channel_bit < 4; channel_bit++)
+ {
+ const uint8_t shift = channel_bit << 2;
+ const uint16_t mask = 0x0f << shift;
+ if (changed & mask)
+ {
+ m_envclk_frame[channel_bit + channel_offset] = get_envclk_frame_count(channel_bit + channel_offset);
+ }
+ }
+ break;
+ }
+
+ case AUDIO_ENVCLK0_HIGH:
+ case AUDIO_ENVCLK1_HIGH:
+ {
+ LOGMASKED(LOG_SPU_WRITES | LOG_ENVELOPES, "audio_w: Envelope Interval %d (hi): %04x\n", offset == AUDIO_ENVCLK0_HIGH ? 0 : 1, data);
+ const uint16_t old = m_audio_regs[offset];
+ m_audio_regs[offset] = data;
+ const uint16_t changed = old ^ m_audio_regs[offset];
+ if (!changed)
+ break;
+
+ const uint8_t channel_offset = offset == AUDIO_ENVCLK0_HIGH ? 0 : 8;
+ for (uint8_t channel_bit = 0; channel_bit < 4; channel_bit++)
+ {
+ const uint8_t shift = channel_bit << 2;
+ const uint16_t mask = 0x0f << shift;
+ if (changed & mask)
+ {
+ m_envclk_frame[channel_bit + channel_offset + 4] = get_envclk_frame_count(channel_bit + channel_offset);
+ }
+ }
+ break;
+ }
+
+ case AUDIO_ENV_RAMP_DOWN:
+ {
+ LOGMASKED(LOG_SPU_WRITES | LOG_RAMPDOWN, "audio_w: Envelope Fast Ramp Down: %04x\n", data);
+ const uint16_t old = m_audio_regs[offset];
+ m_audio_regs[offset] = data & AUDIO_ENV_RAMP_DOWN_MASK;
+ const uint16_t changed = old ^ m_audio_regs[offset];
+ if (!changed)
+ break;
+
+ for (uint32_t channel_bit = 0; channel_bit < 16; channel_bit++)
+ {
+ const uint16_t mask = 1 << channel_bit;
+ if ((changed & mask) && (data & mask))
+ {
+ m_rampdown_frame[channel_bit] = get_rampdown_frame_count(channel_bit);
+ LOGMASKED(LOG_RAMPDOWN, "Preparing to ramp down channel %d in %d ticks\n", channel_bit, m_rampdown_frame[channel_bit] / 13);
+ }
+ }
+ break;
+ }
+
+ case AUDIO_CHANNEL_STOP:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Channel Stop Status: %04x\n", data);
+ m_audio_regs[offset] &= ~data;
+ m_audio_regs[AUDIO_CHANNEL_ENABLE] &= ~data;
+ break;
+
+ case AUDIO_CHANNEL_ZERO_CROSS:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Channel Zero-Cross Enable: %04x\n", data);
+ m_audio_regs[offset] = data & AUDIO_CHANNEL_ZERO_CROSS_MASK;
+ break;
+
+ case AUDIO_CONTROL:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Control: %04x (SOFTCH:%d, COMPEN:%d, NOHIGH:%d, NOINT:%d, EQEN:%d\n", data
+ , (data & AUDIO_CONTROL_SOFTCH_MASK) ? 1 : 0
+ , (data & AUDIO_CONTROL_COMPEN_MASK) ? 1 : 0
+ , (data & AUDIO_CONTROL_NOHIGH_MASK) ? 1 : 0
+ , (data & AUDIO_CONTROL_NOINT_MASK) ? 1 : 0
+ , (data & AUDIO_CONTROL_EQEN_MASK) ? 1 : 0);
+ m_audio_regs[offset] = data & AUDIO_CONTROL_MASK;
+ break;
+
+ case AUDIO_COMPRESS_CTRL:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Compressor Control: %04x\n", data);
+ m_audio_regs[offset] = data;
+ break;
+
+ case AUDIO_CHANNEL_STATUS:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Channel Status (read-only): %04x\n", data);
+ break;
+
+ case AUDIO_WAVE_IN_L:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Wave In (L) / FIFO Write Data: %04x\n", data);
+ m_audio_regs[offset] = data;
+ break;
+
+ case AUDIO_WAVE_IN_R:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Wave In (R) / Software Channel FIFO IRQ Control: %04x\n", data);
+ m_audio_regs[offset] = data;
+ break;
+
+ case AUDIO_WAVE_OUT_L:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Wave Out (L): %04x\n", data);
+ m_audio_regs[offset] = data;
+ break;
+
+ case AUDIO_WAVE_OUT_R:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Wave Out (R): %04x\n", data);
+ m_audio_regs[offset] = data;
+ break;
+
+ case AUDIO_CHANNEL_REPEAT:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Channel Repeat Enable: %04x\n", data);
+ m_audio_regs[offset] = data & AUDIO_CHANNEL_REPEAT_MASK;
+ break;
+
+ case AUDIO_CHANNEL_ENV_MODE:
+ LOGMASKED(LOG_SPU_WRITES | LOG_ENVELOPES, "audio_w: Channel Envelope Enable: %04x\n", data);
+ m_audio_regs[offset] = data & AUDIO_CHANNEL_ENV_MODE_MASK;
+ break;
+
+ case AUDIO_CHANNEL_TONE_RELEASE:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Channel Tone Release Enable: %04x\n", data);
+ m_audio_regs[offset] = data & AUDIO_CHANNEL_TONE_RELEASE_MASK;
+ break;
+
+ case AUDIO_CHANNEL_ENV_IRQ:
+ LOGMASKED(LOG_SPU_WRITES | LOG_ENVELOPES | LOG_IRQS, "audio_w: Channel Envelope IRQ Acknowledge: %04x\n", data);
+ m_audio_regs[offset] &= ~data & AUDIO_CHANNEL_ENV_IRQ_MASK;
+ break;
+
+ case AUDIO_CHANNEL_PITCH_BEND:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Channel Pitch Bend Enable: %04x\n", data);
+ m_audio_regs[offset] = data & AUDIO_CHANNEL_PITCH_BEND_MASK;
+ break;
+
+ case AUDIO_SOFT_PHASE:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Software Channel Phase: %04x\n", data);
+ m_audio_regs[offset] = data;
+ break;
+
+ case AUDIO_ATTACK_RELEASE:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: Attack/Release Time Control: %04x\n", data);
+ m_audio_regs[offset] = data;
+ break;
+
+ case AUDIO_EQ_CUTOFF10:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: EQ Cutoff Frequency 0/1: %04x\n", data);
+ m_audio_regs[offset] = data & AUDIO_EQ_CUTOFF10_MASK;
+ break;
+
+ case AUDIO_EQ_CUTOFF32:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: EQ Cutoff Frequency 2/3: %04x\n", data);
+ m_audio_regs[offset] = data & AUDIO_EQ_CUTOFF32_MASK;
+ break;
+
+ case AUDIO_EQ_GAIN10:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: EQ Cutoff Gain 0/1: %04x\n", data);
+ m_audio_regs[offset] = data & AUDIO_EQ_GAIN10_MASK;
+ break;
+
+ case AUDIO_EQ_GAIN32:
+ LOGMASKED(LOG_SPU_WRITES, "audio_w: EQ Cutoff Gain 2/3: %04x\n", data);
+ m_audio_regs[offset] = data & AUDIO_EQ_GAIN32_MASK;
+ break;
+
+ default:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_UNKNOWN_SPU, "audio_w: Unknown register %04x = %04x\n", 0x3000 + offset, data);
+ break;
+ }
+ }
+ else if (channel < 16)
+ {
+ switch (offset & AUDIO_CHAN_OFFSET_MASK)
+ {
+ case AUDIO_WAVE_ADDR:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Wave Addr (lo): %04x\n", channel, data);
+ break;
+
+ case AUDIO_MODE:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Mode: %04x (ADPCM:%d, 16M:%d, TONE:%d, LADDR_HI:%04x, WADDR_HI:%04x)\n", channel, data,
+ get_adpcm_bit(channel), get_16bit_bit(channel), get_tone_mode(channel), get_loop_addr_high(channel), get_wave_addr_high(channel));
+ break;
+
+ case AUDIO_LOOP_ADDR:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Loop Addr: %04x\n", channel, data);
+ break;
+
+ case AUDIO_PAN_VOL:
+ m_audio_regs[offset] = data & AUDIO_PAN_VOL_MASK;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Pan/Vol: %04x (PAN:%02x, VOL:%02x)\n", channel, data,
+ get_pan(channel), get_volume(channel));
+ break;
+
+ case AUDIO_ENVELOPE0:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_CHANNEL_WRITES | LOG_ENVELOPES, "audio_w: Channel %d: Envelope0: %04x (RPTPER:%d, TARGET:%02x, SIGN:%d, INC:%02x)\n", channel, data,
+ get_repeat_period_bit(channel), get_envelope_target(channel), get_envelope_sign_bit(channel), get_envelope_inc(channel));
+ break;
+
+ case AUDIO_ENVELOPE_DATA:
+ m_audio_regs[offset] = data & AUDIO_ENVELOPE_DATA_MASK;
+ LOGMASKED(LOG_CHANNEL_WRITES | LOG_ENVELOPES, "audio_w: Channel %d: Envelope Data: %04x (CNT:%d, EDD:%02x)\n", channel, data,
+ get_envelope_count(channel), get_edd(channel));
+ break;
+
+ case AUDIO_ENVELOPE1:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_CHANNEL_WRITES | LOG_ENVELOPES, "audio_w: Channel %d: Envelope1 Data: %04x (RPTCNT:%02x, RPT:%d, LOAD:%02x)\n", channel, data,
+ get_envelope_repeat_count(channel), get_envelope_repeat_bit(channel), get_envelope_load(channel));
+ break;
+
+ case AUDIO_ENVELOPE_ADDR_HIGH:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_CHANNEL_WRITES | LOG_ENVELOPES, "audio_w: Channel %d: Envelope Addr (hi): %04x (IRQADDR:%03x, IRQEN:%d, EADDR_HI:%02x)\n", channel, data,
+ get_audio_irq_addr(channel), get_audio_irq_enable_bit(channel), get_envelope_addr_high(channel));
+ break;
+
+ case AUDIO_ENVELOPE_ADDR:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_CHANNEL_WRITES | LOG_ENVELOPES, "audio_w: Channel %d: Envelope Addr (lo): %04x\n", channel, data);
+ break;
+
+ case AUDIO_WAVE_DATA_PREV:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Wave Data Prev: %04x \n", channel, data);
+ break;
+
+ case AUDIO_ENVELOPE_LOOP_CTRL:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_CHANNEL_WRITES | LOG_ENVELOPES, "audio_w: Channel %d: Envelope Loop Ctrl: %04x (RDOFFS:%02x, EAOFFS:%03x)\n", channel, data,
+ get_rampdown_offset(channel), get_envelope_eaoffset(channel));
+ break;
+
+ case AUDIO_WAVE_DATA:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Wave Data: %04x\n", channel, data);
+ break;
+
+ case AUDIO_ADPCM_SEL:
+ m_audio_regs[offset] = data & AUDIO_ADPCM_SEL_MASK;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: ADPCM Sel: %04x (ADPCM36:%d, POINTNUM:%02x\n", channel, data,
+ get_adpcm36_bit(channel), get_point_number(channel));
+ break;
+
+ case AUDIO_PHASE_HIGH:
+ m_audio_regs[offset] = data & AUDIO_PHASE_HIGH_MASK;
+ m_channel_rate[channel] = ((double)get_phase(channel) * 140625.0 * 2.0) / (double)(1 << 19);
+ m_channel_rate_accum[channel] = 0.0;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Phase High: %04x (rate: %f)\n", channel, data, m_channel_rate[channel]);
+ break;
+
+ case AUDIO_PHASE_ACCUM_HIGH:
+ m_audio_regs[offset] = data & AUDIO_PHASE_ACCUM_HIGH_MASK;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Phase Accum High: %04x\n", channel, data);
+ break;
+
+ case AUDIO_TARGET_PHASE_HIGH:
+ m_audio_regs[offset] = data & AUDIO_TARGET_PHASE_HIGH_MASK;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Target Phase High: %04x\n", channel, data);
+ break;
+
+ case AUDIO_RAMP_DOWN_CLOCK:
+ m_audio_regs[offset] = data & AUDIO_RAMP_DOWN_CLOCK_MASK;
+ LOGMASKED(LOG_CHANNEL_WRITES | LOG_RAMPDOWN, "audio_w: Channel %d: Rampdown Clock: %04x\n", channel, data);
+ break;
+
+ case AUDIO_PHASE:
+ m_audio_regs[offset] = data;
+ m_channel_rate[channel] = ((double)get_phase(channel) * 140625.0 * 2.0) / (double)(1 << 19);
+ m_channel_rate_accum[channel] = 0.0;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Phase: %04x (rate: %f)\n", channel, data, m_channel_rate[channel]);
+ break;
+
+ case AUDIO_PHASE_ACCUM:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Phase Accum: %04x\n", channel, data);
+ break;
+
+ case AUDIO_TARGET_PHASE:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Target Phase: %04x\n", channel, data);
+ break;
+
+ case AUDIO_PHASE_CTRL:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Phase Ctrl: %04x (TIMESTEP:%d, SIGN:%d, OFFSET:%03x\n", channel, data,
+ get_phase_time_step(channel), get_phase_sign_bit(channel), get_phase_offset(channel));
+ break;
+
+ default:
+ m_audio_regs[offset] = data;
+ LOGMASKED(LOG_UNKNOWN_SPU, "audio_w: Unknown register %04x = %04x\n", 0x3000 + offset, data);
+ break;
+ }
+ }
+ else if (channel >= 16)
+ {
+ LOGMASKED(LOG_UNKNOWN_SPU, "audio_w: Trying to write to channel %d: %04x = %04x\n", channel, 0x3000 + offset, data);
+ }
+ else
+ {
+ m_audio_regs[offset] = data;
+ }
+}
+
+void spg2xx_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+{
+ stream_sample_t *out_l = outputs[0];
+ stream_sample_t *out_r = outputs[1];
+ address_space &space = m_cpu->space(AS_PROGRAM);
+
+ for (int i = 0; i < samples; i++)
+ {
+ int32_t left_total = 0;
+ int32_t right_total = 0;
+ int32_t active_count = 0;
+
+ for (uint32_t ch_index = 0; ch_index < 16; ch_index++)
+ {
+ if (!get_channel_status(ch_index))
+ {
+ continue;
+ }
+
+ if (SPG_DEBUG_AUDIO && m_debug_rates)
+ printf("%f:%f ", m_channel_rate[ch_index], m_channel_rate_accum[ch_index]);
+ bool playing = advance_channel(space, ch_index);
+ if (playing)
+ {
+ int32_t sample = (int16_t)(m_audio_regs[(ch_index << 4) | AUDIO_WAVE_DATA] ^ 0x8000);
+ if (!(m_audio_regs[AUDIO_CONTROL] & AUDIO_CONTROL_NOINT_MASK))
+ {
+ int32_t prev_sample = (int16_t)(m_audio_regs[(ch_index << 4) | AUDIO_WAVE_DATA_PREV] ^ 0x8000);
+ int16_t lerp_factor = (int16_t)((m_channel_rate_accum[ch_index] / 44100.0) * 256.0);
+ prev_sample = (prev_sample * (0x100 - lerp_factor)) >> 8;
+ sample = (sample * lerp_factor) >> 8;
+ sample += prev_sample;
+ }
+
+ sample = (sample * (int16_t)get_edd(ch_index)) >> 7;
+
+ active_count++;
+
+ int32_t vol = get_volume(ch_index);
+ int32_t pan = get_pan(ch_index);
+
+ int32_t pan_left, pan_right;
+ if (pan < 0x40)
+ {
+ pan_left = 0x7f * vol;
+ pan_right = pan * 2 * vol;
+ }
+ else
+ {
+ pan_left = (0x7f - pan) * 2 * vol;
+ pan_right = 0x7f * vol;
+ }
+
+ left_total += ((int16_t)sample * (int16_t)pan_left) >> 14;
+ right_total += ((int16_t)sample * (int16_t)pan_right) >> 14;
+ }
+ }
+
+ if (active_count)
+ {
+ left_total /= active_count;
+ right_total /= active_count;
+ *out_l++ = (left_total * (int16_t)m_audio_regs[AUDIO_MAIN_VOLUME]) >> 7;
+ *out_r++ = (right_total * (int16_t)m_audio_regs[AUDIO_MAIN_VOLUME]) >> 7;
+ }
+ else
+ {
+ *out_l++ = 0;
+ *out_r++ = 0;
+ }
+ }
+}
+
+inline void spg2xx_device::stop_channel(const uint32_t channel)
+{
+ // TODO: IRQs
+ m_audio_regs[AUDIO_CHANNEL_ENABLE] &= ~(1 << channel);
+ m_audio_regs[AUDIO_CHANNEL_STATUS] &= ~(1 << channel);
+ m_audio_regs[AUDIO_CHANNEL_STOP] |= (1 << channel);
+ m_audio_regs[(channel << 4) | AUDIO_MODE] &= ~AUDIO_ADPCM_MASK;
+ m_audio_regs[AUDIO_CHANNEL_TONE_RELEASE] &= ~(1 << channel);
+}
+
+bool spg2xx_device::advance_channel(address_space &space, const uint32_t channel)
+{
+ m_channel_rate_accum[channel] += m_channel_rate[channel];
+ uint32_t samples_to_advance = 0;
+ while (m_channel_rate_accum[channel] >= 44100.0)
+ {
+ m_channel_rate_accum[channel] -= 44100.0;
+ samples_to_advance++;
+ }
+
+ if (!samples_to_advance)
+ return true;
+
+ bool playing = true;
+
+ if (get_adpcm_bit(channel))
+ {
+ // ADPCM mode
+ for (uint32_t sample = 0; sample < samples_to_advance && playing; sample++)
+ {
+ playing = fetch_sample(space, channel);
+ if (playing)
+ {
+ m_sample_shift[channel] += 4;
+ if (m_sample_shift[channel] == 16)
+ {
+ m_sample_shift[channel] = 0;
+ m_sample_addr[channel]++;
+ }
+ }
+ }
+ }
+ else if (get_16bit_bit(channel))
+ {
+ // 16-bit mode
+ for (uint32_t sample = 0; sample < samples_to_advance && playing; sample++)
+ {
+ playing = fetch_sample(space, channel);
+ if (playing)
+ m_sample_addr[channel]++;
+ }
+ }
+ else
+ {
+ // 8-bit mode
+ for (uint32_t sample = 0; sample < samples_to_advance && playing; sample++)
+ {
+ playing = fetch_sample(space, channel);
+ if (playing)
+ {
+ m_sample_shift[channel] += 8;
+ if (m_sample_shift[channel] == 16)
+ {
+ m_sample_shift[channel] = 0;
+ m_sample_addr[channel]++;
+ }
+ }
+ }
+ }
+
+ return playing;
+}
+
+bool spg2xx_device::fetch_sample(address_space &space, const uint32_t channel)
+{
+ const uint32_t channel_mask = channel << 4;
+ m_audio_regs[channel_mask | AUDIO_WAVE_DATA_PREV] = m_audio_regs[channel_mask | AUDIO_WAVE_DATA];
+
+ const uint32_t wave_data_reg = channel_mask | AUDIO_WAVE_DATA;
+ const uint16_t tone_mode = get_tone_mode(channel);
+ const uint16_t raw_sample = tone_mode ? space.read_word(m_sample_addr[channel]) : m_audio_regs[wave_data_reg];
+
+ m_audio_regs[wave_data_reg] = raw_sample;
+
+ if (get_adpcm_bit(channel))
+ {
+ // ADPCM mode
+ m_audio_regs[wave_data_reg] >>= m_sample_shift[channel];
+ m_audio_regs[wave_data_reg] = (uint16_t)(m_adpcm[channel].clock((uint8_t)(m_audio_regs[wave_data_reg] & 0x000f)) * 7) ^ 0x8000;
+ if (tone_mode != 0 && raw_sample == 0xffff)
+ {
+ if (tone_mode == AUDIO_TONE_MODE_HW_ONESHOT)
+ {
+ LOGMASKED(LOG_SAMPLES, "ADPCM stopped after %d samples\n", m_sample_count[channel]);
+ m_sample_count[channel] = 0;
+ stop_channel(channel);
+ return false;
+ }
+ else
+ {
+ LOGMASKED(LOG_SAMPLES, "ADPCM looping after %d samples\n", m_sample_count[channel]);
+ m_sample_count[channel] = 0;
+ loop_channel(channel);
+ }
+ }
+ m_sample_count[channel]++;
+ }
+ else if (get_16bit_bit(channel))
+ {
+ // 16-bit mode
+ if (tone_mode != 0 && raw_sample == 0xffff)
+ {
+ if (tone_mode == AUDIO_TONE_MODE_HW_ONESHOT)
+ {
+ LOGMASKED(LOG_SAMPLES, "16-bit PCM stopped after %d samples\n", m_sample_count[channel]);
+ m_sample_count[channel] = 0;
+ stop_channel(channel);
+ return false;
+ }
+ else
+ {
+ LOGMASKED(LOG_SAMPLES, "16-bit PCM looping after %d samples\n", m_sample_count[channel]);
+ m_sample_count[channel] = 0;
+ loop_channel(channel);
+ }
+ }
+ m_sample_count[channel]++;
+ }
+ else
+ {
+ // 8-bit mode
+ if (tone_mode != 0)
+ {
+ if (m_sample_shift[channel])
+ m_audio_regs[wave_data_reg] <<= 8;
+ else
+ m_audio_regs[wave_data_reg] &= 0xff00;
+
+ if (m_audio_regs[wave_data_reg] == 0xff00)
+ {
+ if (tone_mode == AUDIO_TONE_MODE_HW_ONESHOT)
+ {
+ LOGMASKED(LOG_SAMPLES, "8-bit PCM stopped after %d samples\n", m_sample_count[channel]);
+ m_sample_count[channel] = 0;
+ stop_channel(channel);
+ return false;
+ }
+ else
+ {
+ LOGMASKED(LOG_SAMPLES, "8-bit PCM looping after %d samples\n", m_sample_count[channel]);
+ m_sample_count[channel] = 0;
+ loop_channel(channel);
+ }
+ }
+ }
+ m_sample_count[channel]++;
+ }
+
+ return true;
}
-void spg24x_device::device_add_mconfig(machine_config &config)
+inline void spg2xx_device::loop_channel(const uint32_t channel)
{
- SPG2XX_AUDIO(config, m_spg_audio, DERIVED_CLOCK(1, 1));
- m_spg_audio->write_irq_callback().set(FUNC(spg24x_device::audioirq_w));
- m_spg_audio->space_read_callback().set(FUNC(spg24x_device::space_r));
+ m_sample_addr[channel] = get_loop_addr(channel);
+ m_sample_shift[channel] = 0;
+}
- m_spg_audio->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_spg_audio->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+void spg2xx_device::audio_frame_tick()
+{
+ audio_beat_tick();
- SPG24X_IO(config, m_spg_io, DERIVED_CLOCK(1, 1), m_cpu, m_screen);
- configure_spg_io(m_spg_io);
+ address_space &space = m_cpu->space(AS_PROGRAM);
+ bool any_changed = false;
+ for (uint32_t channel = 0; channel < 16; channel++)
+ {
+ const uint16_t mask = (1 << channel);
+ if (!(m_audio_regs[AUDIO_CHANNEL_STATUS] & mask))
+ {
+ continue;
+ }
+
+ if (m_audio_regs[AUDIO_ENV_RAMP_DOWN] & mask)
+ {
+ m_rampdown_frame[channel]--;
+ if (m_rampdown_frame[channel] == 0)
+ {
+ LOGMASKED(LOG_RAMPDOWN, "Ticking rampdown for channel %d\n", channel);
+ audio_rampdown_tick(channel);
+ any_changed = true;
+ }
+ continue;
+ }
+
+ if (!(m_audio_regs[AUDIO_CHANNEL_ENV_MODE] & mask))
+ {
+ m_envclk_frame[channel]--;
+ if (m_envclk_frame[channel] == 0)
+ {
+ LOGMASKED(LOG_ENVELOPES, "Ticking envelope for channel %d\n", channel);
+ any_changed = audio_envelope_tick(space, channel) || any_changed;
+ m_envclk_frame[channel] = get_envclk_frame_count(channel);
+ }
+ }
+ }
+
+ if (any_changed)
+ {
+ m_stream->update();
+ }
}
-void spg28x_device::device_add_mconfig(machine_config &config)
+void spg2xx_device::audio_beat_tick()
{
- SPG2XX_AUDIO(config, m_spg_audio, DERIVED_CLOCK(1, 1));
- m_spg_audio->write_irq_callback().set(FUNC(spg28x_device::audioirq_w));
- m_spg_audio->space_read_callback().set(FUNC(spg28x_device::space_r));
+ if (m_audio_curr_beat_base_count == 0)
+ {
+ LOGMASKED(LOG_BEAT, "Beat base count elapsed, reloading with %d\n", m_audio_regs[AUDIO_BEAT_BASE_COUNT]);
+ m_audio_curr_beat_base_count = m_audio_regs[AUDIO_BEAT_BASE_COUNT];
+
+ uint16_t beat_count = m_audio_regs[AUDIO_BEAT_COUNT] & AUDIO_BEAT_COUNT_MASK;
+ if (beat_count == 0)
+ {
+ if (m_audio_regs[AUDIO_BEAT_COUNT] & AUDIO_BIE_MASK)
+ {
+ LOGMASKED(LOG_BEAT, "Beat count elapsed, setting Status bit and checking IRQs\n");
+ m_audio_regs[AUDIO_BEAT_COUNT] |= AUDIO_BIS_MASK;
+ check_irqs(AUDIO_BIS_MASK);
+ }
+ else
+ {
+ LOGMASKED(LOG_BEAT, "Beat count elapsed but IRQ not enabled\n");
+ }
+ }
+ else
+ {
+ beat_count--;
+ m_audio_regs[AUDIO_BEAT_COUNT] = (m_audio_regs[AUDIO_BEAT_COUNT] & ~AUDIO_BEAT_COUNT_MASK) | beat_count;
+ }
+ }
+ else
+ {
+ m_audio_curr_beat_base_count--;
+ }
+}
- m_spg_audio->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_spg_audio->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+void spg2xx_device::audio_rampdown_tick(const uint32_t channel)
+{
+ const uint8_t old_edd = get_edd(channel);
+ uint8_t new_edd = old_edd - get_rampdown_offset(channel);
+ if (new_edd > old_edd)
+ new_edd = 0;
- SPG28X_IO(config, m_spg_io, DERIVED_CLOCK(1, 1), m_cpu, m_screen);
- configure_spg_io(m_spg_io);
+ if (new_edd)
+ {
+ LOGMASKED(LOG_RAMPDOWN, "Channel %d preparing for next rampdown step (%02x)\n", channel, new_edd);
+ const uint16_t channel_mask = channel << 4;
+ m_audio_regs[channel_mask | AUDIO_ENVELOPE_DATA] &= ~AUDIO_EDD_MASK;
+ m_audio_regs[channel_mask | AUDIO_ENVELOPE_DATA] |= new_edd & AUDIO_EDD_MASK;
+ m_rampdown_frame[channel] = get_rampdown_frame_count(channel);
+ }
+ else
+ {
+ LOGMASKED(LOG_RAMPDOWN, "Stopping channel %d due to rampdown\n", channel);
+ const uint16_t channel_mask = 1 << channel;
+ m_audio_regs[AUDIO_CHANNEL_ENABLE] &= ~channel_mask;
+ m_audio_regs[AUDIO_CHANNEL_STATUS] &= ~channel_mask;
+ m_audio_regs[AUDIO_CHANNEL_STOP] |= channel_mask;
+ m_audio_regs[AUDIO_ENV_RAMP_DOWN] &= ~channel_mask;
+ m_audio_regs[AUDIO_CHANNEL_TONE_RELEASE] &= ~channel_mask;
+ }
+}
+
+const uint32_t spg2xx_device::s_rampdown_frame_counts[8] =
+{
+ 13*4, 13*16, 13*64, 13*256, 13*1024, 13*4096, 13*8192, 13*8192
+};
+
+uint32_t spg2xx_device::get_rampdown_frame_count(const uint32_t channel)
+{
+ return s_rampdown_frame_counts[get_rampdown_clock(channel)];
+}
+
+const uint32_t spg2xx_device::s_envclk_frame_counts[16] =
+{
+ 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 8192, 8192, 8192, 8192
+};
+
+uint32_t spg2xx_device::get_envclk_frame_count(const uint32_t channel)
+{
+ return s_envclk_frame_counts[get_envelope_clock(channel)];
+}
+
+uint32_t spg2xx_device::get_envelope_clock(const offs_t channel) const
+{
+ if (channel < 4)
+ return (m_audio_regs[AUDIO_ENVCLK0] >> (channel << 2)) & 0x000f;
+ else if (channel < 8)
+ return (m_audio_regs[AUDIO_ENVCLK0_HIGH] >> ((channel - 4) << 2)) & 0x000f;
+ else if (channel < 12)
+ return (m_audio_regs[AUDIO_ENVCLK1] >> ((channel - 8) << 2)) & 0x000f;
+ else
+ return (m_audio_regs[AUDIO_ENVCLK1_HIGH] >> ((channel - 12) << 2)) & 0x000f;
+}
+
+bool spg2xx_device::audio_envelope_tick(address_space &space, const uint32_t channel)
+{
+ const uint16_t channel_mask = channel << 4;
+ uint16_t new_count = get_envelope_count(channel);
+ const uint16_t curr_edd = get_edd(channel);
+ LOGMASKED(LOG_ENVELOPES, "envelope %d tick, count is %04x, curr edd is %04x\n", channel, new_count, curr_edd);
+ bool edd_changed = false;
+ if (new_count == 0)
+ {
+ const uint16_t target = get_envelope_target(channel);
+ uint16_t new_edd = curr_edd;
+ const uint16_t inc = get_envelope_inc(channel);
+
+ if (new_edd != target)
+ {
+ if (get_envelope_sign_bit(channel))
+ {
+ new_edd -= inc;
+ LOGMASKED(LOG_ENVELOPES, "Envelope %d new EDD-: %04x (%04x), dec %04x\n", channel, new_edd, target, inc);
+ if (new_edd > curr_edd)
+ new_edd = 0;
+ else if (new_edd < target)
+ new_edd = target;
+
+ if (new_edd == 0)
+ {
+ LOGMASKED(LOG_ENVELOPES, "Envelope %d at 0, stopping channel\n", channel);
+ stop_channel(channel);
+ return true;
+ }
+ }
+ else
+ {
+ new_edd += inc;
+ LOGMASKED(LOG_ENVELOPES, "Envelope %d new EDD+: %04x\n", channel, new_edd);
+ if (new_edd >= target)
+ new_edd = target;
+ }
+ }
+
+ if (new_edd == target)
+ {
+ LOGMASKED(LOG_ENVELOPES, "Envelope %d at target %04x\n", channel, target);
+ new_edd = target;
+
+ if (get_envelope_repeat_bit(channel))
+ {
+ const uint16_t repeat_count = get_envelope_repeat_count(channel) - 1;
+ LOGMASKED(LOG_ENVELOPES, "Repeating envelope, new repeat count %d\n", repeat_count);
+ if (repeat_count == 0)
+ {
+ m_audio_regs[channel_mask | AUDIO_ENVELOPE0] = space.read_word(m_envelope_addr[channel]);
+ m_audio_regs[channel_mask | AUDIO_ENVELOPE1] = space.read_word(m_envelope_addr[channel] + 1);
+ m_audio_regs[channel_mask | AUDIO_ENVELOPE_LOOP_CTRL] = space.read_word(m_envelope_addr[channel] + 2);
+ m_envelope_addr[channel] = get_envelope_addr(channel) + get_envelope_eaoffset(channel);
+ LOGMASKED(LOG_ENVELOPES, "Envelope data after repeat: %04x %04x %04x (%08x)\n", m_audio_regs[channel_mask | AUDIO_ENVELOPE0], m_audio_regs[channel_mask | AUDIO_ENVELOPE1], m_audio_regs[channel_mask | AUDIO_ENVELOPE_LOOP_CTRL], m_envelope_addr[channel]);
+ }
+ else
+ {
+ set_envelope_repeat_count(channel, repeat_count);
+ }
+ }
+ else
+ {
+ LOGMASKED(LOG_ENVELOPES, "Fetching envelope for channel %d from %08x\n", channel, m_envelope_addr[channel]);
+ m_audio_regs[channel_mask | AUDIO_ENVELOPE0] = space.read_word(m_envelope_addr[channel]);
+ m_audio_regs[channel_mask | AUDIO_ENVELOPE1] = space.read_word(m_envelope_addr[channel] + 1);
+ LOGMASKED(LOG_ENVELOPES, "Fetched envelopes %04x %04x\n", m_audio_regs[channel_mask | AUDIO_ENVELOPE0], m_audio_regs[channel_mask | AUDIO_ENVELOPE1]);
+ m_envelope_addr[channel] += 2;
+ }
+ new_count = get_envelope_load(channel);
+ set_envelope_count(channel, new_count);
+ }
+ else
+ {
+ LOGMASKED(LOG_ENVELOPES, "Envelope %d not yet at target %04x (%04x)\n", channel, target, new_edd);
+ new_count = get_envelope_load(channel);
+ set_envelope_count(channel, new_count);
+ }
+ LOGMASKED(LOG_ENVELOPES, "Envelope %d new count %04x\n", channel, new_count);
+
+ set_edd(channel, new_edd);
+ edd_changed = true;
+ LOGMASKED(LOG_ENVELOPES, "Setting channel %d edd to %04x, register is %04x\n", channel, new_edd, m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA]);
+ }
+ else
+ {
+ new_count--;
+ set_envelope_count(channel, new_count);
+ }
+ LOGMASKED(LOG_ENVELOPES, "envelope %d post-tick, count is now %04x, register is %04x\n", channel, new_count, m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA]);
+ return edd_changed;
}
diff --git a/src/devices/machine/spg2xx.h b/src/devices/machine/spg2xx.h
index 859620d9f66..0573daef7ac 100644
--- a/src/devices/machine/spg2xx.h
+++ b/src/devices/machine/spg2xx.h
@@ -27,6 +27,12 @@
ND - unknown - Wireless Air 60
ND - Likely many more
+ Also on this hardware:
+
+ name PCB ID ROM width TSOP pads ROM size SEEPROM die markings
+ Radica Play TV Football 2 L7278 x16 48 not dumped no Sunplus
+ Dream Life ? x16 48 not dumped no Sunplus
+
**********************************************************************/
#ifndef MAME_MACHINE_SPG2XX_H
@@ -35,17 +41,15 @@
#pragma once
#include "cpu/unsp/unsp.h"
-#include "spg2xx_audio.h"
-#include "spg2xx_io.h"
+#include "sound/okiadpcm.h"
#include "screen.h"
-class spg2xx_device : public device_t, public device_mixer_interface
+class spg2xx_device : public device_t, public device_sound_interface
{
public:
spg2xx_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
void set_pal(bool pal) { m_pal_flag = pal ? 1 : 0; }
- void set_rowscroll_offset(int offset) { m_rowscrolloffset = offset; }
void map(address_map &map);
@@ -56,8 +60,6 @@ public:
auto portb_in() { return m_portb_in.bind(); }
auto portc_in() { return m_portc_in.bind(); }
- template <size_t Line> auto adc_in() { return m_adc_in[Line].bind(); }
-
auto eeprom_w() { return m_eeprom_w.bind(); }
auto eeprom_r() { return m_eeprom_r.bind(); }
@@ -65,22 +67,21 @@ public:
auto chip_select() { return m_chip_sel.bind(); }
+ void uart_rx(uint8_t data);
+
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank);
- required_device<spg2xx_audio_device> m_spg_audio;
- required_device<spg2xx_io_device> m_spg_io;
-
- void extint_w(int channel, bool state) { m_spg_io->extint_w(channel, state); };
- void uart_rx(uint8_t data) { m_spg_io->uart_rx(data); };
-
protected:
- spg2xx_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const uint32_t sprite_limit)
+ spg2xx_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const size_t sprite_limit)
: spg2xx_device(mconfig, type, tag, owner, clock)
{
m_sprite_limit = sprite_limit;
}
+ // sound stream update overrides
+ virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+
enum
{
PAGE_ENABLE_MASK = 0x0008,
@@ -99,82 +100,370 @@ protected:
TILE_Y_FLIP = 0x0008
};
- DECLARE_READ16_MEMBER(video_r);
- DECLARE_WRITE16_MEMBER(video_w);
+ void audio_frame_tick();
+ void audio_beat_tick();
+ void audio_rampdown_tick(const uint32_t channel);
+ bool audio_envelope_tick(address_space &space, const uint32_t channel);
+ inline uint32_t get_rampdown_frame_count(const uint32_t channel);
+ inline uint32_t get_envclk_frame_count(const uint32_t channel);
+
+ // Audio getters
+ bool get_channel_enable(const offs_t channel) const { return m_audio_regs[AUDIO_CHANNEL_ENABLE] & (1 << channel); }
+ bool get_channel_status(const offs_t channel) const { return m_audio_regs[AUDIO_CHANNEL_STATUS] & (1 << channel); }
+ bool get_manual_envelope_enable(const offs_t channel) const { return m_audio_regs[AUDIO_CHANNEL_ENV_MODE] & (1 << channel); }
+ bool get_auto_envelope_enable(const offs_t channel) const { return !get_manual_envelope_enable(channel); }
+ uint32_t get_envelope_clock(const offs_t channel) const;
+
+ // Audio Mode getters
+ uint16_t get_wave_addr_high(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_MODE] & AUDIO_WADDR_HIGH_MASK; }
+ uint16_t get_loop_addr_high(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_MODE] & AUDIO_LADDR_HIGH_MASK) >> AUDIO_LADDR_HIGH_SHIFT; }
+ uint16_t get_tone_mode(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_MODE] & AUDIO_TONE_MODE_MASK) >> AUDIO_TONE_MODE_SHIFT; }
+ uint16_t get_16bit_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_MODE] & AUDIO_16M_MASK) ? 1 : 0; }
+ uint16_t get_adpcm_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_MODE] & AUDIO_ADPCM_MASK) ? 1 : 0; }
+
+ // Audio Pan getters
+ uint16_t get_volume(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_PAN_VOL] & AUDIO_VOLUME_MASK; }
+ uint16_t get_pan(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_PAN_VOL] & AUDIO_PAN_MASK) >> AUDIO_PAN_SHIFT; }
+
+ // Audio Envelope0 Data getters
+ uint16_t get_envelope_inc(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_ENVELOPE0] & AUDIO_ENVELOPE_INC_MASK; }
+ uint16_t get_envelope_sign_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE0] & AUDIO_ENVELOPE_SIGN_MASK) ? 1 : 0; }
+ uint16_t get_envelope_target(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE0] & AUDIO_ENVELOPE_TARGET_MASK) >> AUDIO_ENVELOPE_TARGET_SHIFT; }
+ uint16_t get_repeat_period_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE0] & AUDIO_ENVELOPE_REPEAT_PERIOD_MASK) ? 1 : 0; }
+
+ // Audio Envelope Data getters
+ uint16_t get_edd(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA] & AUDIO_EDD_MASK; }
+ uint16_t get_envelope_count(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA] & AUDIO_ENVELOPE_COUNT_MASK) >> AUDIO_ENVELOPE_COUNT_SHIFT; }
+ void set_edd(const offs_t channel, uint8_t edd) { m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA] = (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA] & ~AUDIO_EDD_MASK) | edd; }
+ void set_envelope_count(const offs_t channel, uint16_t count) { m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA] = get_edd(channel) | (count << AUDIO_ENVELOPE_COUNT_SHIFT); }
+
+ // Audio Envelope1 Data getters
+ uint16_t get_envelope_load(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_ENVELOPE1] & AUDIO_ENVELOPE_LOAD_MASK; }
+ uint16_t get_envelope_repeat_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE1] & AUDIO_ENVELOPE_RPT_MASK) ? 1 : 0; }
+ uint16_t get_envelope_repeat_count(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE1] & AUDIO_ENVELOPE_RPCNT_MASK) >> AUDIO_ENVELOPE_RPCNT_SHIFT; }
+ inline void set_envelope_repeat_count(const offs_t channel, const uint16_t count) { m_audio_regs[(channel << 4) | AUDIO_ENVELOPE1] = (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE1] & ~AUDIO_ENVELOPE_RPCNT_MASK) | ((count << AUDIO_ENVELOPE_RPCNT_SHIFT) & AUDIO_ENVELOPE_RPCNT_MASK); }
+
+ // Audio Envelope Address getters
+ uint16_t get_envelope_addr_high(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_ADDR_HIGH] & AUDIO_EADDR_HIGH_MASK; }
+ uint16_t get_audio_irq_enable_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_ADDR_HIGH] & AUDIO_IRQ_EN_MASK) ? 1 : 0; }
+ uint16_t get_audio_irq_addr(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_ADDR_HIGH] & AUDIO_IRQ_ADDR_MASK) >> AUDIO_IRQ_ADDR_SHIFT; }
+
+ // Audio Envelope Loop getters
+ uint16_t get_envelope_eaoffset(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_LOOP_CTRL] & AUDIO_EAOFFSET_MASK; }
+ uint16_t get_rampdown_offset(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_LOOP_CTRL] & AUDIO_RAMPDOWN_OFFSET_MASK) >> AUDIO_RAMPDOWN_OFFSET_SHIFT; }
+ void set_envelope_eaoffset(const offs_t channel, uint16_t eaoffset) { m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_LOOP_CTRL] = (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_LOOP_CTRL] & ~AUDIO_RAMPDOWN_OFFSET_MASK) | (eaoffset & AUDIO_EAOFFSET_MASK); }
+
+ // Audio ADPCM getters
+ uint16_t get_point_number(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ADPCM_SEL] & AUDIO_POINT_NUMBER_MASK) >> AUDIO_POINT_NUMBER_SHIFT; }
+ uint16_t get_adpcm36_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ADPCM_SEL] & AUDIO_ADPCM36_MASK) ? 1 : 0; }
+
+ // Audio high-word getters
+ uint16_t get_phase_high(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_PHASE_HIGH] & AUDIO_PHASE_HIGH_MASK; }
+ uint16_t get_phase_accum_high(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_PHASE_ACCUM_HIGH] & AUDIO_PHASE_ACCUM_HIGH_MASK; }
+ uint16_t get_target_phase_high(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_TARGET_PHASE_HIGH] & AUDIO_TARGET_PHASE_HIGH_MASK; }
+ uint16_t get_rampdown_clock(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_RAMP_DOWN_CLOCK] & AUDIO_RAMP_DOWN_CLOCK_MASK; }
+
+ // Audio ADPCM getters
+ uint16_t get_phase_offset(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_PHASE_CTRL] & AUDIO_PHASE_OFFSET_MASK; }
+ uint16_t get_phase_sign_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_PHASE_CTRL] & AUDIO_PHASE_SIGN_MASK) >> AUDIO_PHASE_SIGN_SHIFT; }
+ uint16_t get_phase_time_step(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_PHASE_CTRL] & AUDIO_PHASE_TIME_STEP_MASK) >> AUDIO_PHASE_TIME_STEP_SHIFT; }
+
+ // Audio combined getters
+ uint32_t get_phase(const offs_t channel) const { return ((uint32_t)get_phase_high(channel) << 16) | m_audio_regs[(channel << 4) | AUDIO_PHASE]; }
+ uint32_t get_phase_accum(const offs_t channel) const { return ((uint32_t)get_phase_accum_high(channel) << 16) | m_audio_regs[(channel << 4) | AUDIO_PHASE_ACCUM]; }
+ uint32_t get_target_phase(const offs_t channel) const { return ((uint32_t)get_target_phase_high(channel) << 16) | m_audio_regs[(channel << 4) | AUDIO_TARGET_PHASE]; }
+ uint32_t get_wave_addr(const offs_t channel) const { return ((uint32_t)get_wave_addr_high(channel) << 16) | m_audio_regs[(channel << 4) | AUDIO_WAVE_ADDR]; }
+ uint32_t get_loop_addr(const offs_t channel) const { return ((uint32_t)get_loop_addr_high(channel) << 16) | m_audio_regs[(channel << 4) | AUDIO_LOOP_ADDR]; }
+ uint32_t get_envelope_addr(const offs_t channel) const { return ((uint32_t)get_envelope_addr_high(channel) << 16) | m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_ADDR]; }
+
+ enum
+ {
+ AUDIO_WAVE_ADDR = 0x000,
+
+ AUDIO_MODE = 0x001,
+ AUDIO_WADDR_HIGH_MASK = 0x003f,
+ AUDIO_LADDR_HIGH_MASK = 0x0fc0,
+ AUDIO_LADDR_HIGH_SHIFT = 6,
+ AUDIO_TONE_MODE_MASK = 0x3000,
+ AUDIO_TONE_MODE_SHIFT = 12,
+ AUDIO_TONE_MODE_SW = 0,
+ AUDIO_TONE_MODE_HW_ONESHOT = 1,
+ AUDIO_TONE_MODE_HW_LOOP = 2,
+ AUDIO_16M_MASK = 0x4000,
+ AUDIO_ADPCM_MASK = 0x8000,
+
+ AUDIO_LOOP_ADDR = 0x002,
+
+ AUDIO_PAN_VOL = 0x003,
+ AUDIO_PAN_VOL_MASK = 0x7f7f,
+ AUDIO_VOLUME_MASK = 0x007f,
+ AUDIO_PAN_MASK = 0x7f00,
+ AUDIO_PAN_SHIFT = 8,
+
+ AUDIO_ENVELOPE0 = 0x004,
+ AUDIO_ENVELOPE_INC_MASK = 0x007f,
+ AUDIO_ENVELOPE_SIGN_MASK = 0x0080,
+ AUDIO_ENVELOPE_TARGET_MASK = 0x7f00,
+ AUDIO_ENVELOPE_TARGET_SHIFT = 8,
+ AUDIO_ENVELOPE_REPEAT_PERIOD_MASK = 0x8000,
+
+ AUDIO_ENVELOPE_DATA = 0x005,
+ AUDIO_ENVELOPE_DATA_MASK = 0xff7f,
+ AUDIO_EDD_MASK = 0x007f,
+ AUDIO_ENVELOPE_COUNT_MASK = 0xff00,
+ AUDIO_ENVELOPE_COUNT_SHIFT = 8,
+
+ AUDIO_ENVELOPE1 = 0x006,
+ AUDIO_ENVELOPE_LOAD_MASK = 0x00ff,
+ AUDIO_ENVELOPE_RPT_MASK = 0x0100,
+ AUDIO_ENVELOPE_RPCNT_MASK = 0xfe00,
+ AUDIO_ENVELOPE_RPCNT_SHIFT = 9,
+
+ AUDIO_ENVELOPE_ADDR_HIGH = 0x007,
+ AUDIO_EADDR_HIGH_MASK = 0x003f,
+ AUDIO_IRQ_EN_MASK = 0x0040,
+ AUDIO_IRQ_ADDR_MASK = 0xff80,
+ AUDIO_IRQ_ADDR_SHIFT = 7,
+
+ AUDIO_ENVELOPE_ADDR = 0x008,
+ AUDIO_WAVE_DATA_PREV = 0x009,
+
+ AUDIO_ENVELOPE_LOOP_CTRL = 0x00a,
+ AUDIO_EAOFFSET_MASK = 0x01ff,
+ AUDIO_RAMPDOWN_OFFSET_MASK = 0xfe00,
+ AUDIO_RAMPDOWN_OFFSET_SHIFT = 9,
+
+ AUDIO_WAVE_DATA = 0x00b,
+
+ AUDIO_ADPCM_SEL = 0x00d,
+ AUDIO_ADPCM_SEL_MASK = 0xfe00,
+ AUDIO_POINT_NUMBER_MASK = 0x7e00,
+ AUDIO_POINT_NUMBER_SHIFT = 9,
+ AUDIO_ADPCM36_MASK = 0x8000,
+
+ AUDIO_PHASE_HIGH = 0x200,
+ AUDIO_PHASE_HIGH_MASK = 0x0007,
+
+ AUDIO_PHASE_ACCUM_HIGH = 0x201,
+ AUDIO_PHASE_ACCUM_HIGH_MASK = 0x0007,
+
+ AUDIO_TARGET_PHASE_HIGH = 0x202,
+ AUDIO_TARGET_PHASE_HIGH_MASK= 0x0007,
+
+ AUDIO_RAMP_DOWN_CLOCK = 0x203,
+ AUDIO_RAMP_DOWN_CLOCK_MASK = 0x0007,
+
+ AUDIO_PHASE = 0x204,
+ AUDIO_PHASE_ACCUM = 0x205,
+ AUDIO_TARGET_PHASE = 0x206,
+
+ AUDIO_PHASE_CTRL = 0x207,
+ AUDIO_PHASE_OFFSET_MASK = 0x0fff,
+ AUDIO_PHASE_SIGN_MASK = 0x1000,
+ AUDIO_PHASE_SIGN_SHIFT = 12,
+ AUDIO_PHASE_TIME_STEP_MASK = 0xe000,
+ AUDIO_PHASE_TIME_STEP_SHIFT = 13,
+
+ AUDIO_CHAN_OFFSET_MASK = 0xf0f,
+
+ AUDIO_CHANNEL_ENABLE = 0x400,
+ AUDIO_CHANNEL_ENABLE_MASK = 0xffff,
+
+ AUDIO_MAIN_VOLUME = 0x401,
+ AUDIO_MAIN_VOLUME_MASK = 0x007f,
+
+ AUDIO_CHANNEL_FIQ_ENABLE = 0x402,
+ AUDIO_CHANNEL_FIQ_ENABLE_MASK = 0xffff,
+
+ AUDIO_CHANNEL_FIQ_STATUS = 0x403,
+ AUDIO_CHANNEL_FIQ_STATUS_MASK = 0xffff,
+
+ AUDIO_BEAT_BASE_COUNT = 0x404,
+ AUDIO_BEAT_BASE_COUNT_MASK = 0x07ff,
+
+ AUDIO_BEAT_COUNT = 0x405,
+ AUDIO_BEAT_COUNT_MASK = 0x3fff,
+ AUDIO_BIS_MASK = 0x4000,
+ AUDIO_BIE_MASK = 0x8000,
+
+ AUDIO_ENVCLK0 = 0x406,
+
+ AUDIO_ENVCLK0_HIGH = 0x407,
+ AUDIO_ENVCLK0_HIGH_MASK = 0xffff,
+
+ AUDIO_ENVCLK1 = 0x408,
+
+ AUDIO_ENVCLK1_HIGH = 0x409,
+ AUDIO_ENVCLK1_HIGH_MASK = 0xffff,
+
+ AUDIO_ENV_RAMP_DOWN = 0x40a,
+ AUDIO_ENV_RAMP_DOWN_MASK = 0xffff,
+
+ AUDIO_CHANNEL_STOP = 0x40b,
+ AUDIO_CHANNEL_STOP_MASK = 0xffff,
+
+ AUDIO_CHANNEL_ZERO_CROSS = 0x40c,
+ AUDIO_CHANNEL_ZERO_CROSS_MASK = 0xffff,
+
+ AUDIO_CONTROL = 0x40d,
+ AUDIO_CONTROL_MASK = 0x9fe8,
+ AUDIO_CONTROL_SATURATE_MASK = 0x8000,
+ AUDIO_CONTROL_SOFTCH_MASK = 0x1000,
+ AUDIO_CONTROL_COMPEN_MASK = 0x0800,
+ AUDIO_CONTROL_NOHIGH_MASK = 0x0400,
+ AUDIO_CONTROL_NOINT_MASK = 0x0200,
+ AUDIO_CONTROL_EQEN_MASK = 0x0100,
+ AUDIO_CONTROL_VOLSEL_MASK = 0x00c0,
+ AUDIO_CONTROL_VOLSEL_SHIFT = 6,
+ AUDIO_CONTROL_FOF_MASK = 0x0020,
+ AUDIO_CONTROL_INIT_MASK = 0x0008,
+
+ AUDIO_COMPRESS_CTRL = 0x40e,
+ AUDIO_COMPRESS_CTRL_PEAK_MASK = 0x8000,
+ AUDIO_COMPRESS_CTRL_THRESHOLD_MASK = 0x7f00,
+ AUDIO_COMPRESS_CTRL_THRESHOLD_SHIFT = 8,
+ AUDIO_COMPRESS_CTRL_ATTSCALE_MASK = 0x00c0,
+ AUDIO_COMPRESS_CTRL_ATTSCALE_SHIFT = 6,
+ AUDIO_COMPRESS_CTRL_RELSCALE_MASK = 0x0030,
+ AUDIO_COMPRESS_CTRL_RELSCALE_SHIFT = 4,
+ AUDIO_COMPRESS_CTRL_DISZC_MASK = 0x0008,
+ AUDIO_COMPRESS_CTRL_RATIO_MASK = 0x0007,
+
+ AUDIO_CHANNEL_STATUS = 0x40f,
+ AUDIO_CHANNEL_STATUS_MASK = 0xffff,
+
+ AUDIO_WAVE_IN_L = 0x410,
+
+ AUDIO_WAVE_IN_R = 0x411,
+ AUDIO_SOFTIRQ_MASK = 0x8000,
+ AUDIO_SOFTIRQ_EN_MASK = 0x4000,
+ AUDIO_SOFT_PHASE_HIGH_MASK = 0x0070,
+ AUDIO_SOFT_PHASE_HIGH_SHIFT = 4,
+ AUDIO_FIFO_IRQ_THRESHOLD_MASK = 0x000f,
+
+ AUDIO_WAVE_OUT_L = 0x412,
+ AUDIO_WAVE_OUT_R = 0x413,
+
+ AUDIO_CHANNEL_REPEAT = 0x414,
+ AUDIO_CHANNEL_REPEAT_MASK = 0xffff,
+
+ AUDIO_CHANNEL_ENV_MODE = 0x415,
+ AUDIO_CHANNEL_ENV_MODE_MASK = 0xffff,
+
+ AUDIO_CHANNEL_TONE_RELEASE = 0x416,
+ AUDIO_CHANNEL_TONE_RELEASE_MASK = 0xffff,
+
+ AUDIO_CHANNEL_ENV_IRQ = 0x417,
+ AUDIO_CHANNEL_ENV_IRQ_MASK = 0xffff,
+
+ AUDIO_CHANNEL_PITCH_BEND = 0x418,
+ AUDIO_CHANNEL_PITCH_BEND_MASK = 0xffff,
+
+ AUDIO_SOFT_PHASE = 0x419,
- DECLARE_READ16_MEMBER(dma_r);
- DECLARE_WRITE16_MEMBER(dma_w);
+ AUDIO_ATTACK_RELEASE = 0x41a,
+ AUDIO_RELEASE_TIME_MASK = 0x00ff,
+ AUDIO_ATTACK_TIME_MASK = 0xff00,
+ AUDIO_ATTACK_TIME_SHIFT = 8,
- DECLARE_WRITE_LINE_MEMBER(audioirq_w);
- DECLARE_WRITE_LINE_MEMBER(timerirq_w);
- DECLARE_WRITE_LINE_MEMBER(uartirq_w);
- DECLARE_WRITE_LINE_MEMBER(extirq_w);
- DECLARE_WRITE_LINE_MEMBER(ffreq1_w);
- DECLARE_WRITE_LINE_MEMBER(ffreq2_w);
+ AUDIO_EQ_CUTOFF10 = 0x41b,
+ AUDIO_EQ_CUTOFF10_MASK = 0x7f7f,
- DECLARE_READ16_MEMBER(space_r);
+ AUDIO_EQ_CUTOFF32 = 0x41c,
+ AUDIO_EQ_CUTOFF32_MASK = 0x7f7f,
+ AUDIO_EQ_GAIN10 = 0x41d,
+ AUDIO_EQ_GAIN10_MASK = 0x7f7f,
+
+ AUDIO_EQ_GAIN32 = 0x41e,
+ AUDIO_EQ_GAIN32_MASK = 0x7f7f
+ };
+
+ DECLARE_READ16_MEMBER(video_r);
+ DECLARE_WRITE16_MEMBER(video_w);
+ DECLARE_READ16_MEMBER(audio_r);
+ DECLARE_WRITE16_MEMBER(audio_w);
+ DECLARE_READ16_MEMBER(io_r);
+ DECLARE_WRITE16_MEMBER(io_w);
+
+ void check_irqs(const uint16_t changed);
inline void check_video_irq();
void spg2xx_map(address_map &map);
+ static const device_timer_id TIMER_TMB1 = 0;
+ static const device_timer_id TIMER_TMB2 = 1;
static const device_timer_id TIMER_SCREENPOS = 2;
-
+ static const device_timer_id TIMER_BEAT = 3;
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+ void update_porta_special_modes();
+ void update_portb_special_modes();
+ void do_gpio(uint32_t offset);
+
+ void do_i2c();
void do_cpu_dma(uint32_t len);
void do_sprite_dma(uint32_t len);
- enum blend_enable_t : bool
- {
- BlendOff = false,
- BlendOn = true
- };
-
- enum rowscroll_enable_t : bool
- {
- RowScrollOff = false,
- RowScrollOn = true
- };
-
- enum flipx_t : bool
- {
- FlipXOff = false,
- FlipXOn = true
- };
-
void apply_saturation(const rectangle &cliprect);
void apply_fade(const rectangle &cliprect);
+ void blit(const rectangle &cliprect, uint32_t xoff, uint32_t yoff, uint32_t attr, uint32_t ctrl, uint32_t bitmap_addr, uint16_t tile);
+ void blit_page(const rectangle &cliprect, int depth, uint32_t bitmap_addr, uint16_t *regs);
+ void blit_sprite(const rectangle &cliprect, int depth, uint32_t base_addr);
+ void blit_sprites(const rectangle &cliprect, int depth);
- template<blend_enable_t Blend, rowscroll_enable_t RowScroll, flipx_t FlipX>
- void blit(const rectangle &cliprect, uint32_t line, uint32_t xoff, uint32_t yoff, uint32_t attr, uint32_t ctrl, uint32_t bitmap_addr, uint16_t tile);
- void blit_page(const rectangle &cliprect, uint32_t scanline, int depth, uint32_t bitmap_addr, uint16_t *regs);
- void blit_sprite(const rectangle &cliprect, uint32_t scanline, int depth, uint32_t base_addr);
- void blit_sprites(const rectangle &cliprect, uint32_t scanline, int depth);
-
+ uint8_t expand_rgb5_to_rgb8(uint8_t val);
uint8_t mix_channel(uint8_t a, uint8_t b);
+ void mix_pixel(uint32_t offset, uint16_t rgb);
+ void set_pixel(uint32_t offset, uint16_t rgb);
+
+ void stop_channel(const uint32_t channel);
+ bool advance_channel(address_space &space, const uint32_t channel);
+ bool fetch_sample(address_space &space, const uint32_t channel);
+ void loop_channel(const uint32_t channel);
+
+ struct rgbtriad_t
+ {
+ uint8_t r, g, b;
+ };
- uint32_t m_screenbuf[320 * 240];
- uint8_t m_rgb5_to_rgb8[32];
- uint32_t m_rgb555_to_rgb888[0x8000];
+ rgbtriad_t m_screenbuf[320 * 240];
bool m_hide_page0;
bool m_hide_page1;
bool m_hide_sprites;
bool m_debug_sprites;
bool m_debug_blit;
- bool m_debug_palette;
uint8_t m_sprite_index_to_debug;
- uint16_t m_dma_regs[0x4];
+ bool m_debug_samples;
+ bool m_debug_rates;
+
+ uint16_t m_audio_regs[0x800];
+ uint8_t m_sample_shift[16];
+ uint32_t m_sample_count[16];
+ uint32_t m_sample_addr[16];
+ double m_channel_rate[16];
+ double m_channel_rate_accum[16];
+ uint32_t m_rampdown_frame[16];
+ uint32_t m_envclk_frame[16];
+ uint32_t m_envelope_addr[16];
+ int m_channel_debug;
+ uint16_t m_audio_curr_beat_base_count;
+
+ uint16_t m_io_regs[0x200];
+ uint8_t m_uart_rx_fifo[8];
+ uint8_t m_uart_rx_fifo_start;
+ uint8_t m_uart_rx_fifo_end;
+ uint8_t m_uart_rx_fifo_count;
+ bool m_uart_rx_available;
uint16_t m_video_regs[0x100];
- uint32_t m_sprite_limit;
- int m_rowscrolloffset; // auto racing in 'zone60' minigames needs this to be 15, the JAKKS games (Star Wars Revenge of the sith - Gunship Battle, Wheel of Fortune, Namco Ms. Pac-Man 5-in-1 Pole Position) need it to be 0, where does it come from?
+ size_t m_sprite_limit;
uint16_t m_pal_flag;
devcb_write16 m_porta_out;
@@ -184,8 +473,6 @@ protected:
devcb_read16 m_portb_in;
devcb_read16 m_portc_in;
- devcb_read16 m_adc_in[2];
-
devcb_write8 m_eeprom_w;
devcb_read8 m_eeprom_r;
@@ -193,7 +480,13 @@ protected:
devcb_write8 m_chip_sel;
+ emu_timer *m_tmb1;
+ emu_timer *m_tmb2;
emu_timer *m_screenpos_timer;
+ emu_timer *m_audio_beat;
+
+ sound_stream *m_stream;
+ oki_adpcm_state m_adpcm[16];
required_device<unsp_device> m_cpu;
required_device<screen_device> m_screen;
@@ -201,23 +494,8 @@ protected:
required_shared_ptr<uint16_t> m_paletteram;
required_shared_ptr<uint16_t> m_spriteram;
- void configure_spg_io(spg2xx_io_device* io);
-
- DECLARE_READ16_MEMBER(porta_r) { return m_porta_in(); };
- DECLARE_READ16_MEMBER(portb_r) { return m_portb_in(); };
- DECLARE_READ16_MEMBER(portc_r) { return m_portc_in(); };
- DECLARE_WRITE16_MEMBER(porta_w) { m_porta_out(offset, data, mem_mask); };
- DECLARE_WRITE16_MEMBER(portb_w) { m_portb_out(offset, data, mem_mask); };
- DECLARE_WRITE16_MEMBER(portc_w) { m_portc_out(offset, data, mem_mask); };
- template <size_t Line> DECLARE_READ16_MEMBER(adc_r) { return m_adc_in[Line](); };
-
- DECLARE_WRITE8_MEMBER(eepromx_w) { m_eeprom_w(offset, data, mem_mask); };
- DECLARE_READ8_MEMBER(eepromx_r) { return m_eeprom_r(); };
-
- DECLARE_WRITE8_MEMBER(tx_w) { m_uart_tx(offset, data, mem_mask); };
- DECLARE_WRITE8_MEMBER(cs_w) { m_chip_sel(offset, data, mem_mask); };
- DECLARE_READ16_MEMBER(get_pal_r) { return m_pal_flag; };
-
+ static const uint32_t s_rampdown_frame_counts[8];
+ static const uint32_t s_envclk_frame_counts[16];
};
class spg24x_device : public spg2xx_device
@@ -232,9 +510,6 @@ public:
}
spg24x_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- virtual void device_add_mconfig(machine_config &config) override;
-
};
class spg28x_device : public spg2xx_device
@@ -249,9 +524,6 @@ public:
}
spg28x_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- virtual void device_add_mconfig(machine_config &config) override;
-
};
DECLARE_DEVICE_TYPE(SPG24X, spg24x_device)
diff --git a/src/devices/machine/spg2xx_audio.cpp b/src/devices/machine/spg2xx_audio.cpp
deleted file mode 100644
index a09eb907694..00000000000
--- a/src/devices/machine/spg2xx_audio.cpp
+++ /dev/null
@@ -1,1258 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-/*****************************************************************************
-
- SunPlus SPG2xx-series SoC peripheral emulation (Audio)
-
-**********************************************************************/
-
-#include "emu.h"
-#include "spg2xx_audio.h"
-
-DEFINE_DEVICE_TYPE(SPG2XX_AUDIO, spg2xx_audio_device, "spg2xx", "SPG2xx-series System-on-a-Chip Audio")
-
-#define LOG_SPU_READS (1U << 0)
-#define LOG_SPU_WRITES (1U << 1)
-#define LOG_UNKNOWN_SPU (1U << 2)
-#define LOG_CHANNEL_READS (1U << 3)
-#define LOG_CHANNEL_WRITES (1U << 4)
-#define LOG_ENVELOPES (1U << 5)
-#define LOG_SAMPLES (1U << 6)
-#define LOG_RAMPDOWN (1U << 7)
-#define LOG_BEAT (1U << 8)
-
-#define LOG_ALL (LOG_SPU_READS | LOG_SPU_WRITES | LOG_UNKNOWN_SPU | LOG_CHANNEL_READS | LOG_CHANNEL_WRITES \
- | LOG_ENVELOPES | LOG_SAMPLES | LOG_RAMPDOWN | LOG_BEAT)
-
-#define VERBOSE (0)
-#include "logmacro.h"
-
-#define SPG_DEBUG_AUDIO (0)
-
-
-spg2xx_audio_device::spg2xx_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, type, tag, owner, clock)
- , device_sound_interface(mconfig, *this)
- , m_space_read_cb(*this)
- , m_irq_cb(*this)
-{
-}
-
-spg2xx_audio_device::spg2xx_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : spg2xx_audio_device(mconfig, SPG2XX_AUDIO, tag, owner, clock)
-{
-}
-
-
-void spg2xx_audio_device::device_start()
-{
- m_audio_beat = timer_alloc(TIMER_BEAT);
- m_audio_beat->adjust(attotime::never);
-
- m_stream = stream_alloc(0, 2, 281250/4);
-
- m_channel_debug = -1;
-
- save_item(NAME(m_debug_samples));
- save_item(NAME(m_debug_rates));
-
- save_item(NAME(m_audio_regs));
- save_item(NAME(m_audio_phase_regs));
- save_item(NAME(m_audio_ctrl_regs));
-
- save_item(NAME(m_sample_shift));
- save_item(NAME(m_sample_count));
- save_item(NAME(m_sample_addr));
- save_item(NAME(m_channel_rate));
- save_item(NAME(m_channel_rate_accum));
- save_item(NAME(m_rampdown_frame));
- save_item(NAME(m_envclk_frame));
- save_item(NAME(m_envelope_addr));
- save_item(NAME(m_channel_debug));
- save_item(NAME(m_audio_curr_beat_base_count));
-
-
- for (int i = 0; i < 16; i++)
- {
- save_item(NAME(m_adpcm[i].m_signal), i);
- save_item(NAME(m_adpcm[i].m_step), i);
- }
-
- m_space_read_cb.resolve_safe(0);
- m_irq_cb.resolve();
-}
-
-void spg2xx_audio_device::device_reset()
-{
- memset(m_audio_regs, 0, 0x200 * sizeof(uint16_t));
- memset(m_audio_phase_regs, 0, 0x200 * sizeof(uint16_t));
- memset(m_audio_ctrl_regs, 0, 0x400 * sizeof(uint16_t));
-
- memset(m_sample_shift, 0, 16);
- memset(m_sample_count, 0, sizeof(uint32_t) * 16);
- memset(m_sample_addr, 0, sizeof(uint32_t) * 16);
- memset(m_channel_rate, 0, sizeof(double) * 16);
- memset(m_channel_rate_accum, 0, sizeof(double) * 16);
- memset(m_rampdown_frame, 0, sizeof(uint32_t) * 16);
- memset(m_envclk_frame, 4, sizeof(uint32_t) * 16);
- memset(m_envelope_addr, 0, sizeof(uint32_t) * 16);
-
- m_debug_samples = false;
- m_debug_rates = false;
- m_audio_curr_beat_base_count = 0;
-
- m_audio_ctrl_regs[AUDIO_CHANNEL_REPEAT] = 0x3f;
- m_audio_ctrl_regs[AUDIO_CHANNEL_ENV_MODE] = 0x3f;
-
- m_audio_beat->adjust(attotime::from_ticks(4, 281250), 0, attotime::from_ticks(4, 281250));
-}
-
-
-void spg2xx_audio_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- switch (id)
- {
- case TIMER_BEAT:
- audio_beat_tick();
- break;
- }
-}
-
-/***********************
-* Audio Hardware *
-***********************/
-void spg2xx_audio_device::check_irqs(const uint16_t changed)
-{
- if (changed & (AUDIO_BIS_MASK | AUDIO_BIE_MASK)) // Beat IRQ
- {
- if ((m_audio_ctrl_regs[AUDIO_BEAT_COUNT] & (AUDIO_BIS_MASK | AUDIO_BIE_MASK)) == (AUDIO_BIS_MASK | AUDIO_BIE_MASK))
- {
- LOGMASKED(LOG_BEAT, "Asserting beat IRQ\n");
- m_irq_cb(true);
- }
- else
- {
- LOGMASKED(LOG_BEAT, "Clearing beat IRQ\n");
- m_irq_cb(false);
- }
- }
-}
-
-READ16_MEMBER(spg2xx_audio_device::audio_ctrl_r)
-{
- uint16_t data = m_audio_ctrl_regs[offset];
-
- switch (offset)
- {
- case AUDIO_CHANNEL_ENABLE:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Channel Enable: %04x\n", data);
- break;
-
- case AUDIO_MAIN_VOLUME:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Main Volume: %04x\n", data);
- break;
-
- case AUDIO_CHANNEL_FIQ_ENABLE:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Channel FIQ Enable: %04x\n", data);
- break;
-
- case AUDIO_CHANNEL_FIQ_STATUS:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Channel FIQ Acknowledge: %04x\n", data);
- break;
-
- case AUDIO_BEAT_BASE_COUNT:
- LOGMASKED(LOG_SPU_READS | LOG_BEAT, "audio_ctrl_r: Beat Base Count: %04x\n", data);
- break;
-
- case AUDIO_BEAT_COUNT:
- LOGMASKED(LOG_SPU_READS | LOG_BEAT, "audio_ctrl_r: Beat Count: %04x\n", data);
- break;
-
- case AUDIO_ENVCLK0:
- case AUDIO_ENVCLK1:
- LOGMASKED(LOG_SPU_READS | LOG_ENVELOPES, "audio_ctrl_r: Envelope Interval %d (lo): %04x\n", offset == AUDIO_ENVCLK0 ? 0 : 1, data);
- break;
-
- case AUDIO_ENVCLK0_HIGH:
- case AUDIO_ENVCLK1_HIGH:
- LOGMASKED(LOG_SPU_READS | LOG_ENVELOPES, "audio_ctrl_r: Envelope Interval %d (hi): %04x\n", offset == AUDIO_ENVCLK0_HIGH ? 0 : 1, data);
- break;
-
- case AUDIO_ENV_RAMP_DOWN:
- LOGMASKED(LOG_SPU_READS | LOG_RAMPDOWN, "audio_ctrl_r: Envelope Fast Ramp Down: %04x\n", data);
- break;
-
- case AUDIO_CHANNEL_STOP:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Channel Stop Status: %04x\n", data);
- break;
-
- case AUDIO_CHANNEL_ZERO_CROSS:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Channel Zero-Cross Enable: %04x\n", data);
- break;
-
- case AUDIO_CONTROL:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Control: %04x\n", data);
- break;
-
- case AUDIO_COMPRESS_CTRL:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Compressor Control: %04x\n", data);
- break;
-
- case AUDIO_CHANNEL_STATUS:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Channel Status: %04x\n", data);
- break;
-
- case AUDIO_WAVE_IN_L:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Wave In (L) / FIFO Write Data: %04x\n", data);
- break;
-
- case AUDIO_WAVE_IN_R:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Wave In (R) / Software Channel FIFO IRQ Control: %04x\n", data);
- break;
-
- case AUDIO_WAVE_OUT_L:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Wave Out (L): %04x\n", data);
- break;
-
- case AUDIO_WAVE_OUT_R:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Wave Out (R): %04x\n", data);
- break;
-
- case AUDIO_CHANNEL_REPEAT:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Channel Repeat Enable: %04x\n", data);
- break;
-
- case AUDIO_CHANNEL_ENV_MODE:
- LOGMASKED(LOG_SPU_READS | LOG_ENVELOPES, "audio_ctrl_r: Channel Envelope Enable: %04x\n", data);
- break;
-
- case AUDIO_CHANNEL_TONE_RELEASE:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Channel Tone Release Enable: %04x\n", data);
- break;
-
- case AUDIO_CHANNEL_ENV_IRQ:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Channel Envelope IRQ Status: %04x\n", data);
- break;
-
- case AUDIO_CHANNEL_PITCH_BEND:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Channel Pitch Bend Enable: %04x\n", data);
- break;
-
- case AUDIO_SOFT_PHASE:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Software Channel Phase: %04x\n", data);
- break;
-
- case AUDIO_ATTACK_RELEASE:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: Attack/Release Time Control: %04x\n", data);
- break;
-
- case AUDIO_EQ_CUTOFF10:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: EQ Cutoff Frequency 0/1: %04x\n", data);
- break;
-
- case AUDIO_EQ_CUTOFF32:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: EQ Cutoff Frequency 2/3: %04x\n", data);
- break;
-
- case AUDIO_EQ_GAIN10:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: EQ Cutoff Gain 0/1: %04x\n", data);
- break;
-
- case AUDIO_EQ_GAIN32:
- LOGMASKED(LOG_SPU_READS, "audio_ctrl_r: EQ Cutoff Gain 2/3: %04x\n", data);
- break;
-
- default:
- LOGMASKED(LOG_UNKNOWN_SPU, "audio_ctrl_r: Unknown register %04x = %04x\n", 0x3000 + offset, data);
- break;
- }
-
- return data;
-}
-
-READ16_MEMBER(spg2xx_audio_device::audio_r)
-{
- const uint16_t channel = (offset & 0x00f0) >> 4;
- uint16_t data = m_audio_regs[offset];
-
-
- switch (offset & AUDIO_CHAN_OFFSET_MASK)
- {
- case AUDIO_WAVE_ADDR:
- LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Wave Addr (lo): %04x\n", channel, data);
- break;
-
- case AUDIO_MODE:
- LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Mode: %04x (ADPCM:%d, 16M:%d, TONE:%d, LADDR_HI:%04x, WADDR_HI:%04x)\n", channel, data,
- get_adpcm_bit(channel), get_16bit_bit(channel), get_tone_mode(channel), get_loop_addr_high(channel), get_wave_addr_high(channel));
- break;
-
- case AUDIO_LOOP_ADDR:
- LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Loop Addr: %04x\n", channel, data);
- break;
-
- case AUDIO_PAN_VOL:
- LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Pan/Vol: %04x (PAN:%02x, VOL:%02x)\n", channel, data,
- get_pan(channel), get_volume(channel));
- break;
-
- case AUDIO_ENVELOPE0:
- LOGMASKED(LOG_CHANNEL_READS | LOG_ENVELOPES, "audio_r: Channel %d: Envelope0: %04x (RPTPER:%d, TARGET:%02x, SIGN:%d, INC:%02x)\n", channel, data,
- get_repeat_period_bit(channel), get_envelope_target(channel), get_envelope_sign_bit(channel), get_envelope_inc(channel));
- break;
-
- case AUDIO_ENVELOPE_DATA:
- LOGMASKED(LOG_CHANNEL_READS | LOG_ENVELOPES, "audio_r: Channel %d: Envelope Data: %04x (CNT:%d, EDD:%02x)\n", channel, data,
- get_envelope_count(channel), get_edd(channel));
- break;
-
- case AUDIO_ENVELOPE1:
- LOGMASKED(LOG_CHANNEL_READS | LOG_ENVELOPES, "audio_r: Channel %d: Envelope1 Data: %04x (RPTCNT:%02x, RPT:%d, LOAD:%02x)\n", channel, data,
- get_envelope_repeat_count(channel), get_envelope_repeat_bit(channel), get_envelope_load(channel));
- break;
-
- case AUDIO_ENVELOPE_ADDR_HIGH:
- LOGMASKED(LOG_CHANNEL_READS | LOG_ENVELOPES, "audio_r: Channel %d: Envelope Addr (hi): %04x (IRQADDR:%03x, IRQEN:%d, EADDR_HI:%02x)\n", channel, data,
- get_audio_irq_addr(channel), get_audio_irq_enable_bit(channel), get_envelope_addr_high(channel));
- break;
-
- case AUDIO_ENVELOPE_ADDR:
- LOGMASKED(LOG_CHANNEL_READS | LOG_ENVELOPES, "audio_r: Channel %d: Envelope Addr (lo): %04x \n", channel, data);
- break;
-
- case AUDIO_WAVE_DATA_PREV:
- LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Wave Data Prev: %04x \n", channel, data);
- break;
-
- case AUDIO_ENVELOPE_LOOP_CTRL:
- LOGMASKED(LOG_CHANNEL_READS | LOG_ENVELOPES, "audio_r: Channel %d: Envelope Loop Ctrl: %04x (RDOFFS:%02x, EAOFFS:%03x)\n", channel, data,
- get_rampdown_offset(channel), get_envelope_eaoffset(channel));
- break;
-
- case AUDIO_WAVE_DATA:
- LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: Wave Data: %04x\n", channel, data);
- break;
-
- case AUDIO_ADPCM_SEL:
- LOGMASKED(LOG_CHANNEL_READS, "audio_r: Channel %d: ADPCM Sel: %04x (ADPCM36:%d, POINTNUM:%02x\n", channel, data,
- get_adpcm36_bit(channel), get_point_number(channel));
- break;
-
- default:
- LOGMASKED(LOG_UNKNOWN_SPU, "audio_r: Unknown register %04x\n", 0x3000 + offset);
- break;
-
- }
-
- return data;
-}
-
-
-READ16_MEMBER(spg2xx_audio_device::audio_phase_r)
-{
- const uint16_t channel = (offset & 0x00f0) >> 4;
- uint16_t data = m_audio_phase_regs[offset];
-
- switch (offset & AUDIO_CHAN_OFFSET_MASK)
- {
- case AUDIO_PHASE_HIGH:
- LOGMASKED(LOG_CHANNEL_READS, "audio_phase_r: Channel %d: Phase High: %04x\n", channel, data);
- break;
-
- case AUDIO_PHASE_ACCUM_HIGH:
- LOGMASKED(LOG_CHANNEL_READS, "audio_phase_r: Channel %d: Phase Accum High: %04x\n", channel, data);
- break;
-
- case AUDIO_TARGET_PHASE_HIGH:
- LOGMASKED(LOG_CHANNEL_READS, "audio_phase_r: Channel %d: Target Phase High: %04x\n", channel, data);
- break;
-
- case AUDIO_RAMP_DOWN_CLOCK:
- LOGMASKED(LOG_CHANNEL_READS | LOG_RAMPDOWN, "audio_phase_r: Channel %d: Rampdown Clock: %04x\n", channel, data);
- break;
-
- case AUDIO_PHASE:
- LOGMASKED(LOG_CHANNEL_READS, "audio_phase_r: Channel %d: Phase: %04x\n", channel, data);
- break;
-
- case AUDIO_PHASE_ACCUM:
- LOGMASKED(LOG_CHANNEL_READS, "audio_phase_r: Channel %d: Phase Accum: %04x\n", channel, data);
- break;
-
- case AUDIO_TARGET_PHASE:
- LOGMASKED(LOG_CHANNEL_READS, "audio_phase_r: Channel %d: Target Phase: %04x\n", channel, data);
- break;
-
- case AUDIO_PHASE_CTRL:
- LOGMASKED(LOG_CHANNEL_READS, "audio_phase_r: Channel %d: Phase Ctrl: %04x (TIMESTEP:%d, SIGN:%d, OFFSET:%03x\n", channel, data,
- get_phase_time_step(channel), get_phase_sign_bit(channel), get_phase_offset(channel));
- break;
-
- default:
- LOGMASKED(LOG_UNKNOWN_SPU, "audio_phase_r: Unknown register %04x\n", 0x3000 + offset);
- break;
- }
-
- return data;
-}
-
-WRITE16_MEMBER(spg2xx_audio_device::audio_ctrl_w)
-{
- switch (offset)
- {
- case AUDIO_CHANNEL_ENABLE:
- {
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Channel Enable: %04x\n", data);
- const uint16_t changed = m_audio_ctrl_regs[AUDIO_CHANNEL_ENABLE] ^ data;
- for (uint32_t channel_bit = 0; channel_bit < 16; channel_bit++)
- {
- const uint16_t mask = 1 << channel_bit;
- if (!(changed & mask))
- continue;
-
- if (data & mask)
- {
- if (!(m_audio_ctrl_regs[AUDIO_CHANNEL_STATUS] & mask))
- {
- LOGMASKED(LOG_SPU_WRITES, "Enabling channel %d\n", channel_bit);
- m_audio_ctrl_regs[offset] |= mask;
- if (!(m_audio_ctrl_regs[AUDIO_CHANNEL_STOP] & mask))
- {
- LOGMASKED(LOG_SPU_WRITES, "Stop not set, starting playback on channel %d, mask %04x\n", channel_bit, mask);
- m_audio_ctrl_regs[AUDIO_CHANNEL_STATUS] |= mask;
- m_sample_addr[channel_bit] = get_wave_addr(channel_bit);
- m_envelope_addr[channel_bit] = get_envelope_addr(channel_bit);
- set_envelope_count(channel_bit, get_envelope_load(channel_bit));
- }
- m_adpcm[channel_bit].reset();
- m_sample_shift[channel_bit] = 0;
- m_sample_count[channel_bit] = 0;
- }
- }
- else
- {
- stop_channel(channel_bit);
- //m_audio_ctrl_regs[offset] &= ~mask;
- //m_audio_ctrl_regs[AUDIO_CHANNEL_STATUS] &= ~mask;
- //m_audio_ctrl_regs[AUDIO_CHANNEL_STOP] |= mask;
- //m_audio_ctrl_regs[AUDIO_CHANNEL_TONE_RELEASE] &= ~mask;
- }
- }
- break;
- }
-
- case AUDIO_MAIN_VOLUME:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Main Volume: %04x\n", data);
- m_audio_ctrl_regs[offset] = data & AUDIO_MAIN_VOLUME_MASK;
- break;
-
- case AUDIO_CHANNEL_FIQ_ENABLE:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Channel FIQ Enable: %04x\n", data);
- m_audio_ctrl_regs[offset] = data & AUDIO_CHANNEL_FIQ_ENABLE_MASK;
- break;
-
- case AUDIO_CHANNEL_FIQ_STATUS:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Channel FIQ Acknowledge: %04x\n", data);
- m_audio_ctrl_regs[offset] &= ~(data & AUDIO_CHANNEL_FIQ_STATUS_MASK);
- break;
-
- case AUDIO_BEAT_BASE_COUNT:
- LOGMASKED(LOG_SPU_WRITES | LOG_BEAT, "audio_ctrl_w: Beat Base Count: %04x\n", data);
- m_audio_ctrl_regs[offset] = data & AUDIO_BEAT_BASE_COUNT_MASK;
- m_audio_curr_beat_base_count = m_audio_ctrl_regs[offset];
- break;
-
- case AUDIO_BEAT_COUNT:
- {
- LOGMASKED(LOG_SPU_WRITES | LOG_BEAT, "audio_ctrl_w: Beat Count: %04x\n", data);
- const uint16_t old = m_audio_ctrl_regs[offset];
- m_audio_ctrl_regs[offset] &= ~(data & AUDIO_BIS_MASK);
- m_audio_ctrl_regs[offset] &= AUDIO_BIS_MASK;
- m_audio_ctrl_regs[offset] |= data & ~AUDIO_BIS_MASK;
- const uint16_t changed = old ^ m_audio_ctrl_regs[offset];
- if (changed & (AUDIO_BIS_MASK | AUDIO_BIE_MASK))
- {
- LOGMASKED(LOG_BEAT, "BIS mask changed, updating IRQ\n");
- check_irqs(changed & (AUDIO_BIS_MASK | AUDIO_BIE_MASK));
- }
- break;
- }
-
- case AUDIO_ENVCLK0:
- case AUDIO_ENVCLK1:
- {
- LOGMASKED(LOG_SPU_WRITES | LOG_ENVELOPES, "audio_ctrl_w: Envelope Interval %d (lo): %04x\n", offset == AUDIO_ENVCLK0 ? 0 : 1, data);
- const uint16_t old = m_audio_ctrl_regs[offset];
- m_audio_ctrl_regs[offset] = data;
- const uint16_t changed = old ^ m_audio_ctrl_regs[offset];
-
- if (!changed)
- break;
-
- const uint8_t channel_offset = offset == AUDIO_ENVCLK0 ? 0 : 8;
- for (uint8_t channel_bit = 0; channel_bit < 4; channel_bit++)
- {
- const uint8_t shift = channel_bit << 2;
- const uint16_t mask = 0x0f << shift;
- if (changed & mask)
- {
- m_envclk_frame[channel_bit + channel_offset] = get_envclk_frame_count(channel_bit + channel_offset);
- }
- }
- break;
- }
-
- case AUDIO_ENVCLK0_HIGH:
- case AUDIO_ENVCLK1_HIGH:
- {
- LOGMASKED(LOG_SPU_WRITES | LOG_ENVELOPES, "audio_ctrl_w: Envelope Interval %d (hi): %04x\n", offset == AUDIO_ENVCLK0_HIGH ? 0 : 1, data);
- const uint16_t old = m_audio_ctrl_regs[offset];
- m_audio_ctrl_regs[offset] = data;
- const uint16_t changed = old ^ m_audio_ctrl_regs[offset];
- if (!changed)
- break;
-
- const uint8_t channel_offset = offset == AUDIO_ENVCLK0_HIGH ? 0 : 8;
- for (uint8_t channel_bit = 0; channel_bit < 4; channel_bit++)
- {
- const uint8_t shift = channel_bit << 2;
- const uint16_t mask = 0x0f << shift;
- if (changed & mask)
- {
- m_envclk_frame[channel_bit + channel_offset + 4] = get_envclk_frame_count(channel_bit + channel_offset);
- }
- }
- break;
- }
-
- case AUDIO_ENV_RAMP_DOWN:
- {
- LOGMASKED(LOG_SPU_WRITES | LOG_RAMPDOWN, "audio_ctrl_w: Envelope Fast Ramp Down: %04x\n", data);
- const uint16_t old = m_audio_ctrl_regs[offset];
- m_audio_ctrl_regs[offset] = (data & AUDIO_ENV_RAMP_DOWN_MASK) & m_audio_ctrl_regs[AUDIO_CHANNEL_STATUS];
- const uint16_t changed = old ^ m_audio_ctrl_regs[offset];
- if (!changed)
- break;
-
- for (uint32_t channel_bit = 0; channel_bit < 16; channel_bit++)
- {
- const uint16_t mask = 1 << channel_bit;
- if ((changed & mask) && (data & mask))
- {
- m_rampdown_frame[channel_bit] = get_rampdown_frame_count(channel_bit);
- LOGMASKED(LOG_RAMPDOWN, "Preparing to ramp down channel %d in %d ticks\n", channel_bit, m_rampdown_frame[channel_bit] / 13);
- }
- }
- break;
- }
-
- case AUDIO_CHANNEL_STOP:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Channel Stop Status: %04x\n", data);
- m_audio_ctrl_regs[offset] &= ~data;
- break;
-
- case AUDIO_CHANNEL_ZERO_CROSS:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Channel Zero-Cross Enable: %04x\n", data);
- m_audio_ctrl_regs[offset] = data & AUDIO_CHANNEL_ZERO_CROSS_MASK;
- break;
-
- case AUDIO_CONTROL:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Control: %04x (SOFTCH:%d, COMPEN:%d, NOHIGH:%d, NOINT:%d, EQEN:%d, VOLSEL:%d)\n", data
- , (data & AUDIO_CONTROL_SOFTCH_MASK) ? 1 : 0
- , (data & AUDIO_CONTROL_COMPEN_MASK) ? 1 : 0
- , (data & AUDIO_CONTROL_NOHIGH_MASK) ? 1 : 0
- , (data & AUDIO_CONTROL_NOINT_MASK) ? 1 : 0
- , (data & AUDIO_CONTROL_EQEN_MASK) ? 1 : 0
- , (data & AUDIO_CONTROL_VOLSEL_MASK) >> AUDIO_CONTROL_VOLSEL_SHIFT);
- m_audio_ctrl_regs[offset] = data & AUDIO_CONTROL_MASK;
- break;
-
- case AUDIO_COMPRESS_CTRL:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Compressor Control: %04x\n", data);
- m_audio_ctrl_regs[offset] = data;
- break;
-
- case AUDIO_CHANNEL_STATUS:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Channel Status (read-only): %04x\n", data);
- break;
-
- case AUDIO_WAVE_IN_L:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Wave In (L) / FIFO Write Data: %04x\n", data);
- m_audio_ctrl_regs[offset] = data;
- break;
-
- case AUDIO_WAVE_IN_R:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Wave In (R) / Software Channel FIFO IRQ Control: %04x\n", data);
- m_audio_ctrl_regs[offset] = data;
- break;
-
- case AUDIO_WAVE_OUT_L:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Wave Out (L): %04x\n", data);
- m_audio_ctrl_regs[offset] = data;
- break;
-
- case AUDIO_WAVE_OUT_R:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Wave Out (R): %04x\n", data);
- m_audio_ctrl_regs[offset] = data;
- break;
-
- case AUDIO_CHANNEL_REPEAT:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Channel Repeat Enable: %04x\n", data);
- m_audio_ctrl_regs[offset] = data & AUDIO_CHANNEL_REPEAT_MASK;
- break;
-
- case AUDIO_CHANNEL_ENV_MODE:
- LOGMASKED(LOG_SPU_WRITES | LOG_ENVELOPES, "audio_ctrl_w: Channel Envelope Enable: %04x\n", data);
- m_audio_ctrl_regs[offset] = data & AUDIO_CHANNEL_ENV_MODE_MASK;
- break;
-
- case AUDIO_CHANNEL_TONE_RELEASE:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Channel Tone Release Enable: %04x\n", data);
- m_audio_ctrl_regs[offset] = data & AUDIO_CHANNEL_TONE_RELEASE_MASK;
- break;
-
- case AUDIO_CHANNEL_ENV_IRQ:
- LOGMASKED(LOG_SPU_WRITES | LOG_ENVELOPES, "audio_ctrl_w: Channel Envelope IRQ Acknowledge: %04x\n", data);
- m_audio_ctrl_regs[offset] &= ~data & AUDIO_CHANNEL_ENV_IRQ_MASK;
- break;
-
- case AUDIO_CHANNEL_PITCH_BEND:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Channel Pitch Bend Enable: %04x\n", data);
- m_audio_ctrl_regs[offset] = data & AUDIO_CHANNEL_PITCH_BEND_MASK;
- break;
-
- case AUDIO_SOFT_PHASE:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Software Channel Phase: %04x\n", data);
- m_audio_ctrl_regs[offset] = data;
- break;
-
- case AUDIO_ATTACK_RELEASE:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: Attack/Release Time Control: %04x\n", data);
- m_audio_ctrl_regs[offset] = data;
- break;
-
- case AUDIO_EQ_CUTOFF10:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: EQ Cutoff Frequency 0/1: %04x\n", data);
- m_audio_ctrl_regs[offset] = data & AUDIO_EQ_CUTOFF10_MASK;
- break;
-
- case AUDIO_EQ_CUTOFF32:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: EQ Cutoff Frequency 2/3: %04x\n", data);
- m_audio_ctrl_regs[offset] = data & AUDIO_EQ_CUTOFF32_MASK;
- break;
-
- case AUDIO_EQ_GAIN10:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: EQ Cutoff Gain 0/1: %04x\n", data);
- m_audio_ctrl_regs[offset] = data & AUDIO_EQ_GAIN10_MASK;
- break;
-
- case AUDIO_EQ_GAIN32:
- LOGMASKED(LOG_SPU_WRITES, "audio_ctrl_w: EQ Cutoff Gain 2/3: %04x\n", data);
- m_audio_ctrl_regs[offset] = data & AUDIO_EQ_GAIN32_MASK;
- break;
-
- default:
- m_audio_ctrl_regs[offset] = data;
- LOGMASKED(LOG_UNKNOWN_SPU, "audio_ctrl_w: Unknown register %04x = %04x\n", 0x3000 + offset, data);
- break;
- }
-}
-
-WRITE16_MEMBER(spg2xx_audio_device::audio_phase_w)
-{
- const uint16_t channel = (offset & 0x00f0) >> 4;
-
- switch (offset & AUDIO_CHAN_OFFSET_MASK)
- {
- case AUDIO_PHASE_HIGH:
- m_audio_phase_regs[offset] = data & AUDIO_PHASE_HIGH_MASK;
- m_channel_rate[channel] = ((double)get_phase(channel) * 140625.0 * 2.0) / (double)(1 << 19);
- m_channel_rate_accum[channel] = 0.0;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_phase_w: Channel %d: Phase High: %04x (rate: %f)\n", channel, data, m_channel_rate[channel]);
- break;
-
- case AUDIO_PHASE_ACCUM_HIGH:
- m_audio_phase_regs[offset] = data & AUDIO_PHASE_ACCUM_HIGH_MASK;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_phase_w: Channel %d: Phase Accum High: %04x\n", channel, data);
- break;
-
- case AUDIO_TARGET_PHASE_HIGH:
- m_audio_phase_regs[offset] = data & AUDIO_TARGET_PHASE_HIGH_MASK;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_phase_w: Channel %d: Target Phase High: %04x\n", channel, data);
- break;
-
- case AUDIO_RAMP_DOWN_CLOCK:
- m_audio_phase_regs[offset] = data & AUDIO_RAMP_DOWN_CLOCK_MASK;
- LOGMASKED(LOG_CHANNEL_WRITES | LOG_RAMPDOWN, "audio_phase_w: Channel %d: Rampdown Clock: %04x\n", channel, data);
- break;
-
- case AUDIO_PHASE:
- m_audio_phase_regs[offset] = data;
- m_channel_rate[channel] = ((double)get_phase(channel) * 140625.0 * 2.0) / (double)(1 << 19);
- m_channel_rate_accum[channel] = 0.0;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_phase_w: Channel %d: Phase: %04x (rate: %f)\n", channel, data, m_channel_rate[channel]);
- break;
-
- case AUDIO_PHASE_ACCUM:
- m_audio_phase_regs[offset] = data;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_phase_w: Channel %d: Phase Accum: %04x\n", channel, data);
- break;
-
- case AUDIO_TARGET_PHASE:
- m_audio_phase_regs[offset] = data;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_phase_w: Channel %d: Target Phase: %04x\n", channel, data);
- break;
-
- case AUDIO_PHASE_CTRL:
- m_audio_phase_regs[offset] = data;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_phase_w: Channel %d: Phase Ctrl: %04x (TIMESTEP:%d, SIGN:%d, OFFSET:%03x\n", channel, data,
- get_phase_time_step(channel), get_phase_sign_bit(channel), get_phase_offset(channel));
- break;
-
- default:
- m_audio_phase_regs[offset] = data;
- LOGMASKED(LOG_UNKNOWN_SPU, "audio_phase_w: Unknown register %04x = %04x\n", 0x3000 + offset, data);
- break;
- }
-}
-
-
-WRITE16_MEMBER(spg2xx_audio_device::audio_w)
-{
- const uint16_t channel = (offset & 0x00f0) >> 4;
-
- switch (offset & AUDIO_CHAN_OFFSET_MASK)
- {
- case AUDIO_WAVE_ADDR:
- m_audio_regs[offset] = data;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Wave Addr (lo): %04x\n", channel, data);
- break;
-
- case AUDIO_MODE:
- m_audio_regs[offset] = data;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Mode: %04x (ADPCM:%d, 16M:%d, TONE:%d, LADDR_HI:%04x, WADDR_HI:%04x)\n", channel, data,
- get_adpcm_bit(channel), get_16bit_bit(channel), get_tone_mode(channel), get_loop_addr_high(channel), get_wave_addr_high(channel));
- break;
-
- case AUDIO_LOOP_ADDR:
- m_audio_regs[offset] = data;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Loop Addr: %04x\n", channel, data);
- break;
-
- case AUDIO_PAN_VOL:
- m_audio_regs[offset] = data & AUDIO_PAN_VOL_MASK;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Pan/Vol: %04x (PAN:%02x, VOL:%02x)\n", channel, data,
- get_pan(channel), get_volume(channel));
- break;
-
- case AUDIO_ENVELOPE0:
- m_audio_regs[offset] = data;
- LOGMASKED(LOG_CHANNEL_WRITES | LOG_ENVELOPES, "audio_w: Channel %d: Envelope0: %04x (RPTPER:%d, TARGET:%02x, SIGN:%d, INC:%02x)\n", channel, data,
- get_repeat_period_bit(channel), get_envelope_target(channel), get_envelope_sign_bit(channel), get_envelope_inc(channel));
- break;
-
- case AUDIO_ENVELOPE_DATA:
- m_audio_regs[offset] = data & AUDIO_ENVELOPE_DATA_MASK;
- LOGMASKED(LOG_CHANNEL_WRITES | LOG_ENVELOPES, "audio_w: Channel %d: Envelope Data: %04x (CNT:%d, EDD:%02x)\n", channel, data,
- get_envelope_count(channel), get_edd(channel));
- break;
-
- case AUDIO_ENVELOPE1:
- m_audio_regs[offset] = data;
- LOGMASKED(LOG_CHANNEL_WRITES | LOG_ENVELOPES, "audio_w: Channel %d: Envelope1 Data: %04x (RPTCNT:%02x, RPT:%d, LOAD:%02x)\n", channel, data,
- get_envelope_repeat_count(channel), get_envelope_repeat_bit(channel), get_envelope_load(channel));
- break;
-
- case AUDIO_ENVELOPE_ADDR_HIGH:
- m_audio_regs[offset] = data;
- LOGMASKED(LOG_CHANNEL_WRITES | LOG_ENVELOPES, "audio_w: Channel %d: Envelope Addr (hi): %04x (IRQADDR:%03x, IRQEN:%d, EADDR_HI:%02x)\n", channel, data,
- get_audio_irq_addr(channel), get_audio_irq_enable_bit(channel), get_envelope_addr_high(channel));
- break;
-
- case AUDIO_ENVELOPE_ADDR:
- m_audio_regs[offset] = data;
- LOGMASKED(LOG_CHANNEL_WRITES | LOG_ENVELOPES, "audio_w: Channel %d: Envelope Addr (lo): %04x\n", channel, data);
- break;
-
- case AUDIO_WAVE_DATA_PREV:
- m_audio_regs[offset] = data;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Wave Data Prev: %04x \n", channel, data);
- break;
-
- case AUDIO_ENVELOPE_LOOP_CTRL:
- m_audio_regs[offset] = data;
- LOGMASKED(LOG_CHANNEL_WRITES | LOG_ENVELOPES, "audio_w: Channel %d: Envelope Loop Ctrl: %04x (RDOFFS:%02x, EAOFFS:%03x)\n", channel, data,
- get_rampdown_offset(channel), get_envelope_eaoffset(channel));
- break;
-
- case AUDIO_WAVE_DATA:
- m_audio_regs[offset] = data;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: Wave Data: %04x\n", channel, data);
- break;
-
- case AUDIO_ADPCM_SEL:
- m_audio_regs[offset] = data & AUDIO_ADPCM_SEL_MASK;
- LOGMASKED(LOG_CHANNEL_WRITES, "audio_w: Channel %d: ADPCM Sel: %04x (ADPCM36:%d, POINTNUM:%02x\n", channel, data,
- get_adpcm36_bit(channel), get_point_number(channel));
- break;
-
- default:
- m_audio_regs[offset] = data;
- LOGMASKED(LOG_UNKNOWN_SPU, "audio_w: Unknown register %04x = %04x\n", 0x3000 + offset, data);
- break;
-
- }
-}
-
-void spg2xx_audio_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
-{
- stream_sample_t *out_l = outputs[0];
- stream_sample_t *out_r = outputs[1];
-
- for (int i = 0; i < samples; i++)
- {
- int32_t left_total = 0;
- int32_t right_total = 0;
-
- for (uint32_t channel = 0; channel < 16; channel++)
- {
- if (!get_channel_status(channel))
- {
- continue;
- }
-
- if (SPG_DEBUG_AUDIO && m_debug_rates)
- printf("%f:%f ", m_channel_rate[channel], m_channel_rate_accum[channel]);
- bool playing = advance_channel(channel);
- if (playing)
- {
- int32_t sample = (int16_t)(m_audio_regs[(channel << 4) | AUDIO_WAVE_DATA] ^ 0x8000);
- if (!(m_audio_ctrl_regs[AUDIO_CONTROL] & AUDIO_CONTROL_NOINT_MASK))
- {
- int32_t prev_sample = (int16_t)(m_audio_regs[(channel << 4) | AUDIO_WAVE_DATA_PREV] ^ 0x8000);
- int16_t lerp_factor = (int16_t)((m_channel_rate_accum[channel] / 70312.5) * 256.0);
- prev_sample = (prev_sample * (0x100 - lerp_factor)) >> 8;
- sample = (sample * lerp_factor) >> 8;
- sample += prev_sample;
- }
-
- sample = (sample * (int32_t)get_edd(channel)) >> 7;
-
- int32_t vol = get_volume(channel);
- int32_t pan = get_pan(channel);
-
- int32_t pan_left, pan_right;
- if (pan < 0x40)
- {
- pan_left = 0x7f * vol;
- pan_right = pan * 2 * vol;
- }
- else
- {
- pan_left = (0x7f - pan) * 2 * vol;
- pan_right = 0x7f * vol;
- }
-
- left_total += ((int16_t)sample * (int16_t)pan_left) >> 14;
- right_total += ((int16_t)sample * (int16_t)pan_right) >> 14;
-
- const uint16_t mask = (1 << channel);
- if (m_audio_ctrl_regs[AUDIO_ENV_RAMP_DOWN] & mask)
- {
- if (m_rampdown_frame[channel] == 0)
- {
- LOGMASKED(LOG_RAMPDOWN, "Ticking rampdown for channel %d\n", channel);
- audio_rampdown_tick(channel);
- }
- m_rampdown_frame[channel]--;
- }
- else if (!(m_audio_ctrl_regs[AUDIO_CHANNEL_ENV_MODE] & mask))
- {
- if (m_envclk_frame[channel] == 0)
- {
- LOGMASKED(LOG_ENVELOPES, "Ticking envelope for channel %d\n", channel);
- audio_envelope_tick(channel);
- m_envclk_frame[channel] = get_envclk_frame_count(channel);
- }
- m_envclk_frame[channel]--;
- }
- }
- }
-
- switch (get_vol_sel())
- {
- case 0: // 1/16
- left_total >>= 4;
- right_total >>= 4;
- break;
- case 1: // 1/4
- case 2: // 1
- case 3: // 2 // Both x1 and x2 clip like mad even with only 6 voices. Hack it for now.
- left_total >>= 2;
- right_total >>= 2;
- break;
- }
- *out_l++ = (left_total * (int16_t)m_audio_ctrl_regs[AUDIO_MAIN_VOLUME]) >> 7;
- *out_r++ = (right_total * (int16_t)m_audio_ctrl_regs[AUDIO_MAIN_VOLUME]) >> 7;
- }
-}
-
-inline void spg2xx_audio_device::stop_channel(const uint32_t channel)
-{
- // TODO: IRQs
- m_audio_ctrl_regs[AUDIO_CHANNEL_ENABLE] &= ~(1 << channel);
- m_audio_ctrl_regs[AUDIO_CHANNEL_STATUS] &= ~(1 << channel);
- m_audio_regs[(channel << 4) | AUDIO_MODE] &= ~AUDIO_ADPCM_MASK;
- m_audio_ctrl_regs[AUDIO_CHANNEL_TONE_RELEASE] &= ~(1 << channel);
- m_audio_ctrl_regs[AUDIO_ENV_RAMP_DOWN] &= ~(1 << channel);
-}
-
-bool spg2xx_audio_device::advance_channel(const uint32_t channel)
-{
- m_channel_rate_accum[channel] += m_channel_rate[channel];
- uint32_t samples_to_advance = 0;
- while (m_channel_rate_accum[channel] >= 70312.5)
- {
- m_channel_rate_accum[channel] -= 70312.5;
- samples_to_advance++;
- }
-
- if (!samples_to_advance)
- return true;
-
- bool playing = true;
-
- for (uint32_t sample = 0; sample < samples_to_advance; sample++)
- {
- playing = fetch_sample(channel);
- if (!playing)
- break;
-
- if (get_adpcm_bit(channel))
- {
- // ADPCM mode
- m_sample_shift[channel] += 4;
- if (m_sample_shift[channel] >= 16)
- {
- m_sample_shift[channel] = 0;
- m_sample_addr[channel]++;
- }
- }
- else if (get_16bit_bit(channel))
- {
- // 16-bit mode
- m_sample_addr[channel]++;
- }
- else
- {
- // 8-bit mode
- m_sample_shift[channel] += 8;
- if (m_sample_shift[channel] >= 16)
- {
- m_sample_shift[channel] = 0;
- m_sample_addr[channel]++;
- }
- }
- }
-
- return playing;
-}
-
-uint16_t spg2xx_audio_device::read_space(offs_t offset)
-{
- return m_space_read_cb(offset);
-}
-
-bool spg2xx_audio_device::fetch_sample(const uint32_t channel)
-{
- const uint32_t channel_mask = channel << 4;
- m_audio_regs[channel_mask | AUDIO_WAVE_DATA_PREV] = m_audio_regs[channel_mask | AUDIO_WAVE_DATA];
-
- const uint32_t wave_data_reg = channel_mask | AUDIO_WAVE_DATA;
- const uint16_t tone_mode = get_tone_mode(channel);
- uint16_t raw_sample = tone_mode ? read_space(m_sample_addr[channel]) : m_audio_regs[wave_data_reg];
-
- LOGMASKED(LOG_SAMPLES, "Channel %d: Raw sample %04x\n", channel, raw_sample);
-
- if (get_adpcm_bit(channel))
- {
- // ADPCM mode
- if (tone_mode != 0 && raw_sample == 0xffff)
- {
- if (tone_mode == AUDIO_TONE_MODE_HW_ONESHOT)
- {
- LOGMASKED(LOG_SAMPLES, "ADPCM stopped after %d samples\n", m_sample_count[channel]);
- m_sample_count[channel] = 0;
- stop_channel(channel);
- return false;
- }
- else
- {
- LOGMASKED(LOG_SAMPLES, "ADPCM looping after %d samples\n", m_sample_count[channel]);
- m_sample_count[channel] = 0;
- loop_channel(channel);
- m_audio_regs[(channel << 4) | AUDIO_MODE] &= ~AUDIO_ADPCM_MASK;
- }
- }
- else
- {
- m_audio_regs[wave_data_reg] = raw_sample;
- m_audio_regs[wave_data_reg] >>= m_sample_shift[channel];
- const uint8_t adpcm_sample = (uint8_t)(m_audio_regs[wave_data_reg] & 0x000f);
- m_audio_regs[wave_data_reg] = (uint16_t)(m_adpcm[channel].clock(adpcm_sample) << 4) ^ 0x8000;
- }
- m_sample_count[channel]++;
- }
- else if (get_16bit_bit(channel))
- {
- // 16-bit mode
- if (tone_mode != 0 && raw_sample == 0xffff)
- {
- if (tone_mode == AUDIO_TONE_MODE_HW_ONESHOT)
- {
- LOGMASKED(LOG_SAMPLES, "16-bit PCM stopped after %d samples\n", m_sample_count[channel]);
- m_sample_count[channel] = 0;
- stop_channel(channel);
- return false;
- }
- else
- {
- LOGMASKED(LOG_SAMPLES, "16-bit PCM looping after %d samples\n", m_sample_count[channel]);
- m_sample_count[channel] = 0;
- loop_channel(channel);
- }
- }
- else
- {
- m_audio_regs[wave_data_reg] = raw_sample;
- }
- m_sample_count[channel]++;
- }
- else
- {
- // 8-bit mode
- LOGMASKED(LOG_SAMPLES, "Channel %d: Processing as 8-bit sample, tone_mode is %d, sample_shift is %d\n", channel, tone_mode, m_sample_shift[channel]);
- if (tone_mode != 0)
- {
- if (m_sample_shift[channel])
- raw_sample &= 0xff00;
- else
- raw_sample <<= 8;
- raw_sample |= raw_sample >> 8;
-
- if (raw_sample == 0xffff)
- {
- if (tone_mode == AUDIO_TONE_MODE_HW_ONESHOT)
- {
- LOGMASKED(LOG_SAMPLES, "Channel %d: 8-bit PCM stopped after %d samples\n", channel, m_sample_count[channel]);
- m_sample_count[channel] = 0;
- stop_channel(channel);
- return false;
- }
- else
- {
- LOGMASKED(LOG_SAMPLES, "Channel %d: 8-bit PCM looping after %d samples\n", channel, m_sample_count[channel]);
- m_sample_count[channel] = 0;
- loop_channel(channel);
- }
- }
- else
- {
- m_audio_regs[wave_data_reg] = raw_sample;
- }
- }
- m_sample_count[channel]++;
- }
-
- return true;
-}
-
-inline void spg2xx_audio_device::loop_channel(const uint32_t channel)
-{
- m_sample_addr[channel] = get_loop_addr(channel);
- m_sample_shift[channel] = 0;
- LOGMASKED(LOG_SAMPLES, "Channel %d: Looping to address %08x\n", channel, m_sample_addr[channel]);
-}
-
-void spg2xx_audio_device::audio_beat_tick()
-{
- if (m_audio_curr_beat_base_count == 0)
- {
- LOGMASKED(LOG_BEAT, "Beat base count elapsed, reloading with %d\n", m_audio_ctrl_regs[AUDIO_BEAT_BASE_COUNT]);
- m_audio_curr_beat_base_count = m_audio_ctrl_regs[AUDIO_BEAT_BASE_COUNT];
-
- uint16_t beat_count = m_audio_ctrl_regs[AUDIO_BEAT_COUNT] & AUDIO_BEAT_COUNT_MASK;
- if (beat_count == 0)
- {
- if (m_audio_ctrl_regs[AUDIO_BEAT_COUNT] & AUDIO_BIE_MASK)
- {
- LOGMASKED(LOG_BEAT, "Beat count elapsed, setting Status bit and checking IRQs\n");
- m_audio_ctrl_regs[AUDIO_BEAT_COUNT] |= AUDIO_BIS_MASK;
- check_irqs(AUDIO_BIS_MASK);
- }
- else
- {
- LOGMASKED(LOG_BEAT, "Beat count elapsed but IRQ not enabled\n");
- }
- }
- else
- {
- beat_count--;
- m_audio_ctrl_regs[AUDIO_BEAT_COUNT] = (m_audio_ctrl_regs[AUDIO_BEAT_COUNT] & ~AUDIO_BEAT_COUNT_MASK) | beat_count;
- }
- }
- m_audio_curr_beat_base_count--;
-}
-
-void spg2xx_audio_device::audio_rampdown_tick(const uint32_t channel)
-{
- const uint8_t old_edd = get_edd(channel);
- uint8_t new_edd = old_edd - get_rampdown_offset(channel);
- if (new_edd > old_edd)
- new_edd = 0;
-
- if (new_edd)
- {
- LOGMASKED(LOG_RAMPDOWN, "Channel %d preparing for next rampdown step (%02x)\n", channel, new_edd);
- const uint16_t channel_mask = channel << 4;
- m_audio_regs[channel_mask | AUDIO_ENVELOPE_DATA] &= ~AUDIO_EDD_MASK;
- m_audio_regs[channel_mask | AUDIO_ENVELOPE_DATA] |= new_edd & AUDIO_EDD_MASK;
- m_rampdown_frame[channel] = get_rampdown_frame_count(channel);
- }
- else
- {
- LOGMASKED(LOG_RAMPDOWN, "Stopping channel %d due to rampdown\n", channel);
- const uint16_t channel_mask = 1 << channel;
- m_audio_ctrl_regs[AUDIO_CHANNEL_ENABLE] &= ~channel_mask;
- m_audio_ctrl_regs[AUDIO_CHANNEL_STATUS] &= ~channel_mask;
- m_audio_ctrl_regs[AUDIO_CHANNEL_STOP] |= channel_mask;
- m_audio_ctrl_regs[AUDIO_ENV_RAMP_DOWN] &= ~channel_mask;
- m_audio_ctrl_regs[AUDIO_CHANNEL_TONE_RELEASE] &= ~channel_mask;
- }
-}
-
-const uint32_t spg2xx_audio_device::s_rampdown_frame_counts[8] =
-{
- 13*4, 13*16, 13*64, 13*256, 13*1024, 13*4096, 13*8192, 13*8192
-};
-
-uint32_t spg2xx_audio_device::get_rampdown_frame_count(const uint32_t channel)
-{
- return s_rampdown_frame_counts[get_rampdown_clock(channel)];
-}
-
-const uint32_t spg2xx_audio_device::s_envclk_frame_counts[16] =
-{
- 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 8192, 8192, 8192, 8192
-};
-
-uint32_t spg2xx_audio_device::get_envclk_frame_count(const uint32_t channel)
-{
- return s_envclk_frame_counts[get_envelope_clock(channel)];
-}
-
-uint32_t spg2xx_audio_device::get_envelope_clock(const offs_t channel) const
-{
- if (channel < 4)
- return (m_audio_ctrl_regs[AUDIO_ENVCLK0] >> (channel << 2)) & 0x000f;
- else if (channel < 8)
- return (m_audio_ctrl_regs[AUDIO_ENVCLK0_HIGH] >> ((channel - 4) << 2)) & 0x000f;
- else if (channel < 12)
- return (m_audio_ctrl_regs[AUDIO_ENVCLK1] >> ((channel - 8) << 2)) & 0x000f;
- else
- return (m_audio_ctrl_regs[AUDIO_ENVCLK1_HIGH] >> ((channel - 12) << 2)) & 0x000f;
-}
-
-bool spg2xx_audio_device::audio_envelope_tick(const uint32_t channel)
-{
- const uint16_t channel_mask = channel << 4;
- uint16_t new_count = get_envelope_count(channel);
- const uint16_t curr_edd = get_edd(channel);
- LOGMASKED(LOG_ENVELOPES, "envelope %d tick, count is %04x, curr edd is %04x\n", channel, new_count, curr_edd);
- bool edd_changed = false;
- if (new_count == 0)
- {
- const uint16_t target = get_envelope_target(channel);
- uint16_t new_edd = curr_edd;
- const uint16_t inc = get_envelope_inc(channel);
-
- if (new_edd != target)
- {
- if (get_envelope_sign_bit(channel))
- {
- new_edd -= inc;
- LOGMASKED(LOG_ENVELOPES, "Envelope %d new EDD-: %04x (%04x), dec %04x\n", channel, new_edd, target, inc);
- if (new_edd > curr_edd)
- new_edd = 0;
- else if (new_edd < target)
- new_edd = target;
-
- if (new_edd == 0)
- {
- LOGMASKED(LOG_ENVELOPES, "Envelope %d at 0, stopping channel\n", channel);
- stop_channel(channel);
- return true;
- }
- }
- else
- {
- new_edd += inc;
- LOGMASKED(LOG_ENVELOPES, "Envelope %d new EDD+: %04x (%04x), inc %04x\n", channel, new_edd, target, inc);
- if (new_edd >= target)
- new_edd = target;
- }
- }
-
- if (new_edd == target)
- {
- LOGMASKED(LOG_ENVELOPES, "Envelope %d at target %04x\n", channel, target);
- new_edd = target;
-
- if (get_envelope_repeat_bit(channel))
- {
- const uint16_t repeat_count = get_envelope_repeat_count(channel) - 1;
- LOGMASKED(LOG_ENVELOPES, "Repeating envelope, new repeat count %d\n", repeat_count);
- if (repeat_count == 0)
- {
- m_audio_regs[channel_mask | AUDIO_ENVELOPE0] = read_space(m_envelope_addr[channel]);
- m_audio_regs[channel_mask | AUDIO_ENVELOPE1] = read_space(m_envelope_addr[channel] + 1);
- m_audio_regs[channel_mask | AUDIO_ENVELOPE_LOOP_CTRL] = read_space(m_envelope_addr[channel] + 2);
- m_envelope_addr[channel] = get_envelope_addr(channel) + get_envelope_eaoffset(channel);
- LOGMASKED(LOG_ENVELOPES, "Envelope data after repeat: %04x %04x %04x (%08x)\n", m_audio_regs[channel_mask | AUDIO_ENVELOPE0], m_audio_regs[channel_mask | AUDIO_ENVELOPE1], m_audio_regs[channel_mask | AUDIO_ENVELOPE_LOOP_CTRL], m_envelope_addr[channel]);
- }
- else
- {
- set_envelope_repeat_count(channel, repeat_count);
- }
- }
- else
- {
- LOGMASKED(LOG_ENVELOPES, "Fetching envelope for channel %d from %08x\n", channel, m_envelope_addr[channel]);
- m_audio_regs[channel_mask | AUDIO_ENVELOPE0] = read_space(m_envelope_addr[channel]);
- m_audio_regs[channel_mask | AUDIO_ENVELOPE1] = read_space(m_envelope_addr[channel] + 1);
- LOGMASKED(LOG_ENVELOPES, "Fetched envelopes %04x %04x\n", m_audio_regs[channel_mask | AUDIO_ENVELOPE0], m_audio_regs[channel_mask | AUDIO_ENVELOPE1]);
- m_envelope_addr[channel] += 2;
- }
- new_count = get_envelope_load(channel);
- set_envelope_count(channel, new_count);
- }
- else
- {
- LOGMASKED(LOG_ENVELOPES, "Envelope %d not yet at target %04x (%04x)\n", channel, target, new_edd);
- new_count = get_envelope_load(channel);
- set_envelope_count(channel, new_count);
- }
- LOGMASKED(LOG_ENVELOPES, "Envelope %d new count %04x\n", channel, new_count);
-
- set_edd(channel, new_edd);
- edd_changed = true;
- LOGMASKED(LOG_ENVELOPES, "Setting channel %d edd to %04x, register is %04x\n", channel, new_edd, m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA]);
- }
- else
- {
- new_count--;
- set_envelope_count(channel, new_count);
- }
- LOGMASKED(LOG_ENVELOPES, "envelope %d post-tick, count is now %04x, register is %04x\n", channel, new_count, m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA]);
- return edd_changed;
-}
diff --git a/src/devices/machine/spg2xx_audio.h b/src/devices/machine/spg2xx_audio.h
deleted file mode 100644
index 22f5108e405..00000000000
--- a/src/devices/machine/spg2xx_audio.h
+++ /dev/null
@@ -1,372 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-/*****************************************************************************
-
- SunPlus SPG2xx-series SoC peripheral emulation (Audio)
-
-**********************************************************************/
-
-#ifndef MAME_MACHINE_SPG2XX_AUDIO_H
-#define MAME_MACHINE_SPG2XX_AUDIO_H
-
-#pragma once
-
-#include "sound/okiadpcm.h"
-#include "cpu/unsp/unsp.h"
-
-class spg2xx_audio_device : public device_t, public device_sound_interface
-{
-public:
- spg2xx_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
- spg2xx_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- auto space_read_callback() { return m_space_read_cb.bind(); }
- auto write_irq_callback() { return m_irq_cb.bind(); }
-
- DECLARE_READ16_MEMBER(audio_r);
- DECLARE_WRITE16_MEMBER(audio_w);
- DECLARE_READ16_MEMBER(audio_ctrl_r);
- DECLARE_WRITE16_MEMBER(audio_ctrl_w);
- DECLARE_READ16_MEMBER(audio_phase_r);
- DECLARE_WRITE16_MEMBER(audio_phase_w);
-
-protected:
- // sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
-
- void audio_beat_tick();
- void audio_rampdown_tick(const uint32_t channel);
- bool audio_envelope_tick(const uint32_t channel);
- inline uint32_t get_rampdown_frame_count(const uint32_t channel);
- inline uint32_t get_envclk_frame_count(const uint32_t channel);
-
- // Audio getters
- bool get_channel_enable(const offs_t channel) const { return m_audio_ctrl_regs[AUDIO_CHANNEL_ENABLE] & (1 << channel); }
- bool get_channel_status(const offs_t channel) const { return m_audio_ctrl_regs[AUDIO_CHANNEL_STATUS] & (1 << channel); }
- bool get_manual_envelope_enable(const offs_t channel) const { return m_audio_ctrl_regs[AUDIO_CHANNEL_ENV_MODE] & (1 << channel); }
- bool get_auto_envelope_enable(const offs_t channel) const { return !get_manual_envelope_enable(channel); }
- uint32_t get_envelope_clock(const offs_t channel) const;
- uint16_t get_vol_sel() const { return (m_audio_ctrl_regs[AUDIO_CONTROL] & AUDIO_CONTROL_VOLSEL_MASK) >> AUDIO_CONTROL_VOLSEL_SHIFT; }
-
- // Audio Mode getters
- uint16_t get_wave_addr_high(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_MODE] & AUDIO_WADDR_HIGH_MASK; }
- uint16_t get_loop_addr_high(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_MODE] & AUDIO_LADDR_HIGH_MASK) >> AUDIO_LADDR_HIGH_SHIFT; }
- uint16_t get_tone_mode(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_MODE] & AUDIO_TONE_MODE_MASK) >> AUDIO_TONE_MODE_SHIFT; }
- uint16_t get_16bit_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_MODE] & AUDIO_16M_MASK) ? 1 : 0; }
- uint16_t get_adpcm_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_MODE] & AUDIO_ADPCM_MASK) ? 1 : 0; }
-
- // Audio Pan getters
- uint16_t get_volume(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_PAN_VOL] & AUDIO_VOLUME_MASK; }
- uint16_t get_pan(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_PAN_VOL] & AUDIO_PAN_MASK) >> AUDIO_PAN_SHIFT; }
-
- // Audio Envelope0 Data getters
- uint16_t get_envelope_inc(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_ENVELOPE0] & AUDIO_ENVELOPE_INC_MASK; }
- uint16_t get_envelope_sign_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE0] & AUDIO_ENVELOPE_SIGN_MASK) ? 1 : 0; }
- uint16_t get_envelope_target(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE0] & AUDIO_ENVELOPE_TARGET_MASK) >> AUDIO_ENVELOPE_TARGET_SHIFT; }
- uint16_t get_repeat_period_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE0] & AUDIO_ENVELOPE_REPEAT_PERIOD_MASK) ? 1 : 0; }
-
- // Audio Envelope Data getters
- uint16_t get_edd(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA] & AUDIO_EDD_MASK; }
- uint16_t get_envelope_count(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA] & AUDIO_ENVELOPE_COUNT_MASK) >> AUDIO_ENVELOPE_COUNT_SHIFT; }
- void set_edd(const offs_t channel, uint8_t edd) { m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA] = (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA] & ~AUDIO_EDD_MASK) | edd; }
- void set_envelope_count(const offs_t channel, uint16_t count) { m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_DATA] = get_edd(channel) | (count << AUDIO_ENVELOPE_COUNT_SHIFT); }
-
- // Audio Envelope1 Data getters
- uint16_t get_envelope_load(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_ENVELOPE1] & AUDIO_ENVELOPE_LOAD_MASK; }
- uint16_t get_envelope_repeat_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE1] & AUDIO_ENVELOPE_RPT_MASK) ? 1 : 0; }
- uint16_t get_envelope_repeat_count(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE1] & AUDIO_ENVELOPE_RPCNT_MASK) >> AUDIO_ENVELOPE_RPCNT_SHIFT; }
- inline void set_envelope_repeat_count(const offs_t channel, const uint16_t count) { m_audio_regs[(channel << 4) | AUDIO_ENVELOPE1] = (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE1] & ~AUDIO_ENVELOPE_RPCNT_MASK) | ((count << AUDIO_ENVELOPE_RPCNT_SHIFT) & AUDIO_ENVELOPE_RPCNT_MASK); }
-
- // Audio Envelope Address getters
- uint16_t get_envelope_addr_high(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_ADDR_HIGH] & AUDIO_EADDR_HIGH_MASK; }
- uint16_t get_audio_irq_enable_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_ADDR_HIGH] & AUDIO_IRQ_EN_MASK) ? 1 : 0; }
- uint16_t get_audio_irq_addr(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_ADDR_HIGH] & AUDIO_IRQ_ADDR_MASK) >> AUDIO_IRQ_ADDR_SHIFT; }
-
- // Audio Envelope Loop getters
- uint16_t get_envelope_eaoffset(const offs_t channel) const { return m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_LOOP_CTRL] & AUDIO_EAOFFSET_MASK; }
- uint16_t get_rampdown_offset(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_LOOP_CTRL] & AUDIO_RAMPDOWN_OFFSET_MASK) >> AUDIO_RAMPDOWN_OFFSET_SHIFT; }
- void set_envelope_eaoffset(const offs_t channel, uint16_t eaoffset) { m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_LOOP_CTRL] = (m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_LOOP_CTRL] & ~AUDIO_RAMPDOWN_OFFSET_MASK) | (eaoffset & AUDIO_EAOFFSET_MASK); }
-
- // Audio ADPCM getters
- uint16_t get_point_number(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ADPCM_SEL] & AUDIO_POINT_NUMBER_MASK) >> AUDIO_POINT_NUMBER_SHIFT; }
- uint16_t get_adpcm36_bit(const offs_t channel) const { return (m_audio_regs[(channel << 4) | AUDIO_ADPCM_SEL] & AUDIO_ADPCM36_MASK) ? 1 : 0; }
-
- // Audio high-word getters
- uint16_t get_phase_high(const offs_t channel) const { return m_audio_phase_regs[(channel << 4) | AUDIO_PHASE_HIGH] & AUDIO_PHASE_HIGH_MASK; }
- uint16_t get_phase_accum_high(const offs_t channel) const { return m_audio_phase_regs[(channel << 4) | AUDIO_PHASE_ACCUM_HIGH] & AUDIO_PHASE_ACCUM_HIGH_MASK; }
- uint16_t get_target_phase_high(const offs_t channel) const { return m_audio_phase_regs[(channel << 4) | AUDIO_TARGET_PHASE_HIGH] & AUDIO_TARGET_PHASE_HIGH_MASK; }
- uint16_t get_rampdown_clock(const offs_t channel) const { return m_audio_phase_regs[(channel << 4) | AUDIO_RAMP_DOWN_CLOCK] & AUDIO_RAMP_DOWN_CLOCK_MASK; }
-
- // Audio ADPCM getters
- uint16_t get_phase_offset(const offs_t channel) const { return m_audio_phase_regs[(channel << 4) | AUDIO_PHASE_CTRL] & AUDIO_PHASE_OFFSET_MASK; }
- uint16_t get_phase_sign_bit(const offs_t channel) const { return (m_audio_phase_regs[(channel << 4) | AUDIO_PHASE_CTRL] & AUDIO_PHASE_SIGN_MASK) >> AUDIO_PHASE_SIGN_SHIFT; }
- uint16_t get_phase_time_step(const offs_t channel) const { return (m_audio_phase_regs[(channel << 4) | AUDIO_PHASE_CTRL] & AUDIO_PHASE_TIME_STEP_MASK) >> AUDIO_PHASE_TIME_STEP_SHIFT; }
-
- // Audio combined getters
- uint32_t get_phase(const offs_t channel) const { return ((uint32_t)get_phase_high(channel) << 16) | m_audio_phase_regs[(channel << 4) | AUDIO_PHASE]; }
- uint32_t get_phase_accum(const offs_t channel) const { return ((uint32_t)get_phase_accum_high(channel) << 16) | m_audio_phase_regs[(channel << 4) | AUDIO_PHASE_ACCUM]; }
- uint32_t get_target_phase(const offs_t channel) const { return ((uint32_t)get_target_phase_high(channel) << 16) | m_audio_phase_regs[(channel << 4) | AUDIO_TARGET_PHASE]; }
-
- uint32_t get_wave_addr(const offs_t channel) const { return ((uint32_t)get_wave_addr_high(channel) << 16) | m_audio_regs[(channel << 4) | AUDIO_WAVE_ADDR]; }
- uint32_t get_loop_addr(const offs_t channel) const { return ((uint32_t)get_loop_addr_high(channel) << 16) | m_audio_regs[(channel << 4) | AUDIO_LOOP_ADDR]; }
- uint32_t get_envelope_addr(const offs_t channel) const { return ((uint32_t)get_envelope_addr_high(channel) << 16) | m_audio_regs[(channel << 4) | AUDIO_ENVELOPE_ADDR]; }
-
- enum // at audio write offset 0x000 in spg2xx
- {
- AUDIO_WAVE_ADDR = 0x000,
-
- AUDIO_MODE = 0x001,
- AUDIO_WADDR_HIGH_MASK = 0x003f,
- AUDIO_LADDR_HIGH_MASK = 0x0fc0,
- AUDIO_LADDR_HIGH_SHIFT = 6,
- AUDIO_TONE_MODE_MASK = 0x3000,
- AUDIO_TONE_MODE_SHIFT = 12,
- AUDIO_TONE_MODE_SW = 0,
- AUDIO_TONE_MODE_HW_ONESHOT = 1,
- AUDIO_TONE_MODE_HW_LOOP = 2,
- AUDIO_16M_MASK = 0x4000,
- AUDIO_ADPCM_MASK = 0x8000,
-
- AUDIO_LOOP_ADDR = 0x002,
-
- AUDIO_PAN_VOL = 0x003,
- AUDIO_PAN_VOL_MASK = 0x7f7f,
- AUDIO_VOLUME_MASK = 0x007f,
- AUDIO_PAN_MASK = 0x7f00,
- AUDIO_PAN_SHIFT = 8,
-
- AUDIO_ENVELOPE0 = 0x004,
- AUDIO_ENVELOPE_INC_MASK = 0x007f,
- AUDIO_ENVELOPE_SIGN_MASK = 0x0080,
- AUDIO_ENVELOPE_TARGET_MASK = 0x7f00,
- AUDIO_ENVELOPE_TARGET_SHIFT = 8,
- AUDIO_ENVELOPE_REPEAT_PERIOD_MASK = 0x8000,
-
- AUDIO_ENVELOPE_DATA = 0x005,
- AUDIO_ENVELOPE_DATA_MASK = 0xff7f,
- AUDIO_EDD_MASK = 0x007f,
- AUDIO_ENVELOPE_COUNT_MASK = 0xff00,
- AUDIO_ENVELOPE_COUNT_SHIFT = 8,
-
- AUDIO_ENVELOPE1 = 0x006,
- AUDIO_ENVELOPE_LOAD_MASK = 0x00ff,
- AUDIO_ENVELOPE_RPT_MASK = 0x0100,
- AUDIO_ENVELOPE_RPCNT_MASK = 0xfe00,
- AUDIO_ENVELOPE_RPCNT_SHIFT = 9,
-
- AUDIO_ENVELOPE_ADDR_HIGH = 0x007,
- AUDIO_EADDR_HIGH_MASK = 0x003f,
- AUDIO_IRQ_EN_MASK = 0x0040,
- AUDIO_IRQ_ADDR_MASK = 0xff80,
- AUDIO_IRQ_ADDR_SHIFT = 7,
-
- AUDIO_ENVELOPE_ADDR = 0x008,
- AUDIO_WAVE_DATA_PREV = 0x009,
-
- AUDIO_ENVELOPE_LOOP_CTRL = 0x00a,
- AUDIO_EAOFFSET_MASK = 0x01ff,
- AUDIO_RAMPDOWN_OFFSET_MASK = 0xfe00,
- AUDIO_RAMPDOWN_OFFSET_SHIFT = 9,
-
- AUDIO_WAVE_DATA = 0x00b,
-
- AUDIO_ADPCM_SEL = 0x00d,
- AUDIO_ADPCM_SEL_MASK = 0xfe00,
- AUDIO_POINT_NUMBER_MASK = 0x7e00,
- AUDIO_POINT_NUMBER_SHIFT = 9,
- AUDIO_ADPCM36_MASK = 0x8000,
- };
-
- enum // at audio write offset 0x200 in spg2xx
- {
- AUDIO_PHASE_HIGH = 0x000,
- AUDIO_PHASE_HIGH_MASK = 0x0007,
-
- AUDIO_PHASE_ACCUM_HIGH = 0x001,
- AUDIO_PHASE_ACCUM_HIGH_MASK = 0x0007,
-
- AUDIO_TARGET_PHASE_HIGH = 0x002,
- AUDIO_TARGET_PHASE_HIGH_MASK= 0x0007,
-
- AUDIO_RAMP_DOWN_CLOCK = 0x003,
- AUDIO_RAMP_DOWN_CLOCK_MASK = 0x0007,
-
- AUDIO_PHASE = 0x004,
- AUDIO_PHASE_ACCUM = 0x005,
- AUDIO_TARGET_PHASE = 0x006,
-
- AUDIO_PHASE_CTRL = 0x007,
- AUDIO_PHASE_OFFSET_MASK = 0x0fff,
- AUDIO_PHASE_SIGN_MASK = 0x1000,
- AUDIO_PHASE_SIGN_SHIFT = 12,
- AUDIO_PHASE_TIME_STEP_MASK = 0xe000,
- AUDIO_PHASE_TIME_STEP_SHIFT = 13,
-
- AUDIO_CHAN_OFFSET_MASK = 0xf0f,
- };
-
- enum // at audio write offset 0x400 in spg2xx
- {
-
- AUDIO_CHANNEL_ENABLE = 0x000,
- AUDIO_CHANNEL_ENABLE_MASK = 0xffff,
-
- AUDIO_MAIN_VOLUME = 0x001,
- AUDIO_MAIN_VOLUME_MASK = 0x007f,
-
- AUDIO_CHANNEL_FIQ_ENABLE = 0x002,
- AUDIO_CHANNEL_FIQ_ENABLE_MASK = 0xffff,
-
- AUDIO_CHANNEL_FIQ_STATUS = 0x003,
- AUDIO_CHANNEL_FIQ_STATUS_MASK = 0xffff,
-
- AUDIO_BEAT_BASE_COUNT = 0x004,
- AUDIO_BEAT_BASE_COUNT_MASK = 0x07ff,
-
- AUDIO_BEAT_COUNT = 0x005,
- AUDIO_BEAT_COUNT_MASK = 0x3fff,
- AUDIO_BIS_MASK = 0x4000,
- AUDIO_BIE_MASK = 0x8000,
-
- AUDIO_ENVCLK0 = 0x006,
-
- AUDIO_ENVCLK0_HIGH = 0x007,
- AUDIO_ENVCLK0_HIGH_MASK = 0xffff,
-
- AUDIO_ENVCLK1 = 0x008,
-
- AUDIO_ENVCLK1_HIGH = 0x009,
- AUDIO_ENVCLK1_HIGH_MASK = 0xffff,
-
- AUDIO_ENV_RAMP_DOWN = 0x00a,
- AUDIO_ENV_RAMP_DOWN_MASK = 0xffff,
-
- AUDIO_CHANNEL_STOP = 0x00b,
- AUDIO_CHANNEL_STOP_MASK = 0xffff,
-
- AUDIO_CHANNEL_ZERO_CROSS = 0x00c,
- AUDIO_CHANNEL_ZERO_CROSS_MASK = 0xffff,
-
- AUDIO_CONTROL = 0x00d,
- AUDIO_CONTROL_MASK = 0x9fe8,
- AUDIO_CONTROL_SATURATE_MASK = 0x8000,
- AUDIO_CONTROL_SOFTCH_MASK = 0x1000,
- AUDIO_CONTROL_COMPEN_MASK = 0x0800,
- AUDIO_CONTROL_NOHIGH_MASK = 0x0400,
- AUDIO_CONTROL_NOINT_MASK = 0x0200,
- AUDIO_CONTROL_EQEN_MASK = 0x0100,
- AUDIO_CONTROL_VOLSEL_MASK = 0x00c0,
- AUDIO_CONTROL_VOLSEL_SHIFT = 6,
- AUDIO_CONTROL_FOF_MASK = 0x0020,
- AUDIO_CONTROL_INIT_MASK = 0x0008,
-
- AUDIO_COMPRESS_CTRL = 0x00e,
- AUDIO_COMPRESS_CTRL_PEAK_MASK = 0x8000,
- AUDIO_COMPRESS_CTRL_THRESHOLD_MASK = 0x7f00,
- AUDIO_COMPRESS_CTRL_THRESHOLD_SHIFT = 8,
- AUDIO_COMPRESS_CTRL_ATTSCALE_MASK = 0x00c0,
- AUDIO_COMPRESS_CTRL_ATTSCALE_SHIFT = 6,
- AUDIO_COMPRESS_CTRL_RELSCALE_MASK = 0x0030,
- AUDIO_COMPRESS_CTRL_RELSCALE_SHIFT = 4,
- AUDIO_COMPRESS_CTRL_DISZC_MASK = 0x0008,
- AUDIO_COMPRESS_CTRL_RATIO_MASK = 0x0007,
-
- AUDIO_CHANNEL_STATUS = 0x00f,
- AUDIO_CHANNEL_STATUS_MASK = 0xffff,
-
- AUDIO_WAVE_IN_L = 0x010,
-
- AUDIO_WAVE_IN_R = 0x011,
- AUDIO_SOFTIRQ_MASK = 0x8000,
- AUDIO_SOFTIRQ_EN_MASK = 0x4000,
- AUDIO_SOFT_PHASE_HIGH_MASK = 0x0070,
- AUDIO_SOFT_PHASE_HIGH_SHIFT = 4,
- AUDIO_FIFO_IRQ_THRESHOLD_MASK = 0x000f,
-
- AUDIO_WAVE_OUT_L = 0x012,
- AUDIO_WAVE_OUT_R = 0x013,
-
- AUDIO_CHANNEL_REPEAT = 0x014,
- AUDIO_CHANNEL_REPEAT_MASK = 0xffff,
-
- AUDIO_CHANNEL_ENV_MODE = 0x015,
- AUDIO_CHANNEL_ENV_MODE_MASK = 0xffff,
-
- AUDIO_CHANNEL_TONE_RELEASE = 0x016,
- AUDIO_CHANNEL_TONE_RELEASE_MASK = 0xffff,
-
- AUDIO_CHANNEL_ENV_IRQ = 0x017,
- AUDIO_CHANNEL_ENV_IRQ_MASK = 0xffff,
-
- AUDIO_CHANNEL_PITCH_BEND = 0x018,
- AUDIO_CHANNEL_PITCH_BEND_MASK = 0xffff,
-
- AUDIO_SOFT_PHASE = 0x019,
-
- AUDIO_ATTACK_RELEASE = 0x01a,
- AUDIO_RELEASE_TIME_MASK = 0x00ff,
- AUDIO_ATTACK_TIME_MASK = 0xff00,
- AUDIO_ATTACK_TIME_SHIFT = 8,
-
- AUDIO_EQ_CUTOFF10 = 0x01b,
- AUDIO_EQ_CUTOFF10_MASK = 0x7f7f,
-
- AUDIO_EQ_CUTOFF32 = 0x01c,
- AUDIO_EQ_CUTOFF32_MASK = 0x7f7f,
-
- AUDIO_EQ_GAIN10 = 0x01d,
- AUDIO_EQ_GAIN10_MASK = 0x7f7f,
-
- AUDIO_EQ_GAIN32 = 0x01e,
- AUDIO_EQ_GAIN32_MASK = 0x7f7f
- };
-
- static const device_timer_id TIMER_BEAT = 3;
- void check_irqs(const uint16_t changed);
-
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
-
- uint16_t read_space(offs_t offset);
-
- void stop_channel(const uint32_t channel);
- bool advance_channel(const uint32_t channel);
- bool fetch_sample(const uint32_t channel);
- void loop_channel(const uint32_t channel);
-
-
- bool m_debug_samples;
- bool m_debug_rates;
-
- uint16_t m_audio_regs[0x200];
- uint16_t m_audio_phase_regs[0x200];
- uint16_t m_audio_ctrl_regs[0x400];
- uint8_t m_sample_shift[16];
- uint32_t m_sample_count[16];
- uint32_t m_sample_addr[16];
- double m_channel_rate[16];
- double m_channel_rate_accum[16];
- uint32_t m_rampdown_frame[16];
- uint32_t m_envclk_frame[16];
- uint32_t m_envelope_addr[16];
- int m_channel_debug;
- uint16_t m_audio_curr_beat_base_count;
-
- emu_timer *m_audio_beat;
-
- sound_stream *m_stream;
- oki_adpcm_state m_adpcm[16];
-
- static const uint32_t s_rampdown_frame_counts[8];
- static const uint32_t s_envclk_frame_counts[16];
-
-private:
- devcb_read16 m_space_read_cb;
- devcb_write_line m_irq_cb;
-
-};
-
-DECLARE_DEVICE_TYPE(SPG2XX_AUDIO, spg2xx_audio_device)
-
-#endif // MAME_MACHINE_SPG2XX_AUDIO_H
diff --git a/src/devices/machine/spg2xx_io.cpp b/src/devices/machine/spg2xx_io.cpp
deleted file mode 100644
index 404087f6a7f..00000000000
--- a/src/devices/machine/spg2xx_io.cpp
+++ /dev/null
@@ -1,1313 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-
-/* this is used by the SPG110, SPG24x and SPG28x
- basic I/O behavior is definitely the same on the SPG110 but
- the rest needs verifying */
-
-#include "emu.h"
-#include "spg2xx_io.h"
-
-DEFINE_DEVICE_TYPE(SPG24X_IO, spg24x_io_device, "spg24x_io", "SPG240-series System-on-a-Chip I/O")
-DEFINE_DEVICE_TYPE(SPG28X_IO, spg28x_io_device, "spg28x_io", "SPG280-series System-on-a-Chip I/O")
-
-#define LOG_IO_READS (1U << 1)
-#define LOG_IO_WRITES (1U << 2)
-#define LOG_UNKNOWN_IO (1U << 3)
-#define LOG_IRQS (1U << 4)
-#define LOG_VLINES (1U << 5)
-#define LOG_GPIO (1U << 6)
-#define LOG_UART (1U << 7)
-#define LOG_I2C (1U << 8)
-#define LOG_SEGMENT (1U << 10)
-#define LOG_WATCHDOG (1U << 11)
-#define LOG_TIMERS (1U << 12)
-#define LOG_FIQ (1U << 25)
-#define LOG_SIO (1U << 26)
-#define LOG_EXT_MEM (1U << 27)
-#define LOG_EXTINT (1U << 28)
-#define LOG_IO (LOG_IO_READS | LOG_IO_WRITES | LOG_IRQS | LOG_GPIO | LOG_UART | LOG_I2C | LOG_TIMERS | LOG_EXTINT | LOG_UNKNOWN_IO)
-#define LOG_ALL (LOG_IO | LOG_VLINES | LOG_SEGMENT | LOG_FIQ)
-
-#define VERBOSE (0)
-#include "logmacro.h"
-
-
-#define IO_IRQ_ENABLE m_io_regs[0x21]
-#define IO_IRQ_STATUS m_io_regs[0x22]
-
-spg2xx_io_device::spg2xx_io_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_porta_out(*this)
- , m_portb_out(*this)
- , m_portc_out(*this)
- , m_porta_in(*this)
- , m_portb_in(*this)
- , m_portc_in(*this)
- , m_adc_in{{*this}, {*this}}
- , m_eeprom_w(*this)
- , m_eeprom_r(*this)
- , m_uart_tx(*this)
- , m_chip_sel(*this)
- , m_cpu(*this, finder_base::DUMMY_TAG)
- , m_screen(*this, finder_base::DUMMY_TAG)
- , m_pal_read_cb(*this)
- , m_timer_irq_cb(*this)
- , m_uart_adc_irq_cb(*this)
- , m_external_irq_cb(*this)
- , m_ffreq_tmr1_irq_cb(*this)
- , m_ffreq_tmr2_irq_cb(*this)
-{
-}
-
-spg24x_io_device::spg24x_io_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : spg2xx_io_device(mconfig, SPG24X_IO, tag, owner, clock, 256)
-{
-}
-
-spg28x_io_device::spg28x_io_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : spg2xx_io_device(mconfig, SPG28X_IO, tag, owner, clock, 64)
-{
-}
-
-
-void spg2xx_io_device::device_start()
-{
- m_porta_out.resolve_safe();
- m_portb_out.resolve_safe();
- m_portc_out.resolve_safe();
- m_porta_in.resolve_safe(0);
- m_portb_in.resolve_safe(0);
- m_portc_in.resolve_safe(0);
- m_adc_in[0].resolve_safe(0x0fff);
- m_adc_in[1].resolve_safe(0x0fff);
- m_eeprom_w.resolve_safe();
- m_eeprom_r.resolve_safe(0);
- m_uart_tx.resolve_safe();
- m_chip_sel.resolve_safe();
- m_pal_read_cb.resolve_safe(0);
-
- m_timer_irq_cb.resolve();
- m_uart_adc_irq_cb.resolve();
- m_external_irq_cb.resolve();
- m_ffreq_tmr1_irq_cb.resolve();
- m_ffreq_tmr2_irq_cb.resolve();
-
- m_tmb1 = timer_alloc(TIMER_TMB1);
- m_tmb2 = timer_alloc(TIMER_TMB2);
- m_tmb1->adjust(attotime::never);
- m_tmb2->adjust(attotime::never);
-
- m_uart_tx_timer = timer_alloc(TIMER_UART_TX);
- m_uart_tx_timer->adjust(attotime::never);
-
- m_uart_rx_timer = timer_alloc(TIMER_UART_RX);
- m_uart_rx_timer->adjust(attotime::never);
-
- m_4khz_timer = timer_alloc(TIMER_4KHZ);
- m_4khz_timer->adjust(attotime::never);
-
- m_timer_src_ab = timer_alloc(TIMER_SRC_AB);
- m_timer_src_ab->adjust(attotime::never);
-
- m_timer_src_c = timer_alloc(TIMER_SRC_C);
- m_timer_src_c->adjust(attotime::never);
-
- save_item(NAME(m_timer_a_preload));
- save_item(NAME(m_timer_b_preload));
- save_item(NAME(m_timer_b_divisor));
- save_item(NAME(m_timer_b_tick_rate));
-
- save_item(NAME(m_io_regs));
-
- save_item(NAME(m_extint));
-
- save_item(NAME(m_2khz_divider));
- save_item(NAME(m_1khz_divider));
- save_item(NAME(m_4hz_divider));
-
- save_item(NAME(m_uart_baud_rate));
-
-}
-
-void spg2xx_io_device::device_reset()
-{
- memset(m_io_regs, 0, 0x100 * sizeof(uint16_t));
-
- m_timer_a_preload = 0;
- m_timer_b_preload = 0;
- m_timer_b_divisor = 0;
- m_timer_b_tick_rate = 0;
-
- m_io_regs[0x23] = 0x0028;
- m_io_regs[0x2c] = 0x1418;
- m_io_regs[0x2d] = 0x1658;
-
- m_uart_rx_available = false;
- memset(m_uart_rx_fifo, 0, ARRAY_LENGTH(m_uart_rx_fifo));
- m_uart_rx_fifo_start = 0;
- m_uart_rx_fifo_end = 0;
- m_uart_rx_fifo_count = 0;
- m_uart_tx_irq = false;
- m_uart_rx_irq = false;
-
- memset(m_extint, 0, sizeof(bool) * 2);
-
- m_4khz_timer->adjust(attotime::from_hz(4096), 0, attotime::from_hz(4096));
-
- m_2khz_divider = 0;
- m_1khz_divider = 0;
- m_4hz_divider = 0;
-}
-
-/*************************
-* Machine Hardware *
-*************************/
-
-void spg2xx_io_device::uart_rx(uint8_t data)
-{
- LOGMASKED(LOG_UART, "uart_rx: Pulling %02x into receive FIFO\n", data);
- if (BIT(m_io_regs[0x30], 6))
- {
- m_uart_rx_fifo[m_uart_rx_fifo_end] = data;
- m_uart_rx_fifo_end = (m_uart_rx_fifo_end + 1) % ARRAY_LENGTH(m_uart_rx_fifo);
- m_uart_rx_fifo_count++;
- if (m_uart_rx_timer->remaining() == attotime::never)
- m_uart_rx_timer->adjust(attotime::from_ticks(BIT(m_io_regs[0x30], 5) ? 11 : 10, m_uart_baud_rate));
- }
-}
-
-READ16_MEMBER(spg2xx_io_device::io_r)
-{
- static const char *const gpioregs[] = { "GPIO Data Port", "GPIO Buffer Port", "GPIO Direction Port", "GPIO Attribute Port", "GPIO IRQ/Latch Port" };
- static const char gpioports[] = { 'A', 'B', 'C' };
-
- uint16_t val = m_io_regs[offset];
-
- switch (offset)
- {
- case 0x01: case 0x06: case 0x0b: // GPIO Data Port A/B/C
- do_gpio(offset, false);
- LOGMASKED(LOG_GPIO, "%s: io_r: %s %c = %04x\n", machine().describe_context(), gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset]);
- val = m_io_regs[offset];
- break;
-
- case 0x02: case 0x03: case 0x04: case 0x05:
- case 0x07: case 0x08: case 0x09: case 0x0a:
- case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Other GPIO regs
- LOGMASKED(LOG_GPIO, "%s: io_r: %s %c = %04x\n", machine().describe_context(), gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset]);
- break;
-
- case 0x10: // Timebase Control
- LOGMASKED(LOG_IO_READS, "io_r: Timebase Control = %04x\n", val);
- break;
-
- case 0x12: // Timer A Data
- LOGMASKED(LOG_IO_WRITES, "io_r: Timer A Data = %04x\n", val);
- break;
-
- case 0x1c: // Video line counter
- val = m_screen->vpos();
- LOGMASKED(LOG_VLINES, "io_r: Video Line = %04x\n", val);
- break;
-
- case 0x20: // System Control
- LOGMASKED(LOG_IO_READS, "io_r: System Control = %04x\n", val);
- break;
-
- case 0x21: // IRQ Control
- LOGMASKED(LOG_IRQS, "%s: io_r: I/O IRQ Control = %04x\n", machine().describe_context(), val);
- break;
-
- case 0x22: // IRQ Status
- LOGMASKED(LOG_IRQS, "%s: io_r: I/O IRQ Status = %04x\n", machine().describe_context(), val);
- break;
-
- case 0x23: // External Memory Control
- LOGMASKED(LOG_IO_READS, "%s: io_r: Ext. Memory Control = %04x\n", machine().describe_context(), val);
- break;
-
- case 0x25: // ADC Control
- LOGMASKED(LOG_IO_READS, "io_r: ADC Control = %04x\n", val);
- break;
-
- case 0x27: // ADC Data
- {
- m_io_regs[0x27] = 0;
- const uint16_t old = IO_IRQ_STATUS;
- IO_IRQ_STATUS &= ~0x2000;
- const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE);
- if (changed)
- check_irqs(changed);
- LOGMASKED(LOG_IO_READS, "%s: io_r: ADC Data = %04x\n", machine().describe_context(), val);
- break;
- }
-
- case 0x29: // Wakeup Source
- LOGMASKED(LOG_IO_READS, "io_r: Wakeup Source = %04x\n", val);
- break;
-
- case 0x2b:
- {
- uint16_t pal = m_pal_read_cb();
- LOGMASKED(LOG_IO_READS, "io_r: NTSC/PAL = %04x\n", pal);
- return pal;
- }
-
- case 0x2c: // PRNG 0
- {
- const uint16_t value = m_io_regs[0x2c];
- m_io_regs[0x2c] = ((value << 1) | (BIT(value, 14) ^ BIT(value, 13))) & 0x7fff;
- return value;
- }
-
- case 0x2d: // PRNG 1
- {
- const uint16_t value = m_io_regs[0x2d];
- m_io_regs[0x2d] = ((value << 1) | (BIT(value, 14) ^ BIT(value, 13))) & 0x7fff;
- return value;
- }
-
- case 0x2e: // FIQ Source Select
- LOGMASKED(LOG_FIQ, "io_r: FIQ Source Select = %04x\n", val);
- break;
-
- case 0x2f: // Data Segment
- val = m_cpu->get_ds();
- LOGMASKED(LOG_SEGMENT, "io_r: Data Segment = %04x\n", val);
- break;
-
- default:
- LOGMASKED(LOG_UNKNOWN_IO, "io_r: Unknown register %04x\n", 0x3d00 + offset);
- break;
- }
-
- return val;
-}
-
-READ16_MEMBER(spg2xx_io_device::io_extended_r)
-{
- // this set of registers might only be on the 24x not the 11x
-
- offset += 0x30;
-
- uint16_t val = m_io_regs[offset];
-
- switch (offset)
- {
- case 0x30: // UART Control
- LOGMASKED(LOG_UART, "%s: io_r: UART Control = %04x\n", machine().describe_context(), val);
- break;
-
- case 0x31: // UART Status
- //LOGMASKED(LOG_UART, "%s: io_r: UART Status = %04x\n", machine().describe_context(), val);
- break;
-
- case 0x36: // UART RX Data
- if (m_uart_rx_available)
- {
- m_io_regs[0x31] &= ~0x0081;
- LOGMASKED(LOG_UART, "UART Rx data is available, clearing bits\n");
- if (m_uart_rx_fifo_count)
- {
- LOGMASKED(LOG_UART, "Remaining count %d, value %02x\n", m_uart_rx_fifo_count, m_uart_rx_fifo[m_uart_rx_fifo_start]);
- m_io_regs[0x36] = m_uart_rx_fifo[m_uart_rx_fifo_start];
- val = m_io_regs[0x36];
- m_uart_rx_fifo_start = (m_uart_rx_fifo_start + 1) % ARRAY_LENGTH(m_uart_rx_fifo);
- m_uart_rx_fifo_count--;
-
- if (m_uart_rx_fifo_count == 0)
- {
- m_uart_rx_available = false;
- }
- else
- {
- LOGMASKED(LOG_UART, "Remaining count %d, setting up timer\n", m_uart_rx_fifo_count);
- //uart_receive_tick();
- if (m_uart_rx_timer->remaining() == attotime::never)
- m_uart_rx_timer->adjust(attotime::from_ticks(BIT(m_io_regs[0x30], 5) ? 11 : 10, m_uart_baud_rate));
- }
- }
- else
- {
- m_uart_rx_available = false;
- }
- }
- else
- {
- m_io_regs[0x37] |= 0x2000;
- }
- LOGMASKED(LOG_UART, "%s: io_r: UART Rx Data = %04x\n", machine().describe_context(), val);
- break;
-
- case 0x37: // UART Rx FIFO Control
- val &= ~0x0070;
- val |= (m_uart_rx_available ? 7 : 0) << 4;
- LOGMASKED(LOG_UART, "io_r: UART Rx FIFO Control = %04x\n", machine().describe_context(), val);
- break;
-
- case 0x51: // unknown, polled by ClickStart cartridges ( clikstrt )
- return 0x8000;
-
- case 0x59: // I2C Status
- LOGMASKED(LOG_I2C, "io_r: I2C Status = %04x\n", val);
- break;
-
- case 0x5e: // I2C Data In
- LOGMASKED(LOG_I2C, "io_r: I2C Data In = %04x\n", val);
- break;
-
- default:
- LOGMASKED(LOG_UNKNOWN_IO, "io_r: Unknown register %04x\n", 0x3d00 + offset);
- break;
- }
-
- return val;
-}
-
-void spg2xx_io_device::update_porta_special_modes()
-{
- static const char* const s_pa_special[4][16] =
- {
- // Input, Special 0
- // Input, Special 1
- // Output, Special 0
- // Output, Special 1
-
- { "LP", "ExtClk2", "ExtClk1", "-", "SDA", "SlvRDY", "-", "-", "SPICLK", "-", "RxD", "SPISSB", "-", "-", "-", "-" },
- { "-", "-", "-", "SCK", "-", "SWS", "-", "-", "-", "-", "-", "-", "IRQ2B", "-", "-", "IRQ1B" },
- { "-", "-", "-", "SCK", "SDA", "SWS", "-", "-", "SPICLK", "TxD", "-", "SPISSB", "TAPWM", "TM1", "TBPWM", "TM2" },
- { "CSB3", "CSB2", "CSB1", "SCK", "SDA", "VSYNC", "HSYNC", "SYSCLK3", "SPICLK", "TxD", "SWS", "SPISSB", "-", "VSYNC", "HSYNC", "CSYNC" },
- };
- for (int bit = 15; bit >= 0; bit--)
- {
- if (!BIT(m_io_regs[0x05], bit))
- continue;
- uint8_t type = (BIT(m_io_regs[0x03], bit) << 1) | BIT(m_io_regs[0x00], 0);
- LOGMASKED(LOG_GPIO, " Bit %2d: %s\n", bit, s_pa_special[type][bit]);
- }
-}
-
-void spg2xx_io_device::update_portb_special_modes()
-{
- static const char* const s_pb_special[4][8] =
- {
- // Input, Special 0
- // Input, Special 1
- // Output, Special 0
- // Output, Special 1
-
- { "-", "-", "-", "-", "-", "-", "SDA", "SlvRDY" },
- { "-", "-", "-", "-", "-", "-", "SDA", "SlvRDY" },
- { "VSYNC", "HSYNC", "CSYNC", "-", "-", "SCK", "SDA", "SWS" },
- { "CSB3", "CSB2", "CSB1", "TBPWM", "TM2", "-", "-", "SYSCLK2" },
- };
- for (int bit = 7; bit >= 0; bit--)
- {
- if (!BIT(m_io_regs[0x0a], bit))
- continue;
- uint8_t type = (BIT(m_io_regs[0x08], bit) << 1) | BIT(m_io_regs[0x00], 1);
- LOGMASKED(LOG_GPIO, " Bit %2d: %s\n", bit, s_pb_special[type][bit]);
- }
-}
-
-void spg2xx_io_device::update_timer_b_rate()
-{
- switch (m_io_regs[0x17] & 7)
- {
- case 0:
- case 1:
- case 5:
- case 6:
- case 7:
- m_timer_src_c->adjust(attotime::never);
- break;
- case 2:
- m_timer_src_c->adjust(attotime::from_hz(32768), 0, attotime::from_hz(32768));
- break;
- case 3:
- m_timer_src_c->adjust(attotime::from_hz(8192), 0, attotime::from_hz(8192));
- break;
- case 4:
- m_timer_src_c->adjust(attotime::from_hz(4096), 0, attotime::from_hz(4096));
- break;
- }
-}
-
-void spg2xx_io_device::update_timer_ab_src()
-{
- if (m_timer_b_tick_rate == 0)
- return;
-
- m_timer_b_divisor++;
- if (m_timer_b_divisor >= m_timer_b_tick_rate)
- {
- m_timer_b_divisor = 0;
- increment_timer_a();
- }
-}
-
-void spg2xx_io_device::increment_timer_a()
-{
- m_io_regs[0x12]++;
- if (m_io_regs[0x12] == 0)
- {
- m_io_regs[0x12] = m_timer_a_preload;
- const uint16_t old = IO_IRQ_STATUS;
- IO_IRQ_STATUS |= 0x0800;
- const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE);
- if (changed)
- {
- //printf("Timer A overflow\n");
- check_irqs(0x0800);
- }
- }
-}
-
-void spg2xx_io_device::update_timer_c_src()
-{
- m_io_regs[0x16]++;
- if (m_io_regs[0x16] == 0)
- {
- m_io_regs[0x16] = m_timer_b_preload;
- const uint16_t old = IO_IRQ_STATUS;
- IO_IRQ_STATUS |= 0x0400;
- const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE);
- if (changed)
- {
- printf("Timer B overflow\n");
- check_irqs(0x0400);
- }
- }
-}
-
-
-WRITE16_MEMBER(spg28x_io_device::io_extended_w)
-{
- offset += 0x30;
-
- if (offset == 0x33)
- {
- m_io_regs[offset] = data;
- m_uart_baud_rate = 27000000 / (0x10000 - m_io_regs[0x33]);
- LOGMASKED(LOG_UART, "%s: io_w: UART Baud Rate scaler = %04x (%d baud)\n", machine().describe_context(), data, m_uart_baud_rate);
- }
- else
- {
- spg2xx_io_device::io_extended_w(space, offset-0x30, data, mem_mask);
- }
-}
-
-WRITE16_MEMBER(spg2xx_io_device::io_w)
-{
- static const char *const gpioregs[] = { "GPIO Data Port", "GPIO Buffer Port", "GPIO Direction Port", "GPIO Attribute Port", "GPIO IRQ/Latch Port" };
- static const char gpioports[3] = { 'A', 'B', 'C' };
-
- switch (offset)
- {
- case 0x00: // GPIO special function select
- {
- LOGMASKED(LOG_GPIO, "%s: io_w: GPIO Configuration = %04x (IOBWake:%d, IOAWake:%d, IOBSpecSel:%d, IOASpecSel:%d)\n", machine().describe_context(), data
- , BIT(data, 4), BIT(data, 3), BIT(data, 1), BIT(data, 0));
- const uint16_t old = m_io_regs[offset];
- m_io_regs[offset] = data;
- const uint16_t changed = old ^ data;
- if (BIT(changed, 0))
- update_porta_special_modes();
- if (BIT(changed, 1))
- update_portb_special_modes();
- break;
- }
-
- case 0x01: case 0x06: case 0x0b: // GPIO data, port A/B/C
- offset++;
- // Intentional fallthrough - we redirect data register writes to the buffer register.
-
- case 0x02: case 0x04: // Port A
- case 0x07: case 0x09: // Port B
- case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Port C
- LOGMASKED(LOG_GPIO, "%s: io_w: %s %c = %04x\n", machine().describe_context(), gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], data);
- m_io_regs[offset] = data;
- do_gpio(offset, true);
- break;
-
- case 0x03: // Port A Direction
- LOGMASKED(LOG_GPIO, "%s: io_w: GPIO Direction Port A = %04x\n", machine().describe_context(), data);
- m_io_regs[offset] = data;
- update_porta_special_modes();
- do_gpio(offset, true);
- break;
-
- case 0x08: // Port B Direction
- LOGMASKED(LOG_GPIO, "%s: io_w: GPIO Direction Port B = %04x\n", machine().describe_context(), data);
- m_io_regs[offset] = data;
- update_portb_special_modes();
- do_gpio(offset, true);
- break;
-
- case 0x05: // Port A Special
- LOGMASKED(LOG_GPIO, "%s: io_w: Port A Special Function Select: %04x\n", machine().describe_context(), data);
- m_io_regs[offset] = data;
- update_porta_special_modes();
- break;
-
- case 0x0a: // Port B Special
- LOGMASKED(LOG_GPIO, "%s: io_w: Port B Special Function Select: %04x\n", machine().describe_context(), data);
- m_io_regs[offset] = data;
- update_portb_special_modes();
- break;
-
- case 0x10: // Timebase Control
- {
- static const char* const s_tmb1_sel[2][4] =
- {
- { "8Hz", "16Hz", "32Hz", "64Hz" },
- { "12kHz", "24kHz", "40kHz", "40kHz" }
- };
- static const char* const s_tmb2_sel[2][4] =
- {
- { "128Hz", "256Hz", "512Hz", "1024Hz" },
- { "105kHz", "210kHz", "420kHz", "840kHz" }
- };
- static const uint32_t s_tmb1_freq[2][4] =
- {
- { 8, 16, 32, 64 },
- { 12000, 24000, 40000, 40000 }
- };
- static const uint32_t s_tmb2_freq[2][4] =
- {
- { 128, 256, 512, 1024 },
- { 105000, 210000, 420000, 840000 }
- };
- LOGMASKED(LOG_TIMERS, "io_w: Timebase Control = %04x (Source:%s, TMB2:%s, TMB1:%s)\n", data,
- BIT(data, 4) ? "27MHz" : "32768Hz", s_tmb2_sel[BIT(data, 4)][(data >> 2) & 3], s_tmb1_sel[BIT(data, 4)][data & 3]);
- m_io_regs[offset] = data;
- const uint8_t hifreq = BIT(data, 4);
- const uint32_t tmb1freq = s_tmb1_freq[hifreq][data & 3];
- m_tmb1->adjust(attotime::from_hz(tmb1freq), 0, attotime::from_hz(tmb1freq));
- const uint32_t tmb2freq = s_tmb2_freq[hifreq][(data >> 2) & 3];
- m_tmb2->adjust(attotime::from_hz(tmb2freq), 0, attotime::from_hz(tmb2freq));
- break;
- }
-
- case 0x11: // Timebase Clear
- LOGMASKED(LOG_TIMERS, "io_w: Timebase Clear = %04x\n", data);
- break;
-
- case 0x12: // Timer A Data
- LOGMASKED(LOG_TIMERS, "io_w: Timer A Data = %04x\n", data);
- m_io_regs[offset] = data;
- m_timer_a_preload = data;
- break;
-
- case 0x13: // Timer A Control
- {
- static const char* const s_source_a[8] = { "0", "0", "32768Hz", "8192Hz", "4096Hz", "1", "0", "ExtClk1" };
- static const char* const s_source_b[8] = { "2048Hz", "1024Hz", "256Hz", "TMB1", "4Hz", "2Hz", "1", "ExtClk2" };
- LOGMASKED(LOG_TIMERS, "io_w: Timer A Control = %04x (Source A:%s, Source B:%s)\n", data,
- s_source_a[data & 7], s_source_b[(data >> 3) & 7]);
- m_io_regs[offset] = data;
- int timer_a_rate = 0;
- switch (data & 7)
- {
- case 0:
- case 1:
- case 5:
- case 6:
- case 7:
- m_timer_src_ab->adjust(attotime::never);
- break;
- case 2:
- m_timer_src_ab->adjust(attotime::from_hz(32768), 0, attotime::from_hz(32768));
- timer_a_rate = 32768;
- break;
- case 3:
- m_timer_src_ab->adjust(attotime::from_hz(8192), 0, attotime::from_hz(8192));
- timer_a_rate = 8192;
- break;
- case 4:
- m_timer_src_ab->adjust(attotime::from_hz(4096), 0, attotime::from_hz(4096));
- timer_a_rate = 4096;
- break;
- }
- switch ((data >> 3) & 7)
- {
- case 0:
- m_timer_b_tick_rate = timer_a_rate / 2048;
- break;
- case 1:
- m_timer_b_tick_rate = timer_a_rate / 1024;
- break;
- case 2:
- m_timer_b_tick_rate = timer_a_rate / 256;
- break;
- case 3:
- m_timer_b_tick_rate = 0;
- break;
- case 4:
- m_timer_b_tick_rate = timer_a_rate / 4;
- break;
- case 5:
- m_timer_b_tick_rate = timer_a_rate / 2;
- break;
- case 6:
- m_timer_b_tick_rate = 1;
- break;
- case 7:
- m_timer_b_tick_rate = 0;
- break;
- }
- break;
- }
-
- case 0x15: // Timer A IRQ Clear
- {
- LOGMASKED(LOG_TIMERS, "io_w: Timer A IRQ Clear\n");
- const uint16_t old = IO_IRQ_STATUS;
- IO_IRQ_STATUS &= ~0x0800;
- const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE);
- if (changed)
- check_irqs(0x0800);
- break;
- }
-
- case 0x16: // Timer B Data
- LOGMASKED(LOG_TIMERS, "io_w: Timer B Data = %04x\n", data);
- m_io_regs[offset] = data;
- m_timer_b_preload = data;
- break;
-
- case 0x17: // Timer B Control
- {
- static const char* const s_source_c[8] = { "0", "0", "32768Hz", "8192Hz", "4096Hz", "1", "0", "ExtClk1" };
- LOGMASKED(LOG_TIMERS, "io_w: Timer B Control = %04x (Source C:%s)\n", data, s_source_c[data & 7]);
- m_io_regs[offset] = data;
- if (m_io_regs[0x18] == 1)
- {
- update_timer_b_rate();
- }
- break;
- }
-
- case 0x18: // Timer B Enable
- {
- LOGMASKED(LOG_TIMERS, "io_w: Timer B Enable = %04x\n", data);
- m_io_regs[offset] = data & 1;
- if (data & 1)
- {
- update_timer_b_rate();
- }
- else
- {
- m_timer_src_c->adjust(attotime::never);
- }
- break;
- }
-
- case 0x19: // Timer B IRQ Clear
- {
- LOGMASKED(LOG_TIMERS, "io_w: Timer B IRQ Clear\n");
- const uint16_t old = IO_IRQ_STATUS;
- IO_IRQ_STATUS &= ~0x0400;
- const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE);
- if (changed)
- check_irqs(0x0400);
- break;
- }
-
- case 0x20: // System Control
- {
- static const char* const s_sysclk[4] = { "13.5MHz", "27MHz", "27MHz NoICE", "54MHz" };
- static const char* const s_lvd_voltage[4] = { "2.7V", "2.9V", "3.1V", "3.3V" };
- static const char* const s_weak_strong[2] = { "Weak", "Strong" };
- LOGMASKED(LOG_IO_WRITES, "io_w: System Control = %04x (Watchdog:%d, Sleep:%d, SysClk:%s, SysClkInv:%d, LVROutEn:%d, LVREn:%d\n"
- , data, BIT(data, 15), BIT(data, 14), s_sysclk[(data >> 12) & 3], BIT(data, 11), BIT(data, 9), BIT(data, 8));
- LOGMASKED(LOG_IO_WRITES, " LVDEn:%d, LVDVoltSel:%s, 32kHzDisable:%d, StrWkMode:%s, VDACDisable:%d, ADACDisable:%d, ADACOutDisable:%d)\n"
- , BIT(data, 7), s_lvd_voltage[(data >> 5) & 3], BIT(data, 4), s_weak_strong[BIT(data, 3)], BIT(data, 2), BIT(data, 1), BIT(data, 0));
- m_io_regs[offset] = data;
- break;
- }
-
- case 0x21: // IRQ Enable
- {
- LOGMASKED(LOG_IRQS, "io_w: IRQ Enable = %04x\n", data);
- const uint16_t old = IO_IRQ_ENABLE;
- m_io_regs[offset] = data;
- const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE);
- if (changed)
- check_irqs(changed);
- break;
- }
-
- case 0x22: // IRQ Acknowledge
- {
- LOGMASKED(LOG_IRQS, "io_w: IRQ Acknowledge = %04x\n", data);
- const uint16_t old = IO_IRQ_STATUS;
- IO_IRQ_STATUS &= ~data;
- const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE);
- if (m_uart_rx_irq || m_uart_tx_irq)
- {
- LOGMASKED(LOG_IRQS | LOG_UART, "Re-setting UART IRQ due to still-unacknowledged Rx or Tx.\n");
- IO_IRQ_STATUS |= 0x0100;
- }
- if (changed)
- check_irqs(changed);
- break;
- }
-
- case 0x23: // External Memory Control
- {
- static const char* const s_bus_arb[8] =
- {
- "Forbidden", "Forbidden", "Forbidden", "Forbidden", "Forbidden", "1:SPU/2:PPU/3:CPU", "Forbidden", "1:PPU/2:SPU/3:CPU"
- };
- static const char* const s_addr_decode[4] =
- {
- "ROMCSB: 4000-3fffff, CSB1: ---, CSB2: ---, CSB3: ---",
- "ROMCSB: 4000-1fffff, CSB1: 200000-3fffff, CSB2: ---, CSB3: ---",
- "ROMCSB: 4000-0fffff, CSB1: 100000-1fffff, CSB2: 200000-2fffff, CSB3: 300000-3fffff",
- "ROMCSB: 4000-0fffff, CSB1: 100000-1fffff, CSB2: 200000-2fffff, CSB3: 300000-3fffff"
- };
- static const char* const s_ram_decode[16] =
- {
- "None", "None", "None", "None", "None", "None", "None", "None",
- "4KW, 3ff000-3fffff\n",
- "8KW, 3fe000-3fffff\n",
- "16KW, 3fc000-3fffff\n",
- "32KW, 3f8000-3fffff\n",
- "64KW, 3f0000-3fffff\n",
- "128KW, 3e0000-3fffff\n",
- "256KW, 3c0000-3fffff\n",
- "512KW, 380000-3fffff\n"
- };
- LOGMASKED(LOG_EXT_MEM, "io_w: Ext. Memory Control (not yet implemented) = %04x:\n", data);
- LOGMASKED(LOG_EXT_MEM, " WaitStates:%d, BusArbPrio:%s\n", (data >> 1) & 3, s_bus_arb[(data >> 3) & 7]);
- LOGMASKED(LOG_EXT_MEM, " ROMAddrDecode:%s\n", s_addr_decode[(data >> 6) & 3]);
- LOGMASKED(LOG_EXT_MEM, " RAMAddrDecode:%s\n", s_ram_decode[(data >> 8) & 15]);
- m_chip_sel((data >> 6) & 3);
- m_io_regs[offset] = data;
- break;
- }
-
- case 0x24: // Watchdog
- LOGMASKED(LOG_WATCHDOG, "io_w: Watchdog Pet = %04x\n", data);
- break;
-
- case 0x25: // ADC Control
- {
- LOGMASKED(LOG_IO_WRITES, "%s: io_w: ADC Control = %04x\n", machine().describe_context(), data);
- m_io_regs[offset] = data & ~0x1000;
- if (BIT(data, 0))
- {
- m_io_regs[0x27] = 0x8000 | (m_adc_in[BIT(data, 5)]() & 0x7fff);
- m_io_regs[0x25] |= 0x2000;
- }
- if (BIT(data, 12) && !BIT(m_io_regs[offset], 1))
- {
- const uint16_t old = IO_IRQ_STATUS;
- IO_IRQ_STATUS |= 0x2000;
- const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE);
- if (changed)
- {
- check_irqs(changed);
- }
- }
- break;
- }
-
- case 0x28: // Sleep Mode
- LOGMASKED(LOG_IO_WRITES, "io_w: Sleep Mode (%s enter value) = %04x\n", data == 0xaa55 ? "valid" : "invalid", data);
- m_io_regs[offset] = data;
- break;
-
- case 0x29: // Wakeup Source
- {
- m_io_regs[offset] = data;
- static const char* const s_sources[8] =
- {
- "TMB1", "TMB2", "2Hz", "4Hz", "1024Hz", "2048Hz", "4096Hz", "Key"
- };
-
- LOGMASKED(LOG_IO_WRITES, "io_w: Wakeup Source = %04x:\n", data);
- bool comma = false;
- char buf[1024];
- int char_idx = 0;
- for (int i = 7; i >= 0; i--)
- {
- if (BIT(data, i))
- {
- char_idx += sprintf(&buf[char_idx], "%s%s", comma ? ", " : "", s_sources[i]);
- comma = true;
- }
- }
- buf[char_idx] = 0;
- LOGMASKED(LOG_IO_WRITES, " %s\n", buf);
- break;
- }
-
- case 0x2c: // PRNG 0 seed
- LOGMASKED(LOG_IO_WRITES, "io_w: PRNG 0 seed = %04x\n", data & 0x7fff);
- m_io_regs[offset] = data & 0x7fff;
- break;
-
- case 0x2d: // PRNG 1 seed
- LOGMASKED(LOG_IO_WRITES, "io_w: PRNG 1 seed = %04x\n", data & 0x7fff);
- m_io_regs[offset] = data & 0x7fff;
- break;
-
- case 0x2e: // FIQ Source Select
- {
- static const char* const s_fiq_select[8] =
- {
- "PPU", "SPU Channel", "Timer A", "Timer B", "UART/SPI", "External", "Reserved", "None"
- };
- LOGMASKED(LOG_FIQ, "io_w: FIQ Source Select (not yet implemented) = %04x, %s\n", data, s_fiq_select[data & 7]);
- m_io_regs[offset] = data;
- break;
- }
-
- case 0x2f: // Data Segment
- m_cpu->set_ds(data & 0x3f);
- LOGMASKED(LOG_SEGMENT, "io_w: Data Segment = %04x\n", data);
- break;
-
- default:
- LOGMASKED(LOG_UNKNOWN_IO, "io_w: Unknown register %04x = %04x\n", 0x3d00 + offset, data);
- m_io_regs[offset] = data;
- break;
- }
-}
-
-
-
-
-WRITE16_MEMBER(spg2xx_io_device::io_extended_w)
-{
- // this set of registers might only be on the 24x not the 11x
-
- offset += 0x30;
-
- switch (offset)
- {
-
- case 0x30: // UART Control
- {
- static const char* const s_9th_bit[4] = { "0", "1", "Odd", "Even" };
- LOGMASKED(LOG_UART, "%s: io_w: UART Control = %04x (TxEn:%d, RxEn:%d, Bits:%d, MultiProc:%d, 9thBit:%s, TxIntEn:%d, RxIntEn:%d\n",
- machine().describe_context(), data, BIT(data, 7), BIT(data, 6), BIT(data, 5) ? 9 : 8, BIT(data, 4), s_9th_bit[(data >> 2) & 3],
- BIT(data, 1), BIT(data, 0));
- const uint16_t changed = m_io_regs[offset] ^ data;
- m_io_regs[offset] = data;
- if (!BIT(data, 6))
- {
- m_uart_rx_available = false;
- m_io_regs[0x36] = 0;
- }
- if (BIT(changed, 7))
- {
- if (BIT(data, 7))
- {
- m_io_regs[0x31] |= 0x0002;
- }
- else
- {
- m_io_regs[0x31] &= ~0x0042;
- m_uart_tx_timer->adjust(attotime::never);
- }
- }
- break;
- }
-
- case 0x31: // UART Status
- LOGMASKED(LOG_UART, "%s: io_w: UART Status = %04x\n", machine().describe_context(), data);
- if (BIT(data, 0))
- {
- m_io_regs[0x31] &= ~1;
- m_uart_rx_irq = false;
- }
- if (BIT(data, 1))
- {
- m_io_regs[0x31] &= ~2;
- m_uart_tx_irq = false;
- }
- if (!m_uart_rx_irq && !m_uart_tx_irq)
- {
- const uint16_t old = IO_IRQ_STATUS;
- IO_IRQ_STATUS &= ~0x0100;
- const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE);
- if (changed)
- check_irqs(0x0100);
- }
- break;
-
- case 0x33: // UART Baud Rate (low byte)
- case 0x34: // UART Baud Rate (high byte)
- {
- m_io_regs[offset] = data;
- const uint32_t divisor = 16 * (0x10000 - ((m_io_regs[0x34] << 8) | m_io_regs[0x33]));
- LOGMASKED(LOG_UART, "%s: io_w: UART Baud Rate (%s byte): Baud rate = %d\n", offset == 0x33 ? "low" : "high", machine().describe_context(), 27000000 / divisor);
- m_uart_baud_rate = 27000000 / divisor;
- break;
- }
-
- case 0x35: // UART TX Data
- LOGMASKED(LOG_UART, "%s: io_w: UART Tx Data = %02x\n", machine().describe_context(), data & 0x00ff);
- m_io_regs[offset] = data;
- if (BIT(m_io_regs[0x30], 7))
- {
- LOGMASKED(LOG_UART, "io_w: UART Tx: Clearing ready bit, setting busy bit, setting up timer\n");
- m_uart_tx_timer->adjust(attotime::from_ticks(BIT(m_io_regs[0x30], 5) ? 11 : 10, m_uart_baud_rate));
- m_io_regs[0x31] &= ~0x0002;
- m_io_regs[0x31] |= 0x0040;
- }
- break;
-
- case 0x36: // UART RX Data
- LOGMASKED(LOG_UART, "%s: io_w: UART Rx Data (read-only) = %04x\n", machine().describe_context(), data);
- break;
-
- case 0x37: // UART Rx FIFO Control
- LOGMASKED(LOG_UART, "%s: io_w: UART Rx FIFO Control = %04x (Reset:%d, Overrun:%d, Underrun:%d, Count:%d, Threshold:%d)\n",
- machine().describe_context(), data, BIT(data, 15), BIT(data, 14), BIT(data, 13), (data >> 4) & 7, data & 7);
- if (data & 0x8000)
- {
- m_uart_rx_available = false;
- m_io_regs[0x36] = 0;
- }
- m_io_regs[offset] &= ~data & 0x6000;
- m_io_regs[offset] &= ~0x0007;
- m_io_regs[offset] |= data & 0x0007;
- break;
-
- case 0x50: // SIO Setup
- {
- static const char* const s_addr_mode[4] = { "16-bit", "None", "8-bit", "24-bit" };
- static const char* const s_baud_rate[4] = { "/16", "/4", "/8", "/32" };
- LOGMASKED(LOG_SIO, "io_w: SIO Setup (not implemented) = %04x (DS301Ready:%d, Start:%d, Auto:%d, IRQEn:%d, Width:%d, Related:%d\n", data
- , BIT(data, 11), BIT(data, 10), BIT(data, 9), BIT(data, 8), BIT(data, 7) ? 16 : 8, BIT(data, 6));
- LOGMASKED(LOG_SIO, " (Mode:%s, RWProtocol:%d, Rate:sysclk%s, AddrMode:%s)\n"
- , BIT(data, 5), BIT(data, 4), s_baud_rate[(data >> 2) & 3], s_addr_mode[data & 3]);
- break;
- }
-
- case 0x52: // SIO Start Address (low)
- LOGMASKED(LOG_SIO, "io_w: SIO Stat Address (low) (not implemented) = %04x\n", data);
- break;
-
- case 0x53: // SIO Start Address (hi)
- LOGMASKED(LOG_SIO, "io_w: SIO Stat Address (hi) (not implemented) = %04x\n", data);
- break;
-
- case 0x54: // SIO Data
- LOGMASKED(LOG_SIO, "io_w: SIO Data (not implemented) = %04x\n", data);
- break;
-
- case 0x55: // SIO Automatic Transmit Count
- LOGMASKED(LOG_SIO, "io_w: SIO Auto Transmit Count (not implemented) = %04x\n", data);
- break;
-
- case 0x58: // I2C Command
- LOGMASKED(LOG_I2C, "io_w: I2C Command = %04x\n", data);
- m_io_regs[offset] = data;
- do_i2c();
- break;
-
- case 0x59: // I2C Status / Acknowledge
- LOGMASKED(LOG_I2C, "io_w: I2C Acknowledge = %04x\n", data);
- m_io_regs[offset] &= ~data;
- break;
-
- case 0x5a: // I2C Access Mode
- LOGMASKED(LOG_I2C, "io_w: I2C Access Mode = %04x\n", data);
- m_io_regs[offset] = data;
- break;
-
- case 0x5b: // I2C Device Address
- LOGMASKED(LOG_I2C, "io_w: I2C Device Address = %04x\n", data);
- m_io_regs[offset] = data;
- break;
-
- case 0x5c: // I2C Sub-Address
- LOGMASKED(LOG_I2C, "io_w: I2C Sub-Address = %04x\n", data);
- m_io_regs[offset] = data;
- break;
-
- case 0x5d: // I2C Data Out
- LOGMASKED(LOG_I2C, "io_w: I2C Data Out = %04x\n", data);
- m_io_regs[offset] = data;
- break;
-
- case 0x5e: // I2C Data In
- LOGMASKED(LOG_I2C, "io_w: I2C Data In = %04x\n", data);
- m_io_regs[offset] = data;
- break;
-
- case 0x5f: // I2C Controller Mode
- LOGMASKED(LOG_I2C, "io_w: I2C Controller Mode = %04x\n", data);
- m_io_regs[offset] = data;
- break;
-
- default:
- LOGMASKED(LOG_UNKNOWN_IO, "io_w: Unknown register %04x = %04x\n", 0x3d00 + offset, data);
- m_io_regs[offset] = data;
- break;
- }
-}
-
-void spg2xx_io_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- switch (id)
- {
- case TIMER_TMB1:
- {
- LOGMASKED(LOG_TIMERS, "TMB1 elapsed, setting IRQ Status bit 0 (old:%04x, new:%04x, enable:%04x)\n", IO_IRQ_STATUS, IO_IRQ_STATUS | 1, IO_IRQ_ENABLE);
- const uint16_t old = IO_IRQ_STATUS;
- IO_IRQ_STATUS |= 1;
- const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE);
- if (changed)
- check_irqs(0x0001);
- break;
- }
-
- case TIMER_TMB2:
- {
- LOGMASKED(LOG_TIMERS, "TMB2 elapsed, setting IRQ Status bit 1 (old:%04x, new:%04x, enable:%04x)\n", IO_IRQ_STATUS, IO_IRQ_STATUS | 2, IO_IRQ_ENABLE);
- const uint16_t old = IO_IRQ_STATUS;
- IO_IRQ_STATUS |= 2;
- const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE);
- if (changed)
- check_irqs(0x0002);
- break;
- }
-
- case TIMER_UART_TX:
- uart_transmit_tick();
- break;
-
- case TIMER_UART_RX:
- uart_receive_tick();
- break;
-
- case TIMER_4KHZ:
- system_timer_tick();
- break;
-
- case TIMER_SRC_AB:
- update_timer_ab_src();
- break;
-
- case TIMER_SRC_C:
- update_timer_c_src();
- break;
- }
-}
-
-void spg2xx_io_device::system_timer_tick()
-{
- const uint16_t old = IO_IRQ_STATUS;
- uint16_t check_mask = 0x0040;
- IO_IRQ_STATUS |= 0x0040;
-
- m_2khz_divider++;
- if (m_2khz_divider == 2)
- {
- m_2khz_divider = 0;
- IO_IRQ_STATUS |= 0x0020;
- check_mask |= 0x0020;
-
- m_1khz_divider++;
- if (m_1khz_divider == 2)
- {
- m_1khz_divider = 0;
- IO_IRQ_STATUS |= 0x0010;
- check_mask |= 0x0010;
-
- m_4hz_divider++;
- if (m_4hz_divider == 256)
- {
- m_4hz_divider = 0;
- IO_IRQ_STATUS |= 0x0008;
- check_mask |= 0x0008;
- }
- }
- }
-
- const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE);
- if (changed)
- check_irqs(check_mask);
-}
-
-void spg2xx_io_device::uart_transmit_tick()
-{
- LOGMASKED(LOG_UART, "uart_transmit_tick: Transmitting %02x, setting TxReady, clearing TxBusy\n", (uint8_t)m_io_regs[0x35]);
- m_uart_tx((uint8_t)m_io_regs[0x35]);
- m_io_regs[0x31] |= 0x0002;
- m_io_regs[0x31] &= ~0x0040;
- if (BIT(m_io_regs[0x30], 1))
- {
- const uint16_t old = IO_IRQ_STATUS;
- IO_IRQ_STATUS |= 0x0100;
- m_uart_tx_irq = true;
- LOGMASKED(LOG_UART, "uart_transmit_tick: Setting UART IRQ bit\n");
- if (IO_IRQ_STATUS != old)
- {
- LOGMASKED(LOG_UART, "uart_transmit_tick: Bit newly set, checking IRQs\n");
- check_irqs(0x0100);
- }
- }
-}
-
-void spg2xx_io_device::uart_receive_tick()
-{
- LOGMASKED(LOG_UART, "uart_receive_tick: Setting RBF and RxRDY\n");
- m_io_regs[0x31] |= 0x81;
- m_uart_rx_available = true;
- if (BIT(m_io_regs[0x30], 0))
- {
- LOGMASKED(LOG_UART, "uart_receive_tick: RxIntEn is set, setting rx_irq to true and setting UART IRQ\n");
- m_uart_rx_irq = true;
- IO_IRQ_STATUS |= 0x0100;
- check_irqs(0x0100);
- }
-}
-
-void spg2xx_io_device::extint_w(int channel, bool state)
-{
- LOGMASKED(LOG_EXTINT, "Setting extint channel %d to %s\n", channel, state ? "true" : "false");
- bool old = m_extint[channel];
- m_extint[channel] = state;
- if (old != state)
- {
- check_extint_irq(channel);
- }
-}
-
-void spg2xx_io_device::check_extint_irq(int channel)
-{
- LOGMASKED(LOG_EXTINT, "%sing extint %d interrupt\n", m_extint[channel] ? "rais" : "lower", channel + 1);
- const uint16_t mask = (channel == 0) ? 0x0200 : 0x1000;
- const uint16_t old_irq = IO_IRQ_STATUS;
- if (m_extint[channel])
- IO_IRQ_STATUS |= mask;
- else
- IO_IRQ_STATUS &= ~mask;
-
- if (old_irq != IO_IRQ_STATUS)
- {
- LOGMASKED(LOG_EXTINT, "extint IRQ changed, so checking interrupts\n");
- check_irqs(mask);
- }
-}
-
-void spg2xx_io_device::check_irqs(const uint16_t changed)
-{
- if (changed & 0x0c00) // Timer A, Timer B IRQ
- {
- LOGMASKED(LOG_TIMERS, "%ssserting IRQ2 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0c00) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0c00), changed);
- m_timer_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0c00) ? ASSERT_LINE : CLEAR_LINE);
- }
-
- if (changed & 0x2100) // UART, ADC IRQ
- {
- LOGMASKED(LOG_UART, "%ssserting IRQ3 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x2100) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x2100), changed);
- m_uart_adc_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x2100) ? ASSERT_LINE : CLEAR_LINE);
- }
-
- if (changed & 0x1200) // External IRQ
- {
- LOGMASKED(LOG_UART, "%ssserting IRQ5 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x1200) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x1200), changed);
- m_external_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x1200) ? ASSERT_LINE : CLEAR_LINE);
- }
-
- if (changed & 0x0070) // 1024Hz, 2048Hz, 4096Hz IRQ
- {
- LOGMASKED(LOG_TIMERS, "%ssserting IRQ6 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0070) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0070), changed); //m_cpu->set_state_unsynced(UNSP_IRQ6_LINE, (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0070) ? ASSERT_LINE : CLEAR_LINE);
- m_ffreq_tmr1_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0070) ? ASSERT_LINE : CLEAR_LINE);
- }
-
- if (changed & 0x008b) // TMB1, TMB2, 4Hz, key change IRQ
- {
- LOGMASKED(LOG_IRQS, "%ssserting IRQ7 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b), changed);
- m_ffreq_tmr2_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b) ? ASSERT_LINE : CLEAR_LINE);
- }
-}
-
-uint16_t spg2xx_io_device::do_special_gpio(uint32_t index, uint16_t mask)
-{
- uint16_t data = 0;
- switch (index)
- {
- case 0: // Port A
- if (mask & 0xe000)
- {
- const uint8_t csel = m_cpu->get_csb() & 0x0e;
- data = (csel << 12) & mask;
- }
- break;
- case 1: // Port B
- // To do
- break;
- case 2: // Port C
- // To do
- break;
- default:
- // Can't happen
- break;
- }
- return data;
-}
-
-void spg2xx_io_device::do_gpio(uint32_t offset, bool write)
-{
- uint32_t index = (offset - 1) / 5;
- uint16_t buffer = m_io_regs[5 * index + 2];
- uint16_t dir = m_io_regs[5 * index + 3];
- uint16_t attr = m_io_regs[5 * index + 4];
- uint16_t special = m_io_regs[5 * index + 5];
-
- uint16_t push = dir;
- uint16_t pull = ~dir;
- uint16_t what = (buffer & (push | pull));
- what ^= (dir & ~attr);
- what &= ~special;
-
- switch (index)
- {
- case 0:
- if (write)
- m_porta_out(0, what, push &~ special);
- what = (what & ~pull);
- if (!write)
- what |= m_porta_in(0, pull &~ special) & pull;
- break;
- case 1:
- if (write)
- m_portb_out(0, what, push &~ special);
- what = (what & ~pull);
- if (!write)
- what |= m_portb_in(0, pull &~ special) & pull;
- break;
- case 2:
- if (write)
- m_portc_out(0, what, push &~ special);
- what = (what & ~pull);
- if (!write)
- what |= m_portc_in(0, pull &~ special) & pull;
- break;
- }
-
- what |= do_special_gpio(index, special);
- m_io_regs[5 * index + 1] = what;
-}
-
-void spg2xx_io_device::do_i2c()
-{
- const uint16_t addr = ((m_io_regs[0x5b] & 0x06) << 7) | (uint8_t)m_io_regs[0x5c];
-
- if (m_io_regs[0x58] & 0x40) // Serial EEPROM read
- m_io_regs[0x5e] = m_eeprom_r(addr);
- else
- m_eeprom_w(addr, m_io_regs[0x5d]);
-
- m_io_regs[0x59] |= 1;
-}
diff --git a/src/devices/machine/spg2xx_io.h b/src/devices/machine/spg2xx_io.h
deleted file mode 100644
index d829915cbec..00000000000
--- a/src/devices/machine/spg2xx_io.h
+++ /dev/null
@@ -1,183 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-
-#ifndef MAME_MACHINE_SPG2XX_IO_H
-#define MAME_MACHINE_SPG2XX_IO_H
-
-#pragma once
-
-#include "cpu/unsp/unsp.h"
-#include "screen.h"
-
-class spg2xx_io_device : public device_t
-{
-public:
- spg2xx_io_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
- auto porta_out() { return m_porta_out.bind(); }
- auto portb_out() { return m_portb_out.bind(); }
- auto portc_out() { return m_portc_out.bind(); }
- auto porta_in() { return m_porta_in.bind(); }
- auto portb_in() { return m_portb_in.bind(); }
- auto portc_in() { return m_portc_in.bind(); }
-
- template <size_t Line> auto adc_in() { return m_adc_in[Line].bind(); }
-
- auto eeprom_w() { return m_eeprom_w.bind(); }
- auto eeprom_r() { return m_eeprom_r.bind(); }
-
- auto uart_tx() { return m_uart_tx.bind(); }
-
- auto chip_select() { return m_chip_sel.bind(); }
-
- void uart_rx(uint8_t data);
-
- void extint_w(int channel, bool state);
-
- DECLARE_READ16_MEMBER(io_r);
- DECLARE_WRITE16_MEMBER(io_w);
-
- virtual DECLARE_READ16_MEMBER(io_extended_r);
- virtual DECLARE_WRITE16_MEMBER(io_extended_w);
-
-
- auto pal_read_callback() { return m_pal_read_cb.bind(); };
-
- auto write_timer_irq_callback() { return m_timer_irq_cb.bind(); };
- auto write_uart_adc_irq_callback() { return m_uart_adc_irq_cb.bind(); };
- auto write_external_irq_callback() { return m_external_irq_cb.bind(); };
- auto write_ffrq_tmr1_irq_callback() { return m_ffreq_tmr1_irq_cb.bind(); };
- auto write_ffrq_tmr2_irq_callback() { return m_ffreq_tmr2_irq_cb.bind(); };
-
-protected:
- spg2xx_io_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const uint32_t sprite_limit)
- : spg2xx_io_device(mconfig, type, tag, owner, clock)
- {
- }
-
- void check_extint_irq(int channel);
- void check_irqs(const uint16_t changed);
-
- static const device_timer_id TIMER_TMB1 = 0;
- static const device_timer_id TIMER_TMB2 = 1;
-
- static const device_timer_id TIMER_UART_TX = 4;
- static const device_timer_id TIMER_UART_RX = 5;
- static const device_timer_id TIMER_4KHZ = 6;
- static const device_timer_id TIMER_SRC_AB = 7;
- static const device_timer_id TIMER_SRC_C = 8;
-
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
-
- void update_porta_special_modes();
- void update_portb_special_modes();
- void do_gpio(uint32_t offset, bool write);
- uint16_t do_special_gpio(uint32_t index, uint16_t mask);
-
- void update_timer_b_rate();
- void update_timer_ab_src();
- void update_timer_c_src();
- void increment_timer_a();
-
- void uart_transmit_tick();
- void uart_receive_tick();
-
- void system_timer_tick();
-
- void do_i2c();
-
- uint16_t m_io_regs[0x100];
-
- uint8_t m_uart_rx_fifo[8];
- uint8_t m_uart_rx_fifo_start;
- uint8_t m_uart_rx_fifo_end;
- uint8_t m_uart_rx_fifo_count;
- bool m_uart_rx_available;
- bool m_uart_rx_irq;
- bool m_uart_tx_irq;
-
- bool m_extint[2];
-
- devcb_write16 m_porta_out;
- devcb_write16 m_portb_out;
- devcb_write16 m_portc_out;
- devcb_read16 m_porta_in;
- devcb_read16 m_portb_in;
- devcb_read16 m_portc_in;
-
- devcb_read16 m_adc_in[2];
-
- devcb_write8 m_eeprom_w;
- devcb_read8 m_eeprom_r;
-
- devcb_write8 m_uart_tx;
-
- devcb_write8 m_chip_sel;
-
- uint16_t m_timer_a_preload;
- uint16_t m_timer_b_preload;
- uint16_t m_timer_b_divisor;
- uint16_t m_timer_b_tick_rate;
-
- emu_timer *m_tmb1;
- emu_timer *m_tmb2;
- emu_timer *m_timer_src_ab;
- emu_timer *m_timer_src_c;
-
- emu_timer *m_4khz_timer;
- uint32_t m_2khz_divider;
- uint32_t m_1khz_divider;
- uint32_t m_4hz_divider;
-
- uint32_t m_uart_baud_rate;
- emu_timer *m_uart_tx_timer;
- emu_timer *m_uart_rx_timer;
-
- required_device<unsp_device> m_cpu;
- required_device<screen_device> m_screen;
-
- devcb_read16 m_pal_read_cb;
-
- devcb_write_line m_timer_irq_cb;
- devcb_write_line m_uart_adc_irq_cb;
- devcb_write_line m_external_irq_cb;
- devcb_write_line m_ffreq_tmr1_irq_cb;
- devcb_write_line m_ffreq_tmr2_irq_cb;
-};
-
-class spg24x_io_device : public spg2xx_io_device
-{
-public:
- template <typename T, typename U>
- spg24x_io_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag, U &&screen_tag)
- : spg24x_io_device(mconfig, tag, owner, clock)
- {
- m_cpu.set_tag(std::forward<T>(cpu_tag));
- m_screen.set_tag(std::forward<U>(screen_tag));
- }
-
- spg24x_io_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-};
-
-class spg28x_io_device : public spg2xx_io_device
-{
-public:
- template <typename T, typename U>
- spg28x_io_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag, U &&screen_tag)
- : spg28x_io_device(mconfig, tag, owner, clock)
- {
- m_cpu.set_tag(std::forward<T>(cpu_tag));
- m_screen.set_tag(std::forward<U>(screen_tag));
- }
-
- spg28x_io_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- virtual DECLARE_WRITE16_MEMBER(io_extended_w) override;
-};
-
-DECLARE_DEVICE_TYPE(SPG24X_IO, spg24x_io_device)
-DECLARE_DEVICE_TYPE(SPG28X_IO, spg28x_io_device)
-
-#endif // MAME_MACHINE_SPG2XX_IO_H
diff --git a/src/devices/machine/strata.cpp b/src/devices/machine/strata.cpp
index df434adbd24..3f32b62739f 100644
--- a/src/devices/machine/strata.cpp
+++ b/src/devices/machine/strata.cpp
@@ -203,7 +203,7 @@ void strataflash_device::device_start()
/*
read a 8/16-bit word from FEEPROM
*/
-uint16_t strataflash_device::read8_16(offs_t offset, bus_width_t bus_width)
+uint16_t strataflash_device::read8_16(address_space& space, offs_t offset, bus_width_t bus_width)
{
switch (bus_width)
{
@@ -393,7 +393,7 @@ uint16_t strataflash_device::read8_16(offs_t offset, bus_width_t bus_width)
/*
write a 8/16-bit word to FEEPROM
*/
-void strataflash_device::write8_16(offs_t offset, uint16_t data, bus_width_t bus_width)
+void strataflash_device::write8_16(address_space& space, offs_t offset, uint16_t data, bus_width_t bus_width)
{
switch (bus_width)
{
@@ -634,31 +634,31 @@ void strataflash_device::write8_16(offs_t offset, uint16_t data, bus_width_t bus
/*
read a byte from FEEPROM
*/
-uint8_t strataflash_device::read8(offs_t offset)
+READ8_MEMBER( strataflash_device::read8 )
{
- return read8_16(offset, bw_8);
+ return read8_16(space, offset, bw_8);
}
/*
Write a byte to FEEPROM
*/
-void strataflash_device::write8(offs_t offset, uint8_t data)
+WRITE8_MEMBER( strataflash_device::write8 )
{
- write8_16(offset, data, bw_8);
+ write8_16(space, offset, data, bw_8);
}
/*
read a 16-bit word from FEEPROM
*/
-uint16_t strataflash_device::read16(offs_t offset)
+READ16_MEMBER( strataflash_device::read16 )
{
- return read8_16(offset, bw_16);
+ return read8_16(space, offset, bw_16);
}
/*
Write a byte to FEEPROM
*/
-void strataflash_device::write16(offs_t offset, uint16_t data)
+WRITE16_MEMBER( strataflash_device::write16 )
{
- write8_16(offset, data, bw_16);
+ write8_16(space, offset, data, bw_16);
}
diff --git a/src/devices/machine/strata.h b/src/devices/machine/strata.h
index 1a3acbbd9dd..26d8675f436 100644
--- a/src/devices/machine/strata.h
+++ b/src/devices/machine/strata.h
@@ -12,12 +12,12 @@ public:
strataflash_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// 8-bit access
- uint8_t read8(offs_t offset);
- void write8(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read8 );
+ DECLARE_WRITE8_MEMBER( write8 );
// 16-bit access
- uint16_t read16(offs_t offset);
- void write16(offs_t offset, uint16_t data);
+ DECLARE_READ16_MEMBER( read16 );
+ DECLARE_WRITE16_MEMBER( write16 );
protected:
// device-level overrides
@@ -36,8 +36,8 @@ private:
bw_16
};
- uint16_t read8_16(offs_t offset, bus_width_t bus_width);
- void write8_16(offs_t offset, uint16_t data, bus_width_t bus_width);
+ uint16_t read8_16(address_space& space, offs_t offset, bus_width_t bus_width);
+ void write8_16(address_space& space, offs_t offset, uint16_t data, bus_width_t bus_width);
enum fm_mode_t
{
diff --git a/src/devices/machine/stvcd.cpp b/src/devices/machine/stvcd.cpp
index c4b7ada9b9f..09323a7deea 100644
--- a/src/devices/machine/stvcd.cpp
+++ b/src/devices/machine/stvcd.cpp
@@ -78,17 +78,17 @@ stvcd_device::stvcd_device(const machine_config &mconfig, const char *tag, devic
{
}
-void stvcd_device::device_add_mconfig(machine_config &config)
-{
- CDROM(config, "cdrom").set_interface("sat_cdrom");
+MACHINE_CONFIG_START(stvcd_device::device_add_mconfig)
+ MCFG_CDROM_ADD("cdrom")
+ MCFG_CDROM_INTERFACE("sat_cdrom")
- TIMER(config, m_sector_timer).configure_generic(FUNC(stvcd_device::stv_sector_cb));
- TIMER(config, m_sh1_timer).configure_generic(FUNC(stvcd_device::stv_sh1_sim));
+ MCFG_TIMER_DRIVER_ADD("sector_timer", stvcd_device, stv_sector_cb)
+ MCFG_TIMER_DRIVER_ADD("sh1_cmd", stvcd_device, stv_sh1_sim)
- CDDA(config, m_cdda);
- m_cdda->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_cdda->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
-}
+ MCFG_DEVICE_ADD("cdda", CDDA)
+ MCFG_MIXER_ROUTE(0, *this, 1.0, 0)
+ MCFG_MIXER_ROUTE(1, *this, 1.0, 1)
+MACHINE_CONFIG_END
void stvcd_device::device_start()
{
diff --git a/src/devices/machine/tc009xlvc.cpp b/src/devices/machine/tc009xlvc.cpp
index a870dee98a6..4624e3fc79d 100644
--- a/src/devices/machine/tc009xlvc.cpp
+++ b/src/devices/machine/tc009xlvc.cpp
@@ -171,7 +171,7 @@ void tc0091lvc_device::tc0091lvc_map8(address_map &map)
tc0091lvc_device::tc0091lvc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, TC0091LVC, tag, owner, clock)
, device_memory_interface(mconfig, *this)
- , m_space_config("tc0091lvc", ENDIANNESS_LITTLE, 8,20, 0, address_map_constructor(FUNC(tc0091lvc_device::tc0091lvc_map8), this))
+ , m_space_config("tc0091lvc", ENDIANNESS_LITTLE, 8,20, 0, address_map_constructor(), address_map_constructor(FUNC(tc0091lvc_device::tc0091lvc_map8), this))
, m_gfxdecode(*this, finder_base::DUMMY_TAG)
{
}
diff --git a/src/devices/machine/terminal.cpp b/src/devices/machine/terminal.cpp
index c2e5c5be205..be9b501c687 100644
--- a/src/devices/machine/terminal.cpp
+++ b/src/devices/machine/terminal.cpp
@@ -326,22 +326,21 @@ void generic_terminal_device::kbd_put(u8 data)
VIDEO HARDWARE
***************************************************************************/
-void generic_terminal_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, TERMINAL_SCREEN_TAG, SCREEN_TYPE_RASTER));
- screen.set_refresh_hz(50);
- screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
- screen.set_size(generic_terminal_device::TERMINAL_WIDTH*8, generic_terminal_device::TERMINAL_HEIGHT*10);
- screen.set_visarea(0, generic_terminal_device::TERMINAL_WIDTH*8-1, 0, generic_terminal_device::TERMINAL_HEIGHT*10-1);
- screen.set_screen_update(FUNC(generic_terminal_device::update));
+MACHINE_CONFIG_START(generic_terminal_device::device_add_mconfig)
+ MCFG_SCREEN_ADD(TERMINAL_SCREEN_TAG, RASTER)
+ MCFG_SCREEN_REFRESH_RATE(50)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
+ MCFG_SCREEN_SIZE(generic_terminal_device::TERMINAL_WIDTH*8, generic_terminal_device::TERMINAL_HEIGHT*10)
+ MCFG_SCREEN_VISIBLE_AREA(0, generic_terminal_device::TERMINAL_WIDTH*8-1, 0, generic_terminal_device::TERMINAL_HEIGHT*10-1)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, generic_terminal_device, update)
generic_keyboard_device &keyboard(GENERIC_KEYBOARD(config, KEYBOARD_TAG, 0));
keyboard.set_keyboard_callback(FUNC(generic_terminal_device::kbd_put));
SPEAKER(config, "bell").front_center();
- BEEP(config, m_beeper, 2'000);
- m_beeper->add_route(ALL_OUTPUTS, "bell", 0.25);
-}
+ MCFG_DEVICE_ADD("beeper", BEEP, 2'000)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "bell", 0.25)
+MACHINE_CONFIG_END
void generic_terminal_device::device_start()
{
diff --git a/src/devices/machine/terminal.h b/src/devices/machine/terminal.h
index dab8bd40578..bf2f81c07f7 100644
--- a/src/devices/machine/terminal.h
+++ b/src/devices/machine/terminal.h
@@ -36,7 +36,7 @@ public:
}
void set_keyboard_callback(generic_keyboard_device::output_delegate callback) { m_keyboard_cb = callback; }
- void write(u8 data) { term_write(data); }
+ DECLARE_WRITE8_MEMBER(write) { term_write(data); }
void kbd_put(u8 data);
diff --git a/src/devices/machine/ticket.h b/src/devices/machine/ticket.h
index 7330ad3cb74..813e27b95c1 100644
--- a/src/devices/machine/ticket.h
+++ b/src/devices/machine/ticket.h
@@ -21,6 +21,22 @@
DECLARE_DEVICE_TYPE(TICKET_DISPENSER, ticket_dispenser_device)
DECLARE_DEVICE_TYPE(HOPPER, hopper_device)
+
+//**************************************************************************
+// DEVICE CONFIGURATION MACROS
+//**************************************************************************
+
+// add/remove dispensers
+#define MCFG_TICKET_DISPENSER_ADD(_tag, _period_in_msec, _motor_sense, _status_sense) \
+ MCFG_DEVICE_ADD(_tag, TICKET_DISPENSER, 0) \
+ downcast<ticket_dispenser_device &>(*device).set_period(_period_in_msec); \
+ downcast<ticket_dispenser_device &>(*device).set_senses(_motor_sense, _status_sense, false);
+
+#define MCFG_HOPPER_ADD(_tag, _period_in_msec, _motor_sense, _status_sense) \
+ MCFG_DEVICE_ADD(_tag, TICKET_DISPENSER, 0) \
+ downcast<ticket_dispenser_device &>(*device).set_period(_period_in_msec); \
+ downcast<ticket_dispenser_device &>(*device).set_senses(_motor_sense, _status_sense, true);
+
//**************************************************************************
// CONSTANTS
//**************************************************************************
diff --git a/src/devices/machine/timekpr.cpp b/src/devices/machine/timekpr.cpp
index f7cfed5451c..7dddede2c05 100644
--- a/src/devices/machine/timekpr.cpp
+++ b/src/devices/machine/timekpr.cpp
@@ -37,47 +37,53 @@ DEFINE_DEVICE_TYPE(MK48T12, mk48t12_device, "mk48t12", "MK48T12 Timekeeper")
MACROS
***************************************************************************/
-#define MASK_SECONDS (0x7f)
-#define MASK_MINUTES (0x7f)
-#define MASK_HOURS (0x3f)
-#define MASK_DAY (0x07)
-#define MASK_DATE (0x3f)
-#define MASK_MONTH (0x1f)
-#define MASK_YEAR (0xff)
-#define MASK_CENTURY (0xff)
+#define MASK_SECONDS ( 0x7f )
+#define MASK_MINUTES ( 0x7f )
+#define MASK_HOURS ( 0x3f )
+#define MASK_DAY ( 0x07 )
+#define MASK_DATE ( 0x3f )
+#define MASK_MONTH ( 0x1f )
+#define MASK_YEAR ( 0xff )
+#define MASK_CENTURY ( 0xff )
-#define CONTROL_W (0x80)
-#define CONTROL_R (0x40)
-#define CONTROL_S (0x20) /* not emulated */
-#define CONTROL_CALIBRATION (0x1f) /* not emulated */
+#define CONTROL_W ( 0x80 )
+#define CONTROL_R ( 0x40 )
+#define CONTROL_S ( 0x20 ) /* not emulated */
+#define CONTROL_CALIBRATION ( 0x1f ) /* not emulated */
-#define SECONDS_ST (0x80)
+#define SECONDS_ST ( 0x80 )
-#define DAY_FT (0x40) /* M48T37 - not emulated */
-#define DAY_CEB (0x20) /* M48T35/M48T58 */
-#define DAY_CB (0x10) /* M48T35/M48T58 */
+#define DAY_FT ( 0x40 ) /* M48T37 - not emulated */
+#define DAY_CEB ( 0x20 ) /* M48T35/M48T58 */
+#define DAY_CB ( 0x10 ) /* M48T35/M48T58 */
-#define DATE_BLE (0x80) /* M48T58: not emulated */
-#define DATE_BL (0x40) /* M48T58: not emulated */
+#define DATE_BLE ( 0x80 ) /* M48T58: not emulated */
+#define DATE_BL ( 0x40 ) /* M48T58: not emulated */
-#define FLAGS_BL (0x10) /* MK48T08/M48T37: not emulated */
-#define FLAGS_AF (0x40) /* M48T37: not emulated */
-#define FLAGS_WDF (0x80) /* M48T37 */
+#define FLAGS_BL ( 0x10 ) /* MK48T08/M48T37: not emulated */
+#define FLAGS_AF ( 0x40 ) /* M48T37: not emulated */
+#define FLAGS_WDF ( 0x80 ) /* M48T37 */
/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
-inline void counter_to_ram(u8 *data, s32 offset, u8 counter)
+static void counter_to_ram( uint8_t *data, int offset, int counter )
{
- if (offset >= 0)
- data[offset] = counter;
+ if( offset >= 0 )
+ {
+ data[ offset ] = counter;
+ }
}
-inline int counter_from_ram(u8 const *data, s32 offset, u8 unmap = 0)
+static int counter_from_ram( uint8_t *data, int offset )
{
- return (offset >= 0) ? data[offset] : unmap;
+ if( offset >= 0 )
+ {
+ return data[ offset ];
+ }
+ return 0;
}
//**************************************************************************
@@ -88,7 +94,7 @@ inline int counter_from_ram(u8 const *data, s32 offset, u8 unmap = 0)
// timekeeper_device_config - constructor
//-------------------------------------------------
-timekeeper_device::timekeeper_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 size)
+timekeeper_device::timekeeper_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int size)
: device_t(mconfig, type, tag, owner, clock)
, device_nvram_interface(mconfig, *this)
, m_reset_cb(*this)
@@ -98,7 +104,7 @@ timekeeper_device::timekeeper_device(const machine_config &mconfig, device_type
{
}
-m48t02_device::m48t02_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+m48t02_device::m48t02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: timekeeper_device(mconfig, M48T02, tag, owner, clock, 0x800)
{
m_offset_watchdog = -1;
@@ -114,7 +120,7 @@ m48t02_device::m48t02_device(const machine_config &mconfig, const char *tag, dev
m_offset_flags = -1;
}
-m48t35_device::m48t35_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+m48t35_device::m48t35_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: timekeeper_device(mconfig, M48T35, tag, owner, clock, 0x8000)
{
m_offset_watchdog = -1;
@@ -130,7 +136,7 @@ m48t35_device::m48t35_device(const machine_config &mconfig, const char *tag, dev
m_offset_flags = -1;
}
-m48t37_device::m48t37_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+m48t37_device::m48t37_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: timekeeper_device(mconfig, M48T37, tag, owner, clock, 0x8000)
{
m_offset_watchdog = 0x7ff7;
@@ -146,7 +152,7 @@ m48t37_device::m48t37_device(const machine_config &mconfig, const char *tag, dev
m_offset_flags = 0x7ff0;
}
-m48t58_device::m48t58_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+m48t58_device::m48t58_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: timekeeper_device(mconfig, M48T58, tag, owner, clock, 0x2000)
{
m_offset_watchdog = -1;
@@ -162,7 +168,7 @@ m48t58_device::m48t58_device(const machine_config &mconfig, const char *tag, dev
m_offset_flags = -1;
}
-mk48t08_device::mk48t08_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+mk48t08_device::mk48t08_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: timekeeper_device(mconfig, MK48T08, tag, owner, clock, 0x2000)
{
m_offset_watchdog = -1;
@@ -178,7 +184,7 @@ mk48t08_device::mk48t08_device(const machine_config &mconfig, const char *tag, d
m_offset_flags = 0x1ff0;
}
-mk48t12_device::mk48t12_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+mk48t12_device::mk48t12_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: timekeeper_device(mconfig, MK48T12, tag, owner, clock, 0x800)
{
m_offset_watchdog = -1;
@@ -208,27 +214,27 @@ void timekeeper_device::device_start()
machine().base_datetime(systime);
m_control = 0;
- m_seconds = time_helper::make_bcd(systime.local_time.second);
- m_minutes = time_helper::make_bcd(systime.local_time.minute);
- m_hours = time_helper::make_bcd(systime.local_time.hour);
- m_day = time_helper::make_bcd(systime.local_time.weekday + 1);
- m_date = time_helper::make_bcd(systime.local_time.mday);
- m_month = time_helper::make_bcd(systime.local_time.month + 1);
- m_year = time_helper::make_bcd(systime.local_time.year % 100);
- m_century = time_helper::make_bcd(systime.local_time.year / 100);
- m_data.resize(m_size);
-
- save_item(NAME(m_control));
- save_item(NAME(m_seconds));
- save_item(NAME(m_minutes));
- save_item(NAME(m_hours));
- save_item(NAME(m_day));
- save_item(NAME(m_date));
- save_item(NAME(m_month));
- save_item(NAME(m_year));
- save_item(NAME(m_century));
- save_item(NAME(m_data));
- save_item(NAME(m_watchdog_delay));
+ m_seconds = time_helper::make_bcd( systime.local_time.second );
+ m_minutes = time_helper::make_bcd( systime.local_time.minute );
+ m_hours = time_helper::make_bcd( systime.local_time.hour );
+ m_day = time_helper::make_bcd( systime.local_time.weekday + 1 );
+ m_date = time_helper::make_bcd( systime.local_time.mday );
+ m_month = time_helper::make_bcd( systime.local_time.month + 1 );
+ m_year = time_helper::make_bcd( systime.local_time.year % 100 );
+ m_century = time_helper::make_bcd( systime.local_time.year / 100 );
+ m_data.resize( m_size );
+
+ save_item( NAME(m_control) );
+ save_item( NAME(m_seconds) );
+ save_item( NAME(m_minutes) );
+ save_item( NAME(m_hours) );
+ save_item( NAME(m_day) );
+ save_item( NAME(m_date) );
+ save_item( NAME(m_month) );
+ save_item( NAME(m_year) );
+ save_item( NAME(m_century) );
+ save_item( NAME(m_data) );
+ save_item( NAME(m_watchdog_delay));
emu_timer *timer = timer_alloc();
timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
@@ -248,98 +254,98 @@ void timekeeper_device::device_reset() { }
void timekeeper_device::counters_to_ram()
{
- counter_to_ram(&m_data[0], m_offset_control, m_control);
- counter_to_ram(&m_data[0], m_offset_seconds, m_seconds);
- counter_to_ram(&m_data[0], m_offset_minutes, m_minutes);
- counter_to_ram(&m_data[0], m_offset_hours, m_hours);
- counter_to_ram(&m_data[0], m_offset_day, m_day);
- counter_to_ram(&m_data[0], m_offset_date, m_date);
- counter_to_ram(&m_data[0], m_offset_month, m_month);
- counter_to_ram(&m_data[0], m_offset_year, m_year);
- counter_to_ram(&m_data[0], m_offset_century, m_century);
+ counter_to_ram( &m_data[0], m_offset_control, m_control );
+ counter_to_ram( &m_data[0], m_offset_seconds, m_seconds );
+ counter_to_ram( &m_data[0], m_offset_minutes, m_minutes );
+ counter_to_ram( &m_data[0], m_offset_hours, m_hours );
+ counter_to_ram( &m_data[0], m_offset_day, m_day );
+ counter_to_ram( &m_data[0], m_offset_date, m_date );
+ counter_to_ram( &m_data[0], m_offset_month, m_month );
+ counter_to_ram( &m_data[0], m_offset_year, m_year );
+ counter_to_ram( &m_data[0], m_offset_century, m_century );
}
void timekeeper_device::counters_from_ram()
{
- m_control = counter_from_ram(&m_data[0], m_offset_control);
- m_seconds = counter_from_ram(&m_data[0], m_offset_seconds);
- m_minutes = counter_from_ram(&m_data[0], m_offset_minutes);
- m_hours = counter_from_ram(&m_data[0], m_offset_hours);
- m_day = counter_from_ram(&m_data[0], m_offset_day);
- m_date = counter_from_ram(&m_data[0], m_offset_date);
- m_month = counter_from_ram(&m_data[0], m_offset_month);
- m_year = counter_from_ram(&m_data[0], m_offset_year);
- m_century = counter_from_ram(&m_data[0], m_offset_century);
+ m_control = counter_from_ram( &m_data[0], m_offset_control );
+ m_seconds = counter_from_ram( &m_data[0], m_offset_seconds );
+ m_minutes = counter_from_ram( &m_data[0], m_offset_minutes );
+ m_hours = counter_from_ram( &m_data[0], m_offset_hours );
+ m_day = counter_from_ram( &m_data[0], m_offset_day );
+ m_date = counter_from_ram( &m_data[0], m_offset_date );
+ m_month = counter_from_ram( &m_data[0], m_offset_month );
+ m_year = counter_from_ram( &m_data[0], m_offset_year );
+ m_century = counter_from_ram( &m_data[0], m_offset_century );
}
void timekeeper_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
LOGMASKED(LOG_TICKS, "Tick\n");
- if ((m_seconds & SECONDS_ST) != 0 ||
- (m_control & CONTROL_W) != 0)
+ if( ( m_seconds & SECONDS_ST ) != 0 ||
+ ( m_control & CONTROL_W ) != 0 )
{
logerror("No Tick\n");
return;
}
- int carry = time_helper::inc_bcd(&m_seconds, MASK_SECONDS, 0x00, 0x59);
- if (carry)
+ int carry = time_helper::inc_bcd( &m_seconds, MASK_SECONDS, 0x00, 0x59 );
+ if( carry )
{
- carry = time_helper::inc_bcd(&m_minutes, MASK_MINUTES, 0x00, 0x59);
+ carry = time_helper::inc_bcd( &m_minutes, MASK_MINUTES, 0x00, 0x59 );
}
- if (carry)
+ if( carry )
{
- carry = time_helper::inc_bcd(&m_hours, MASK_HOURS, 0x00, 0x23);
+ carry = time_helper::inc_bcd( &m_hours, MASK_HOURS, 0x00, 0x23 );
}
- if (carry)
+ if( carry )
{
- u8 maxdays;
- static const u8 daysinmonth[] = { 0x31, 0x28, 0x31, 0x30, 0x31, 0x30, 0x31, 0x31, 0x30, 0x31, 0x30, 0x31 };
+ uint8_t maxdays;
+ static const uint8_t daysinmonth[] = { 0x31, 0x28, 0x31, 0x30, 0x31, 0x30, 0x31, 0x31, 0x30, 0x31, 0x30, 0x31 };
- time_helper::inc_bcd(&m_day, MASK_DAY, 0x01, 0x07);
+ time_helper::inc_bcd( &m_day, MASK_DAY, 0x01, 0x07 );
- u8 month = time_helper::from_bcd(m_month);
- u8 year = time_helper::from_bcd(m_year);
+ uint8_t month = time_helper::from_bcd( m_month );
+ uint8_t year = time_helper::from_bcd( m_year );
- if (month == 2 && (year % 4) == 0)
+ if( month == 2 && ( year % 4 ) == 0 )
{
maxdays = 0x29;
}
- else if (month >= 1 && month <= 12)
+ else if( month >= 1 && month <= 12 )
{
- maxdays = daysinmonth[month - 1];
+ maxdays = daysinmonth[ month - 1 ];
}
else
{
maxdays = 0x31;
}
- carry = time_helper::inc_bcd(&m_date, MASK_DATE, 0x01, maxdays);
+ carry = time_helper::inc_bcd( &m_date, MASK_DATE, 0x01, maxdays );
}
- if (carry)
+ if( carry )
{
- carry = time_helper::inc_bcd(&m_month, MASK_MONTH, 0x01, 0x12);
+ carry = time_helper::inc_bcd( &m_month, MASK_MONTH, 0x01, 0x12 );
}
- if (carry)
+ if( carry )
{
- carry = time_helper::inc_bcd(&m_year, MASK_YEAR, 0x00, 0x99);
+ carry = time_helper::inc_bcd( &m_year, MASK_YEAR, 0x00, 0x99 );
}
- if (carry)
+ if( carry )
{
- carry = time_helper::inc_bcd(&m_century, MASK_CENTURY, 0x00, 0x99);
+ carry = time_helper::inc_bcd( &m_century, MASK_CENTURY, 0x00, 0x99 );
- if (type() == M48T35 ||
- type() == M48T58)
+ if( type() == M48T35 ||
+ type() == M48T58 )
{
- if ((m_day & DAY_CEB) != 0)
+ if( ( m_day & DAY_CEB ) != 0 )
{
m_day ^= DAY_CB;
}
}
}
- if ((m_control & CONTROL_R) == 0)
+ if( ( m_control & CONTROL_R ) == 0 )
{
counters_to_ram();
}
@@ -350,59 +356,57 @@ TIMER_CALLBACK_MEMBER(timekeeper_device::watchdog_callback)
// Set Flag
m_data[m_offset_flags] |= FLAGS_WDF;
// WDS (bit 7) selects callback
- if (m_data[m_offset_watchdog] & 0x80)
- {
+ if (m_data[m_offset_watchdog] & 0x80) {
// Clear watchdog register
m_data[m_offset_watchdog] = 0;
m_reset_cb(ASSERT_LINE);
}
- else
+ else {
m_irq_cb(ASSERT_LINE);
-
+ }
logerror("watchdog_callback: WD Control: %02x WD Flags: %02x\n", m_data[m_offset_watchdog], m_data[m_offset_flags]);
}
-void timekeeper_device::watchdog_write(u8 data)
+WRITE8_MEMBER(timekeeper_device::watchdog_write)
{
- if ((m_data[m_offset_watchdog] & 0x7f) != 0)
+ if ((m_data[m_offset_watchdog] & 0x7f) != 0) {
m_watchdog_timer->adjust(m_watchdog_delay);
+ }
}
-void timekeeper_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( timekeeper_device::write )
{
LOGMASKED(LOG_GENERAL, "timekeeper_device::write: %04x = %02x\n", offset, data);
- if (offset == m_offset_control)
+ if( offset == m_offset_control )
{
- if ((m_control & CONTROL_W) != 0 &&
- (data & CONTROL_W) == 0)
+ if( ( m_control & CONTROL_W ) != 0 &&
+ ( data & CONTROL_W ) == 0 )
{
counters_from_ram();
}
- if ((m_control & CONTROL_R) != 0 &&
- (data & CONTROL_W) == 0)
+ if( ( m_control & CONTROL_R ) != 0 &&
+ ( data & CONTROL_W ) == 0 )
{
counters_to_ram();
}
m_control = data;
}
- else if (offset == m_offset_day)
+ else if( offset == m_offset_day )
{
- if (type() == M48T35 ||
- type() == M48T58)
+ if( type() == M48T35 ||
+ type() == M48T58 )
{
- m_day = (m_day & ~DAY_CEB) | (data & DAY_CEB);
+ m_day = ( m_day & ~DAY_CEB ) | ( data & DAY_CEB );
}
}
else if (offset == m_offset_watchdog && type() == M48T37)
{
- if ((data & 0x7f) == 0)
- {
+ if ((data & 0x7f) == 0) {
m_watchdog_timer->adjust(attotime::never);
}
- else
- {
+ else {
// Calculate the time unit
m_watchdog_delay = attotime::from_usec(62500 << (2 * (data & 0x3)));
// Adjust by multiplier
@@ -412,17 +416,17 @@ void timekeeper_device::write(offs_t offset, u8 data)
}
}
- m_data[offset] = data;
+ m_data[ offset ] = data;
}
-u8 timekeeper_device::read(offs_t offset)
+READ8_MEMBER( timekeeper_device::read )
{
- u8 result = m_data[offset];
- if (offset == m_offset_date && type() == M48T58)
+ uint8_t result = m_data[ offset ];
+ if( offset == m_offset_date && type() == M48T58 )
{
result &= ~DATE_BL;
}
- else if (offset == m_offset_flags && type() == M48T37)
+ else if( offset == m_offset_flags && type() == M48T37 )
{
// Clear the watchdog flag
m_data[m_offset_flags] &= ~FLAGS_WDF;
@@ -443,15 +447,15 @@ void timekeeper_device::nvram_default()
{
if (m_default_data.found())
{
- memcpy(&m_data[0], m_default_data, m_size);
+ memcpy( &m_data[0], m_default_data, m_size );
}
else
{
- memset(&m_data[0], 0xff, m_data.size());
+ memset( &m_data[0], 0xff, m_data.size());
}
- if (m_offset_flags >= 0)
- m_data[m_offset_flags] = 0;
+ if ( m_offset_flags >= 0 )
+ m_data[ m_offset_flags ] = 0;
counters_to_ram();
}
@@ -463,7 +467,7 @@ void timekeeper_device::nvram_default()
void timekeeper_device::nvram_read(emu_file &file)
{
- file.read(&m_data[0], m_size);
+ file.read( &m_data[0], m_size );
counters_to_ram();
}
@@ -476,5 +480,5 @@ void timekeeper_device::nvram_read(emu_file &file)
void timekeeper_device::nvram_write(emu_file &file)
{
- file.write(&m_data[0], m_size);
+ file.write( &m_data[0], m_size );
}
diff --git a/src/devices/machine/timekpr.h b/src/devices/machine/timekpr.h
index def60c02059..4742a1b1ae8 100644
--- a/src/devices/machine/timekpr.h
+++ b/src/devices/machine/timekpr.h
@@ -32,16 +32,16 @@
class timekeeper_device : public device_t, public device_nvram_interface
{
public:
- void write(offs_t offset, u8 data);
- u8 read(offs_t offset);
- void watchdog_write(u8 data = 0);
+ DECLARE_WRITE8_MEMBER( write );
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER(watchdog_write);
auto reset_cb() { return m_reset_cb.bind(); }
auto irq_cb() { return m_irq_cb.bind(); }
protected:
// construction/destruction
- timekeeper_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 size);
+ timekeeper_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int size);
// device-level overrides
virtual void device_start() override;
@@ -62,70 +62,70 @@ private:
void counters_from_ram();
// internal state
- u8 m_control;
- u8 m_seconds;
- u8 m_minutes;
- u8 m_hours;
- u8 m_day;
- u8 m_date;
- u8 m_month;
- u8 m_year;
- u8 m_century;
-
- std::vector<u8> m_data;
- optional_region_ptr<u8> m_default_data;
+ uint8_t m_control;
+ uint8_t m_seconds;
+ uint8_t m_minutes;
+ uint8_t m_hours;
+ uint8_t m_day;
+ uint8_t m_date;
+ uint8_t m_month;
+ uint8_t m_year;
+ uint8_t m_century;
+
+ std::vector<uint8_t> m_data;
+ optional_region_ptr<uint8_t> m_default_data;
emu_timer* m_watchdog_timer;
attotime m_watchdog_delay;
protected:
- u32 const m_size;
- s32 m_offset_watchdog;
- s32 m_offset_control;
- s32 m_offset_seconds;
- s32 m_offset_minutes;
- s32 m_offset_hours;
- s32 m_offset_day;
- s32 m_offset_date;
- s32 m_offset_month;
- s32 m_offset_year;
- s32 m_offset_century;
- s32 m_offset_flags;
+ int const m_size;
+ int m_offset_watchdog;
+ int m_offset_control;
+ int m_offset_seconds;
+ int m_offset_minutes;
+ int m_offset_hours;
+ int m_offset_day;
+ int m_offset_date;
+ int m_offset_month;
+ int m_offset_year;
+ int m_offset_century;
+ int m_offset_flags;
};
class m48t02_device : public timekeeper_device
{
public:
- m48t02_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
+ m48t02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
};
class m48t35_device : public timekeeper_device
{
public:
- m48t35_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
+ m48t35_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
};
class m48t37_device : public timekeeper_device
{
public:
- m48t37_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
+ m48t37_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
};
class m48t58_device : public timekeeper_device
{
public:
- m48t58_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
+ m48t58_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
};
class mk48t08_device : public timekeeper_device
{
public:
- mk48t08_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
+ mk48t08_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
};
class mk48t12_device : public timekeeper_device
{
public:
- mk48t12_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
+ mk48t12_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
};
// device type definition
diff --git a/src/devices/machine/timer.h b/src/devices/machine/timer.h
index 944db93c1e5..e27c8a8cc53 100644
--- a/src/devices/machine/timer.h
+++ b/src/devices/machine/timer.h
@@ -23,6 +23,44 @@
#define TIMER_DEVICE_CALLBACK_MEMBER(name) void name(timer_device &timer, void *ptr, s32 param)
//**************************************************************************
+// TIMER DEVICE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_TIMER_ADD_NONE(_tag) \
+ MCFG_DEVICE_ADD(_tag, TIMER, 0) \
+ downcast<timer_device &>(*device).configure_generic(timer_device::expired_delegate());
+#define MCFG_TIMER_DRIVER_ADD(_tag, _class, _callback) \
+ MCFG_DEVICE_ADD(_tag, TIMER, 0) \
+ downcast<timer_device &>(*device).configure_generic(timer_device::expired_delegate(&_class::_callback, #_class "::" #_callback, nullptr, (_class *)nullptr));
+#define MCFG_TIMER_DEVICE_ADD(_tag, _devtag, _class, _callback) \
+ MCFG_DEVICE_ADD(_tag, TIMER, 0) \
+ downcast<timer_device &>(*device).configure_generic(timer_device::expired_delegate(&_class::_callback, #_class "::" #_callback, _devtag, (_class *)nullptr));
+#define MCFG_TIMER_DRIVER_ADD_PERIODIC(_tag, _class, _callback, _period) \
+ MCFG_DEVICE_ADD(_tag, TIMER, 0) \
+ downcast<timer_device &>(*device).configure_periodic(timer_device::expired_delegate(&_class::_callback, #_class "::" #_callback, nullptr, (_class *)nullptr), _period);
+#define MCFG_TIMER_DEVICE_ADD_PERIODIC(_tag, _devtag, _class, _callback, _period) \
+ MCFG_DEVICE_ADD(_tag, TIMER, 0) \
+ downcast<timer_device &>(*device).configure_periodic(timer_device::expired_delegate(&_class::_callback, #_class "::" #_callback, _devtag, (_class *)nullptr), _period);
+#define MCFG_TIMER_DRIVER_ADD_SCANLINE(_tag, _class, _callback, _screen, _first_vpos, _increment) \
+ MCFG_DEVICE_ADD(_tag, TIMER, 0) \
+ downcast<timer_device &>(*device).configure_scanline(timer_device::expired_delegate(&_class::_callback, #_class "::" #_callback, nullptr, (_class *)nullptr), _screen, _first_vpos, _increment);
+#define MCFG_TIMER_DEVICE_ADD_SCANLINE(_tag, _devtag, _class, _callback, _screen, _first_vpos, _increment) \
+ MCFG_DEVICE_ADD(_tag, TIMER, 0) \
+ downcast<timer_device &>(*device).configure_scanline(timer_device::expired_delegate(&_class::_callback, #_class "::" #_callback, _devtag, (_class *)nullptr), _screen, _first_vpos, _increment);
+#define MCFG_TIMER_MODIFY(_tag) \
+ MCFG_DEVICE_MODIFY(_tag)
+
+#define MCFG_TIMER_DRIVER_CALLBACK(_class, _callback) \
+ downcast<timer_device &>(*device).set_callback(timer_device::expired_delegate(&_class::_callback, #_class "::" #_callback, nullptr, (_class *)nullptr));
+#define MCFG_TIMER_START_DELAY(_start_delay) \
+ downcast<timer_device &>(*device).set_start_delay(_start_delay);
+#define MCFG_TIMER_PARAM(_param) \
+ downcast<timer_device &>(*device).config_param(_param);
+#define MCFG_TIMER_PTR(_ptr) \
+ downcast<timer_device &>(*device).set_ptr((void *)(_ptr));
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -48,11 +86,6 @@ public:
configure_generic(expired_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr)));
}
- template <class FunctionClass> void configure_generic(const char *devname, void (FunctionClass::*callback)(timer_device &, void *, s32), const char *name)
- {
- configure_generic(expired_delegate(callback, name, devname, static_cast<FunctionClass *>(nullptr)));
- }
-
template <typename Object> void configure_periodic(Object &&cb, const attotime &period)
{
m_type = TIMER_TYPE_PERIODIC;
@@ -65,12 +98,6 @@ public:
configure_periodic(expired_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr)), period);
}
- template <class FunctionClass> void configure_periodic(const char *devname, void (FunctionClass::*callback)(timer_device &, void *, s32),
- const char *name, const attotime &period)
- {
- configure_periodic(expired_delegate(callback, name, devname, static_cast<FunctionClass *>(nullptr)), period);
- }
-
template <typename Object> void configure_scanline(Object &&cb, const char *screen, int first_vpos, int increment)
{
m_type = TIMER_TYPE_SCANLINE;
@@ -111,18 +138,13 @@ public:
// adjustments
void reset() { adjust(attotime::never, 0, attotime::never); }
- void adjust(const attotime &duration, s32 param = 0, const attotime &period = attotime::never) const
- {
- assert(m_type == TIMER_TYPE_GENERIC);
- m_timer->adjust(duration, param, period);
- }
+ void adjust(const attotime &duration, s32 param = 0, const attotime &period = attotime::never) const { assert(m_type == TIMER_TYPE_GENERIC); m_timer->adjust(duration, param, period); }
// timing information
attotime time_elapsed() const { return m_timer->elapsed(); }
attotime time_left() const { return m_timer->remaining(); }
attotime start_time() const { return m_timer->start(); }
attotime fire_time() const { return m_timer->expire(); }
- attotime period() const { return m_timer ? m_timer->period() : m_period; }
private:
// device-level overrides
@@ -141,7 +163,7 @@ private:
// configuration data
timer_type m_type; // type of timer
- expired_delegate m_callback; // the timer's callback function
+ expired_delegate m_callback; // the timer's callback function
void * m_ptr; // the pointer parameter passed to the timer callback
// periodic timers only
diff --git a/src/devices/machine/tmp68301.cpp b/src/devices/machine/tmp68301.cpp
index 1eea072c64a..2add964e4e5 100644
--- a/src/devices/machine/tmp68301.cpp
+++ b/src/devices/machine/tmp68301.cpp
@@ -23,8 +23,7 @@ DEFINE_DEVICE_TYPE(TMP68301, tmp68301_device, "tmp68301", "Toshiba TMP68301")
void tmp68301_device::tmp68301_regs(address_map &map)
{
- map(0x000, 0x3ff).rw(FUNC(tmp68301_device::regs_r), FUNC(tmp68301_device::regs_w));
-
+// AM_RANGE(0x000,0x3ff) AM_RAM
map(0x080, 0x093).rw(FUNC(tmp68301_device::icr_r), FUNC(tmp68301_device::icr_w)).umask16(0x00ff);
map(0x094, 0x095).rw(FUNC(tmp68301_device::imr_r), FUNC(tmp68301_device::imr_w));
@@ -135,7 +134,9 @@ WRITE8_MEMBER(tmp68301_device::icr_w)
}
tmp68301_device::tmp68301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : m68000_device(mconfig, TMP68301, tag, owner, clock),
+ : device_t(mconfig, TMP68301, tag, owner, clock),
+ device_memory_interface(mconfig, *this),
+ m_cpu(*this, finder_base::DUMMY_TAG),
m_in_parallel_cb(*this),
m_out_parallel_cb(*this),
m_ipl(0),
@@ -144,7 +145,8 @@ tmp68301_device::tmp68301_device(const machine_config &mconfig, const char *tag,
m_iisr(0),
m_scr(0),
m_pdir(0),
- m_pdr(0)
+ m_pdr(0),
+ m_space_config("regs", ENDIANNESS_LITTLE, 16, 10, 0, address_map_constructor(), address_map_constructor(FUNC(tmp68301_device::tmp68301_regs), this))
{
memset(m_regs, 0, sizeof(m_regs));
memset(m_icr, 0, sizeof(m_icr));
@@ -157,17 +159,13 @@ tmp68301_device::tmp68301_device(const machine_config &mconfig, const char *tag,
void tmp68301_device::device_start()
{
- m68000_device::device_start();
-
- for (int i = 0; i < 3; i++)
+ int i;
+ for (i = 0; i < 3; i++)
m_tmp68301_timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tmp68301_device::timer_callback), this));
m_in_parallel_cb.resolve_safe(0);
m_out_parallel_cb.resolve_safe();
- m_program->install_device(0xfffc00, 0xffffff, *this, &tmp68301_device::tmp68301_regs);
- m_int_ack_callback = device_irq_acknowledge_delegate(FUNC(tmp68301_device::irq_callback), this);
-
save_item(NAME(m_regs));
save_item(NAME(m_icr));
save_item(NAME(m_ipl));
@@ -185,8 +183,6 @@ void tmp68301_device::device_start()
void tmp68301_device::device_reset()
{
- m68000_device::device_reset();
-
m_ipr = 0;
m_iisr = 0;
m_imr = 0x7f7; // mask all irqs
@@ -194,10 +190,40 @@ void tmp68301_device::device_reset()
update_ipl();
}
+//-------------------------------------------------
+// memory_space_config - return a description of
+// any address spaces owned by this device
+//-------------------------------------------------
+
+device_memory_interface::space_config_vector tmp68301_device::memory_space_config() const
+{
+ return space_config_vector {
+ std::make_pair(0, &m_space_config)
+ };
+}
+
//**************************************************************************
// INLINE HELPERS
//**************************************************************************
+//-------------------------------------------------
+// read_byte - read a byte at the given address
+//-------------------------------------------------
+
+inline uint16_t tmp68301_device::read_word(offs_t address)
+{
+ return space(0).read_word(address << 1);
+}
+
+//-------------------------------------------------
+// write_byte - write a byte at the given address
+//-------------------------------------------------
+
+inline void tmp68301_device::write_word(offs_t address, uint16_t data)
+{
+ space(0).write_word(address << 1, data);
+}
+
IRQ_CALLBACK_MEMBER(tmp68301_device::irq_callback)
{
uint8_t IVNR = m_regs[0x9a/2] & 0xe0; // Interrupt Vector Number Register (IVNR)
@@ -286,7 +312,7 @@ void tmp68301_device::update_timer(int i)
{
int scale = (TCR & 0x3c00)>>10; // P4..1
if (scale > 8) scale = 8;
- duration = attotime::from_hz(unscaled_clock()) * ((1 << scale) * max);
+ duration = attotime::from_hz(m_cpu->unscaled_clock()) * ((1 << scale) * max);
}
break;
}
@@ -317,9 +343,9 @@ void tmp68301_device::update_ipl()
if (new_ipl != m_ipl)
{
if (m_ipl != 0)
- set_input_line(m_ipl, CLEAR_LINE);
+ m_cpu->set_input_line(m_ipl, CLEAR_LINE);
if (new_ipl != 0)
- set_input_line(new_ipl, ASSERT_LINE);
+ m_cpu->set_input_line(new_ipl, ASSERT_LINE);
m_ipl = new_ipl;
}
@@ -340,16 +366,18 @@ uint8_t tmp68301_device::serial_interrupt_cause(int channel)
READ16_MEMBER( tmp68301_device::regs_r )
{
- return m_regs[offset];
+ return read_word(offset);
}
WRITE16_MEMBER( tmp68301_device::regs_w )
{
COMBINE_DATA(&m_regs[offset]);
+ write_word(offset,m_regs[offset]);
+
if (!ACCESSING_BITS_0_7) return;
-// logerror("CPU #0 PC %06X: TMP68301 Reg %04X<-%04X & %04X\n", >pc(),offset*2,data,mem_mask^0xffff);
+// logerror("CPU #0 PC %06X: TMP68301 Reg %04X<-%04X & %04X\n", m_cpu->pc(),offset*2,data,mem_mask^0xffff);
switch( offset * 2 )
{
diff --git a/src/devices/machine/tmp68301.h b/src/devices/machine/tmp68301.h
index c350b9b0be6..e019387802b 100644
--- a/src/devices/machine/tmp68301.h
+++ b/src/devices/machine/tmp68301.h
@@ -16,19 +16,27 @@
-class tmp68301_device : public m68000_device
+class tmp68301_device : public device_t,
+ public device_memory_interface
{
public:
tmp68301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <typename T> void set_cputag(T &&tag) { m_cpu.set_tag(std::forward<T>(tag)); } // FIXME: M68000 ought to be a parent class, not an external object
auto in_parallel_callback() { return m_in_parallel_cb.bind(); }
auto out_parallel_callback() { return m_out_parallel_cb.bind(); }
+ // Hardware Registers
+ DECLARE_READ16_MEMBER( regs_r );
+ DECLARE_WRITE16_MEMBER( regs_w );
+
// Interrupts
void external_interrupt_0();
void external_interrupt_1();
void external_interrupt_2();
+ IRQ_CALLBACK_MEMBER(irq_callback);
+
private:
DECLARE_READ16_MEMBER(imr_r);
DECLARE_WRITE16_MEMBER(imr_w);
@@ -45,18 +53,13 @@ private:
DECLARE_READ8_MEMBER(icr_r);
DECLARE_WRITE8_MEMBER(icr_w);
- // Hardware Registers
- DECLARE_READ16_MEMBER( regs_r );
- DECLARE_WRITE16_MEMBER( regs_w );
-
void tmp68301_regs(address_map &map);
- IRQ_CALLBACK_MEMBER(irq_callback);
-
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
+ virtual space_config_vector memory_space_config() const override;
private:
TIMER_CALLBACK_MEMBER(timer_callback);
@@ -75,6 +78,11 @@ private:
static constexpr uint16_t TIMER1_IRQ = 1 << 9;
static constexpr uint16_t TIMER2_IRQ = 1 << 10;
+ inline uint16_t read_word(offs_t address);
+ inline void write_word(offs_t address, uint16_t data);
+
+ required_device<m68000_base_device> m_cpu;
+
devcb_read16 m_in_parallel_cb;
devcb_write16 m_out_parallel_cb;
@@ -92,6 +100,8 @@ private:
uint16_t m_pdir;
uint16_t m_pdr;
uint8_t m_icr[10];
+
+ const address_space_config m_space_config;
};
DECLARE_DEVICE_TYPE(TMP68301, tmp68301_device)
diff --git a/src/devices/machine/tms5501.cpp b/src/devices/machine/tms5501.cpp
index d067497567a..f7581a30a72 100644
--- a/src/devices/machine/tms5501.cpp
+++ b/src/devices/machine/tms5501.cpp
@@ -263,9 +263,6 @@ READ8_MEMBER( tms5501_device::rst_r )
READ8_MEMBER( tms5501_device::sta_r )
{
- if(is_transmit_register_empty())
- m_sta |= STA_XBE;
-
uint8_t data = m_sta;
m_sta &= ~STA_OE;
diff --git a/src/devices/machine/tms9901.cpp b/src/devices/machine/tms9901.cpp
index 4e7341feb61..5282dd6f9f5 100644
--- a/src/devices/machine/tms9901.cpp
+++ b/src/devices/machine/tms9901.cpp
@@ -53,16 +53,6 @@ Pins:
(This is mostly obvious, but it implies that you cannot trigger an
interrupt by setting the output state of a pin, which is not SO obvious.)
-Clock mode:
- The "clock mode" is entered by setting bit 0 to 1. This means that the
- clock register becomes accessible to changes and inspection. The clock
- itself runs in the interrupt mode. Accordingly, the typical setup
- involves first setting bit 0 to 1, then loading some or all of the
- clock register bits, and then switching to interrupt mode again. From then
- on, INT3 is asserted whenever the clock reaches 0, and is cleared by
- writing 0 or 1 to bit 3. The clock can only be stopped by setting the
- register to 0 or by a reset.
-
Interrupt handling:
After each clock cycle, TMS9901 latches the state of INT1*-INT15* (except
pins which are set as output pins). If the clock is enabled, it replaces
@@ -115,9 +105,6 @@ MZ: According to the description in
MZ: Turned to class (January 2012)
-MZ: Added a synchronous clock input (Phi line) as an alternative to the
- emu_timer.
-
TODO: Tests on a real machine
- Set an interrupt input (e.g. keyboard for Geneve), trigger RST2*, check whether
interrupt mask has been reset
@@ -137,23 +124,24 @@ TODO: Tests on a real machine
#include <math.h>
-#define LOG_GENERAL (1U << 0)
-#define LOG_PINS (1U << 1)
-#define LOG_CONFIG (1U << 2)
-#define LOG_MODE (1U << 3)
-#define LOG_INT (1U << 4)
-#define LOG_DECVALUE (1U << 5)
+#define LOG_GENERAL (1U << 0)
+#define LOG_PINS (1U << 1)
+#define LOG_CLOCK (1U << 2)
+#define LOG_MODE (1U << 3)
-#define VERBOSE ( 0 )
+//#define VERBOSE (LOG_PINS | LOG_CLOCK | LOG_MODE)
#include "logmacro.h"
+#define LOGPINS(...) LOGMASKED(LOG_PINS, __VA_ARGS__)
+#define LOGCLOCK(...) LOGMASKED(LOG_CLOCK, __VA_ARGS__)
+#define LOGMODE(...) LOGMASKED(LOG_MODE, __VA_ARGS__)
+
+
/*
Constructor
*/
tms9901_device::tms9901_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, TMS9901, tag, owner, clock),
- m_clock_active(false),
- m_clockdiv(0),
m_read_block(*this),
m_write_p{{*this},{*this},{*this},{*this},{*this},{*this},{*this},{*this},{*this},{*this},{*this},{*this},{*this},{*this},{*this},{*this}},
m_interrupt(*this)
@@ -174,12 +162,12 @@ void tms9901_device::field_interrupts()
// if timer is enabled, INT3 pin is overridden by timer
if (m_timer_int_pending)
{
- LOGMASKED(LOG_INT, "INT3 (timer) asserted\n");
+ LOGCLOCK("timer fires\n");
current_ints |= INT3;
}
else
{
- LOGMASKED(LOG_INT, "INT3 (timer) cleared\n");
+ LOGCLOCK("timer clear\n");
current_ints &= ~INT3;
}
}
@@ -209,7 +197,6 @@ void tms9901_device::field_interrupts()
current_ints >>= 1; /* try next bit */
level++;
}
- LOGMASKED(LOG_INT, "Triggering interrupt, level %d\n", level);
m_int_pending = true;
if (!m_interrupt.isnull())
m_interrupt(level, 1, 0xff); // the offset carries the IC0-3 level
@@ -250,11 +237,11 @@ void tms9901_device::timer_reload()
if (m_clock_register != 0)
{ /* reset clock interval */
m_decrementer_value = m_clock_register;
- m_clock_active = true;
+ m_decrementer->enable(true);
}
else
{ /* clock interval == 0 -> no timer */
- m_clock_active = false;
+ m_decrementer->enable(false);
}
}
@@ -275,13 +262,13 @@ void tms9901_device::timer_reload()
bit 16-31: current status of the P0-P15 pins (quits timer mode, too...)
*/
-uint8_t tms9901_device::read(offs_t offset)
+READ8_MEMBER( tms9901_device::read )
{
int answer = 0;
- offset &= 0x01f;
+ offset &= 0x003;
- switch (offset >> 3)
+ switch (offset)
{
case 0:
if (m_clock_mode)
@@ -304,7 +291,7 @@ uint8_t tms9901_device::read(offs_t offset)
// Set those bits here
answer |= (m_pio_output_mirror & m_pio_direction_mirror) & 0xFF;
}
- LOGMASKED(LOG_PINS, "Input on lines INT7..CB = %02x\n", answer);
+ LOGPINS("input on lines INT7..CB = %02x\n", answer);
break;
case 1:
if (m_clock_mode)
@@ -324,7 +311,7 @@ uint8_t tms9901_device::read(offs_t offset)
answer &= ~(m_pio_direction_mirror >> 8);
answer |= (m_pio_output_mirror & m_pio_direction_mirror) >> 8;
}
- LOGMASKED(LOG_PINS, "Input on lines INT15..INT8 = %02x\n", answer);
+ LOGPINS("input on lines INT15..INT8 = %02x\n", answer);
break;
case 2:
/* exit timer mode */
@@ -338,7 +325,7 @@ uint8_t tms9901_device::read(offs_t offset)
answer &= ~m_pio_direction;
answer |= (m_pio_output & m_pio_direction) & 0xFF;
- LOGMASKED(LOG_PINS, "Input on lines P7..P0 = %02x\n", answer);
+ LOGPINS("input on lines P7..P0 = %02x\n", answer);
break;
case 3:
@@ -351,12 +338,12 @@ uint8_t tms9901_device::read(offs_t offset)
answer &= ~(m_pio_direction >> 8);
answer |= (m_pio_output & m_pio_direction) >> 8;
- LOGMASKED(LOG_PINS, "Input on lines P15..P8 = %02x\n", answer);
+ LOGPINS("input on lines P15..P8 = %02x\n", answer);
break;
}
- return BIT(answer, offset & 7);
+ return answer;
}
/*
@@ -372,7 +359,7 @@ uint8_t tms9901_device::read(offs_t offset)
bit 16-31: set output state of P0-P15 (and set them as output pin) (quit timer mode, too...)
*/
-void tms9901_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER ( tms9901_device::write )
{
data &= 1; /* clear extra bits */
offset &= 0x01F;
@@ -380,7 +367,7 @@ void tms9901_device::write(offs_t offset, uint8_t data)
if (offset >= 0x10)
{
int pin = offset & 0x0F;
- LOGMASKED(LOG_PINS, "Output on P%d = %d\n", pin, data);
+ LOGPINS("output on P%d = %d\n", pin, data);
int bit = (1 << pin);
@@ -421,20 +408,18 @@ void tms9901_device::write(offs_t offset, uint8_t data)
{
// Switch to interrupt mode; quit clock mode
m_clock_mode = false;
- LOGMASKED(LOG_MODE, "Enter interrupt mode\n");
+ LOGMODE("int mode\n");
}
else
{
m_clock_mode = true;
- LOGMASKED(LOG_MODE, "Enter clock mode\n");
+ LOGMODE("clock mode\n");
// we are switching to clock mode: latch the current value of
// the decrementer register
if (m_clock_register != 0)
m_clock_read_register = m_decrementer_value;
else
m_clock_read_register = 0; /* timer inactive... */
-
- LOGMASKED(LOG_CONFIG, "Clock setting = %d\n", m_clock_read_register);
}
}
else if (offset == 0x0f)
@@ -452,7 +437,7 @@ void tms9901_device::write(offs_t offset, uint8_t data)
// Spec is not clear on whether the mask bits are also reset by RST2*
// TODO: Check on a real machine. (I'd guess from the text they are not touched)
m_enabled_ints = 0;
- LOGMASKED(LOG_MODE, "Soft reset (RST2*)\n");
+ LOGMODE("Soft reset (RST2*)\n");
}
}
else
@@ -462,7 +447,7 @@ void tms9901_device::write(offs_t offset, uint8_t data)
else
m_enabled_ints &= ~0x4000; /* unset bit */
- LOGMASKED(LOG_CONFIG, "Enabled interrupts = %04x\n", m_enabled_ints);
+ LOGMODE("interrupts = %04x\n", m_enabled_ints);
field_interrupts(); /* changed interrupt state */
}
}
@@ -484,7 +469,7 @@ void tms9901_device::write(offs_t offset, uint8_t data)
m_clock_register &= ~bit; /* clear bit */
/* reset clock timer (page 8) */
- LOGMASKED(LOG_CONFIG, "Clock register = %04x\n", m_clock_register);
+ LOGCLOCK("clock register = %04x\n", m_clock_register);
timer_reload();
}
else
@@ -499,7 +484,7 @@ void tms9901_device::write(offs_t offset, uint8_t data)
if (offset == 3)
m_timer_int_pending = false; /* SBO 3 clears pending timer interrupt (??) */
- LOGMASKED(LOG_CONFIG, "Enabled interrupts = %04x\n", m_enabled_ints);
+ LOGMODE("enabled interrupts = %04x\n");
field_interrupts(); /* changed interrupt state */
}
}
@@ -515,20 +500,10 @@ void tms9901_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (id==DECREMENTER) // we have only that one
{
- clock_in(ASSERT_LINE);
- clock_in(CLEAR_LINE);
- }
-}
-
-void tms9901_device::clock_in(line_state clk)
-{
- if (m_clock_active && clk == ASSERT_LINE)
- {
m_decrementer_value--;
- LOGMASKED(LOG_DECVALUE, "Decrementer = %d\n", m_decrementer_value);
+ LOGCLOCK("decrementer = %d\n", m_decrementer_value);
if (m_decrementer_value<=0)
{
- LOGMASKED(LOG_INT, "Timer expired\n");
m_timer_int_pending = true; // decrementer interrupt requested
field_interrupts();
m_decrementer_value = m_clock_register;
@@ -536,21 +511,6 @@ void tms9901_device::clock_in(line_state clk)
}
}
-/*
- Synchronous clock input. This may be used for systems which have
- a CLK line controlled by the CPU, like the TMS99xx systems.
- In that case, clock is set to 0.
-*/
-WRITE_LINE_MEMBER( tms9901_device::phi_line )
-{
- // Divider by 64
- if (state==ASSERT_LINE)
- m_clockdiv = (m_clockdiv+1) % 0x40;
-
- if (m_clockdiv==0)
- clock_in((line_state)state);
-}
-
/*-------------------------------------------------
device_stop - device-specific stop
-------------------------------------------------*/
@@ -605,12 +565,9 @@ void tms9901_device::do_reset()
void tms9901_device::device_start()
{
- // Allow for using asynchronous and synchronous clocks
- if (clock() != 0)
- {
- m_decrementer = timer_alloc(DECREMENTER);
- m_decrementer->adjust(attotime::from_hz(clock() / 64.), 0, attotime::from_hz(clock() / 64.));
- }
+ m_decrementer = timer_alloc(DECREMENTER);
+ m_decrementer->adjust(attotime::from_hz(clock() / 64.), 0, attotime::from_hz(clock() / 64.));
+ m_decrementer->enable(false);
m_read_block.resolve();
for (auto &cb : m_write_p)
diff --git a/src/devices/machine/tms9901.h b/src/devices/machine/tms9901.h
index eda01f253ad..86a2c6852e3 100644
--- a/src/devices/machine/tms9901.h
+++ b/src/devices/machine/tms9901.h
@@ -60,11 +60,8 @@ public:
DECLARE_WRITE_LINE_MEMBER( rst1_line );
- // Synchronous clock input
- DECLARE_WRITE_LINE_MEMBER( phi_line );
-
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
auto p_out_cb(int n) { return m_write_p[n].bind(); }
auto read_cb() { return m_read_block.bind(); }
@@ -86,9 +83,6 @@ private:
// Common method for device_reset and rst1_line
void do_reset();
- // Common clock handling
- void clock_in(line_state clk);
-
// State of the INT1-INT15 lines (must be inverted when queried)
// Note that the levels must also be delivered when reading the pins, which
// may require to latch the int levels.
@@ -99,9 +93,6 @@ private:
bool m_int_pending; // status of the int* pin (connected to TMS9900)
bool m_timer_int_pending; // timer int pending (overrides int3 pin if timer enabled)
- bool m_clock_active;
- int m_clockdiv; // Clock divider counter (for synchronous clock)
-
// PIO registers
int m_pio_direction; // direction register for PIO
@@ -119,7 +110,7 @@ private:
// true = clock mode (read/write clock interval)
bool m_clock_mode;
- // Timer, used to emulate the decrementer register
+ // MESS timer, used to emulate the decrementer register
emu_timer *m_decrementer;
// clock interval, loaded in decrementer when it reaches 0.
diff --git a/src/devices/machine/tms9902.cpp b/src/devices/machine/tms9902.cpp
index 813372f6f22..93e48cf03a2 100644
--- a/src/devices/machine/tms9902.cpp
+++ b/src/devices/machine/tms9902.cpp
@@ -478,109 +478,48 @@ void tms9902_device::initiate_transmit()
bit 13-15: not emulated, normally used for diagnostics
bit 16: RBINT (RBRL&RIENB)
*/
-uint8_t tms9902_device::cruread(offs_t offset)
+READ8_MEMBER( tms9902_device::cruread )
{
uint8_t answer = 0;
- switch (offset & 31)
- {
- case 31:
- answer = m_INT;
- break;
-
- case 30:
- answer = (m_LDCTRL || m_LDIR || m_LRDR || m_LXDR || m_BRKON);
- break;
-
- case 29:
- answer = m_DSCH;
- break;
-
- case 28:
- answer = m_CTSin;
- break;
-
- case 27:
- answer = m_DSRin;
- break;
-
- case 26:
- answer = m_RTSout;
- break;
-
- case 25:
- answer = m_TIMELP;
- break;
-
- case 24:
- answer = m_TIMERR;
- break;
-
- case 23:
- answer = m_XSRE;
- break;
-
- case 22:
- answer = m_XBRE;
- break;
+ offset &= 0x0003;
- case 21:
- answer = m_RBRL;
- break;
-
- case 20:
- answer = (m_DSCH && m_DSCENB);
- break;
-
- case 19:
- answer = (m_TIMELP && m_TIMENB);
- break;
-
- case 17:
- answer = (m_XBRE && m_XBIENB);
- break;
-
- case 16:
- answer = (m_RBRL && m_RIENB);
- break;
-
- case 15:
- answer = m_RIN;
- break;
-
- case 14:
- answer = m_RSBD;
- break;
-
- case 13:
- answer = m_RFBD;
- break;
-
- case 12:
- answer = m_RFER;
- break;
-
- case 11:
- answer = m_ROVER;
+ switch (offset)
+ {
+ case 3: // Bits 31-24
+ if (m_INT) answer |= 0x80;
+ if (m_LDCTRL || m_LDIR || m_LRDR || m_LXDR || m_BRKON) answer |= 0x40;
+ if (m_DSCH) answer |= 0x20;
+ if (m_CTSin) answer |= 0x10;
+ if (m_DSRin) answer |= 0x08;
+ if (m_RTSout) answer |= 0x04;
+ if (m_TIMELP) answer |= 0x02;
+ if (m_TIMERR) answer |= 0x01;
break;
- case 10:
- answer = m_RPER;
+ case 2: // Bits 23-16
+ if (m_XSRE) answer |= 0x80;
+ if (m_XBRE) answer |= 0x40;
+ if (m_RBRL) answer |= 0x20;
+ if (m_DSCH && m_DSCENB) answer |= 0x10;
+ if (m_TIMELP && m_TIMENB) answer |= 0x08;
+ if (m_XBRE && m_XBIENB) answer |= 0x02;
+ if (m_RBRL && m_RIENB) answer |= 0x01;
break;
- case 9:
- answer = (m_RPER || m_RFER || m_ROVER);
+ case 1: // Bits 15-8
+ if (m_RIN) answer |= 0x80;
+ if (m_RSBD) answer |= 0x40;
+ if (m_RFBD) answer |= 0x20;
+ if (m_RFER) answer |= 0x10;
+ if (m_ROVER) answer |= 0x08;
+ if (m_RPER) answer |= 0x04;
+ if (m_RPER || m_RFER || m_ROVER) answer |= 0x02;
break;
- case 7:
- case 6:
- case 5:
- case 4:
- case 3:
- case 2:
- case 1:
- case 0:
- answer = BIT(m_RBR, offset & 31);
+ case 0: // Bits 7-0
+ LOGCRU("Reading received byte = %02x\n", m_RBR);
+ answer = m_RBR;
break;
}
if (VERBOSE & LOG_DETAIL) LOGCRU("Reading flag bits %d - %d = %02x\n", ((offset+1)*8-1), offset*8, answer);
@@ -658,7 +597,7 @@ void tms9902_device::reset_uart()
/*
TMS9902 CRU write
*/
-void tms9902_device::cruwrite(offs_t offset, uint8_t data)
+WRITE8_MEMBER( tms9902_device::cruwrite )
{
data &= 1; /* clear extra bits */
diff --git a/src/devices/machine/tms9902.h b/src/devices/machine/tms9902.h
index 3d203c59709..1f96e2ffc17 100644
--- a/src/devices/machine/tms9902.h
+++ b/src/devices/machine/tms9902.h
@@ -69,8 +69,8 @@ public:
int get_config_value();
- uint8_t cruread(offs_t offset);
- void cruwrite(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( cruread );
+ DECLARE_WRITE8_MEMBER( cruwrite );
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
diff --git a/src/devices/machine/tms9914.cpp b/src/devices/machine/tms9914.cpp
index eef06895493..00fedd5db0c 100644
--- a/src/devices/machine/tms9914.cpp
+++ b/src/devices/machine/tms9914.cpp
@@ -241,7 +241,7 @@ WRITE_LINE_MEMBER(tms9914_device::ren_w)
}
// Register I/O
-void tms9914_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(tms9914_device::reg8_w)
{
LOG_REG("W %u=%02x\n" , offset , data);
@@ -323,7 +323,7 @@ void tms9914_device::write(offs_t offset, uint8_t data)
}
}
-uint8_t tms9914_device::read(offs_t offset)
+READ8_MEMBER(tms9914_device::reg8_r)
{
uint8_t res;
diff --git a/src/devices/machine/tms9914.h b/src/devices/machine/tms9914.h
index 9fda5aa2ebb..14df9d80647 100644
--- a/src/devices/machine/tms9914.h
+++ b/src/devices/machine/tms9914.h
@@ -83,9 +83,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(atn_w);
DECLARE_WRITE_LINE_MEMBER(ren_w);
- // Register access
- void write(offs_t offset, uint8_t data);
- uint8_t read(offs_t offset);
+ DECLARE_WRITE8_MEMBER(reg8_w);
+ DECLARE_READ8_MEMBER(reg8_r);
// CONT output: true when 9914 is current controller-in-charge
DECLARE_READ_LINE_MEMBER(cont_r);
diff --git a/src/devices/machine/tube.cpp b/src/devices/machine/tube.cpp
index a53c05ac38c..aac084a3158 100644
--- a/src/devices/machine/tube.cpp
+++ b/src/devices/machine/tube.cpp
@@ -79,7 +79,7 @@ void tube_device::update_interrupts()
m_drq_handler(!BIT(m_r1stat, 4) && ((m_hp3pos > BIT(m_r1stat, 4)) || (m_ph3pos == 0)) ? ASSERT_LINE : CLEAR_LINE);
}
-uint8_t tube_device::host_r(offs_t offset)
+READ8_MEMBER(tube_device::host_r)
{
uint8_t data = 0xfe;
@@ -143,7 +143,7 @@ uint8_t tube_device::host_r(offs_t offset)
return data;
}
-void tube_device::host_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(tube_device::host_w)
{
switch (offset & 0x07)
{
@@ -197,7 +197,7 @@ void tube_device::host_w(offs_t offset, uint8_t data)
update_interrupts();
}
-uint8_t tube_device::parasite_r(offs_t offset)
+READ8_MEMBER(tube_device::parasite_r)
{
uint8_t data = 0x00;
@@ -265,7 +265,7 @@ uint8_t tube_device::parasite_r(offs_t offset)
return data;
}
-void tube_device::parasite_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(tube_device::parasite_w)
{
switch (offset & 0x07)
{
diff --git a/src/devices/machine/tube.h b/src/devices/machine/tube.h
index 384cf29b8d9..c8d94b1c7a7 100644
--- a/src/devices/machine/tube.h
+++ b/src/devices/machine/tube.h
@@ -32,10 +32,10 @@ public:
auto pirq_handler() { return m_pirq_handler.bind(); }
auto drq_handler() { return m_drq_handler.bind(); }
- uint8_t host_r(offs_t offset);
- void host_w(offs_t offset, uint8_t data);
- uint8_t parasite_r(offs_t offset);
- void parasite_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(host_r);
+ DECLARE_WRITE8_MEMBER(host_w);
+ DECLARE_READ8_MEMBER(parasite_r);
+ DECLARE_WRITE8_MEMBER(parasite_w);
protected:
// device-level overrides
diff --git a/src/devices/machine/upd7002.cpp b/src/devices/machine/upd7002.cpp
index b00d44066e5..69b9bb262ee 100644
--- a/src/devices/machine/upd7002.cpp
+++ b/src/devices/machine/upd7002.cpp
@@ -59,7 +59,7 @@ void upd7002_device::device_reset()
*****************************************************************************/
-READ_LINE_MEMBER( upd7002_device::eoc_r )
+READ8_MEMBER( upd7002_device::eoc_r )
{
return (m_status>>7)&0x01;
}
@@ -94,7 +94,7 @@ void upd7002_device::device_timer(emu_timer &timer, device_timer_id id, int para
}
-uint8_t upd7002_device::read(offs_t offset)
+READ8_MEMBER( upd7002_device::read )
{
switch(offset&0x03)
{
@@ -112,7 +112,7 @@ uint8_t upd7002_device::read(offs_t offset)
-void upd7002_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( upd7002_device::write )
{
/* logerror("write to uPD7002 $%02X = $%02X\n",offset,data); */
diff --git a/src/devices/machine/upd7002.h b/src/devices/machine/upd7002.h
index 2a68774d435..5b62d13dc34 100644
--- a/src/devices/machine/upd7002.h
+++ b/src/devices/machine/upd7002.h
@@ -30,9 +30,9 @@ public:
template <typename... T> void set_get_analogue_callback(T &&... args) { m_get_analogue_cb = get_analogue_delegate(std::forward<T>(args)...); }
template <typename... T> void set_eoc_callback(T &&... args) { m_eoc_cb = eoc_delegate(std::forward<T>(args)...); }
- DECLARE_READ_LINE_MEMBER(eoc_r);
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(eoc_r);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
protected:
// device-level overrides
diff --git a/src/devices/machine/upd765.cpp b/src/devices/machine/upd765.cpp
index 64b844dd222..bfbf277449b 100644
--- a/src/devices/machine/upd765.cpp
+++ b/src/devices/machine/upd765.cpp
@@ -18,7 +18,6 @@
#define LOG_MATCH (1U << 10) // Sector matching
#define LOG_STATE (1U << 11) // State machine
#define LOG_LIVE (1U << 12) // Live states
-#define LOG_DONE (1U << 13) // Command done
#define VERBOSE (LOG_GENERAL | LOG_WARN )
@@ -39,7 +38,6 @@
#define LOGMATCH(...) LOGMASKED(LOG_MATCH, __VA_ARGS__)
#define LOGSTATE(...) LOGMASKED(LOG_STATE, __VA_ARGS__)
#define LOGLIVE(...) LOGMASKED(LOG_LIVE, __VA_ARGS__)
-#define LOGDONE(...) LOGMASKED(LOG_DONE, __VA_ARGS__)
DEFINE_DEVICE_TYPE(UPD765A, upd765a_device, "upd765a", "NEC uPD765A FDC")
DEFINE_DEVICE_TYPE(UPD765B, upd765b_device, "upd765b", "NEC uPD765B FDC")
@@ -168,9 +166,7 @@ upd765_family_device::upd765_family_device(const machine_config &mconfig, device
pc_fdc_interface(mconfig, type, tag, owner, clock),
intrq_cb(*this),
drq_cb(*this),
- hdl_cb(*this),
- idx_cb(*this),
- us_cb(*this)
+ hdl_cb(*this)
{
ready_polled = true;
ready_connected = true;
@@ -195,20 +191,15 @@ void upd765_family_device::set_mode(int _mode)
mode = _mode;
}
-void upd765_family_device::device_resolve_objects()
-{
- intrq_cb.resolve_safe();
- drq_cb.resolve_safe();
- hdl_cb.resolve_safe();
- idx_cb.resolve_safe();
- us_cb.resolve_safe();
-}
-
void upd765_family_device::device_start()
{
save_item(NAME(motorcfg));
save_item(NAME(selected_drive));
+ intrq_cb.resolve_safe();
+ drq_cb.resolve_safe();
+ hdl_cb.resolve_safe();
+
for(int i=0; i != 4; i++) {
char name[2];
flopi[i].tm = timer_alloc(i);
@@ -336,7 +327,6 @@ void upd765_family_device::set_ds(int fid)
for(floppy_info &fi : flopi)
if(fi.dev)
fi.dev->ds_w(fid);
- us_cb(fid);
// record selected drive
selected_drive = fid;
@@ -351,11 +341,9 @@ void upd765_family_device::set_floppy(floppy_image_device *flop)
}
if(flop)
flop->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(&upd765_family_device::index_callback, this));
- else
- idx_cb(0);
}
-uint8_t upd765_family_device::sra_r()
+READ8_MEMBER(upd765_family_device::sra_r)
{
uint8_t sra = 0;
int fid = dor & 3;
@@ -378,17 +366,17 @@ uint8_t upd765_family_device::sra_r()
return sra;
}
-uint8_t upd765_family_device::srb_r()
+READ8_MEMBER(upd765_family_device::srb_r)
{
return 0;
}
-uint8_t upd765_family_device::dor_r()
+READ8_MEMBER(upd765_family_device::dor_r)
{
return dor;
}
-void upd765_family_device::dor_w(uint8_t data)
+WRITE8_MEMBER(upd765_family_device::dor_w)
{
LOGREGS("dor = %02x\n", data);
uint8_t diff = dor ^ data;
@@ -404,16 +392,21 @@ void upd765_family_device::dor_w(uint8_t data)
check_irq();
}
-uint8_t upd765_family_device::tdr_r()
+READ8_MEMBER(upd765_family_device::tdr_r)
{
return 0;
}
-void upd765_family_device::tdr_w(uint8_t data)
+WRITE8_MEMBER(upd765_family_device::tdr_w)
+{
+}
+
+READ8_MEMBER(upd765_family_device::msr_r)
{
+ return read_msr();
}
-uint8_t upd765_family_device::msr_r()
+uint8_t upd765_family_device::read_msr()
{
uint32_t msr = 0;
switch(main_phase) {
@@ -444,7 +437,7 @@ uint8_t upd765_family_device::msr_r()
}
msr |= get_drive_busy();
- if(data_irq && !machine().side_effects_disabled()) {
+ if(data_irq) {
data_irq = false;
check_irq();
}
@@ -452,7 +445,7 @@ uint8_t upd765_family_device::msr_r()
return msr;
}
-void upd765_family_device::dsr_w(uint8_t data)
+WRITE8_MEMBER(upd765_family_device::dsr_w)
{
LOGREGS("dsr_w %02x (%s)\n", data, machine().describe_context());
if(data & 0x80)
@@ -466,43 +459,39 @@ void upd765_family_device::set_rate(int rate)
cur_rate = rate;
}
-uint8_t upd765_family_device::fifo_r()
+uint8_t upd765_family_device::read_fifo()
{
uint8_t r = 0xff;
switch(main_phase) {
case PHASE_EXEC:
- if(machine().side_effects_disabled())
- return fifo[0];
if(internal_drq)
return fifo_pop(false);
- LOGFIFO("fifo_r in phase %d\n", main_phase);
+ LOGFIFO("read_fifo in phase %d\n", main_phase);
break;
case PHASE_RESULT:
r = result[0];
- if(!machine().side_effects_disabled()) {
- result_pos--;
- memmove(result, result+1, result_pos);
- if(!result_pos)
- main_phase = PHASE_CMD;
- else if(result_pos == 1) {
- // clear drive busy bit after the first sense interrupt status result byte is read
- for(floppy_info &fi : flopi)
- if((fi.main_state == RECALIBRATE || fi.main_state == SEEK) && fi.sub_state == IDLE && fi.st0_filled == false)
- fi.main_state = IDLE;
- clr_drive_busy();
- }
+ result_pos--;
+ memmove(result, result+1, result_pos);
+ if(!result_pos)
+ main_phase = PHASE_CMD;
+ else if(result_pos == 1) {
+ // clear drive busy bit after the first sense interrupt status result byte is read
+ for(floppy_info &fi : flopi)
+ if((fi.main_state == RECALIBRATE || fi.main_state == SEEK) && fi.sub_state == IDLE && fi.st0_filled == false)
+ fi.main_state = IDLE;
+ clr_drive_busy();
}
break;
default:
- LOGFIFO("fifo_r in phase %d\n", main_phase);
+ LOGFIFO("read_fifo in phase %d\n", main_phase);
break;
}
return r;
}
-void upd765_family_device::fifo_w(uint8_t data)
+void upd765_family_device::write_fifo(uint8_t data)
{
switch(main_phase) {
case PHASE_CMD: {
@@ -528,11 +517,11 @@ void upd765_family_device::fifo_w(uint8_t data)
fifo_push(data, false);
return;
}
- LOGFIFO("fifo_w in phase %d\n", main_phase);
+ LOGFIFO("write_fifo in phase %d\n", main_phase);
break;
default:
- LOGFIFO("fifo_w in phase %d\n", main_phase);
+ LOGFIFO("write_fifo in phase %d\n", main_phase);
break;
}
}
@@ -545,7 +534,12 @@ uint8_t upd765_family_device::do_dir_r()
return 0x00;
}
-void upd765_family_device::ccr_w(uint8_t data)
+READ8_MEMBER(upd765_family_device::dir_r)
+{
+ return do_dir_r();
+}
+
+WRITE8_MEMBER(upd765_family_device::ccr_w)
{
dsr = (dsr & 0xfc) | (data & 3);
cur_rate = rates[data & 3];
@@ -647,10 +641,18 @@ void upd765_family_device::fifo_expect(int size, bool write)
enable_transfer();
}
+READ8_MEMBER(upd765_family_device::mdma_r)
+{
+ return dma_r();
+}
+
+WRITE8_MEMBER(upd765_family_device::mdma_w)
+{
+ dma_w(data);
+}
+
uint8_t upd765_family_device::dma_r()
{
- if(machine().side_effects_disabled())
- return fifo[0];
return fifo_pop(false);
}
@@ -1472,7 +1474,7 @@ void upd765_family_device::execute_command(int cmd)
void upd765_family_device::command_end(floppy_info &fi, bool data_completion)
{
- LOGDONE("command done (%s) - %s\n", data_completion ? "data" : "seek", results());
+ LOGCOMMAND("command done (%s) - %s\n", data_completion ? "data" : "seek", results());
fi.main_state = fi.sub_state = IDLE;
if(data_completion)
data_irq = true;
@@ -1744,16 +1746,7 @@ void upd765_family_device::read_data_continue(floppy_info &fi)
fi.sub_state = COMMAND_DONE;
break;
}
- // MZ: This st1 handling ensures that both HX5102 floppy and the
- // Speedlock protection scheme are properly working.
- // a) HX5102 requires that the ND flag not be set when no address
- // marks could be found on the track at all (particularly due to
- // wrong density)
- // b) Speedlock requires the ND flag be set when there are valid
- // sectors on the track, but the desired sector is missing, also
- // when it has no valid address marks
st1 &= ~ST1_MA;
- st1 |= ST1_ND;
if(!sector_matches()) {
if(cur_live.idbuf[0] != command[2]) {
if(cur_live.idbuf[0] == 0xff)
@@ -1765,7 +1758,6 @@ void upd765_family_device::read_data_continue(floppy_info &fi)
live_start(fi, SEARCH_ADDRESS_MARK_HEADER);
return;
}
- st1 &= ~ST1_ND;
LOGRW("reading sector %02x %02x %02x %02x\n",
cur_live.idbuf[0],
cur_live.idbuf[1],
@@ -1784,6 +1776,11 @@ void upd765_family_device::read_data_continue(floppy_info &fi)
case SCAN_ID_FAILED:
LOGSTATE("SCAN_ID_FAILED\n");
fi.st0 |= ST0_FAIL;
+ // MZ: The HX5102 does not correctly detect a FM/MFM mismatch
+ // when the ND bit is set, because in the firmware the ND bit wins
+ // against MA, and thus concludes that the format is correct
+ // but the sector is missing.
+ // st1 |= ST1_ND;
fi.sub_state = COMMAND_DONE;
break;
@@ -1855,7 +1852,7 @@ void upd765_family_device::write_data_start(floppy_info &fi)
fi.main_state = WRITE_DATA;
fi.sub_state = HEAD_LOAD;
mfm = command[0] & 0x40;
- LOGCOMMAND("command write%s data%s%s cmd=%02x sel=%x chrn=(%d, %d, %d, %d) eot=%02x gpl=%02x dtl=%02x rate=%d\n",
+ LOGRW("command write%s data%s%s cmd=%02x sel=%x chrn=(%d, %d, %d, %d) eot=%02x gpl=%02x dtl=%02x rate=%d\n",
command[0] & 0x08 ? " deleted" : "",
command[0] & 0x80 ? " mt" : "",
command[0] & 0x40 ? " mfm" : "",
@@ -1923,11 +1920,6 @@ void upd765_family_device::write_data_continue(floppy_info &fi)
break;
}
st1 &= ~ST1_MA;
- LOGRW("writing sector %02x %02x %02x %02x\n",
- cur_live.idbuf[0],
- cur_live.idbuf[1],
- cur_live.idbuf[2],
- cur_live.idbuf[3]);
sector_size = calc_sector_size(cur_live.idbuf[3]);
fifo_expect(sector_size, true);
fi.sub_state = SECTOR_WRITTEN;
@@ -2000,7 +1992,7 @@ void upd765_family_device::read_track_start(floppy_info &fi)
mfm = command[0] & 0x40;
sectors_read = 0;
- LOGCOMMAND("command read track%s cmd=%02x sel=%x chrn=(%d, %d, %d, %d) eot=%02x gpl=%02x dtl=%02x rate=%d\n",
+ LOGRW("command read track%s cmd=%02x sel=%x chrn=(%d, %d, %d, %d) eot=%02x gpl=%02x dtl=%02x rate=%d\n",
command[0] & 0x40 ? " mfm" : "",
command[0],
command[1],
@@ -2292,9 +2284,6 @@ void upd765_family_device::read_id_start(floppy_info &fi)
return;
}
- for(int i=0; i<4; i++)
- cur_live.idbuf[i] = command[i+2];
-
read_id_continue(fi);
}
@@ -2327,7 +2316,8 @@ void upd765_family_device::read_id_continue(floppy_info &fi)
case SCAN_ID_FAILED:
LOGSTATE("SCAN_ID_FAILED\n");
fi.st0 |= ST0_FAIL;
- st1 |= ST1_ND|ST1_MA;
+ // st1 |= ST1_ND|ST1_MA;
+ st1 = ST1_MA;
fi.sub_state = COMMAND_DONE;
break;
@@ -2453,7 +2443,6 @@ void upd765_family_device::index_callback(floppy_image_device *floppy, int state
if(fi.live)
live_sync();
fi.index = state;
- idx_cb(state);
if(!state) {
general_continue(fi);
@@ -2966,7 +2955,7 @@ void mcs3201_device::device_start()
m_input_handler.resolve_safe(0);
}
-uint8_t mcs3201_device::input_r()
+READ8_MEMBER( mcs3201_device::input_r )
{
return m_input_handler();
}
@@ -2986,7 +2975,7 @@ void tc8566af_device::device_start()
save_item(NAME(m_cr1));
}
-void tc8566af_device::cr1_w(uint8_t data)
+WRITE8_MEMBER(tc8566af_device::cr1_w)
{
m_cr1 = data;
@@ -2996,7 +2985,7 @@ void tc8566af_device::cr1_w(uint8_t data)
}
}
-void upd72065_device::auxcmd_w(uint8_t data)
+WRITE8_MEMBER(upd72065_device::auxcmd_w)
{
switch(data) {
case 0x36: // reset
diff --git a/src/devices/machine/upd765.h b/src/devices/machine/upd765.h
index 0a40e4f4b53..dd2e30ce78a 100644
--- a/src/devices/machine/upd765.h
+++ b/src/devices/machine/upd765.h
@@ -45,29 +45,34 @@ public:
auto intrq_wr_callback() { return intrq_cb.bind(); }
auto drq_wr_callback() { return drq_cb.bind(); }
auto hdl_wr_callback() { return hdl_cb.bind(); }
- auto us_wr_callback() { return us_cb.bind(); }
- auto idx_wr_callback() { return idx_cb.bind(); }
virtual void map(address_map &map) override = 0;
- uint8_t sra_r();
- uint8_t srb_r();
- uint8_t dor_r();
- void dor_w(uint8_t data);
- uint8_t tdr_r();
- void tdr_w(uint8_t data);
- uint8_t msr_r();
- void dsr_w(uint8_t data);
- uint8_t fifo_r();
- void fifo_w(uint8_t data);
- uint8_t dir_r() { return do_dir_r(); }
- void ccr_w(uint8_t data);
+ DECLARE_READ8_MEMBER (sra_r);
+ DECLARE_READ8_MEMBER (srb_r);
+ DECLARE_READ8_MEMBER (dor_r);
+ DECLARE_WRITE8_MEMBER(dor_w);
+ DECLARE_READ8_MEMBER (tdr_r);
+ DECLARE_WRITE8_MEMBER(tdr_w);
+ uint8_t read_msr();
+ DECLARE_READ8_MEMBER (msr_r);
+ DECLARE_WRITE8_MEMBER(dsr_w);
+ uint8_t read_fifo();
+ void write_fifo(uint8_t data);
+ DECLARE_READ8_MEMBER (fifo_r) { return read_fifo(); }
+ DECLARE_WRITE8_MEMBER(fifo_w) { write_fifo(data); }
+ DECLARE_READ8_MEMBER (dir_r);
+ DECLARE_WRITE8_MEMBER(ccr_w);
virtual uint8_t do_dir_r() override;
uint8_t dma_r() override;
void dma_w(uint8_t data) override;
+ // Same as the previous ones, but as memory-mappable members
+ DECLARE_READ8_MEMBER(mdma_r);
+ DECLARE_WRITE8_MEMBER(mdma_w);
+
bool get_irq() const;
bool get_drq() const;
void tc_w(bool val) override;
@@ -86,7 +91,6 @@ public:
protected:
upd765_family_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
- virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
@@ -265,8 +269,7 @@ protected:
int main_phase;
live_info cur_live, checkpoint_live;
- devcb_write_line intrq_cb, drq_cb, hdl_cb, idx_cb;
- devcb_write8 us_cb;
+ devcb_write_line intrq_cb, drq_cb, hdl_cb;
bool cur_irq, other_irq, data_irq, drq, internal_drq, tc, tc_done, locked, mfm, scan_done;
floppy_info flopi[4];
@@ -470,7 +473,7 @@ public:
upd72065_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual void map(address_map &map) override;
- void auxcmd_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER(auxcmd_w);
};
class n82077aa_device : public upd765_family_device {
@@ -521,7 +524,7 @@ public:
auto input_handler() { return m_input_handler.bind(); }
virtual void map(address_map &map) override;
- uint8_t input_r();
+ DECLARE_READ8_MEMBER( input_r );
protected:
virtual void device_start() override;
@@ -536,7 +539,7 @@ public:
virtual void map(address_map &map) override;
- void cr1_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER(cr1_w);
protected:
virtual void device_start() override;
diff --git a/src/devices/machine/wd1010.cpp b/src/devices/machine/wd1010.cpp
deleted file mode 100644
index 16442934352..00000000000
--- a/src/devices/machine/wd1010.cpp
+++ /dev/null
@@ -1,583 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Dirk Best
-/***************************************************************************
-
- Western Digital WD1010-05 Winchester Disk Controller
-
-***************************************************************************/
-
-#include "emu.h"
-#include "wd1010.h"
-
-//#define LOG_GENERAL (1U << 0)
-#define LOG_CMD (1U << 1)
-#define LOG_INT (1U << 2)
-#define LOG_SEEK (1U << 3)
-#define LOG_REGS (1U << 4)
-#define LOG_DATA (1U << 5)
-
-//#define VERBOSE (LOG_CMD | LOG_INT | LOG_SEEK | LOG_REGS | LOG_DATA)
-//#define LOG_OUTPUT_STREAM std::cout
-
-#include "logmacro.h"
-
-#define LOGCMD(...) LOGMASKED(LOG_CMD, __VA_ARGS__)
-#define LOGINT(...) LOGMASKED(LOG_INT, __VA_ARGS__)
-#define LOGSEEK(...) LOGMASKED(LOG_SEEK, __VA_ARGS__)
-#define LOGREGS(...) LOGMASKED(LOG_REGS, __VA_ARGS__)
-#define LOGDATA(...) LOGMASKED(LOG_DATA, __VA_ARGS__)
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-DEFINE_DEVICE_TYPE(WD1010, wd1010_device, "wd1010", "Western Digital WD1010-05")
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// wd1010_device - constructor
-//-------------------------------------------------
-
-wd1010_device::wd1010_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, WD1010, tag, owner, clock),
- m_out_intrq_cb(*this),
- m_out_bcr_cb(*this),
- m_in_data_cb(*this),
- m_out_data_cb(*this),
- m_intrq(0),
- m_brdy(0),
- m_stepping_rate(0x00),
- m_command(0x00),
- m_error(0x00),
- m_precomp(0x00),
- m_sector_count(0x00),
- m_sector_number(0x00),
- m_cylinder(0x0000),
- m_sdh(0x00),
- m_status(0x00)
-{
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void wd1010_device::device_start()
-{
- // get connected drives
- for (int i = 0; i < 4; i++)
- {
- char name[2];
- name[0] = '0' + i;
- name[1] = 0;
- m_drives[i].drive = subdevice<harddisk_image_device>(name);
- m_drives[i].head = 0;
- m_drives[i].cylinder = 0;
- m_drives[i].sector = 0;
- }
-
- // resolve callbacks
- m_out_intrq_cb.resolve_safe();
- m_out_bcr_cb.resolve_safe();
- m_in_data_cb.resolve_safe(0);
- m_out_data_cb.resolve_safe();
-
- // allocate timer
- m_seek_timer = timer_alloc(TIMER_SEEK);
- m_data_timer = timer_alloc(TIMER_DATA);
-
- // register for save states
- save_item(NAME(m_intrq));
- save_item(NAME(m_brdy));
- save_item(NAME(m_stepping_rate));
- save_item(NAME(m_command));
- save_item(NAME(m_error));
- save_item(NAME(m_precomp));
- save_item(NAME(m_sector_count));
- save_item(NAME(m_sector_number));
- save_item(NAME(m_cylinder));
- save_item(NAME(m_sdh));
- save_item(NAME(m_status));
-}
-
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void wd1010_device::device_reset()
-{
-}
-
-//-------------------------------------------------
-// device_timer - device-specific timer
-//-------------------------------------------------
-
-void wd1010_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr)
-{
- switch (tid)
- {
- case TIMER_SEEK:
-
- if ((m_command >> 4) != CMD_SCAN_ID)
- {
- LOGSEEK("Seek complete\n");
- m_drives[drive()].cylinder = param;
- m_status |= STATUS_SC;
- }
-
- switch (m_command >> 4)
- {
- case CMD_RESTORE:
- cmd_restore();
- break;
-
- case CMD_SEEK:
- cmd_seek();
- break;
-
- case CMD_READ_SECTOR:
- cmd_read_sector();
- break;
-
- case CMD_WRITE_SECTOR:
- case CMD_WRITE_FORMAT:
- cmd_write_sector();
- break;
-
- case CMD_SCAN_ID:
- cmd_scan_id();
- break;
- }
-
- break;
-
- case TIMER_DATA:
-
- // check if data is ready or continue waiting
- if (m_brdy)
- cmd_write_sector();
- else
- m_data_timer->adjust(attotime::from_usec(35));
-
- break;
- }
-}
-
-//-------------------------------------------------
-// set_error - set error and adjust status
-//-------------------------------------------------
-
-void wd1010_device::set_error(int error)
-{
- if (error)
- {
- m_error |= error;
- m_status |= STATUS_ERR;
- }
- else
- {
- m_error = 0;
- m_status &= ~STATUS_ERR;
- }
-}
-
-//-------------------------------------------------
-// set_intrq - set interrupt status
-//-------------------------------------------------
-
-void wd1010_device::set_intrq(int state)
-{
- if (m_intrq == 0 && state == 1)
- {
- LOGINT("INT 1\n");
- m_intrq = 1;
- m_out_intrq_cb(1);
- }
- else if (m_intrq == 1 && state == 0)
- {
- LOGINT("INT 0\n");
- m_intrq = 0;
- m_out_intrq_cb(0);
- }
-}
-
-//-------------------------------------------------
-// get_stepping_rate - calculate stepping rate
-//-------------------------------------------------
-
-attotime wd1010_device::get_stepping_rate()
-{
- if (m_stepping_rate)
- return attotime::from_usec(500 * m_stepping_rate);
- else
- return attotime::from_usec(35);
-}
-
-//-------------------------------------------------
-// start_command - executed at the start of every command
-//-------------------------------------------------
-
-void wd1010_device::start_command()
-{
- // now busy and command in progress, clear error
- m_status |= STATUS_BSY;
- m_status |= STATUS_CIP;
- set_error(0);
-
- switch (m_command >> 4)
- {
- case CMD_RESTORE:
- m_stepping_rate = m_command & 0x0f;
- LOGCMD("RESTORE\n");
- break;
- case CMD_READ_SECTOR:
- LOGCMD("READ SECTOR\n");
- break;
- case CMD_WRITE_SECTOR:
- LOGCMD("WRITE SECTOR\n");
- break;
- case CMD_SCAN_ID:
- LOGCMD("SCAN ID\n");
- break;
- case CMD_WRITE_FORMAT:
- LOGCMD("WRITE FORMAT ID\n");
- break;
- case CMD_SEEK:
- m_stepping_rate = m_command & 0x0f;
- LOGCMD("SEEK\n");
- break;
- }
-}
-
-//-------------------------------------------------
-// end_command - executed at end of every command
-//-------------------------------------------------
-
-void wd1010_device::end_command()
-{
- m_out_bcr_cb(1);
- m_out_bcr_cb(0);
-
- m_status &= ~(STATUS_BSY | STATUS_CIP);
-
- set_intrq(1);
-}
-
-//-------------------------------------------------
-// get_lbasector - translate to lba
-//-------------------------------------------------
-
-int wd1010_device::get_lbasector()
-{
- hard_disk_file *file = m_drives[drive()].drive->get_hard_disk_file();
- hard_disk_info *info = hard_disk_get_info(file);
- int lbasector;
-
- lbasector = m_cylinder;
- lbasector *= info->heads;
- lbasector += head();
- lbasector *= info->sectors;
- lbasector += m_sector_number;
-
- return lbasector;
-}
-
-
-//**************************************************************************
-// INTERFACE
-//**************************************************************************
-
-WRITE_LINE_MEMBER( wd1010_device::drdy_w )
-{
- if (state)
- m_status |= STATUS_RDY;
- else
- m_status &= ~STATUS_RDY;
-}
-
-WRITE_LINE_MEMBER( wd1010_device::brdy_w )
-{
- m_brdy = state;
-}
-
-READ8_MEMBER( wd1010_device::read )
-{
- // if the controller is busy all reads return the status register
- if (m_status & STATUS_BSY)
- {
- LOG("Read while busy, return STATUS: %02x\n", m_status);
- return m_status;
- }
-
- switch (offset & 0x07)
- {
- case 0:
- LOGREGS("RD INVALID\n");
- return 0;
-
- case 1:
- LOGREGS("RD ERROR: %02x\n", m_error);
- return m_error;
-
- case 2:
- LOGREGS("RD SECTOR COUNT: %02x\n", m_sector_count);
- return m_sector_count;
-
- case 3:
- LOGREGS("RD SECTOR NUMBER: %02x\n", m_sector_number);
- return m_sector_number;
-
- case 4:
- LOGREGS("RD CYLINDER L: %02x\n", m_cylinder & 0xff);
- return m_cylinder & 0xff;
-
- case 5:
- LOGREGS("RD CYLINDER H: %02x\n", m_cylinder >> 8);
- return m_cylinder >> 8;
-
- case 6:
- LOGREGS("RD SDH: %02x\n", m_sdh);
- return m_sdh;
-
- case 7:
- LOGREGS("RD STATUS: %02x\n", m_status);
-
- // reading the status register clears the interrupt
- set_intrq(0);
-
- return m_status;
- }
-
- // should never get here
- return 0xff;
-}
-
-WRITE8_MEMBER( wd1010_device::write )
-{
- switch (offset & 0x07)
- {
- case 0:
- LOGREGS("WR INVALID: %02x\n", data);
- break;
-
- case 1:
- LOGREGS("WR PRECOMP: %02x\n", data);
- m_precomp = data;
- break;
-
- case 2:
- LOGREGS("WR SECTOR COUNT: %02x\n", data);
- m_sector_count = data;
- break;
-
- case 3:
- LOGREGS("WR SECTOR NUMBER: %02x\n", data);
- m_sector_number = data;
- break;
-
- case 4:
- LOGREGS("WR CYLINDER L: %02x\n", data);
- m_cylinder = (m_cylinder & 0xff00) | (data << 0);
- break;
-
- case 5:
- LOGREGS("WR CYLINDER H: %02x\n", data);
- m_cylinder = (m_cylinder & 0x00ff) | (data << 8);
- break;
-
- case 6:
- LOGREGS("WR SDH: %02x\n", data);
- m_sdh = data;
- break;
-
- case 7:
- // writes to the command register are ignored when a command is in progress
- if (m_status & STATUS_CIP)
- return;
-
- // writing the command register clears the interrupt
- set_intrq(0);
-
- // check drive status
- if (!(m_status & STATUS_RDY))
- {
- // selected drive not ready
- LOG("--> Drive not ready, aborting\n");
-
- set_error(ERR_AC);
- end_command();
- }
- else
- {
- m_command = data;
-
- start_command();
-
- // all other command imply a seek
- if ((m_command >> 4) != CMD_SCAN_ID)
- m_status &= ~STATUS_SC;
-
- int amount = 0;
- int target = 0;
-
- switch (m_command >> 4)
- {
- case CMD_RESTORE:
- amount = m_drives[drive()].cylinder;
- target = 0;
- break;
-
- case CMD_SEEK:
- case CMD_READ_SECTOR:
- case CMD_WRITE_SECTOR:
- case CMD_WRITE_FORMAT:
- amount = abs(m_drives[drive()].cylinder - m_cylinder);
- target = m_cylinder;
- break;
- }
-
- if ((m_command >> 4) != CMD_SCAN_ID)
- LOGSEEK("Seeking %d cylinders to %d\n", amount, target);
-
- m_seek_timer->adjust(get_stepping_rate() * amount, target);
- }
-
- break;
- }
-}
-
-
-//**************************************************************************
-// IMPLEMENTATION
-//**************************************************************************
-
-void wd1010_device::cmd_restore()
-{
- LOGCMD("--> RESTORE done\n");
- end_command();
-}
-
-void wd1010_device::cmd_read_sector()
-{
- hard_disk_file *file = m_drives[drive()].drive->get_hard_disk_file();
- hard_disk_info *info = hard_disk_get_info(file);
-
- m_out_bcr_cb(1);
- m_out_bcr_cb(0);
-
- // verify that we can read
- if (head() > info->heads)
- {
- // out of range
- LOG("--> Head out of range, aborting\n");
-
- set_error(ERR_AC);
- end_command();
- }
- else
- {
- uint8_t buffer[512];
-
- while (m_sector_count > 0)
- {
- LOGDATA("--> Transferring sector to buffer (lba = %08x)\n", get_lbasector());
-
- hard_disk_read(file, get_lbasector(), buffer);
-
- for (int i = 0; i < 512; i++)
- m_out_data_cb(buffer[i]);
-
- m_out_bcr_cb(1);
- m_out_bcr_cb(0);
-
- // save last read head and sector number
- m_drives[drive()].head = head();
- m_drives[drive()].sector = m_sector_number;
-
- if (BIT(m_command, 2))
- {
- m_sector_number++;
- m_sector_count--;
- }
- else
- break;
- }
-
- end_command();
- }
-}
-
-void wd1010_device::cmd_write_sector()
-{
- if (!(m_status & STATUS_DRQ))
- {
- LOGDATA("Setting DATA REQUEST\n");
- m_status |= STATUS_DRQ;
- m_data_timer->adjust(attotime::from_usec(35));
- return;
- }
-
- if (m_brdy == 0)
- {
- m_data_timer->adjust(attotime::from_usec(35));
- return;
- }
-
- LOGDATA("Clearing DATA REQUEST\n");
- m_status &= ~STATUS_DRQ;
-
- hard_disk_file *file = m_drives[drive()].drive->get_hard_disk_file();
- uint8_t buffer[512];
-
- while (m_sector_count > 0)
- {
- if ((m_command >> 4) == CMD_WRITE_FORMAT)
- {
- // we ignore the format specification and fill everything with 0xe5
- std::fill(std::begin(buffer), std::end(buffer), 0xe5);
- }
- else
- {
- // get data for sector from buffer chip
- for (int i = 0; i < 512; i++)
- buffer[i] = m_in_data_cb();
- }
-
- hard_disk_write(file, get_lbasector(), buffer);
-
- // save last read head and sector number
- m_drives[drive()].head = head();
- m_drives[drive()].sector = m_sector_number;
-
- if (BIT(m_command, 2))
- {
- m_sector_number++;
- m_sector_count--;
- }
- else
- break;
- }
-
- end_command();
-}
-
-void wd1010_device::cmd_scan_id()
-{
- // update head, sector size, sector number and cylinder
- m_sdh = (m_sdh & 0xf8) | (m_drives[drive()].head & 0x07);
- m_sector_number = m_drives[drive()].sector;
- m_cylinder = m_drives[drive()].cylinder;
-
- end_command();
-}
-
-void wd1010_device::cmd_seek()
-{
- LOGCMD("--> SEEK done\n");
- end_command();
-}
diff --git a/src/devices/machine/wd1010.h b/src/devices/machine/wd1010.h
deleted file mode 100644
index b5db9975693..00000000000
--- a/src/devices/machine/wd1010.h
+++ /dev/null
@@ -1,143 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Dirk Best
-/***************************************************************************
-
- Western Digital WD1010-05 Winchester Disk Controller
-
-***************************************************************************/
-
-#ifndef MAME_MACHINE_WD1010_H
-#define MAME_MACHINE_WD1010_H
-
-#pragma once
-
-#include "imagedev/harddriv.h"
-
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> wd1010_device
-
-class wd1010_device : public device_t
-{
-public:
- // construction/destruction
- wd1010_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- auto out_intrq_callback() { return m_out_intrq_cb.bind(); }
- auto out_bcr_callback() { return m_out_bcr_cb.bind(); }
- auto in_data_callback() { return m_in_data_cb.bind(); }
- auto out_data_callback() { return m_out_data_cb.bind(); }
-
- DECLARE_READ8_MEMBER(read);
- DECLARE_WRITE8_MEMBER(write);
-
- DECLARE_WRITE_LINE_MEMBER(drdy_w);
- DECLARE_WRITE_LINE_MEMBER(brdy_w);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
-
-private:
- enum
- {
- STATUS_ERR = 0x01, // error
- STATUS_CIP = 0x02, // command in progress
- STATUS_RSV = 0x04, // reserved
- STATUS_DRQ = 0x08, // data request
- STATUS_SC = 0x10, // seek complete
- STATUS_WF = 0x20, // write fault
- STATUS_RDY = 0x40, // drive ready
- STATUS_BSY = 0x80 // controller busy
- };
-
- enum
- {
- ERR_DM = 0x01, // data address mark not found
- ERR_TK = 0x02, // track zero error
- ERR_AC = 0x04, // aborted command
- ERR_RSV1 = 0x08, // reserved, forced to 0
- ERR_ID = 0x10, // id not found
- ERR_RSV2 = 0x20, // reserved, forced to 0
- ERR_CRC = 0x40, // crc error
- ERR_BB = 0x80 // bad block
- };
-
- enum
- {
- CMD_RESTORE = 1,
- CMD_READ_SECTOR = 2,
- CMD_WRITE_SECTOR = 3,
- CMD_SCAN_ID = 4,
- CMD_WRITE_FORMAT = 5,
- CMD_SEEK = 7
- };
-
- enum
- {
- TIMER_SEEK,
- TIMER_DATA
- };
-
- void set_error(int error);
- void set_intrq(int state);
- attotime get_stepping_rate();
- void start_command();
- void end_command();
- int get_lbasector();
-
- // extract values from sdh
- int head() { return (m_sdh >> 0) & 0x07; }
- int drive() { return (m_sdh >> 3) & 0x03; }
- int sector_size()
- {
- const int S[4] = { 256, 512, 1024, 128 };
- return S[(m_sdh >> 5) & 0x03];
- }
-
- void cmd_restore();
- void cmd_read_sector();
- void cmd_write_sector();
- void cmd_scan_id();
- void cmd_seek();
-
- devcb_write_line m_out_intrq_cb;
- devcb_write_line m_out_bcr_cb;
- devcb_read8 m_in_data_cb;
- devcb_write8 m_out_data_cb;
-
- struct
- {
- harddisk_image_device *drive;
- uint8_t head;
- uint16_t cylinder;
- uint8_t sector;
- } m_drives[4];
-
- emu_timer *m_seek_timer;
- emu_timer *m_data_timer;
-
- int m_intrq;
- int m_brdy;
- uint8_t m_stepping_rate;
- uint8_t m_command;
-
- // task file registers
- uint8_t m_error;
- uint8_t m_precomp;
- uint8_t m_sector_count;
- uint8_t m_sector_number;
- uint16_t m_cylinder;
- uint8_t m_sdh;
- uint8_t m_status;
-};
-
-// device type definition
-DECLARE_DEVICE_TYPE(WD1010, wd1010_device)
-
-#endif // MAME_MACHINE_WD1010_H
diff --git a/src/devices/machine/wd11c00_17.cpp b/src/devices/machine/wd11c00_17.cpp
index b0d58034f6d..499601c943f 100644
--- a/src/devices/machine/wd11c00_17.cpp
+++ b/src/devices/machine/wd11c00_17.cpp
@@ -301,15 +301,6 @@ WRITE8_MEMBER( wd11c00_17_device::io_w )
//-------------------------------------------------
-// dack3_w -
-//-------------------------------------------------
-
-WRITE_LINE_MEMBER(wd11c00_17_device::dack3_w)
-{
-}
-
-
-//-------------------------------------------------
// dack_r -
//-------------------------------------------------
diff --git a/src/devices/machine/wd11c00_17.h b/src/devices/machine/wd11c00_17.h
index 0b375f61e67..e109c548202 100644
--- a/src/devices/machine/wd11c00_17.h
+++ b/src/devices/machine/wd11c00_17.h
@@ -39,7 +39,6 @@ public:
DECLARE_READ8_MEMBER( io_r );
DECLARE_WRITE8_MEMBER( io_w );
- DECLARE_WRITE_LINE_MEMBER( dack3_w );
uint8_t dack_r();
void dack_w(uint8_t data);
diff --git a/src/devices/machine/wd2010.cpp b/src/devices/machine/wd2010.cpp
index 95bb4803107..c25aa538df3 100644
--- a/src/devices/machine/wd2010.cpp
+++ b/src/devices/machine/wd2010.cpp
@@ -28,11 +28,11 @@ UNIMPLEMENTED FEATURES :
the intended instruction flow. Some loops were omitted!
USAGE: tie WF (write fault) to ground if not needed:
- in_wf_callback().set_constant(0)
+ MCFG_WD2010_IN_WF_CB(GND)
Other signals should be set to VCC if not serviced:
- in_drdy_callback().set_constant(1) // DRIVE READY = VCC
- in_sc_callback().set_constant(1) // SEEK COMPLETE = VCC
+ MCFG_WD2010_IN_DRDY_CB(VCC) // DRIVE READY = VCC
+ MCFG_WD2010_IN_SC_CB(VCC) // SEEK COMPLETE = VCC
**********************************************************************/
#include "emu.h"
@@ -233,7 +233,7 @@ void wd2010_device::device_reset()
// read -
//-------------------------------------------------
-uint8_t wd2010_device::read(offs_t offset)
+READ8_MEMBER(wd2010_device::read)
{
uint8_t data;
@@ -273,7 +273,7 @@ uint8_t wd2010_device::read(offs_t offset)
// write -
//-------------------------------------------------
-void wd2010_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(wd2010_device::write)
{
m_task_file[offset] = data;
diff --git a/src/devices/machine/wd2010.h b/src/devices/machine/wd2010.h
index 1617f886ed6..fdfc2c4462c 100644
--- a/src/devices/machine/wd2010.h
+++ b/src/devices/machine/wd2010.h
@@ -40,8 +40,8 @@ public:
auto in_tk000_callback() { return m_in_tk000_cb.bind(); }
auto in_sc_callback() { return m_in_sc_cb.bind(); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
void buffer_ready(bool state);
diff --git a/src/devices/machine/wd33c93.cpp b/src/devices/machine/wd33c93.cpp
new file mode 100644
index 00000000000..fcbb45957af
--- /dev/null
+++ b/src/devices/machine/wd33c93.cpp
@@ -0,0 +1,984 @@
+// license:BSD-3-Clause
+// copyright-holders:ElSemi, R. Belmont, Ryan Holtz
+/*
+ * wd33c93.c
+ *
+ * WD/AMD 33c93 SCSI controller, as seen in
+ * early PCs, some MSX add-ons, NEC PC-88, and SGI
+ * Indigo, Indigo2, and Indy systems.
+ *
+ * References:
+ * WD 33c93 manual
+ * NetBSD 33c93 driver
+ *
+ */
+
+#include "emu.h"
+#include "wd33c93.h"
+
+#define LOG_READS (1 << 0)
+#define LOG_WRITES (1 << 1)
+#define LOG_COMMANDS (1 << 2)
+#define LOG_ERRORS (1 << 3)
+#define LOG_MISC (1 << 4)
+#define LOG_REGS (LOG_READS | LOG_WRITES)
+#define LOG_ALL (LOG_REGS | LOG_COMMANDS | LOG_ERRORS | LOG_MISC)
+
+#define VERBOSE (0)
+#include "logmacro.h"
+
+
+/* WD commands */
+#define WD_CMD_RESET 0x00
+#define WD_CMD_ABORT 0x01
+#define WD_CMD_ASSERT_ATN 0x02
+#define WD_CMD_NEGATE_ACK 0x03
+#define WD_CMD_DISCONNECT 0x04
+#define WD_CMD_RESELECT 0x05
+#define WD_CMD_SEL_ATN 0x06
+#define WD_CMD_SEL 0x07
+#define WD_CMD_SEL_ATN_XFER 0x08
+#define WD_CMD_SEL_XFER 0x09
+#define WD_CMD_RESEL_RECEIVE 0x0a
+#define WD_CMD_RESEL_SEND 0x0b
+#define WD_CMD_WAIT_SEL_RECEIVE 0x0c
+#define WD_CMD_SSCC 0x0d
+#define WD_CMD_SND_DISC 0x0e
+#define WD_CMD_SET_IDI 0x0f
+#define WD_CMD_RCV_CMD 0x10
+#define WD_CMD_RCV_DATA 0x11
+#define WD_CMD_RCV_MSG_OUT 0x12
+#define WD_CMD_RCV 0x13
+#define WD_CMD_SND_STATUS 0x14
+#define WD_CMD_SND_DATA 0x15
+#define WD_CMD_SND_MSG_IN 0x16
+#define WD_CMD_SND 0x17
+#define WD_CMD_TRANS_ADDR 0x18
+#define WD_CMD_XFER_PAD 0x19
+#define WD_CMD_TRANS_INFO 0x20
+#define WD_CMD_TRANSFER_PAD 0x21
+#define WD_CMD_SBT_MODE 0x80
+
+/* ASR register */
+#define ASR_INT 0x80
+#define ASR_LCI 0x40
+#define ASR_BSY 0x20
+#define ASR_CIP 0x10
+#define ASR_PE 0x02
+#define ASR_DBR 0x01
+
+/* SCSI Bus Phases */
+#define PHS_DATA_OUT 0x00
+#define PHS_DATA_IN 0x01
+#define PHS_COMMAND 0x02
+#define PHS_STATUS 0x03
+#define PHS_MESS_OUT 0x06
+#define PHS_MESS_IN 0x07
+
+/* Command Status Register definitions */
+
+ /* reset state interrupts */
+#define CSR_RESET 0x00
+#define CSR_RESET_AF 0x01
+
+ /* successful completion interrupts */
+#define CSR_RESELECT 0x10
+#define CSR_SELECT 0x11
+#define CSR_SEL_XFER_DONE 0x16
+#define CSR_XFER_DONE 0x18
+
+ /* paused or aborted interrupts */
+#define CSR_MSGIN 0x20
+#define CSR_SDP 0x21
+#define CSR_SEL_ABORT 0x22
+#define CSR_RESEL_ABORT 0x25
+#define CSR_RESEL_ABORT_AM 0x27
+#define CSR_ABORT 0x28
+
+ /* terminated interrupts */
+#define CSR_INVALID 0x40
+#define CSR_UNEXP_DISC 0x41
+#define CSR_TIMEOUT 0x42
+#define CSR_PARITY 0x43
+#define CSR_PARITY_ATN 0x44
+#define CSR_BAD_STATUS 0x45
+#define CSR_UNEXP 0x48
+
+ /* service required interrupts */
+#define CSR_RESEL 0x80
+#define CSR_RESEL_AM 0x81
+#define CSR_DISC 0x85
+#define CSR_SRV_REQ 0x88
+
+ /* Own ID/CDB Size register */
+#define OWNID_EAF 0x08
+#define OWNID_EHP 0x10
+#define OWNID_RAF 0x20
+#define OWNID_FS_8 0x00
+#define OWNID_FS_12 0x40
+#define OWNID_FS_16 0x80
+
+ /* Control register */
+#define CTRL_HSP 0x01
+#define CTRL_HA 0x02
+#define CTRL_IDI 0x04
+#define CTRL_EDI 0x08
+#define CTRL_HHP 0x10
+#define CTRL_POLLED 0x00
+#define CTRL_BURST 0x20
+#define CTRL_BUS 0x40
+#define CTRL_DMA 0x80
+
+ /* Synchronous Transfer Register */
+#define STR_FSS 0x80
+
+ /* Destination ID register */
+#define DSTID_DPD 0x40
+#define DATA_OUT_DIR 0
+#define DATA_IN_DIR 1
+#define DSTID_SCC 0x80
+
+ /* Source ID register */
+#define SRCID_MASK 0x07
+#define SRCID_SIV 0x08
+#define SRCID_DSP 0x20
+#define SRCID_ES 0x40
+#define SRCID_ER 0x80
+
+/* convernience functions */
+uint8_t wd33c93_device::getunit()
+{
+ /* return the destination unit id */
+ return m_regs[WD_DESTINATION_ID] & SRCID_MASK;
+}
+
+void wd33c93_device::set_xfer_count( int count )
+{
+ /* set the count */
+ m_regs[WD_TRANSFER_COUNT_LSB] = count & 0xff;
+ m_regs[WD_TRANSFER_COUNT] = (count >> 8) & 0xff;
+ m_regs[WD_TRANSFER_COUNT_MSB] = (count >> 16) & 0xff;
+}
+
+int wd33c93_device::get_xfer_count()
+{
+ /* get the count */
+ int count = m_regs[WD_TRANSFER_COUNT_MSB];
+
+ count <<= 8;
+ count |= m_regs[WD_TRANSFER_COUNT];
+ count <<= 8;
+ count |= m_regs[WD_TRANSFER_COUNT_LSB];
+
+ return count;
+}
+
+void wd33c93_device::complete_immediate(int status)
+{
+ /* reset our timer */
+ m_cmd_timer->reset();
+
+ /* set the new status */
+ m_regs[WD_SCSI_STATUS] = status & 0xff;
+
+ /* set interrupt pending */
+ m_regs[WD_AUXILIARY_STATUS] |= ASR_INT;
+
+ /* check for error conditions */
+ if (get_xfer_count() > 0)
+ {
+ /* set data buffer ready */
+ m_regs[WD_AUXILIARY_STATUS] |= ASR_DBR;
+ }
+ else
+ {
+ /* clear data buffer ready */
+ m_regs[WD_AUXILIARY_STATUS] &= ~ASR_DBR;
+ }
+
+ /* clear command in progress and bus busy */
+ m_regs[WD_AUXILIARY_STATUS] &= ~(ASR_CIP | ASR_BSY);
+
+ /* if we have a callback, call it */
+ if (!m_irq_cb.isnull())
+ {
+ m_irq_cb(1);
+ }
+}
+
+void wd33c93_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr)
+{
+ switch (tid)
+ {
+ case 0:
+ complete_immediate(param);
+ break;
+
+ case 1:
+ complete_immediate(CSR_SRV_REQ | m_busphase);
+ break;
+
+ case 2:
+ m_regs[WD_AUXILIARY_STATUS] &= ~ASR_CIP;
+ break;
+ }
+}
+
+void wd33c93_device::complete_cmd(uint8_t status)
+{
+ /* fire off a timer to complete the command */
+ m_cmd_timer->adjust(attotime::from_usec(1), status);
+}
+
+/* command handlers */
+void wd33c93_device::unimplemented_cmd()
+{
+ LOGMASKED(LOG_COMMANDS | LOG_ERRORS, "%s: Unimplemented SCSI controller command: %02x\n", machine().describe_context(), m_regs[WD_COMMAND]);
+
+ /* complete the command */
+ complete_cmd(CSR_INVALID);
+}
+
+void wd33c93_device::invalid_cmd()
+{
+ LOGMASKED(LOG_COMMANDS | LOG_ERRORS, "%s: Invalid SCSI controller command: %02x\n", machine().describe_context(), m_regs[WD_COMMAND]);
+
+ /* complete the command */
+ complete_cmd(CSR_INVALID);
+}
+
+void wd33c93_device::reset_cmd()
+{
+ int advanced = 0;
+
+ /* see if it wants us to reset with advanced features */
+ if (m_regs[WD_OWN_ID] & OWNID_EAF)
+ {
+ advanced = 1;
+ }
+
+ /* clear out all registers */
+ memset(m_regs, 0, sizeof(m_regs));
+
+ /* complete the command */
+ complete_cmd(advanced ? CSR_RESET_AF : CSR_RESET);
+}
+
+void wd33c93_device::abort_cmd()
+{
+ /* complete the command */
+ complete_cmd(CSR_ABORT);
+}
+
+void wd33c93_device::disconnect_cmd()
+{
+ /* complete the command */
+ m_regs[WD_AUXILIARY_STATUS] &= ~(ASR_CIP | ASR_BSY);
+}
+
+void wd33c93_device::select_cmd()
+{
+ uint8_t unit = getunit();
+ uint8_t newstatus;
+
+ /* see if we can select that device */
+ if (select(unit))
+ {
+ /* device is available - signal selection done */
+ newstatus = CSR_SELECT;
+
+ /* determine the next bus phase depending on the command */
+ if ((m_regs[WD_COMMAND] & 0x7f) == WD_CMD_SEL_ATN)
+ {
+ /* /ATN asserted during select: Move to Message Out Phase to read identify */
+ m_busphase = PHS_MESS_OUT;
+ }
+ else
+ {
+ /* No /ATN asserted: Move to Command Phase */
+ m_busphase = PHS_COMMAND;
+ }
+
+ /* queue up a service request out in the future */
+ m_service_req_timer->adjust( attotime::from_usec(50) );
+ }
+ else
+ {
+ /* device is not available */
+ newstatus = CSR_TIMEOUT;
+ }
+
+ /* complete the command */
+ complete_cmd(newstatus);
+}
+
+void wd33c93_device::selectxfer_cmd()
+{
+ uint8_t unit = getunit();
+ uint8_t newstatus;
+
+ /* see if we can select that device */
+ if (select(unit))
+ {
+ if (m_regs[WD_COMMAND_PHASE] < 0x45)
+ {
+ /* device is available */
+
+ /* do the request */
+ send_command(&m_regs[WD_CDB_1], 12);
+ int phase = get_phase();
+
+ /* set transfer count */
+ if (get_xfer_count() > TEMP_INPUT_LEN)
+ {
+ LOGMASKED(LOG_ERRORS, "WD33C93: Transfer count too big. Please increase TEMP_INPUT_LEN (size=%d)\n", get_xfer_count());
+ set_xfer_count(TEMP_INPUT_LEN);
+ }
+
+ switch (phase)
+ {
+ case SCSI_PHASE_DATAIN:
+ m_read_pending = true;
+ break;
+ }
+ }
+
+ if (m_read_pending)
+ {
+ int len = TEMP_INPUT_LEN;
+
+ if (get_xfer_count() < len)
+ len = get_xfer_count();
+
+ memset(&m_temp_input[0], 0, TEMP_INPUT_LEN);
+ read_data(&m_temp_input[0], len);
+ m_temp_input_pos = 0;
+ m_read_pending = false;
+ }
+
+ m_regs[WD_TARGET_LUN] = 0;
+ m_regs[WD_CONTROL] |= CTRL_EDI;
+ m_regs[WD_COMMAND_PHASE] = 0x60;
+
+ /* signal transfer ready */
+ newstatus = CSR_SEL_XFER_DONE;
+
+ /* if allowed disconnect, queue a service request */
+ if (m_identify & 0x40)
+ {
+ /* queue disconnect message in */
+ m_busphase = PHS_MESS_IN;
+
+ /* queue up a service request out in the future */
+ m_service_req_timer->adjust(attotime::from_usec(50));
+ }
+ }
+ else
+ {
+ /* device is not available */
+ newstatus = CSR_TIMEOUT;
+
+ set_xfer_count(0);
+ }
+
+ /* complete the command */
+ complete_cmd(newstatus);
+}
+
+void wd33c93_device::negate_ack()
+{
+ LOGMASKED(LOG_MISC, "WD33C93: ACK Negated\n");
+
+ /* complete the command */
+ m_regs[WD_AUXILIARY_STATUS] &= ~(ASR_CIP | ASR_BSY);
+}
+
+void wd33c93_device::xferinfo_cmd()
+{
+ /* make the buffer available right away */
+ m_regs[WD_AUXILIARY_STATUS] |= ASR_DBR;
+ m_regs[WD_AUXILIARY_STATUS] |= ASR_CIP;
+
+ /* the command will be completed once the data is transferred */
+ m_deassert_cip_timer->adjust(attotime::from_msec(1));
+}
+
+/* Handle pending commands */
+void wd33c93_device::dispatch_command()
+{
+ /* get the command */
+ uint8_t cmd = m_regs[WD_COMMAND] & 0x7f;
+
+ switch (cmd)
+ {
+ case WD_CMD_RESET:
+ LOGMASKED(LOG_COMMANDS, "WD33C93: %s - Reset Command\n", machine().describe_context());
+ reset_cmd();
+ break;
+
+ case WD_CMD_ABORT:
+ LOGMASKED(LOG_COMMANDS, "WD33C93: %s - Abort Command\n", machine().describe_context());
+ abort_cmd();
+ break;
+
+ case WD_CMD_NEGATE_ACK:
+ LOGMASKED(LOG_COMMANDS, "WD33C93: %s - Negate ACK Command\n", machine().describe_context());
+ negate_ack();
+ break;
+
+ case WD_CMD_DISCONNECT:
+ LOGMASKED(LOG_COMMANDS, "WD33C93: %s - Disconnect Command\n", machine().describe_context());
+ disconnect_cmd();
+ break;
+
+ case WD_CMD_SEL_ATN:
+ case WD_CMD_SEL:
+ LOGMASKED(LOG_COMMANDS, "WD33C93: %s - Select %sCommand\n", machine().describe_context(), cmd == WD_CMD_SEL_ATN ? "w/ ATN " : "");
+ select_cmd();
+ break;
+
+ case WD_CMD_SEL_ATN_XFER:
+ case WD_CMD_SEL_XFER:
+ LOGMASKED(LOG_COMMANDS, "WD33C93: %s - Select %sand Xfer Command\n", machine().describe_context(), cmd == WD_CMD_SEL_ATN ? "w/ ATN " : "");
+ selectxfer_cmd();
+ break;
+
+ case WD_CMD_TRANS_INFO:
+ LOGMASKED(LOG_COMMANDS, "WD33C93: %s - Transfer Info Command\n", machine().describe_context());
+ xferinfo_cmd();
+ break;
+
+ case WD_CMD_ASSERT_ATN:
+ case WD_CMD_RESELECT:
+ case WD_CMD_RESEL_RECEIVE:
+ case WD_CMD_RESEL_SEND:
+ case WD_CMD_WAIT_SEL_RECEIVE:
+ case WD_CMD_SSCC:
+ case WD_CMD_SND_DISC:
+ case WD_CMD_SET_IDI:
+ case WD_CMD_RCV_CMD:
+ case WD_CMD_RCV_DATA:
+ case WD_CMD_RCV_MSG_OUT:
+ case WD_CMD_RCV:
+ case WD_CMD_SND_STATUS:
+ case WD_CMD_SND_DATA:
+ case WD_CMD_SND_MSG_IN:
+ case WD_CMD_SND:
+ case WD_CMD_TRANS_ADDR:
+ case WD_CMD_XFER_PAD:
+ case WD_CMD_TRANSFER_PAD:
+ unimplemented_cmd();
+ break;
+
+ default:
+ invalid_cmd();
+ break;
+ }
+}
+
+WRITE8_MEMBER(wd33c93_device::write)
+{
+ switch (offset)
+ {
+ case 0:
+ {
+ /* update register select */
+ m_sasr = data & 0x1f;
+ }
+ break;
+
+ case 1:
+ {
+ /* update the register */
+ if (m_sasr != WD_SCSI_STATUS && m_sasr <= WD_QUEUE_TAG)
+ {
+ m_regs[m_sasr] = data;
+ }
+
+ switch (m_sasr)
+ {
+ case WD_OWN_ID:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Own ID Register (CDB Size) = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_CONTROL:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Control Register = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_TIMEOUT_PERIOD:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Timeout Period Register = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_CDB_1:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Total Sectors Register (CDB1) = %02x\n", machine().describe_context(), m_sasr, data);
+ m_regs[WD_COMMAND_PHASE] = 0;
+ break;
+ case WD_CDB_2:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Total Heads Register (CDB2) = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_CDB_3:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Total Cylinders Register MSB (CDB3) = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_CDB_4:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Total Cylinders Register LSB (CDB4) = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_CDB_5:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Logical Address Register MSB (CDB5) = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_CDB_6:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Logical Address Register 2nd (CDB6) = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_CDB_7:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Logical Address Register 3rd (CDB7) = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_CDB_8:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Logical Address Register LSB (CDB8) = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_CDB_9:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Sector Number Register (CDB9) = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_CDB_10:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Head Number Register (CDB10) = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_CDB_11:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Cylinder Number Register MSB (CDB11) = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_CDB_12:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Cylinder Number Register LSB (CDB12) = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_TARGET_LUN:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Target LUN Register = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_COMMAND_PHASE:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Command Phase Register = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_SYNCHRONOUS_TRANSFER:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Synchronous Transfer Register = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_TRANSFER_COUNT_MSB:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Transfer Count Register MSB = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_TRANSFER_COUNT:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Transfer Count Register 2nd = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_TRANSFER_COUNT_LSB:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Transfer Count Register LSB = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_DESTINATION_ID:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Destination ID Register = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_SOURCE_ID:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Source ID Register = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_SCSI_STATUS:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, SCSI Status Register (read-only!) = %02x (ignored)\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_COMMAND:
+ /* if we receive a command, schedule to process it */
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Command Register = %02x - unit %d\n", machine().describe_context(), m_sasr, data, getunit());
+
+ /* signal we're processing it */
+ m_regs[WD_AUXILIARY_STATUS] |= ASR_CIP;
+
+ /* process the command */
+ dispatch_command();
+ break;
+ case WD_DATA:
+ {
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Data Register = %02x\n", machine().describe_context(), m_sasr, data);
+
+ /* if data was written, and we have a count, send to device */
+ int count = get_xfer_count();
+
+ if (m_regs[WD_COMMAND] & 0x80)
+ count = 1;
+
+ if (count-- > 0)
+ {
+ /* write to FIFO */
+ if (m_fifo_pos < FIFO_SIZE)
+ {
+ m_fifo[m_fifo_pos++] = data;
+ }
+
+ /* update count */
+ set_xfer_count(count);
+
+ /* if we're done with the write, see where we're at */
+ if (count == 0)
+ {
+ m_regs[WD_AUXILIARY_STATUS] |= ASR_INT;
+ m_regs[WD_AUXILIARY_STATUS] &= ~ASR_DBR;
+
+ switch (m_busphase)
+ {
+ case PHS_MESS_OUT:
+ {
+ /* reset fifo */
+ m_fifo_pos = 0;
+
+ /* Message out phase. Data is probably SCSI Identify. Move to command phase. */
+ m_busphase = PHS_COMMAND;
+
+ m_identify = m_fifo[0];
+ }
+ break;
+
+ case PHS_COMMAND:
+ {
+ /* Execute the command. Depending on the command, we'll move to data in or out */
+ send_command(&m_fifo[0], 12);
+ int xfercount = get_length();
+ int phase = get_phase();
+
+ /* reset fifo */
+ m_fifo_pos = 0;
+
+ /* set the new count */
+ set_xfer_count(xfercount);
+
+ switch (phase)
+ {
+ case SCSI_PHASE_STATUS:
+ m_busphase = PHS_STATUS;
+ break;
+
+ case SCSI_PHASE_DATAIN:
+ m_busphase = PHS_DATA_IN;
+ m_read_pending = true;
+ break;
+
+ case SCSI_PHASE_DATAOUT:
+ m_busphase = PHS_DATA_OUT;
+ break;
+ }
+ }
+ break;
+
+ case PHS_DATA_OUT:
+ {
+ /* write data out to device */
+ write_data(m_fifo, m_fifo_pos);
+
+ /* reset fifo */
+ m_fifo_pos = 0;
+
+ /* move to status phase */
+ m_busphase = PHS_STATUS;
+ }
+ break;
+ }
+
+ /* complete the command */
+ complete_immediate(CSR_XFER_DONE | m_busphase);
+ }
+ }
+ else
+ {
+ LOGMASKED(LOG_MISC | LOG_ERRORS, "WD33C93: Sending data to device with transfer count = 0!. Ignoring...\n");
+ }
+ break;
+ }
+ case WD_QUEUE_TAG:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Queue Tag Register = %02x\n", machine().describe_context(), m_sasr, data);
+ break;
+ case WD_AUXILIARY_STATUS:
+ LOGMASKED(LOG_WRITES, "WD33C93: %s - Write Register %02x, Auxiliary Status Register (read-only!) = %02x (ignored)\n", machine().describe_context(), m_sasr, data);
+ break;
+ default:
+ LOGMASKED(LOG_WRITES | LOG_ERRORS, "WD33C93: %s - Write Register %02x, Unknown = %02x (ignored)\n", machine().describe_context(), m_sasr, data);
+ break;
+ }
+
+ /* auto-increment register select if not on special registers */
+ if (m_sasr != WD_COMMAND && m_sasr != WD_DATA && m_sasr != WD_AUXILIARY_STATUS)
+ {
+ m_sasr = (m_sasr + 1) & 0x1f;
+ }
+ }
+ break;
+
+ default:
+ {
+ LOGMASKED(LOG_ERRORS, "WD33C93: Write to invalid offset %d (data=%02x)\n", offset, data);
+ }
+ break;
+ }
+}
+
+READ8_MEMBER(wd33c93_device::read)
+{
+ switch (offset)
+ {
+ case 0:
+ /* read aux status */
+ return m_regs[WD_AUXILIARY_STATUS];
+
+ case 1:
+ {
+ switch (m_sasr)
+ {
+ case WD_OWN_ID:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Own ID Register (CDB Size) (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_CONTROL:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Control Register (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_TIMEOUT_PERIOD:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Timeout Period Register (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_CDB_1:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Total Sectors Register (CDB1) (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ m_regs[WD_COMMAND_PHASE] = 0;
+ break;
+ case WD_CDB_2:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Total Heads Register (CDB2) (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_CDB_3:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Total Cylinders Register MSB (CDB3) (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_CDB_4:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Total Cylinders Register LSB (CDB4) (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_CDB_5:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Logical Address Register MSB (CDB5) (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_CDB_6:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Logical Address Register 2nd (CDB6) (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_CDB_7:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Logical Address Register 3rd (CDB7) (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_CDB_8:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Logical Address Register LSB (CDB8) (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_CDB_9:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Sector Number Register (CDB9) (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_CDB_10:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Head Number Register (CDB10) (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_CDB_11:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Cylinder Number Register MSB (CDB11) (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_CDB_12:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Cylinder Number Register LSB (CDB12) (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_TARGET_LUN:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Target LUN Register (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_COMMAND_PHASE:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Command Phase Register (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_SYNCHRONOUS_TRANSFER:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Synchronous Transfer Register (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_TRANSFER_COUNT_MSB:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Transfer Count Register MSB (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_TRANSFER_COUNT:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Transfer Count Register 2nd (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_TRANSFER_COUNT_LSB:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Transfer Count Register LSB (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_DESTINATION_ID:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Destination ID Register (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_SOURCE_ID:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Source ID Register (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_SCSI_STATUS:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, SCSI Status Register (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ m_regs[WD_AUXILIARY_STATUS] &= ~ASR_INT;
+
+ /* if reading status, clear irq flag */
+ if (!m_irq_cb.isnull())
+ {
+ m_irq_cb(0);
+ }
+ break;
+ case WD_COMMAND:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Command Register (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_DATA:
+ {
+ /* we're going to be doing synchronous reads */
+
+ /* get the transfer count */
+ int count = get_xfer_count();
+
+ /* initialize the return value */
+ m_regs[WD_DATA] = 0;
+
+ if (count <= 0 && m_busphase == PHS_MESS_IN)
+ {
+ /* move to disconnect */
+ complete_cmd(CSR_DISC);
+ }
+ else if (count == 1 && m_busphase == PHS_STATUS)
+ {
+ /* update the count */
+ set_xfer_count(0);
+
+ /* move to message in phase */
+ m_busphase = PHS_MESS_IN;
+
+ /* complete the command */
+ complete_cmd(CSR_XFER_DONE | m_busphase);
+ }
+ else if (count-- > 0) /* make sure we still have data to send */
+ {
+ if (m_read_pending)
+ {
+ int len = TEMP_INPUT_LEN;
+
+ if ((count + 1) < len )
+ len = count + 1;
+ read_data(&m_temp_input[0], len);
+ m_temp_input_pos = 0;
+ m_read_pending = false;
+ }
+
+ m_regs[WD_AUXILIARY_STATUS] &= ~ASR_INT;
+
+ /* read in one byte */
+ if (m_temp_input_pos < TEMP_INPUT_LEN)
+ m_regs[WD_DATA] = m_temp_input[m_temp_input_pos++];
+
+ /* update the count */
+ set_xfer_count(count);
+
+ /* transfer finished, see where we're at */
+ if (count == 0)
+ {
+ if (m_regs[WD_COMMAND_PHASE] != 0x60)
+ {
+ /* move to status phase */
+ m_busphase = PHS_STATUS;
+
+ /* complete the command */
+ complete_cmd(CSR_XFER_DONE | m_busphase);
+ }
+ else
+ {
+ m_regs[WD_AUXILIARY_STATUS] |= ASR_INT;
+ m_regs[WD_AUXILIARY_STATUS] &= ~ASR_DBR;
+ }
+ }
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Data Register (%02x)\n", machine().describe_context(), WD_DATA, m_regs[WD_DATA]);
+ }
+ break;
+ }
+ case WD_QUEUE_TAG:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Queue Tag Register (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ case WD_AUXILIARY_STATUS:
+ LOGMASKED(LOG_READS, "WD33C93: %s - Read Register %02x, Auxiliary Status Register (%02x)\n", machine().describe_context(), m_sasr, m_regs[m_sasr]);
+ break;
+ default:
+ LOGMASKED(LOG_READS | LOG_ERRORS, "WD33C93: %s - Read Register %02x, Unknown\n", machine().describe_context(), m_sasr);
+ break;
+ }
+
+ /* get the register value */
+ uint8_t ret = 0xff;
+ if (m_sasr == WD_AUXILIARY_STATUS || m_sasr <= WD_QUEUE_TAG)
+ ret = m_regs[m_sasr];
+
+ /* auto-increment register select if not on special registers */
+ if (m_sasr != WD_COMMAND && m_sasr != WD_DATA && m_sasr != WD_AUXILIARY_STATUS)
+ {
+ m_sasr = (m_sasr + 1) & 0x1f;
+ }
+
+ return ret;
+ }
+
+ default:
+ LOGMASKED(LOG_READS | LOG_ERRORS, "WD33C93: Read from invalid offset %d\n", offset);
+ break;
+ }
+
+ return 0;
+}
+
+wd33c93_device::wd33c93_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ legacy_scsi_host_adapter(mconfig, WD33C93, tag, owner, clock),
+ m_irq_cb(*this)
+{
+}
+
+void wd33c93_device::device_start()
+{
+ legacy_scsi_host_adapter::device_start();
+
+ memset(m_regs, 0, sizeof(m_regs));
+ memset(m_fifo, 0, sizeof(m_fifo));
+ memset(m_temp_input, 0, sizeof(m_temp_input));
+
+ m_sasr = 0;
+ m_fifo_pos = 0;
+ m_temp_input_pos = 0;
+ m_busphase = 0;
+ m_identify = 0;
+ m_read_pending = 0;
+
+ m_irq_cb.resolve();
+
+ /* allocate a timer for commands */
+ m_cmd_timer = timer_alloc(0);
+ m_service_req_timer = timer_alloc(1);
+ m_deassert_cip_timer = timer_alloc(2);
+
+ save_item(NAME(m_sasr));
+ save_item(NAME(m_regs));
+ save_item(NAME(m_fifo));
+ save_item(NAME(m_fifo_pos));
+ save_item(NAME(m_temp_input));
+ save_item(NAME(m_temp_input_pos));
+ save_item(NAME(m_busphase));
+ save_item(NAME(m_identify));
+ save_item(NAME(m_read_pending));
+}
+
+int wd33c93_device::dma_read_data(int bytes, uint8_t *data)
+{
+ int len = bytes;
+
+ if (len >= get_xfer_count())
+ len = get_xfer_count();
+
+ if (len == 0)
+ return 0;
+
+ if ((m_temp_input_pos + len) >= TEMP_INPUT_LEN)
+ {
+ LOGMASKED(LOG_ERRORS, "Reading past end of buffer, increase TEMP_INPUT_LEN size\n");
+ len = TEMP_INPUT_LEN - len;
+ }
+
+ assert(len);
+
+ memcpy(data, &m_temp_input[m_temp_input_pos], len);
+
+ m_temp_input_pos += len;
+ set_xfer_count(get_xfer_count() - len);
+ return len;
+}
+
+void wd33c93_device::dma_write_data(int bytes, uint8_t *data)
+{
+ write_data(data, bytes);
+}
+
+void wd33c93_device::clear_dma()
+{
+ /* indicate DMA completed by clearing the transfer count */
+ set_xfer_count(0);
+ m_regs[WD_AUXILIARY_STATUS] &= ~ASR_DBR;
+}
+
+int wd33c93_device::get_dma_count()
+{
+ return get_xfer_count();
+}
+
+DEFINE_DEVICE_TYPE(WD33C93, wd33c93_device, "wd33c93", "Western Digital WD33C93 SCSI")
diff --git a/src/devices/machine/wd33c93.h b/src/devices/machine/wd33c93.h
new file mode 100644
index 00000000000..b4a883afca4
--- /dev/null
+++ b/src/devices/machine/wd33c93.h
@@ -0,0 +1,112 @@
+// license:BSD-3-Clause
+// copyright-holders:ElSemi, R. Belmont, Ryan Holtz
+/*
+ * wd33c93.h
+ *
+ */
+
+#ifndef MAME_MACHINE_WD33C93_H
+#define MAME_MACHINE_WD33C93_H
+
+#pragma once
+
+#include "legscsi.h"
+
+class wd33c93_device : public legacy_scsi_host_adapter
+{
+public:
+ // construction/destruction
+ wd33c93_device(const machine_config &mconfig, const char *tag, device_t *owner)
+ : wd33c93_device(mconfig, tag, owner, (uint32_t)0)
+ {
+ }
+
+ wd33c93_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ auto irq_cb() { return m_irq_cb.bind(); }
+
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
+
+ int dma_read_data(int bytes, uint8_t *data);
+ void dma_write_data(int bytes, uint8_t *data);
+ void clear_dma();
+ int get_dma_count();
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
+private:
+ // wd register names
+ enum
+ {
+ WD_OWN_ID = 0x00,
+ WD_CONTROL = 0x01,
+ WD_TIMEOUT_PERIOD = 0x02,
+ WD_CDB_1 = 0x03,
+ WD_CDB_2 = 0x04,
+ WD_CDB_3 = 0x05,
+ WD_CDB_4 = 0x06,
+ WD_CDB_5 = 0x07,
+ WD_CDB_6 = 0x08,
+ WD_CDB_7 = 0x09,
+ WD_CDB_8 = 0x0a,
+ WD_CDB_9 = 0x0b,
+ WD_CDB_10 = 0x0c,
+ WD_CDB_11 = 0x0d,
+ WD_CDB_12 = 0x0e,
+ WD_TARGET_LUN = 0x0f,
+ WD_COMMAND_PHASE = 0x10,
+ WD_SYNCHRONOUS_TRANSFER = 0x11,
+ WD_TRANSFER_COUNT_MSB = 0x12,
+ WD_TRANSFER_COUNT = 0x13,
+ WD_TRANSFER_COUNT_LSB = 0x14,
+ WD_DESTINATION_ID = 0x15,
+ WD_SOURCE_ID = 0x16,
+ WD_SCSI_STATUS = 0x17,
+ WD_COMMAND = 0x18,
+ WD_DATA = 0x19,
+ WD_QUEUE_TAG = 0x1a,
+ WD_AUXILIARY_STATUS = 0x1f
+ };
+
+ static constexpr int TEMP_INPUT_LEN = 262144;
+ static constexpr int FIFO_SIZE = 12;
+
+ uint8_t getunit();
+ void set_xfer_count(int count);
+ int get_xfer_count();
+ void complete_immediate(int status);
+ void complete_cmd(uint8_t status);
+ void unimplemented_cmd();
+ void invalid_cmd();
+ void reset_cmd();
+ void abort_cmd();
+ void disconnect_cmd();
+ void select_cmd();
+ void selectxfer_cmd();
+ void negate_ack();
+ void xferinfo_cmd();
+ void dispatch_command();
+
+ uint8_t m_sasr;
+ uint8_t m_regs[WD_AUXILIARY_STATUS+1];
+ uint8_t m_fifo[FIFO_SIZE];
+ int m_fifo_pos;
+ uint8_t m_temp_input[TEMP_INPUT_LEN];
+ int m_temp_input_pos;
+ uint8_t m_busphase;
+ uint8_t m_identify;
+ bool m_read_pending;
+ emu_timer *m_cmd_timer;
+ emu_timer *m_service_req_timer;
+ emu_timer *m_deassert_cip_timer;
+ devcb_write_line m_irq_cb; /* irq callback */
+};
+
+// device type definition
+DECLARE_DEVICE_TYPE(WD33C93, wd33c93_device)
+
+#endif // MAME_MACHINE_WD33C93_H
diff --git a/src/devices/machine/wd33c9x.cpp b/src/devices/machine/wd33c9x.cpp
index d425a9249b9..2ef063ad449 100644
--- a/src/devices/machine/wd33c9x.cpp
+++ b/src/devices/machine/wd33c9x.cpp
@@ -29,7 +29,8 @@
#define LOG_REGS (LOG_READS | LOG_WRITES)
#define LOG_ALL (LOG_REGS | LOG_COMMANDS | LOG_ERRORS | LOG_MISC | LOG_LINES | LOG_STATE | LOG_STEP)
-#define VERBOSE (0)
+#define VERBOSE (LOG_COMMANDS | LOG_ERRORS | LOG_STATE)
+#define LOG_OUTPUT_FUNC printf
#include "logmacro.h"
enum register_addresses_e : uint8_t {
@@ -278,27 +279,6 @@ enum : uint16_t {
INIT_CPT_RECV_BYTE_NACK
};
-const char *const wd33c9x_base_device::state_names[] = {
- "-",
- "IDLE",
- "FINISHED",
- "DISC_SEL_ARBITRATION",
- "INIT_MSG_WAIT_REQ",
- "INIT_XFR",
- "INIT_XFR_SEND_PAD_WAIT_REQ",
- "INIT_XFR_SEND_PAD",
- "INIT_XFR_RECV_PAD_WAIT_REQ",
- "INIT_XFR_RECV_PAD",
- "INIT_XFR_RECV_BYTE_ACK",
- "INIT_XFR_RECV_BYTE_NACK",
- "INIT_XFR_FUNCTION_COMPLETE",
- "INIT_XFR_BUS_COMPLETE",
- "INIT_XFR_WAIT_REQ",
- "INIT_CPT_RECV_BYTE_ACK",
- "INIT_CPT_RECV_WAIT_REQ",
- "INIT_CPT_RECV_BYTE_NACK",
-};
-
enum : uint16_t {
// Arbitration
ARB_WAIT_BUS_FREE = 1,
@@ -319,24 +299,6 @@ enum : uint16_t {
RECV_WAIT_REQ_0
};
-const char *const wd33c9x_base_device::substate_names[] = {
- "-",
- "ARB_WAIT_BUS_FREE",
- "ARB_CHECK_FREE",
- "ARB_EXAMINE_BUS",
- "ARB_ASSERT_SEL",
- "ARB_SET_DEST",
- "ARB_RELEASE_BUSY",
- "ARB_TIMEOUT_BUSY",
- "ARB_TIMEOUT_ABORT",
- "ARB_DESKEW_WAIT",
- "SEND_WAIT_SETTLE",
- "SEND_WAIT_REQ_0",
- "RECV_WAIT_REQ_1",
- "RECV_WAIT_SETTLE",
- "RECV_WAIT_REQ_0",
-};
-
enum : uint16_t {
STATE_MASK = 0x00ff,
SUB_SHIFT = 8,
@@ -348,8 +310,8 @@ enum : uint16_t {
// LIVE DEVICE
//**************************************************************************
-DEFINE_DEVICE_TYPE(WD33C92, wd33c92_device, "wd33c92", "Western Digital WD33C92 SCSI Controller")
-DEFINE_DEVICE_TYPE(WD33C93, wd33c93_device, "wd33c93", "Western Digital WD33C93 SCSI Controller")
+DEFINE_DEVICE_TYPE(WD33C92, wd33c92_device, "wd33c92", "Western Digital WD33C92 SCSI Controller")
+DEFINE_DEVICE_TYPE(WD33C93N, wd33c93n_device, "wd33c93", "Western Digital WD33C93 SCSI Controller")
DEFINE_DEVICE_TYPE(WD33C93A, wd33c93a_device, "wd33c93a", "Western Digital WD33C93A SCSI Controller")
DEFINE_DEVICE_TYPE(WD33C93B, wd33c93b_device, "wd33c93b", "Western Digital WD33C93B SCSI Controller")
@@ -362,10 +324,10 @@ wd33c9x_base_device::wd33c9x_base_device(const machine_config &mconfig, device_t
, m_addr{ 0 }
, m_regs{ 0 }
, m_command_length{ 0 }
- , m_last_message{ 0 }
, m_scsi_state{ IDLE }
, m_mode{ MODE_D }
, m_xfr_phase{ 0 }
+ , m_step_count{ 0 }
, m_transfer_count{ 0 }
, m_data_fifo{ 0 }
, m_data_fifo_pos{ 0 }
@@ -393,10 +355,10 @@ void wd33c9x_base_device::device_start()
save_item(NAME(m_addr));
save_item(NAME(m_regs));
save_item(NAME(m_command_length));
- save_item(NAME(m_last_message));
save_item(NAME(m_mode));
save_item(NAME(m_scsi_state));
save_item(NAME(m_xfr_phase));
+ save_item(NAME(m_step_count));
save_item(NAME(m_transfer_count));
save_item(NAME(m_data_fifo));
save_item(NAME(m_data_fifo_pos));
@@ -422,10 +384,10 @@ void wd33c9x_base_device::device_reset()
m_regs[reg] = (QUEUE_TAG <= reg && reg <= INVALID_1E) ? 0xff : 0;
}
m_command_length = 0;
- m_last_message = 0;
set_scsi_state(IDLE);
m_mode = MODE_D;
m_xfr_phase = 0;
+ m_step_count = 0;
m_transfer_count = 0;
data_fifo_reset();
irq_fifo_reset();
@@ -470,10 +432,10 @@ void wd33c9x_base_device::scsi_ctrl_changed()
// dir_r
//-------------------------------------------------
-uint8_t wd33c9x_base_device::dir_r(offs_t offset)
+READ8_MEMBER(wd33c9x_base_device::dir_r)
{
m_addr = offset & REGS_MASK;
- return indir_reg_r();
+ return indir_reg_r(space, 0, mem_mask);
}
@@ -481,10 +443,10 @@ uint8_t wd33c9x_base_device::dir_r(offs_t offset)
// dir_w
//-------------------------------------------------
-void wd33c9x_base_device::dir_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(wd33c9x_base_device::dir_w)
{
m_addr = offset & REGS_MASK;
- indir_reg_w(data);
+ indir_reg_w(space, 0, data, mem_mask);
}
@@ -492,15 +454,15 @@ void wd33c9x_base_device::dir_w(offs_t offset, uint8_t data)
// indir_r
//-------------------------------------------------
-uint8_t wd33c9x_base_device::indir_r(offs_t offset)
+READ8_MEMBER(wd33c9x_base_device::indir_r)
{
switch (offset) {
case 0:
- return indir_addr_r();
+ return indir_addr_r(space, 0, mem_mask);
case 1:
- return indir_reg_r();
+ return indir_reg_r(space, 0, mem_mask);
default:
- LOGMASKED(LOG_READS | LOG_ERRORS, "Read from invalid offset %d\n", offset);
+ LOGMASKED(LOG_READS | LOG_ERRORS, "%s: Read from invalid offset %d\n", shortname(), offset);
break;
}
return 0;
@@ -511,17 +473,17 @@ uint8_t wd33c9x_base_device::indir_r(offs_t offset)
// indir_w
//-------------------------------------------------
-void wd33c9x_base_device::indir_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER(wd33c9x_base_device::indir_w)
{
switch (offset) {
case 0:
- indir_addr_w(data);
+ indir_addr_w(space, 0, data, mem_mask);
break;
case 1:
- indir_reg_w(data);
+ indir_reg_w(space, 0, data, mem_mask);
break;
default:
- LOGMASKED(LOG_WRITES | LOG_ERRORS, "Write to invalid offset %d (data=%02x)\n", offset, data);
+ LOGMASKED(LOG_WRITES | LOG_ERRORS, "%s: Write to invalid offset %d (data=%02x)\n", shortname(), offset, data);
break;
}
}
@@ -531,10 +493,13 @@ void wd33c9x_base_device::indir_w(offs_t offset, uint8_t data)
// indir_addr_r
//-------------------------------------------------
-uint8_t wd33c9x_base_device::indir_addr_r()
+READ8_MEMBER(wd33c9x_base_device::indir_addr_r)
{
- // Trick to push the interrupt flag after the fifo is empty to help cps3
- return m_regs[AUXILIARY_STATUS] & 0x01 ? m_regs[AUXILIARY_STATUS] & 0x7f : m_regs[AUXILIARY_STATUS];
+ if (offset != 0) {
+ fatalerror("%s: Read from invalid address offset %d\n", shortname(), offset);
+ }
+ step(false);
+ return m_regs[AUXILIARY_STATUS];
}
@@ -542,8 +507,11 @@ uint8_t wd33c9x_base_device::indir_addr_r()
// indir_addr_w
//-------------------------------------------------
-void wd33c9x_base_device::indir_addr_w(uint8_t data)
+WRITE8_MEMBER(wd33c9x_base_device::indir_addr_w)
{
+ if (offset != 0) {
+ fatalerror("%s: Write to invalid address offset %d (data=%02x)\n", shortname(), offset, data);
+ }
m_addr = data & REGS_MASK;
}
@@ -552,11 +520,15 @@ void wd33c9x_base_device::indir_addr_w(uint8_t data)
// indir_reg_r
//-------------------------------------------------
-uint8_t wd33c9x_base_device::indir_reg_r()
+READ8_MEMBER(wd33c9x_base_device::indir_reg_r)
{
+ if (offset != 0) {
+ fatalerror("%s: Read from invalid indirect register offset %d\n", shortname(), offset);
+ }
+
uint8_t ret;
switch (m_addr) {
- case DATA: {
+ case DATA:
if (!(m_regs[AUXILIARY_STATUS] & AUXILIARY_STATUS_DBR)) {
// The processor, except in one case, should only
// access the Data Register when the DBR bit in the
@@ -567,14 +539,9 @@ uint8_t wd33c9x_base_device::indir_reg_r()
// Data Register.
fatalerror("%s: The host should never access the data register without DBR set.\n", shortname());
}
- bool was_full = data_fifo_full();
ret = data_fifo_pop();
- if (data_fifo_empty())
- m_regs[AUXILIARY_STATUS] &= ~AUXILIARY_STATUS_DBR;
- if (was_full)
- step(false);
+ m_regs[AUXILIARY_STATUS] &= ~AUXILIARY_STATUS_DBR;
break;
- }
default:
if (m_addr == OWN_ID) {
@@ -604,8 +571,12 @@ uint8_t wd33c9x_base_device::indir_reg_r()
// indir_reg_w
//-------------------------------------------------
-void wd33c9x_base_device::indir_reg_w(uint8_t data)
+WRITE8_MEMBER(wd33c9x_base_device::indir_reg_w)
{
+ if (offset != 0) {
+ fatalerror("%s: Write to invalid indirect register offset %d (data=%02x)\n", shortname(), offset, data);
+ }
+
switch (m_addr) {
case SCSI_STATUS:
case QUEUE_TAG: // Only for 92/93 and 93A
@@ -614,7 +585,7 @@ void wd33c9x_base_device::indir_reg_w(uint8_t data)
case INVALID_1D:
case INVALID_1E:
case AUXILIARY_STATUS:
- LOGMASKED(LOG_WRITES | LOG_ERRORS, "Write to read-only register address %d (data=%02x)\n", m_addr, data);
+ LOGMASKED(LOG_WRITES | LOG_ERRORS, "%s: Write to read-only register address %d (data=%02x)\n", shortname(), m_addr, data);
break;
case COMMAND: {
@@ -666,7 +637,7 @@ void wd33c9x_base_device::indir_reg_w(uint8_t data)
WRITE_LINE_MEMBER(wd33c9x_base_device::reset_w)
{
if (state) {
- LOGMASKED(LOG_LINES, "Reset via MR line\n");
+ LOGMASKED(LOG_LINES, "%s: Reset via MR line\n", shortname());
device_reset();
}
}
@@ -724,7 +695,7 @@ void wd33c9x_base_device::start_command()
switch (cc) {
case COMMAND_CC_RESET:
- LOGMASKED(LOG_COMMANDS, "Reset Command\n");
+ LOGMASKED(LOG_COMMANDS, "%s: Reset Command\n", shortname());
scsi_bus->ctrl_w(scsi_refid, 0, S_ALL);
scsi_bus->ctrl_wait(scsi_refid, S_SEL|S_BSY|S_RST, S_ALL);
m_regs[OWN_ID] = m_command_length;
@@ -738,18 +709,17 @@ void wd33c9x_base_device::start_command()
set_scsi_state(FINISHED);
irq_fifo_push((m_regs[OWN_ID] & OWN_ID_EAF) ? SCSI_STATUS_RESET_EAF : SCSI_STATUS_RESET);
scsi_id = (m_regs[OWN_ID] & OWN_ID_SCSI_ID);
- step(false);
break;
case COMMAND_CC_ABORT:
- LOGMASKED(LOG_COMMANDS, "Abort Command\n");
+ LOGMASKED(LOG_COMMANDS, "%s: Abort Command\n", shortname());
set_scsi_state(FINISHED);
// FIXME
irq_fifo_push((m_regs[OWN_ID] & OWN_ID_EAF) ? SCSI_STATUS_RESET_EAF : SCSI_STATUS_RESET);
break;
case COMMAND_CC_ASSERT_ATN:
- LOGMASKED(LOG_COMMANDS, "Assert ATN Command\n");
+ LOGMASKED(LOG_COMMANDS, "%s: Assert ATN Command\n", shortname());
if (m_mode != MODE_I) {
fatalerror("%s: ASSERT_ATN command only valid in the Initiator state.", shortname());
}
@@ -757,7 +727,7 @@ void wd33c9x_base_device::start_command()
return;
case COMMAND_CC_NEGATE_ACK:
- LOGMASKED(LOG_COMMANDS, "Negate ACK Command\n");
+ LOGMASKED(LOG_COMMANDS, "%s: Negate ACK Command\n", shortname());
// FIXME - This is causing problems, so ignore for now.
//if (m_mode != MODE_I) {
// fatalerror("NEGATE_ACK command only valid in the Initiator state.");
@@ -766,27 +736,26 @@ void wd33c9x_base_device::start_command()
return;
case COMMAND_CC_DISCONNECT:
- LOGMASKED(LOG_COMMANDS, "Disconnect Command\n");
+ LOGMASKED(LOG_COMMANDS, "%s: Disconnect Command\n", shortname());
scsi_bus->ctrl_w(scsi_refid, 0, S_ALL);
scsi_bus->ctrl_wait(scsi_refid, S_SEL|S_BSY|S_RST, S_ALL);
m_mode = MODE_D;
- set_scsi_state(IDLE);
- m_regs[AUXILIARY_STATUS] &= ~(AUXILIARY_STATUS_CIP | AUXILIARY_STATUS_BSY);
+ set_scsi_state(FINISHED);
+ irq_fifo_push(SCSI_STATUS_DISCONNECT);
break;
case COMMAND_CC_SELECT:
case COMMAND_CC_SELECT_ATN:
- LOGMASKED(LOG_COMMANDS, "%s Command\n", select_strings[cc - COMMAND_CC_SELECT_ATN]);
+ LOGMASKED(LOG_COMMANDS, "%s: %s Command\n", shortname(), select_strings[cc - COMMAND_CC_SELECT_ATN]);
if (m_mode != MODE_D) {
fatalerror("Select commands only valid in the Disconnected state.");
}
set_scsi_state((ARB_WAIT_BUS_FREE << SUB_SHIFT) | DISC_SEL_ARBITRATION);
- step(false);
break;
case COMMAND_CC_SELECT_TRANSFER:
case COMMAND_CC_SELECT_ATN_TRANSFER:
- LOGMASKED(LOG_COMMANDS, "%s Command\n", select_strings[cc - COMMAND_CC_SELECT_ATN]);
+ LOGMASKED(LOG_COMMANDS, "%s: %s Command\n", shortname(), select_strings[cc - COMMAND_CC_SELECT_ATN]);
if (m_mode == MODE_D) {
set_scsi_state((ARB_WAIT_BUS_FREE << SUB_SHIFT) | DISC_SEL_ARBITRATION);
m_regs[COMMAND_PHASE] = COMMAND_PHASE_ZERO;
@@ -799,11 +768,10 @@ void wd33c9x_base_device::start_command()
}
set_command_length(cc);
load_transfer_count();
- step(false);
break;
case COMMAND_CC_TRANSFER_INFO:
- LOGMASKED(LOG_COMMANDS, "Transfer Info Command\n");
+ LOGMASKED(LOG_COMMANDS, "%s: Transfer Info Command\n", shortname());
if (m_mode != MODE_I) {
fatalerror("%s: TRANSFER_INFO command only valid in the Initiator state.", shortname());
}
@@ -819,6 +787,8 @@ void wd33c9x_base_device::start_command()
fatalerror("%s: Unimplemented command: 0x%02x", shortname(), cc);
break;
}
+
+ delay(1);
}
@@ -840,533 +810,563 @@ static const char * phase_strings[8] = {
void wd33c9x_base_device::step(bool timeout)
{
+ if (++m_step_count > 1) {
+ return;
+ }
+
const uint8_t cc = (m_regs[COMMAND] & COMMAND_CC);
const bool sat = (cc == COMMAND_CC_SELECT_TRANSFER || cc == COMMAND_CC_SELECT_ATN_TRANSFER);
- const uint32_t ctrl = scsi_bus->ctrl_r();
- const uint32_t data = scsi_bus->data_r();
-
- LOGMASKED(LOG_STEP,
- "%s: step - PHASE:%s BSY:%x SEL:%x REQ:%x ACK:%x ATN:%x RST:%x DATA:%02x (%s.%s) %s\n",
- shortname(),
- phase_strings[ctrl & S_PHASE_MASK],
- (ctrl & S_BSY) ? 1 : 0,
- (ctrl & S_SEL) ? 1 : 0,
- (ctrl & S_REQ) ? 1 : 0,
- (ctrl & S_ACK) ? 1 : 0,
- (ctrl & S_ATN) ? 1 : 0,
- (ctrl & S_RST) ? 1 : 0,
- data,
- state_names[m_scsi_state & STATE_MASK], substate_names[m_scsi_state >> SUB_SHIFT],
- (timeout) ? "timeout" : "change"
- );
-
- if (m_mode == MODE_I) {
- if (ctrl & S_BSY) {
- if (ctrl & S_REQ) {
- uint8_t xfr_phase = (ctrl & S_PHASE_MASK);
- switch (m_scsi_state) {
- case DISC_SEL_ARBITRATION:
- m_xfr_phase = xfr_phase;
- break;
+ uint32_t cycles = 0;
+ do {
+ const uint32_t ctrl = scsi_bus->ctrl_r();
+ const uint32_t data = scsi_bus->data_r();
+
+ m_step_count = 1;
+
+ LOGMASKED(LOG_STEP,
+ "%s: step - PHASE:%s BSY:%x SEL:%x REQ:%x ACK:%x ATN:%x RST:%x DATA:%x (%d.%d) %s\n",
+ shortname(),
+ phase_strings[ctrl & S_PHASE_MASK],
+ (ctrl & S_BSY) ? 1 : 0,
+ (ctrl & S_SEL) ? 1 : 0,
+ (ctrl & S_REQ) ? 1 : 0,
+ (ctrl & S_ACK) ? 1 : 0,
+ (ctrl & S_ATN) ? 1 : 0,
+ (ctrl & S_RST) ? 1 : 0,
+ data,
+ m_scsi_state & STATE_MASK, m_scsi_state >> SUB_SHIFT,
+ (timeout) ? "timeout" : "change"
+ );
- case INIT_XFR_WAIT_REQ:
- break;
+ if (m_mode == MODE_I) {
+ if (ctrl & S_BSY) {
+ if (ctrl & S_REQ) {
+ uint8_t xfr_phase = (ctrl & S_PHASE_MASK);
+ switch (m_scsi_state) {
+ case DISC_SEL_ARBITRATION:
+ m_xfr_phase = xfr_phase;
+ break;
- default:
- if (m_xfr_phase != xfr_phase) {
- fatalerror("%s: Unexpected phase change during state.\n", shortname());
+ case INIT_XFR_WAIT_REQ:
+ break;
+
+ default:
+ if (m_xfr_phase != xfr_phase) {
+ fatalerror("%s: Unexpected phase change during state.\n", shortname());
+ }
+ break;
}
- break;
}
}
- } else {
- LOGMASKED(LOG_STATE, "Target disconnected\n");
- if (sat) {
- switch (m_regs[COMMAND_PHASE]) {
- case COMMAND_PHASE_DISCONNECT_MESSAGE:
- set_scsi_state(FINISHED);
- m_regs[COMMAND_PHASE] = COMMAND_PHASE_DISCONNECTED;
- break;
-
- case COMMAND_PHASE_COMMAND_COMPLETE:
- if (m_regs[CONTROL] & CONTROL_EDI) {
+ else {
+ LOGMASKED(LOG_STATE, "%s: Target disconnected\n", shortname());
+ if (sat) {
+ switch (m_regs[COMMAND_PHASE]) {
+ case COMMAND_PHASE_DISCONNECT_MESSAGE:
set_scsi_state(FINISHED);
- irq_fifo_push(SCSI_STATUS_SELECT_TRANSFER_SUCCESS);
- } else {
- // Makes very little sense, but the previous code did it and warzard seems to need it - XXX
- m_regs[CONTROL] |= CONTROL_EDI;
- }
- break;
+ m_regs[COMMAND_PHASE] = COMMAND_PHASE_DISCONNECTED;
+ break;
- default:
- fatalerror("%s: Unhandled command phase during Select-and-Transfer disconnect.\n", shortname());
- break;
+ case COMMAND_PHASE_COMMAND_COMPLETE:
+ if (m_regs[CONTROL] & CONTROL_EDI) {
+ set_scsi_state(FINISHED);
+ irq_fifo_push(SCSI_STATUS_SELECT_TRANSFER_SUCCESS);
+ }
+ break;
+
+ default:
+ fatalerror("%s: Unhandled command phase during Select-and-Transfer disconnect.\n", shortname());
+ break;
+ }
}
- } else {
- set_scsi_state(FINISHED);
- irq_fifo_push(SCSI_STATUS_DISCONNECT);
+ else {
+ set_scsi_state(FINISHED);
+ irq_fifo_push(SCSI_STATUS_DISCONNECT);
+ }
+ m_mode = MODE_D;
+ scsi_bus->ctrl_w(scsi_refid, 0, S_ALL);
+ scsi_bus->ctrl_wait(scsi_refid, S_SEL|S_BSY|S_RST, S_ALL);
+ continue;
}
- m_mode = MODE_D;
- scsi_bus->ctrl_w(scsi_refid, 0, S_ALL);
- scsi_bus->ctrl_wait(scsi_refid, S_SEL|S_BSY|S_RST, S_ALL);
}
- }
- switch (m_scsi_state & SUB_MASK ? m_scsi_state & SUB_MASK : m_scsi_state & STATE_MASK) {
- case IDLE:
- break;
+ switch (m_scsi_state & SUB_MASK ? m_scsi_state & SUB_MASK : m_scsi_state & STATE_MASK) {
+ case IDLE:
+ break;
- case FINISHED:
- set_scsi_state(IDLE);
- m_regs[AUXILIARY_STATUS] &= ~(AUXILIARY_STATUS_CIP | AUXILIARY_STATUS_BSY);
- update_irq();
- break;
+ case FINISHED:
+ set_scsi_state(IDLE);
+ m_regs[AUXILIARY_STATUS] &= ~(AUXILIARY_STATUS_CIP | AUXILIARY_STATUS_BSY);
+ update_irq();
+ break;
- case ARB_WAIT_BUS_FREE << SUB_SHIFT:
- if (!(ctrl & (S_BSY | S_SEL))) {
- set_scsi_state_sub(ARB_CHECK_FREE);
- delay(1);
- }
- break;
+ case ARB_WAIT_BUS_FREE << SUB_SHIFT:
+ if (timeout) {
+ if (!(ctrl & (S_BSY | S_SEL))) {
+ set_scsi_state_sub(ARB_CHECK_FREE);
+ }
+ cycles = 1;
+ }
+ break;
- case ARB_CHECK_FREE << SUB_SHIFT:
- if (ctrl & (S_BSY | S_SEL)) {
- set_scsi_state_sub(ARB_CHECK_FREE);
+ case ARB_CHECK_FREE << SUB_SHIFT:
+ if (timeout) {
+ uint8_t next_state;
+ if (ctrl & (S_BSY | S_SEL)) {
+ next_state = ARB_WAIT_BUS_FREE;
+ cycles = 1;
+ }
+ else {
+ scsi_bus->data_w(scsi_refid, 1 << scsi_id);
+ scsi_bus->ctrl_w(scsi_refid, S_BSY, S_BSY);
+ next_state = ARB_EXAMINE_BUS;
+ cycles = 1;
+ }
+ set_scsi_state_sub(next_state);
+ }
break;
- }
- if (timeout) {
- scsi_bus->data_w(scsi_refid, 1 << scsi_id);
- scsi_bus->ctrl_w(scsi_refid, S_BSY, S_BSY);
- set_scsi_state_sub(ARB_EXAMINE_BUS);
- delay(1);
- }
- break;
- case ARB_EXAMINE_BUS << SUB_SHIFT:
- if (timeout) {
- if (ctrl & S_SEL) {
- scsi_bus->ctrl_w(scsi_refid, 0, S_BSY);
- scsi_bus->data_w(scsi_refid, 0);
- set_scsi_state_sub(ARB_WAIT_BUS_FREE);
- } else {
- int win;
- for (win = 7; win >=0 && !(data & (1 << win)); win--);
- if (win == scsi_id) {
- scsi_bus->ctrl_w(scsi_refid, S_SEL, S_SEL);
- set_scsi_state_sub(ARB_ASSERT_SEL);
- delay(1);
- } else {
+ case ARB_EXAMINE_BUS << SUB_SHIFT:
+ if (timeout) {
+ if (ctrl & S_SEL) {
+ scsi_bus->ctrl_w(scsi_refid, 0, S_BSY);
scsi_bus->data_w(scsi_refid, 0);
- scsi_bus->ctrl_w(scsi_refid, 0, S_ALL);
- set_scsi_state_sub(ARB_CHECK_FREE);
+ set_scsi_state_sub(ARB_WAIT_BUS_FREE);
}
+ else {
+ int win;
+ for (win = 7; win >=0 && !(data & (1 << win)); win--) {};
+ if (win == scsi_id) {
+ scsi_bus->ctrl_w(scsi_refid, S_SEL, S_SEL);
+ set_scsi_state_sub(ARB_ASSERT_SEL);
+ }
+ else {
+ scsi_bus->data_w(scsi_refid, 0);
+ scsi_bus->ctrl_w(scsi_refid, 0, S_ALL);
+ }
+ }
+ cycles = 1;
}
- }
- break;
+ break;
- case ARB_ASSERT_SEL << SUB_SHIFT:
- if (timeout) {
- scsi_bus->data_w(scsi_refid, (1 << scsi_id) | (1 << (m_regs[DESTINATION_ID] & DESTINATION_ID_DI)));
- set_scsi_state_sub(ARB_SET_DEST);
- delay(1);
- }
- break;
+ case ARB_ASSERT_SEL << SUB_SHIFT:
+ if (timeout) {
+ scsi_bus->data_w(scsi_refid, (1 << scsi_id) | (1 << (m_regs[DESTINATION_ID] & DESTINATION_ID_DI)));
+ set_scsi_state_sub(ARB_SET_DEST);
+ cycles = 1;
+ }
+ break;
- case ARB_SET_DEST << SUB_SHIFT:
- if (timeout) {
- scsi_bus->ctrl_w(scsi_refid, (cc == COMMAND_CC_SELECT_ATN || cc == COMMAND_CC_SELECT_ATN_TRANSFER) ? S_ATN : 0, S_ATN | S_BSY);
- set_scsi_state_sub(ARB_RELEASE_BUSY);
- delay(1);
- }
- break;
+ case ARB_SET_DEST << SUB_SHIFT:
+ if (timeout) {
+ scsi_bus->ctrl_w(scsi_refid, (cc == COMMAND_CC_SELECT_ATN || cc == COMMAND_CC_SELECT_ATN_TRANSFER) ? S_ATN : 0, S_ATN | S_BSY);
+ set_scsi_state_sub(ARB_RELEASE_BUSY);
+ cycles = 1;
+ }
+ break;
- case ARB_RELEASE_BUSY << SUB_SHIFT:
- if (timeout) {
- if (ctrl & S_BSY) {
- set_scsi_state_sub(ARB_DESKEW_WAIT);
- if (cc == COMMAND_CC_RESELECT) {
- scsi_bus->ctrl_w(scsi_refid, S_BSY, S_BSY);
+ case ARB_RELEASE_BUSY << SUB_SHIFT:
+ if (timeout) {
+ if (ctrl & S_BSY) {
+ set_scsi_state_sub(ARB_DESKEW_WAIT);
+ if (cc == COMMAND_CC_RESELECT) {
+ scsi_bus->ctrl_w(scsi_refid, S_BSY, S_BSY);
+ }
+ cycles = 1;
+ }
+ else {
+ set_scsi_state_sub(ARB_TIMEOUT_BUSY);
+ cycles = 1;
}
- delay(1);
- } else {
- set_scsi_state_sub(ARB_TIMEOUT_BUSY);
- delay(1); // Should be the select timeout...
}
- }
- break;
-
- case ARB_DESKEW_WAIT << SUB_SHIFT:
- if (timeout) {
- scsi_bus->data_w(scsi_refid, 0);
- scsi_bus->ctrl_w(scsi_refid, 0, S_SEL);
- m_mode = (cc == COMMAND_CC_RESELECT) ? MODE_T : MODE_I;
- set_scsi_state_sub(0);
- step(true);
- }
- break;
+ break;
- case ARB_TIMEOUT_BUSY << SUB_SHIFT:
- if (timeout) {
- scsi_bus->data_w(scsi_refid, 0);
- set_scsi_state_sub(ARB_TIMEOUT_ABORT);
- delay(1000);
- } else if (ctrl & S_BSY) {
- set_scsi_state_sub(ARB_DESKEW_WAIT);
- if (cc == COMMAND_CC_RESELECT) {
- scsi_bus->ctrl_w(scsi_refid, S_BSY, S_BSY);
+ case ARB_DESKEW_WAIT << SUB_SHIFT:
+ if (timeout) {
+ scsi_bus->data_w(scsi_refid, 0);
+ scsi_bus->ctrl_w(scsi_refid, 0, S_SEL);
+ m_mode = (cc == COMMAND_CC_RESELECT) ? MODE_T : MODE_I;
+ set_scsi_state_sub(0);
+ ++m_step_count;
}
- delay(1);
- }
- break;
+ break;
- case ARB_TIMEOUT_ABORT << SUB_SHIFT:
- if (timeout) {
- if (ctrl & S_BSY) {
+ case ARB_TIMEOUT_BUSY << SUB_SHIFT:
+ if (timeout) {
+ scsi_bus->data_w(scsi_refid, 0);
+ set_scsi_state_sub(ARB_TIMEOUT_ABORT);
+ cycles = 1000;
+ }
+ else if (ctrl & S_BSY) {
set_scsi_state_sub(ARB_DESKEW_WAIT);
if (cc == COMMAND_CC_RESELECT) {
scsi_bus->ctrl_w(scsi_refid, S_BSY, S_BSY);
}
- delay(1);
- } else {
- scsi_bus->ctrl_w(scsi_refid, 0, S_ALL);
- scsi_bus->ctrl_wait(scsi_refid, S_SEL|S_BSY|S_RST, S_ALL);
- m_regs[AUXILIARY_STATUS] &= ~(AUXILIARY_STATUS_CIP | AUXILIARY_STATUS_BSY);
- m_mode = MODE_D;
- set_scsi_state(IDLE);
- irq_fifo_push(SCSI_STATUS_SELECTION_TIMEOUT);
- update_irq();
+ cycles = 1;
}
- }
- break;
+ break;
- case SEND_WAIT_SETTLE << SUB_SHIFT:
- if (timeout) {
- set_scsi_state_sub(SEND_WAIT_REQ_0);
- step(false);
- }
- break;
+ case ARB_TIMEOUT_ABORT << SUB_SHIFT:
+ if (timeout) {
+ if (ctrl & S_BSY) {
+ set_scsi_state_sub(ARB_DESKEW_WAIT);
+ if (cc == COMMAND_CC_RESELECT) {
+ scsi_bus->ctrl_w(scsi_refid, S_BSY, S_BSY);
+ }
+ cycles = 1;
+ }
+ else {
+ scsi_bus->ctrl_w(scsi_refid, 0, S_ALL);
+ scsi_bus->ctrl_wait(scsi_refid, S_SEL|S_BSY|S_RST, S_ALL);
+ m_regs[AUXILIARY_STATUS] &= ~(AUXILIARY_STATUS_CIP | AUXILIARY_STATUS_BSY);
+ m_mode = MODE_D;
+ set_scsi_state(IDLE);
+ irq_fifo_push(SCSI_STATUS_SELECTION_TIMEOUT);
+ update_irq();
+ }
+ }
+ break;
- case SEND_WAIT_REQ_0 << SUB_SHIFT:
- if (!(ctrl & S_REQ)) {
- set_scsi_state_sub(0);
- scsi_bus->data_w(scsi_refid, 0);
- scsi_bus->ctrl_w(scsi_refid, 0, S_ACK);
- if (sat) {
- switch (m_xfr_phase) {
- case S_PHASE_COMMAND:
- ++m_regs[COMMAND_PHASE];
- break;
+ case SEND_WAIT_SETTLE << SUB_SHIFT:
+ if (timeout) {
+ set_scsi_state_sub(SEND_WAIT_REQ_0);
+ ++m_step_count;
+ }
+ break;
+
+ case SEND_WAIT_REQ_0 << SUB_SHIFT:
+ if (!(ctrl & S_REQ)) {
+ set_scsi_state_sub(0);
+ scsi_bus->data_w(scsi_refid, 0);
+ scsi_bus->ctrl_w(scsi_refid, 0, S_ACK);
+ if (sat) {
+ switch (m_xfr_phase) {
+ case S_PHASE_COMMAND:
+ ++m_regs[COMMAND_PHASE];
+ break;
+ }
}
+ ++m_step_count;
}
- step(false);
- }
- break;
+ break;
- case RECV_WAIT_REQ_1 << SUB_SHIFT:
- if (ctrl & S_REQ) {
- set_scsi_state_sub(RECV_WAIT_SETTLE);
- delay(1);
- }
- break;
+ case RECV_WAIT_REQ_1 << SUB_SHIFT:
+ if (ctrl & S_REQ) {
+ set_scsi_state_sub(RECV_WAIT_SETTLE);
+ cycles = 1;
+ }
+ break;
- case RECV_WAIT_SETTLE << SUB_SHIFT:
- if (timeout) {
- if (sat) {
- switch (m_xfr_phase) {
- case S_PHASE_DATA_IN:
+ case RECV_WAIT_SETTLE << SUB_SHIFT:
+ if (timeout) {
+ if (sat) {
+ switch (m_xfr_phase) {
+ case S_PHASE_DATA_IN:
+ data_fifo_push(data);
+ if ((m_regs[CONTROL] & CONTROL_DM) != CONTROL_DM_POLLED) {
+ set_drq();
+ }
+ else {
+ decrement_transfer_count();
+ m_regs[AUXILIARY_STATUS] |= AUXILIARY_STATUS_DBR;
+ }
+ break;
+
+ case S_PHASE_STATUS:
+ m_regs[TARGET_LUN] = data;
+ m_regs[COMMAND_PHASE] = COMMAND_PHASE_STATUS_RECEIVED;
+ break;
+
+ case S_PHASE_MSG_IN:
+ data_fifo_push(data);
+ break;
+
+ default:
+ fatalerror("%s: Unexpected phase in RECV_WAIT_SETTLE.\n", shortname());
+ break;
+ }
+ }
+ else {
data_fifo_push(data);
- if ((m_regs[CONTROL] & CONTROL_DM) != CONTROL_DM_POLLED) {
+ if (m_xfr_phase == S_PHASE_DATA_IN && (m_regs[CONTROL] & CONTROL_DM) != CONTROL_DM_POLLED) {
set_drq();
- } else {
+ }
+ else {
decrement_transfer_count();
m_regs[AUXILIARY_STATUS] |= AUXILIARY_STATUS_DBR;
}
- break;
-
- case S_PHASE_STATUS:
- m_regs[TARGET_LUN] = data;
- m_regs[COMMAND_PHASE] = COMMAND_PHASE_STATUS_RECEIVED;
- break;
-
- case S_PHASE_MSG_IN:
- m_last_message = data;
- break;
-
- default:
- fatalerror("%s: Unexpected phase in RECV_WAIT_SETTLE.\n", shortname());
- break;
- }
- } else {
- data_fifo_push(data);
- if (m_xfr_phase == S_PHASE_DATA_IN && (m_regs[CONTROL] & CONTROL_DM) != CONTROL_DM_POLLED) {
- set_drq();
- } else {
- decrement_transfer_count();
- m_regs[AUXILIARY_STATUS] |= AUXILIARY_STATUS_DBR;
}
+ set_scsi_state_sub(RECV_WAIT_REQ_0);
+ scsi_bus->ctrl_w(scsi_refid, S_ACK, S_ACK);
+ ++m_step_count;
}
- set_scsi_state_sub(RECV_WAIT_REQ_0);
- scsi_bus->ctrl_w(scsi_refid, S_ACK, S_ACK);
- step(false);
- }
- break;
-
- case RECV_WAIT_REQ_0 << SUB_SHIFT:
- if (!(ctrl & S_REQ)) {
- set_scsi_state_sub(0);
- step(false);
- }
- break;
+ break;
- case DISC_SEL_ARBITRATION:
- scsi_bus->ctrl_wait(scsi_refid, S_REQ, S_REQ);
- if (cc == COMMAND_CC_SELECT || cc == COMMAND_CC_SELECT_ATN) {
- set_scsi_state(FINISHED);
- irq_fifo_push(SCSI_STATUS_SELECT_SUCCESS);
- if (ctrl & S_REQ) {
- irq_fifo_push(SCSI_STATUS_REQ | m_xfr_phase);
+ case RECV_WAIT_REQ_0 << SUB_SHIFT:
+ if (!(ctrl & S_REQ)) {
+ set_scsi_state_sub(0);
+ ++m_step_count;
}
- } else {
- if(cc == COMMAND_CC_SELECT_TRANSFER) {
- m_regs[COMMAND_PHASE] = COMMAND_PHASE_CP_BYTES_0;
- std::string cmd;
- for (uint8_t i = 0; i < m_command_length; ++i) {
- const uint8_t command_byte = m_regs[CDB_1 + i];
- cmd += util::string_format(" %02x", command_byte);
- data_fifo_push(command_byte);
+ break;
+
+ case DISC_SEL_ARBITRATION:
+ scsi_bus->ctrl_wait(scsi_refid, S_REQ, S_REQ);
+ if (cc == COMMAND_CC_SELECT || cc == COMMAND_CC_SELECT_ATN) {
+ set_scsi_state(FINISHED);
+ irq_fifo_push(SCSI_STATUS_SELECT_SUCCESS);
+ if (ctrl & S_REQ) {
+ irq_fifo_push(SCSI_STATUS_REQ | m_xfr_phase);
}
- LOGMASKED(LOG_COMMANDS, "Sending command:%s (%d)\n", cmd, m_transfer_count);
- } else
+ }
+ else {
+ set_scsi_state(INIT_XFR);
m_regs[COMMAND_PHASE] = COMMAND_PHASE_SELECTED;
- set_scsi_state(INIT_XFR);
- }
- step(false);
- break;
+ }
+ ++m_step_count;
+ break;
- case INIT_XFR:
- if (ctrl & S_REQ) {
- switch (m_xfr_phase) {
- case S_PHASE_DATA_OUT:
- if ((m_regs[CONTROL] & CONTROL_DM) != CONTROL_DM_POLLED) {
- if(!data_fifo_full() && m_transfer_count > 0)
- set_drq();
- }
- if (!data_fifo_empty()) {
- set_scsi_state(INIT_XFR_WAIT_REQ);
- delay(send_byte());
- } else if ((m_regs[CONTROL] & CONTROL_DM) == CONTROL_DM_POLLED) {
- m_regs[AUXILIARY_STATUS] |= AUXILIARY_STATUS_DBR;
- }
- break;
+ case INIT_XFR:
+ if (ctrl & S_REQ) {
+ switch (m_xfr_phase) {
+ case S_PHASE_DATA_OUT:
+ if ((m_regs[CONTROL] & CONTROL_DM) != CONTROL_DM_POLLED) {
+ while (!data_fifo_full() && m_transfer_count > 0) {
+ set_drq();
+ }
+ }
+ if (!data_fifo_empty()) {
+ set_scsi_state(INIT_XFR_WAIT_REQ);
+ cycles = send_byte();
+ }
+ else if ((m_regs[CONTROL] & CONTROL_DM) == CONTROL_DM_POLLED) {
+ m_regs[AUXILIARY_STATUS] |= AUXILIARY_STATUS_DBR;
+ }
+ break;
- case S_PHASE_COMMAND:
- if (!data_fifo_empty()) {
- uint32_t mask;
- if (sat) {
- mask = 0;
- } else {
+ case S_PHASE_COMMAND:
+ if (!data_fifo_empty()) {
+ uint32_t mask;
+ if (sat) {
+ mask = 0;
+ }
+ else {
+ m_regs[AUXILIARY_STATUS] |= AUXILIARY_STATUS_DBR;
+ mask = (m_transfer_count == 0 && m_data_fifo_size == 1) ? S_ATN : 0;
+ }
+ set_scsi_state(INIT_XFR_WAIT_REQ);
+ cycles = send_byte(0, mask);
+ }
+ else if (!sat) {
m_regs[AUXILIARY_STATUS] |= AUXILIARY_STATUS_DBR;
- mask = (m_transfer_count == 0 && m_data_fifo_size == 1) ? S_ATN : 0;
}
- set_scsi_state(INIT_XFR_WAIT_REQ);
- delay(send_byte(0, mask));
- } else if (!sat) {
- m_regs[AUXILIARY_STATUS] |= AUXILIARY_STATUS_DBR;
- }
- break;
+ break;
- case S_PHASE_MSG_OUT:
- if (sat) {
- data_fifo_push(get_msg_out());
- }
- if (!data_fifo_empty()) {
- uint32_t mask;
+ case S_PHASE_MSG_OUT:
if (sat) {
- mask = S_ATN;
- } else {
+ data_fifo_push(get_msg_out());
+ }
+ if (!data_fifo_empty()) {
+ uint32_t mask;
+ if (sat) {
+ mask = S_ATN;
+ }
+ else {
+ m_regs[AUXILIARY_STATUS] |= AUXILIARY_STATUS_DBR;
+ mask = (m_transfer_count == 0 && m_data_fifo_size == 1) ? S_ATN : 0;
+ }
+ set_scsi_state(INIT_XFR_WAIT_REQ);
+ cycles = send_byte(0, mask);
+ }
+ else if (!sat) {
m_regs[AUXILIARY_STATUS] |= AUXILIARY_STATUS_DBR;
- mask = (m_transfer_count == 0 && m_data_fifo_size == 1) ? S_ATN : 0;
}
- set_scsi_state(INIT_XFR_WAIT_REQ);
- delay(send_byte(0, mask));
- } else if (!sat) {
- m_regs[AUXILIARY_STATUS] |= AUXILIARY_STATUS_DBR;
- }
- break;
+ break;
- case S_PHASE_DATA_IN:
- case S_PHASE_STATUS:
- case S_PHASE_MSG_IN:
- if (!data_fifo_full()) {
- // if it's the last message byte, ACK remains asserted, terminate with function_complete()
- //state = (m_xfr_phase == S_PHASE_MSG_IN && (!dma_command || tcounter == 1)) ? INIT_XFR_RECV_BYTE_NACK : INIT_XFR_RECV_BYTE_ACK;
- scsi_bus->ctrl_wait(scsi_refid, S_REQ, S_REQ);
- set_scsi_state((RECV_WAIT_REQ_1 << SUB_SHIFT) | INIT_XFR_RECV_BYTE_ACK);
- step(false);
- }
- break;
+ case S_PHASE_DATA_IN:
+ case S_PHASE_STATUS:
+ case S_PHASE_MSG_IN:
+ if (!data_fifo_full()) {
+ // if it's the last message byte, ACK remains asserted, terminate with function_complete()
+ //state = (m_xfr_phase == S_PHASE_MSG_IN && (!dma_command || tcounter == 1)) ? INIT_XFR_RECV_BYTE_NACK : INIT_XFR_RECV_BYTE_ACK;
+ scsi_bus->ctrl_wait(scsi_refid, S_REQ, S_REQ);
+ set_scsi_state((RECV_WAIT_REQ_1 << SUB_SHIFT) | INIT_XFR_RECV_BYTE_ACK);
+ if (ctrl & S_REQ) {
+ ++m_step_count;
+ }
+ }
+ break;
- default:
- fatalerror("%s: Invalid phase during INIT_XFR.\n", shortname());
- break;
+ default:
+ fatalerror("%s: Invalid phase during INIT_XFR.\n", shortname());
+ break;
+ }
}
- }
- break;
+ break;
- case INIT_XFR_WAIT_REQ:
- if (ctrl & S_REQ) {
- uint16_t next_state = m_scsi_state;
+ case INIT_XFR_WAIT_REQ:
+ if (ctrl & S_REQ) {
+ uint16_t next_state = m_scsi_state;
- const uint8_t xfr_phase = (ctrl & S_PHASE_MASK);
+ const uint8_t xfr_phase = (ctrl & S_PHASE_MASK);
- switch ((m_xfr_phase << 3) | xfr_phase) {
- case ((S_PHASE_MSG_OUT << 3) | S_PHASE_MSG_OUT):
- case ((S_PHASE_COMMAND << 3) | S_PHASE_COMMAND):
- case ((S_PHASE_MSG_IN << 3) | S_PHASE_MSG_IN):
- next_state = INIT_XFR;
- break;
+ switch ((m_xfr_phase << 3) | xfr_phase) {
+ case ((S_PHASE_MSG_OUT << 3) | S_PHASE_MSG_OUT):
+ case ((S_PHASE_COMMAND << 3) | S_PHASE_COMMAND):
+ case ((S_PHASE_MSG_IN << 3) | S_PHASE_MSG_IN):
+ next_state = INIT_XFR;
+ break;
- case ((S_PHASE_DATA_IN << 3) | S_PHASE_DATA_IN):
- case ((S_PHASE_DATA_OUT << 3) | S_PHASE_DATA_OUT):
- if (sat || cc == COMMAND_CC_TRANSFER_INFO) {
- if (m_transfer_count > 0 || (m_xfr_phase == S_PHASE_DATA_OUT && !data_fifo_empty())) {
- next_state = INIT_XFR;
+ case ((S_PHASE_DATA_IN << 3) | S_PHASE_DATA_IN):
+ case ((S_PHASE_DATA_OUT << 3) | S_PHASE_DATA_OUT):
+ if (sat || cc == COMMAND_CC_TRANSFER_INFO) {
+ if (m_transfer_count > 0 || (m_xfr_phase == S_PHASE_DATA_OUT && !data_fifo_empty())) {
+ next_state = INIT_XFR;
+ }
+ else {
+ next_state = FINISHED;
+ uint8_t scsi_status;
+ if (sat) {
+ m_regs[COMMAND_PHASE] = COMMAND_PHASE_TRANSFER_COUNT;
+ scsi_status = SCSI_STATUS_UNEXPECTED_PHASE;
+ }
+ else {
+ scsi_status = SCSI_STATUS_TRANSFER_SUCCESS;
+ }
+ irq_fifo_push(scsi_status | m_xfr_phase);
+ }
}
else {
+ fatalerror("%s: Unhandled command in data phase.\n", shortname());
next_state = FINISHED;
- uint8_t scsi_status;
- if (sat) {
- m_regs[COMMAND_PHASE] = COMMAND_PHASE_TRANSFER_COUNT;
- scsi_status = SCSI_STATUS_UNEXPECTED_PHASE;
- }
- else {
- scsi_status = SCSI_STATUS_TRANSFER_SUCCESS;
+ }
+ break;
+
+ case ((S_PHASE_MSG_OUT << 3) | S_PHASE_COMMAND):
+ case ((S_PHASE_COMMAND << 3) | S_PHASE_DATA_OUT):
+ case ((S_PHASE_COMMAND << 3) | S_PHASE_DATA_IN):
+ case ((S_PHASE_COMMAND << 3) | S_PHASE_STATUS):
+ case ((S_PHASE_COMMAND << 3) | S_PHASE_MSG_IN):
+ case ((S_PHASE_DATA_OUT << 3) | S_PHASE_STATUS):
+ case ((S_PHASE_DATA_IN << 3) | S_PHASE_STATUS):
+ case ((S_PHASE_STATUS << 3) | S_PHASE_MSG_IN):
+ if (!(m_xfr_phase & 1) && !data_fifo_empty()) {
+ fatalerror("%s: Data FIFO is not empty on phase transition.\n", shortname());
+ }
+
+ if (sat) {
+ switch (xfr_phase) {
+ case S_PHASE_MSG_OUT:
+ next_state = INIT_XFR;
+ break;
+
+ case S_PHASE_COMMAND:
+ next_state = INIT_XFR;
+ m_regs[COMMAND_PHASE] = COMMAND_PHASE_CP_BYTES_0;
+ LOGMASKED(LOG_COMMANDS, "%s: Sending Command:", shortname());
+ for (uint8_t i = 0; i < m_command_length; ++i) {
+ const uint8_t command_byte = m_regs[CDB_1 + i];
+ LOGMASKED(LOG_COMMANDS, " %02x", command_byte);
+ data_fifo_push(command_byte);
+ }
+ LOGMASKED(LOG_COMMANDS, " (%d)\n", m_transfer_count);
+ break;
+
+ case S_PHASE_DATA_OUT:
+ case S_PHASE_DATA_IN:
+ next_state = INIT_XFR;
+ break;
+
+ case S_PHASE_STATUS:
+ next_state = INIT_XFR;
+ m_regs[COMMAND_PHASE] = COMMAND_PHASE_RECEIVE_STATUS;
+ break;
+
+ case S_PHASE_MSG_IN:
+ next_state = INIT_XFR;
+ break;
+
+ default:
+ fatalerror("%s: Unhandled phase in Select-w/Atn-and-Transfer.\n", shortname());
+ next_state = FINISHED;
+ break;
}
- irq_fifo_push(scsi_status | m_xfr_phase);
}
- }
- else {
- fatalerror("%s: Unhandled command in data phase.\n", shortname());
+ else if (cc == COMMAND_CC_TRANSFER_INFO) {
+ next_state = FINISHED;
+ irq_fifo_push(SCSI_STATUS_TRANSFER_SUCCESS | xfr_phase);
+ }
+ else {
+ fatalerror("%s: Unhandled command in data phase.\n", shortname());
+ next_state = FINISHED;
+ }
+ break;
+
+ default:
+ fatalerror("%s: Unhandled phase transition in INIT_XFR_WAIT_REQ.\n", shortname());
next_state = FINISHED;
+ break;
}
- break;
- case ((S_PHASE_MSG_OUT << 3) | S_PHASE_COMMAND):
- case ((S_PHASE_COMMAND << 3) | S_PHASE_DATA_OUT):
- case ((S_PHASE_COMMAND << 3) | S_PHASE_DATA_IN):
- case ((S_PHASE_COMMAND << 3) | S_PHASE_STATUS):
- case ((S_PHASE_COMMAND << 3) | S_PHASE_MSG_IN):
- case ((S_PHASE_DATA_OUT << 3) | S_PHASE_STATUS):
- case ((S_PHASE_DATA_IN << 3) | S_PHASE_STATUS):
- case ((S_PHASE_STATUS << 3) | S_PHASE_MSG_IN):
- if (!(m_xfr_phase & 1) && !data_fifo_empty()) {
- fatalerror("%s: Data FIFO is not empty on phase transition.\n", shortname());
+ if (next_state != m_scsi_state) {
+ set_scsi_state(next_state);
+ ++m_step_count;
+ m_xfr_phase = xfr_phase;
}
+ }
+ break;
- if (sat) {
- switch (xfr_phase) {
- case S_PHASE_MSG_OUT:
- next_state = INIT_XFR;
- break;
-
- case S_PHASE_COMMAND: {
- next_state = INIT_XFR;
- m_regs[COMMAND_PHASE] = COMMAND_PHASE_CP_BYTES_0;
- std::string cmd;
- for (uint8_t i = 0; i < m_command_length; ++i) {
- const uint8_t command_byte = m_regs[CDB_1 + i];
- cmd += util::string_format(" %02x", command_byte);
- data_fifo_push(command_byte);
- }
- LOGMASKED(LOG_COMMANDS, "Sending command:%s (%d)\n", cmd, m_transfer_count);
+ case INIT_XFR_RECV_BYTE_ACK:
+ if (sat && m_xfr_phase == S_PHASE_MSG_IN) {
+ const uint8_t msg = data_fifo_pop();
+ if (m_regs[COMMAND_PHASE] <= COMMAND_PHASE_CP_BYTES_C) {
+ switch (msg) {
+ case SM_SAVE_DATA_PTR:
+ set_scsi_state(FINISHED);
+ irq_fifo_push(SCSI_STATUS_SAVE_DATA_POINTERS);
+ m_regs[COMMAND_PHASE] = COMMAND_PHASE_SAVE_DATA_POINTER;
break;
- }
- case S_PHASE_DATA_OUT:
- case S_PHASE_DATA_IN:
- next_state = INIT_XFR;
+ case SM_DISCONNECT:
+ m_regs[COMMAND_PHASE] = COMMAND_PHASE_DISCONNECT_MESSAGE;
break;
- case S_PHASE_STATUS:
- next_state = INIT_XFR;
- m_regs[COMMAND_PHASE] = COMMAND_PHASE_RECEIVE_STATUS;
+ default:
+ fatalerror("%s: Unhandled MSG_IN.\n", shortname());
break;
-
- case S_PHASE_MSG_IN:
- next_state = INIT_XFR;
+ }
+ }
+ else if (m_regs[COMMAND_PHASE] < COMMAND_PHASE_COMMAND_COMPLETE) {
+ switch (msg) {
+ case SM_COMMAND_COMPLETE:
+ set_scsi_state(FINISHED);
+ irq_fifo_push(SCSI_STATUS_SELECT_TRANSFER_SUCCESS);
+ m_regs[COMMAND_PHASE] = COMMAND_PHASE_COMMAND_COMPLETE;
break;
-
default:
- fatalerror("%s: Unhandled phase in Select-w/Atn-and-Transfer.\n", shortname());
- next_state = FINISHED;
+ fatalerror("%s: Unhandled MSG_IN.\n", shortname());
break;
}
}
- else if (cc == COMMAND_CC_TRANSFER_INFO) {
- next_state = FINISHED;
- irq_fifo_push(SCSI_STATUS_TRANSFER_SUCCESS | xfr_phase);
- }
- else {
- fatalerror("%s: Unhandled command in data phase.\n", shortname());
- next_state = FINISHED;
- }
- break;
-
- default:
- fatalerror("%s: Unhandled phase transition in INIT_XFR_WAIT_REQ.\n", shortname());
- next_state = FINISHED;
- break;
}
-
- if (next_state != m_scsi_state) {
- set_scsi_state(next_state);
- m_xfr_phase = xfr_phase;
- step(false);
+ else {
+ set_scsi_state(INIT_XFR_WAIT_REQ);
}
- }
- break;
+ scsi_bus->ctrl_w(scsi_refid, 0, S_ACK);
+ ++m_step_count;
+ break;
- case INIT_XFR_RECV_BYTE_ACK:
- if (sat && m_xfr_phase == S_PHASE_MSG_IN) {
- if (m_regs[COMMAND_PHASE] <= COMMAND_PHASE_CP_BYTES_C) {
- switch (m_last_message) {
- case SM_SAVE_DATA_PTR:
- set_scsi_state(FINISHED);
- irq_fifo_push(SCSI_STATUS_SAVE_DATA_POINTERS);
- m_regs[COMMAND_PHASE] = COMMAND_PHASE_SAVE_DATA_POINTER;
- break;
+ default:
+ fatalerror("%s: Unhandled state in step.\n", shortname());
+ break;
+ }
- case SM_DISCONNECT:
- m_regs[COMMAND_PHASE] = COMMAND_PHASE_DISCONNECT_MESSAGE;
- break;
+ timeout = false;
- default:
- fatalerror("%s: Unhandled MSG_IN %02x.\n", shortname(), m_last_message);
- break;
- }
- } else if (m_regs[COMMAND_PHASE] < COMMAND_PHASE_COMMAND_COMPLETE) {
- switch (m_last_message) {
- case SM_COMMAND_COMPLETE:
- set_scsi_state(FINISHED);
- irq_fifo_push(SCSI_STATUS_SELECT_TRANSFER_SUCCESS);
- m_regs[COMMAND_PHASE] = COMMAND_PHASE_COMMAND_COMPLETE;
- break;
- default:
- fatalerror("%s: Unhandled MSG_IN %02x.\n", shortname(), m_last_message);
- break;
- }
- }
- } else {
- set_scsi_state(INIT_XFR_WAIT_REQ);
- }
- scsi_bus->ctrl_w(scsi_refid, 0, S_ACK);
- step(false);
- break;
+ } while (--m_step_count);
- default:
- fatalerror("%s: Unhandled state in step.\n", shortname());
- break;
+ if (cycles) {
+ delay(cycles);
}
}
@@ -1390,7 +1390,7 @@ void wd33c9x_base_device::load_transfer_count()
m_transfer_count = 1;
}
}
- LOGMASKED(LOG_COMMANDS, "Transfer Count %d bytes\n", m_transfer_count);
+ LOGMASKED(LOG_COMMANDS, "%s: Transfer Count %d bytes\n", shortname(), m_transfer_count);
}
@@ -1499,9 +1499,7 @@ uint32_t wd33c9x_base_device::send_byte(const uint32_t value, const uint32_t mas
void wd33c9x_base_device::set_scsi_state(uint16_t state)
{
- LOGMASKED(LOG_STEP, "SCSI state change: %s.%s to %s.%s\n",
- state_names[m_scsi_state & STATE_MASK], substate_names[m_scsi_state >> SUB_SHIFT],
- state_names[state & STATE_MASK], substate_names[state >> SUB_SHIFT]);
+ LOGMASKED(LOG_STEP, "%s: SCSI state change: %x to %x\n", shortname(), m_scsi_state, state);
m_scsi_state = state;
}
@@ -1590,7 +1588,7 @@ void wd33c9x_base_device::update_irq()
{
if (m_regs[AUXILIARY_STATUS] & AUXILIARY_STATUS_INT) {
m_regs[AUXILIARY_STATUS] &= ~AUXILIARY_STATUS_INT;
- LOGMASKED(LOG_LINES, "Clearing IRQ\n");
+ LOGMASKED(LOG_LINES, "%s: Clearing IRQ\n", shortname());
m_irq_cb(CLEAR_LINE);
}
if (!irq_fifo_empty()) {
@@ -1614,7 +1612,7 @@ void wd33c9x_base_device::update_irq()
}
}
- LOGMASKED(LOG_LINES, "Asserting IRQ - SCSI Status (%02x)\n", m_regs[SCSI_STATUS]);
+ LOGMASKED(LOG_LINES, "%s: Asserting IRQ - SCSI Status (%02x)\n", shortname(), m_regs[SCSI_STATUS]);
m_irq_cb(ASSERT_LINE);
}
}
@@ -1627,7 +1625,7 @@ void wd33c9x_base_device::update_irq()
void wd33c9x_base_device::set_drq()
{
if (!m_drq_state) {
- LOGMASKED(LOG_LINES, "Asserting DRQ\n");
+ LOGMASKED(LOG_LINES, "%s: Asserting DRQ\n", shortname());
m_drq_state = true;
m_drq_cb(ASSERT_LINE);
}
@@ -1641,7 +1639,7 @@ void wd33c9x_base_device::set_drq()
void wd33c9x_base_device::clear_drq()
{
if (m_drq_state) {
- LOGMASKED(LOG_LINES, "Clearing DRQ\n");
+ LOGMASKED(LOG_LINES, "%s: Clearing DRQ\n", shortname());
m_drq_state = false;
m_drq_cb(CLEAR_LINE);
}
@@ -1680,13 +1678,15 @@ bool wd33c9x_base_device::set_command_length(const uint8_t cc)
if (eaf && (cc == COMMAND_CC_SELECT_TRANSFER || cc == COMMAND_CC_SELECT_ATN_TRANSFER)) {
m_command_length &= OWN_ID_CDB_SIZE;
ret = true;
- } else if (eaf && cc == COMMAND_CC_WAIT_SELECT_RECEIVE_DATA) {
+ }
+ else if (eaf && cc == COMMAND_CC_WAIT_SELECT_RECEIVE_DATA) {
m_command_length = 6;
m_regs[COMMAND_PHASE] = COMMAND_PHASE_CP_BYTES_1;
irq_fifo_push(SCSI_STATUS_NEED_COMMAND_SIZE);
update_irq();
ret = false;
- } else {
+ }
+ else {
switch (m_regs[CDB_1] >> 5) {
default:
case 0: m_command_length = 6; break;
@@ -1695,7 +1695,7 @@ bool wd33c9x_base_device::set_command_length(const uint8_t cc)
}
ret = true;
}
- LOGMASKED(LOG_COMMANDS, "SCSI Command Length %d bytes\n", m_command_length);
+ LOGMASKED(LOG_COMMANDS, "%s: SCSI Command Length %d bytes\n", shortname(), m_command_length);
return ret;
}
@@ -1715,8 +1715,8 @@ wd33c92_device::wd33c92_device(const machine_config &mconfig, const char *tag, d
{
}
-wd33c93_device::wd33c93_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : wd33c9x_base_device(mconfig, WD33C93, tag, owner, clock)
+wd33c93n_device::wd33c93n_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : wd33c9x_base_device(mconfig, WD33C93N, tag, owner, clock)
{
}
diff --git a/src/devices/machine/wd33c9x.h b/src/devices/machine/wd33c9x.h
index 65e97852e00..d5f3b5a5da4 100644
--- a/src/devices/machine/wd33c9x.h
+++ b/src/devices/machine/wd33c9x.h
@@ -18,18 +18,18 @@ public:
auto drq_cb() { return m_drq_cb.bind(); }
// Direct Addressing Interface
- uint8_t dir_r(offs_t offset);
- void dir_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(dir_r);
+ DECLARE_WRITE8_MEMBER(dir_w);
// Indirect Addressing Interface
- uint8_t indir_r(offs_t offset);
- void indir_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(indir_r);
+ DECLARE_WRITE8_MEMBER(indir_w);
// Alternative Indirect Addressing Interface
- uint8_t indir_addr_r();
- void indir_addr_w(uint8_t data);
- uint8_t indir_reg_r();
- void indir_reg_w(uint8_t data);
+ DECLARE_READ8_MEMBER(indir_addr_r);
+ DECLARE_WRITE8_MEMBER(indir_addr_w);
+ DECLARE_READ8_MEMBER(indir_reg_r);
+ DECLARE_WRITE8_MEMBER(indir_reg_w);
// Master Reset (MR) Interface
DECLARE_WRITE_LINE_MEMBER(reset_w);
@@ -48,14 +48,11 @@ protected:
virtual void scsi_ctrl_changed() override;
private:
- static const char *const state_names[];
- static const char *const substate_names[];
static constexpr uint8_t NUM_REGS = 0x20;
static constexpr uint8_t REGS_MASK = NUM_REGS - 1;
uint8_t m_addr;
uint8_t m_regs[NUM_REGS];
uint8_t m_command_length;
- uint8_t m_last_message;
void start_command();
@@ -65,6 +62,7 @@ private:
uint16_t m_scsi_state;
uint8_t m_mode;
uint8_t m_xfr_phase;
+ uint8_t m_step_count;
void load_transfer_count();
bool decrement_transfer_count();
@@ -119,15 +117,15 @@ public:
wd33c92_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-class wd33c93_device : public wd33c9x_base_device
+class wd33c93n_device : public wd33c9x_base_device
{
public:
- wd33c93_device(const machine_config &mconfig, const char *tag, device_t *owner)
- : wd33c93_device(mconfig, tag, owner, 0)
+ wd33c93n_device(const machine_config &mconfig, const char *tag, device_t *owner)
+ : wd33c93n_device(mconfig, tag, owner, 0)
{
}
- wd33c93_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ wd33c93n_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
class wd33c93a_device : public wd33c9x_base_device
@@ -153,8 +151,8 @@ public:
};
-DECLARE_DEVICE_TYPE(WD33C92, wd33c92_device)
-DECLARE_DEVICE_TYPE(WD33C93, wd33c93_device)
+DECLARE_DEVICE_TYPE(WD33C92, wd33c92_device)
+DECLARE_DEVICE_TYPE(WD33C93N, wd33c93n_device)
DECLARE_DEVICE_TYPE(WD33C93A, wd33c93a_device)
DECLARE_DEVICE_TYPE(WD33C93B, wd33c93b_device)
diff --git a/src/devices/machine/wd7600.cpp b/src/devices/machine/wd7600.cpp
index 373c371cb5f..9c018fede8e 100644
--- a/src/devices/machine/wd7600.cpp
+++ b/src/devices/machine/wd7600.cpp
@@ -159,46 +159,46 @@ void wd7600_device::device_start()
if (m_space_io->data_width() == 16)
{
// FIXME: are all these address ranges correct?
- m_space_io->install_readwrite_handler(0x0000, 0x000f, read8sm_delegate(FUNC(am9517a_device::read), &(*m_dma1)), write8sm_delegate(FUNC(am9517a_device::write), &(*m_dma1)), 0xffff);
+ m_space_io->install_readwrite_handler(0x0000, 0x000f, read8_delegate(FUNC(am9517a_device::read), &(*m_dma1)), write8_delegate(FUNC(am9517a_device::write), &(*m_dma1)), 0xffff);
m_space_io->install_readwrite_handler(0x0020, 0x003f, read8sm_delegate(FUNC(pic8259_device::read), &(*m_pic1)), write8sm_delegate(FUNC(pic8259_device::write), &(*m_pic1)), 0xffff);
m_space_io->install_readwrite_handler(0x0040, 0x0043, read8sm_delegate(FUNC(pit8254_device::read), &(*m_ctc)), write8sm_delegate(FUNC(pit8254_device::write), &(*m_ctc)), 0xffff);
- m_space_io->install_readwrite_handler(0x0060, 0x0061, read8smo_delegate(FUNC(wd7600_device::keyb_data_r), this), write8smo_delegate(FUNC(wd7600_device::keyb_data_w), this), 0x00ff);
- m_space_io->install_readwrite_handler(0x0060, 0x0061, read8smo_delegate(FUNC(wd7600_device::portb_r), this), write8smo_delegate(FUNC(wd7600_device::portb_w), this), 0xff00);
- m_space_io->install_readwrite_handler(0x0064, 0x0065, read8smo_delegate(FUNC(wd7600_device::keyb_status_r), this), write8smo_delegate(FUNC(wd7600_device::keyb_cmd_w), this), 0x00ff);
- m_space_io->install_readwrite_handler(0x0070, 0x007f, read8sm_delegate(FUNC(mc146818_device::read), &(*m_rtc)), write8sm_delegate(FUNC(wd7600_device::rtc_w), this), 0xffff);
- m_space_io->install_readwrite_handler(0x0080, 0x008f, read8sm_delegate(FUNC(wd7600_device::dma_page_r), this), write8sm_delegate(FUNC(wd7600_device::dma_page_w), this), 0xffff);
- m_space_io->install_readwrite_handler(0x0092, 0x0093, read8smo_delegate(FUNC(wd7600_device::a20_reset_r), this), write8smo_delegate(FUNC(wd7600_device::a20_reset_w), this), 0x00ff);
+ m_space_io->install_readwrite_handler(0x0060, 0x0061, read8_delegate(FUNC(wd7600_device::keyb_data_r), this), write8_delegate(FUNC(wd7600_device::keyb_data_w), this), 0x00ff);
+ m_space_io->install_readwrite_handler(0x0060, 0x0061, read8_delegate(FUNC(wd7600_device::portb_r), this), write8_delegate(FUNC(wd7600_device::portb_w), this), 0xff00);
+ m_space_io->install_readwrite_handler(0x0064, 0x0065, read8_delegate(FUNC(wd7600_device::keyb_status_r), this), write8_delegate(FUNC(wd7600_device::keyb_cmd_w), this), 0x00ff);
+ m_space_io->install_readwrite_handler(0x0070, 0x007f, read8_delegate(FUNC(mc146818_device::read), &(*m_rtc)), write8_delegate(FUNC(wd7600_device::rtc_w), this), 0xffff);
+ m_space_io->install_readwrite_handler(0x0080, 0x008f, read8_delegate(FUNC(wd7600_device::dma_page_r), this), write8_delegate(FUNC(wd7600_device::dma_page_w), this), 0xffff);
+ m_space_io->install_readwrite_handler(0x0092, 0x0093, read8_delegate(FUNC(wd7600_device::a20_reset_r), this), write8_delegate(FUNC(wd7600_device::a20_reset_w), this), 0x00ff);
m_space_io->install_readwrite_handler(0x00a0, 0x00a3, read8sm_delegate(FUNC(pic8259_device::read), &(*m_pic2)), write8sm_delegate(FUNC(pic8259_device::write), &(*m_pic2)), 0xffff);
- m_space_io->install_readwrite_handler(0x00c0, 0x00df, read8sm_delegate(FUNC(am9517a_device::read), &(*m_dma2)), write8sm_delegate(FUNC(am9517a_device::write), &(*m_dma2)), 0x00ff);
- m_space_io->install_readwrite_handler(0x2072, 0x2073, read16smo_delegate(FUNC(wd7600_device::refresh_r), this), write16smo_delegate(FUNC(wd7600_device::refresh_w), this));
- m_space_io->install_readwrite_handler(0x2872, 0x2873, read16smo_delegate(FUNC(wd7600_device::chipsel_r), this), write16smo_delegate(FUNC(wd7600_device::chipsel_w), this));
- m_space_io->install_readwrite_handler(0x3872, 0x3873, read16smo_delegate(FUNC(wd7600_device::mem_ctrl_r), this), write16smo_delegate(FUNC(wd7600_device::mem_ctrl_w), this));
- m_space_io->install_readwrite_handler(0x4872, 0x4873, read16s_delegate(FUNC(wd7600_device::bank_01_start_r), this), write16s_delegate(FUNC(wd7600_device::bank_01_start_w), this));
- m_space_io->install_readwrite_handler(0x5072, 0x5073, read16s_delegate(FUNC(wd7600_device::bank_23_start_r), this), write16s_delegate(FUNC(wd7600_device::bank_23_start_w), this));
- m_space_io->install_readwrite_handler(0x5872, 0x5873, read16smo_delegate(FUNC(wd7600_device::split_addr_r), this), write16smo_delegate(FUNC(wd7600_device::split_addr_w), this));
- m_space_io->install_readwrite_handler(0x9872, 0x9873, read16smo_delegate(FUNC(wd7600_device::diag_r), this), write16smo_delegate(FUNC(wd7600_device::diag_w), this));
+ m_space_io->install_readwrite_handler(0x00c0, 0x00df, read8_delegate(FUNC(am9517a_device::read), &(*m_dma2)), write8_delegate(FUNC(am9517a_device::write), &(*m_dma2)), 0x00ff);
+ m_space_io->install_readwrite_handler(0x2072, 0x2073, read16_delegate(FUNC(wd7600_device::refresh_r), this), write16_delegate(FUNC(wd7600_device::refresh_w), this));
+ m_space_io->install_readwrite_handler(0x2872, 0x2873, read16_delegate(FUNC(wd7600_device::chipsel_r), this), write16_delegate(FUNC(wd7600_device::chipsel_w), this));
+ m_space_io->install_readwrite_handler(0x3872, 0x3873, read16_delegate(FUNC(wd7600_device::mem_ctrl_r), this), write16_delegate(FUNC(wd7600_device::mem_ctrl_w), this));
+ m_space_io->install_readwrite_handler(0x4872, 0x4873, read16_delegate(FUNC(wd7600_device::bank_01_start_r), this), write16_delegate(FUNC(wd7600_device::bank_01_start_w), this));
+ m_space_io->install_readwrite_handler(0x5072, 0x5073, read16_delegate(FUNC(wd7600_device::bank_23_start_r), this), write16_delegate(FUNC(wd7600_device::bank_23_start_w), this));
+ m_space_io->install_readwrite_handler(0x5872, 0x5873, read16_delegate(FUNC(wd7600_device::split_addr_r), this), write16_delegate(FUNC(wd7600_device::split_addr_w), this));
+ m_space_io->install_readwrite_handler(0x9872, 0x9873, read16_delegate(FUNC(wd7600_device::diag_r), this), write16_delegate(FUNC(wd7600_device::diag_w), this));
}
else
{
assert(m_space_io->data_width() == 32);
- m_space_io->install_readwrite_handler(0x0000, 0x000f, read8sm_delegate(FUNC(am9517a_device::read), &(*m_dma1)), write8sm_delegate(FUNC(am9517a_device::write), &(*m_dma1)), 0xffffffff);
+ m_space_io->install_readwrite_handler(0x0000, 0x000f, read8_delegate(FUNC(am9517a_device::read), &(*m_dma1)), write8_delegate(FUNC(am9517a_device::write), &(*m_dma1)), 0xffffffff);
m_space_io->install_readwrite_handler(0x0020, 0x003f, read8sm_delegate(FUNC(pic8259_device::read), &(*m_pic1)), write8sm_delegate(FUNC(pic8259_device::write), &(*m_pic1)), 0x0000ffff);
m_space_io->install_readwrite_handler(0x0040, 0x0043, read8sm_delegate(FUNC(pit8254_device::read), &(*m_ctc)), write8sm_delegate(FUNC(pit8254_device::write), &(*m_ctc)), 0xffffffff);
- m_space_io->install_readwrite_handler(0x0060, 0x0063, read8smo_delegate(FUNC(wd7600_device::keyb_data_r), this), write8smo_delegate(FUNC(wd7600_device::keyb_data_w), this), 0x000000ff);
- m_space_io->install_readwrite_handler(0x0060, 0x0063, read8smo_delegate(FUNC(wd7600_device::portb_r), this), write8smo_delegate(FUNC(wd7600_device::portb_w), this), 0x0000ff00);
- m_space_io->install_readwrite_handler(0x0064, 0x0067, read8smo_delegate(FUNC(wd7600_device::keyb_status_r), this), write8smo_delegate(FUNC(wd7600_device::keyb_cmd_w), this), 0x000000ff);
- m_space_io->install_readwrite_handler(0x0070, 0x007f, read8sm_delegate(FUNC(mc146818_device::read), &(*m_rtc)), write8sm_delegate(FUNC(wd7600_device::rtc_w), this), 0x0000ffff);
- m_space_io->install_readwrite_handler(0x0080, 0x008f, read8sm_delegate(FUNC(wd7600_device::dma_page_r), this), write8sm_delegate(FUNC(wd7600_device::dma_page_w), this), 0xffffffff);
- m_space_io->install_readwrite_handler(0x0090, 0x0093, read8smo_delegate(FUNC(wd7600_device::a20_reset_r), this), write8smo_delegate(FUNC(wd7600_device::a20_reset_w), this), 0x00ff0000);
+ m_space_io->install_readwrite_handler(0x0060, 0x0063, read8_delegate(FUNC(wd7600_device::keyb_data_r), this), write8_delegate(FUNC(wd7600_device::keyb_data_w), this), 0x000000ff);
+ m_space_io->install_readwrite_handler(0x0060, 0x0063, read8_delegate(FUNC(wd7600_device::portb_r), this), write8_delegate(FUNC(wd7600_device::portb_w), this), 0x0000ff00);
+ m_space_io->install_readwrite_handler(0x0064, 0x0067, read8_delegate(FUNC(wd7600_device::keyb_status_r), this), write8_delegate(FUNC(wd7600_device::keyb_cmd_w), this), 0x000000ff);
+ m_space_io->install_readwrite_handler(0x0070, 0x007f, read8_delegate(FUNC(mc146818_device::read), &(*m_rtc)), write8_delegate(FUNC(wd7600_device::rtc_w), this), 0x0000ffff);
+ m_space_io->install_readwrite_handler(0x0080, 0x008f, read8_delegate(FUNC(wd7600_device::dma_page_r), this), write8_delegate(FUNC(wd7600_device::dma_page_w), this), 0xffffffff);
+ m_space_io->install_readwrite_handler(0x0090, 0x0093, read8_delegate(FUNC(wd7600_device::a20_reset_r), this), write8_delegate(FUNC(wd7600_device::a20_reset_w), this), 0x00ff0000);
m_space_io->install_readwrite_handler(0x00a0, 0x00a3, read8sm_delegate(FUNC(pic8259_device::read), &(*m_pic2)), write8sm_delegate(FUNC(pic8259_device::write), &(*m_pic2)), 0x0000ffff);
- m_space_io->install_readwrite_handler(0x00c0, 0x00df, read8sm_delegate(FUNC(am9517a_device::read), &(*m_dma2)), write8sm_delegate(FUNC(am9517a_device::write), &(*m_dma2)), 0x00ff00ff);
- m_space_io->install_readwrite_handler(0x2070, 0x2073, read16smo_delegate(FUNC(wd7600_device::refresh_r), this), write16smo_delegate(FUNC(wd7600_device::refresh_w), this), 0xffff0000);
- m_space_io->install_readwrite_handler(0x2870, 0x2873, read16smo_delegate(FUNC(wd7600_device::chipsel_r), this), write16smo_delegate(FUNC(wd7600_device::chipsel_w), this), 0xffff0000);
- m_space_io->install_readwrite_handler(0x3870, 0x3873, read16smo_delegate(FUNC(wd7600_device::mem_ctrl_r), this), write16smo_delegate(FUNC(wd7600_device::mem_ctrl_w), this), 0xffff0000);
- m_space_io->install_readwrite_handler(0x4870, 0x4873, read16s_delegate(FUNC(wd7600_device::bank_01_start_r), this), write16s_delegate(FUNC(wd7600_device::bank_01_start_w), this), 0xffff0000);
- m_space_io->install_readwrite_handler(0x5070, 0x5073, read16s_delegate(FUNC(wd7600_device::bank_23_start_r), this), write16s_delegate(FUNC(wd7600_device::bank_23_start_w), this), 0xffff0000);
- m_space_io->install_readwrite_handler(0x5870, 0x5873, read16smo_delegate(FUNC(wd7600_device::split_addr_r), this), write16smo_delegate(FUNC(wd7600_device::split_addr_w), this), 0xffff0000);
- m_space_io->install_readwrite_handler(0x9870, 0x9873, read16smo_delegate(FUNC(wd7600_device::diag_r), this), write16smo_delegate(FUNC(wd7600_device::diag_w), this), 0xffff0000);
+ m_space_io->install_readwrite_handler(0x00c0, 0x00df, read8_delegate(FUNC(am9517a_device::read), &(*m_dma2)), write8_delegate(FUNC(am9517a_device::write), &(*m_dma2)), 0x00ff00ff);
+ m_space_io->install_readwrite_handler(0x2070, 0x2073, read16_delegate(FUNC(wd7600_device::refresh_r), this), write16_delegate(FUNC(wd7600_device::refresh_w), this), 0xffff0000);
+ m_space_io->install_readwrite_handler(0x2870, 0x2873, read16_delegate(FUNC(wd7600_device::chipsel_r), this), write16_delegate(FUNC(wd7600_device::chipsel_w), this), 0xffff0000);
+ m_space_io->install_readwrite_handler(0x3870, 0x3873, read16_delegate(FUNC(wd7600_device::mem_ctrl_r), this), write16_delegate(FUNC(wd7600_device::mem_ctrl_w), this), 0xffff0000);
+ m_space_io->install_readwrite_handler(0x4870, 0x4873, read16_delegate(FUNC(wd7600_device::bank_01_start_r), this), write16_delegate(FUNC(wd7600_device::bank_01_start_w), this), 0xffff0000);
+ m_space_io->install_readwrite_handler(0x5070, 0x5073, read16_delegate(FUNC(wd7600_device::bank_23_start_r), this), write16_delegate(FUNC(wd7600_device::bank_23_start_w), this), 0xffff0000);
+ m_space_io->install_readwrite_handler(0x5870, 0x5873, read16_delegate(FUNC(wd7600_device::split_addr_r), this), write16_delegate(FUNC(wd7600_device::split_addr_w), this), 0xffff0000);
+ m_space_io->install_readwrite_handler(0x9870, 0x9873, read16_delegate(FUNC(wd7600_device::diag_r), this), write16_delegate(FUNC(wd7600_device::diag_w), this), 0xffff0000);
}
}
@@ -255,7 +255,7 @@ void wd7600_device::keyboard_gatea20(int state)
a20m();
}
-void wd7600_device::rtc_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( wd7600_device::rtc_w )
{
if (offset == 0)
{
@@ -263,10 +263,10 @@ void wd7600_device::rtc_w(offs_t offset, uint8_t data)
data &= 0x7f;
}
- m_rtc->write(offset, data);
+ m_rtc->write(space, offset, data);
}
-uint8_t wd7600_device::pic1_slave_ack_r(offs_t offset)
+READ8_MEMBER( wd7600_device::pic1_slave_ack_r )
{
if (offset == 2) // IRQ 2
return m_pic2->acknowledge();
@@ -288,36 +288,36 @@ WRITE_LINE_MEMBER( wd7600_device::ctc_out2_w )
}
// Keyboard
-void wd7600_device::keyb_data_w(uint8_t data)
+WRITE8_MEMBER( wd7600_device::keyb_data_w )
{
// LOG("WD7600: keyboard data write %02x\n", data);
- m_keybc->data_w(data);
+ m_keybc->data_w(space,0,data);
}
-uint8_t wd7600_device::keyb_data_r()
+READ8_MEMBER( wd7600_device::keyb_data_r )
{
- uint8_t ret = m_keybc->data_r();
+ uint8_t ret = m_keybc->data_r(space,0);
// LOG("WD7600: keyboard data read %02x\n", ret);
return ret;
}
-void wd7600_device::keyb_cmd_w(uint8_t data)
+WRITE8_MEMBER( wd7600_device::keyb_cmd_w )
{
// LOG("WD7600: keyboard command %02x\n", data);
- m_keybc->command_w(data);
+ m_keybc->command_w(space,0,data);
}
-uint8_t wd7600_device::keyb_status_r()
+READ8_MEMBER( wd7600_device::keyb_status_r )
{
- return m_keybc->status_r();
+ return m_keybc->status_r(space,0);
}
-uint8_t wd7600_device::portb_r()
+READ8_MEMBER( wd7600_device::portb_r )
{
return m_portb;
}
-void wd7600_device::portb_w(uint8_t data)
+WRITE8_MEMBER( wd7600_device::portb_w )
{
m_portb = (m_portb & 0xf0) | (data & 0x0f);
@@ -352,7 +352,7 @@ offs_t wd7600_device::page_offset()
return 0xff0000;
}
-uint8_t wd7600_device::dma_read_byte(offs_t offset)
+READ8_MEMBER( wd7600_device::dma_read_byte )
{
if (m_dma_channel == -1)
return 0xff;
@@ -360,7 +360,7 @@ uint8_t wd7600_device::dma_read_byte(offs_t offset)
return m_space->read_byte(page_offset() + offset);
}
-void wd7600_device::dma_write_byte(offs_t offset, uint8_t data)
+WRITE8_MEMBER( wd7600_device::dma_write_byte )
{
if (m_dma_channel == -1)
return;
@@ -368,7 +368,7 @@ void wd7600_device::dma_write_byte(offs_t offset, uint8_t data)
m_space->write_byte(page_offset() + offset, data);
}
-uint8_t wd7600_device::dma_read_word(offs_t offset)
+READ8_MEMBER( wd7600_device::dma_read_word )
{
if (m_dma_channel == -1)
return 0xff;
@@ -379,7 +379,7 @@ uint8_t wd7600_device::dma_read_word(offs_t offset)
return result;
}
-void wd7600_device::dma_write_word(offs_t offset, uint8_t data)
+WRITE8_MEMBER( wd7600_device::dma_write_word )
{
if (m_dma_channel == -1)
return;
@@ -401,8 +401,6 @@ WRITE_LINE_MEMBER( wd7600_device::dma1_eop_w )
void wd7600_device::set_dma_channel(int channel, bool state)
{
- //m_write_dack(channel, state);
-
if (!state)
{
m_dma_channel = channel;
@@ -440,7 +438,7 @@ WRITE_LINE_MEMBER( wd7600_device::kbrst_w )
m_kbrst = state;
}
-void wd7600_device::a20_reset_w(uint8_t data)
+WRITE8_MEMBER( wd7600_device::a20_reset_w )
{
m_alt_a20 = BIT(data,1);
a20m();
@@ -453,7 +451,7 @@ void wd7600_device::a20_reset_w(uint8_t data)
}
}
-uint8_t wd7600_device::a20_reset_r()
+READ8_MEMBER( wd7600_device::a20_reset_r )
{
uint8_t ret = 0;
if(m_alt_a20)
@@ -462,12 +460,12 @@ uint8_t wd7600_device::a20_reset_r()
}
// port 0x2072 - Refresh Control, and serial/parallel port address select
-uint16_t wd7600_device::refresh_r()
+READ16_MEMBER(wd7600_device::refresh_r)
{
return m_refresh_ctrl;
}
-void wd7600_device::refresh_w(uint16_t data)
+WRITE16_MEMBER(wd7600_device::refresh_w)
{
// TODO: select serial/parallel I/O port location
m_refresh_ctrl = data;
@@ -475,36 +473,36 @@ void wd7600_device::refresh_w(uint16_t data)
}
// port 0x2872 - chip select
-uint16_t wd7600_device::chipsel_r()
+READ16_MEMBER(wd7600_device::chipsel_r)
{
return m_chip_sel;
}
-void wd7600_device::chipsel_w(uint16_t data)
+WRITE16_MEMBER(wd7600_device::chipsel_w)
{
m_chip_sel = data;
LOG("WD7600: Chip Select write %04x\n", data);
}
// port 0x3872 - Memory Control
-uint16_t wd7600_device::mem_ctrl_r()
+READ16_MEMBER(wd7600_device::mem_ctrl_r)
{
return m_memory_ctrl;
}
-void wd7600_device::mem_ctrl_w(uint16_t data)
+WRITE16_MEMBER(wd7600_device::mem_ctrl_w)
{
m_memory_ctrl = data;
LOG("WD7600: Memory Control write %04x\n", data);
}
// port 0x4872 - Bank 0 and 1 start address
-uint16_t wd7600_device::bank_01_start_r(offs_t offset, uint16_t mem_mask)
+READ16_MEMBER(wd7600_device::bank_01_start_r)
{
return (m_bank_start[1] << 8) | m_bank_start[0];
}
-void wd7600_device::bank_01_start_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+WRITE16_MEMBER(wd7600_device::bank_01_start_w)
{
if(ACCESSING_BITS_0_7)
{
@@ -519,12 +517,12 @@ void wd7600_device::bank_01_start_w(offs_t offset, uint16_t data, uint16_t mem_m
}
// port 0x5072 - Bank 2 and 3 start address
-uint16_t wd7600_device::bank_23_start_r(offs_t offset, uint16_t mem_mask)
+READ16_MEMBER(wd7600_device::bank_23_start_r)
{
return (m_bank_start[3] << 8) | m_bank_start[2];
}
-void wd7600_device::bank_23_start_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+WRITE16_MEMBER(wd7600_device::bank_23_start_w)
{
if(ACCESSING_BITS_0_7)
{
@@ -539,24 +537,24 @@ void wd7600_device::bank_23_start_w(offs_t offset, uint16_t data, uint16_t mem_m
}
// port 0x5872 - split starting address (used for BIOS shadowing)
-uint16_t wd7600_device::split_addr_r()
+READ16_MEMBER(wd7600_device::split_addr_r)
{
return m_split_start;
}
-void wd7600_device::split_addr_w(uint16_t data)
+WRITE16_MEMBER(wd7600_device::split_addr_w)
{
m_split_start = data;
LOG("WD7600: Split start address write %04x\n", data);
}
// port 0x9872 - Diagnostic
-uint16_t wd7600_device::diag_r()
+READ16_MEMBER(wd7600_device::diag_r)
{
return m_diagnostic | 0xe080;
}
-void wd7600_device::diag_w(uint16_t data)
+WRITE16_MEMBER(wd7600_device::diag_w)
{
m_diagnostic = data;
LOG("WD7600: Diagnostic write %04x\n", data);
diff --git a/src/devices/machine/wd7600.h b/src/devices/machine/wd7600.h
index 43ddb00b038..8f40ed3116f 100644
--- a/src/devices/machine/wd7600.h
+++ b/src/devices/machine/wd7600.h
@@ -75,20 +75,20 @@ public:
DECLARE_WRITE_LINE_MEMBER( gatea20_w );
DECLARE_WRITE_LINE_MEMBER( kbrst_w );
- uint16_t refresh_r();
- void refresh_w(uint16_t data);
- uint16_t chipsel_r();
- void chipsel_w(uint16_t data);
- uint16_t mem_ctrl_r();
- void mem_ctrl_w(uint16_t data);
- uint16_t bank_01_start_r(offs_t offset, uint16_t mem_mask);
- void bank_01_start_w(offs_t offset, uint16_t data, uint16_t mem_mask);
- uint16_t bank_23_start_r(offs_t offset, uint16_t mem_mask);
- void bank_23_start_w(offs_t offset, uint16_t data, uint16_t mem_mask);
- uint16_t split_addr_r();
- void split_addr_w(uint16_t data);
- uint16_t diag_r();
- void diag_w(uint16_t data);
+ DECLARE_READ16_MEMBER(refresh_r);
+ DECLARE_WRITE16_MEMBER(refresh_w);
+ DECLARE_READ16_MEMBER(chipsel_r);
+ DECLARE_WRITE16_MEMBER(chipsel_w);
+ DECLARE_READ16_MEMBER(mem_ctrl_r);
+ DECLARE_WRITE16_MEMBER(mem_ctrl_w);
+ DECLARE_READ16_MEMBER(bank_01_start_r);
+ DECLARE_WRITE16_MEMBER(bank_01_start_w);
+ DECLARE_READ16_MEMBER(bank_23_start_r);
+ DECLARE_WRITE16_MEMBER(bank_23_start_w);
+ DECLARE_READ16_MEMBER(split_addr_r);
+ DECLARE_WRITE16_MEMBER(split_addr_w);
+ DECLARE_READ16_MEMBER(diag_r);
+ DECLARE_WRITE16_MEMBER(diag_w);
IRQ_CALLBACK_MEMBER(intack_cb) { return m_pic1->acknowledge(); }
@@ -101,39 +101,39 @@ protected:
private:
DECLARE_WRITE_LINE_MEMBER( pic1_int_w ) { m_write_intr(state); }
- uint8_t pic1_slave_ack_r(offs_t offset);
+ DECLARE_READ8_MEMBER( pic1_slave_ack_r );
DECLARE_WRITE_LINE_MEMBER( ctc_out1_w );
DECLARE_WRITE_LINE_MEMBER( ctc_out2_w );
- void rtc_w(offs_t offset, uint8_t data);
- void keyb_cmd_w(uint8_t data);
- void keyb_data_w(uint8_t data);
- uint8_t keyb_data_r();
- uint8_t keyb_status_r();
- void a20_reset_w(uint8_t data);
- uint8_t a20_reset_r();
- uint8_t portb_r();
- void portb_w(uint8_t data);
- void dma_page_w(offs_t offset, uint8_t data) { m_dma_page[offset & 0x0f] = data; }
- uint8_t dma_page_r(offs_t offset) { return m_dma_page[offset & 0x0f]; }
- uint8_t dma_read_byte(offs_t offset);
- void dma_write_byte(offs_t offset, uint8_t data);
- uint8_t dma_read_word(offs_t offset);
- void dma_write_word(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER( rtc_w );
+ DECLARE_WRITE8_MEMBER( keyb_cmd_w );
+ DECLARE_WRITE8_MEMBER( keyb_data_w );
+ DECLARE_READ8_MEMBER( keyb_data_r );
+ DECLARE_READ8_MEMBER( keyb_status_r );
+ DECLARE_WRITE8_MEMBER( a20_reset_w );
+ DECLARE_READ8_MEMBER( a20_reset_r );
+ DECLARE_READ8_MEMBER( portb_r );
+ DECLARE_WRITE8_MEMBER( portb_w );
+ DECLARE_WRITE8_MEMBER( dma_page_w ) { m_dma_page[offset & 0x0f] = data; }
+ DECLARE_READ8_MEMBER( dma_page_r ) { return m_dma_page[offset & 0x0f]; }
+ DECLARE_READ8_MEMBER( dma_read_byte );
+ DECLARE_WRITE8_MEMBER( dma_write_byte );
+ DECLARE_READ8_MEMBER( dma_read_word );
+ DECLARE_WRITE8_MEMBER( dma_write_word );
DECLARE_WRITE_LINE_MEMBER( dma1_eop_w );
- uint8_t dma1_ior0_r() { return m_read_ior(0); }
- uint8_t dma1_ior1_r() { return m_read_ior(1); }
- uint8_t dma1_ior2_r() { return m_read_ior(2); }
- uint8_t dma1_ior3_r() { return m_read_ior(3); }
- uint8_t dma2_ior1_r() { uint16_t result = m_read_ior(5); m_dma_high_byte = result >> 8; return result; }
- uint8_t dma2_ior2_r() { uint16_t result = m_read_ior(6); m_dma_high_byte = result >> 8; return result; }
- uint8_t dma2_ior3_r() { uint16_t result = m_read_ior(7); m_dma_high_byte = result >> 8; return result; }
- void dma1_iow0_w(uint8_t data) { m_write_iow(0, data, 0xffff); }
- void dma1_iow1_w(uint8_t data) { m_write_iow(1, data, 0xffff); }
- void dma1_iow2_w(uint8_t data) { m_write_iow(2, data, 0xffff); }
- void dma1_iow3_w(uint8_t data) { m_write_iow(3, data, 0xffff); }
- void dma2_iow1_w(uint8_t data) { m_write_iow(5, (m_dma_high_byte << 8) | data, 0xffff); }
- void dma2_iow2_w(uint8_t data) { m_write_iow(6, (m_dma_high_byte << 8) | data, 0xffff); }
- void dma2_iow3_w(uint8_t data) { m_write_iow(7, (m_dma_high_byte << 8) | data, 0xffff); }
+ DECLARE_READ8_MEMBER( dma1_ior0_r ) { return m_read_ior(0); }
+ DECLARE_READ8_MEMBER( dma1_ior1_r ) { return m_read_ior(1); }
+ DECLARE_READ8_MEMBER( dma1_ior2_r ) { return m_read_ior(2); }
+ DECLARE_READ8_MEMBER( dma1_ior3_r ) { return m_read_ior(3); }
+ DECLARE_READ8_MEMBER( dma2_ior1_r ) { uint16_t result = m_read_ior(5); m_dma_high_byte = result >> 8; return result; }
+ DECLARE_READ8_MEMBER( dma2_ior2_r ) { uint16_t result = m_read_ior(6); m_dma_high_byte = result >> 8; return result; }
+ DECLARE_READ8_MEMBER( dma2_ior3_r ) { uint16_t result = m_read_ior(7); m_dma_high_byte = result >> 8; return result; }
+ DECLARE_WRITE8_MEMBER( dma1_iow0_w ) { m_write_iow(0, data, 0xffff); }
+ DECLARE_WRITE8_MEMBER( dma1_iow1_w ) { m_write_iow(1, data, 0xffff); }
+ DECLARE_WRITE8_MEMBER( dma1_iow2_w ) { m_write_iow(2, data, 0xffff); }
+ DECLARE_WRITE8_MEMBER( dma1_iow3_w ) { m_write_iow(3, data, 0xffff); }
+ DECLARE_WRITE8_MEMBER( dma2_iow1_w ) { m_write_iow(5, (m_dma_high_byte << 8) | data, 0xffff); }
+ DECLARE_WRITE8_MEMBER( dma2_iow2_w ) { m_write_iow(6, (m_dma_high_byte << 8) | data, 0xffff); }
+ DECLARE_WRITE8_MEMBER( dma2_iow3_w ) { m_write_iow(7, (m_dma_high_byte << 8) | data, 0xffff); }
DECLARE_WRITE_LINE_MEMBER( dma1_dack0_w ) { set_dma_channel(0, state); }
DECLARE_WRITE_LINE_MEMBER( dma1_dack1_w ) { set_dma_channel(1, state); }
DECLARE_WRITE_LINE_MEMBER( dma1_dack2_w ) { set_dma_channel(2, state); }
diff --git a/src/devices/machine/x2201.cpp b/src/devices/machine/x2201.cpp
index 90d731b7e3e..ec252d1b8dd 100644
--- a/src/devices/machine/x2201.cpp
+++ b/src/devices/machine/x2201.cpp
@@ -128,6 +128,17 @@ u8 x2201_device::read(offs_t offset)
//-------------------------------------------------
+// read_byte - read 8 bits of data from RAM
+// (FIXME: remove once CRU reads are 1-bit)
+//-------------------------------------------------
+
+u8 x2201_device::read_byte(offs_t offset)
+{
+ return m_ram[offset & 127];
+}
+
+
+//-------------------------------------------------
// write - write one bit of data to RAM
//-------------------------------------------------
diff --git a/src/devices/machine/x2201.h b/src/devices/machine/x2201.h
index 1d873850df1..670c69b349c 100644
--- a/src/devices/machine/x2201.h
+++ b/src/devices/machine/x2201.h
@@ -38,6 +38,7 @@ public:
// read/write handlers
u8 read(offs_t offset);
+ u8 read_byte(offs_t offset); // hack
void write(offs_t offset, u8 data);
// control lines
diff --git a/src/devices/machine/xc1700e.cpp b/src/devices/machine/xc1700e.cpp
deleted file mode 100644
index fe056664b07..00000000000
--- a/src/devices/machine/xc1700e.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Patrick Mackinlay
-
-/*
- * An implementation of the Xilinx XC1700E family of serial configuration PROM
- * devices, including:
- *
- * Part Capacity Variants
- * -------- --------- ----------------
- * XC1736E 36,288
- * XC1765E 65,536 XC1765EL
- * XC17128E 131,072 XC17128EL
- * XC17256E 262,144 XC17256EL
- * XC17512L 524,288
- * XC1701 1,048,576 XC1701L, XQ1701L
- * XC1702L 2,097,152
- * XC1704L 4,194,304
- *
- * The input CÌ…EÌ… and CLK lines have not been explicitly implemented; these are
- * assumed to be asserted as expected before/during data read. The effect of
- * CÌ…EÌ…OÌ… can be obtained by connecting the cascade_r callback to the data_r of
- * the cascaded device and resetting all devices when needed.
- *
- * This implementation assumes the input data is stored least-significant bit
- * first; i.e. the first bit read out of the device is held in the LSB of the
- * first byte of the memory region. This convention matches at least one
- * dumping device tested.
- *
- * Sources:
- *
- * http://www.xilinx.com/support/documentation/data_sheets/ds027.pdf
- *
- */
-
-#include "emu.h"
-#include "xc1700e.h"
-
-#define VERBOSE 0
-#include "logmacro.h"
-
-DEFINE_DEVICE_TYPE(XC1736E, xc1736e_device, "xc1736e", "Xilinx 36,288 bit Serial PROM")
-DEFINE_DEVICE_TYPE(XC1765E, xc1765e_device, "xc1765e", "Xilinx 65,536 bit Serial PROM")
-DEFINE_DEVICE_TYPE(XC17128E, xc17128e_device, "xc17128e", "Xilinx 131,072 bit Serial PROM")
-DEFINE_DEVICE_TYPE(XC17256E, xc17256e_device, "xc17256e", "Xilinx 262,144 bit Serial PROM")
-DEFINE_DEVICE_TYPE(XC17512L, xc17512l_device, "xc17512l", "Xilinx 524,288 bit Serial PROM")
-DEFINE_DEVICE_TYPE(XC1701, xc1701_device, "xc1701", "Xilinx 1,048,576 bit Serial PROM")
-DEFINE_DEVICE_TYPE(XC1702L, xc1702l_device, "xc1702l", "Xilinx 2,097,152 bit Serial PROM")
-DEFINE_DEVICE_TYPE(XC1704L, xc1704l_device, "xc1704l", "Xilinx 4,194,304 bit Serial PROM")
-
-base_xc1700e_device::base_xc1700e_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 capacity)
- : device_t(mconfig, type, tag, owner, clock)
- , m_capacity(capacity)
- , m_region(*this, DEVICE_SELF)
- , m_cascade_cb(*this)
- , m_reset(true)
- , m_address(0)
-{
-}
-
-void base_xc1700e_device::device_start()
-{
- m_cascade_cb.resolve_safe(1);
-
- save_item(NAME(m_reset));
- save_item(NAME(m_address));
-}
-
-void base_xc1700e_device::reset_w(int state)
-{
- if (state)
- m_address = 0;
-
- m_reset = bool(state);
-}
-
-int base_xc1700e_device::data_r()
-{
- if (m_reset)
- return 1;
-
- if (m_address < m_capacity)
- {
- int const data = BIT(m_region->as_u8(m_address >> 3), m_address & 7);
-
- m_address++;
-
- return data;
- }
- else
- return m_cascade_cb();
-}
diff --git a/src/devices/machine/xc1700e.h b/src/devices/machine/xc1700e.h
deleted file mode 100644
index 42a191c73ce..00000000000
--- a/src/devices/machine/xc1700e.h
+++ /dev/null
@@ -1,118 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Patrick Mackinlay
-
-#ifndef MAME_MACHINE_XC1700E_H
-#define MAME_MACHINE_XC1700E_H
-
-#pragma once
-
-class base_xc1700e_device : public device_t
-{
-public:
- // configuration
- auto cascade_r() { return m_cascade_cb.bind(); }
-
- // input/output lines
- void reset_w(int state);
- int data_r();
-
-protected:
- base_xc1700e_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 capacity);
-
- // device_t overrides
- virtual void device_start() override;
-
-private:
- // device configuration
- const u32 m_capacity;
- required_memory_region m_region;
-
- devcb_read_line m_cascade_cb;
-
- // device state
- bool m_reset;
- unsigned m_address;
-};
-
-DECLARE_DEVICE_TYPE(XC1736E, xc1736e_device)
-DECLARE_DEVICE_TYPE(XC1765E, xc1765e_device)
-DECLARE_DEVICE_TYPE(XC17128E, xc17128e_device)
-DECLARE_DEVICE_TYPE(XC17256E, xc17256e_device)
-DECLARE_DEVICE_TYPE(XC17512L, xc17512l_device)
-DECLARE_DEVICE_TYPE(XC1701, xc1701_device)
-DECLARE_DEVICE_TYPE(XC1702L, xc1702l_device)
-DECLARE_DEVICE_TYPE(XC1704L, xc1704l_device)
-
-class xc1736e_device : public base_xc1700e_device
-{
-public:
- xc1736e_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
- : base_xc1700e_device(mconfig, XC1736E, tag, owner, clock, 36'288UL)
- {
- }
-};
-
-class xc1765e_device : public base_xc1700e_device
-{
-public:
- xc1765e_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
- : base_xc1700e_device(mconfig, XC1765E, tag, owner, clock, 65'536UL)
- {
- }
-};
-
-class xc17128e_device : public base_xc1700e_device
-{
-public:
- xc17128e_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
- : base_xc1700e_device(mconfig, XC17128E, tag, owner, clock, 131'072UL)
- {
- }
-};
-
-class xc17256e_device : public base_xc1700e_device
-{
-public:
- xc17256e_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
- : base_xc1700e_device(mconfig, XC17256E, tag, owner, clock, 262'144UL)
- {
- }
-};
-
-class xc17512l_device : public base_xc1700e_device
-{
-public:
- xc17512l_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
- : base_xc1700e_device(mconfig, XC17512L, tag, owner, clock, 524'288UL)
- {
- }
-};
-
-class xc1701_device : public base_xc1700e_device
-{
-public:
- xc1701_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
- : base_xc1700e_device(mconfig, XC1701, tag, owner, clock, 1'048'576UL)
- {
- }
-};
-
-class xc1702l_device : public base_xc1700e_device
-{
-public:
- xc1702l_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
- : base_xc1700e_device(mconfig, XC1702L, tag, owner, clock, 2'097'152UL)
- {
- }
-};
-
-class xc1704l_device : public base_xc1700e_device
-{
-public:
- xc1704l_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
- : base_xc1700e_device(mconfig, XC1704L, tag, owner, clock, 4'194'304UL)
- {
- }
-};
-
-#endif // MAME_MACHINE_XC1700E_H
diff --git a/src/devices/machine/ym2148.cpp b/src/devices/machine/ym2148.cpp
index 04a3e53e97e..10eb9c9e6c9 100644
--- a/src/devices/machine/ym2148.cpp
+++ b/src/devices/machine/ym2148.cpp
@@ -143,7 +143,7 @@ void ym2148_device::device_timer(emu_timer &timer, device_timer_id id, int param
}
-uint8_t ym2148_device::read(offs_t offset)
+READ8_MEMBER(ym2148_device::read)
{
switch (offset & 7)
{
@@ -165,7 +165,7 @@ uint8_t ym2148_device::read(offs_t offset)
}
-void ym2148_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER(ym2148_device::write)
{
switch (offset & 7)
{
diff --git a/src/devices/machine/ym2148.h b/src/devices/machine/ym2148.h
index 3cb13bf2058..7f5f45d7066 100644
--- a/src/devices/machine/ym2148.h
+++ b/src/devices/machine/ym2148.h
@@ -31,8 +31,8 @@ public:
auto port_read_handler() { return m_port_read_handler.bind(); }
auto irq_handler() { return m_irq_handler.bind(); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
DECLARE_WRITE_LINE_MEMBER(write_rxd);
uint8_t get_irq_vector();
diff --git a/src/devices/machine/z80scc.cpp b/src/devices/machine/z80scc.cpp
index b44be5c5873..711d58b8b49 100644
--- a/src/devices/machine/z80scc.cpp
+++ b/src/devices/machine/z80scc.cpp
@@ -84,9 +84,9 @@ baud rate:
-- in the unlikely case of T == 0, pretend T = 1.
- If the required wr11 bits are set:
-- let's say M = wr4 D7,D6 if 1,1 M = 64; if 1,0 M = 32; if 0,1 M = 16 else M = 1
--- so, the required device clock = 2*T*B*M.
+-- so, the required clock on the MCFG_DEVICE_ADD line = 2*T*B*M.
- If the required wr11 bits are not set:
--- call: configure_channels(X, 0, Y, 0), where X = channel-A-baud * T,
+-- add a line: MCFG_Z80SCC_OFFSETS(X, 0, Y, 0), where X = channel-A-baud * T,
and Y = channel-B-baud * T.
***************************************************************************/
@@ -436,7 +436,6 @@ z80scc_device::z80scc_device(const machine_config &mconfig, device_type type, co
m_out_rxdrq_cb{ { *this }, { *this } },
m_out_txdrq_cb{ { *this }, { *this } },
m_out_int_cb(*this),
- m_out_int_state(CLEAR_LINE),
m_variant(variant),
m_wr0_ptrbits(0),
m_cputag(nullptr)
@@ -518,7 +517,6 @@ void z80scc_device::device_start()
LOG("%s", FUNCNAME);
// state saving
- save_item(NAME(m_out_int_state));
save_item(NAME(m_int_state));
save_item(NAME(m_int_source));
save_item(NAME(m_wr9));
@@ -683,12 +681,8 @@ void z80scc_device::z80daisy_irq_reti()
void z80scc_device::check_interrupts()
{
int state = (z80daisy_irq_state() & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE;
- if (m_out_int_state != state)
- {
- m_out_int_state = state;
- LOGINT("%s\n", FUNCNAME);
- m_out_int_cb(state);
- }
+ LOGINT("%s %s \n",tag(), FUNCNAME);
+ m_out_int_cb(state);
}
diff --git a/src/devices/machine/z80scc.h b/src/devices/machine/z80scc.h
index 3e8812707dc..e2cad9e660b 100644
--- a/src/devices/machine/z80scc.h
+++ b/src/devices/machine/z80scc.h
@@ -467,7 +467,6 @@ protected:
devcb_write_line m_out_int_cb;
- int m_out_int_state;
int m_int_state[6]; // interrupt state
int m_int_source[6]; // interrupt source
diff --git a/src/devices/machine/z80sio.cpp b/src/devices/machine/z80sio.cpp
index 8337aeafdf6..82997875f46 100644
--- a/src/devices/machine/z80sio.cpp
+++ b/src/devices/machine/z80sio.cpp
@@ -242,17 +242,15 @@ DEFINE_DEVICE_TYPE(UPD7201_NEW, upd7201_new_device, "upd7201_new", "NEC uP
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void z80sio_device::device_add_mconfig(machine_config &config)
-{
- Z80SIO_CHANNEL(config, CHANA_TAG, 0);
- Z80SIO_CHANNEL(config, CHANB_TAG, 0);
-}
-
-void i8274_new_device::device_add_mconfig(machine_config &config)
-{
- I8274_CHANNEL(config, CHANA_TAG, 0);
- I8274_CHANNEL(config, CHANB_TAG, 0);
-}
+MACHINE_CONFIG_START(z80sio_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(CHANA_TAG, Z80SIO_CHANNEL, 0)
+ MCFG_DEVICE_ADD(CHANB_TAG, Z80SIO_CHANNEL, 0)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(i8274_new_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(CHANA_TAG, I8274_CHANNEL, 0)
+ MCFG_DEVICE_ADD(CHANB_TAG, I8274_CHANNEL, 0)
+MACHINE_CONFIG_END
//**************************************************************************
diff --git a/src/devices/sound/2203intf.cpp b/src/devices/sound/2203intf.cpp
index 02ad8a41579..faf3072e94e 100644
--- a/src/devices/sound/2203intf.cpp
+++ b/src/devices/sound/2203intf.cpp
@@ -130,34 +130,34 @@ void ym2203_device::device_reset()
}
-u8 ym2203_device::read(offs_t offset)
+READ8_MEMBER( ym2203_device::read )
{
return ym2203_read(m_chip, offset & 1);
}
-void ym2203_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( ym2203_device::write )
{
ym2203_write(m_chip, offset & 1, data);
}
-u8 ym2203_device::status_port_r()
+READ8_MEMBER( ym2203_device::status_port_r )
{
- return read(0);
+ return read(space, 0);
}
-u8 ym2203_device::read_port_r()
+READ8_MEMBER( ym2203_device::read_port_r )
{
- return read(1);
+ return read(space, 1);
}
-void ym2203_device::control_port_w(u8 data)
+WRITE8_MEMBER( ym2203_device::control_port_w )
{
- write(0, data);
+ write(space, 0, data);
}
-void ym2203_device::write_port_w(u8 data)
+WRITE8_MEMBER( ym2203_device::write_port_w )
{
- write(1, data);
+ write(space, 1, data);
}
DEFINE_DEVICE_TYPE(YM2203, ym2203_device, "ym2203", "YM2203 OPN")
diff --git a/src/devices/sound/2203intf.h b/src/devices/sound/2203intf.h
index 8dd456f50bd..93e09d9a9dc 100644
--- a/src/devices/sound/2203intf.h
+++ b/src/devices/sound/2203intf.h
@@ -20,13 +20,13 @@ public:
template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
auto irq_handler() { return m_irq_handler.bind(); }
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
- u8 status_port_r();
- u8 read_port_r();
- void control_port_w(u8 data);
- void write_port_w(u8 data);
+ DECLARE_READ8_MEMBER( status_port_r );
+ DECLARE_READ8_MEMBER( read_port_r );
+ DECLARE_WRITE8_MEMBER( control_port_w );
+ DECLARE_WRITE8_MEMBER( write_port_w );
// update request from fm.cpp
static void update_request(device_t *param) { downcast<ym2203_device *>(param)->update_request(); }
diff --git a/src/devices/sound/2608intf.cpp b/src/devices/sound/2608intf.cpp
index 6c31c2aea0f..1445de91f37 100644
--- a/src/devices/sound/2608intf.cpp
+++ b/src/devices/sound/2608intf.cpp
@@ -141,12 +141,12 @@ void ym2608_device::rom_bank_updated()
}
-u8 ym2608_device::read(offs_t offset)
+READ8_MEMBER( ym2608_device::read )
{
return ym2608_read(m_chip, offset & 3);
}
-void ym2608_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( ym2608_device::write )
{
ym2608_write(m_chip, offset & 3, data);
}
diff --git a/src/devices/sound/2608intf.h b/src/devices/sound/2608intf.h
index 23506b66eea..76c69ec3961 100644
--- a/src/devices/sound/2608intf.h
+++ b/src/devices/sound/2608intf.h
@@ -21,8 +21,8 @@ public:
template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
auto irq_handler() { return m_irq_handler.bind(); }
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
// update request from fm.cpp
static void update_request(device_t *param) { downcast<ym2608_device *>(param)->update_request(); }
diff --git a/src/devices/sound/2610intf.cpp b/src/devices/sound/2610intf.cpp
index fe4077b2d40..84598507274 100644
--- a/src/devices/sound/2610intf.cpp
+++ b/src/devices/sound/2610intf.cpp
@@ -164,12 +164,12 @@ device_memory_interface::space_config_vector ym2610_device::memory_space_config(
}
-u8 ym2610_device::read(offs_t offset)
+READ8_MEMBER( ym2610_device::read )
{
return ym2610_read(m_chip, offset & 3);
}
-void ym2610_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( ym2610_device::write )
{
ym2610_write(m_chip, offset & 3, data);
}
diff --git a/src/devices/sound/2610intf.h b/src/devices/sound/2610intf.h
index 1a1515e081c..ff736e4890e 100644
--- a/src/devices/sound/2610intf.h
+++ b/src/devices/sound/2610intf.h
@@ -23,8 +23,8 @@ public:
virtual space_config_vector memory_space_config() const override;
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
// update request from fm.cpp
static void update_request(device_t *param) { downcast<ym2610_device *>(param)->update_request(); }
diff --git a/src/devices/sound/2612intf.cpp b/src/devices/sound/2612intf.cpp
index b8e440666ec..21ca436a004 100644
--- a/src/devices/sound/2612intf.cpp
+++ b/src/devices/sound/2612intf.cpp
@@ -129,12 +129,12 @@ void ym2612_device::device_reset()
}
-u8 ym2612_device::read(offs_t offset)
+READ8_MEMBER( ym2612_device::read )
{
return ym2612_read(m_chip, offset & 3);
}
-void ym2612_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( ym2612_device::write )
{
ym2612_write(m_chip, offset & 3, data);
}
diff --git a/src/devices/sound/2612intf.h b/src/devices/sound/2612intf.h
index 13255b59e8f..5dc31593685 100644
--- a/src/devices/sound/2612intf.h
+++ b/src/devices/sound/2612intf.h
@@ -15,8 +15,8 @@ public:
template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
auto irq_handler() { return m_irq_handler.bind(); }
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
// update request from fm.cpp
static void update_request(device_t *param) { downcast<ym2612_device *>(param)->update_request(); }
diff --git a/src/devices/sound/262intf.cpp b/src/devices/sound/262intf.cpp
index 0de5e274ca9..905d9afd8b6 100644
--- a/src/devices/sound/262intf.cpp
+++ b/src/devices/sound/262intf.cpp
@@ -121,12 +121,12 @@ void ymf262_device::device_clock_changed()
m_stream->set_sample_rate(rate);
}
-u8 ymf262_device::read(offs_t offset)
+READ8_MEMBER( ymf262_device::read )
{
return ymf262_read(m_chip, offset & 3);
}
-void ymf262_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( ymf262_device::write )
{
ymf262_write(m_chip, offset & 3, data);
}
diff --git a/src/devices/sound/262intf.h b/src/devices/sound/262intf.h
index 816b2903831..96d819b761b 100644
--- a/src/devices/sound/262intf.h
+++ b/src/devices/sound/262intf.h
@@ -13,8 +13,8 @@ public:
// configuration helpers
auto irq_handler() { return m_irq_handler.bind(); }
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
protected:
// device-level overrides
diff --git a/src/devices/sound/3526intf.cpp b/src/devices/sound/3526intf.cpp
index 2418b9e65a1..86ee4a5c0b7 100644
--- a/src/devices/sound/3526intf.cpp
+++ b/src/devices/sound/3526intf.cpp
@@ -130,20 +130,20 @@ void ym3526_device::device_reset()
}
-u8 ym3526_device::read(offs_t offset)
+READ8_MEMBER( ym3526_device::read )
{
return ym3526_read(m_chip, offset & 1);
}
-void ym3526_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( ym3526_device::write )
{
ym3526_write(m_chip, offset & 1, data);
}
-u8 ym3526_device::status_port_r() { return read(0); }
-u8 ym3526_device::read_port_r() { return read(1); }
-void ym3526_device::control_port_w(u8 data) { write(0, data); }
-void ym3526_device::write_port_w(u8 data) { write(1, data); }
+READ8_MEMBER( ym3526_device::status_port_r ) { return read(space, 0); }
+READ8_MEMBER( ym3526_device::read_port_r ) { return read(space, 1); }
+WRITE8_MEMBER( ym3526_device::control_port_w ) { write(space, 0, data); }
+WRITE8_MEMBER( ym3526_device::write_port_w ) { write(space, 1, data); }
DEFINE_DEVICE_TYPE(YM3526, ym3526_device, "ym3526", "YM3526 OPL")
diff --git a/src/devices/sound/3526intf.h b/src/devices/sound/3526intf.h
index c880cfcfc51..338ffb1f2b4 100644
--- a/src/devices/sound/3526intf.h
+++ b/src/devices/sound/3526intf.h
@@ -15,13 +15,13 @@ public:
template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
auto irq_handler() { return m_irq_handler.bind(); }
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
- u8 status_port_r();
- u8 read_port_r();
- void control_port_w(u8 data);
- void write_port_w(u8 data);
+ DECLARE_READ8_MEMBER( status_port_r );
+ DECLARE_READ8_MEMBER( read_port_r );
+ DECLARE_WRITE8_MEMBER( control_port_w );
+ DECLARE_WRITE8_MEMBER( write_port_w );
protected:
// device-level overrides
diff --git a/src/devices/sound/3812intf.cpp b/src/devices/sound/3812intf.cpp
index 9b29af0599d..6818a531371 100644
--- a/src/devices/sound/3812intf.cpp
+++ b/src/devices/sound/3812intf.cpp
@@ -131,20 +131,20 @@ void ym3812_device::device_reset()
}
-u8 ym3812_device::read(offs_t offset)
+READ8_MEMBER( ym3812_device::read )
{
return ym3812_read(m_chip, offset & 1);
}
-void ym3812_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( ym3812_device::write )
{
ym3812_write(m_chip, offset & 1, data);
}
-u8 ym3812_device::status_port_r() { return read(0); }
-u8 ym3812_device::read_port_r() { return read(1); }
-void ym3812_device::control_port_w(u8 data) { write(0, data); }
-void ym3812_device::write_port_w(u8 data) { write(1, data); }
+READ8_MEMBER( ym3812_device::status_port_r ) { return read(space, 0); }
+READ8_MEMBER( ym3812_device::read_port_r ) { return read(space, 1); }
+WRITE8_MEMBER( ym3812_device::control_port_w ) { write(space, 0, data); }
+WRITE8_MEMBER( ym3812_device::write_port_w ) { write(space, 1, data); }
DEFINE_DEVICE_TYPE(YM3812, ym3812_device, "ym3812", "YM3812 OPL2")
diff --git a/src/devices/sound/3812intf.h b/src/devices/sound/3812intf.h
index 56a6accb30a..5a4f4eeae2e 100644
--- a/src/devices/sound/3812intf.h
+++ b/src/devices/sound/3812intf.h
@@ -13,13 +13,13 @@ public:
template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
auto irq_handler() { return m_irq_handler.bind(); }
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
- u8 status_port_r();
- u8 read_port_r();
- void control_port_w(u8 data);
- void write_port_w(u8 data);
+ DECLARE_READ8_MEMBER( status_port_r );
+ DECLARE_READ8_MEMBER( read_port_r );
+ DECLARE_WRITE8_MEMBER( control_port_w );
+ DECLARE_WRITE8_MEMBER( write_port_w );
protected:
// device-level overrides
diff --git a/src/devices/sound/8950intf.cpp b/src/devices/sound/8950intf.cpp
index 601c9861f33..f56f34c88f9 100644
--- a/src/devices/sound/8950intf.cpp
+++ b/src/devices/sound/8950intf.cpp
@@ -138,20 +138,20 @@ void y8950_device::rom_bank_updated()
}
-u8 y8950_device::read(offs_t offset)
+READ8_MEMBER( y8950_device::read )
{
return y8950_read(m_chip, offset & 1);
}
-void y8950_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( y8950_device::write )
{
y8950_write(m_chip, offset & 1, data);
}
-u8 y8950_device::status_port_r() { return read(0); }
-u8 y8950_device::read_port_r() { return read(1); }
-void y8950_device::control_port_w(u8 data) { write(0, data); }
-void y8950_device::write_port_w(u8 data) { write(1, data); }
+READ8_MEMBER( y8950_device::status_port_r ) { return read(space, 0); }
+READ8_MEMBER( y8950_device::read_port_r ) { return read(space, 1); }
+WRITE8_MEMBER( y8950_device::control_port_w ) { write(space, 0, data); }
+WRITE8_MEMBER( y8950_device::write_port_w ) { write(space, 1, data); }
DEFINE_DEVICE_TYPE(Y8950, y8950_device, "y8950", "Y8950 MSX-Audio")
diff --git a/src/devices/sound/8950intf.h b/src/devices/sound/8950intf.h
index ac4584626e4..fd65a036ef8 100644
--- a/src/devices/sound/8950intf.h
+++ b/src/devices/sound/8950intf.h
@@ -20,13 +20,13 @@ public:
auto io_read() { return m_io_read_handler.bind(); }
auto io_write() { return m_io_write_handler.bind(); }
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
- u8 status_port_r();
- u8 read_port_r();
- void control_port_w(u8 data);
- void write_port_w(u8 data);
+ DECLARE_READ8_MEMBER( status_port_r );
+ DECLARE_READ8_MEMBER( read_port_r );
+ DECLARE_WRITE8_MEMBER( control_port_w );
+ DECLARE_WRITE8_MEMBER( write_port_w );
protected:
// device-level overrides
diff --git a/src/devices/sound/ad1848.cpp b/src/devices/sound/ad1848.cpp
index 5db5b3ded2d..1049a03a177 100644
--- a/src/devices/sound/ad1848.cpp
+++ b/src/devices/sound/ad1848.cpp
@@ -29,6 +29,7 @@ void ad1848_device::device_add_mconfig(machine_config &config)
DAC_16BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5); // unknown DAC
DAC_16BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref", 0));
+ vref.set_output(5.0);
vref.add_route(0, "ldac", 1.0, DAC_VREF_POS_INPUT);
vref.add_route(0, "ldac", -1.0, DAC_VREF_NEG_INPUT);
vref.add_route(0, "rdac", 1.0, DAC_VREF_POS_INPUT);
diff --git a/src/devices/sound/astrocde.cpp b/src/devices/sound/astrocde.cpp
index 33ae926f34c..e3600a88286 100644
--- a/src/devices/sound/astrocde.cpp
+++ b/src/devices/sound/astrocde.cpp
@@ -86,7 +86,7 @@ astrocade_io_device::astrocade_io_device(const machine_config &mconfig, const ch
, m_c_state(0)
, m_si_callback(*this)
, m_so_callback{{*this}, {*this}, {*this}, {*this}, {*this}, {*this}, {*this}, {*this}}
- , m_pots{{*this}, {*this}, {*this}, {*this}}
+ , m_pots(*this, {finder_base::DUMMY_TAG, finder_base::DUMMY_TAG, finder_base::DUMMY_TAG, finder_base::DUMMY_TAG})
{
memset(m_reg, 0, sizeof(uint8_t)*8);
memset(m_bitswap, 0, sizeof(uint8_t)*256);
@@ -104,8 +104,6 @@ void astrocade_io_device::device_resolve_objects()
m_si_callback.resolve_safe(0);
for (auto &cb : m_so_callback)
cb.resolve_safe();
- for (auto &pot : m_pots)
- pot.resolve_safe(0);
}
@@ -325,7 +323,7 @@ READ8_MEMBER(astrocade_io_device::read)
return m_si_callback(space, offset & 7);
}
else if ((offset & 0x0f) >= 0x0c)
- return m_pots[offset & 3]();
+ return m_pots[offset & 3].read_safe(0);
else
return 0xff;
}
diff --git a/src/devices/sound/astrocde.h b/src/devices/sound/astrocde.h
index eddde3a12bb..7eaae126f4f 100644
--- a/src/devices/sound/astrocde.h
+++ b/src/devices/sound/astrocde.h
@@ -49,7 +49,7 @@ public:
// configuration access
auto si_cb() { return m_si_callback.bind(); }
template <std::size_t Bit> auto so_cb() { return m_so_callback[Bit].bind(); }
- template <std::size_t Pot> auto pot_cb() { return m_pots[Pot].bind(); }
+ template <std::size_t Pot> void set_pot_tag(const char *tag) { m_pots[Pot].set_tag(tag); }
protected:
// device-level overrides
@@ -90,7 +90,7 @@ private:
devcb_read8 m_si_callback;
devcb_write8 m_so_callback[8];
- devcb_read8 m_pots[4];
+ optional_ioport_array<4> m_pots;
};
DECLARE_DEVICE_TYPE(ASTROCADE_IO, astrocade_io_device)
diff --git a/src/devices/sound/ay8910.cpp b/src/devices/sound/ay8910.cpp
index 9ee02834f67..71dd5854725 100644
--- a/src/devices/sound/ay8910.cpp
+++ b/src/devices/sound/ay8910.cpp
@@ -120,7 +120,7 @@
/***************************************************************************
- ay8910.cpp
+ ay8910.c
Emulation of the AY-3-8910 / YM2149 sound chip.
@@ -511,56 +511,6 @@ Yamaha YMZ294: limited info: 0 I/O port
between 4MHz (H) and 6MHz (L), while pin 10 is /TEST.
OKI M5255, Winbond WF19054, JFC 95101, File KC89C72, Toshiba T7766A : differences to be listed
-AY8930 Expanded mode registers :
- Bank Register Bits
- A 0 xxxx xxxx Channel A Tone period fine tune
- A 1 xxxx xxxx Channel A Tone period coarse tune
- A 2 xxxx xxxx Channel B Tone period fine tune
- A 3 xxxx xxxx Channel B Tone period coarse tune
- A 4 xxxx xxxx Channel C Tone period fine tune
- A 5 xxxx xxxx Channel C Tone period coarse tune
- A 6 xxxx xxxx Noise period
- A 7 x--- ---- I/O Port B input(0) / output(1)
- -x-- ---- I/O Port A input(0) / output(1)
- --x- ---- Channel C Noise enable(0) / disable(1)
- ---x ---- Channel B Noise enable(0) / disable(1)
- ---- x--- Channel A Noise enable(0) / disable(1)
- ---- -x-- Channel C Tone enable(0) / disable(1)
- ---- --x- Channel B Tone enable(0) / disable(1)
- ---- ---x Channel A Tone enable(0) / disable(1)
- A 8 --x- ---- Channel A Envelope mode
- ---x xxxx Channel A Tone volume
- A 9 --x- ---- Channel B Envelope mode
- ---x xxxx Channel B Tone volume
- A A --x- ---- Channel C Envelope mode
- ---x xxxx Channel C Tone volume
- A B xxxx xxxx Channel A Envelope period fine tune
- A C xxxx xxxx Channel A Envelope period coarse tune
- A D 101- ---- 101 = Expanded mode enable, other AY-3-8910A Compatiblity mode
- ---0 ---- 0 for Register Bank A
- ---- xxxx Channel A Envelope Shape/Cycle
- A E xxxx xxxx 8 bit Parallel I/O on Port A
- A F xxxx xxxx 8 bit Parallel I/O on Port B
-
- B 0 xxxx xxxx Channel B Envelope period fine tune
- B 1 xxxx xxxx Channel B Envelope period coarse tune
- B 2 xxxx xxxx Channel C Envelope period fine tune
- B 3 xxxx xxxx Channel C Envelope period coarse tune
- B 4 ---- xxxx Channel B Envelope Shape/Cycle
- B 5 ---- xxxx Channel C Envelope Shape/Cycle
- B 6 ---- xxxx Channel A Duty Cycle
- B 7 ---- xxxx Channel B Duty Cycle
- B 8 ---- xxxx Channel C Duty Cycle
- B 9 xxxx xxxx Noise "And" Mask
- B A xxxx xxxx Noise "Or" Mask
- B B Reserved (Read as 0)
- B C Reserved (Read as 0)
- B D 101- ---- 101 = Expanded mode enable, other AY-3-8910A Compatiblity mode
- ---1 ---- 1 for Register Bank B
- ---- xxxx Channel A Envelope Shape
- B E Reserved (Read as 0)
- B F Test (Function unknown)
-
Decaps:
AY-3-8914 - http://siliconpr0n.org/map/gi/ay-3-8914/mz_mit20x/
AY-3-8910 - http://privatfrickler.de/blick-auf-den-chip-soundchip-general-instruments-ay-3-8910/
@@ -785,7 +735,7 @@ static const ay8910_device::mosfet_param ay8910_mosfet_param =
*
*************************************/
-static inline void build_3D_table(double rl, const ay8910_device::ay_ym_param *par, const ay8910_device::ay_ym_param *par_env, int normalize, double factor, int zero_is_off, s32 *tab)
+static inline void build_3D_table(double rl, const ay8910_device::ay_ym_param *par, const ay8910_device::ay_ym_param *par_env, int normalize, double factor, int zero_is_off, int32_t *tab)
{
double min = 10.0, max = 0.0;
@@ -844,7 +794,7 @@ static inline void build_3D_table(double rl, const ay8910_device::ay_ym_param *p
/* for (e=0;e<16;e++) printf("%d %d\n",e<<10, tab[e<<10]); */
}
-static inline void build_single_table(double rl, const ay8910_device::ay_ym_param *par, int normalize, s32 *tab, int zero_is_off)
+static inline void build_single_table(double rl, const ay8910_device::ay_ym_param *par, int normalize, int32_t *tab, int zero_is_off)
{
int j;
double rt;
@@ -883,7 +833,7 @@ static inline void build_single_table(double rl, const ay8910_device::ay_ym_para
}
-static inline void build_mosfet_resistor_table(const ay8910_device::mosfet_param &par, const double rd, s32 *tab)
+static inline void build_mosfet_resistor_table(const ay8910_device::mosfet_param &par, const double rd, int32_t *tab)
{
int j;
@@ -907,7 +857,7 @@ static inline void build_mosfet_resistor_table(const ay8910_device::mosfet_param
}
-u16 ay8910_device::mix_3D()
+uint16_t ay8910_device::mix_3D()
{
int indx = 0, chan;
@@ -939,7 +889,6 @@ u16 ay8910_device::mix_3D()
void ay8910_device::ay8910_write_reg(int r, int v)
{
//if (r >= 11 && r <= 13 ) printf("%d %x %02x\n", PSG->index, r, v);
- device_type chip_type = type();
m_regs[r] = v;
switch( r )
@@ -981,14 +930,6 @@ void ay8910_device::ay8910_write_reg(int r, int v)
m_last_enable = m_regs[AY_ENABLE];
break;
case AY_ESHAPE:
- if (chip_type == AY8930)
- {
- m_mode = (v >> 4) & 0xf;
- if ((m_mode & 0xe) == 0xa) // AY8930 expanded mode
- logerror("warning: activated unemulated extended mode at %s, bank %02x\n", name(), m_mode & 1);
- else if (m_mode & 0xf)
- logerror("warning: activated unknown mode %02x at %s\n", m_mode & 0xf, name());
- }
if ( (v & 0x0f) > 0)
osd_printf_verbose("EShape\n");
m_attack = (m_regs[AY_ESHAPE] & 0x04) ? m_env_step_mask : 0x00;
@@ -1234,7 +1175,6 @@ void ay8910_device::ay8910_statesave()
save_item(NAME(m_attack));
save_item(NAME(m_holding));
save_item(NAME(m_rng));
- save_item(NAME(m_mode));
}
//-------------------------------------------------
@@ -1262,7 +1202,7 @@ void ay8910_device::device_start()
m_streams = 1;
}
- m_vol3d_table = make_unique_clear<s32[]>(8*32*32*32);
+ m_vol3d_table = make_unique_clear<int32_t[]>(8*32*32*32);
build_mixer_table();
@@ -1293,7 +1233,7 @@ void ay8910_device::ay8910_reset_ym()
m_count_env = 0;
m_prescale_noise = 0;
m_last_enable = -1; /* force a write */
- for (i = 0; i < AY_PORTA; i++)
+ for (i = 0;i < AY_PORTA;i++)
ay8910_write_reg(i,0);
m_ready = 1;
#if ENABLE_REGISTER_TEST
@@ -1338,7 +1278,7 @@ void ay8910_device::device_clock_changed()
ay_set_clock(clock());
}
-void ay8910_device::ay8910_write_ym(int addr, u8 data)
+void ay8910_device::ay8910_write_ym(int addr, uint8_t data)
{
if (addr & 1)
{
@@ -1369,7 +1309,7 @@ void ay8910_device::ay8910_write_ym(int addr, u8 data)
}
}
-u8 ay8910_device::ay8910_read_ym()
+uint8_t ay8910_device::ay8910_read_ym()
{
device_type chip_type = type();
int r = m_register_latch;
@@ -1418,13 +1358,13 @@ u8 ay8910_device::ay8910_read_ym()
- YM2149: no anomaly
*/
if (chip_type == AY8910) {
- const u8 mask[0x10]={
+ const uint8_t mask[0x10]={
0xff,0x0f,0xff,0x0f,0xff,0x0f,0x1f,0xff,0x1f,0x1f,0x1f,0xff,0xff,0x0f,0xff,0xff
};
return m_regs[r] & mask[r];
}
else if (chip_type == AY8914) {
- const u8 mask[0x10]={
+ const uint8_t mask[0x10]={
0xff,0x0f,0xff,0x0f,0xff,0x0f,0x1f,0xff,0x3f,0x3f,0x3f,0xff,0xff,0x0f,0xff,0xff
};
return m_regs[r] & mask[r];
@@ -1454,69 +1394,74 @@ void ay8910_device::device_reset()
*
*************************************/
-void ay8910_device::address_w(u8 data)
+READ8_MEMBER( ay8910_device::data_r )
+{
+ return ay8910_read_ym();
+}
+
+WRITE8_MEMBER( ay8910_device::address_w )
{
#if ENABLE_REGISTER_TEST
return;
#else
- ay8910_write_ym(0, data);
+ data_address_w(space, 1, data);
#endif
}
-void ay8910_device::data_w(u8 data)
+WRITE8_MEMBER( ay8910_device::data_w )
{
#if ENABLE_REGISTER_TEST
return;
#else
- ay8910_write_ym(1, data);
+ data_address_w(space, 0, data);
#endif
}
// here, BC1 is hooked up to A0 on the host and BC2 is hooked up to A1
-void ay8910_device::write_bc1_bc2(offs_t offset, u8 data)
+WRITE8_MEMBER( ay8910_device::write_bc1_bc2 )
{
switch (offset & 3)
{
case 0: // latch address
- address_w(data);
+ address_w(space, 0, data);
break;
case 1: // inactive
break;
case 2: // write to psg
- data_w(data);
+ data_w(space, 0, data);
break;
case 3: // latch address
- address_w(data);
+ address_w(space, 0, data);
break;
}
}
-static const u8 mapping8914to8910[16] = { 0, 2, 4, 11, 1, 3, 5, 12, 7, 6, 13, 8, 9, 10, 14, 15 };
+static const int mapping8914to8910[16] = { 0, 2, 4, 11, 1, 3, 5, 12, 7, 6, 13, 8, 9, 10, 14, 15 };
-u8 ay8914_device::read(offs_t offset)
+READ8_MEMBER( ay8914_device::read )
{
- u8 rv;
- address_w(mapping8914to8910[offset & 0xf]);
- rv = data_r();
+ uint16_t rv;
+ address_w(space, 0, mapping8914to8910[offset & 0xf]);
+ rv = (uint16_t) data_r(space, 0);
return rv;
}
-void ay8914_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( ay8914_device::write )
{
- address_w(mapping8914to8910[offset & 0xf]);
- data_w(data & 0xff);
+ address_w(space, 0, mapping8914to8910[offset & 0xf]);
+ data_w(space, 0, data & 0xff);
}
DEFINE_DEVICE_TYPE(AY8910, ay8910_device, "ay8910", "AY-3-8910A PSG")
-ay8910_device::ay8910_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ay8910_device::ay8910_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ay8910_device(mconfig, AY8910, tag, owner, clock, PSG_TYPE_AY, 3, 2)
{
}
-ay8910_device::ay8910_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock,
+ay8910_device::ay8910_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock,
psg_type_t psg_type, int streams, int ioports)
: device_t(mconfig, type, tag, owner, clock),
device_sound_interface(mconfig, *this),
@@ -1538,7 +1483,6 @@ ay8910_device::ay8910_device(const machine_config &mconfig, device_type type, co
m_attack(0),
m_holding(0),
m_rng(0),
- m_mode(0),
m_env_step_mask(psg_type == PSG_TYPE_AY ? 0x0f : 0x1f),
m_step( psg_type == PSG_TYPE_AY ? 2 : 1),
m_zero_is_off( psg_type == PSG_TYPE_AY ? 1 : 0),
@@ -1584,7 +1528,7 @@ void ay8910_device::set_type(psg_type_t psg_type)
DEFINE_DEVICE_TYPE(AY8912, ay8912_device, "ay8912", "AY-3-8912A PSG")
-ay8912_device::ay8912_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ay8912_device::ay8912_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ay8910_device(mconfig, AY8912, tag, owner, clock, PSG_TYPE_AY, 3, 1)
{
}
@@ -1592,7 +1536,7 @@ ay8912_device::ay8912_device(const machine_config &mconfig, const char *tag, dev
DEFINE_DEVICE_TYPE(AY8913, ay8913_device, "ay8913", "AY-3-8913 PSG")
-ay8913_device::ay8913_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ay8913_device::ay8913_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ay8910_device(mconfig, AY8913, tag, owner, clock, PSG_TYPE_AY, 3, 0)
{
}
@@ -1600,7 +1544,7 @@ ay8913_device::ay8913_device(const machine_config &mconfig, const char *tag, dev
DEFINE_DEVICE_TYPE(AY8914, ay8914_device, "ay8914", "AY-3-8914A PSG")
-ay8914_device::ay8914_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ay8914_device::ay8914_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ay8910_device(mconfig, AY8914, tag, owner, clock, PSG_TYPE_AY, 3, 2)
{
}
@@ -1608,7 +1552,7 @@ ay8914_device::ay8914_device(const machine_config &mconfig, const char *tag, dev
DEFINE_DEVICE_TYPE(AY8930, ay8930_device, "ay8930", "AY8930 EPSG")
-ay8930_device::ay8930_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ay8930_device::ay8930_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ay8910_device(mconfig, AY8930, tag, owner, clock, PSG_TYPE_AY, 3, 2)
{
}
@@ -1616,7 +1560,7 @@ ay8930_device::ay8930_device(const machine_config &mconfig, const char *tag, dev
DEFINE_DEVICE_TYPE(YM2149, ym2149_device, "ym2149", "YM2149 SSG")
-ym2149_device::ym2149_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ym2149_device::ym2149_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ay8910_device(mconfig, YM2149, tag, owner, clock, PSG_TYPE_YM, 3, 2)
{
}
@@ -1624,7 +1568,7 @@ ym2149_device::ym2149_device(const machine_config &mconfig, const char *tag, dev
DEFINE_DEVICE_TYPE(YM3439, ym3439_device, "ym3439", "YM3439 SSGC")
-ym3439_device::ym3439_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ym3439_device::ym3439_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ay8910_device(mconfig, YM3439, tag, owner, clock, PSG_TYPE_YM, 3, 2)
{
}
@@ -1632,7 +1576,7 @@ ym3439_device::ym3439_device(const machine_config &mconfig, const char *tag, dev
DEFINE_DEVICE_TYPE(YMZ284, ymz284_device, "ymz284", "YMZ284 SSGL")
-ymz284_device::ymz284_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ymz284_device::ymz284_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ay8910_device(mconfig, YMZ284, tag, owner, clock, PSG_TYPE_YM, 1, 0)
{
}
@@ -1640,7 +1584,7 @@ ymz284_device::ymz284_device(const machine_config &mconfig, const char *tag, dev
DEFINE_DEVICE_TYPE(YMZ294, ymz294_device, "ymz294", "YMZ294 SSGLP")
-ymz294_device::ymz294_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ymz294_device::ymz294_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ay8910_device(mconfig, YMZ294, tag, owner, clock, PSG_TYPE_YM, 1, 0)
{
}
diff --git a/src/devices/sound/ay8910.h b/src/devices/sound/ay8910.h
index c1bbf718245..29a7ae674d4 100644
--- a/src/devices/sound/ay8910.h
+++ b/src/devices/sound/ay8910.h
@@ -62,7 +62,7 @@ public:
};
// construction/destruction
- ay8910_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ ay8910_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration helpers
void set_flags(int flags) { m_flags = flags; }
@@ -73,21 +73,24 @@ public:
auto port_a_write_callback() { return m_port_a_write_cb.bind(); }
auto port_b_write_callback() { return m_port_b_write_cb.bind(); }
- u8 data_r() { return ay8910_read_ym(); }
- void address_w(u8 data);
- void data_w(u8 data);
+ DECLARE_READ8_MEMBER( data_r );
+ DECLARE_WRITE8_MEMBER( address_w );
+ DECLARE_WRITE8_MEMBER( data_w );
+ u8 read_data() { return ay8910_read_ym(); }
+ void write_address(u8 data) { ay8910_write_ym(0, data); }
+ void write_data(u8 data) { ay8910_write_ym(1, data); }
/* /RES */
- void reset_w(u8 data = 0) { ay8910_reset_ym(); }
+ DECLARE_WRITE8_MEMBER( reset_w ) { ay8910_reset_ym(); }
// use this when BC1 == A0; here, BC1=0 selects 'data' and BC1=1 selects 'latch address'
- void data_address_w(offs_t offset, u8 data) { ay8910_write_ym(~offset & 1, data); } // note that directly connecting BC1 to A0 puts data on 0 and address on 1
+ DECLARE_WRITE8_MEMBER( data_address_w ) { ay8910_write_ym(~offset & 1, data); } // note that directly connecting BC1 to A0 puts data on 0 and address on 1
// use this when BC1 == !A0; here, BC1=0 selects 'latch address' and BC1=1 selects 'data'
- void address_data_w(offs_t offset, u8 data) { ay8910_write_ym(offset & 1, data); }
+ DECLARE_WRITE8_MEMBER( address_data_w ) { ay8910_write_ym(offset & 1, data); }
// bc1=a0, bc2=a1
- void write_bc1_bc2(offs_t offset, u8 data);
+ DECLARE_WRITE8_MEMBER(write_bc1_bc2);
void set_volume(int channel,int volume);
void ay_set_clock(int clock);
@@ -110,10 +113,13 @@ public:
// internal interface for PSG component of YM device
// FIXME: these should be private, but vector06 accesses them directly
+ void ay8910_write_ym(int addr, uint8_t data);
+ uint8_t ay8910_read_ym();
+ void ay8910_reset_ym();
protected:
ay8910_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner,
- u32 clock, psg_type_t psg_type, int streams, int ioports);
+ uint32_t clock, psg_type_t psg_type, int streams, int ioports);
// device-level overrides
virtual void device_start() override;
@@ -134,15 +140,11 @@ private:
// internal helpers
void set_type(psg_type_t psg_type);
- inline u16 mix_3D();
+ inline uint16_t mix_3D();
void ay8910_write_reg(int r, int v);
void build_mixer_table();
void ay8910_statesave();
- void ay8910_write_ym(int addr, u8 data);
- u8 ay8910_read_ym();
- void ay8910_reset_ym();
-
// internal state
psg_type_t m_type;
int m_streams;
@@ -150,29 +152,28 @@ private:
int m_ready;
sound_stream *m_channel;
bool m_active;
- s32 m_register_latch;
- u8 m_regs[16];
- s32 m_last_enable;
- s32 m_count[NUM_CHANNELS];
- u8 m_output[NUM_CHANNELS];
- u8 m_prescale_noise;
- s32 m_count_noise;
- s32 m_count_env;
- s8 m_env_step;
- u32 m_env_volume;
- u8 m_hold,m_alternate,m_attack,m_holding;
- s32 m_rng;
- u8 m_mode;
- u8 m_env_step_mask;
+ int32_t m_register_latch;
+ uint8_t m_regs[16];
+ int32_t m_last_enable;
+ int32_t m_count[NUM_CHANNELS];
+ uint8_t m_output[NUM_CHANNELS];
+ uint8_t m_prescale_noise;
+ int32_t m_count_noise;
+ int32_t m_count_env;
+ int8_t m_env_step;
+ uint32_t m_env_volume;
+ uint8_t m_hold,m_alternate,m_attack,m_holding;
+ int32_t m_rng;
+ uint8_t m_env_step_mask;
/* init parameters ... */
int m_step;
int m_zero_is_off;
- u8 m_vol_enabled[NUM_CHANNELS];
+ uint8_t m_vol_enabled[NUM_CHANNELS];
const ay_ym_param *m_par;
const ay_ym_param *m_par_env;
- s32 m_vol_table[NUM_CHANNELS][16];
- s32 m_env_table[NUM_CHANNELS][32];
- std::unique_ptr<s32[]> m_vol3d_table;
+ int32_t m_vol_table[NUM_CHANNELS][16];
+ int32_t m_env_table[NUM_CHANNELS][32];
+ std::unique_ptr<int32_t[]> m_vol3d_table;
int m_flags; /* Flags */
int m_res_load[3]; /* Load on channel in ohms */
devcb_read8 m_port_a_read_cb;
@@ -186,7 +187,7 @@ DECLARE_DEVICE_TYPE(AY8910, ay8910_device)
class ay8912_device : public ay8910_device
{
public:
- ay8912_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ ay8912_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
DECLARE_DEVICE_TYPE(AY8912, ay8912_device)
@@ -194,7 +195,7 @@ DECLARE_DEVICE_TYPE(AY8912, ay8912_device)
class ay8913_device : public ay8910_device
{
public:
- ay8913_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ ay8913_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
DECLARE_DEVICE_TYPE(AY8913, ay8913_device)
@@ -202,11 +203,11 @@ DECLARE_DEVICE_TYPE(AY8913, ay8913_device)
class ay8914_device : public ay8910_device
{
public:
- ay8914_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ ay8914_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
/* AY8914 handlers needed due to different register map */
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
};
DECLARE_DEVICE_TYPE(AY8914, ay8914_device)
@@ -214,7 +215,7 @@ DECLARE_DEVICE_TYPE(AY8914, ay8914_device)
class ay8930_device : public ay8910_device
{
public:
- ay8930_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ ay8930_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
DECLARE_DEVICE_TYPE(AY8930, ay8930_device)
@@ -222,7 +223,7 @@ DECLARE_DEVICE_TYPE(AY8930, ay8930_device)
class ym2149_device : public ay8910_device
{
public:
- ym2149_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ ym2149_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
DECLARE_DEVICE_TYPE(YM2149, ym2149_device)
@@ -230,7 +231,7 @@ DECLARE_DEVICE_TYPE(YM2149, ym2149_device)
class ym3439_device : public ay8910_device
{
public:
- ym3439_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ ym3439_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
DECLARE_DEVICE_TYPE(YM3439, ym3439_device)
@@ -238,7 +239,7 @@ DECLARE_DEVICE_TYPE(YM3439, ym3439_device)
class ymz284_device : public ay8910_device
{
public:
- ymz284_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ ymz284_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
DECLARE_DEVICE_TYPE(YMZ284, ymz284_device)
@@ -246,7 +247,7 @@ DECLARE_DEVICE_TYPE(YMZ284, ymz284_device)
class ymz294_device : public ay8910_device
{
public:
- ymz294_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ ymz294_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
DECLARE_DEVICE_TYPE(YMZ294, ymz294_device)
diff --git a/src/devices/sound/bsmt2000.cpp b/src/devices/sound/bsmt2000.cpp
index f29e429390a..4104b83a619 100644
--- a/src/devices/sound/bsmt2000.cpp
+++ b/src/devices/sound/bsmt2000.cpp
@@ -180,8 +180,8 @@ void bsmt2000_device::sound_stream_update(sound_stream &stream, stream_sample_t
// just fill with current left/right values
for (int samp = 0; samp < samples; samp++)
{
- outputs[0][samp] = m_left_data;
- outputs[1][samp] = m_right_data;
+ outputs[0][samp] = m_left_data * 16;
+ outputs[1][samp] = m_right_data * 16;
}
}
@@ -264,8 +264,8 @@ READ16_MEMBER( bsmt2000_device::tms_data_r )
READ16_MEMBER( bsmt2000_device::tms_rom_r )
{
- // DSP code expects a 16-bit value with the data in the high byte
- return (int16_t)(read_byte((m_rom_bank << 16) + m_rom_address) << 8);
+ // underlying logic assumes this is a sign-extended value
+ return (int8_t)read_byte((m_rom_bank << 16) + m_rom_address);
}
diff --git a/src/devices/sound/c140.cpp b/src/devices/sound/c140.cpp
index b5534959230..0d72ac8be24 100644
--- a/src/devices/sound/c140.cpp
+++ b/src/devices/sound/c140.cpp
@@ -374,14 +374,14 @@ void c140_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
}
-u8 c140_device::c140_r(offs_t offset)
+READ8_MEMBER( c140_device::c140_r )
{
offset&=0x1ff;
return m_REG[offset];
}
-void c140_device::c140_w(offs_t offset, u8 data)
+WRITE8_MEMBER( c140_device::c140_w )
{
m_stream->update();
diff --git a/src/devices/sound/c140.h b/src/devices/sound/c140.h
index dba89c78089..cdc84a38fd1 100644
--- a/src/devices/sound/c140.h
+++ b/src/devices/sound/c140.h
@@ -32,8 +32,8 @@ public:
// configuration
void set_bank_type(C140_TYPE bank) { m_banking_type = bank; }
- u8 c140_r(offs_t offset);
- void c140_w(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( c140_r );
+ DECLARE_WRITE8_MEMBER( c140_w );
protected:
// device-level overrides
diff --git a/src/devices/sound/cdp1864.cpp b/src/devices/sound/cdp1864.cpp
index de39b3390c8..58697352b8d 100644
--- a/src/devices/sound/cdp1864.cpp
+++ b/src/devices/sound/cdp1864.cpp
@@ -470,18 +470,18 @@ void cdp1864_device::initialize_palette()
// foreground colors
uint8_t r = 0, g = 0, b = 0;
- if (m_chr_r != RES_INF) r = combine_weights(color_weights_r, BIT(i, 0));
- if (m_chr_b != RES_INF) b = combine_weights(color_weights_b, BIT(i, 1));
- if (m_chr_g != RES_INF) g = combine_weights(color_weights_g, BIT(i, 2));
+ if (m_chr_r != RES_INF) r = combine_1_weights(color_weights_r, BIT(i, 0));
+ if (m_chr_b != RES_INF) b = combine_1_weights(color_weights_b, BIT(i, 1));
+ if (m_chr_g != RES_INF) g = combine_1_weights(color_weights_g, BIT(i, 2));
m_palette[i] = rgb_t(r, g, b);
// background colors
r = 0, g = 0, b = 0;
- if (m_chr_r != RES_INF) r = combine_weights(color_weights_bkg_r, BIT(i, 0));
- if (m_chr_b != RES_INF) b = combine_weights(color_weights_bkg_b, BIT(i, 1));
- if (m_chr_g != RES_INF) g = combine_weights(color_weights_bkg_g, BIT(i, 2));
+ if (m_chr_r != RES_INF) r = combine_1_weights(color_weights_bkg_r, BIT(i, 0));
+ if (m_chr_b != RES_INF) b = combine_1_weights(color_weights_bkg_b, BIT(i, 1));
+ if (m_chr_g != RES_INF) g = combine_1_weights(color_weights_bkg_g, BIT(i, 2));
m_palette[i + 8] = rgb_t(r, g, b);
}
diff --git a/src/devices/sound/cdp1869.cpp b/src/devices/sound/cdp1869.cpp
index 661611531d8..1347081549a 100644
--- a/src/devices/sound/cdp1869.cpp
+++ b/src/devices/sound/cdp1869.cpp
@@ -88,8 +88,7 @@ void cdp1869_device::page_map(address_map &map)
// default address map
void cdp1869_device::cdp1869(address_map &map)
{
- if (!has_configured_map(0))
- map(0x000, 0x7ff).ram();
+ map(0x000, 0x7ff).ram();
}
@@ -360,7 +359,7 @@ cdp1869_device::cdp1869_device(const machine_config &mconfig, const char *tag, d
m_color_clock(0),
m_stream(nullptr),
m_palette(*this, "palette"),
- m_space_config("pageram", ENDIANNESS_LITTLE, 8, 11, 0, address_map_constructor(FUNC(cdp1869_device::cdp1869), this))
+ m_space_config("pageram", ENDIANNESS_LITTLE, 8, 11, 0, address_map_constructor(), address_map_constructor(FUNC(cdp1869_device::cdp1869), this))
{
}
diff --git a/src/devices/sound/dac.h b/src/devices/sound/dac.h
index 434f82ba4f9..96ebb2757d7 100644
--- a/src/devices/sound/dac.h
+++ b/src/devices/sound/dac.h
@@ -258,7 +258,7 @@ DECLARE_DEVICE_TYPE(_dac_type, _dac_class) \
class _dac_class : public dac_generator<_dac_interface, _dac_coding> \
{\
public: \
- _dac_class(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0) : \
+ _dac_class(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : \
dac_generator(mconfig, _dac_type, tag, owner, clock, _dac_gain) {} \
}; \
DAC_GENERATOR_EPILOG(_dac_type, _dac_class, _dac_description, _dac_shortname)
diff --git a/src/devices/sound/es1373.cpp b/src/devices/sound/es1373.cpp
index dbc0c6a96d8..9279e3558cd 100644
--- a/src/devices/sound/es1373.cpp
+++ b/src/devices/sound/es1373.cpp
@@ -71,11 +71,10 @@
#define ES_PCI_READ 0
#define ES_PCI_WRITE 1
-void es1373_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(es1373_device::device_add_mconfig)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
-}
+MACHINE_CONFIG_END
DEFINE_DEVICE_TYPE(ES1373, es1373_device, "es1373", "Creative Labs Ensoniq AudioPCI97 ES1373")
diff --git a/src/devices/sound/es5506.cpp b/src/devices/sound/es5506.cpp
index 2702d58fa25..f243f0c06e7 100644
--- a/src/devices/sound/es5506.cpp
+++ b/src/devices/sound/es5506.cpp
@@ -156,8 +156,7 @@ es550x_device::es550x_device(const machine_config &mconfig, device_type type, co
m_region3(nullptr),
m_channels(0),
m_irq_cb(*this),
- m_read_port_cb(*this),
- m_sample_rate_changed_cb(*this)
+ m_read_port_cb(*this)
{
for (auto & elem : m_region_base)
{
@@ -231,7 +230,6 @@ void es5506_device::device_start()
m_master_clock = clock();
m_irq_cb.resolve();
m_read_port_cb.resolve();
- m_sample_rate_changed_cb.resolve();
m_irqv = 0x80;
m_channels = channels;
@@ -311,8 +309,6 @@ void es550x_device::device_clock_changed()
m_master_clock = clock();
m_sample_rate = m_master_clock / (16 * (m_active_voices + 1));
m_stream->set_sample_rate(m_sample_rate);
- if (!m_sample_rate_changed_cb.isnull())
- m_sample_rate_changed_cb(m_sample_rate);
}
//-------------------------------------------------
@@ -382,7 +378,6 @@ void es5505_device::device_start()
m_master_clock = clock();
m_irq_cb.resolve();
m_read_port_cb.resolve();
- m_sample_rate_changed_cb.resolve();
m_irqv = 0x80;
m_channels = channels;
@@ -1220,8 +1215,6 @@ inline void es5506_device::reg_write_low(es550x_voice *voice, offs_t offset, uin
m_active_voices = data & 0x1f;
m_sample_rate = m_master_clock / (16 * (m_active_voices + 1));
m_stream->set_sample_rate(m_sample_rate);
- if (!m_sample_rate_changed_cb.isnull())
- m_sample_rate_changed_cb(m_sample_rate);
LOG("active voices=%d, sample_rate=%d\n", m_active_voices, m_sample_rate);
break;
@@ -1756,8 +1749,6 @@ inline void es5505_device::reg_write_low(es550x_voice *voice, offs_t offset, uin
m_active_voices = data & 0x1f;
m_sample_rate = m_master_clock / (16 * (m_active_voices + 1));
m_stream->set_sample_rate(m_sample_rate);
- if (!m_sample_rate_changed_cb.isnull())
- m_sample_rate_changed_cb(m_sample_rate);
LOG("active voices=%d, sample_rate=%d\n", m_active_voices, m_sample_rate);
}
@@ -1856,8 +1847,6 @@ inline void es5505_device::reg_write_high(es550x_voice *voice, offs_t offset, ui
m_active_voices = data & 0x1f;
m_sample_rate = m_master_clock / (16 * (m_active_voices + 1));
m_stream->set_sample_rate(m_sample_rate);
- if (!m_sample_rate_changed_cb.isnull())
- m_sample_rate_changed_cb(m_sample_rate);
LOG("active voices=%d, sample_rate=%d\n", m_active_voices, m_sample_rate);
}
@@ -1901,8 +1890,6 @@ inline void es5505_device::reg_write_test(es550x_voice *voice, offs_t offset, ui
m_active_voices = data & 0x1f;
m_sample_rate = m_master_clock / (16 * (m_active_voices + 1));
m_stream->set_sample_rate(m_sample_rate);
- if (!m_sample_rate_changed_cb.isnull())
- m_sample_rate_changed_cb(m_sample_rate);
LOG("active voices=%d, sample_rate=%d\n", m_active_voices, m_sample_rate);
}
diff --git a/src/devices/sound/es5506.h b/src/devices/sound/es5506.h
index ddf38d19fb9..38a006ea967 100644
--- a/src/devices/sound/es5506.h
+++ b/src/devices/sound/es5506.h
@@ -25,7 +25,6 @@ public:
auto irq_cb() { return m_irq_cb.bind(); }
auto read_port_cb() { return m_read_port_cb.bind(); }
- auto sample_rate_changed() { return m_sample_rate_changed_cb.bind(); }
protected:
// struct describing a single playing voice
@@ -115,7 +114,6 @@ protected:
int m_channels; /* number of output channels: 1 .. 6 */
devcb_write_line m_irq_cb; /* irq callback */
devcb_read16 m_read_port_cb; /* input port read */
- devcb_write32 m_sample_rate_changed_cb; /* callback for when sample rate is changed */
};
diff --git a/src/devices/sound/es8712.cpp b/src/devices/sound/es8712.cpp
index 00ec7fe90d3..e0b2699edd0 100644
--- a/src/devices/sound/es8712.cpp
+++ b/src/devices/sound/es8712.cpp
@@ -228,7 +228,7 @@ WRITE_LINE_MEMBER(es8712_device::msm_int)
}
else
{
- m_adpcm_select->ab_w(read_byte(m_base_offset));
+ m_adpcm_select->write_ab(read_byte(m_base_offset));
m_adpcm_select->select_w(m_adpcm_trigger);
m_adpcm_trigger ^= 1;
if (m_adpcm_trigger == 0)
diff --git a/src/devices/sound/es8712.h b/src/devices/sound/es8712.h
index b1cfafc1424..d355bd10633 100644
--- a/src/devices/sound/es8712.h
+++ b/src/devices/sound/es8712.h
@@ -23,7 +23,7 @@ public:
es8712_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration
- template <typename T> void set_msm_tag(T &&tag) { m_msm.set_tag(std::forward<T>(tag)); }
+ void set_msm_tag(const char *tag) { m_msm.set_tag(tag); }
auto reset_handler() { return m_reset_handler.bind(); }
auto msm_write_handler() { return m_msm_write_cb.bind(); }
diff --git a/src/devices/sound/esqpump.cpp b/src/devices/sound/esqpump.cpp
index 5ed977b9f81..f817b0d7274 100644
--- a/src/devices/sound/esqpump.cpp
+++ b/src/devices/sound/esqpump.cpp
@@ -16,12 +16,8 @@ DEFINE_DEVICE_TYPE(ESQ_5505_5510_PUMP, esq_5505_5510_pump_device, "esq_5505_5510
esq_5505_5510_pump_device::esq_5505_5510_pump_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, ESQ_5505_5510_PUMP, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , m_stream(nullptr)
- , m_timer(nullptr)
- , m_esp(*this, finder_base::DUMMY_TAG)
- , m_esp_halted(true)
- , ticks_spent_processing(0)
- , samples_processed(0)
+ , m_stream(nullptr), m_timer(nullptr), m_esp(nullptr)
+ , m_esp_halted(true), ticks_spent_processing(0), samples_processed(0)
{
#if !PUMP_FAKE_ESP_PROCESSING && PUMP_REPLACE_ESP_PROGRAM
e = nullptr;
@@ -63,14 +59,12 @@ void esq_5505_5510_pump_device::device_stop()
void esq_5505_5510_pump_device::device_reset()
{
- m_timer->adjust(attotime::zero, 0, attotime::from_hz(clock()));
- m_timer->enable(true);
-}
+ int64_t nsec_per_sample = 100 * 16 * 21;
+ attotime sample_time(0, 1000000000 * nsec_per_sample);
+ attotime initial_delay(0, 0);
-void esq_5505_5510_pump_device::device_clock_changed()
-{
- m_stream->set_sample_rate(clock());
- m_timer->adjust(attotime::zero, 0, attotime::from_hz(clock()));
+ m_timer->adjust(initial_delay, 0, sample_time);
+ m_timer->enable(true);
}
void esq_5505_5510_pump_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
diff --git a/src/devices/sound/esqpump.h b/src/devices/sound/esqpump.h
index 8ebd12bccb0..a95ee84c292 100644
--- a/src/devices/sound/esqpump.h
+++ b/src/devices/sound/esqpump.h
@@ -20,7 +20,7 @@ public:
esq_5505_5510_pump_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template <typename T> void set_esp(T &&tag) { m_esp.set_tag(std::forward<T>(tag)); }
+ void set_esp(es5510_device *esp) { m_esp = esp; }
void set_esp_halted(bool esp_halted) {
m_esp_halted = esp_halted;
logerror("ESP-halted -> %d\n", m_esp_halted);
@@ -72,7 +72,6 @@ protected:
virtual void device_start() override;
virtual void device_stop() override;
virtual void device_reset() override;
- virtual void device_clock_changed() override;
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
@@ -89,7 +88,7 @@ private:
emu_timer *m_timer;
// ESP signal processor
- required_device<es5510_device> m_esp;
+ es5510_device *m_esp;
// Is the ESP halted by the CPU?
bool m_esp_halted;
diff --git a/src/devices/sound/gaelco.cpp b/src/devices/sound/gaelco.cpp
index c8109ce5acd..57167945cae 100644
--- a/src/devices/sound/gaelco.cpp
+++ b/src/devices/sound/gaelco.cpp
@@ -131,9 +131,7 @@ void gaelco_gae1_device::sound_stream_update(sound_stream &stream, stream_sample
}
} else {
LOG_SOUND(("(GAE1) Playing unknown sample format in channel: %02d, type: %02x, bank: %02x, end: %08x, Length: %04x\n", ch, type, bank, end_pos, m_sndregs[base_offset + 3]));
- //channel->active = 0;
- // play2000 expects these to expire, are they valid? this is unrelated to the missing sounds in touchgo which never hits here
- m_sndregs[base_offset + 3]--;
+ channel->active = 0;
}
/* check if the current sample has finished playing */
diff --git a/src/devices/sound/ics2115.cpp b/src/devices/sound/ics2115.cpp
index 9ce19fe649f..12062e9a509 100644
--- a/src/devices/sound/ics2115.cpp
+++ b/src/devices/sound/ics2115.cpp
@@ -15,9 +15,9 @@
//#define ICS2115_ISOLATE 6
// device type definition
-DEFINE_DEVICE_TYPE(ICS2115, ics2115_device, "ics2115", "ICS2115 WaveFront Synthesizer")
+DEFINE_DEVICE_TYPE(ICS2115, ics2115_device, "ics2115", "ICS2115")
-ics2115_device::ics2115_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ics2115_device::ics2115_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, ICS2115, tag, owner, clock),
device_sound_interface(mconfig, *this), m_stream(nullptr),
m_rom(*this, DEVICE_SELF),
@@ -36,26 +36,26 @@ void ics2115_device::device_start()
//Exact formula as per patent 5809466
//This seems to give the ok fit but it is not good enough.
/*double maxvol = ((1 << volume_bits) - 1) * pow(2., (double)1/0x100);
- for (int i = 0; i < 0x1000; i++)
+ for (int i = 0; i < 0x1000; i++) {
m_volume[i] = floor(maxvol * pow(2.,(double)i/256 - 16) + 0.5);
- */
+ }*/
//austere's table, derived from patent 5809466:
//See section V starting from page 195
//Subsection F (column 124, page 198) onwards
- for (int i = 0; i<4096; i++)
+ for (int i = 0; i<4096; i++) {
m_volume[i] = ((0x100 | (i & 0xff)) << (volume_bits-9)) >> (15 - (i>>8));
+ }
//u-Law table as per MIL-STD-188-113
- u16 lut[8];
- u16 lut_initial = 33 << 2; //shift up 2-bits for 16-bit range.
- for (int i = 0; i < 8; i++)
+ uint16_t lut[8];
+ uint16_t lut_initial = 33 << 2; //shift up 2-bits for 16-bit range.
+ for(int i = 0; i < 8; i++)
lut[i] = (lut_initial << i) - lut_initial;
- for (int i = 0; i < 256; i++)
- {
- u8 exponent = (~i >> 4) & 0x07;
- u8 mantissa = ~i & 0x0f;
- s16 value = lut[exponent] + (mantissa << (exponent + 3));
+ for(int i = 0; i < 256; i++) {
+ uint8_t exponent = (~i >> 4) & 0x07;
+ uint8_t mantissa = ~i & 0x0f;
+ int16_t value = lut[exponent] + (mantissa << (exponent + 3));
m_ulaw[i] = (i & 0x80) ? -value : value;
}
@@ -73,8 +73,7 @@ void ics2115_device::device_start()
save_item(NAME(m_active_osc));
save_item(NAME(m_vmode));
- for (int i = 0; i < 32; i++)
- {
+ for(int i = 0; i < 32; i++) {
save_item(NAME(m_voice[i].osc_conf.value), i);
save_item(NAME(m_voice[i].state.value), i);
save_item(NAME(m_voice[i].vol_ctrl.value), i);
@@ -109,15 +108,14 @@ void ics2115_device::device_reset()
m_vmode = 0;
m_irq_on = false;
memset(m_voice, 0, sizeof(m_voice));
- for (auto & elem : m_timer)
+ for(auto & elem : m_timer)
{
elem.timer->adjust(attotime::never);
elem.period = 0;
elem.scale = 0;
elem.preset = 0;
}
- for (auto & elem : m_voice)
- {
+ for(auto & elem : m_voice) {
elem.osc_conf.value = 2;
elem.osc.fc = 0;
elem.osc.acc = 0;
@@ -129,7 +127,7 @@ void ics2115_device::device_reset()
elem.vol.incr = 0;
elem.vol.start = 0;
elem.vol.end = 0;
- elem.vol.pan = 0x7f;
+ elem.vol.pan = 0x7F;
elem.vol_ctrl.value = 1;
elem.vol.mode = 0;
elem.state.value = 0;
@@ -140,47 +138,40 @@ void ics2115_device::device_reset()
int ics2115_device::ics2115_voice::update_volume_envelope()
{
int ret = 0;
- if (vol_ctrl.bitflags.done || vol_ctrl.bitflags.stop)
+ if(vol_ctrl.bitflags.done || vol_ctrl.bitflags.stop)
return ret;
- if (vol_ctrl.bitflags.invert)
- {
+ if(vol_ctrl.bitflags.invert) {
vol.acc -= vol.add;
vol.left = vol.acc - vol.start;
- }
- else
- {
+ } else {
vol.acc += vol.add;
vol.left = vol.end - vol.acc;
}
- if (vol.left > 0)
+ if(vol.left > 0)
return ret;
- if (vol_ctrl.bitflags.irq)
- {
+ if(vol_ctrl.bitflags.irq) {
vol_ctrl.bitflags.irq_pending = true;
ret = 1;
}
- if (osc_conf.bitflags.eightbit)
+ if(osc_conf.bitflags.eightbit)
return ret;
- if (vol_ctrl.bitflags.loop)
- {
- if (vol_ctrl.bitflags.loop_bidir)
+ if(vol_ctrl.bitflags.loop) {
+ if(vol_ctrl.bitflags.loop_bidir)
vol_ctrl.bitflags.invert = !vol_ctrl.bitflags.invert;
- if (vol_ctrl.bitflags.invert)
+ if(vol_ctrl.bitflags.invert)
vol.acc = vol.end + vol.left;
else
vol.acc = vol.start - vol.left;
- }
- else
- {
+ } else {
state.bitflags.on = false;
vol_ctrl.bitflags.done = true;
- if (vol_ctrl.bitflags.invert)
+ if(vol_ctrl.bitflags.invert)
vol.acc = vol.end;
else
vol.acc = vol.start;
@@ -189,7 +180,7 @@ int ics2115_device::ics2115_voice::update_volume_envelope()
return ret;
}
-/*u32 ics2115_device::ics2115_voice::next_address()
+/*uint32_t ics2115_device::ics2115_voice::next_address()
{
//Patent 6,246,774 B1, Column 111, Row 25
//LEN BLEN DIR BC NextAddress
@@ -207,49 +198,40 @@ int ics2115_device::ics2115_voice::update_volume_envelope()
int ics2115_device::ics2115_voice::update_oscillator()
{
int ret = 0;
- if (osc_conf.bitflags.stop)
+ if(osc_conf.bitflags.stop)
return ret;
- if (osc_conf.bitflags.invert)
- {
+ if(osc_conf.bitflags.invert) {
osc.acc -= osc.fc << 2;
osc.left = osc.acc - osc.start;
- }
- else
- {
+ } else {
osc.acc += osc.fc << 2;
osc.left = osc.end - osc.acc;
}
// > instead of >= to stop crackling?
- if (osc.left > 0)
+ if(osc.left > 0)
return ret;
- if (osc_conf.bitflags.irq)
- {
+ if(osc_conf.bitflags.irq) {
osc_conf.bitflags.irq_pending = true;
ret = 1;
}
- if (osc_conf.bitflags.loop)
- {
- if (osc_conf.bitflags.loop_bidir)
+ if(osc_conf.bitflags.loop) {
+ if(osc_conf.bitflags.loop_bidir)
osc_conf.bitflags.invert = !osc_conf.bitflags.invert;
//else
- // logerror("click!\n");
+ // printf("click!\n");
- if (osc_conf.bitflags.invert)
- {
+ if(osc_conf.bitflags.invert) {
osc.acc = osc.end + osc.left;
osc.left = osc.acc - osc.start;
}
- else
- {
+ else {
osc.acc = osc.start - osc.left;
osc.left = osc.end - osc.acc;
}
- }
- else
- {
+ } else {
state.bitflags.on = false;
osc_conf.bitflags.stop = true;
- if (!osc_conf.bitflags.invert)
+ if(!osc_conf.bitflags.invert)
osc.acc = osc.end;
else
osc.acc = osc.start;
@@ -260,44 +242,41 @@ int ics2115_device::ics2115_voice::update_oscillator()
//TODO: proper interpolation for uLaw (fill_output doesn't use this) and 8-bit samples (looping)
stream_sample_t ics2115_device::get_sample(ics2115_voice& voice)
{
- u32 curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12);
- u32 nextaddr;
+ uint32_t curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12);
+ uint32_t nextaddr;
if (voice.state.bitflags.on && voice.osc_conf.bitflags.loop && !voice.osc_conf.bitflags.loop_bidir &&
- (voice.osc.left < (voice.osc.fc <<2)))
- {
- //logerror("C?[%x:%x]", voice.osc.left, voice.osc.acc);
+ (voice.osc.left < (voice.osc.fc <<2))) {
+ //printf("C?[%x:%x]", voice.osc.left, voice.osc.acc);
nextaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.start >> 12);
}
else
nextaddr = curaddr + 2;
- s16 sample1, sample2;
- if (voice.osc_conf.bitflags.eightbit)
- {
- sample1 = ((s8)m_rom[curaddr]) << 8;
- sample2 = ((s8)m_rom[curaddr + 1]) << 8;
+ int16_t sample1, sample2;
+ if (voice.osc_conf.bitflags.eightbit) {
+ sample1 = ((int8_t)m_rom[curaddr]) << 8;
+ sample2 = ((int8_t)m_rom[curaddr + 1]) << 8;
}
- else
- {
- sample1 = m_rom[curaddr + 0] | (((s8)m_rom[curaddr + 1]) << 8);
- sample2 = m_rom[nextaddr+ 0] | (((s8)m_rom[nextaddr+ 1]) << 8);
- //sample2 = m_rom[curaddr + 2] | (((s8)m_rom[curaddr + 3]) << 8);
+ else {
+ sample1 = m_rom[curaddr + 0] | (((int8_t)m_rom[curaddr + 1]) << 8);
+ sample2 = m_rom[nextaddr+ 0] | (((int8_t)m_rom[nextaddr+ 1]) << 8);
+ //sample2 = m_rom[curaddr + 2] | (((int8_t)m_rom[curaddr + 3]) << 8);
}
//no need for interpolation since it's around 1 note a cycle?
- //if (voice.osc.fc >> 10)
+ //if(voice.osc.fc >> 10)
// return sample1;
//linear interpolation as in US patent 6,246,774 B1, column 2 row 59
//LEN=1, BLEN=0, DIR=0, start+end interpolation
- s32 sample, diff;
- u16 fract;
+ int32_t sample, diff;
+ uint16_t fract;
diff = sample2 - sample1;
fract = (voice.osc.acc >> 3) & 0x1ff;
- sample = (((s32)sample1 << 9) + diff * fract) >> 9;
+ sample = (((int32_t)sample1 << 9) + diff * fract) >> 9;
//sample = sample1;
return sample;
}
@@ -307,19 +286,16 @@ bool ics2115_device::ics2115_voice::playing()
return state.bitflags.on && !((vol_ctrl.bitflags.done || vol_ctrl.bitflags.stop) && osc_conf.bitflags.stop);
}
-void ics2115_device::ics2115_voice::update_ramp()
-{
+void ics2115_device::ics2115_voice::update_ramp() {
//slow attack
- if (state.bitflags.on && !osc_conf.bitflags.stop)
- {
+ if (state.bitflags.on && !osc_conf.bitflags.stop) {
if (state.bitflags.ramp < 0x40)
state.bitflags.ramp += 0x1;
else
state.bitflags.ramp = 0x40;
}
//slow release
- else
- {
+ else {
if (state.bitflags.ramp)
state.bitflags.ramp -= 0x1;
}
@@ -328,15 +304,14 @@ void ics2115_device::ics2115_voice::update_ramp()
int ics2115_device::fill_output(ics2115_voice& voice, stream_sample_t *outputs[2], int samples)
{
bool irq_invalid = false;
- u16 fine = 1 << (3*(voice.vol.incr >> 6));
- voice.vol.add = (voice.vol.incr & 0x3f)<< (10 - fine);
+ uint16_t fine = 1 << (3*(voice.vol.incr >> 6));
+ voice.vol.add = (voice.vol.incr & 0x3F)<< (10 - fine);
- for (int i = 0; i < samples; i++)
- {
- u32 volacc = (voice.vol.acc >> 10) & 0xffff;
- u32 volume = (m_volume[volacc >> 4] * voice.state.bitflags.ramp) >> 6;
- u16 vleft = volume; //* (255 - voice.vol.pan) / 0x80];
- u16 vright = volume; //* (voice.vol.pan + 1) / 0x80];
+ for (int i = 0; i < samples; i++) {
+ uint32_t volacc = (voice.vol.acc >> 10) & 0xffff;
+ uint32_t volume = (m_volume[volacc >> 4] * voice.state.bitflags.ramp) >> 6;
+ uint16_t vleft = volume; //* (255 - voice.vol.pan) / 0x80];
+ uint16_t vright = volume; //* (voice.vol.pan + 1) / 0x80];
//From GUS doc:
//In general, it is necessary to remember that all voices are being summed in to the
@@ -344,26 +319,22 @@ int ics2115_device::fill_output(ics2115_voice& voice, stream_sample_t *outputs[2
//that the voice is pointing at is contributing to the summation.
//(austere note: this will of course fix some of the glitches due to multiple transition)
stream_sample_t sample;
- if (voice.osc_conf.bitflags.ulaw)
- {
- u32 curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12);
+ if(voice.osc_conf.bitflags.ulaw) {
+ uint32_t curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12);
sample = m_ulaw[m_rom[curaddr]];
}
else
sample = get_sample(voice);
//15-bit volume + (5-bit worth of 32 channel sum) + 16-bit samples = 4-bit extra
- if (!m_vmode || voice.playing())
- {
- /*if (voice.playing())
- {*/
+ if (!m_vmode || voice.playing()) {
+ //if (voice.playing()) {
outputs[0][i] += (sample * vleft) >> (5 + volume_bits - 16);
outputs[1][i] += (sample * vright) >> (5 + volume_bits - 16);
}
voice.update_ramp();
- if (voice.playing())
- {
+ if (voice.playing()) {
if (voice.update_oscillator())
irq_invalid = true;
if (voice.update_volume_envelope())
@@ -379,77 +350,71 @@ void ics2115_device::sound_stream_update(sound_stream &stream, stream_sample_t *
memset(outputs[1], 0, samples * sizeof(stream_sample_t));
bool irq_invalid = false;
- for (int osc = 0; osc <= m_active_osc; osc++)
- {
+ for(int osc = 0; osc <= m_active_osc; osc++) {
ics2115_voice& voice = m_voice[osc];
#ifdef ICS2115_ISOLATE
- if (osc != ICS2115_ISOLATE)
+ if(osc != ICS2115_ISOLATE)
continue;
#endif
/*
#ifdef ICS2115_DEBUG
- u32 curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12);
+ uint32_t curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12);
stream_sample_t sample;
- if (voice.osc_conf.bitflags.ulaw)
+ if(voice.osc_conf.bitflags.ulaw)
sample = m_ulaw[m_rom[curaddr]];
else
sample = get_sample(voice);
- logerror("[%06x=%04x]", curaddr, (s16)sample);
+ printf("[%06x=%04x]", curaddr, (int16_t)sample);
#endif
*/
- if (fill_output(voice, outputs, samples))
+ if(fill_output(voice, outputs, samples))
irq_invalid = true;
#ifdef ICS2115_DEBUG
- if (voice.playing())
- {
- logerror("%d", osc);
+ if(voice.playing()) {
+ printf("%d", osc);
if (voice.osc_conf.bitflags.invert)
- logerror("+");
+ printf("+");
else if ((voice.osc.fc >> 1) > 0x1ff)
- logerror("*");
- logerror(" ");
+ printf("*");
+ printf(" ");
/*int min = 0x7fffffff, max = 0x80000000;
double average = 0;
- for (int i = 0; i < samples; i++)
- {
+ for (int i = 0; i < samples; i++) {
if (outputs[0][i] > max) max = outputs[0][i];
if (outputs[0][i] < min) min = outputs[0][i];
average += fabs(outputs[0][i]);
}
average /= samples;
average /= 1 << 16;
- logerror("<Mi:%d Mx:%d Av:%g>", min >> 16, max >> 16, average);*/
+ printf("<Mi:%d Mx:%d Av:%g>", min >> 16, max >> 16, average);*/
}
#endif
}
#ifdef ICS2115_DEBUG
- logerror("|");
+ printf("|");
#endif
//rescale
- for (int i = 0; i < samples; i++)
- {
+ for (int i = 0; i < samples; i++) {
outputs[0][i] >>= 16;
outputs[1][i] >>= 16;
}
- if (irq_invalid)
+ if(irq_invalid)
recalc_irq();
}
//Helper Function (Reads off current register)
-u16 ics2115_device::reg_read()
-{
- u16 ret;
+uint16_t ics2115_device::reg_read() {
+ uint16_t ret;
ics2115_voice& voice = m_voice[m_osc_select];
- switch (m_reg_select)
- {
+ switch(m_reg_select) {
case 0x00: // [osc] Oscillator Configuration
ret = voice.osc_conf.value;
ret <<= 8;
@@ -495,33 +460,33 @@ u16 ics2115_device::reg_read()
ret = voice.vol.acc >> (10);
break;
- case 0x0a: // [osc] Wavesample address
+ case 0x0A: // [osc] Wavesample address
ret = (voice.osc.acc >> 16) & 0xffff;
break;
- case 0x0b: // [osc] Wavesample address
+ case 0x0B: // [osc] Wavesample address
ret = (voice.osc.acc >> 0) & 0xfff8;
break;
- case 0x0c: // [osc] Pan
+ case 0x0C: // [osc] Pan
ret = voice.vol.pan << 8;
break;
/* DDP3 code (trap15's reversal) */
/* 0xA13's work:
res = read() & 0xC3;
- if (!(res & 2)) res |= 1;
+ if(!(res & 2)) res |= 1;
e = d = res;
*/
/* 0xA4F's work:
while(!(read() & 1))
*/
- case 0x0d: // [osc] Volume Envelope Control
+ case 0x0D: // [osc] Volume Envelope Control
//ret = v->Vol.Ctl | ((v->state & FLAG_STATE_VOLIRQ) ? 0x81 : 1);
// may expect |8 on voice irq with &40 == 0
// may expect |8 on reg 0 on voice irq with &80 == 0
- // ret = 0xff;
+ // ret = 0xFF;
if (!m_vmode)
ret = voice.vol_ctrl.bitflags.irq ? 0x81 : 0x01;
else
@@ -530,28 +495,24 @@ u16 ics2115_device::reg_read()
ret <<= 8;
break;
- case 0x0e: // Active Voices
+ case 0x0E: // Active Voices
ret = m_active_osc;
break;
- case 0x0f:{// [osc] Interrupt source/oscillator
+ case 0x0F:{// [osc] Interrupt source/oscillator
ret = 0xff;
- for (int i = 0; i <= m_active_osc; i++)
- {
+ for (int i = 0; i <= m_active_osc; i++) {
ics2115_voice& v = m_voice[i];
- if (v.osc_conf.bitflags.irq_pending || v.vol_ctrl.bitflags.irq_pending)
- {
+ if (v.osc_conf.bitflags.irq_pending || v.vol_ctrl.bitflags.irq_pending) {
ret = i | 0xe0;
ret &= v.vol_ctrl.bitflags.irq_pending ? (~0x40) : 0xff;
ret &= v.osc_conf.bitflags.irq_pending ? (~0x80) : 0xff;
recalc_irq();
- if (v.osc_conf.bitflags.irq_pending)
- {
+ if (v.osc_conf.bitflags.irq_pending) {
v.osc_conf.bitflags.irq_pending = 0;
ret &= ~0x80;
}
- if (v.vol_ctrl.bitflags.irq_pending)
- {
+ if (v.vol_ctrl.bitflags.irq_pending) {
v.vol_ctrl.bitflags.irq_pending = 0;
ret &= ~0x40;
}
@@ -581,21 +542,21 @@ u16 ics2115_device::reg_read()
ret = m_irq_pending & 3;
break;
- case 0x4a: // IRQ Pending
+ case 0x4A: // IRQ Pending
ret = m_irq_pending;
break;
- case 0x4b: // Address of Interrupting Oscillator
+ case 0x4B: // Address of Interrupting Oscillator
ret = 0x80;
break;
- case 0x4c: // Chip Revision
+ case 0x4C: // Chip Revision
ret = revision;
break;
default:
#ifdef ICS2115_DEBUG
- logerror("ICS2115: Unhandled read %x\n", m_reg_select);
+ printf("ICS2115: Unhandled read %x\n", m_reg_select);
#endif
ret = 0;
break;
@@ -603,147 +564,140 @@ u16 ics2115_device::reg_read()
return ret;
}
-void ics2115_device::reg_write(u16 data, u16 mem_mask)
-{
+void ics2115_device::reg_write(uint8_t data, bool msb) {
ics2115_voice& voice = m_voice[m_osc_select];
- switch (m_reg_select)
- {
+ switch(m_reg_select) {
case 0x00: // [osc] Oscillator Configuration
- if (ACCESSING_BITS_8_15)
- {
+ if(msb) {
voice.osc_conf.value &= 0x80;
- voice.osc_conf.value |= (data >> 8) & 0x7f;
+ voice.osc_conf.value |= data & 0x7f;
}
break;
case 0x01: // [osc] Wavesample frequency
// freq = fc*33075/1024 in 32 voices mode, fc*44100/1024 in 24 voices mode
- if (ACCESSING_BITS_8_15)
- voice.osc.fc = (voice.osc.fc & 0x00fe) | (data & 0xff00);
- if (ACCESSING_BITS_0_7)
+ if(msb)
+ voice.osc.fc = (voice.osc.fc & 0x00ff) | (data << 8);
+ else
//last bit not used!
- voice.osc.fc = (voice.osc.fc & 0xff00) | (data & 0x00fe);
+ voice.osc.fc = (voice.osc.fc & 0xff00) | (data & 0xfe);
break;
case 0x02: // [osc] Wavesample loop start high
- if (ACCESSING_BITS_8_15)
- voice.osc.start = (voice.osc.start & 0x00ffffff) | ((data & 0xff00) << 16);
- if (ACCESSING_BITS_0_7)
- voice.osc.start = (voice.osc.start & 0xff00ffff) | ((data & 0x00ff) << 16);
+ if(msb)
+ voice.osc.start = (voice.osc.start & 0x00ffffff) | (data << 24);
+ else
+ voice.osc.start = (voice.osc.start & 0xff00ffff) | (data << 16);
break;
case 0x03: // [osc] Wavesample loop start low
- if (ACCESSING_BITS_8_15)
- voice.osc.start = (voice.osc.start & 0xffff00ff) | (data & 0xff00);
+ if(msb)
+ voice.osc.start = (voice.osc.start & 0xffff00ff) | (data << 8);
// This is unused?
- //if (ACCESSING_BITS_0_7)
+ //else
//voice.osc.start = (voice.osc.start & 0xffffff00) | (data & 0);
break;
case 0x04: // [osc] Wavesample loop end high
- if (ACCESSING_BITS_8_15)
- voice.osc.end = (voice.osc.end & 0x00ffffff) | ((data & 0xff00) << 16);
- if (ACCESSING_BITS_0_7)
- voice.osc.end = (voice.osc.end & 0xff00ffff) | ((data & 0x00ff) << 16);
+ if(msb)
+ voice.osc.end = (voice.osc.end & 0x00ffffff) | (data << 24);
+ else
+ voice.osc.end = (voice.osc.end & 0xff00ffff) | (data << 16);
break;
case 0x05: // [osc] Wavesample loop end low
- if (ACCESSING_BITS_8_15)
- voice.osc.end = (voice.osc.end & 0xffff00ff) | (data & 0xff00);
+ if(msb)
+ voice.osc.end = (voice.osc.end & 0xffff00ff) | (data << 8);
// lsb is unused?
break;
case 0x06: // [osc] Volume Increment
- if (ACCESSING_BITS_8_15)
- voice.vol.incr = (data >> 8) & 0xff;
+ if(msb)
+ voice.vol.incr = data;
break;
case 0x07: // [osc] Volume Start
- if (ACCESSING_BITS_0_7)
- voice.vol.start = (data & 0xff) << (10+8);
+ if (!msb)
+ voice.vol.start = data << (10+8);
break;
case 0x08: // [osc] Volume End
- if (ACCESSING_BITS_0_7)
- voice.vol.end = (data & 0xff) << (10+8);
+ if (!msb)
+ voice.vol.end = data << (10+8);
break;
case 0x09: // [osc] Volume accumulator
- if (ACCESSING_BITS_8_15)
- voice.vol.regacc = (voice.vol.regacc & 0x00ff) | (data & 0xff00);
- if (ACCESSING_BITS_0_7)
- voice.vol.regacc = (voice.vol.regacc & 0xff00) | (data & 0x00ff);
+ if(msb)
+ voice.vol.regacc = (voice.vol.regacc & 0x00ff) | (data << 8);
+ else
+ voice.vol.regacc = (voice.vol.regacc & 0xff00) | data;
voice.vol.acc = voice.vol.regacc << 10;
break;
- case 0x0a: // [osc] Wavesample address high
+ case 0x0A: // [osc] Wavesample address high
#ifdef ICS2115_DEBUG
#ifdef ICS2115_ISOLATE
- if (m_osc_select == ICS2115_ISOLATE)
+ if(m_osc_select == ICS2115_ISOLATE)
#endif
- logerror("<%d:oa:H=%x>", m_osc_select, data);
+ printf("<%d:oa:H[%d]=%x>", m_osc_select, msb, data);
#endif
- if (ACCESSING_BITS_8_15)
- voice.osc.acc = (voice.osc.acc & 0x00ffffff) | ((data & 0xff00) << 16);
- if (ACCESSING_BITS_0_7)
- voice.osc.acc = (voice.osc.acc & 0xff00ffff) | ((data & 0x00ff) << 16);
+ if(msb)
+ voice.osc.acc = (voice.osc.acc & 0x00ffffff) | (data << 24);
+ else
+ voice.osc.acc = (voice.osc.acc & 0xff00ffff) | (data << 16);
break;
- case 0x0b: // [osc] Wavesample address low
+ case 0x0B: // [osc] Wavesample address low
#ifdef ICS2115_DEBUG
#ifdef ICS2115_ISOLATE
- if (m_osc_select == ICS2115_ISOLATE)
+ if(m_osc_select == ICS2115_ISOLATE)
#endif
- logerror("<%d:oa:L=%x>", m_osc_select, data);
+ printf("<%d:oa:L[%d]=%x>", m_osc_select, msb, data);
#endif
- if (ACCESSING_BITS_8_15)
- voice.osc.acc = (voice.osc.acc & 0xffff00ff) | (data & 0xff00);
- if (ACCESSING_BITS_0_7)
- voice.osc.acc = (voice.osc.acc & 0xffffff00) | (data & 0x00f8);
+ if(msb)
+ voice.osc.acc = (voice.osc.acc & 0xffff00ff) | (data << 8);
+ else
+ voice.osc.acc = (voice.osc.acc & 0xffffff00) | (data & 0xF8);
break;
- case 0x0c: // [osc] Pan
- if (ACCESSING_BITS_8_15)
- voice.vol.pan = (data >> 8) & 0xff;
+ case 0x0C: // [osc] Pan
+ if(msb)
+ voice.vol.pan = data;
break;
- case 0x0d: // [osc] Volume Envelope Control
- if (ACCESSING_BITS_8_15)
- {
+ case 0x0D: // [osc] Volume Envelope Control
+ if(msb) {
voice.vol_ctrl.value &= 0x80;
- voice.vol_ctrl.value |= (data >> 8) & 0x7f;
+ voice.vol_ctrl.value |= data & 0x7F;
}
break;
- case 0x0e: // Active Voices
+ case 0x0E: // Active Voices
//Does this value get added to 1? Not sure. Could trace for writes of 32.
- if (ACCESSING_BITS_8_15)
- m_active_osc = (data >> 8) & 0x1f; // & 0x1f ? (Guessing)
+ if(msb) {
+ m_active_osc = data & 0x1F; // & 0x1F ? (Guessing)
+ }
break;
//2X8 ?
case 0x10: // [osc] Oscillator Control
//Could this be 2X9?
//[7 R | 6 M2 | 5 M1 | 4-2 Reserve | 1 - Timer 2 Strt | 0 - Timer 1 Strt]
- if (ACCESSING_BITS_8_15)
- {
- data >>= 8;
+ if (msb) {
voice.osc.ctl = data;
if (!data)
keyon();
//guessing here
- else if (data == 0xf)
- {
+ else if(data == 0xf) {
#ifdef ICS2115_DEBUG
#ifdef ICS2115_ISOLATE
if (m_osc_select == ICS2115_ISOLATE)
#endif
if (!voice.osc_conf.bitflags.stop || !voice.vol_ctrl.bitflags.stop)
- logerror("[%02d STOP]\n", m_osc_select);
+ printf("[%02d STOP]\n", m_osc_select);
#endif
- if (!m_vmode)
- {
+ if (!m_vmode) {
voice.osc_conf.bitflags.stop = true;
voice.vol_ctrl.bitflags.stop = true;
//try to key it off as well!
@@ -752,77 +706,71 @@ void ics2115_device::reg_write(u16 data, u16 mem_mask)
}
#ifdef ICS2115_DEBUG
else
- logerror("ICS2115: Unhandled* data write %d onto 0x10.\n", data);
+ printf("ICS2115: Unhandled* data write %d onto 0x10.\n", data);
#endif
}
break;
case 0x11: // [osc] Wavesample static address 27-20
- if (ACCESSING_BITS_8_15)
- //v->Osc.SAddr = (data >> 8);
- voice.osc.saddr = (data >> 8);
+ if(msb)
+ //v->Osc.SAddr = data;
+ voice.osc.saddr = data;
break;
case 0x12:
//Could be per voice! -- investigate.
- if (ACCESSING_BITS_8_15)
- m_vmode = (data >> 8);
+ if (msb)
+ m_vmode = data;
break;
case 0x40: // Timer 1 Preset
case 0x41: // Timer 2 Preset
- if (ACCESSING_BITS_0_7)
- {
- m_timer[m_reg_select & 0x1].preset = data & 0xff;
+ if(!msb) {
+ m_timer[m_reg_select & 0x1].preset = data;
recalc_timer(m_reg_select & 0x1);
}
break;
case 0x42: // Timer 1 Prescale
case 0x43: // Timer 2 Prescale
- if (ACCESSING_BITS_0_7)
- {
- m_timer[m_reg_select & 0x1].scale = data & 0xff;
+ if(!msb) {
+ m_timer[m_reg_select & 0x1].scale = data;
recalc_timer(m_reg_select & 0x1);
}
break;
- case 0x4a: // IRQ Enable
- if (ACCESSING_BITS_0_7)
- {
- m_irq_enabled = data & 0xff;
+ case 0x4A: // IRQ Enable
+ if(!msb) {
+ m_irq_enabled = data;
recalc_irq();
}
break;
- case 0x4f: // Oscillator Address being Programmed
- if (ACCESSING_BITS_0_7)
- m_osc_select = (data & 0xff) % (1+m_active_osc);
+ case 0x4F: // Oscillator Address being Programmed
+ if(!msb) {
+ m_osc_select = data % (1+m_active_osc);
+ }
break;
default:
#ifdef ICS2115_DEBUG
- logerror("ICS2115: Unhandled write %x onto %x [voice = %d]\n", data, m_reg_select, m_osc_select);
+ printf("ICS2115: Unhandled write %x onto %x(%d) [voice = %d]\n", data, m_reg_select, msb, m_osc_select);
#endif
break;
}
}
-u8 ics2115_device::read(offs_t offset)
+READ8_MEMBER(ics2115_device::read)
{
- u8 ret = 0;
+ uint8_t ret = 0;
- switch (offset)
- {
+ switch(offset) {
case 0:
//TODO: check this suspect code
- if (m_irq_on)
- {
+ if (m_irq_on) {
ret |= 0x80;
if (m_irq_enabled && (m_irq_pending & 3))
ret |= 1;
- for (int i = 0; i <= m_active_osc; i++)
- {
+ for (int i = 0; i <= m_active_osc; i++) {
if (//m_voice[i].vol_ctrl.bitflags.irq_pending ||
- m_voice[i].osc_conf.bitflags.irq_pending)
- {
+ m_voice[i].osc_conf.bitflags.irq_pending) {
ret |= 2;
break;
}
@@ -834,89 +782,35 @@ u8 ics2115_device::read(offs_t offset)
ret = m_reg_select;
break;
case 2:
- ret = (u8)(reg_read());
+ ret = (uint8_t)(reg_read());
break;
case 3:
ret = reg_read() >> 8;
break;
default:
#ifdef ICS2115_DEBUG
- logerror("ICS2115: Unhandled memory read at %x\n", offset);
+ printf("ICS2115: Unhandled memory read at %x\n", offset);
#endif
break;
}
return ret;
}
-void ics2115_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER(ics2115_device::write)
{
- switch (offset)
- {
+ switch(offset) {
case 1:
m_reg_select = data;
break;
case 2:
- reg_write(data, 0x00ff);
+ reg_write(data,0);
break;
case 3:
- reg_write(data << 8, 0xff00);
+ reg_write(data,1);
break;
default:
#ifdef ICS2115_DEBUG
- logerror("ICS2115: Unhandled memory write %02x to %x\n", data, offset);
-#endif
- break;
- }
-}
-
-u16 ics2115_device::word_r(offs_t offset, u16 mem_mask)
-{
- u16 ret = 0;
-
- switch (offset)
- {
- case 0:
- case 1:
- if (ACCESSING_BITS_0_7)
- ret |= read(offset);
- break;
- case 2:
- ret |= reg_read() & mem_mask;
- break;
- /*
- case 3:
- TODO : used for byte size only;
- break;
- */
- default:
-#ifdef ICS2115_DEBUG
- logerror("ICS2115: Unhandled memory read at %x\n", offset);
-#endif
- break;
- }
- return ret;
-}
-
-void ics2115_device::word_w(offs_t offset, u16 data, u16 mem_mask)
-{
- switch (offset)
- {
- case 0:
- case 1:
- if (ACCESSING_BITS_0_7)
- write(offset, data & 0xff);
- break;
- case 2:
- reg_write(data, mem_mask);
- break;
- /*
- case 3:
- TODO : used for byte size only;
- break;
- */
- default:
-#ifdef ICS2115_DEBUG
- logerror("ICS2115: Unhandled memory write %02x to %x\n", data, offset);
+ printf("ICS2115: Unhandled memory write %02x to %x\n", data, offset);
#endif
break;
}
@@ -934,7 +828,7 @@ void ics2115_device::keyon()
m_voice[m_osc_select].state.bitflags.ramp = 0x40;
#ifdef ICS2115_DEBUG
- logerror("[%02d vs:%04x ve:%04x va:%04x vi:%02x vc:%02x os:%06x oe:%06x oa:%06x of:%04x SA:%02x oc:%02x][%04x]\n", m_osc_select,
+ printf("[%02d vs:%04x ve:%04x va:%04x vi:%02x vc:%02x os:%06x oe:%06x oa:%06x of:%04x SA:%02x oc:%02x][%04x]\n", m_osc_select,
m_voice[m_osc_select].vol.start >> 10,
m_voice[m_osc_select].vol.end >> 10,
m_voice[m_osc_select].vol.acc >> 10,
@@ -950,17 +844,17 @@ void ics2115_device::keyon()
);
#endif
//testing memory corruption issue with mame stream
- //logerror("m_volume[0x%x]=0x%x\n", mastervolume, m_volume[mastervolume]);
+ //printf("m_volume[0x%x]=0x%x\n", mastervolume, m_volume[mastervolume]);
}
void ics2115_device::recalc_irq()
{
//Suspect
bool irq = (m_irq_pending & m_irq_enabled);
- for (int i = 0; (!irq) && (i < 32); i++)
+ for(int i = 0; (!irq) && (i < 32); i++)
irq |= m_voice[i].vol_ctrl.bitflags.irq_pending && m_voice[i].osc_conf.bitflags.irq_pending;
m_irq_on = irq;
- if (!m_irq_cb.isnull())
+ if(!m_irq_cb.isnull())
m_irq_cb(irq ? ASSERT_LINE : CLEAR_LINE);
}
@@ -979,17 +873,16 @@ TIMER_CALLBACK_MEMBER( ics2115_device::timer_cb_1 )
void ics2115_device::recalc_timer(int timer)
{
//Old regression-based formula (minus constant)
- //u64 period = m_timer[timer].preset * (m_timer[timer].scale << 16) / 60;
+ //uint64_t period = m_timer[timer].preset * (m_timer[timer].scale << 16) / 60;
//New formula based on O.Galibert's reverse engineering of ICS2115 card firmware
- u64 period = ((m_timer[timer].scale & 0x1f) + 1) * (m_timer[timer].preset + 1);
+ uint64_t period = ((m_timer[timer].scale & 0x1f) + 1) * (m_timer[timer].preset + 1);
period = (period << (4 + (m_timer[timer].scale >> 5)))*78125/2646;
- if (m_timer[timer].period != period)
- {
+ if(m_timer[timer].period != period) {
m_timer[timer].period = period;
// Adjust the timer lengths
- if (period) // Reset the length
+ if(period) // Reset the length
m_timer[timer].timer->adjust(attotime::from_nsec(period), 0, attotime::from_nsec(period));
else // Kill the timer if length == 0
m_timer[timer].timer->adjust(attotime::never);
diff --git a/src/devices/sound/ics2115.h b/src/devices/sound/ics2115.h
index e9dc99a368f..57afef9f0c1 100644
--- a/src/devices/sound/ics2115.h
+++ b/src/devices/sound/ics2115.h
@@ -16,79 +16,77 @@ class ics2115_device : public device_t, public device_sound_interface
{
public:
// construction/destruction
- ics2115_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ ics2115_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
template <class Object> devcb_base &set_irq_callback(Object &&cb) { return m_irq_cb.set_callback(std::forward<Object>(cb)); }
auto irq() { return m_irq_cb.bind(); }
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
-
- // 16-bit read / write handlers (when /IOCS16 is low)
- u16 word_r(offs_t offset, u16 mem_mask);
- void word_w(offs_t offset, u16 data, u16 mem_mask);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
+ //uint8_t read(offs_t offset);
+ //void write(offs_t offset, uint8_t data);
TIMER_CALLBACK_MEMBER(timer_cb_0);
TIMER_CALLBACK_MEMBER(timer_cb_1);
protected:
- static constexpr u16 revision = 0x1;
+ static constexpr uint16_t revision = 0x1;
struct ics2115_voice {
struct {
- s32 left;
- u32 acc, start, end;
- u16 fc;
- u8 ctl, saddr;
+ int32_t left;
+ uint32_t acc, start, end;
+ uint16_t fc;
+ uint8_t ctl, saddr;
} osc;
struct {
- s32 left;
- u32 add;
- u32 start, end;
- u32 acc;
- u16 regacc;
- u8 incr;
- u8 pan, mode;
+ int32_t left;
+ uint32_t add;
+ uint32_t start, end;
+ uint32_t acc;
+ uint16_t regacc;
+ uint8_t incr;
+ uint8_t pan, mode;
} vol;
union {
struct {
- u8 ulaw : 1;
- u8 stop : 1; //stops wave + vol envelope
- u8 eightbit : 1;
- u8 loop : 1;
- u8 loop_bidir : 1;
- u8 irq : 1;
- u8 invert : 1;
- u8 irq_pending: 1;
+ uint8_t ulaw : 1;
+ uint8_t stop : 1; //stops wave + vol envelope
+ uint8_t eightbit : 1;
+ uint8_t loop : 1;
+ uint8_t loop_bidir : 1;
+ uint8_t irq : 1;
+ uint8_t invert : 1;
+ uint8_t irq_pending: 1;
//IRQ on variable?
} bitflags;
- u8 value;
+ uint8_t value;
} osc_conf;
union {
struct {
- u8 done : 1; //indicates ramp has stopped
- u8 stop : 1; //stops the ramp
- u8 rollover : 1; //rollover (TODO)
- u8 loop : 1;
- u8 loop_bidir : 1;
- u8 irq : 1; //enable IRQ generation
- u8 invert : 1; //invert direction
- u8 irq_pending: 1; //(read only) IRQ pending
+ uint8_t done : 1; //indicates ramp has stopped
+ uint8_t stop : 1; //stops the ramp
+ uint8_t rollover : 1; //rollover (TODO)
+ uint8_t loop : 1;
+ uint8_t loop_bidir : 1;
+ uint8_t irq : 1; //enable IRQ generation
+ uint8_t invert : 1; //invert direction
+ uint8_t irq_pending: 1; //(read only) IRQ pending
//noenvelope == (done | disable)
} bitflags;
- u8 value;
+ uint8_t value;
} vol_ctrl;
//Possibly redundant state. => improvements of wavetable logic
//may lead to its elimination.
union {
struct {
- u8 on : 1;
- u8 ramp : 7; // 100 0000 = 0x40 maximum
+ uint8_t on : 1;
+ uint8_t ramp : 7; // 100 0000 = 0x40 maximum
} bitflags;
- u8 value;
+ uint8_t value;
} state;
bool playing();
@@ -105,8 +103,8 @@ protected:
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
//internal register helper functions
- u16 reg_read();
- void reg_write(u16 data, u16 mem_mask);
+ uint16_t reg_read();
+ void reg_write(uint8_t data, bool msb);
void recalc_timer(int timer);
void keyon();
void recalc_irq();
@@ -118,29 +116,29 @@ protected:
sound_stream *m_stream;
// internal state
- required_region_ptr<u8> m_rom;
+ required_region_ptr<uint8_t> m_rom;
devcb_write_line m_irq_cb;
- s16 m_ulaw[256];
- u16 m_volume[4096];
+ int16_t m_ulaw[256];
+ uint16_t m_volume[4096];
static const int volume_bits = 15;
ics2115_voice m_voice[32];
struct {
- u8 scale, preset;
+ uint8_t scale, preset;
emu_timer *timer;
- u64 period; /* in nsec */
+ uint64_t period; /* in nsec */
} m_timer[2];
- u8 m_active_osc;
- u8 m_osc_select;
- u8 m_reg_select;
- u8 m_irq_enabled, m_irq_pending;
+ uint8_t m_active_osc;
+ uint8_t m_osc_select;
+ uint8_t m_reg_select;
+ uint8_t m_irq_enabled, m_irq_pending;
bool m_irq_on;
//Unknown variable, seems to be effected by 0x12. Further investigation
//Required.
- u8 m_vmode;
+ uint8_t m_vmode;
};
diff --git a/src/devices/sound/k051649.cpp b/src/devices/sound/k051649.cpp
index 995593aa6b2..815abb26739 100644
--- a/src/devices/sound/k051649.cpp
+++ b/src/devices/sound/k051649.cpp
@@ -37,7 +37,7 @@ void k051649_device::scc_map(address_map &map)
map(0x80, 0x89).w(FUNC(k051649_device::k051649_frequency_w));
map(0x8a, 0x8e).w(FUNC(k051649_device::k051649_volume_w));
map(0x8f, 0x8f).w(FUNC(k051649_device::k051649_keyonoff_w));
- map(0xe0, 0xe0).mirror(0x1f).rw(FUNC(k051649_device::k051649_test_r), FUNC(k051649_device::k051649_test_w));
+ map(0xe0, 0xff).rw(FUNC(k051649_device::k051649_test_r), FUNC(k051649_device::k051649_test_w));
}
// device type definition
@@ -177,7 +177,7 @@ void k051649_device::sound_stream_update(sound_stream &stream, stream_sample_t *
/********************************************************************************/
-void k051649_device::k051649_waveform_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( k051649_device::k051649_waveform_w )
{
// waveram is read-only?
if (m_test & 0x40 || (m_test & 0x80 && offset >= 0x60))
@@ -196,7 +196,7 @@ void k051649_device::k051649_waveform_w(offs_t offset, uint8_t data)
}
-uint8_t k051649_device::k051649_waveform_r(offs_t offset)
+READ8_MEMBER ( k051649_device::k051649_waveform_r )
{
// test-register bits 6/7 expose the internal counter
if (m_test & 0xc0)
@@ -212,7 +212,7 @@ uint8_t k051649_device::k051649_waveform_r(offs_t offset)
}
-void k051649_device::k052539_waveform_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( k051649_device::k052539_waveform_w )
{
// waveram is read-only?
if (m_test & 0x40)
@@ -223,7 +223,7 @@ void k051649_device::k052539_waveform_w(offs_t offset, uint8_t data)
}
-uint8_t k051649_device::k052539_waveform_r(offs_t offset)
+READ8_MEMBER ( k051649_device::k052539_waveform_r )
{
// test-register bit 6 exposes the internal counter
if (m_test & 0x40)
@@ -235,14 +235,14 @@ uint8_t k051649_device::k052539_waveform_r(offs_t offset)
}
-void k051649_device::k051649_volume_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( k051649_device::k051649_volume_w )
{
m_stream->update();
m_channel_list[offset&0x7].volume=data&0xf;
}
-void k051649_device::k051649_frequency_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( k051649_device::k051649_frequency_w )
{
int freq_hi = offset & 1;
offset >>= 1;
@@ -263,7 +263,7 @@ void k051649_device::k051649_frequency_w(offs_t offset, uint8_t data)
}
-void k051649_device::k051649_keyonoff_w(uint8_t data)
+WRITE8_MEMBER( k051649_device::k051649_keyonoff_w )
{
int i;
m_stream->update();
@@ -276,17 +276,16 @@ void k051649_device::k051649_keyonoff_w(uint8_t data)
}
-void k051649_device::k051649_test_w(uint8_t data)
+WRITE8_MEMBER( k051649_device::k051649_test_w )
{
m_test = data;
}
-uint8_t k051649_device::k051649_test_r()
+READ8_MEMBER ( k051649_device::k051649_test_r )
{
// reading the test register sets it to $ff!
- if (!machine().side_effects_disabled())
- k051649_test_w(0xff);
+ k051649_test_w(space, offset, 0xff);
return 0xff;
}
diff --git a/src/devices/sound/k051649.h b/src/devices/sound/k051649.h
index bbd671fe9ab..6ede7a295ee 100644
--- a/src/devices/sound/k051649.h
+++ b/src/devices/sound/k051649.h
@@ -18,16 +18,16 @@ class k051649_device : public device_t,
public:
k051649_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void k051649_waveform_w(offs_t offset, uint8_t data);
- uint8_t k051649_waveform_r(offs_t offset);
- void k051649_volume_w(offs_t offset, uint8_t data);
- void k051649_frequency_w(offs_t offset, uint8_t data);
- void k051649_keyonoff_w(uint8_t data);
- void k051649_test_w(uint8_t data);
- uint8_t k051649_test_r();
-
- void k052539_waveform_w(offs_t offset, uint8_t data);
- uint8_t k052539_waveform_r(offs_t offset);
+ DECLARE_WRITE8_MEMBER( k051649_waveform_w );
+ DECLARE_READ8_MEMBER ( k051649_waveform_r );
+ DECLARE_WRITE8_MEMBER( k051649_volume_w );
+ DECLARE_WRITE8_MEMBER( k051649_frequency_w );
+ DECLARE_WRITE8_MEMBER( k051649_keyonoff_w );
+ DECLARE_WRITE8_MEMBER( k051649_test_w );
+ DECLARE_READ8_MEMBER ( k051649_test_r );
+
+ DECLARE_WRITE8_MEMBER( k052539_waveform_w );
+ DECLARE_READ8_MEMBER ( k052539_waveform_r );
void scc_map(address_map &map);
protected:
diff --git a/src/devices/sound/k054539.cpp b/src/devices/sound/k054539.cpp
index 17dd9c97501..35f45bf4fa6 100644
--- a/src/devices/sound/k054539.cpp
+++ b/src/devices/sound/k054539.cpp
@@ -338,7 +338,7 @@ void k054539_device::init_chip()
save_item(NAME(m_timer_state));
}
-void k054539_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER(k054539_device::write)
{
if(0) {
int voice, reg;
@@ -476,7 +476,7 @@ void k054539_device::device_post_load()
cur_limit = rom_addr == 0x80 ? 0x4000 : 0x20000;
}
-u8 k054539_device::read(offs_t offset)
+READ8_MEMBER(k054539_device::read)
{
switch(offset) {
case 0x22d:
diff --git a/src/devices/sound/k054539.h b/src/devices/sound/k054539.h
index 9e7bafdb0fc..ebc117d494c 100644
--- a/src/devices/sound/k054539.h
+++ b/src/devices/sound/k054539.h
@@ -44,8 +44,8 @@ public:
set_analog_callback(cb_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr)));
}
- void write(offs_t offset, u8 data);
- u8 read(offs_t offset);
+ DECLARE_WRITE8_MEMBER(write);
+ DECLARE_READ8_MEMBER(read);
void init_flags(int flags);
diff --git a/src/devices/sound/meg.cpp b/src/devices/sound/meg.cpp
deleted file mode 100644
index a1f9d67b293..00000000000
--- a/src/devices/sound/meg.cpp
+++ /dev/null
@@ -1,384 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Olivier Galibert
-
-// Yamaha MEG - Multiple effects generator
-//
-// Audio dsp dedicated to effects generation
-
-#include "emu.h"
-#include "debugger.h"
-#include "meg.h"
-
-DEFINE_DEVICE_TYPE(MEG, meg_device, "meg", "Multiple Effects Generator (HD62098 / XM309A00)")
-DEFINE_DEVICE_TYPE(MEGEMB, meg_embedded_device, "megemb", "Multiple Effects Generator (embedded)")
-
-void meg_base_device::prg_map(address_map &map)
-{
- map(0, m_prg_size - 1).ram();
-}
-
-void meg_base_device::fp_map(address_map &map)
-{
- map(0, m_prg_size - 1).ram();
-}
-
-void meg_base_device::offsets_map(address_map &map)
-{
- map(0, 0x7f).ram();
-}
-
-meg_base_device::meg_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, u32 prg_size) :
- cpu_device(mconfig, type, tag, owner, clock),
- m_program_config("program", ENDIANNESS_BIG, 64, prg_size > 256 ? 9 : 8, -3, address_map_constructor(FUNC(meg_base_device::prg_map), this)),
- m_fp_config("fp", ENDIANNESS_BIG, 16, prg_size > 256 ? 9 : 8, -1, address_map_constructor(FUNC(meg_base_device::fp_map), this)),
- m_offsets_config("offsets", ENDIANNESS_BIG, 16, prg_size > 256 ? 7 : 7, -1, address_map_constructor(FUNC(meg_base_device::offsets_map), this)),
- m_prg_size(prg_size)
-{
-}
-
-
-void meg_base_device::prg_w(u16 address, u64 opcode)
-{
- m_program->write_qword(address, opcode);
-}
-
-void meg_base_device::fp_w(u16 address, u16 value)
-{
- m_fp->write_word(address, value);
-}
-
-void meg_base_device::offset_w(u16 address, u16 value)
-{
- m_offsets->write_word(address, value);
-}
-
-void meg_base_device::lfo_w(u8 reg, u16 value)
-{
- m_lfo[reg] = value;
-
- static const int dt[8] = { 0, 32, 64, 128, 256, 512, 1024, 2048 };
- static const int sh[8] = { 0, 0, 1, 2, 3, 4, 5, 6 };
-
- int scale = (value >> 5) & 7;
- int step = ((value & 31) << sh[scale]) + dt[scale];
- logerror("lfo_w %02x freq=%5.2f phase=%6.4f\n", reg, step * 44100.0/4194304, (value >> 8)/256.0);
-}
-
-void meg_base_device::map_w(u8 reg, u16 value)
-{
- m_map[reg] = value;
-}
-
-u64 meg_base_device::prg_r(u16 address) const
-{
- return m_program->read_qword(address);
-}
-
-u16 meg_base_device::fp_r(u16 address) const
-{
- return m_fp->read_word(address);
-}
-
-u16 meg_base_device::offset_r(u16 address) const
-{
- return m_offsets->read_word(address);
-}
-
-u16 meg_base_device::lfo_r(u8 reg) const
-{
- return m_lfo[reg];
-}
-
-u16 meg_base_device::map_r(u8 reg) const
-{
- return m_map[reg];
-}
-
-
-void meg_base_device::device_start()
-{
- m_program = &space(AS_PROGRAM);
- m_fp = &space(AS_FP);
- m_offsets = &space(AS_OFFSETS);
-
- state_add(STATE_GENPC, "GENPC", m_pc).noshow();
- state_add(STATE_GENPCBASE, "CURPC", m_pc).noshow();
- state_add(0, "PC", m_pc);
-
- set_icountptr(m_icount);
-
- save_item(NAME(m_lfo));
- save_item(NAME(m_map));
- save_item(NAME(m_pc));
-}
-
-void meg_base_device::device_reset()
-{
- memset(m_lfo, 0, sizeof(m_lfo));
- memset(m_map, 0, sizeof(m_map));
- m_pc = 0;
-}
-
-uint32_t meg_base_device::execute_min_cycles() const
-{
- return 1;
-}
-
-uint32_t meg_base_device::execute_max_cycles() const
-{
- return 1;
-}
-
-uint32_t meg_base_device::execute_input_lines() const
-{
- return 0;
-}
-
-void meg_base_device::execute_run()
-{
- if(machine().debug_flags & DEBUG_FLAG_ENABLED)
- debugger_instruction_hook(m_pc);
- m_icount = 0;
-}
-
-device_memory_interface::space_config_vector meg_base_device::memory_space_config() const
-{
- return space_config_vector {
- std::make_pair(AS_PROGRAM, &m_program_config),
- std::make_pair(AS_FP, &m_fp_config),
- std::make_pair(AS_OFFSETS, &m_offsets_config)
- };
-}
-
-void meg_base_device::state_import(const device_state_entry &entry)
-{
-}
-
-void meg_base_device::state_export(const device_state_entry &entry)
-{
-}
-
-void meg_base_device::state_string_export(const device_state_entry &entry, std::string &str) const
-{
-}
-
-std::unique_ptr<util::disasm_interface> meg_base_device::create_disassembler()
-{
- return std::make_unique<meg_disassembler>(this);
-}
-
-meg_embedded_device::meg_embedded_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- meg_base_device(mconfig, MEGEMB, tag, owner, clock, 384)
-{
-}
-
-meg_device::meg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- meg_base_device(mconfig, MEG, tag, owner, clock, 256)
-{
-}
-
-
-// vl70:
-// 6d1e: write 1, r0l
-// 6d26: write 2, r0l
-// 6d2e: read 2
-// 6d36: write 3, r0l
-// 6d3e: write reg 4:r0h, r0l
-// 6d52: write reg 5:r0h, r0l-1
-// 6d68: write 7, r0l
-// 6d70: write reg 8:r0h, r0l
-// 6d84: write reg 9:r0h, r0l
-// 6dac: write a, r0l
-// 6db4: write reg cd:r1l, r0
-// 6dd4: write reg e:r0h, r0l
-// 6dee: write reg f:r0h, r0l
-// 6e08: read 10,11
-// 6e1c: write reg 1213:r1l, r0
-// 6e3c: write reg 14:r0h, r0l
-// 6e50: write 15, r0l
-// 6e58: write reg 16:r0h, r0l
-// 6e6c: write reg 17:r0h, r0l
-// 6e80: write reg 18:e0h, e0l
-
-void meg_device::map(address_map &map)
-{
- map(0x00, 0x00).w(FUNC(meg_device::select_w));
- map(0x01, 0x01).w(FUNC(meg_device::s1_w));
- map(0x02, 0x02).rw(FUNC(meg_device::s2_r), FUNC(meg_device::s2_w));
- map(0x03, 0x03).w(FUNC(meg_device::s3_w));
- map(0x04, 0x04).w(FUNC(meg_device::s4_w));
- map(0x05, 0x05).w(FUNC(meg_device::s5_w));
- map(0x07, 0x07).w(FUNC(meg_device::s7_w));
- map(0x08, 0x08).w(FUNC(meg_device::s8_w));
- map(0x09, 0x09).w(FUNC(meg_device::s9_w));
- map(0x0a, 0x0a).w(FUNC(meg_device::sa_w));
- map(0x0c, 0x0c).w(FUNC(meg_device::fph_w));
- map(0x0d, 0x0d).w(FUNC(meg_device::fpl_w));
- map(0x0e, 0x0e).w(FUNC(meg_device::se_w));
- map(0x0f, 0x0f).w(FUNC(meg_device::sf_w));
- map(0x10, 0x10).r(FUNC(meg_device::s10_r));
- map(0x11, 0x11).r(FUNC(meg_device::s11_r));
- map(0x12, 0x12).w(FUNC(meg_device::offseth_w));
- map(0x13, 0x13).w(FUNC(meg_device::offsetl_w));
- map(0x14, 0x14).w(FUNC(meg_device::s14_w));
- map(0x15, 0x15).w(FUNC(meg_device::s15_w));
- map(0x16, 0x16).w(FUNC(meg_device::s16_w));
- map(0x17, 0x17).w(FUNC(meg_device::s17_w));
- map(0x18, 0x18).w(FUNC(meg_device::s18_w));
-}
-
-u8 meg_device::s2_r()
-{
- logerror("read r2 %s\n", machine().describe_context());
- return 0x00;
-}
-
-void meg_device::select_w(u8 data)
-{
- m_reg = data;
-}
-
-void meg_device::s1_w(u8 data)
-{
- logerror("r1 %02x %s\n", data, machine().describe_context());
-}
-
-void meg_device::s2_w(u8 data)
-{
- logerror("r2 %02x %s\n", data, machine().describe_context());
-}
-
-void meg_device::s3_w(u8 data)
-{
- logerror("r3 %02x %s\n", data, machine().describe_context());
-}
-
-void meg_device::s4_w(u8 data)
-{
- if(m_r4[m_reg] != data) {
- m_r4[m_reg] = data;
- logerror("r4[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
- }
-}
-
-void meg_device::s5_w(u8 data)
-{
- if(m_r5[m_reg] != data) {
- m_r5[m_reg] = data;
- logerror("r5[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
- }
-}
-
-void meg_device::s7_w(u8 data)
-{
- logerror("r7 %02x %s\n", data, machine().describe_context());
-}
-
-void meg_device::s8_w(u8 data)
-{
- if(m_r8[m_reg] != data) {
- m_r8[m_reg] = data;
- logerror("r8[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
- }
-}
-
-
-void meg_device::s9_w(u8 data)
-{
- if(m_r9[m_reg] != data) {
- m_r9[m_reg] = data;
- logerror("r9[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
- }
-}
-
-void meg_device::sa_w(u8 data)
-{
- logerror("ra %02x %s\n", data, machine().describe_context());
-}
-
-void meg_device::fph_w(u8 data)
-{
- fp_w(m_reg, (fp_r(m_reg) & 0x00ff) | (data << 8));
-}
-
-
-void meg_device::fpl_w(u8 data)
-{
- fp_w(m_reg, (fp_r(m_reg) & 0xff00) | data);
-}
-
-void meg_device::se_w(u8 data)
-{
- if(m_re[m_reg] != data) {
- m_re[m_reg] = data;
- logerror("re[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
- }
-}
-
-
-void meg_device::sf_w(u8 data)
-{
- if(m_rf[m_reg] != data) {
- m_rf[m_reg] = data;
- logerror("rf[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
- }
-}
-
-u8 meg_device::s10_r()
-{
- logerror("read r10 %s\n", machine().describe_context());
- return 0x00;
-}
-
-u8 meg_device::s11_r()
-{
- logerror("read r11 %s\n", machine().describe_context());
- return 0x00;
-}
-
-void meg_device::offseth_w(u8 data)
-{
- offset_w(m_reg, (offset_r(m_reg) & 0x00ff) | (data << 8));
-}
-
-void meg_device::offsetl_w(u8 data)
-{
- offset_w(m_reg, (offset_r(m_reg) & 0xff00) | data);
-}
-
-void meg_device::s14_w(u8 data)
-{
- if(m_r14[m_reg] != data) {
- m_r14[m_reg] = data;
- logerror("r14[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
- }
-}
-
-void meg_device::s15_w(u8 data)
-{
- logerror("r15 %02x %s\n", data, machine().describe_context());
-}
-
-void meg_device::s16_w(u8 data)
-{
- if(m_r16[m_reg] != data) {
- m_r16[m_reg] = data;
- logerror("r16[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
- }
-}
-
-void meg_device::s17_w(u8 data)
-{
- if(m_r17[m_reg] != data) {
- m_r17[m_reg] = data;
- logerror("r17[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
- }
-}
-
-void meg_device::s18_w(u8 data)
-{
- if(m_r18[m_reg] != data) {
- m_r18[m_reg] = data;
- logerror("r18[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
- }
-}
diff --git a/src/devices/sound/meg.h b/src/devices/sound/meg.h
deleted file mode 100644
index e9ff44f990a..00000000000
--- a/src/devices/sound/meg.h
+++ /dev/null
@@ -1,122 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Olivier Galibert
-
-// Yamaha MEG - Multiple effects generator
-//
-// Audio dsp dedicated to effects generation
-
-#ifndef DEVICES_SOUND_MEG_H
-#define DEVICES_SOUND_MEG_H
-
-#pragma once
-
-#include "megd.h"
-
-
-class meg_base_device : public cpu_device, public meg_disassembler::info
-{
-public:
- enum {
- AS_FP = 1,
- AS_OFFSETS = 2
- };
-
- meg_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, u32 prg_size);
-
- void prg_w(u16 address, u64 opcode);
- void fp_w(u16 address, u16 value);
- void offset_w(u16 address, u16 value);
- void lfo_w(u8 reg, u16 value);
- void map_w(u8 reg, u16 value);
- u64 prg_r(u16 address) const;
- virtual u16 fp_r(u16 address) const override;
- virtual u16 offset_r(u16 address) const override;
- u16 lfo_r(u8 reg) const;
- u16 map_r(u8 reg) const;
-
-protected:
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual uint32_t execute_min_cycles() const override;
- virtual uint32_t execute_max_cycles() const override;
- virtual uint32_t execute_input_lines() const override;
- virtual void execute_run() override;
- virtual space_config_vector memory_space_config() const override;
- virtual void state_import(const device_state_entry &entry) override;
- virtual void state_export(const device_state_entry &entry) override;
- virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
- virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
-
-private:
- address_space_config m_program_config, m_fp_config, m_offsets_config;
- address_space *m_program, *m_fp, *m_offsets;
-
- u32 m_prg_size, m_pc;
- int m_icount;
-
- u16 m_lfo[0x18], m_map[8];
-
- void prg_map(address_map &map);
- void fp_map(address_map &map);
- void offsets_map(address_map &map);
-};
-
-class meg_embedded_device : public meg_base_device
-{
-public:
- meg_embedded_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 44100*384);
-};
-
-class meg_device : public meg_base_device
-{
-public:
- meg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 44100*256);
- void map(address_map &map);
-
-private:
- u8 m_r4[256];
- u8 m_r5[256];
- u8 m_r8[256];
- u8 m_r9[256];
- u8 m_re[256];
- u8 m_rf[256];
- u8 m_r12[256];
- u8 m_r13[256];
- u8 m_r14[256];
- u8 m_r16[256];
- u8 m_r17[256];
- u8 m_r18[256];
- u8 m_reg;
- u8 s2_r();
- u8 s10_r();
- u8 s11_r();
- void select_w(u8 reg);
- void s1_w(u8 data);
- void s2_w(u8 data);
- void s3_w(u8 data);
- void s4_w(u8 data);
- void s5_w(u8 data);
- void s7_w(u8 data);
- void s8_w(u8 data);
- void s9_w(u8 data);
- void sa_w(u8 data);
- void fph_w(u8 data);
- void fpl_w(u8 data);
- void se_w(u8 data);
- void sf_w(u8 data);
- void s10_w(u8 data);
- void s11_w(u8 data);
- void offseth_w(u8 data);
- void offsetl_w(u8 data);
- void s14_w(u8 data);
- void s15_w(u8 data);
- void s16_w(u8 data);
- void s17_w(u8 data);
- void s18_w(u8 data);
-};
-
-
-DECLARE_DEVICE_TYPE(MEG, meg_device)
-DECLARE_DEVICE_TYPE(MEGEMB, meg_embedded_device)
-
-#endif
diff --git a/src/devices/sound/megd.cpp b/src/devices/sound/megd.cpp
deleted file mode 100644
index 2790a7ca69c..00000000000
--- a/src/devices/sound/megd.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Olivier Galibert
-
-// Yamaha MEG - Multiple effects generator
-//
-// Audio dsp dedicated to effects generation
-//
-// Disassembler
-
-#include "emu.h"
-#include "megd.h"
-
-meg_disassembler::meg_disassembler(info *inf) : m_info(inf)
-{
-}
-
-u32 meg_disassembler::opcode_alignment() const
-{
- return 1;
-}
-
-std::string meg_disassembler::gfp(offs_t address) const
-{
- if(!m_info)
- return util::string_format("fp%03x", address);
- s16 fp = m_info->fp_r(address);
- return util::string_format("%g", fp / 16384.0);
-}
-
-std::string meg_disassembler::goffset(offs_t address) const
-{
- return m_info ? util::string_format("%x", m_info->offset_r(address)) : util::string_format("of%02x", address);
-}
-
-u32 meg_disassembler::b(u64 opc, u32 start, u32 count)
-{
- return (opc >> start) & ((1 << count) - 1);
-}
-
-void meg_disassembler::append(std::string &r, std::string e)
-{
- if(r != "")
- r += " ; ";
- r += e;
-}
-
-// 33333333 33333333 22222222 22222222 11111111 11111111 00000000 00000000
-// fedcba98 76543210 fedcba98 76543210 fedcba98 76543210 fedcba98 76543210
-
-// 66665555 55555544 44444444 33333333 33222222 22221111 11111100 00000000
-// 32109876 54321098 76543210 98765432 10987654 32109876 54321098 76543210
-// XLB----- -rrrrrrr r--mmmmm m-MM---- -P-----* -----Arr rrrrrrmm mmmm----
-
-// m = low is read port, high is write port, memory register
-// r = low is read port, high is high port, rotating register
-
-// X = used for lo-fi variation only
-// L = lfo read
-// * = compute mul
-// A = mul input = m or r
-// P = P sent for register write
-// B = register write to mbuf
-// M = memory mode, none/read/write/read+1
-
-offs_t meg_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params)
-{
- u64 opc = opcodes.r64(pc);
-
- std::string r;
-
- r = util::string_format("[m%02x]", b(opc, 39, 6));
-
- if(b(opc, 62, 1))
- append(r, "lfo");
-
- if(b(opc, 23, 1))
- switch(b(opc, 24, 2)) {
- case 0:
- if(b(opc, 18, 1))
- append(r, util::string_format("p += %s*m%02x", gfp(pc), b(opc, 4, 6)));
- else
- append(r, util::string_format("p += %s*r%02x", gfp(pc), b(opc, 10, 8)));
- break;
- case 1:
- append(r, util::string_format("p = %s*(r%02x+m%02x)", gfp(pc), b(opc, 10, 8), b(opc, 4, 6)));
- break;
- case 2:
- append(r, util::string_format("p ?= %s*(r%02x+m%02x)", gfp(pc), b(opc, 10, 8), b(opc, 4, 6)));
- break;
- case 3:
- if(b(opc, 18, 1))
- append(r, util::string_format("p = %s*m%02x", gfp(pc), b(opc, 4, 6)));
- else
- append(r, util::string_format("p = %s*r%02x", gfp(pc), b(opc, 10, 8)));
- break;
- }
-
- if(b(opc, 30, 1)) {
- if(b(opc, 61, 1))
- append(r, "mb = p");
- else if(b(opc, 46, 1) == 1)
- append(r, util::string_format("m%02x = p", b(opc, 39, 6)));
- else
- append(r, util::string_format("r%02x = p", b(opc, 47, 8)));
- }
-
- u32 memmode = b(opc, 36, 2);
- if(memmode) {
- static const char *modes[4] = { nullptr, "w", "r", "rw" };
-
- append(r, util::string_format("mem_%s %x +%s", modes[memmode], b(opc, 33, 3), goffset(pc/3)));
- r += util::string_format("-> m%02x", b(opcodes.r64(pc+2), 39, 6));
- }
-
- stream << r;
-
- return 1 | SUPPORTED;
-}
diff --git a/src/devices/sound/megd.h b/src/devices/sound/megd.h
deleted file mode 100644
index 59a13aa0ea4..00000000000
--- a/src/devices/sound/megd.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Olivier Galibert
-
-// Yamaha MEG - Multiple effects generator
-//
-// Audio dsp dedicated to effects generation
-//
-// Disassembler
-
-#ifndef DEVICES_SOUND_MEGD_H
-#define DEVICES_SOUND_MEGD_H
-
-#pragma once
-
-class meg_disassembler : public util::disasm_interface
-{
-public:
- class info {
- public:
- virtual u16 fp_r(u16 address) const = 0;
- virtual u16 offset_r(u16 address) const = 0;
- };
-
- meg_disassembler(info *inf = nullptr);
-
- virtual u32 opcode_alignment() const override;
- virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params) override;
-
-private:
- info *m_info;
-
- std::string gfp(offs_t address) const;
- std::string goffset(offs_t address) const;
-
- static inline u32 b(u64 opc, u32 start, u32 count);
- static inline void append(std::string &r, std::string e);
-};
-
-#endif
diff --git a/src/devices/sound/mos6560.cpp b/src/devices/sound/mos6560.cpp
index d332791ec7c..45b944c5179 100644
--- a/src/devices/sound/mos6560.cpp
+++ b/src/devices/sound/mos6560.cpp
@@ -682,14 +682,12 @@ DEFINE_DEVICE_TYPE(MOS656X_ATTACK_UFO, mos656x_attack_ufo_device, "mos656x_attac
// default address maps
void mos6560_device::mos6560_videoram_map(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, 0x3fff).ram();
+ map(0x0000, 0x3fff).ram();
}
void mos6560_device::mos6560_colorram_map(address_map &map)
{
- if (!has_configured_map(1))
- map(0x000, 0x3ff).ram();
+ map(0x000, 0x3ff).ram();
}
mos6560_device::mos6560_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t variant)
@@ -698,8 +696,8 @@ mos6560_device::mos6560_device(const machine_config &mconfig, device_type type,
device_sound_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_variant(variant),
- m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, address_map_constructor(FUNC(mos6560_device::mos6560_videoram_map), this)),
- m_colorram_space_config("colorram", ENDIANNESS_LITTLE, 8, 10, 0, address_map_constructor(FUNC(mos6560_device::mos6560_colorram_map), this)),
+ m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, address_map_constructor(), address_map_constructor(FUNC(mos6560_device::mos6560_videoram_map), this)),
+ m_colorram_space_config("colorram", ENDIANNESS_LITTLE, 8, 10, 0, address_map_constructor(), address_map_constructor(FUNC(mos6560_device::mos6560_colorram_map), this)),
m_read_potx(*this),
m_read_poty(*this)
{
diff --git a/src/devices/sound/mos6581.cpp b/src/devices/sound/mos6581.cpp
index 2e4cb1f3cfd..8648e86bbc9 100644
--- a/src/devices/sound/mos6581.cpp
+++ b/src/devices/sound/mos6581.cpp
@@ -119,7 +119,7 @@ void mos6581_device::sound_stream_update(sound_stream &stream, stream_sample_t *
// read -
//-------------------------------------------------
-uint8_t mos6581_device::read(offs_t offset)
+READ8_MEMBER( mos6581_device::read )
{
uint8_t data;
@@ -146,7 +146,7 @@ uint8_t mos6581_device::read(offs_t offset)
// write -
//-------------------------------------------------
-void mos6581_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mos6581_device::write )
{
m_token->port_w(offset, data);
}
diff --git a/src/devices/sound/mos6581.h b/src/devices/sound/mos6581.h
index 68d319a45df..95af2cbd687 100644
--- a/src/devices/sound/mos6581.h
+++ b/src/devices/sound/mos6581.h
@@ -53,8 +53,8 @@ public:
auto potx() { return m_read_potx.bind(); }
auto poty() { return m_read_poty.bind(); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
protected:
mos6581_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t variant);
diff --git a/src/devices/sound/mos7360.cpp b/src/devices/sound/mos7360.cpp
index 2c3f6cbd26d..f1ced2e6a9e 100644
--- a/src/devices/sound/mos7360.cpp
+++ b/src/devices/sound/mos7360.cpp
@@ -172,8 +172,7 @@ DEFINE_DEVICE_TYPE(MOS7360, mos7360_device, "mos7360", "MOS 7360 TED")
// default address maps
void mos7360_device::mos7360_videoram_map(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, 0xffff).ram();
+ map(0x0000, 0xffff).ram();
}
@@ -266,7 +265,7 @@ mos7360_device::mos7360_device(const machine_config &mconfig, const char *tag, d
device_memory_interface(mconfig, *this),
device_sound_interface(mconfig, *this),
device_video_interface(mconfig, *this),
- m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(mos7360_device::mos7360_videoram_map), this)),
+ m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(), address_map_constructor(FUNC(mos7360_device::mos7360_videoram_map), this)),
m_write_irq(*this),
m_read_k(*this),
m_stream(nullptr)
diff --git a/src/devices/sound/msm5205.h b/src/devices/sound/msm5205.h
index 2f36d0347e9..7bdb0544af1 100644
--- a/src/devices/sound/msm5205.h
+++ b/src/devices/sound/msm5205.h
@@ -7,6 +7,16 @@
/* an interface for the MSM5205 and similar chips */
+#define MCFG_MSM5205_PRESCALER_SELECTOR(select) \
+ downcast<msm5205_device &>(*device).set_prescaler_selector((msm5205_device::select));
+
+#define MCFG_MSM5205_VCK_CALLBACK(cb) \
+ downcast<msm5205_device &>(*device).set_vck_callback((DEVCB_##cb));
+
+#define MCFG_MSM5205_VCLK_CB(cb) \
+ downcast<msm5205_device &>(*device).set_vck_legacy_callback((DEVCB_##cb));
+
+
class msm5205_device : public device_t, public device_sound_interface
{
public:
diff --git a/src/devices/sound/nile.cpp b/src/devices/sound/nile.cpp
index fcd9e4b592d..4e78b754db5 100644
--- a/src/devices/sound/nile.cpp
+++ b/src/devices/sound/nile.cpp
@@ -69,11 +69,6 @@ nile_device::nile_device(const machine_config &mconfig, const char *tag, device_
void nile_device::device_start()
{
m_stream = stream_alloc(0, 2, 44100);
- save_item(NAME(m_sound_regs));
- save_item(NAME(m_vpos));
- save_item(NAME(m_frac));
- save_item(NAME(m_lponce));
- save_item(NAME(m_ctrl));
}
diff --git a/src/devices/sound/okim6258.cpp b/src/devices/sound/okim6258.cpp
index a9477a5d7bc..491229a4e81 100644
--- a/src/devices/sound/okim6258.cpp
+++ b/src/devices/sound/okim6258.cpp
@@ -262,7 +262,7 @@ int okim6258_device::get_vclk()
***********************************************************************************************/
-uint8_t okim6258_device::status_r()
+READ8_MEMBER( okim6258_device::status_r )
{
m_stream->update();
@@ -275,7 +275,7 @@ uint8_t okim6258_device::status_r()
okim6258_data_w -- write to the control port of an OKIM6258-compatible chip
***********************************************************************************************/
-void okim6258_device::data_w(uint8_t data)
+WRITE8_MEMBER( okim6258_device::data_w )
{
/* update the stream */
m_stream->update();
@@ -291,7 +291,7 @@ void okim6258_device::data_w(uint8_t data)
***********************************************************************************************/
-void okim6258_device::ctrl_w(uint8_t data)
+WRITE8_MEMBER( okim6258_device::ctrl_w )
{
m_stream->update();
diff --git a/src/devices/sound/okim6258.h b/src/devices/sound/okim6258.h
index 57f764d4eb7..6ca2c67532b 100644
--- a/src/devices/sound/okim6258.h
+++ b/src/devices/sound/okim6258.h
@@ -33,9 +33,9 @@ public:
void set_type(int type) { m_adpcm_type = type; }
void set_outbits(int outbit) { m_output_bits = outbit; }
- uint8_t status_r();
- void data_w(uint8_t data);
- void ctrl_w(uint8_t data);
+ DECLARE_READ8_MEMBER( status_r );
+ DECLARE_WRITE8_MEMBER( data_w );
+ DECLARE_WRITE8_MEMBER( ctrl_w );
void set_divider(int val);
int get_vclk();
diff --git a/src/devices/sound/okim6295.cpp b/src/devices/sound/okim6295.cpp
index 10375f7736a..faf078e5f7c 100644
--- a/src/devices/sound/okim6295.cpp
+++ b/src/devices/sound/okim6295.cpp
@@ -210,10 +210,10 @@ void okim6295_device::set_pin7(int pin7)
//-------------------------------------------------
-// read - read the status register
+// read_status - read the status register
//-------------------------------------------------
-uint8_t okim6295_device::read()
+uint8_t okim6295_device::read_status()
{
uint8_t result = 0xf0; // naname expects bits 4-7 to be 1
@@ -228,10 +228,20 @@ uint8_t okim6295_device::read()
//-------------------------------------------------
-// write - write to the command register
+// read - memory interface for read
//-------------------------------------------------
-void okim6295_device::write(uint8_t command)
+READ8_MEMBER( okim6295_device::read )
+{
+ return read_status();
+}
+
+
+//-------------------------------------------------
+// write_command - write to the command register
+//-------------------------------------------------
+
+void okim6295_device::write_command(uint8_t command)
{
// if a command is pending, process the second half
if (m_command != -1)
@@ -313,6 +323,16 @@ void okim6295_device::write(uint8_t command)
}
+//-------------------------------------------------
+// write - memory interface for write
+//-------------------------------------------------
+
+WRITE8_MEMBER( okim6295_device::write )
+{
+ write_command(data);
+}
+
+
//**************************************************************************
// OKIM VOICE
diff --git a/src/devices/sound/okim6295.h b/src/devices/sound/okim6295.h
index 0e836c29ad9..536c76b3b10 100644
--- a/src/devices/sound/okim6295.h
+++ b/src/devices/sound/okim6295.h
@@ -47,8 +47,11 @@ public:
// runtime configuration
void set_pin7(int pin7);
- uint8_t read();
- void write(uint8_t command);
+ uint8_t read_status();
+ void write_command(uint8_t command);
+
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
protected:
// device-level overrides
diff --git a/src/devices/sound/okim6376.cpp b/src/devices/sound/okim6376.cpp
index e04f051b0f5..0e33c83d7a8 100644
--- a/src/devices/sound/okim6376.cpp
+++ b/src/devices/sound/okim6376.cpp
@@ -513,7 +513,7 @@ WRITE_LINE_MEMBER( okim6376_device::st_w )
***********************************************************************************************/
-void okim6376_device::write(uint8_t data)
+WRITE8_MEMBER( okim6376_device::write )
{
// The data port is purely used to set the latch, everything else is started by an ST pulse
diff --git a/src/devices/sound/okim6376.h b/src/devices/sound/okim6376.h
index 91cb3acf7e6..7efaa337d49 100644
--- a/src/devices/sound/okim6376.h
+++ b/src/devices/sound/okim6376.h
@@ -13,7 +13,7 @@ class okim6376_device : public device_t,
public:
okim6376_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void write(uint8_t data);
+ DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( st_w );
DECLARE_WRITE_LINE_MEMBER( ch2_w );
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
index 3372ac70a81..487a1b4e83b 100644
--- a/src/devices/sound/pokey.cpp
+++ b/src/devices/sound/pokey.cpp
@@ -99,6 +99,11 @@
#define TIMER2 1
#define TIMER4 2
+/* values to add to the divisors for the different modes */
+#define DIVADD_LOCLK 1
+#define DIVADD_HICLK 4
+#define DIVADD_HICLK_JOINED 7
+
/* AUDCx */
#define NOTPOLY5 0x80 /* selects POLY5 or direct CLOCK */
#define POLY4 0x40 /* selects POLY4 or POLY17 */
@@ -147,10 +152,17 @@
#define DIV_64 28 /* divisor for 1.78979 MHz clock to 63.9211 kHz */
#define DIV_15 114 /* divisor for 1.78979 MHz clock to 15.6999 kHz */
+#define P4(chip) chip->poly4[chip->p4]
+#define P5(chip) chip->poly5[chip->p5]
+#define P9(chip) chip->poly9[chip->p9]
+#define P17(chip) chip->poly17[chip->p17]
+
#define CLK_1 0
#define CLK_28 1
#define CLK_114 2
+static const int clock_divisors[3] = {1, DIV_64, DIV_15};
+
constexpr unsigned pokey_device::FREQ_17_EXACT;
@@ -241,8 +253,7 @@ void pokey_device::device_start()
m_pot_counter = 0;
m_kbd_cnt = 0;
m_out_filter = 0;
- m_out_raw = 0;
- m_old_raw_inval = true;
+ m_output = 0;
m_kbd_state = 0;
/* reset more internal state */
@@ -424,7 +435,14 @@ void pokey_device::execute_run()
{
do
{
- step_one_clock();
+ uint32_t new_out = step_one_clock();
+ if (m_output != new_out)
+ {
+ //printf("forced update %08d %08x\n", m_icount, m_output);
+ m_stream->update();
+ m_output = new_out;
+ }
+
m_icount--;
} while (m_icount > 0);
@@ -528,8 +546,11 @@ void pokey_device::step_keyboard()
void pokey_device::step_pot()
{
- m_pot_counter++;
+ if ((m_SKCTL & SK_RESET) == 0)
+ return;
+
uint8_t upd = 0;
+ m_pot_counter++;
for (int pot = 0; pot < 8; pot++)
{
if ((m_POTx[pot]<m_pot_counter) || (m_pot_counter == 228))
@@ -538,9 +559,7 @@ void pokey_device::step_pot()
/* latching is emulated in read */
}
}
- // some pots latched?
- if (upd != 0)
- synchronize(SYNC_POT, upd);
+ synchronize(SYNC_POT, upd);
}
/*
@@ -551,38 +570,31 @@ void pokey_device::step_pot()
*
*/
-void pokey_device::step_one_clock(void)
+uint32_t pokey_device::step_one_clock(void)
{
- /* Clocks only count if we are not in a reset */
+ int const base_clock = (m_AUDCTL & CLK_15KHZ) ? CLK_114 : CLK_28;
+
if (m_SKCTL & SK_RESET)
{
- /* polynom pointers */
- if (++m_p4 == 0x0000f)
- m_p4 = 0;
- if (++m_p5 == 0x0001f)
- m_p5 = 0;
- if (++m_p9 == 0x001ff)
- m_p9 = 0;
- if (++m_p17 == 0x1ffff)
- m_p17 = 0;
-
- /* CLK_1: no presacler */
- int clock_triggered[3] = {1,0,0};
- /* CLK_28: prescaler 63.9211 kHz */
- if (++m_clock_cnt[CLK_28] >= DIV_64)
- {
- m_clock_cnt[CLK_28] = 0;
- clock_triggered[CLK_28] = 1;
- }
- /* CLK_114 prescaler 15.6999 kHz */
- if (++m_clock_cnt[CLK_114] >= DIV_15)
+ /* Clocks only count if we are not in a reset */
+ int clock_triggered[3] = {0,0,0};
+ int clk;
+ for (clk = 0; clk < 3; clk++)
{
- m_clock_cnt[CLK_114] = 0;
- clock_triggered[CLK_114] = 1;
+ m_clock_cnt[clk]++;
+ if (m_clock_cnt[clk] >= clock_divisors[clk])
+ {
+ m_clock_cnt[clk] = 0;
+ clock_triggered[clk] = 1;
+ }
}
- int const base_clock = (m_AUDCTL & CLK_15KHZ) ? CLK_114 : CLK_28;
- int clk = (m_AUDCTL & CH1_HICLK) ? CLK_1 : base_clock;
+ m_p4 = (m_p4 + 1) % 0x0000f;
+ m_p5 = (m_p5 + 1) % 0x0001f;
+ m_p9 = (m_p9 + 1) % 0x001ff;
+ m_p17 = (m_p17 + 1 ) % 0x1ffff;
+
+ clk = (m_AUDCTL & CH1_HICLK) ? CLK_1 : base_clock;
if (clock_triggered[clk])
m_channel[CHAN1].inc_chan();
@@ -666,23 +678,12 @@ void pokey_device::step_one_clock(void)
m_channel[CHAN1].m_filter_sample = 1;
}
- if (m_old_raw_inval)
+ uint32_t sum = 0;
+ for (int ch = 0; ch < 4; ch++)
{
- uint32_t sum = 0;
- for (int ch = 0; ch < 4; ch++)
- {
- sum |= (((m_channel[ch].m_output ^ m_channel[ch].m_filter_sample) || (m_channel[ch].m_AUDC & VOLUME_ONLY)) ?
- ((m_channel[ch].m_AUDC & VOLUME_MASK) << (ch * 4)) : 0);
- }
-
- if (m_out_raw != sum)
- {
- //printf("forced update %08d %08x\n", m_icount, m_out_raw);
- m_stream->update();
- }
- m_old_raw_inval = false;
- m_out_raw = sum;
+ sum |= (((((m_channel[ch].m_output ^ m_channel[ch].m_filter_sample) || (m_channel[ch].m_AUDC & VOLUME_ONLY)) ? (m_channel[ch].m_AUDC & VOLUME_MASK) : 0 )) << (ch * 4));
}
+ return sum;
}
//-------------------------------------------------
@@ -699,7 +700,7 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
{
int32_t out = 0;
for (int i = 0; i < 4; i++)
- out += ((m_out_raw >> (4*i)) & 0x0f);
+ out += ((m_output >> (4*i)) & 0x0f);
out *= POKEY_DEFAULT_GAIN;
out = (out > 0x7fff) ? 0x7fff : out;
while( samples > 0 )
@@ -710,7 +711,7 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
}
else if (m_output_type == RC_LOWPASS)
{
- double rTot = m_voltab[m_out_raw];
+ double rTot = m_voltab[m_output];
double V0 = rTot / (rTot+m_r_pullup) * m_v_ref / 5.0 * 32767.0;
double mult = (m_cap == 0.0) ? 1.0 : 1.0 - exp(-(rTot + m_r_pullup) / (m_cap * m_r_pullup * rTot) * m_clock_period.as_double());
@@ -726,7 +727,7 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
}
else if (m_output_type == OPAMP_C_TO_GROUND)
{
- double rTot = m_voltab[m_out_raw];
+ double rTot = m_voltab[m_output];
/* In this configuration there is a capacitor in parallel to the pokey output to ground.
* With a LM324 in LTSpice this causes the opamp circuit to oscillate at around 100 kHz.
* We are ignoring the capacitor here, since this oscillation would not be audible.
@@ -748,7 +749,7 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
}
else if (m_output_type == OPAMP_LOW_PASS)
{
- double rTot = m_voltab[m_out_raw];
+ double rTot = m_voltab[m_output];
/* This post-pokey stage usually has a low-pass filter behind it
* It is approximated by not adding in VRef below.
*/
@@ -766,7 +767,7 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
}
else if (m_output_type == DISCRETE_VAR_R)
{
- int32_t out = m_voltab[m_out_raw];
+ int32_t out = m_voltab[m_output];
while( samples > 0 )
{
*buffer++ = out;
@@ -779,7 +780,7 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
// read - memory interface for reading the active status
//-------------------------------------------------
-uint8_t pokey_device::read(offs_t offset)
+READ8_MEMBER( pokey_device::read )
{
int data, pot;
@@ -875,7 +876,7 @@ uint8_t pokey_device::read(offs_t offset)
// write - memory interface for write
//-------------------------------------------------
-void pokey_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( pokey_device::write )
{
synchronize(SYNC_WRITE, (offset << 8) | data);
}
@@ -893,7 +894,6 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
case AUDC1_C:
LOG_SOUND(("POKEY '%s' AUDC1 $%02x (%s)\n", tag(), data, audc2str(data)));
m_channel[CHAN1].m_AUDC = data;
- m_old_raw_inval = true;
break;
case AUDF2_C:
@@ -904,7 +904,6 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
case AUDC2_C:
LOG_SOUND(("POKEY '%s' AUDC2 $%02x (%s)\n", tag(), data, audc2str(data)));
m_channel[CHAN2].m_AUDC = data;
- m_old_raw_inval = true;
break;
case AUDF3_C:
@@ -915,7 +914,6 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
case AUDC3_C:
LOG_SOUND(("POKEY '%s' AUDC3 $%02x (%s)\n", tag(), data, audc2str(data)));
m_channel[CHAN3].m_AUDC = data;
- m_old_raw_inval = true;
break;
case AUDF4_C:
@@ -926,7 +924,6 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
case AUDC4_C:
LOG_SOUND(("POKEY '%s' AUDC4 $%02x (%s)\n", tag(), data, audc2str(data)));
m_channel[CHAN4].m_AUDC = data;
- m_old_raw_inval = true;
break;
case AUDCTL_C:
@@ -951,7 +948,7 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
m_channel[i].m_output = 0;
m_channel[i].m_filter_sample = (i<2 ? 1 : 0);
}
- m_old_raw_inval = true;
+
break;
case SKREST_C:
@@ -1021,7 +1018,6 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
m_clock_cnt[0] = 0;
m_clock_cnt[1] = 0;
m_clock_cnt[2] = 0;
- m_old_raw_inval = true;
/* FIXME: Serial port reset ! */
}
break;
@@ -1070,7 +1066,6 @@ inline void pokey_device::process_channel(int ch)
m_channel[ch].m_output = (m_poly9[m_p9] & 1);
else
m_channel[ch].m_output = (m_poly17[m_p17] & 1);
- m_old_raw_inval = true;
}
}
diff --git a/src/devices/sound/pokey.h b/src/devices/sound/pokey.h
index 7e63e89e54d..ec1a21b3541 100644
--- a/src/devices/sound/pokey.h
+++ b/src/devices/sound/pokey.h
@@ -165,8 +165,8 @@ public:
set_interrupt_callback(int_cb_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr)));
}
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( sid_w ); // pin 24
void serin_ready(int after);
@@ -264,7 +264,7 @@ private:
static constexpr int POKEY_CHANNELS = 4;
- void step_one_clock();
+ uint32_t step_one_clock();
void step_keyboard();
void step_pot();
@@ -284,11 +284,10 @@ private:
pokey_channel m_channel[POKEY_CHANNELS];
- uint32_t m_out_raw; /* raw output */
- bool m_old_raw_inval; /* true: recalc m_out_raw required */
- double m_out_filter; /* filtered output */
+ uint32_t m_output; /* raw output */
+ double m_out_filter; /* filtered output */
- int32_t m_clock_cnt[3]; /* clock counters */
+ int32_t m_clock_cnt[3]; /* clock counters */
uint32_t m_p4; /* poly4 index */
uint32_t m_p5; /* poly5 index */
uint32_t m_p9; /* poly9 index */
diff --git a/src/devices/sound/qs1000.h b/src/devices/sound/qs1000.h
index f57b2e41d91..237ef21b8e5 100644
--- a/src/devices/sound/qs1000.h
+++ b/src/devices/sound/qs1000.h
@@ -40,7 +40,6 @@ public:
//auto serial_w() { return m_serial_w_cb.bind(); }
// external
- i8052_device &cpu() const { return *m_cpu; }
void serial_in(uint8_t data);
DECLARE_WRITE_LINE_MEMBER( set_irq );
diff --git a/src/devices/sound/rf5c68.cpp b/src/devices/sound/rf5c68.cpp
index 9ec522b7d92..2af393c884b 100644
--- a/src/devices/sound/rf5c68.cpp
+++ b/src/devices/sound/rf5c68.cpp
@@ -189,7 +189,7 @@ void rf5c68_device::sound_stream_update(sound_stream &stream, stream_sample_t **
// RF5C68 write register
//-------------------------------------------------
-u8 rf5c68_device::rf5c68_r(offs_t offset)
+READ8_MEMBER( rf5c68_device::rf5c68_r )
{
uint8_t shift;
@@ -201,7 +201,7 @@ u8 rf5c68_device::rf5c68_r(offs_t offset)
return (m_chan[(offset & 0x0e) >> 1].addr) >> (shift);
}
-void rf5c68_device::rf5c68_w(offs_t offset, u8 data)
+WRITE8_MEMBER( rf5c68_device::rf5c68_w )
{
pcm_channel &chan = m_chan[m_cbank];
int i;
@@ -266,7 +266,7 @@ void rf5c68_device::rf5c68_w(offs_t offset, u8 data)
// RF5C68 read memory
//-------------------------------------------------
-u8 rf5c68_device::rf5c68_mem_r(offs_t offset)
+READ8_MEMBER( rf5c68_device::rf5c68_mem_r )
{
return m_cache->read_byte(m_wbank | offset);
}
@@ -276,7 +276,7 @@ u8 rf5c68_device::rf5c68_mem_r(offs_t offset)
// RF5C68 write memory
//-------------------------------------------------
-void rf5c68_device::rf5c68_mem_w(offs_t offset, u8 data)
+WRITE8_MEMBER( rf5c68_device::rf5c68_mem_w )
{
m_data->write_byte(m_wbank | offset, data);
}
diff --git a/src/devices/sound/rf5c68.h b/src/devices/sound/rf5c68.h
index 262efb54286..056d2c9c99c 100644
--- a/src/devices/sound/rf5c68.h
+++ b/src/devices/sound/rf5c68.h
@@ -38,11 +38,11 @@ public:
set_end_callback(sample_end_cb_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr)));
}
- u8 rf5c68_r(offs_t offset);
- void rf5c68_w(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( rf5c68_r );
+ DECLARE_WRITE8_MEMBER( rf5c68_w );
- u8 rf5c68_mem_r(offs_t offset);
- void rf5c68_mem_w(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( rf5c68_mem_r );
+ DECLARE_WRITE8_MEMBER( rf5c68_mem_w );
protected:
rf5c68_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
diff --git a/src/devices/sound/sn76496.cpp b/src/devices/sound/sn76496.cpp
index 6765fb3393f..23b29c208e3 100644
--- a/src/devices/sound/sn76496.cpp
+++ b/src/devices/sound/sn76496.cpp
@@ -290,14 +290,14 @@ void sn76496_base_device::device_clock_changed()
m_sound->set_sample_rate(clock()/2);
}
-void sn76496_base_device::stereo_w(u8 data)
+WRITE8_MEMBER( sn76496_base_device::stereo_w )
{
m_sound->update();
if (m_stereo) m_stereo_mask = data;
else fatalerror("sn76496_base_device: Call to stereo write with mono chip!\n");
}
-void sn76496_base_device::write(u8 data)
+void sn76496_base_device::write(uint8_t data)
{
int n, r, c;
diff --git a/src/devices/sound/sn76496.h b/src/devices/sound/sn76496.h
index cd7b4a6c509..b518fa25398 100644
--- a/src/devices/sound/sn76496.h
+++ b/src/devices/sound/sn76496.h
@@ -24,8 +24,9 @@ class sn76496_base_device : public device_t, public device_sound_interface
public:
auto ready_cb() { return m_ready_handler.bind(); }
- void stereo_w(u8 data);
- void write(u8 data);
+ DECLARE_WRITE8_MEMBER( stereo_w );
+ void write(uint8_t data);
+ DECLARE_WRITE8_MEMBER( command_w ) { write(data); }
DECLARE_READ_LINE_MEMBER( ready_r ) { return m_ready_state ? 1 : 0; }
protected:
diff --git a/src/devices/sound/spkrdev.h b/src/devices/sound/spkrdev.h
index 49e953b5d40..7542d943793 100644
--- a/src/devices/sound/spkrdev.h
+++ b/src/devices/sound/spkrdev.h
@@ -21,9 +21,9 @@ public:
~speaker_sound_device() {}
// configuration
- void set_levels(int num_levels, const int16_t *levels) { m_num_levels = num_levels; m_levels = levels; }
+ void set_levels(int num_levels, const int16_t *levels) { m_num_levels = num_levels; m_levels = levels;}
- void level_w(int new_level); // can use as writeline
+ void level_w(int new_level);
protected:
// device-level overrides
diff --git a/src/devices/sound/swp30.cpp b/src/devices/sound/swp30.cpp
index f43df8084f9..56870df5ec7 100644
--- a/src/devices/sound/swp30.cpp
+++ b/src/devices/sound/swp30.cpp
@@ -150,15 +150,8 @@ 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),
- m_meg(*this, "meg")
+ device_rom_interface(mconfig, *this, 25+2, ENDIANNESS_LITTLE, 32)
{
- (void)m_map;
-}
-
-void swp30_device::device_add_mconfig(machine_config &config)
-{
- MEGEMB(config, m_meg);
}
void swp30_device::device_start()
@@ -167,7 +160,7 @@ void swp30_device::device_start()
// Attenuantion for panning is 4.4 floating point. That means 0
// to -96.3dB. Since it's a nice range, we assume it's the same
- // for other attenuation values. Computed value is 1.16
+ // for other attenuation values. Computed value is is 1.16
// format, to avoid overflow
for(int i=0; i<256; i++)
@@ -335,8 +328,8 @@ void swp30_device::map(address_map &map)
rchan(map, 0x27).rw(FUNC(swp30_device::prg_fp_r<3>), FUNC(swp30_device::prg_fp_w<3>));
rchan(map, 0x29).rw(FUNC(swp30_device::prg_fp_r<4>), FUNC(swp30_device::prg_fp_w<4>));
rchan(map, 0x2b).rw(FUNC(swp30_device::prg_fp_r<5>), FUNC(swp30_device::prg_fp_w<5>));
- rchan(map, 0x30).rw(FUNC(swp30_device::prg_off_r<0>), FUNC(swp30_device::prg_off_w<0>));
- rchan(map, 0x31).rw(FUNC(swp30_device::prg_off_r<1>), FUNC(swp30_device::prg_off_w<1>));
+ rchan(map, 0x30).rw(FUNC(swp30_device::prg_int_r<0>), FUNC(swp30_device::prg_int_w<0>));
+ rchan(map, 0x31).rw(FUNC(swp30_device::prg_int_r<1>), FUNC(swp30_device::prg_int_w<1>));
rchan(map, 0x3e).rw(FUNC(swp30_device::prg_lfo_r<0>), FUNC(swp30_device::prg_lfo_w<0>));
rchan(map, 0x3f).rw(FUNC(swp30_device::prg_lfo_r<1>), FUNC(swp30_device::prg_lfo_w<1>));
}
@@ -388,14 +381,14 @@ void swp30_device::prg_address_w(u16 data)
template<int sel> u16 swp30_device::prg_r()
{
constexpr offs_t shift = 48-16*sel;
- return m_meg->prg_r(m_program_address) >> shift;
+ return m_program[m_program_address] >> shift;
}
template<int sel> void swp30_device::prg_w(u16 data)
{
constexpr offs_t shift = 48-16*sel;
constexpr u64 mask = ~(u64(0xffff) << shift);
- m_meg->prg_w(m_program_address, (m_meg->prg_r(m_program_address) & mask) | (u64(data) << shift));
+ m_program[m_program_address] = (m_program[m_program_address] & mask) | (u64(data) << shift);
if(sel == 3) {
if(0)
@@ -409,12 +402,14 @@ template<int sel> void swp30_device::prg_w(u16 data)
template<int sel> u16 swp30_device::map_r()
{
- return m_meg->map_r(sel);
+ return m_map[sel];
}
template<int sel> void swp30_device::map_w(u16 data)
{
- m_meg->map_w(sel, data);
+ m_map[sel] = data;
+ if(0)
+ logerror("map %d: type=%02x offset=%05x size=%05x\n", sel, data >> 11, (data & 0xff) << 10, 0x400 << ((data >> 8) & 7));
}
@@ -661,36 +656,54 @@ void swp30_device::address_l_w(offs_t offset, u16 data)
}
-// MEG registers forwarding
+// MEG registers (Multiple Effects Generator)
template<int sel> u16 swp30_device::prg_fp_r(offs_t offset)
{
- return m_meg->fp_r((offset >> 6)*6 + sel);
+ offs_t adr = (offset >> 6)*6 + sel;
+ return m_program_pfp[adr];
}
template<int sel> void swp30_device::prg_fp_w(offs_t offset, u16 data)
{
- m_meg->fp_w((offset >> 6)*6 + sel, data);
+ offs_t adr = (offset >> 6)*6 + sel;
+ m_program_pfp[adr] = data;
+ if(0)
+ logerror("prg_fp_w %03x, %04x\n", adr, data);
}
-template<int sel> u16 swp30_device::prg_off_r(offs_t offset)
+template<int sel> u16 swp30_device::prg_int_r(offs_t offset)
{
- return m_meg->offset_r((offset >> 6)*2 + sel);
+ offs_t adr = (offset >> 6)*2 + sel;
+ return m_program_pint[adr];
}
-template<int sel> void swp30_device::prg_off_w(offs_t offset, u16 data)
+template<int sel> void swp30_device::prg_int_w(offs_t offset, u16 data)
{
- m_meg->offset_w((offset >> 6)*2 + sel, data);
+ offs_t adr = (offset >> 6)*2 + sel;
+ m_program_pint[adr] = data;
+ if(0)
+ logerror("prg_int_w %02x, %04x\n", adr, data);
}
template<int sel> u16 swp30_device::prg_lfo_r(offs_t offset)
{
- return m_meg->lfo_r((offset >> 6)*2 + sel);
+ offs_t adr = (offset >> 6)*2 + sel;
+ return m_program_plfo[adr];
}
template<int sel> void swp30_device::prg_lfo_w(offs_t offset, u16 data)
{
- m_meg->lfo_w((offset >> 6)*2 + sel, data);
+ offs_t adr = (offset >> 6)*2 + sel;
+ m_program_plfo[adr] = data;
+
+ static const int dt[8] = { 0, 32, 64, 128, 256, 512, 1024, 2048 };
+ static const int sh[8] = { 0, 0, 1, 2, 3, 4, 5, 6 };
+
+ int scale = (data >> 5) & 7;
+ int step = ((data & 31) << sh[scale]) + dt[scale];
+ if(0)
+ logerror("prg_lfo_w %02x freq=%5.2f phase=%6.4f\n", adr, step * 44100.0/4194304, (data >> 8)/256.0);
}
diff --git a/src/devices/sound/swp30.h b/src/devices/sound/swp30.h
index dd95a8dd85f..56e24b453f0 100644
--- a/src/devices/sound/swp30.h
+++ b/src/devices/sound/swp30.h
@@ -8,8 +8,6 @@
#pragma once
-#include "meg.h"
-
class swp30_device : public device_t, public device_sound_interface, public device_rom_interface
{
public:
@@ -22,11 +20,8 @@ protected:
virtual void device_reset() override;
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
virtual void rom_bank_updated() override;
- virtual void device_add_mconfig(machine_config &config) override;
private:
- required_device<meg_embedded_device> m_meg;
-
sound_stream *m_stream;
s32 m_sample_increment[0x4000];
@@ -104,8 +99,8 @@ private:
// MEG registers
template<int sel> u16 prg_fp_r(offs_t offset);
template<int sel> void prg_fp_w(offs_t offset, u16 data);
- template<int sel> u16 prg_off_r(offs_t offset);
- template<int sel> void prg_off_w(offs_t offset, u16 data);
+ template<int sel> u16 prg_int_r(offs_t offset);
+ template<int sel> void prg_int_w(offs_t offset, u16 data);
template<int sel> u16 prg_lfo_r(offs_t offset);
template<int sel> void prg_lfo_w(offs_t offset, u16 data);
diff --git a/src/devices/sound/t6721a.cpp b/src/devices/sound/t6721a.cpp
index 423cd3edc19..f4ea65a92b5 100644
--- a/src/devices/sound/t6721a.cpp
+++ b/src/devices/sound/t6721a.cpp
@@ -74,7 +74,7 @@ void t6721a_device::sound_stream_update(sound_stream &stream, stream_sample_t **
// read -
//-------------------------------------------------
-uint8_t t6721a_device::read()
+READ8_MEMBER( t6721a_device::read )
{
return 0;
}
@@ -84,7 +84,7 @@ uint8_t t6721a_device::read()
// write -
//-------------------------------------------------
-void t6721a_device::write(uint8_t data)
+WRITE8_MEMBER( t6721a_device::write )
{
}
diff --git a/src/devices/sound/t6721a.h b/src/devices/sound/t6721a.h
index ebc7ea6924e..0342cbaad84 100644
--- a/src/devices/sound/t6721a.h
+++ b/src/devices/sound/t6721a.h
@@ -53,8 +53,8 @@ public:
auto dtrd_handler() { return m_write_dtrd.bind(); }
auto apd_handler() { return m_write_apd.bind(); }
- uint8_t read();
- void write(uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( di_w );
diff --git a/src/devices/sound/t6w28.cpp b/src/devices/sound/t6w28.cpp
index cc7324d41f1..2f155644c5c 100644
--- a/src/devices/sound/t6w28.cpp
+++ b/src/devices/sound/t6w28.cpp
@@ -39,7 +39,7 @@ Offset 0:
#define STEP 0x10000
-void t6w28_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( t6w28_device::write )
{
int n, r, c;
diff --git a/src/devices/sound/t6w28.h b/src/devices/sound/t6w28.h
index e6cc2d9319d..e62852e77b6 100644
--- a/src/devices/sound/t6w28.h
+++ b/src/devices/sound/t6w28.h
@@ -10,8 +10,8 @@ class t6w28_device : public device_t, public device_sound_interface
public:
t6w28_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void write(offs_t offset, uint8_t data);
- void set_enable(bool enable);
+ DECLARE_WRITE8_MEMBER( write );
+ void set_enable( bool enable );
protected:
// device-level overrides
diff --git a/src/devices/sound/upd7752.cpp b/src/devices/sound/upd7752.cpp
index e2e28317d4c..f49171588e7 100644
--- a/src/devices/sound/upd7752.cpp
+++ b/src/devices/sound/upd7752.cpp
@@ -31,8 +31,8 @@ DEFINE_DEVICE_TYPE(UPD7752, upd7752_device, "upd7752", "NEC uPD7752")
/* TODO: unknown exact size */
void upd7752_device::upd7752_ram(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, 0xffff).ram();
+// AM_RANGE(0x0000, 0x7fff) AM_ROM
+ map(0x0000, 0xffff).ram();
}
//**************************************************************************
@@ -47,7 +47,7 @@ upd7752_device::upd7752_device(const machine_config &mconfig, const char *tag, d
: device_t(mconfig, UPD7752, tag, owner, clock),
device_sound_interface(mconfig, *this),
device_memory_interface(mconfig, *this), m_stream(nullptr),
- m_space_config("ram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(upd7752_device::upd7752_ram), this)), m_status(0), m_ram_addr(0), m_mode(0)
+ m_space_config("ram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(), address_map_constructor(FUNC(upd7752_device::upd7752_ram), this)), m_status(0), m_ram_addr(0), m_mode(0)
{
}
diff --git a/src/devices/sound/vlm5030.cpp b/src/devices/sound/vlm5030.cpp
index f58540558d4..9bdbd807876 100644
--- a/src/devices/sound/vlm5030.cpp
+++ b/src/devices/sound/vlm5030.cpp
@@ -397,9 +397,9 @@ READ_LINE_MEMBER( vlm5030_device::bsy )
}
/* latch contoll data */
-void vlm5030_device::data_w(uint8_t data)
+WRITE8_MEMBER( vlm5030_device::data_w )
{
- m_latch_data = data;
+ m_latch_data = (uint8_t)data;
}
/* set RST pin level : reset / set table address A8-A15 */
diff --git a/src/devices/sound/vlm5030.h b/src/devices/sound/vlm5030.h
index adbd9173c2b..af5f6dbc75b 100644
--- a/src/devices/sound/vlm5030.h
+++ b/src/devices/sound/vlm5030.h
@@ -14,7 +14,7 @@ public:
DECLARE_READ_LINE_MEMBER( bsy );
/* latch contoll data */
- void data_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( data_w );
/* set RST pin level : reset / set table address A8-A15 */
DECLARE_WRITE_LINE_MEMBER( rst );
diff --git a/src/devices/sound/volt_reg.cpp b/src/devices/sound/volt_reg.cpp
index aade7ddff01..12f3ed31130 100644
--- a/src/devices/sound/volt_reg.cpp
+++ b/src/devices/sound/volt_reg.cpp
@@ -23,7 +23,7 @@ voltage_regulator_device::voltage_regulator_device(const machine_config &mconfig
device_t(mconfig, VOLTAGE_REGULATOR, tag, owner, clock),
device_sound_interface(mconfig, *this),
m_stream(nullptr),
- m_output(0x7fff)
+ m_output(0)
{
}
diff --git a/src/devices/sound/volt_reg.h b/src/devices/sound/volt_reg.h
index 516039aac17..f2e5d88298e 100644
--- a/src/devices/sound/volt_reg.h
+++ b/src/devices/sound/volt_reg.h
@@ -14,10 +14,13 @@
#pragma once
+#define MCFG_VOLTAGE_REGULATOR_OUTPUT(_output) \
+ downcast<voltage_regulator_device &>(*device).set_output(_output);
+
class voltage_regulator_device : public device_t, public device_sound_interface
{
public:
- voltage_regulator_device &set_output(double analogue_dc) { m_output = (analogue_dc * 0x7fff) / 5.0f; return *this; }
+ voltage_regulator_device &set_output(double analogue_dc) { m_output = (analogue_dc * 32768) / 5.0f; return *this; }
voltage_regulator_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
diff --git a/src/devices/sound/votrax.cpp b/src/devices/sound/votrax.cpp
index 720df7d2ca9..d2741b0a7dc 100644
--- a/src/devices/sound/votrax.cpp
+++ b/src/devices/sound/votrax.cpp
@@ -84,7 +84,7 @@ votrax_sc01_device::votrax_sc01_device(const machine_config &mconfig, const char
{
}
-void votrax_sc01_device::write(uint8_t data)
+WRITE8_MEMBER( votrax_sc01_device::write )
{
// flush out anything currently processing
m_stream->update();
@@ -114,7 +114,7 @@ void votrax_sc01_device::write(uint8_t data)
// inflection bits
//-------------------------------------------------
-void votrax_sc01_device::inflection_w(uint8_t data)
+WRITE8_MEMBER( votrax_sc01_device::inflection_w )
{
// only 2 bits matter
data &= 3;
diff --git a/src/devices/sound/votrax.h b/src/devices/sound/votrax.h
index aa3b88cc7e3..a7122c561af 100644
--- a/src/devices/sound/votrax.h
+++ b/src/devices/sound/votrax.h
@@ -24,8 +24,8 @@ public:
auto ar_callback() { return m_ar_cb.bind(); }
- void write(uint8_t data);
- void inflection_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER(write);
+ DECLARE_WRITE8_MEMBER(inflection_w);
DECLARE_READ_LINE_MEMBER(request) { m_stream->update(); return m_ar_state; }
protected:
diff --git a/src/devices/sound/vrc6.cpp b/src/devices/sound/vrc6.cpp
index e990a0edd69..e632cce1cdb 100644
--- a/src/devices/sound/vrc6.cpp
+++ b/src/devices/sound/vrc6.cpp
@@ -2,7 +2,7 @@
// copyright-holders:R. Belmont
/***************************************************************************
- vrc6.cpp
+ vrc6.c
Konami VRC6 additional sound channels
Emulation by R. Belmont
@@ -218,7 +218,7 @@ void vrc6snd_device::sound_stream_update(sound_stream &stream, stream_sample_t *
// write - write to the chip's registers
//---------------------------------------
-void vrc6snd_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( vrc6snd_device::write )
{
switch (offset >> 8)
{
diff --git a/src/devices/sound/vrc6.h b/src/devices/sound/vrc6.h
index a24d34a90c4..dbcd5152c3b 100644
--- a/src/devices/sound/vrc6.h
+++ b/src/devices/sound/vrc6.h
@@ -24,7 +24,7 @@ public:
// construction/destruction
vrc6snd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void write(offs_t offset, uint8_t data);
+ DECLARE_WRITE8_MEMBER(write);
protected:
// device-level overrides
diff --git a/src/devices/sound/ym2151.cpp b/src/devices/sound/ym2151.cpp
index 42c105c64a0..4f3a95acdb8 100644
--- a/src/devices/sound/ym2151.cpp
+++ b/src/devices/sound/ym2151.cpp
@@ -1676,7 +1676,7 @@ ym2151_device::ym2151_device(const machine_config &mconfig, const char *tag, dev
// read - read from the device
//-------------------------------------------------
-u8 ym2151_device::read(offs_t offset)
+READ8_MEMBER( ym2151_device::read )
{
if (offset & 1)
{
@@ -1692,7 +1692,7 @@ u8 ym2151_device::read(offs_t offset)
// write - write from the device
//-------------------------------------------------
-void ym2151_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( ym2151_device::write )
{
if (offset & 1)
{
@@ -1707,19 +1707,19 @@ void ym2151_device::write(offs_t offset, u8 data)
}
-u8 ym2151_device::status_r()
+READ8_MEMBER( ym2151_device::status_r )
{
- return read(1);
+ return read(space, 1);
}
-void ym2151_device::register_w(u8 data)
+WRITE8_MEMBER( ym2151_device::register_w )
{
- write(0, data);
+ write(space, 0, data);
}
-void ym2151_device::data_w(u8 data)
+WRITE8_MEMBER( ym2151_device::data_w )
{
- write(1, data);
+ write(space, 1, data);
}
diff --git a/src/devices/sound/ym2151.h b/src/devices/sound/ym2151.h
index 562c6bb10a2..e797a88724b 100644
--- a/src/devices/sound/ym2151.h
+++ b/src/devices/sound/ym2151.h
@@ -55,12 +55,12 @@ public:
auto port_write_handler() { return m_portwritehandler.bind(); }
// read/write
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
- u8 status_r();
- void register_w(u8 data);
- void data_w(u8 data);
+ DECLARE_READ8_MEMBER(status_r);
+ DECLARE_WRITE8_MEMBER(register_w);
+ DECLARE_WRITE8_MEMBER(data_w);
DECLARE_WRITE_LINE_MEMBER(reset_w);
diff --git a/src/devices/sound/ym2413.cpp b/src/devices/sound/ym2413.cpp
index 755e66ea629..69ad6b31e33 100644
--- a/src/devices/sound/ym2413.cpp
+++ b/src/devices/sound/ym2413.cpp
@@ -42,8 +42,6 @@ to do:
#include "emu.h"
#include "ym2413.h"
-#include <algorithm>
-
#define FREQ_SH 16 /* 16.16 fixed point (frequency calculations) */
#define EG_SH 16 /* 16.16 fixed point (EG timing) */
#define LFO_SH 24 /* 8.24 fixed point (LFO calculations) */
@@ -133,7 +131,7 @@ const uint32_t ym2413_device::sl_tab[16] = {
};
#undef SC
-const uint8_t ym2413_device::eg_inc[15*RATE_STEPS] = {
+const unsigned char ym2413_device::eg_inc[15*RATE_STEPS] = {
/*cycle:0 1 2 3 4 5 6 7*/
/* 0 */ 0,1, 0,1, 0,1, 0,1, /* rates 00..12 0 (increment by 0 or 1) */
@@ -160,7 +158,7 @@ const uint8_t ym2413_device::eg_inc[15*RATE_STEPS] = {
#define O(a) (a*RATE_STEPS)
/*note that there is no O(13) in this table - it's directly in the code */
-const uint8_t ym2413_device::eg_rate_select[16+64+16] = { /* Envelope Generator rates (16 + 64 rates + 16 RKS) */
+const unsigned char ym2413_device::eg_rate_select[16+64+16] = { /* Envelope Generator rates (16 + 64 rates + 16 RKS) */
/* 16 infinite time rates */
O(14),O(14),O(14),O(14),O(14),O(14),O(14),O(14),
O(14),O(14),O(14),O(14),O(14),O(14),O(14),O(14),
@@ -201,7 +199,7 @@ const uint8_t ym2413_device::eg_rate_select[16+64+16] = { /* Envelope Generato
/*mask 8191, 4095, 2047, 1023, 511, 255, 127, 63, 31, 15, 7, 3, 1, 0, 0, 0 */
#define O(a) (a*1)
-const uint8_t ym2413_device::eg_rate_shift[16+64+16] = { /* Envelope Generator counter shifts (16 + 64 rates + 16 RKS) */
+const unsigned char ym2413_device::eg_rate_shift[16+64+16] = { /* Envelope Generator counter shifts (16 + 64 rates + 16 RKS) */
/* 16 infinite time rates */
O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0),
O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0),
@@ -352,10 +350,9 @@ const int8_t ym2413_device::lfo_pm_table[8*8] = {
- waveform DC and DM select are 100% correct
*/
-const uint8_t ym2413_device::table[19][8] = {
+const unsigned char ym2413_device::table[19][8] = {
/* MULT MULT modTL DcDmFb AR/DR AR/DR SL/RR SL/RR */
/* 0 1 2 3 4 5 6 7 */
-/* These YM2413(OPLL) patch dumps are done via audio analysis (and a/b testing?) from Jarek and are known to be inaccurate */
{0x49, 0x4c, 0x4c, 0x12, 0x00, 0x00, 0x00, 0x00 }, //0
{0x61, 0x61, 0x1e, 0x17, 0xf0, 0x78, 0x00, 0x17 }, //1
@@ -388,45 +385,9 @@ const uint8_t ym2413_device::table[19][8] = {
/* drum instruments definitions */
/* MULTI MULTI modTL xxx AR/DR AR/DR SL/RR SL/RR */
/* 0 1 2 3 4 5 6 7 */
-/* old dumps via audio analysis (and a/b testing?) from Jarek */
-//{0x01, 0x01, 0x16, 0x00, 0xfd, 0xf8, 0x2f, 0x6d },/* BD(multi verified, modTL verified, mod env - verified(close), carr. env verifed) */
-//{0x01, 0x01, 0x00, 0x00, 0xd8, 0xd8, 0xf9, 0xf8 },/* HH(multi verified), SD(multi not used) */
-//{0x05, 0x01, 0x00, 0x00, 0xf8, 0xba, 0x49, 0x55 },/* TOM(multi,env verified), TOP CYM(multi verified, env verified) */
-/* Drums dumped from the VRC7 using debug mode, these are likely also correct for ym2413(OPLL) but need verification */
- {0x01, 0x01, 0x18, 0x0f, 0xdf, 0xf8, 0x6a, 0x6d },/* BD */
- {0x01, 0x01, 0x00, 0x00, 0xc8, 0xd8, 0xa7, 0x68 },/* HH, SD */
- {0x05, 0x01, 0x00, 0x00, 0xf8, 0xaa, 0x59, 0x55 },/* TOM, TOP CYM */
-};
-
-// VRC7 Instruments : Dumped from internal ROM
-// reference : https://siliconpr0n.org/archive/doku.php?id=vendor:yamaha:opl2
-const uint8_t vrc7snd_device::vrc7_table[19][8] = {
-/* MULT MULT modTL DcDmFb AR/DR AR/DR SL/RR SL/RR */
-/* 0 1 2 3 4 5 6 7 */
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, //0 (This is the user-defined instrument, should this default to anything?)
-
- {0x03, 0x21, 0x05, 0x06, 0xe8, 0x81, 0x42, 0x27 }, //1
- {0x13, 0x41, 0x14, 0x0d, 0xd8, 0xf6, 0x23, 0x12 }, //2
- {0x11, 0x11, 0x08, 0x08, 0xfa, 0xb2, 0x20, 0x12 }, //3
- {0x31, 0x61, 0x0c, 0x07, 0xa8, 0x64, 0x61, 0x27 }, //4
- {0x32, 0x21, 0x1e, 0x06, 0xe1, 0x76, 0x01, 0x28 }, //5
- {0x02, 0x01, 0x06, 0x00, 0xa3, 0xe2, 0xf4, 0xf4 }, //6
- {0x21, 0x61, 0x1d, 0x07, 0x82, 0x81, 0x11, 0x07 }, //7
- {0x23, 0x21, 0x22, 0x17, 0xa2, 0x72, 0x01, 0x17 }, //8
- {0x35, 0x11, 0x25, 0x00, 0x40, 0x73, 0x72, 0x01 }, //9
- {0xb5, 0x01, 0x0f, 0x0f, 0xa8, 0xa5, 0x51, 0x02 }, //A
- {0x17, 0xc1, 0x24, 0x07, 0xf8, 0xf8, 0x22, 0x12 }, //B
- {0x71, 0x23, 0x11, 0x06, 0x65, 0x74, 0x18, 0x16 }, //C
- {0x01, 0x02, 0xd3, 0x05, 0xc9, 0x95, 0x03, 0x02 }, //D
- {0x61, 0x63, 0x0c, 0x00, 0x94, 0xc0, 0x33, 0xf6 }, //E
- {0x21, 0x72, 0x0d, 0x00, 0xc1, 0xd5, 0x56, 0x06 }, //F
-
-/* Drums (silent due to no RO output pin(?) on VRC7, but present internally; these are probably shared with YM2413) */
-/* MULTI MULTI modTL xxx AR/DR AR/DR SL/RR SL/RR */
-/* 0 1 2 3 4 5 6 7 */
- {0x01, 0x01, 0x18, 0x0f, 0xdf, 0xf8, 0x6a, 0x6d },/* BD */
- {0x01, 0x01, 0x00, 0x00, 0xc8, 0xd8, 0xa7, 0x68 },/* HH, SD */
- {0x05, 0x01, 0x00, 0x00, 0xf8, 0xaa, 0x59, 0x55 },/* TOM, TOP CYM */
+ {0x01, 0x01, 0x16, 0x00, 0xfd, 0xf8, 0x2f, 0x6d },/* BD(multi verified, modTL verified, mod env - verified(close), carr. env verifed) */
+ {0x01, 0x01, 0x00, 0x00, 0xd8, 0xd8, 0xf9, 0xf8 },/* HH(multi verified), SD(multi not used) */
+ {0x05, 0x01, 0x00, 0x00, 0xf8, 0xba, 0x49, 0x55 },/* TOM(multi,env verified), TOP CYM(multi verified, env verified) */
};
/* work table */
@@ -862,21 +823,21 @@ void ym2413_device::rhythm_calc( OPLL_CH *CH, unsigned int noise )
*/
/* base frequency derived from operator 1 in channel 7 */
- uint8_t bit7 = ((SLOT7_1->phase>>FREQ_SH)>>7)&1;
- uint8_t bit3 = ((SLOT7_1->phase>>FREQ_SH)>>3)&1;
- uint8_t bit2 = ((SLOT7_1->phase>>FREQ_SH)>>2)&1;
+ unsigned char bit7 = ((SLOT7_1->phase>>FREQ_SH)>>7)&1;
+ unsigned char bit3 = ((SLOT7_1->phase>>FREQ_SH)>>3)&1;
+ unsigned char bit2 = ((SLOT7_1->phase>>FREQ_SH)>>2)&1;
- uint8_t res1 = (bit2 ^ bit7) | bit3;
+ unsigned char res1 = (bit2 ^ bit7) | bit3;
/* when res1 = 0 phase = 0x000 | 0xd0; */
/* when res1 = 1 phase = 0x200 | (0xd0>>2); */
uint32_t phase = res1 ? (0x200|(0xd0>>2)) : 0xd0;
/* enable gate based on frequency of operator 2 in channel 8 */
- uint8_t bit5e= ((SLOT8_2->phase>>FREQ_SH)>>5)&1;
- uint8_t bit3e= ((SLOT8_2->phase>>FREQ_SH)>>3)&1;
+ unsigned char bit5e= ((SLOT8_2->phase>>FREQ_SH)>>5)&1;
+ unsigned char bit3e= ((SLOT8_2->phase>>FREQ_SH)>>3)&1;
- uint8_t res2 = (bit3e | bit5e);
+ unsigned char res2 = (bit3e | bit5e);
/* when res2 = 0 pass the phase from calculation above (res1); */
/* when res2 = 1 phase = 0x200 | (0xd0>>2); */
@@ -907,7 +868,7 @@ void ym2413_device::rhythm_calc( OPLL_CH *CH, unsigned int noise )
if( env < ENV_QUIET )
{
/* base frequency derived from operator 1 in channel 7 */
- uint8_t bit8 = ((SLOT7_1->phase>>FREQ_SH)>>8)&1;
+ unsigned char bit8 = ((SLOT7_1->phase>>FREQ_SH)>>8)&1;
/* when bit8 = 0 phase = 0x100; */
/* when bit8 = 1 phase = 0x200; */
@@ -933,21 +894,21 @@ void ym2413_device::rhythm_calc( OPLL_CH *CH, unsigned int noise )
if( env < ENV_QUIET )
{
/* base frequency derived from operator 1 in channel 7 */
- uint8_t bit7 = ((SLOT7_1->phase>>FREQ_SH)>>7)&1;
- uint8_t bit3 = ((SLOT7_1->phase>>FREQ_SH)>>3)&1;
- uint8_t bit2 = ((SLOT7_1->phase>>FREQ_SH)>>2)&1;
+ unsigned char bit7 = ((SLOT7_1->phase>>FREQ_SH)>>7)&1;
+ unsigned char bit3 = ((SLOT7_1->phase>>FREQ_SH)>>3)&1;
+ unsigned char bit2 = ((SLOT7_1->phase>>FREQ_SH)>>2)&1;
- uint8_t res1 = (bit2 ^ bit7) | bit3;
+ unsigned char res1 = (bit2 ^ bit7) | bit3;
/* when res1 = 0 phase = 0x000 | 0x100; */
/* when res1 = 1 phase = 0x200 | 0x100; */
uint32_t phase = res1 ? 0x300 : 0x100;
/* enable gate based on frequency of operator 2 in channel 8 */
- uint8_t bit5e= ((SLOT8_2->phase>>FREQ_SH)>>5)&1;
- uint8_t bit3e= ((SLOT8_2->phase>>FREQ_SH)>>3)&1;
+ unsigned char bit5e= ((SLOT8_2->phase>>FREQ_SH)>>5)&1;
+ unsigned char bit3e= ((SLOT8_2->phase>>FREQ_SH)>>3)&1;
- uint8_t res2 = (bit3e | bit5e);
+ unsigned char res2 = (bit3e | bit5e);
/* when res2 = 0 pass the phase from calculation above (res1); */
/* when res2 = 1 phase = 0x200 | 0x100; */
if (res2)
@@ -1674,14 +1635,11 @@ void ym2413_device::device_reset()
noise_rng = 1; /* noise shift register */
/* setup instruments table */
- if (m_inst_table != nullptr)
+ for (int i=0; i<19; i++)
{
- for (int i=0; i<19; i++)
+ for (int c=0; c<8; c++)
{
- for (int c=0; c<8; c++)
- {
- inst_tab[i][c] = m_inst_table[i][c];
- }
+ inst_tab[i][c] = table[i][c];
}
}
@@ -1706,20 +1664,20 @@ void ym2413_device::device_reset()
}
-void ym2413_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( ym2413_device::write )
{
if (offset)
- data_port_w(data);
+ data_port_w(space, offset, data);
else
- register_port_w(data);
+ register_port_w(space, offset, data);
}
-void ym2413_device::register_port_w(u8 data)
+WRITE8_MEMBER( ym2413_device::register_port_w )
{
address = data;
}
-void ym2413_device::data_port_w(u8 data)
+WRITE8_MEMBER( ym2413_device::data_port_w )
{
m_stream->update();
write_reg(address, data);
@@ -1728,37 +1686,7 @@ void ym2413_device::data_port_w(u8 data)
DEFINE_DEVICE_TYPE(YM2413, ym2413_device, "ym2413", "Yamaha YM2413 OPLL")
ym2413_device::ym2413_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ym2413_device(mconfig, YM2413, tag, owner, clock)
-{
- for (int i = 0; i < 19; i++)
- {
- for (int c = 0; c < 8; c++)
- {
- m_inst_table[i][c] = table[i][c];
- }
- }
-}
-
-ym2413_device::ym2413_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_t(mconfig, YM2413, tag, owner, clock)
, device_sound_interface(mconfig, *this)
{
- for (int i = 0; i < 19; i++)
- {
- std::fill_n(&m_inst_table[i][0], 8, 0);
- }
-}
-
-DEFINE_DEVICE_TYPE(VRC7, vrc7snd_device, "vrc7snd", "Konami VRC7 (Sound)")
-
-vrc7snd_device::vrc7snd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ym2413_device(mconfig, VRC7, tag, owner, clock)
-{
- for (int i = 0; i < 19; i++)
- {
- for (int c = 0; c < 8; c++)
- {
- m_inst_table[i][c] = vrc7_table[i][c];
- }
- }
}
diff --git a/src/devices/sound/ym2413.h b/src/devices/sound/ym2413.h
index 1b0d9869770..8f496645ee9 100644
--- a/src/devices/sound/ym2413.h
+++ b/src/devices/sound/ym2413.h
@@ -11,14 +11,12 @@ class ym2413_device : public device_t, public device_sound_interface
public:
ym2413_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void write(offs_t offset, u8 data);
+ DECLARE_WRITE8_MEMBER( write );
- void register_port_w(u8 data);
- void data_port_w(u8 data);
+ DECLARE_WRITE8_MEMBER( register_port_w );
+ DECLARE_WRITE8_MEMBER( data_port_w );
protected:
- ym2413_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-
// device-level overrides
virtual void device_start() override;
virtual void device_clock_changed() override;
@@ -27,8 +25,6 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
- uint8_t m_inst_table[19][8];
-
private:
struct OPLL_SLOT
{
@@ -110,13 +106,13 @@ private:
static const double ksl_tab[8*16];
static const uint32_t ksl_shift[4];
static const uint32_t sl_tab[16];
- static const uint8_t eg_inc[15*RATE_STEPS];
- static const uint8_t eg_rate_select[16+64+16];
- static const uint8_t eg_rate_shift[16+64+16];
+ static const unsigned char eg_inc[15*RATE_STEPS];
+ static const unsigned char eg_rate_select[16+64+16];
+ static const unsigned char eg_rate_shift[16+64+16];
static const uint8_t mul_tab[16];
static const uint8_t lfo_am_table[LFO_AM_TAB_ELEMENTS];
static const int8_t lfo_pm_table[8*8];
- static const uint8_t table[19][8];
+ static const unsigned char table[19][8];
int tl_tab[TL_TAB_LEN];
@@ -189,15 +185,4 @@ private:
DECLARE_DEVICE_TYPE(YM2413, ym2413_device)
-class vrc7snd_device : public ym2413_device
-{
-public:
- vrc7snd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-private:
- static const uint8_t vrc7_table[19][8];
-};
-
-DECLARE_DEVICE_TYPE(VRC7, vrc7snd_device)
-
#endif // MAME_SOUND_YM2413_H
diff --git a/src/devices/sound/ymf271.cpp b/src/devices/sound/ymf271.cpp
index c979ea7426e..70f466b0667 100644
--- a/src/devices/sound/ymf271.cpp
+++ b/src/devices/sound/ymf271.cpp
@@ -1457,7 +1457,7 @@ void ymf271_device::ymf271_write_timer(uint8_t address, uint8_t data)
}
}
-void ymf271_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( ymf271_device::write )
{
m_stream->update();
@@ -1503,7 +1503,7 @@ void ymf271_device::write(offs_t offset, u8 data)
}
}
-u8 ymf271_device::read(offs_t offset)
+READ8_MEMBER( ymf271_device::read )
{
switch (offset & 0xf)
{
diff --git a/src/devices/sound/ymf271.h b/src/devices/sound/ymf271.h
index efee18db0ad..2022096bce3 100644
--- a/src/devices/sound/ymf271.h
+++ b/src/devices/sound/ymf271.h
@@ -16,8 +16,8 @@ public:
// configuration helpers
auto irq_handler() { return m_irq_handler.bind(); }
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
protected:
// device-level overrides
diff --git a/src/devices/sound/ymf278b.cpp b/src/devices/sound/ymf278b.cpp
index c25b519ae4e..18451d71732 100644
--- a/src/devices/sound/ymf278b.cpp
+++ b/src/devices/sound/ymf278b.cpp
@@ -673,7 +673,7 @@ void ymf278b_device::timer_busy_start(int is_pcm)
m_timer_busy->adjust(attotime::from_hz(m_clock / (is_pcm ? 88 : 56)));
}
-void ymf278b_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( ymf278b_device::write )
{
switch (offset)
{
@@ -717,7 +717,7 @@ void ymf278b_device::write(offs_t offset, u8 data)
}
-u8 ymf278b_device::read(offs_t offset)
+READ8_MEMBER( ymf278b_device::read )
{
uint8_t ret = 0;
diff --git a/src/devices/sound/ymf278b.h b/src/devices/sound/ymf278b.h
index 480397c1d0c..6db01f9b096 100644
--- a/src/devices/sound/ymf278b.h
+++ b/src/devices/sound/ymf278b.h
@@ -16,8 +16,8 @@ public:
// configuration helpers
auto irq_handler() { return m_irq_handler.bind(); }
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
protected:
// device-level overrides
diff --git a/src/devices/sound/ymz280b.cpp b/src/devices/sound/ymz280b.cpp
index 1ab3cd9b6a9..ce2754e97fa 100644
--- a/src/devices/sound/ymz280b.cpp
+++ b/src/devices/sound/ymz280b.cpp
@@ -890,7 +890,7 @@ int ymz280b_device::compute_status()
***********************************************************************************************/
-u8 ymz280b_device::read(offs_t offset)
+READ8_MEMBER( ymz280b_device::read )
{
if ((offset & 1) == 0)
{
@@ -908,7 +908,7 @@ u8 ymz280b_device::read(offs_t offset)
}
-void ymz280b_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( ymz280b_device::write )
{
if ((offset & 1) == 0)
m_current_register = data;
diff --git a/src/devices/sound/ymz280b.h b/src/devices/sound/ymz280b.h
index 0a8ada2ae5b..62c80b23ec9 100644
--- a/src/devices/sound/ymz280b.h
+++ b/src/devices/sound/ymz280b.h
@@ -23,8 +23,8 @@ public:
// configuration helpers
auto irq_handler() { return m_irq_handler.bind(); }
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
protected:
// device-level overrides
diff --git a/src/devices/video/315_5124.cpp b/src/devices/video/315_5124.cpp
index 90b94577376..ef3b07d1f4f 100644
--- a/src/devices/video/315_5124.cpp
+++ b/src/devices/video/315_5124.cpp
@@ -88,12 +88,12 @@ PAL frame timing
#define BOTTOM_BORDER 4
#define BOTTOM_BLANKING 5
-static constexpr u8 ntsc_192[6] = { 3, 13, 27, 192, 24, 3 };
-static constexpr u8 ntsc_224[6] = { 3, 13, 11, 224, 8, 3 };
-static constexpr u8 ntsc_240[6] = { 3, 13, 3, 240, 0, 3 };
-static constexpr u8 pal_192[6] = { 3, 13, 54, 192, 48, 3 };
-static constexpr u8 pal_224[6] = { 3, 13, 38, 224, 32, 3 };
-static constexpr u8 pal_240[6] = { 3, 13, 30, 240, 24, 3 };
+static constexpr uint8_t ntsc_192[6] = { 3, 13, 27, 192, 24, 3 };
+static constexpr uint8_t ntsc_224[6] = { 3, 13, 11, 224, 8, 3 };
+static constexpr uint8_t ntsc_240[6] = { 3, 13, 3, 240, 0, 3 };
+static constexpr uint8_t pal_192[6] = { 3, 13, 54, 192, 48, 3 };
+static constexpr uint8_t pal_224[6] = { 3, 13, 38, 224, 32, 3 };
+static constexpr uint8_t pal_240[6] = { 3, 13, 30, 240, 24, 3 };
#define VINT_HPOS 0
#define VINT_FLAG_HPOS 1
@@ -104,8 +104,8 @@ static constexpr u8 pal_240[6] = { 3, 13, 30, 240, 24, 3 };
#define SPROVR_HPOS 6
#define SPRCOL_BASEHPOS 7
-static constexpr u8 line_315_5124[8] = { 24, 24, 26, 28 /* not verified */, 21, 23, 24, 59 };
-static constexpr u8 line_315_5377[8] = { 26, 26, 27, 28 /* not verified */, 24, 28, 26, 62 };
+static constexpr uint8_t line_315_5124[8] = { 24, 24, 26, 28 /* not verified */, 21, 23, 24, 59 };
+static constexpr uint8_t line_315_5377[8] = { 26, 26, 27, 28 /* not verified */, 24, 28, 26, 62 };
#define DISPLAY_DISABLED_HPOS 24 /* not verified, works if above 18 (for 'pstrike2') and below 25 (for 'fantdizzy') */
#define DISPLAY_CB_HPOS 2 /* fixes 'roadrash' (SMS game) title scrolling, due to line counter reload timing */
@@ -164,22 +164,20 @@ void sega315_5377_device::sega315_5377_palette(palette_device &palette) const
// default address map
void sega315_5124_device::sega315_5124(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, VRAM_SIZE-1).ram();
+ map(0x0000, VRAM_SIZE-1).ram();
}
-sega315_5124_device::sega315_5124_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+sega315_5124_device::sega315_5124_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: sega315_5124_device(mconfig, SEGA315_5124, tag, owner, clock, SEGA315_5124_CRAM_SIZE, 0x00, 0x0f, 4, 8, line_315_5124)
{
}
-sega315_5124_device::sega315_5124_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 cram_size, u8 palette_offset, u8 reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const u8 *line_timing)
+sega315_5124_device::sega315_5124_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, uint8_t reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const uint8_t *line_timing)
: device_t(mconfig, type, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
- , device_mixer_interface(mconfig, *this, 2)
, m_cram_size(cram_size)
, m_line_timing(line_timing)
, m_palette_offset(palette_offset)
@@ -190,33 +188,32 @@ sega315_5124_device::sega315_5124_device(const machine_config &mconfig, device_t
, m_int_cb(*this)
, m_csync_cb(*this)
, m_pause_cb(*this)
- , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, address_map_constructor(FUNC(sega315_5124_device::sega315_5124), this))
+ , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, address_map_constructor(), address_map_constructor(FUNC(sega315_5124_device::sega315_5124), this))
, m_palette(*this, "palette")
- , m_snsnd(*this, "snsnd")
{
}
-sega315_5246_device::sega315_5246_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+sega315_5246_device::sega315_5246_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: sega315_5124_device(mconfig, SEGA315_5246, tag, owner, clock, SEGA315_5124_CRAM_SIZE, 0x00, 0x0f, 8, 8, line_315_5124)
{
}
-sega315_5246_device::sega315_5246_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 cram_size, u8 palette_offset, u8 reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const u8 *line_timing)
+sega315_5246_device::sega315_5246_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, uint8_t reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const uint8_t *line_timing)
: sega315_5124_device(mconfig, type, tag, owner, clock, cram_size, palette_offset, reg_num_mask, max_sprite_zoom_hcount, max_sprite_zoom_vcount, line_timing)
{
}
// Embedded mode 4 support of the 315-5313 VDP (see 315_5313.cpp), used by Sega Genesis/Mega Drive
-sega315_5313_mode4_device::sega315_5313_mode4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 cram_size, u8 palette_offset, u8 reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const u8 *line_timing)
+sega315_5313_mode4_device::sega315_5313_mode4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, uint8_t reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const uint8_t *line_timing)
: sega315_5246_device(mconfig, type, tag, owner, clock, cram_size, palette_offset, reg_num_mask, max_sprite_zoom_hcount, max_sprite_zoom_vcount, line_timing)
{
}
-sega315_5377_device::sega315_5377_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+sega315_5377_device::sega315_5377_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: sega315_5246_device(mconfig, SEGA315_5377, tag, owner, clock, SEGA315_5377_CRAM_SIZE, 0x10, 0x0f, 8, 8, line_315_5377)
{
}
@@ -331,7 +328,7 @@ void sega315_5124_device::set_frame_timing()
}
-u8 sega315_5124_device::vcount_read()
+READ8_MEMBER( sega315_5124_device::vcount_read )
{
const int active_scr_start = m_frame_timing[VERTICAL_SYNC] + m_frame_timing[TOP_BLANKING] + m_frame_timing[TOP_BORDER];
int vpos = screen().vpos();
@@ -347,7 +344,7 @@ u8 sega315_5124_device::vcount_read()
}
-u8 sega315_5124_device::hcount_read()
+READ8_MEMBER( sega315_5124_device::hcount_read )
{
return m_hcounter;
}
@@ -595,10 +592,10 @@ void sega315_5124_device::process_line_timer()
}
-u8 sega315_5124_device::data_read()
+READ8_MEMBER( sega315_5124_device::data_read )
{
/* Return data buffer contents */
- const u8 temp = m_buffer;
+ const uint8_t temp = m_buffer;
/* Clear pending write flag */
m_pending_control_write = false;
@@ -656,9 +653,9 @@ void sega315_5124_device::check_pending_flags()
}
-u8 sega315_5124_device::control_read()
+READ8_MEMBER( sega315_5124_device::control_read )
{
- u8 temp;
+ uint8_t temp;
check_pending_flags();
temp = m_status;
@@ -670,7 +667,7 @@ u8 sega315_5124_device::control_read()
/* Clear status flags */
m_hint_occurred = false;
- m_status = u8(~(STATUS_VINT | STATUS_SPROVR | STATUS_SPRCOL));
+ m_status = uint8_t(~(STATUS_VINT | STATUS_SPROVR | STATUS_SPRCOL));
if (m_irq_state == 1)
{
@@ -685,7 +682,7 @@ u8 sega315_5124_device::control_read()
}
-void sega315_5124_device::write_memory(u8 data)
+void sega315_5124_device::write_memory(uint8_t data)
{
switch (m_addrmode)
{
@@ -705,7 +702,7 @@ void sega315_5124_device::write_memory(u8 data)
}
-void sega315_5313_mode4_device::write_memory(u8 data)
+void sega315_5313_mode4_device::write_memory(uint8_t data)
{
switch (m_addrmode)
{
@@ -723,7 +720,7 @@ void sega315_5313_mode4_device::write_memory(u8 data)
}
-void sega315_5124_device::data_write(u8 data)
+WRITE8_MEMBER( sega315_5124_device::data_write )
{
/* Clear pending write flag */
m_pending_control_write = false;
@@ -733,7 +730,7 @@ void sega315_5124_device::data_write(u8 data)
}
-void sega315_5124_device::load_vram_addr(u8 data)
+void sega315_5124_device::load_vram_addr(uint8_t data)
{
// Seems like the latched data is passed straight through
// to the address register when in the middle of doing a command.
@@ -745,7 +742,7 @@ void sega315_5124_device::load_vram_addr(u8 data)
}
-void sega315_5313_mode4_device::load_vram_addr(u8 data)
+void sega315_5313_mode4_device::load_vram_addr(uint8_t data)
{
if (m_pending_control_write)
m_control_write_data_latch = data;
@@ -754,7 +751,7 @@ void sega315_5313_mode4_device::load_vram_addr(u8 data)
}
-void sega315_5124_device::control_write(u8 data)
+WRITE8_MEMBER( sega315_5124_device::control_write )
{
if (!m_pending_control_write)
{
@@ -862,13 +859,13 @@ void sega315_5124_device::control_write(u8 data)
}
-u16 sega315_5124_device::name_table_row_mode4(int row)
+uint16_t sega315_5124_device::name_table_row_mode4(int row)
{
return ((row >> 3) << 6) & (((m_reg[0x02] & 0x01) << 10) | ((m_reg[0x04] & 0x03) << 11) | 0x23ff);
}
-u16 sega315_5246_device::name_table_row_mode4(int row)
+uint16_t sega315_5246_device::name_table_row_mode4(int row)
{
return (row >> 3) << 6;
}
@@ -900,7 +897,7 @@ void sega315_5124_device::draw_leftmost_pixels_mode4(int *line_buffer, int *prio
// Load data of bit plane 1 for the selected tile.
const int tmp_bit_plane_1 = space().read_byte((tile_selected << 5) + ((parse_line & 0x07) << 2) + 0x01);
- const u8 pen_bit_1 = BIT(tmp_bit_plane_1, 7 - pixel_x);
+ const uint8_t pen_bit_1 = BIT(tmp_bit_plane_1, 7 - pixel_x);
for (int pixel_plot_x = 0; pixel_plot_x < fine_x_scroll; pixel_plot_x++)
{
@@ -934,7 +931,7 @@ void sega315_5124_device::draw_scanline_mode4(int *line_buffer, int *priority_se
const int fine_x_scroll = (x_scroll & 0x07);
int scroll_mod;
- u16 name_table_address;
+ uint16_t name_table_address;
if (m_y_pixels != 192)
{
name_table_address = ((m_reg[0x02] & 0x0c) << 10) | 0x0700;
@@ -956,7 +953,7 @@ void sega315_5124_device::draw_scanline_mode4(int *line_buffer, int *priority_se
/* vertical scrolling when bit 7 of reg[0x00] is set */
const int y_scroll = (BIT(m_reg[0x00], 7) && (tile_column > 23)) ? 0 : m_reg9copy;
- const u16 tile_data = space().read_word(name_table_address + name_table_row_mode4((line + y_scroll) % scroll_mod) + table_column);
+ const uint16_t tile_data = space().read_word(name_table_address + name_table_row_mode4((line + y_scroll) % scroll_mod) + table_column);
const int tile_selected = (tile_data & 0x01ff);
const int priority_select = tile_data & PRIORITY_BIT;
@@ -981,12 +978,12 @@ void sega315_5124_device::draw_scanline_mode4(int *line_buffer, int *priority_se
for (int pixel_x = 0; pixel_x < 8; pixel_x++)
{
- const u8 pen_bit_0 = BIT(bit_plane_0, 7 - pixel_x);
- const u8 pen_bit_1 = BIT(bit_plane_1, 7 - pixel_x);
- const u8 pen_bit_2 = BIT(bit_plane_2, 7 - pixel_x);
- const u8 pen_bit_3 = BIT(bit_plane_3, 7 - pixel_x);
+ const uint8_t pen_bit_0 = BIT(bit_plane_0, 7 - pixel_x);
+ const uint8_t pen_bit_1 = BIT(bit_plane_1, 7 - pixel_x);
+ const uint8_t pen_bit_2 = BIT(bit_plane_2, 7 - pixel_x);
+ const uint8_t pen_bit_3 = BIT(bit_plane_3, 7 - pixel_x);
- u8 pen_selected = (pen_bit_3 << 3 | pen_bit_2 << 2 | pen_bit_1 << 1 | pen_bit_0);
+ uint8_t pen_selected = (pen_bit_3 << 3 | pen_bit_2 << 2 | pen_bit_1 << 1 | pen_bit_0);
if (palette_selected)
pen_selected |= 0x10;
@@ -1003,25 +1000,25 @@ void sega315_5124_device::draw_scanline_mode4(int *line_buffer, int *priority_se
}
-u16 sega315_5124_device::sprite_attributes_addr_mode4(u16 base)
+uint16_t sega315_5124_device::sprite_attributes_addr_mode4(uint16_t base)
{
return base & ((BIT(m_reg[0x05], 0) << 7) | 0x3f7f);
}
-u16 sega315_5246_device::sprite_attributes_addr_mode4(u16 base)
+uint16_t sega315_5246_device::sprite_attributes_addr_mode4(uint16_t base)
{
return base;
}
-u8 sega315_5124_device::sprite_tile_mask_mode4(u8 tile_number)
+uint8_t sega315_5124_device::sprite_tile_mask_mode4(uint8_t tile_number)
{
return tile_number & (((m_reg[0x06] & 0x03) << 6) | 0x3f);
}
-u8 sega315_5246_device::sprite_tile_mask_mode4(u8 tile_number)
+uint8_t sega315_5246_device::sprite_tile_mask_mode4(uint8_t tile_number)
{
return tile_number;
}
@@ -1032,7 +1029,7 @@ void sega315_5124_device::sprite_count_overflow(int line, int sprite_index)
/* Overflow is flagged only on active display and when VINT isn't active */
if (!(m_status & STATUS_VINT) && line >= 0 && line < m_frame_timing[ACTIVE_DISPLAY_V])
{
- u8 sprite_number_bits;
+ uint8_t sprite_number_bits;
m_pending_status |= STATUS_SPROVR;
if (sprite_index < 14)
sprite_number_bits = (sprite_index + 1) / 2;
@@ -1099,7 +1096,7 @@ void sega315_5124_device::select_sprites(int line)
{
const int sprite_x = space().read_byte(m_sprite_base + sprite_index + 1);
int sprite_tile_selected = space().read_byte(m_sprite_base + sprite_index + 2);
- const u8 flags = space().read_byte(m_sprite_base + sprite_index + 3);
+ const uint8_t flags = space().read_byte(m_sprite_base + sprite_index + 3);
int sprite_line = parse_line - sprite_y;
@@ -1268,28 +1265,28 @@ void sega315_5124_device::draw_sprites_mode4(int *line_buffer, int *priority_sel
bool sprite_col_occurred = false;
int sprite_col_x = 255;
- u8 collision_buffer[256] = { 0 };
+ uint8_t collision_buffer[256] = { 0 };
// Draw sprite layer
for (int sprite_buffer_index = m_sprite_count - 1; sprite_buffer_index >= 0; sprite_buffer_index--)
{
const int sprite_x = m_sprite_x[sprite_buffer_index];
const int sprite_tile_selected = m_sprite_tile_selected[sprite_buffer_index];
- const u16 sprite_pattern_line = m_sprite_pattern_line[sprite_buffer_index];
+ const uint16_t sprite_pattern_line = m_sprite_pattern_line[sprite_buffer_index];
const int zoom_scale = sprite_buffer_index < m_max_sprite_zoom_hcount ? m_sprite_zoom_scale : 1;
- const u8 bit_plane_0 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x00);
- const u8 bit_plane_1 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x01);
- const u8 bit_plane_2 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x02);
- const u8 bit_plane_3 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x03);
+ const uint8_t bit_plane_0 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x00);
+ const uint8_t bit_plane_1 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x01);
+ const uint8_t bit_plane_2 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x02);
+ const uint8_t bit_plane_3 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x03);
for (int pixel_x = 0; pixel_x < 8; pixel_x++)
{
- const u8 pen_bit_0 = BIT(bit_plane_0, 7 - pixel_x);
- const u8 pen_bit_1 = BIT(bit_plane_1, 7 - pixel_x);
- const u8 pen_bit_2 = BIT(bit_plane_2, 7 - pixel_x);
- const u8 pen_bit_3 = BIT(bit_plane_3, 7 - pixel_x);
- const u8 pen_selected = (pen_bit_3 << 3 | pen_bit_2 << 2 | pen_bit_1 << 1 | pen_bit_0) | 0x10;
+ const uint8_t pen_bit_0 = BIT(bit_plane_0, 7 - pixel_x);
+ const uint8_t pen_bit_1 = BIT(bit_plane_1, 7 - pixel_x);
+ const uint8_t pen_bit_2 = BIT(bit_plane_2, 7 - pixel_x);
+ const uint8_t pen_bit_3 = BIT(bit_plane_3, 7 - pixel_x);
+ const uint8_t pen_selected = (pen_bit_3 << 3 | pen_bit_2 << 2 | pen_bit_1 << 1 | pen_bit_0) | 0x10;
if (pen_selected == 0x10) // Transparent palette so skip draw
continue;
@@ -1355,15 +1352,15 @@ void sega315_5124_device::draw_sprites_tms9918_mode(int *line_buffer, int line)
bool sprite_col_occurred = false;
int sprite_col_x = 255;
- u8 collision_buffer[256] = { 0 };
+ uint8_t collision_buffer[256] = { 0 };
/* Draw sprite layer */
for (int sprite_buffer_index = m_sprite_count - 1; sprite_buffer_index >= 0; sprite_buffer_index--)
{
int sprite_x = m_sprite_x[sprite_buffer_index];
int sprite_tile_selected = m_sprite_tile_selected[sprite_buffer_index];
- const u16 sprite_pattern_line = m_sprite_pattern_line[sprite_buffer_index];
- const u8 flags = m_sprite_flags[sprite_buffer_index];
+ const uint16_t sprite_pattern_line = m_sprite_pattern_line[sprite_buffer_index];
+ const uint8_t flags = m_sprite_flags[sprite_buffer_index];
const int pen_selected = m_palette_offset + (flags & 0x0f);
const int zoom_scale = sprite_buffer_index < m_max_sprite_zoom_hcount ? m_sprite_zoom_scale : 1;
@@ -1378,7 +1375,7 @@ void sega315_5124_device::draw_sprites_tms9918_mode(int *line_buffer, int line)
sprite_x += (zoom_scale > 1 ? 16 : 8);
}
- u8 pattern = space().read_byte(sprite_pattern_line + sprite_tile_selected * 8);
+ uint8_t pattern = space().read_byte(sprite_pattern_line + sprite_tile_selected * 8);
for (int pixel_x = 0; pixel_x < 8; pixel_x++)
{
@@ -1424,23 +1421,23 @@ void sega315_5124_device::draw_sprites_tms9918_mode(int *line_buffer, int line)
// Display mode 2 (Graphics II Mode)
void sega315_5124_device::draw_scanline_mode2(int *line_buffer, int line)
{
- const u16 name_table_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
- const u16 color_base = ((m_reg[0x03] & 0x80) << 6);
+ const uint16_t name_table_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
+ const uint16_t color_base = ((m_reg[0x03] & 0x80) << 6);
const int color_mask = ((m_reg[0x03] & 0x7f) << 3) | 0x07;
- const u16 pattern_base = ((m_reg[0x04] & 0x04) << 11);
+ const uint16_t pattern_base = ((m_reg[0x04] & 0x04) << 11);
const int pattern_mask = ((m_reg[0x04] & 0x03) << 8) | 0xff;
const int pattern_offset = (line & 0xc0) << 2;
/* Draw background layer */
for (int tile_column = 0; tile_column < 32; tile_column++)
{
- const u8 name = space().read_byte(name_table_base + tile_column);
- const u8 pattern = space().read_byte(pattern_base + (((pattern_offset + name) & pattern_mask) * 8) + (line & 0x07) );
- const u8 colors = space().read_byte(color_base + (((pattern_offset + name) & color_mask) * 8) + (line & 0x07) );
+ const uint8_t name = space().read_byte(name_table_base + tile_column);
+ const uint8_t pattern = space().read_byte(pattern_base + (((pattern_offset + name) & pattern_mask) * 8) + (line & 0x07) );
+ const uint8_t colors = space().read_byte(color_base + (((pattern_offset + name) & color_mask) * 8) + (line & 0x07) );
for (int pixel_x = 0; pixel_x < 8; pixel_x++)
{
- u8 pen_selected;
+ uint8_t pen_selected;
const int pixel_plot_x = (tile_column << 3) + pixel_x;
if (BIT(pattern, 7 - pixel_x))
@@ -1465,16 +1462,16 @@ void sega315_5124_device::draw_scanline_mode2(int *line_buffer, int line)
// Display mode 0 (Graphics I Mode)
void sega315_5124_device::draw_scanline_mode0(int *line_buffer, int line)
{
- const u16 name_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
- const u16 color_base = ((m_reg[0x03] << 6) & (VRAM_SIZE - 1));
- const u16 pattern_base = ((m_reg[0x04] << 11) & (VRAM_SIZE - 1));
+ const uint16_t name_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
+ const uint16_t color_base = ((m_reg[0x03] << 6) & (VRAM_SIZE - 1));
+ const uint16_t pattern_base = ((m_reg[0x04] << 11) & (VRAM_SIZE - 1));
/* Draw background layer */
for (int tile_column = 0; tile_column < 32; tile_column++)
{
- const u8 name = space().read_byte(name_base + tile_column);
- const u8 pattern = space().read_byte(pattern_base + (name << 3) + (line & 0x07));
- const u8 colors = space().read_byte(color_base + (name >> 3));
+ const uint8_t name = space().read_byte(name_base + tile_column);
+ const uint8_t pattern = space().read_byte(pattern_base + (name << 3) + (line & 0x07));
+ const uint8_t colors = space().read_byte(color_base + (name >> 3));
for (int pixel_x = 0; pixel_x < 8; pixel_x++)
{
@@ -1499,8 +1496,8 @@ void sega315_5124_device::draw_scanline_mode0(int *line_buffer, int line)
// Display mode 1 (Text Mode)
void sega315_5124_device::draw_scanline_mode1(int *line_buffer, int line)
{
- const u16 name_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
- const u16 pattern_base = ((m_reg[0x04] << 11) & (VRAM_SIZE - 1));
+ const uint16_t name_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
+ const uint16_t pattern_base = ((m_reg[0x04] << 11) & (VRAM_SIZE - 1));
for (int pixel_plot_x = 0; pixel_plot_x < 8; pixel_plot_x++)
{
@@ -1510,8 +1507,8 @@ void sega315_5124_device::draw_scanline_mode1(int *line_buffer, int line)
/* Draw background layer */
for (int tile_column = 0; tile_column < 40; tile_column++)
{
- const u8 name = space().read_byte(name_base + tile_column);
- const u8 pattern = space().read_byte(pattern_base + (name << 3) + (line & 0x07));
+ const uint8_t name = space().read_byte(name_base + tile_column);
+ const uint8_t pattern = space().read_byte(pattern_base + (name << 3) + (line & 0x07));
for (int pixel_x = 0; pixel_x < 6; pixel_x++)
{
@@ -1539,14 +1536,14 @@ void sega315_5124_device::draw_scanline_mode1(int *line_buffer, int line)
// Display mode 3 (Multicolor Mode)
void sega315_5124_device::draw_scanline_mode3(int *line_buffer, int line)
{
- const u16 name_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
- const u16 pattern_base = ((m_reg[0x04] << 11) & (VRAM_SIZE - 1));
+ const uint16_t name_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
+ const uint16_t pattern_base = ((m_reg[0x04] << 11) & (VRAM_SIZE - 1));
/* Draw background layer */
for (int tile_column = 0; tile_column < 32; tile_column++)
{
- const u8 name = space().read_byte(name_base + tile_column);
- const u8 pattern = space().read_byte(pattern_base + (name << 3) + (((line >> 3) & 3) << 1) + ((line & 4) >> 2));
+ const uint8_t name = space().read_byte(name_base + tile_column);
+ const uint8_t pattern = space().read_byte(pattern_base + (name << 3) + (((line >> 3) & 3) << 1) + ((line & 4) >> 2));
for (int pixel_x = 0; pixel_x < 8; pixel_x++)
{
@@ -1638,8 +1635,8 @@ void sega315_5124_device::draw_scanline(int pixel_offset_x, int pixel_plot_y, in
void sega315_5124_device::blit_scanline(int *line_buffer, int *priority_selected, int pixel_offset_x, int pixel_plot_y, int line)
{
- u32 *p_bitmap = &m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x);
- u8 *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x);
+ uint32_t *p_bitmap = &m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x);
+ uint8_t *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x);
int x = 0;
if (m_vdp_mode == 4 && BIT(m_reg[0x00], 5))
@@ -1670,8 +1667,8 @@ void sega315_5377_device::blit_scanline(int *line_buffer, int *priority_selected
}
else
{
- u32 *p_bitmap = &m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x);
- u8 *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x);
+ uint32_t *p_bitmap = &m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x);
+ uint8_t *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x);
int x = 0;
/* border on left side of the GG active screen */
@@ -1759,9 +1756,9 @@ void sega315_5377_device::update_palette()
}
-void sega315_5124_device::cram_write(u8 data)
+void sega315_5124_device::cram_write(uint8_t data)
{
- u16 address = m_addr & m_cram_mask;
+ uint16_t address = m_addr & m_cram_mask;
if (data != m_CRAM[address])
{
m_CRAM[address] = data;
@@ -1770,7 +1767,7 @@ void sega315_5124_device::cram_write(u8 data)
}
-void sega315_5377_device::cram_write(u8 data)
+void sega315_5377_device::cram_write(uint8_t data)
{
if (m_sega315_5124_compatibility_mode)
{
@@ -1780,7 +1777,7 @@ void sega315_5377_device::cram_write(u8 data)
{
if (m_addr & 1)
{
- u16 address = (m_addr & m_cram_mask) & ~1;
+ uint16_t address = (m_addr & m_cram_mask) & ~1;
if (m_buffer != m_CRAM[address] || data != m_CRAM[address + 1])
{
m_CRAM[address] = m_buffer;
@@ -1792,7 +1789,7 @@ void sega315_5377_device::cram_write(u8 data)
}
-u32 sega315_5124_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+uint32_t sega315_5124_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
copybitmap(bitmap, m_tmpbitmap, 0, 0, 0, 0, cliprect);
return 0;
@@ -1822,7 +1819,7 @@ void sega315_5313_mode4_device::stop_timers()
DEVICE INTERFACE
*****************************************************************************/
-void sega315_5124_device::device_post_load()
+void sega315_5124_device::vdp_postload()
{
set_frame_timing();
}
@@ -1889,6 +1886,8 @@ void sega315_5124_device::device_start()
save_item(NAME(m_max_sprite_zoom_hcount));
save_item(NAME(m_max_sprite_zoom_vcount));
save_item(NAME(m_CRAM));
+
+ machine().save().register_postload(save_prepost_delegate(FUNC(sega315_5124_device::vdp_postload), this));
}
@@ -1900,7 +1899,7 @@ void sega315_5124_device::device_reset()
m_reg[0x02] = 0x0e;
m_reg[0x0a] = 0xff;
- m_status = m_pending_status = u8(~(STATUS_VINT | STATUS_SPROVR | STATUS_SPRCOL));
+ m_status = m_pending_status = uint8_t(~(STATUS_VINT | STATUS_SPROVR | STATUS_SPRCOL));
m_pending_sprcol_x = 0;
m_pending_control_write = false;
m_pending_hint = false;
@@ -1935,8 +1934,6 @@ void sega315_5124_device::device_reset()
void sega315_5124_device::device_add_mconfig(machine_config &config)
{
PALETTE(config, m_palette, FUNC(sega315_5124_device::sega315_5124_palette), SEGA315_5124_PALETTE_SIZE);
-
- SEGAPSG(config, m_snsnd, DERIVED_CLOCK(1, 3)).add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
}
void sega315_5377_device::device_reset()
@@ -1952,11 +1949,6 @@ void sega315_5377_device::device_reset()
void sega315_5377_device::device_add_mconfig(machine_config &config)
{
sega315_5246_device::device_add_mconfig(config);
-
m_palette->set_entries(SEGA315_5377_PALETTE_SIZE);
m_palette->set_init(FUNC(sega315_5377_device::sega315_5377_palette));
-
- GAMEGEAR(config.replace(), m_snsnd, DERIVED_CLOCK(1, 3));
- m_snsnd->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_snsnd->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
}
diff --git a/src/devices/video/315_5124.h b/src/devices/video/315_5124.h
index b88cf5c38d7..3ff7b5165a1 100644
--- a/src/devices/video/315_5124.h
+++ b/src/devices/video/315_5124.h
@@ -13,7 +13,6 @@
#pragma once
-#include "sound/sn76496.h"
#include "emupal.h"
#include "screen.h"
@@ -29,8 +28,7 @@ DECLARE_DEVICE_TYPE(SEGA315_5377, sega315_5377_device) /* aka Gamegear (2 A
class sega315_5124_device : public device_t,
public device_memory_interface,
- public device_video_interface,
- public device_mixer_interface
+ public device_video_interface
{
public:
static constexpr unsigned WIDTH = 342; /* 342 pixels */
@@ -53,22 +51,23 @@ public:
// construction/destruction
- sega315_5124_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ sega315_5124_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void set_is_pal(bool is_pal) { m_is_pal = is_pal; }
+ template <class Object> devcb_base &set_int_callback(Object &&cb) { return m_int_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_csync_callback(Object &&cb) { return m_csync_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_pause_callback(Object &&cb) { return m_pause_cb.set_callback(std::forward<Object>(cb)); }
auto irq() { return m_int_cb.bind(); }
auto csync() { return m_csync_cb.bind(); }
auto pause() { return m_pause_cb.bind(); }
- void psg_w(u8 data) { m_snsnd->write(data); }
- void psg_stereo_w(u8 data) { m_snsnd->stereo_w(data); }
- u8 data_read();
- void data_write(u8 data);
- u8 control_read();
- void control_write(u8 data);
- u8 vcount_read();
- u8 hcount_read();
+ DECLARE_READ8_MEMBER( data_read );
+ DECLARE_WRITE8_MEMBER( data_write );
+ DECLARE_READ8_MEMBER( control_read );
+ DECLARE_WRITE8_MEMBER( control_write );
+ DECLARE_READ8_MEMBER( vcount_read );
+ DECLARE_READ8_MEMBER( hcount_read );
void hcount_latch() { hcount_latch_at_hpos(screen().hpos()); };
void hcount_latch_at_hpos(int hpos);
@@ -77,7 +76,7 @@ public:
bitmap_ind8 &get_y1_bitmap() { return m_y1_bitmap; };
/* update the screen */
- u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
virtual void set_sega315_5124_compatibility_mode(bool sega315_5124_compatibility_mode) { }
@@ -85,10 +84,9 @@ protected:
static constexpr unsigned SEGA315_5377_CRAM_SIZE = 0x40; /* 32 colors x 2 bytes per color = 64 bytes */
static constexpr unsigned SEGA315_5124_CRAM_SIZE = 0x20; /* 32 colors x 1 bytes per color = 32 bytes */
- sega315_5124_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 cram_size, u8 palette_offset, u8 reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const u8 *line_timing);
+ sega315_5124_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, uint8_t reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const uint8_t *line_timing);
// device-level overrides
- virtual void device_post_load() override;
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
@@ -103,9 +101,9 @@ protected:
void set_display_settings();
void set_frame_timing();
virtual void update_palette();
- virtual void write_memory(u8 data);
- virtual void cram_write(u8 data);
- virtual void load_vram_addr(u8 data);
+ virtual void write_memory(uint8_t data);
+ virtual void cram_write(uint8_t data);
+ virtual void load_vram_addr(uint8_t data);
virtual void select_display_mode();
virtual void select_extended_res_mode4(bool M1, bool M2, bool M3);
virtual void select_sprites(int line);
@@ -114,9 +112,9 @@ protected:
virtual void draw_scanline(int pixel_offset_x, int pixel_plot_y, int line);
virtual void blit_scanline(int *line_buffer, int *priority_selected, int pixel_offset_x, int pixel_plot_y, int line);
virtual void draw_leftmost_pixels_mode4(int *line_buffer, int *priority_selected, int fine_x_scroll, int palette_selected, int tile_line);
- virtual u16 name_table_row_mode4(int row);
- virtual u16 sprite_attributes_addr_mode4(u16 base);
- virtual u8 sprite_tile_mask_mode4(u8 tile_number);
+ virtual uint16_t name_table_row_mode4(int row);
+ virtual uint16_t sprite_attributes_addr_mode4(uint16_t base);
+ virtual uint8_t sprite_tile_mask_mode4(uint8_t tile_number);
void process_line_timer();
void draw_scanline_mode4(int *line_buffer, int *priority_selected, int line);
void draw_sprites_mode4(int *line_buffer, int *priority_selected, int line);
@@ -127,42 +125,44 @@ protected:
void draw_scanline_mode0(int *line_buffer, int line);
void check_pending_flags();
- u8 m_reg[16]; /* All the registers */
- u8 m_status; /* Status register */
- u8 m_pending_status; /* Pending status flags */
- u8 m_reg8copy; /* Internal copy of register 8 (X-Scroll) */
- u8 m_reg9copy; /* Internal copy of register 9 (Y-Scroll) */
- u8 m_addrmode; /* Type of VDP action */
- u16 m_addr; /* Contents of internal VDP address register */
- const u8 m_cram_size; /* CRAM size */
- u8 m_cram_mask; /* Mask to switch between SMS and GG CRAM sizes */
+ void vdp_postload();
+
+ uint8_t m_reg[16]; /* All the registers */
+ uint8_t m_status; /* Status register */
+ uint8_t m_pending_status; /* Pending status flags */
+ uint8_t m_reg8copy; /* Internal copy of register 8 (X-Scroll) */
+ uint8_t m_reg9copy; /* Internal copy of register 9 (Y-Scroll) */
+ uint8_t m_addrmode; /* Type of VDP action */
+ uint16_t m_addr; /* Contents of internal VDP address register */
+ const uint8_t m_cram_size; /* CRAM size */
+ uint8_t m_cram_mask; /* Mask to switch between SMS and GG CRAM sizes */
bool m_cram_dirty; /* Have there been any changes to the CRAM area */
bool m_hint_occurred;
bool m_pending_hint;
bool m_pending_control_write;
int m_pending_sprcol_x;
- u8 m_buffer;
- u8 m_control_write_data_latch;
+ uint8_t m_buffer;
+ uint8_t m_control_write_data_latch;
bool m_sega315_5124_compatibility_mode; /* when true, GG VDP behaves as SMS VDP */
int m_irq_state; /* The status of the IRQ line of the VDP */
int m_vdp_mode; /* Current mode of the VDP: 0,1,2,3,4 */
int m_y_pixels; /* 192, 224, 240 */
int m_draw_time;
- u8 m_line_counter;
- u8 m_hcounter;
- u8 m_CRAM[SEGA315_5377_CRAM_SIZE]; /* CRAM */
- const u8 *m_frame_timing;
- const u8 *m_line_timing;
+ uint8_t m_line_counter;
+ uint8_t m_hcounter;
+ uint8_t m_CRAM[SEGA315_5377_CRAM_SIZE]; /* CRAM */
+ const uint8_t *m_frame_timing;
+ const uint8_t *m_line_timing;
bitmap_rgb32 m_tmpbitmap;
bitmap_ind8 m_y1_bitmap;
- const u8 m_palette_offset;
- const u8 m_reg_num_mask;
+ const uint8_t m_palette_offset;
+ const uint8_t m_reg_num_mask;
bool m_display_disabled;
- u16 m_sprite_base;
- u16 m_sprite_pattern_line[8];
+ uint16_t m_sprite_base;
+ uint16_t m_sprite_pattern_line[8];
int m_sprite_tile_selected[8];
int m_sprite_x[8];
- u8 m_sprite_flags[8];
+ uint8_t m_sprite_flags[8];
int m_sprite_count;
int m_sprite_height;
int m_sprite_zoom_scale;
@@ -195,21 +195,20 @@ protected:
static constexpr device_timer_id TIMER_FLAGS = 7;
required_device<palette_device> m_palette;
- required_device<sn76496_base_device> m_snsnd;
};
class sega315_5246_device : public sega315_5124_device
{
public:
- sega315_5246_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ sega315_5246_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
- sega315_5246_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 cram_size, u8 palette_offset, u8 reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const u8 *line_timing);
+ sega315_5246_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, uint8_t reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const uint8_t *line_timing);
- virtual u16 name_table_row_mode4(int row) override;
- virtual u16 sprite_attributes_addr_mode4(u16 base) override;
- virtual u8 sprite_tile_mask_mode4(u8 tile_number) override;
+ virtual uint16_t name_table_row_mode4(int row) override;
+ virtual uint16_t sprite_attributes_addr_mode4(uint16_t base) override;
+ virtual uint8_t sprite_tile_mask_mode4(uint8_t tile_number) override;
virtual void select_extended_res_mode4(bool M1, bool M2, bool M3) override;
};
@@ -217,18 +216,18 @@ protected:
class sega315_5377_device : public sega315_5246_device
{
public:
- sega315_5377_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ sega315_5377_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual void set_sega315_5124_compatibility_mode(bool sega315_5124_compatibility_mode) override;
protected:
- sega315_5377_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 cram_size, u8 palette_offset, u8 reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const u8 *line_timing);
+ sega315_5377_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, uint8_t reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const uint8_t *line_timing);
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
virtual void update_palette() override;
- virtual void cram_write(u8 data) override;
+ virtual void cram_write(uint8_t data) override;
virtual void blit_scanline(int *line_buffer, int *priority_selected, int pixel_offset_x, int pixel_plot_y, int line) override;
private:
@@ -243,10 +242,10 @@ public:
void stop_timers();
protected:
- sega315_5313_mode4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 cram_size, u8 palette_offset, u8 reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const u8 *line_timing);
+ sega315_5313_mode4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, uint8_t reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const uint8_t *line_timing);
- virtual void write_memory(u8 data) override;
- virtual void load_vram_addr(u8 data) override;
+ virtual void write_memory(uint8_t data) override;
+ virtual void load_vram_addr(uint8_t data) override;
virtual void select_sprites(int line) override;
virtual void sprite_collision(int line, int sprite_col_x) override;
virtual void sprite_count_overflow(int line, int sprite_index) override;
@@ -255,4 +254,54 @@ protected:
virtual void draw_leftmost_pixels_mode4(int *line_buffer, int *priority_selected, int fine_x_scroll, int palette_selected, int tile_line) override;
};
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_SEGA315_5124_SET_SCREEN MCFG_VIDEO_SET_SCREEN
+
+#define MCFG_SEGA315_5124_IS_PAL(_bool) \
+ downcast<sega315_5124_device &>(*device).set_is_pal(_bool);
+
+#define MCFG_SEGA315_5124_INT_CB(_devcb) \
+ downcast<sega315_5124_device &>(*device).set_int_callback(DEVCB_##_devcb);
+
+#define MCFG_SEGA315_5124_CSYNC_CB(_devcb) \
+ downcast<sega315_5124_device &>(*device).set_csync_callback(DEVCB_##_devcb);
+
+#define MCFG_SEGA315_5124_PAUSE_CB(_devcb) \
+ downcast<sega315_5124_device &>(*device).set_pause_callback(DEVCB_##_devcb);
+
+
+#define MCFG_SEGA315_5246_SET_SCREEN MCFG_VIDEO_SET_SCREEN
+
+#define MCFG_SEGA315_5246_IS_PAL(_bool) \
+ downcast<sega315_5246_device &>(*device).set_is_pal(_bool);
+
+#define MCFG_SEGA315_5246_INT_CB(_devcb) \
+ downcast<sega315_5246_device &>(*device).set_int_callback(DEVCB_##_devcb);
+
+#define MCFG_SEGA315_5246_CSYNC_CB(_devcb) \
+ downcast<sega315_5246_device &>(*device).set_csync_callback(DEVCB_##_devcb);
+
+#define MCFG_SEGA315_5246_PAUSE_CB(_devcb) \
+ downcast<sega315_5246_device &>(*device).set_pause_callback(DEVCB_##_devcb);
+
+
+#define MCFG_SEGA315_5377_SET_SCREEN MCFG_VIDEO_SET_SCREEN
+
+#define MCFG_SEGA315_5377_IS_PAL(_bool) \
+ downcast<sega315_5377_device &>(*device).set_is_pal(_bool);
+
+#define MCFG_SEGA315_5377_INT_CB(_devcb) \
+ downcast<sega315_5377_device &>(*device).set_int_callback(DEVCB_##_devcb);
+
+#define MCFG_SEGA315_5377_CSYNC_CB(_devcb) \
+ downcast<sega315_5377_device &>(*device).set_csync_callback(DEVCB_##_devcb);
+
+#define MCFG_SEGA315_5377_PAUSE_CB(_devcb) \
+ downcast<sega315_5377_device &>(*device).set_pause_callback(DEVCB_##_devcb);
+
+
#endif // MAME_VIDEO_315_5124_H
diff --git a/src/devices/video/315_5313.cpp b/src/devices/video/315_5313.cpp
index b56f1349f59..921c7011a29 100644
--- a/src/devices/video/315_5313.cpp
+++ b/src/devices/video/315_5313.cpp
@@ -161,6 +161,7 @@ DEFINE_DEVICE_TYPE(SEGA315_5313, sega315_5313_device, "sega315_5313", "Sega 315-
sega315_5313_device::sega315_5313_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
// mode 4 support, for SMS compatibility, is implemented in 315_5124.cpp
: sega315_5313_mode4_device(mconfig, SEGA315_5313, tag, owner, clock, SEGA315_5124_CRAM_SIZE, 0x00, 0x1f, 0, 0, line_315_5313_mode4)
+ , device_mixer_interface(mconfig, *this, 2)
, m_render_bitmap(nullptr)
, m_render_line(nullptr)
, m_render_line_raw(nullptr)
@@ -209,6 +210,7 @@ sega315_5313_device::sega315_5313_device(const machine_config &mconfig, const ch
, m_palette_lookup_highlight(nullptr)
, m_space68k(nullptr)
, m_cpu68k(*this, finder_base::DUMMY_TAG)
+ , m_snsnd(*this, "snsnd")
{
m_use_alt_timing = 0;
m_palwrite_base = -1;
@@ -225,7 +227,7 @@ void sega315_5313_device::device_add_mconfig(machine_config &config)
m_palette->set_entries(0x200); // more entries for 32X - not really the cleanest way to do this
- SEGAPSG(config.replace(), m_snsnd, DERIVED_CLOCK(1, 15)).add_route(ALL_OUTPUTS, *this, 0.5, AUTO_ALLOC_INPUT, 0);
+ SEGAPSG(config, m_snsnd, DERIVED_CLOCK(1, 15)).add_route(ALL_OUTPUTS, *this, 0.5, AUTO_ALLOC_INPUT, 0);
}
TIMER_CALLBACK_MEMBER(sega315_5313_device::irq6_on_timer_callback)
@@ -966,9 +968,9 @@ WRITE16_MEMBER( sega315_5313_device::vdp_w )
case 0x16:
{
// accessed by either segapsg_device or sn76496_device
- if (ACCESSING_BITS_0_7)
- psg_w(data & 0xff);
- //if (ACCESSING_BITS_8_15) psg_w((data>>8) & 0xff);
+ if (m_snsnd && ACCESSING_BITS_0_7)
+ m_snsnd->write(data & 0xff);
+ //if (m_snsnd && ACCESSING_BITS_8_15) sn->write((data>>8) & 0xff);
break;
}
diff --git a/src/devices/video/315_5313.h b/src/devices/video/315_5313.h
index 28d1d995d97..f2aae550f8b 100644
--- a/src/devices/video/315_5313.h
+++ b/src/devices/video/315_5313.h
@@ -9,9 +9,49 @@
#include "video/315_5124.h"
#include "cpu/m68000/m68000.h"
#include "machine/timer.h"
+#include "sound/sn76496.h"
-class sega315_5313_device : public sega315_5313_mode4_device
+#define MCFG_SEGA315_5313_IS_PAL(_bool) \
+ downcast<sega315_5313_device &>(*device).set_is_pal(_bool);
+
+#define MCFG_SEGA315_5313_INT_CB(_devcb) \
+ downcast<sega315_5313_device &>(*device).set_int_callback(DEVCB_##_devcb);
+
+#define MCFG_SEGA315_5313_PAUSE_CB(_devcb) \
+ downcast<sega315_5313_device &>(*device).set_pause_callback(DEVCB_##_devcb);
+
+#define MCFG_SEGA315_5313_SND_IRQ_CALLBACK(_write) \
+ downcast<sega315_5313_device &>(*device).set_sndirqline_callback(DEVCB_##_write);
+
+#define MCFG_SEGA315_5313_LV6_IRQ_CALLBACK(_write) \
+ downcast<sega315_5313_device &>(*device).set_lv6irqline_callback(DEVCB_##_write);
+
+#define MCFG_SEGA315_5313_LV4_IRQ_CALLBACK(_write) \
+ downcast<sega315_5313_device &>(*device).set_lv4irqline_callback(DEVCB_##_write);
+
+#define MCFG_SEGA315_5313_ALT_TIMING(_data) \
+ downcast<sega315_5313_device &>(*device).set_alt_timing(_data);
+
+#define MCFG_SEGA315_5313_PAL_WRITE_BASE(_data) \
+ downcast<sega315_5313_device &>(*device).set_pal_write_base(_data);
+
+#define MCFG_SEGA315_5313_PALETTE(_palette_tag) \
+ downcast<sega315_5313_device &>(*device).set_palette(_palette_tag);
+
+
+// Temporary solution while 32x VDP mixing and scanline interrupting is moved outside MD VDP
+#define MCFG_SEGA315_5313_32X_SCANLINE_CB(_class, _method) \
+ downcast<sega315_5313_device &>(*device).set_md_32x_scanline(sega315_5313_device::md_32x_scanline_delegate(&_class::_method, #_class "::" #_method, this));
+
+#define MCFG_SEGA315_5313_32X_INTERRUPT_CB(_class, _method) \
+ downcast<sega315_5313_device &>(*device).set_md_32x_interrupt(sega315_5313_device::md_32x_interrupt_delegate(&_class::_method, #_class "::" #_method, this));
+
+#define MCFG_SEGA315_5313_32X_SCANLINE_HELPER_CB(_class, _method) \
+ downcast<sega315_5313_device &>(*device).set_md_32x_scanline_helper(sega315_5313_device::md_32x_scanline_helper_delegate(&_class::_method, #_class "::" #_method, this));
+
+
+class sega315_5313_device : public sega315_5313_mode4_device, public device_mixer_interface
{
public:
template <typename T>
@@ -27,6 +67,9 @@ public:
typedef device_delegate<void (int scanline, int irq6)> md_32x_interrupt_delegate;
typedef device_delegate<void (int scanline)> md_32x_scanline_helper_delegate;
+ template <class Object> devcb_base &set_sndirqline_callback(Object &&cb) { return m_sndirqline_callback.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_lv6irqline_callback(Object &&cb) { return m_lv6irqline_callback.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_lv4irqline_callback(Object &&cb) { return m_lv4irqline_callback.set_callback(std::forward<Object>(cb)); }
auto snd_irq() { return m_sndirqline_callback.bind(); }
auto lv6_irq() { return m_lv6irqline_callback.bind(); }
auto lv4_irq() { return m_lv4irqline_callback.bind(); }
@@ -35,10 +78,9 @@ public:
void set_pal_write_base(int palwrite_base) { m_palwrite_base = palwrite_base; }
template <typename T> void set_palette(T &&tag) { m_palette.set_tag(std::forward<T>(tag)); }
- // Temporary solution while 32x VDP mixing and scanline interrupting is moved outside MD VDP
- template <typename... T> void set_md_32x_scanline(T &&... args) { m_32x_scanline_func = md_32x_scanline_delegate(std::forward<T>(args)...); }
- template <typename... T> void set_md_32x_interrupt(T &&... args) { m_32x_interrupt_func = md_32x_interrupt_delegate(std::forward<T>(args)...); }
- template <typename... T> void set_md_32x_scanline_helper(T &&... args) { m_32x_scanline_helper_func = md_32x_scanline_helper_delegate(std::forward<T>(args)...); }
+ template <typename Object> void set_md_32x_scanline(Object &&cb) { m_32x_scanline_func = std::forward<Object>(cb); }
+ template <typename Object> void set_md_32x_interrupt(Object &&cb) { m_32x_interrupt_func = std::forward<Object>(cb); }
+ template <typename Object> void set_md_32x_scanline_helper(Object &&cb) { m_32x_scanline_helper_func = std::forward<Object>(cb); }
int m_use_alt_timing; // use MAME scanline timer instead, render only one scanline to a single line buffer, to be rendered by a partial update call.. experimental
@@ -186,6 +228,7 @@ private:
address_space *m_space68k;
required_device<m68000_base_device> m_cpu68k;
+ required_device<sn76496_base_device> m_snsnd;
};
diff --git a/src/devices/video/cdp1862.cpp b/src/devices/video/cdp1862.cpp
index ba4375c54de..78985db211c 100644
--- a/src/devices/video/cdp1862.cpp
+++ b/src/devices/video/cdp1862.cpp
@@ -126,7 +126,7 @@ void cdp1862_device::device_reset()
// dma_w -
//-------------------------------------------------
-void cdp1862_device::dma_w(uint8_t data)
+WRITE8_MEMBER( cdp1862_device::dma_w )
{
int rd = 1, bd = 1, gd = 1;
int sx = screen().hpos() + 4;
diff --git a/src/devices/video/cdp1862.h b/src/devices/video/cdp1862.h
index 8ab9716642b..0ee90fa3bd6 100644
--- a/src/devices/video/cdp1862.h
+++ b/src/devices/video/cdp1862.h
@@ -49,7 +49,7 @@ public:
void set_luminance(double r, double b, double g, double bkg) { m_lum_r = r; m_lum_b = b; m_lum_g = g; m_lum_bkg = bkg; }
void set_chrominance(double r, double b, double g, double bkg) { m_chr_r = r; m_chr_b = b; m_chr_g = g; m_chr_bkg = bkg; }
- void dma_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( dma_w );
DECLARE_WRITE_LINE_MEMBER( bkg_w );
DECLARE_WRITE_LINE_MEMBER( con_w );
diff --git a/src/devices/video/cesblit.h b/src/devices/video/cesblit.h
index d535921ef6b..f22f16df260 100644
--- a/src/devices/video/cesblit.h
+++ b/src/devices/video/cesblit.h
@@ -11,6 +11,21 @@
#pragma once
+/***************************************************************************
+ INTERFACE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_CESBLIT_ADD(_tag, _screen, _clock) \
+ MCFG_DEVICE_ADD(_tag, CESBLIT, _clock) \
+ MCFG_VIDEO_SET_SCREEN(_screen)
+
+#define MCFG_CESBLIT_MAP MCFG_DEVICE_PROGRAM_MAP
+
+#define MCFG_CESBLIT_COMPUTE_ADDR(_compute_addr) \
+ downcast<cesblit_device &>(*device).set_compute_addr(_compute_addr);
+
+#define MCFG_CESBLIT_IRQ_CB(_devcb) \
+ downcast<cesblit_device &>(*device).set_irq_callback(DEVCB_##_devcb);
/***************************************************************************
TYPE DEFINITIONS
@@ -26,18 +41,11 @@ public:
typedef int (*compute_addr_t) (uint16_t reg_low, uint16_t reg_mid, uint16_t reg_high);
// construction/destruction
- template <typename T>
- cesblit_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&screen_tag)
- : cesblit_device(mconfig, tag, owner, clock)
- {
- set_screen(std::forward<T>(screen_tag));
- }
-
cesblit_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration
void set_compute_addr(compute_addr_t compute_addr) { m_compute_addr = compute_addr; }
- auto irq_callback() { return m_blit_irq_cb.bind(); }
+ template <class Object> devcb_base &set_irq_callback(Object &&cb) { return m_blit_irq_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE16_MEMBER(color_w);
DECLARE_WRITE16_MEMBER(addr_hi_w);
diff --git a/src/devices/video/crt9007.cpp b/src/devices/video/crt9007.cpp
index ff3893a4ca6..40279d1316a 100644
--- a/src/devices/video/crt9007.cpp
+++ b/src/devices/video/crt9007.cpp
@@ -222,8 +222,7 @@ const int STATUS_LIGHT_PEN_UPDATE = 0x20;
// default address map
void crt9007_device::crt9007(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, 0x3fff).ram();
+ map(0x0000, 0x3fff).ram();
}
@@ -457,7 +456,7 @@ crt9007_device::crt9007_device(const machine_config &mconfig, const char *tag, d
device_t(mconfig, CRT9007, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, address_map_constructor(FUNC(crt9007_device::crt9007), this)),
+ m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, address_map_constructor(), address_map_constructor(FUNC(crt9007_device::crt9007), this)),
m_write_int(*this),
m_write_dmar(*this),
m_write_hs(*this),
diff --git a/src/devices/video/crt9021.h b/src/devices/video/crt9021.h
index 65de1032a64..2a7e513fdf2 100644
--- a/src/devices/video/crt9021.h
+++ b/src/devices/video/crt9021.h
@@ -38,6 +38,10 @@
#define CRT9021_DRAW_CHARACTER_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, int y, int x, uint8_t video, int intout)
+#define MCFG_CRT9021_DRAW_CHARACTER_CALLBACK_OWNER(_class, _method) \
+ downcast<crt9021_device &>(*device).set_display_callback(crt9021_device::draw_character_delegate(&_class::_method, #_class "::" #_method, this));
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -53,7 +57,7 @@ public:
// construction/destruction
crt9021_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template <typename... T> void set_display_callback(T &&... args) { m_display_cb = draw_character_delegate(std::forward<T>(args)...); }
+ template <typename Object> void set_display_callback(Object &&cb) { m_display_cb = std::forward<Object>(cb); }
void write(uint8_t data) { m_data = data; }
DECLARE_WRITE8_MEMBER( write ) { write(data); }
diff --git a/src/devices/video/crt9028.cpp b/src/devices/video/crt9028.cpp
deleted file mode 100644
index 31c0c748420..00000000000
--- a/src/devices/video/crt9028.cpp
+++ /dev/null
@@ -1,371 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/**********************************************************************
-
- Standard Microsystems CRT9028/9128 Video Terminal Logic Controller
-
- The CRT 9028 and CRT 9128 are single-chip terminal-oriented video
- processors. The two differ from each other in their bus protocol
- for accessing the address, data and status registers: the 9028 has
- separate RD and WR strobes for an 8051 or similar microcontroller,
- while the 9128 replaces these with DS and R/W inputs that are more
- Z8-oriented. A separate address/data bus connects to a 2Kx8 static
- RAM or similar as display memory.
-
- The internal 128-character set is mask-programmed, as are all
- screen timings, with alternate vertical timings to allow operation
- at either 60 Hz or 50 Hz. Mask parameters also determine the
- polarity of the sync signals, the positioning of the underline
- attribute and cursor and the dot patterns used for 6-segment wide
- (block) graphics and 4-segment thin (line) graphics.
-
- TODO: implement timing and display functions
-
-**********************************************************************/
-
-#include "emu.h"
-#include "video/crt9028.h"
-#include "screen.h"
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-// device type definition
-DEFINE_DEVICE_TYPE(CRT9028_000, crt9028_000_device, "crt9028_000", "CRT9028-000 VTLC")
-
-//**************************************************************************
-// DEVICE IMPLEMENTATION
-//**************************************************************************
-
-//-------------------------------------------------
-// crt9028_device - constructor
-//-------------------------------------------------
-
-crt9028_device::crt9028_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock,
- int dots_per_char, int chars_per_row, int horiz_blanking, int hsync_delay, int hsync_width, bool hsync_active,
- int char_rows, int scans_per_char, bool vsync_active,
- int vert_blanking, int vsync_delay, bool vsync_width,
- int alt_vert_blanking, int alt_vsync_delay, bool alt_vsync_width,
- int csync_delay, int csync_width, int underline,
- u16 wide_gfx_seg1_4, u16 wide_gfx_seg2_5, u16 wide_gfx_seg3_6, u8 wide_gfx_pattern,
- u16 thin_gfx_seg1, u16 thin_gfx_seg2, u16 thin_gfx_seg3, u16 thin_gfx_seg4,
- u8 thin_gfx_dots1, u8 thin_gfx_dots2, u8 thin_gfx_dots3, u8 thin_gfx_dots4)
- : device_t(mconfig, type, tag, owner, clock)
- , device_memory_interface(mconfig, *this)
- , device_video_interface(mconfig, *this)
- , m_space_config("charram", ENDIANNESS_LITTLE, 8, 11, 0)
- , m_charset(*this, "charset")
- , m_hsync_callback(*this)
- , m_vsync_callback(*this)
- , m_dots_per_char(dots_per_char)
- , m_chars_per_row(chars_per_row)
- , m_horiz_blanking(horiz_blanking)
- , m_hsync_delay(hsync_delay)
- , m_hsync_width(hsync_width)
- , m_hsync_active(hsync_active)
- , m_char_rows(char_rows)
- , m_scans_per_char(scans_per_char)
- , m_vsync_active(vsync_active)
- , m_vert_blanking{vert_blanking, alt_vert_blanking}
- , m_vsync_delay{vsync_delay, alt_vsync_delay}
- , m_vsync_width{vsync_width, alt_vsync_width}
- , m_csync_delay(csync_delay)
- , m_csync_width(csync_width)
- , m_underline(underline)
- , m_wide_gfx_seg{wide_gfx_seg1_4, wide_gfx_seg2_5, wide_gfx_seg3_6}
- , m_wide_gfx_pattern(wide_gfx_pattern)
- , m_thin_gfx_seg{thin_gfx_seg1, thin_gfx_seg2, thin_gfx_seg3, thin_gfx_seg4}
- , m_thin_gfx_dots{thin_gfx_dots1, thin_gfx_dots2, thin_gfx_dots3, thin_gfx_dots4}
- , m_address_register(0)
-{
- // Mostly unused now
- (void)m_hsync_delay;
- (void)m_hsync_width;
- (void)m_hsync_active;
- (void)m_vsync_active;
- (void)m_vsync_delay;
- (void)m_vsync_width;
- (void)m_csync_delay;
- (void)m_csync_width;
- (void)m_underline;
- (void)m_wide_gfx_seg;
- (void)m_wide_gfx_pattern;
- (void)m_thin_gfx_seg;
- (void)m_thin_gfx_dots;
-}
-
-
-//-------------------------------------------------
-// crt9028_000_device - constructor
-//-------------------------------------------------
-
-crt9028_000_device::crt9028_000_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : crt9028_device(mconfig, CRT9028_000, tag, owner, clock,
- 7, 80, 20, 4, 8, false,
- 24, 10, false,
- 20, 4, 8,
- 72, 30, 10,
- 2, 8, 9,
- 0x3c0, 0x038, 0x007, 0x0f,
- 0x3e0, 0x020, 0x03f, 0x020,
- 0x10, 0xff, 0x10, 0xff)
-{
-}
-
-
-//-------------------------------------------------
-// device_config_complete - finalise device
-// configuration
-//-------------------------------------------------
-
-void crt9028_device::device_config_complete()
-{
- if (!has_screen())
- return;
-
- if (screen().refresh_attoseconds() == 0)
- {
- int visible_scan_lines = m_char_rows * m_scans_per_char;
- screen().set_raw(clock(), m_dots_per_char * (m_chars_per_row + m_horiz_blanking), 0, m_dots_per_char * m_chars_per_row,
- visible_scan_lines + m_vert_blanking[0], 0, visible_scan_lines);
- }
-
- if (!screen().has_screen_update())
- screen().set_screen_update(screen_update_rgb32_delegate(FUNC(crt9028_device::screen_update), this));
-}
-
-
-//-------------------------------------------------
-// memory_space_config - return the configuration
-// for the address spaces
-//-------------------------------------------------
-
-device_memory_interface::space_config_vector crt9028_device::memory_space_config() const
-{
- return space_config_vector{std::make_pair(0, &m_space_config)};
-}
-
-
-//-------------------------------------------------
-// device_resolve_objects - resolve objects that
-// may be needed for other devices to set
-// initial conditions at start time
-//-------------------------------------------------
-
-void crt9028_device::device_resolve_objects()
-{
- m_hsync_callback.resolve_safe();
- m_vsync_callback.resolve_safe();
-}
-
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void crt9028_device::device_start()
-{
- m_space = &space(0);
-
- save_item(NAME(m_address_register));
-}
-
-
-//-------------------------------------------------
-// screen_update - screen update method
-//-------------------------------------------------
-
-u32 crt9028_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
-{
- return 0;
-}
-
-
-//-------------------------------------------------
-// chip_reset - software reset command
-//-------------------------------------------------
-
-void crt9028_device::chip_reset()
-{
- logerror("%s: Chip reset\n", machine().describe_context());
-}
-
-
-//-------------------------------------------------
-// status_r - read status register
-//-------------------------------------------------
-
-u8 crt9028_device::status_r()
-{
- return 0x80;
-}
-
-
-//-------------------------------------------------
-// filadd_w - set fill address register
-//-------------------------------------------------
-
-void crt9028_device::filadd_w(u8 data)
-{
- logerror("%s: Fill address = %03X\n", machine().describe_context(), data << 4);
-}
-
-
-//-------------------------------------------------
-// tosadd_w - set top of screen address register
-//-------------------------------------------------
-
-void crt9028_device::tosadd_w(u8 data)
-{
- logerror("%s: Top of screen address = %03X\n", machine().describe_context(), data << 4);
-}
-
-
-//-------------------------------------------------
-// curlo_w - set cursor low register
-//-------------------------------------------------
-
-void crt9028_device::curlo_w(u8 data)
-{
- logerror("%s: Cursor low = %02X\n", machine().describe_context(), data);
-}
-
-
-//-------------------------------------------------
-// curhi_w - set cursor high/scroll register
-//-------------------------------------------------
-
-void crt9028_device::curhi_w(u8 data)
-{
- logerror("%s: Cursor high = %02X\n", machine().describe_context(), data);
-}
-
-
-//-------------------------------------------------
-// attdat_w - set attribute data register
-//-------------------------------------------------
-
-void crt9028_device::attdat_w(u8 data)
-{
- logerror("%s: Attribute data = %02X\n", machine().describe_context(), data);
-}
-
-
-//-------------------------------------------------
-// mode_w - set mode register
-//-------------------------------------------------
-
-void crt9028_device::mode_w(u8 data)
-{
- logerror("%s: Auto increment %sabled\n", machine().describe_context(), BIT(data, 7) ? "en" : "dis");
-}
-
-
-//-------------------------------------------------
-// character_r - read character from memory
-//-------------------------------------------------
-
-u8 crt9028_device::character_r()
-{
- return 0;
-}
-
-
-//-------------------------------------------------
-// character_w - write character to memory
-//-------------------------------------------------
-
-void crt9028_device::character_w(u8 data)
-{
- logerror("%s: Character = %02X\n", machine().describe_context(), data);
-}
-
-
-//-------------------------------------------------
-// read - read from data or status register
-//-------------------------------------------------
-
-u8 crt9028_device::read(offs_t offset)
-{
- if (BIT(offset, 0))
- return status_r();
- else if (m_address_register == 0xe)
- return character_r();
- else
- {
- if (!machine().side_effects_disabled())
- logerror("Read from unknown or write-only register %X\n", m_address_register);
- return 0;
- }
-}
-
-
-//-------------------------------------------------
-// write - write to data or address register
-//-------------------------------------------------
-
-void crt9028_device::write(offs_t offset, u8 data)
-{
- if (BIT(offset, 0))
- m_address_register = data & 0x0f;
- else switch (m_address_register)
- {
- case 0x6:
- chip_reset();
- break;
-
- case 0x8:
- tosadd_w(data);
- break;
-
- case 0x9:
- curlo_w(data);
- break;
-
- case 0xa:
- curhi_w(data);
- break;
-
- case 0xb:
- filadd_w(data);
- break;
-
- case 0xc:
- attdat_w(data);
- break;
-
- case 0xd:
- character_w(data);
- break;
-
- case 0xe:
- mode_w(data);
- break;
-
- default:
- logerror("%s: Unknown register %X = %02X\n", machine().describe_context(), m_address_register, data);
- break;
- }
-}
-
-
-//**************************************************************************
-// INTERNAL ROM
-//**************************************************************************
-
-ROM_START(crt9028_000)
- ROM_REGION(0x400, "charset", 0)
- ROM_LOAD("crt9028_000.bin", 0x000, 0x400, NO_DUMP)
-ROM_END
-
-
-//-------------------------------------------------
-// rom_region - return a pointer to the implicit
-// rom region description for this device
-//-------------------------------------------------
-
-const tiny_rom_entry *crt9028_000_device::device_rom_region() const
-{
- return ROM_NAME(crt9028_000);
-}
diff --git a/src/devices/video/crt9028.h b/src/devices/video/crt9028.h
deleted file mode 100644
index f0696519ed9..00000000000
--- a/src/devices/video/crt9028.h
+++ /dev/null
@@ -1,142 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:AJR
-/**********************************************************************
-
- Standard Microsystems CRT9028/9128 Video Terminal Logic Controller
-
-***********************************************************************
- _____ _____
- DA8 1 |* \__/ | 40 DA7
- DA9 2 | | 39 DA6
- DA10 3 | | 38 DA5
- GND 4 | | 37 DA4
- XTAL2 5 | | 36 DA3
- XTAL1 6 | | 35 DA2
- /VIDEO 7 | | 34 DA1
- INTOUT 8 | | 33 DA0
- /DWR 9 | | 32 DB7
- DD0 10 | CRT 9028 | 31 DB6
- DD1 11 | CRT 9128 | 30 DB5
- DD2 12 | | 29 DB4
- DD3 13 | | 28 DB3
- DD4 14 | | 27 DB2
- DD5 15 | | 26 DB1
- DD6 16 | | 25 DB0
- DD7 17 | | 24 A/D
- HSYNC 18 | | 23 /RD or /DS
- VSYNC 19 | | 22 /WR or R/W
- CSYNC 20 |______________| 21 VCC
-
-**********************************************************************/
-
-#ifndef MAME_VIDEO_CRT9028_H
-#define MAME_VIDEO_CRT9028_H
-
-#pragma once
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> crt9028_device
-
-class crt9028_device : public device_t, public device_memory_interface, public device_video_interface
-{
-public:
- // device configuration
- auto hsync_callback() { return m_hsync_callback.bind(); }
- auto vsync_callback() { return m_hsync_callback.bind(); }
-
- // read/write handlers
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
-
- // screen update method
- u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
-
-protected:
- // base type constructor
- crt9028_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock,
- int dots_per_char, int chars_per_row, int horiz_blanking, int hsync_delay, int hsync_width, bool hsync_active,
- int char_rows, int scans_per_char, bool vsync_active,
- int vert_blanking, int vsync_delay, bool vsync_width,
- int alt_vert_blanking, int alt_vsync_delay, bool alt_vsync_width,
- int csync_delay, int csync_width, int underline,
- u16 wide_gfx_seg1_4, u16 wide_gfx_seg2_5, u16 wide_gfx_seg3_6, u8 wide_gfx_pattern,
- u16 thin_gfx_seg1, u16 thin_gfx_seg2, u16 thin_gfx_seg3, u16 thin_gfx_seg4,
- u8 thin_gfx_dots1, u8 thin_gfx_dots2, u8 thin_gfx_dots3, u8 thin_gfx_dots4);
-
- // device-specific overrides
- virtual void device_config_complete() override;
- virtual void device_resolve_objects() override;
- virtual void device_start() override;
-
- // device_memory_interface overrides
- virtual space_config_vector memory_space_config() const override;
-
-private:
- // register helpers
- void chip_reset();
- u8 status_r();
- void filadd_w(u8 data);
- void tosadd_w(u8 data);
- void curlo_w(u8 data);
- void curhi_w(u8 data);
- void attdat_w(u8 data);
- void mode_w(u8 data);
- u8 character_r();
- void character_w(u8 data);
-
- // address space for display memory
- const address_space_config m_space_config;
- address_space *m_space;
-
- // internal character set
- required_region_ptr<u8> m_charset;
-
- // timing callbacks
- devcb_write_line m_hsync_callback;
- devcb_write_line m_vsync_callback;
-
- // mask parameters
- const int m_dots_per_char;
- const int m_chars_per_row;
- const int m_horiz_blanking;
- const int m_hsync_delay;
- const int m_hsync_width;
- const bool m_hsync_active;
- const int m_char_rows;
- const int m_scans_per_char;
- const bool m_vsync_active;
- const int m_vert_blanking[2];
- const int m_vsync_delay[2];
- const int m_vsync_width[2];
- const int m_csync_delay;
- const int m_csync_width;
- const int m_underline;
- const u16 m_wide_gfx_seg[3];
- const u8 m_wide_gfx_pattern;
- const u16 m_thin_gfx_seg[4];
- const u8 m_thin_gfx_dots[4];
-
- // internal state
- u8 m_address_register;
-};
-
-// ======================> crt9028_000_device
-
-class crt9028_000_device : public crt9028_device
-{
-public:
- // device constructor
- crt9028_000_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-
-protected:
- // device-specific overrides
- virtual const tiny_rom_entry *device_rom_region() const override;
-};
-
-// device type declarations
-DECLARE_DEVICE_TYPE(CRT9028_000, crt9028_000_device)
-
-#endif // MAME_VIDEO_CRT9028_H
diff --git a/src/devices/video/crtc_ega.cpp b/src/devices/video/crtc_ega.cpp
index 7d03b09f131..01ee629ad43 100644
--- a/src/devices/video/crtc_ega.cpp
+++ b/src/devices/video/crtc_ega.cpp
@@ -51,13 +51,13 @@ void crtc_ega_device::device_post_load()
}
-void crtc_ega_device::address_w(uint8_t data)
+WRITE8_MEMBER( crtc_ega_device::address_w )
{
m_register_address_latch = data & 0x1f;
}
-uint8_t crtc_ega_device::register_r()
+READ8_MEMBER( crtc_ega_device::register_r )
{
uint8_t ret = 0;
@@ -78,7 +78,7 @@ uint8_t crtc_ega_device::register_r()
}
-void crtc_ega_device::register_w(uint8_t data)
+WRITE8_MEMBER( crtc_ega_device::register_w )
{
LOG("%s CRTC_EGA: reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
diff --git a/src/devices/video/crtc_ega.h b/src/devices/video/crtc_ega.h
index 9d03177b494..e995cdf8a30 100644
--- a/src/devices/video/crtc_ega.h
+++ b/src/devices/video/crtc_ega.h
@@ -17,6 +17,34 @@
#define CRTC_EGA_END_UPDATE(_name) void _name(bitmap_ind16 &bitmap, const rectangle &cliprect)
+
+#define MCFG_CRTC_EGA_SET_SCREEN MCFG_VIDEO_SET_SCREEN
+
+#define MCFG_CRTC_EGA_BEGIN_UPDATE_CB(_class, _method) \
+ downcast<crtc_ega_device &>(*device).set_begin_update_callback(crtc_ega_device::begin_update_delegate(&_class::_method, #_class "::" #_method, this));
+
+#define MCFG_CRTC_EGA_ROW_UPDATE_CB(_class, _method) \
+ downcast<crtc_ega_device &>(*device).set_row_update_callback(crtc_ega_device::row_update_delegate(&_class::_method, #_class "::" #_method, this));
+
+#define MCFG_CRTC_EGA_END_UPDATE_CB(_class, _method) \
+ downcast<crtc_ega_device &>(*device).set_end_update_callback(crtc_ega_device::end_update_delegate(&_class::_method, #_class "::" #_method, this));
+
+#define MCFG_CRTC_EGA_HPIXELS_PER_COLUMN(_pix) \
+ downcast<crtc_ega_device &>(*device).config_set_hpixels_per_column(_pix);
+
+#define MCFG_CRTC_EGA_RES_OUT_DE_CB(_devcb) \
+ downcast<crtc_ega_device &>(*device).set_res_out_de_callback(DEVCB_##_devcb);
+
+#define MCFG_CRTC_EGA_RES_OUT_HSYNC_CB(_devcb) \
+ downcast<crtc_ega_device &>(*device).set_res_out_hsync_callback(DEVCB_##_devcb);
+
+#define MCFG_CRTC_EGA_RES_OUT_VSYNC_CB(_devcb) \
+ downcast<crtc_ega_device &>(*device).set_res_out_vsync_callback(DEVCB_##_devcb);
+
+#define MCFG_CRTC_EGA_RES_OUT_VBLANK_CB(_devcb) \
+ downcast<crtc_ega_device &>(*device).set_res_out_vblank_callback(DEVCB_##_devcb);
+
+
class crtc_ega_device : public device_t,
public device_video_interface
{
@@ -29,24 +57,24 @@ public:
crtc_ega_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto res_out_de_callback() { return m_res_out_de_cb.bind(); }
- auto res_out_hsync_callback() { return m_res_out_hsync_cb.bind(); }
- auto res_out_vsync_callback() { return m_res_out_vsync_cb.bind(); }
- auto res_out_vblank_callback() { return m_res_out_vblank_cb.bind(); }
+ template <class Object> devcb_base &set_res_out_de_callback(Object &&cb) { return m_res_out_de_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_res_out_hsync_callback(Object &&cb) { return m_res_out_hsync_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_res_out_vsync_callback(Object &&cb) { return m_res_out_vsync_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_res_out_vblank_callback(Object &&cb) { return m_res_out_vblank_cb.set_callback(std::forward<Object>(cb)); }
- template <typename... T> void set_begin_update_callback(T &&... args) { m_begin_update_cb = begin_update_delegate(std::forward<T>(args)...); }
- template <typename... T> void set_row_update_callback(T &&... args) { m_row_update_cb = row_update_delegate(std::forward<T>(args)...); }
- template <typename... T> void set_end_update_callback(T &&... args) { m_end_update_cb = end_update_delegate(std::forward<T>(args)...); }
+ template <typename Object> void set_begin_update_callback(Object &&cb) { m_begin_update_cb = std::forward<Object>(cb); }
+ template <typename Object> void set_row_update_callback(Object &&cb) { m_row_update_cb = std::forward<Object>(cb); }
+ template <typename Object> void set_end_update_callback(Object &&cb) { m_end_update_cb = std::forward<Object>(cb); }
void config_set_hpixels_per_column(int hpixels_per_column) { m_hpixels_per_column = hpixels_per_column; }
/* select one of the registers for reading or writing */
- void address_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( address_w );
/* read from the currently selected register */
- uint8_t register_r();
+ DECLARE_READ8_MEMBER( register_r );
/* write to the currently selected register */
- void register_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( register_w );
/* return the current value on the MA0-MA15 pins */
uint16_t get_ma();
diff --git a/src/devices/video/decsfb.cpp b/src/devices/video/decsfb.cpp
deleted file mode 100644
index 166cc98f62b..00000000000
--- a/src/devices/video/decsfb.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:R. Belmont
-
-/*
- * An emulation of the Digital Equipment Corporation SFB "Smart Frame Buffer" chip
- *
- * Used in:
- *
- * Accelerated TURBOChannel video cards for DECstations and AlphaStations
- * On-board on some DECstations
- * On-board on many AlphaStations
- *
- * Sources:
- *
- * http://www.hpl.hp.com/techreports/Compaq-DEC/WRL-93-1.pdf
- *
- */
-
-#include "emu.h"
-#include "decsfb.h"
-
-#define MODE_SIMPLE 0
-#define MODE_OPAQUESTIPPLE 1
-#define MODE_OPAQUELINE 2
-#define MODE_TRANSPARENTSTIPPLE 5
-#define MODE_TRANSPARENTLINE 6
-#define MODE_COPY 7
-
-#define LOG_GENERAL (1U << 0)
-#define LOG_REG (1U << 1)
-#define LOG_IRQ (1U << 2)
-
-//#define VERBOSE (LOG_GENERAL|LOG_REG||LOG_IRQ)
-
-#include "logmacro.h"
-
-DEFINE_DEVICE_TYPE(DECSFB, decsfb_device, "decsfb", "Digital Equipment Corporation Smart Frame Buffer")
-
-decsfb_device::decsfb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, DECSFB, tag, owner, clock),
- m_int_cb(*this)
-{
-}
-
-void decsfb_device::device_start()
-{
- m_int_cb.resolve_safe();
-
- save_item(NAME(m_vram));
- save_item(NAME(m_regs));
- save_item(NAME(m_copy_src));
-}
-
-void decsfb_device::device_reset()
-{
- m_copy_src = 1;
-}
-
-/*
- 0x100000 copy register 0
- 0x100004 copy register 1
- 0x100008 copy register 2
- 0x10000C copy register 3
- 0x100010 copy register 4
- 0x100014 copy register 5
- 0x100018 copy register 6
- 0x10001C copy register 7
- 0x100020 foreground register
- 0x100024 background register
- 0x100028 plane mask
- 0x10002C pixel mask
- 0x100030 cxt mode
- 0x100034 boolean operation
- 0x100038 pixel shift
- 0x10003C line address
- 0x100040 bresh 1
- 0x100044 bresh 2
- 0x100048 bresh 3
- 0x10004C bresh continue
- 0x100050 deep register
- 0x100054 start register
- 0x100058 Clear Interrupt
- 0x10005C reserved 2
- 0x100060 refresh count
- 0x100064 video horiz
- 0x100068 video vertical
- 0x10006C refresh base
- 0x100070 video valid
- 0x100074 Interrupt Enable
-*/
-
-READ32_MEMBER(decsfb_device::read)
-{
- return m_regs[offset];
-}
-
-WRITE32_MEMBER(decsfb_device::write)
-{
- COMBINE_DATA(&m_regs[offset]);
-
- if ((offset == (0x30/4)) && (data = 7))
- {
- m_copy_src = 1;
- }
-}
-
-READ32_MEMBER(decsfb_device::vram_r)
-{
- return m_vram[offset];
-}
-
-WRITE32_MEMBER(decsfb_device::vram_w)
-{
- switch (m_regs[0x30/4])
- {
- case MODE_SIMPLE: // simple
- COMBINE_DATA(&m_vram[offset]);
- break;
-
- case MODE_TRANSPARENTSTIPPLE:
- {
- uint8_t *pVRAM = (uint8_t *)&m_vram[offset];
- uint8_t fgs[4];
-
- fgs[0] = m_regs[0x20/4] >> 24;
- fgs[1] = (m_regs[0x20/4] >> 16) & 0xff;
- fgs[2] = (m_regs[0x20/4] >> 8) & 0xff;
- fgs[3] = m_regs[0x20/4] & 0xff;
- for (int x = 0; x < 32; x++)
- {
- if (data & (1<<(31-x)))
- {
- pVRAM[x] = fgs[x & 3];
- }
- }
- }
- break;
-
- case MODE_COPY:
- {
- uint8_t *pVRAM = (uint8_t *)&m_vram[offset];
- uint8_t *pBuffer = (uint8_t *)&m_regs[0]; // first 8 32-bit regs are the copy buffer
-
- if (m_copy_src)
- {
- m_copy_src = 0;
-
- for (int x = 0; x < 32; x++)
- {
- if (data & (1<<(31-x)))
- {
- pBuffer[x] = pVRAM[x];
- }
- }
- }
- else
- {
- m_copy_src = 1;
-
- for (int x = 0; x < 32; x++)
- {
- if (data & (1<<(31-x)))
- {
- pVRAM[x] = pBuffer[x];
- }
- }
- }
- }
- break;
-
- default:
- logerror("SFB: Unsupported VRAM write %08x (mask %08x) at %08x in mode %x\n", data, mem_mask, offset<<2, m_regs[0x30/4]);
- break;
- }
-}
diff --git a/src/devices/video/decsfb.h b/src/devices/video/decsfb.h
deleted file mode 100644
index 52e6687ea40..00000000000
--- a/src/devices/video/decsfb.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:R. Belmont
-
-#ifndef MAME_VIDEO_DECSFB_H
-#define MAME_VIDEO_DECSFB_H
-
-#pragma once
-
-class decsfb_device : public device_t
-{
-public:
- decsfb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- auto int_cb() { return m_int_cb.bind(); }
-
- DECLARE_READ32_MEMBER( read );
- DECLARE_WRITE32_MEMBER( write );
- DECLARE_READ32_MEMBER( vram_r );
- DECLARE_WRITE32_MEMBER( vram_w );
-
- u32 *get_vram() { return m_vram; }
-
-protected:
- // standard device_interface overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
- devcb_write_line m_int_cb;
-
-private:
- u32 m_vram[0x200000/4];
- u32 m_regs[0x80];
- int m_copy_src;
-};
-
-DECLARE_DEVICE_TYPE(DECSFB, decsfb_device)
-
-#endif // MAME_VIDEO_DECSFB_H
diff --git a/src/devices/video/dl1416.h b/src/devices/video/dl1416.h
index 446e37201dd..2f98355b95d 100644
--- a/src/devices/video/dl1416.h
+++ b/src/devices/video/dl1416.h
@@ -27,12 +27,24 @@ DECLARE_DEVICE_TYPE(DL1416T, dl1416_device)
/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_DL1414_UPDATE_HANDLER(_devcb) \
+ downcast<dl1414_device &>(*device).set_update_handler(DEVCB_##_devcb);
+
+#define MCFG_DL1416_UPDATE_HANDLER(_devcb) \
+ downcast<dl1414_device &>(*device).set_update_handler(DEVCB_##_devcb);
+
+
+/***************************************************************************
TYPE DECLARATIONS
***************************************************************************/
class dl1414_device : public device_t
{
public:
+ template <typename Object> devcb_base &set_update_handler(Object &&cb) { return m_update_cb.set_callback(std::forward<Object>(cb)); }
auto update() { return m_update_cb.bind(); }
// signal-level interface
diff --git a/src/devices/video/dm9368.h b/src/devices/video/dm9368.h
index fb376541a07..ae9956de30b 100644
--- a/src/devices/video/dm9368.h
+++ b/src/devices/video/dm9368.h
@@ -23,6 +23,19 @@
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_DM9368_UPDATE_CALLBACK(cb) \
+ downcast<dm9368_device &>(*device).set_update_callback(DEVCB_##cb);
+
+#define MCFG_DM9368_RBO_CALLBACK(cb) \
+ downcast<dm9368_device &>(*device).set_rbo_callback(DEVCB_##cb);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -32,6 +45,8 @@
class dm9368_device : public device_t
{
public:
+ template <typename Obj> devcb_base &set_update_callback(Obj &&cb) { return m_update_cb.set_callback(std::forward<Obj>(cb)); }
+ template <typename Obj> devcb_base &set_rbo_callback(Obj &&cb) { return m_rbo_cb.set_callback(std::forward<Obj>(cb)); }
auto update_cb() { return m_update_cb.bind(); }
auto rbo_cb() { return m_rbo_cb.bind(); }
diff --git a/src/devices/video/ef9340_1.h b/src/devices/video/ef9340_1.h
index 4d687d227d6..88b1d91a163 100644
--- a/src/devices/video/ef9340_1.h
+++ b/src/devices/video/ef9340_1.h
@@ -15,18 +15,16 @@
#pragma once
+
+#define MCFG_EF9340_1_ADD(_tag, _clock, _screen_tag) \
+ MCFG_DEVICE_ADD(_tag, EF9340_1, _clock) \
+ MCFG_VIDEO_SET_SCREEN(_screen_tag)
+
class ef9340_1_device : public device_t,
public device_video_interface
{
public:
// construction/destruction
- template <typename T>
- ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&screen_tag)
- : ef9340_1_device(mconfig, tag, owner, clock)
- {
- set_screen(std::forward<T>(screen_tag));
- }
-
ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
inline bitmap_ind16 *get_bitmap() { return &m_tmp_bitmap; }
diff --git a/src/devices/video/ef9345.cpp b/src/devices/video/ef9345.cpp
index 1daf7b5fde7..006d92855ba 100644
--- a/src/devices/video/ef9345.cpp
+++ b/src/devices/video/ef9345.cpp
@@ -35,8 +35,7 @@ DEFINE_DEVICE_TYPE(TS9347, ts9347_device, "ts9347", "TS9347")
// default address map
void ef9345_device::ef9345(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, 0x3fff).ram();
+ map(0x0000, 0x3fff).ram();
}
//-------------------------------------------------
@@ -114,7 +113,7 @@ ef9345_device::ef9345_device(const machine_config &mconfig, device_type type, co
device_t(mconfig, type, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(ef9345_device::ef9345), this)),
+ m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(), address_map_constructor(FUNC(ef9345_device::ef9345), this)),
m_charset(*this, DEVICE_SELF),
m_variant(variant),
m_palette(*this, finder_base::DUMMY_TAG)
@@ -213,7 +212,7 @@ void ef9345_device::device_timer(emu_timer &timer, device_timer_id id, int param
void ef9345_device::set_busy_flag(int period)
{
m_bf = 1;
- m_busy_timer->adjust(attotime::from_nsec(period));
+ m_busy_timer->adjust(attotime::from_usec(period));
}
// draw a char in 40 char line mode
@@ -754,7 +753,7 @@ void ef9345_device::ef9345_exec(uint8_t cmd)
{
case 0x00: //KRF: R1,R2,R3->ram
case 0x01: //KRF: R1,R2,R3->ram + increment
- set_busy_flag(4000);
+ set_busy_flag(4);
m_videoram->write_byte(a, m_registers[1]);
m_videoram->write_byte(a + 0x0800, m_registers[2]);
m_videoram->write_byte(a + 0x1000, m_registers[3]);
@@ -762,14 +761,14 @@ void ef9345_device::ef9345_exec(uint8_t cmd)
break;
case 0x02: //KRG: R1,R2->ram
case 0x03: //KRG: R1,R2->ram + increment
- set_busy_flag(5500);
+ set_busy_flag(5.5);
m_videoram->write_byte(a, m_registers[1]);
m_videoram->write_byte(a + 0x0800, m_registers[2]);
if (cmd&1) inc_x(7);
break;
case 0x08: //KRF: ram->R1,R2,R3
case 0x09: //KRF: ram->R1,R2,R3 + increment
- set_busy_flag(7500);
+ set_busy_flag(7.5);
m_registers[1] = m_videoram->read_byte(a);
m_registers[2] = m_videoram->read_byte(a + 0x0800);
m_registers[3] = m_videoram->read_byte(a + 0x1000);
@@ -777,14 +776,14 @@ void ef9345_device::ef9345_exec(uint8_t cmd)
break;
case 0x0a: //KRG: ram->R1,R2
case 0x0b: //KRG: ram->R1,R2 + increment
- set_busy_flag(7500);
+ set_busy_flag(7.5);
m_registers[1] = m_videoram->read_byte(a);
m_registers[2] = m_videoram->read_byte(a + 0x0800);
if (cmd&1) inc_x(7);
break;
case 0x30: //OCT: R1->RAM, main pointer
case 0x31: //OCT: R1->RAM, main pointer + inc
- set_busy_flag(4000);
+ set_busy_flag(4);
m_videoram->write_byte(indexram(7), m_registers[1]);
if (cmd&1)
@@ -796,7 +795,7 @@ void ef9345_device::ef9345_exec(uint8_t cmd)
break;
case 0x34: //OCT: R1->RAM, aux pointer
case 0x35: //OCT: R1->RAM, aux pointer + inc
- set_busy_flag(4000);
+ set_busy_flag(4);
m_videoram->write_byte(indexram(5), m_registers[1]);
if (cmd&1)
@@ -804,7 +803,7 @@ void ef9345_device::ef9345_exec(uint8_t cmd)
break;
case 0x38: //OCT: RAM->R1, main pointer
case 0x39: //OCT: RAM->R1, main pointer + inc
- set_busy_flag(4500);
+ set_busy_flag(4.5);
m_registers[1] = m_videoram->read_byte(indexram(7));
if (cmd&1)
@@ -817,7 +816,7 @@ void ef9345_device::ef9345_exec(uint8_t cmd)
break;
case 0x3c: //OCT: RAM->R1, aux pointer
case 0x3d: //OCT: RAM->R1, aux pointer + inc
- set_busy_flag(4500);
+ set_busy_flag(4.5);
m_registers[1] = m_videoram->read_byte(indexram(5));
if (cmd&1)
@@ -825,7 +824,7 @@ void ef9345_device::ef9345_exec(uint8_t cmd)
break;
case 0x50: //KRL: 80 uint8_t - 12 bits write
case 0x51: //KRL: 80 uint8_t - 12 bits write + inc
- set_busy_flag(12500);
+ set_busy_flag(12.5);
m_videoram->write_byte(a, m_registers[1]);
switch((a / 0x0800) & 1)
{
@@ -851,7 +850,7 @@ void ef9345_device::ef9345_exec(uint8_t cmd)
break;
case 0x58: //KRL: 80 uint8_t - 12 bits read
case 0x59: //KRL: 80 uint8_t - 12 bits read + inc
- set_busy_flag(11500);
+ set_busy_flag(11.5);
m_registers[1] = m_videoram->read_byte(a);
switch((a / 0x0800) & 1)
{
@@ -880,7 +879,7 @@ void ef9345_device::ef9345_exec(uint8_t cmd)
case 0x83: //IND: R1->PAT
case 0x84: //IND: R1->DOR
case 0x87: //IND: R1->ROR
- set_busy_flag(2000);
+ set_busy_flag(2);
switch(cmd&7)
{
case 1: m_tgs = m_registers[1]; break;
@@ -898,7 +897,7 @@ void ef9345_device::ef9345_exec(uint8_t cmd)
case 0x8b: //IND: PAT->R1
case 0x8c: //IND: DOR->R1
case 0x8f: //IND: ROR->R1
- set_busy_flag(3500);
+ set_busy_flag(3.5);
switch(cmd&7)
{
case 0: m_registers[1] = m_charset[indexrom(7) & 0x1fff]; break;
@@ -916,7 +915,7 @@ void ef9345_device::ef9345_exec(uint8_t cmd)
case 0x99: //VSM: vertical sync mask set
break;
case 0xb0: //INY: increment Y
- set_busy_flag(2000);
+ set_busy_flag(2);
inc_y(6);
m_state &= 0x8f; //reset S4(LXa), S5(LXm), S6(Al)
break;
@@ -937,7 +936,7 @@ void ef9345_device::ef9345_exec(uint8_t cmd)
uint8_t n = (cmd>>4) - 0x0c;
uint8_t r1 = (cmd&0x04) ? 7 : 5;
uint8_t r2 = (cmd&0x04) ? 5 : 7;
- int busy = 2000;
+ int busy = 2;
for(i = 0; i < 1280; i++)
{
@@ -960,7 +959,7 @@ void ef9345_device::ef9345_exec(uint8_t cmd)
inc_y(6);
}
- busy += 4000 * n;
+ busy += 4 * n;
}
m_state &= 0x8f; //reset S4(LXa), S5(LXm), S6(Al)
set_busy_flag(busy);
@@ -995,7 +994,7 @@ void ef9345_device::update_scanline(uint16_t scanline)
if (scanline == 250)
m_state &= 0xfb;
- set_busy_flag(104000);
+ set_busy_flag(104);
if (m_char_mode == MODE12x80 || m_char_mode == MODE8x80)
{
@@ -1048,7 +1047,7 @@ void ef9345_device::update_scanline(uint16_t scanline)
}
}
-uint8_t ef9345_device::data_r(offs_t offset)
+READ8_MEMBER( ef9345_device::data_r )
{
if (offset & 7)
return m_registers[offset & 7];
@@ -1061,7 +1060,7 @@ uint8_t ef9345_device::data_r(offs_t offset)
return m_state;
}
-void ef9345_device::data_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( ef9345_device::data_w )
{
m_registers[offset & 7] = data;
diff --git a/src/devices/video/ef9345.h b/src/devices/video/ef9345.h
index d36811e8a60..dfec7d080f2 100644
--- a/src/devices/video/ef9345.h
+++ b/src/devices/video/ef9345.h
@@ -15,6 +15,8 @@
#include "emupal.h"
+#define MCFG_EF9345_PALETTE(_palette_tag) \
+ downcast<ef9345_device &>(*device).set_palette_tag(_palette_tag);
//**************************************************************************
// TYPE DEFINITIONS
@@ -34,8 +36,8 @@ public:
template <typename T> void set_palette_tag(T &&tag) { m_palette.set_tag(std::forward<T>(tag)); }
// device interface
- uint8_t data_r(offs_t offset);
- void data_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( data_r );
+ DECLARE_WRITE8_MEMBER( data_w );
void update_scanline(uint16_t scanline);
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
diff --git a/src/devices/video/ef9364.cpp b/src/devices/video/ef9364.cpp
index 858b7309ca6..ec324ff0e52 100644
--- a/src/devices/video/ef9364.cpp
+++ b/src/devices/video/ef9364.cpp
@@ -35,8 +35,7 @@ DEFINE_DEVICE_TYPE(EF9364, ef9364_device, "ef9364", "Thomson EF9364")
//-------------------------------------------------
void ef9364_device::ef9364(address_map &map)
{
- if (!has_configured_map(0))
- map(0x00000, ef9364_device::TXTPLANE_MAX_SIZE * ef9364_device::MAX_TXTPLANES - 1).ram();
+ map(0x00000, ef9364_device::TXTPLANE_MAX_SIZE * ef9364_device::MAX_TXTPLANES - 1).ram();
}
//-------------------------------------------------
@@ -67,7 +66,7 @@ ef9364_device::ef9364_device(const machine_config &mconfig, const char *tag, dev
device_t(mconfig, EF9364, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
- m_space_config("textram", ENDIANNESS_LITTLE, 8, 12, 0, address_map_constructor(FUNC(ef9364_device::ef9364), this)),
+ m_space_config("textram", ENDIANNESS_LITTLE, 8, 12, 0, address_map_constructor(), address_map_constructor(FUNC(ef9364_device::ef9364), this)),
m_charset(*this, DEVICE_SELF),
m_palette(*this, finder_base::DUMMY_TAG)
{
diff --git a/src/devices/video/ef9364.h b/src/devices/video/ef9364.h
index 290ab8464df..1082173733c 100644
--- a/src/devices/video/ef9364.h
+++ b/src/devices/video/ef9364.h
@@ -15,6 +15,14 @@
#include "emupal.h"
+#define MCFG_EF9364_PALETTE(_palette_tag) \
+ downcast<ef9364_device &>(*device).set_palette_tag(_palette_tag);
+
+#define MCFG_EF9364_PAGES_CNT(_pages_number) \
+ downcast<ef9364_device &>(*device).set_nb_of_pages(_pages_number);
+
+#define MCFG_EF9364_IRQ_HANDLER(_devcb) \
+ downcast<ef9364_device &>(*device).set_irq_handler(DEVCB_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
diff --git a/src/devices/video/ef9365.cpp b/src/devices/video/ef9365.cpp
index 5abc7d2dde8..5023348c99e 100644
--- a/src/devices/video/ef9365.cpp
+++ b/src/devices/video/ef9365.cpp
@@ -168,8 +168,7 @@ const tiny_rom_entry *ef9365_device::device_rom_region() const
//-------------------------------------------------
void ef9365_device::ef9365(address_map &map)
{
- if (!has_configured_map(0))
- map(0x00000, ef9365_device::BITPLANE_MAX_SIZE * ef9365_device::MAX_BITPLANES - 1).ram();
+ map(0x00000, ef9365_device::BITPLANE_MAX_SIZE * ef9365_device::MAX_BITPLANES - 1).ram();
}
//-------------------------------------------------
@@ -201,7 +200,7 @@ ef9365_device::ef9365_device(const machine_config &mconfig, const char *tag, dev
device_t(mconfig, EF9365, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 18, 0, address_map_constructor(FUNC(ef9365_device::ef9365), this)),
+ m_space_config("videoram", ENDIANNESS_LITTLE, 8, 18, 0, address_map_constructor(), address_map_constructor(FUNC(ef9365_device::ef9365), this)),
m_charset(*this, "ef9365"),
m_palette(*this, finder_base::DUMMY_TAG),
m_irq_handler(*this)
@@ -1225,7 +1224,7 @@ void ef9365_device::update_scanline(uint16_t scanline)
// data_r: Registers read access callback
//-------------------------------------------------
-uint8_t ef9365_device::data_r(offs_t offset)
+READ8_MEMBER( ef9365_device::data_r )
{
unsigned char return_value;
@@ -1316,7 +1315,7 @@ uint8_t ef9365_device::data_r(offs_t offset)
// data_w: Registers write access callback
//-------------------------------------------------
-void ef9365_device::data_w(offs_t offset, uint8_t data)
+WRITE8_MEMBER( ef9365_device::data_w )
{
LOG("EF9365 [ %s ] <WR [ 0x%.2X ] - %s\n", register_names[offset&0xF],data, machine().describe_context() );
diff --git a/src/devices/video/ef9365.h b/src/devices/video/ef9365.h
index be22ae6339b..762989e6a03 100644
--- a/src/devices/video/ef9365.h
+++ b/src/devices/video/ef9365.h
@@ -15,6 +15,17 @@
#include "emupal.h"
+#define MCFG_EF936X_PALETTE(palette_tag) \
+ downcast<ef9365_device &>(*device).set_palette_tag(palette_tag);
+
+#define MCFG_EF936X_BITPLANES_CNT(bitplanes_number) \
+ downcast<ef9365_device &>(*device).set_nb_bitplanes((bitplanes_number));
+
+#define MCFG_EF936X_DISPLAYMODE(display_mode) \
+ downcast<ef9365_device &>(*device).set_display_mode((ef9365_device::display_mode));
+
+#define MCFG_EF936X_IRQ_HANDLER(cb) \
+ downcast<ef9365_device &>(*device).set_irq_handler((DEVCB_##cb));
//**************************************************************************
// TYPE DEFINITIONS
@@ -43,11 +54,11 @@ public:
template <typename T> void set_palette_tag(T &&tag) { m_palette.set_tag(std::forward<T>(tag)); }
void set_nb_bitplanes(int nb_bitplanes );
void set_display_mode(int display_mode );
- auto irq_handler() { return m_irq_handler.bind(); }
+ template<class Object> devcb_base &set_irq_handler(Object object) { return m_irq_handler.set_callback(std::forward<Object>(object)); }
// device interface
- uint8_t data_r(offs_t offset);
- void data_w(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( data_r );
+ DECLARE_WRITE8_MEMBER( data_w );
void update_scanline(uint16_t scanline);
void set_color_filler( uint8_t color );
diff --git a/src/devices/video/epic12.h b/src/devices/video/epic12.h
index 287dc08ebb3..a8fe41b069f 100644
--- a/src/devices/video/epic12.h
+++ b/src/devices/video/epic12.h
@@ -6,6 +6,12 @@
#pragma once
+#define MCFG_EPIC12_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, EPIC12, 0)
+
+#define MCFG_EPIC12_SET_MAINRAMSIZE( _rgn ) \
+ downcast<epic12_device &>(*device).set_mainramsize(_rgn);
+
class epic12_device : public device_t, public device_video_interface
{
diff --git a/src/devices/video/fixfreq.cpp b/src/devices/video/fixfreq.cpp
index 58eec1722e3..a64c6d812b3 100644
--- a/src/devices/video/fixfreq.cpp
+++ b/src/devices/video/fixfreq.cpp
@@ -19,216 +19,194 @@
//#define VERBOSE 1
#include "logmacro.h"
+
/***************************************************************************
Fixed frequency monitor
***************************************************************************/
-
-
-
// device type definition
DEFINE_DEVICE_TYPE(FIXFREQ, fixedfreq_device, "fixfreq", "Fixed-Frequency Monochrome Monitor")
-void fixedfreq_monitor_state::update_sync_channel(const time_type &time, const double newval)
+fixedfreq_device::fixedfreq_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock),
+ device_video_interface(mconfig, *this, false),
+ m_htotal(0), m_vtotal(0), m_vid(0), m_last_x(0), m_last_y(0), m_cur_bm(0),
+ // default to NTSC "704x480@30i"
+ m_monitor_clock(13500000),
+ m_hvisible(704),
+ m_hfrontporch(728),
+ m_hsync(791),
+ m_hbackporch(858),
+ m_vvisible(480),
+ m_vfrontporch(486),
+ m_vsync(492),
+ m_vbackporch(525),
+ m_fieldcount(2),
+ m_sync_threshold(0.3),
+ m_gain(1.0 / 3.7),
+ m_vint(0), m_int_trig(0), m_mult(0), m_sig_vsync(0), m_sig_composite(0), m_sig_field(0)
{
- const time_type delta_time = time - m_last_sync_time;
-
- const int last_vsync = m_sig_vsync;
- const int last_comp = m_sig_composite;
-
- m_vsync_filter += ((double) last_comp - m_vsync_filter) * (1.0 - exp(-delta_time * m_vsync_filter_timeconst));
- m_sig_composite = (newval < m_desc.m_sync_threshold) ? 1 : 0 ;
-
- m_sig_vsync = (m_vsync_filter > m_vsync_threshold) ? 1 : 0;
-
- if (!last_vsync && m_sig_vsync)
- {
- //LOG("VSYNC %d %d\n", m_last_x, m_last_y + m_sig_field);
- m_last_y = m_desc.m_vbackporch - m_desc.m_vsync;
- m_intf.vsync_start_cb(time - m_last_vsync_time);
- m_last_vsync_time = time;
- }
- else if (last_vsync && !m_sig_vsync)
- {
- m_sig_field = last_comp; /* force false-progressive */
- m_sig_field = (m_sig_field ^ 1) ^ last_comp; /* if there is no field switch, auto switch */
- //LOG("Field: %d\n", m_sig_field);
- }
-
- if (!last_comp && m_sig_composite)
- {
- /* TODO - time since last hsync and field detection */
- //LOG("HSYNC up %d\n", m_last_x);
- // FIXME: pixels > 50 filters some spurious hysnc on line 27 in breakout
- if (!m_sig_vsync && (m_last_x > m_desc.m_hscale * 100))
- {
- m_last_y += m_desc.m_fieldcount;
- m_last_x = 0;
- m_line_time = time;
- }
- //if (m_last_y == 27) printf("HSYNC up %d %d\n", m_last_y, pixels);
- }
- else if (last_comp && !m_sig_composite)
- {
- /* falling composite */
- //LOG("HSYNC down %f %d %f\n", time * 1e6, m_last_x, m_sync_signal);
- }
-
- m_sync_signal = newval;
- m_last_sync_time = time;
}
-void fixedfreq_monitor_state::update_bm(const time_type &time)
+fixedfreq_device::fixedfreq_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : fixedfreq_device(mconfig, FIXFREQ, tag, owner, clock)
{
- const int pixels = round((time - m_line_time) * m_desc.m_hscale / m_clock_period);
- const int has_fields = (m_desc.m_fieldcount > 1) ? 1: 0;
-
- uint32_t col(0xffff0000); // Mark sync areas
-
- if (m_sync_signal >= m_desc.m_sync_threshold)
- col = m_col;
-
- m_intf.plot_hline(m_last_x, m_last_y + m_sig_field * has_fields, pixels - m_last_x, col);
- m_last_x = pixels;
}
-void fixedfreq_monitor_state::update_composite_monochrome(const time_type &time, const double data)
+void fixedfreq_device::device_start()
{
- update_bm(time);
- update_sync_channel(time, data);
-
- int colv = (int) ((data - m_desc.m_sync_threshold) * m_desc.m_gain * 255.0);
- if (colv > 255)
- colv = 255;
- if (colv < 0)
- m_col = 0xffff0000;
- else
- m_col = 0xff000000 | (colv<<16) | (colv<<8) | colv;
-}
+ m_htotal = 0;
+ m_vtotal = 0;
+
+ m_vid = 0.0;
+ m_last_x = 0;
+ m_last_y = 0;
+ m_last_time = attotime::zero;
+ m_line_time = attotime::zero;
+ m_last_hsync_time = attotime::zero;
+ m_last_vsync_time = attotime::zero;
+ m_refresh = attotime::zero;
+ m_clock_period = attotime::zero;
+ //bitmap_rgb32 *m_bitmap[2];
+ m_cur_bm = 0;
-void fixedfreq_monitor_state::update_red(const time_type &time, const double data)
-{
- update_bm(time);
-
- int colv = (int) ((data - m_desc.m_sync_threshold) * m_desc.m_gain * 255.0);
- if (colv > 255)
- colv = 255;
- if (colv < 0)
- colv = 0;
- m_col = (m_col & 0xff00ffff) | (colv<<16);
-}
+ /* sync separator */
+ m_vint = 0.0;
+ m_int_trig = 0.0;
+ m_mult = 0.0;
+
+ m_sig_vsync = 0;
+ m_sig_composite = 0;
+ m_sig_field = 0;
+
+ m_bitmap[0] = nullptr;
+ m_bitmap[1] = nullptr;
+ //m_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vga_device::vblank_timer_cb),this));
+ recompute_parameters(false);
+
+ save_item(NAME(m_vid));
+ save_item(NAME(m_last_x));
+ save_item(NAME(m_last_y));
+ save_item(NAME(m_last_time));
+ save_item(NAME(m_line_time));
+ save_item(NAME(m_last_hsync_time));
+ save_item(NAME(m_last_vsync_time));
+ save_item(NAME(m_refresh));
+ save_item(NAME(m_clock_period));
+ //save_item(NAME(m_bitmap[0]));
+ //save_item(NAME(m_bitmap[1]));
+ save_item(NAME(m_cur_bm));
-void fixedfreq_monitor_state::update_green(const time_type &time, const double data)
-{
- update_bm(time);
- //update_sync_channel(ctime, data);
-
- int colv = (int) ((data - m_desc.m_sync_threshold) * m_desc.m_gain * 255.0);
- if (colv > 255)
- colv = 255;
- if (colv < 0)
- colv = 0;
- m_col = (m_col & 0xffff00ff) | (colv<<8);
-}
+ /* sync separator */
+ save_item(NAME(m_vint));
+ save_item(NAME(m_int_trig));
+ save_item(NAME(m_mult));
-void fixedfreq_monitor_state::update_blue(const time_type &time, const double data)
-{
- update_bm(time);
- //update_sync_channel(ctime, data);
+ save_item(NAME(m_sig_vsync));
+ save_item(NAME(m_sig_composite));
+ save_item(NAME(m_sig_field));
- int colv = (int) ((data - m_desc.m_sync_threshold) * m_desc.m_gain * 255.0);
- if (colv > 255)
- colv = 255;
- if (colv < 0)
- colv = 0;
- m_col = (m_col & 0xffffff00) | colv;
-}
-void fixedfreq_monitor_state::update_sync(const time_type &time, const double data)
-{
- update_bm(time);
- update_sync_channel(time, data);
}
-fixedfreq_device::fixedfreq_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, type, tag, owner, clock),
- device_video_interface(mconfig, *this, false),
- m_cur_bm(0),
- m_htotal(0),
- m_vtotal(0),
- m_refresh_period(time_type(0)),
- m_monitor(),
- m_state(m_monitor, *this)
+void fixedfreq_device::device_reset()
{
+ m_last_time = attotime::zero;
+ m_line_time = attotime::zero;
+ m_last_hsync_time = attotime::zero;
+ m_last_vsync_time = attotime::zero;
+ m_vint = 0;
+
}
-fixedfreq_device::fixedfreq_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : fixedfreq_device(mconfig, FIXFREQ, tag, owner, clock)
+
+void fixedfreq_device::device_post_load()
{
+ //recompute_parameters(true);
}
-void fixedfreq_device::device_config_complete()
+void fixedfreq_device::recompute_parameters(bool postload)
{
- if (!has_screen())
- return;
+ bool needs_realloc = (m_htotal != m_hbackporch) && (m_vtotal != m_vbackporch);
- if (!screen().refresh_attoseconds())
- screen().set_raw(m_monitor.m_monitor_clock, m_monitor.m_hbackporch, 0,
- m_monitor.m_hbackporch, m_monitor.m_vbackporch, 0,
- m_monitor.m_vbackporch);
+ if (m_bitmap[0] != nullptr || needs_realloc)
+ m_bitmap[0] = nullptr;
+ if (m_bitmap[1] != nullptr || needs_realloc)
+ m_bitmap[1] = nullptr;
- if (!screen().has_screen_update())
- screen().set_screen_update(screen_update_rgb32_delegate(FUNC(fixedfreq_device::screen_update), this));
-}
+ m_htotal = m_hbackporch;
+ m_vtotal = m_vbackporch;
-void fixedfreq_device::device_start()
-{
+ /* sync separator */
- m_refresh_period = time_type(0);
+ m_int_trig = (exp(- 3.0/(3.0+3.0))) - exp(-1.0);
+ m_mult = (double) (m_monitor_clock) / (double) m_htotal * 1.0; // / (3.0 + 3.0);
+ LOG("trigger %f with len %f\n", m_int_trig, 1e6 / m_mult);
- m_cur_bm = 0;
+ m_bitmap[0] = std::make_unique<bitmap_rgb32>(m_htotal, m_vtotal);
+ m_bitmap[1] = std::make_unique<bitmap_rgb32>(m_htotal, m_vtotal);
- m_htotal = m_monitor.m_hbackporch;
- m_vtotal = m_monitor.m_vbackporch;
- m_bitmap[0] = std::make_unique<bitmap_rgb32>(m_htotal * m_monitor.m_hscale, m_vtotal);
- m_bitmap[1] = std::make_unique<bitmap_rgb32>(m_htotal * m_monitor.m_hscale, m_vtotal);
-
- m_state.start();
-
- // FIXME: will be done by netlist going forward
- save_item(NAME(m_state.m_sync_signal));
- save_item(NAME(m_state.m_last_x));
- save_item(NAME(m_state.m_last_y));
- save_item(NAME(m_state.m_last_sync_time));
- save_item(NAME(m_state.m_line_time));
- save_item(NAME(m_state.m_last_hsync_time));
- save_item(NAME(m_state.m_last_vsync_time));
- save_item(NAME(m_refresh_period));
- save_item(NAME(m_state.m_clock_period));
- //save_item(NAME(m_bitmap[0]));
- //save_item(NAME(m_bitmap[1]));
- save_item(NAME(m_cur_bm));
+ rectangle visarea(
+ m_hbackporch - m_hfrontporch,
+ m_hbackporch - m_hfrontporch + m_hvisible - 1,
+ m_vbackporch - m_vfrontporch,
+ m_vbackporch - m_vfrontporch + m_vvisible - 1);
- /* sync separator */
- save_item(NAME(m_state.m_vsync_filter));
- save_item(NAME(m_state.m_vsync_threshold));
- save_item(NAME(m_state.m_vsync_filter_timeconst));
+ m_clock_period = attotime::from_hz(m_monitor_clock);
- save_item(NAME(m_state.m_sig_vsync));
- save_item(NAME(m_state.m_sig_composite));
- save_item(NAME(m_state.m_sig_field));
+ m_refresh = attotime::from_hz(m_monitor_clock) * m_vtotal * m_htotal;
+ screen().configure(m_htotal, m_vtotal, visarea, m_refresh.as_attoseconds());
}
-void fixedfreq_device::device_reset()
+void fixedfreq_device::update_screen_parameters(const attotime &refresh)
{
- m_state.reset();
+ rectangle visarea(
+// m_hsync - m_hvisible,
+// m_hsync - 1 ,
+ m_hbackporch - m_hfrontporch,
+ m_hbackporch - m_hfrontporch + m_hvisible - 1,
+ m_vbackporch - m_vfrontporch,
+ m_vbackporch - m_vfrontporch + m_vvisible - 1);
+
+ m_refresh = refresh;
+ screen().configure(m_htotal, m_vtotal, visarea, m_refresh.as_attoseconds());
}
-void fixedfreq_device::device_post_load()
+int fixedfreq_device::sync_separator(const attotime &time, double newval)
{
- //recompute_parameters();
+ int last_vsync = m_sig_vsync;
+ int last_comp = m_sig_composite;
+ int ret = 0;
+
+ m_vint += ((double) last_comp - m_vint) * (1.0 - exp(-time.as_double() * m_mult));
+ m_sig_composite = (newval < m_sync_threshold) ? 1 : 0 ;
+
+ m_sig_vsync = (m_vint > m_int_trig) ? 1 : 0;
+
+ if (!last_vsync && m_sig_vsync)
+ {
+ /* TODO - time since last hsync and field detection */
+ ret |= 1;
+ }
+ if (last_vsync && !m_sig_vsync)
+ {
+ m_sig_field = last_comp; /* force false-progressive */
+ m_sig_field = (m_sig_field ^ 1) ^ last_comp; /* if there is no field switch, auto switch */
+ LOG("Field: %d\n", m_sig_field);
+ }
+ if (!last_comp && m_sig_composite)
+ {
+ /* TODO - time since last hsync and field detection */
+ ret |= 2;
+ }
+ if (last_comp && !m_sig_composite)
+ {
+ /* falling composite */
+ ret |= 4;
+ }
+ return ret;
}
uint32_t fixedfreq_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
@@ -238,62 +216,72 @@ uint32_t fixedfreq_device::screen_update(screen_device &screen, bitmap_rgb32 &bi
return 0;
}
-void fixedfreq_device::vsync_start_cb(double refresh_time)
-{
- // toggle bitmap
- m_cur_bm ^= 1;
-
- rectangle visarea(m_monitor.minh(), m_monitor.maxh(), m_monitor.minv(), m_monitor.maxv());
-
- m_refresh_period = refresh_time;
- screen().configure(m_htotal * m_monitor.m_hscale, m_vtotal, visarea, DOUBLE_TO_ATTOSECONDS(m_refresh_period));
-}
-
-void fixedfreq_device::plot_hline(int x, int y, int w, uint32_t col)
+NETDEV_ANALOG_CALLBACK_MEMBER(fixedfreq_device::update_vid)
{
bitmap_rgb32 *bm = m_bitmap[m_cur_bm].get();
- if (y < bm->height())
- bm->plot_box(x, y, w, 1, col);
-}
+ const int has_fields = (m_fieldcount > 1) ? 1: 0;
-NETDEV_ANALOG_CALLBACK_MEMBER(fixedfreq_device::update_composite_monochrome)
-{
- // double is good enough for this exercise;
+ int pixels = round((time - m_line_time).as_double() / m_clock_period.as_double());
+ attotime delta_time = (time - m_last_time);
- const time_type ctime = time.as_double();
- m_state.update_composite_monochrome(ctime, data);
-}
+ if (data == m_vid)
+ return;
-NETDEV_ANALOG_CALLBACK_MEMBER(fixedfreq_device::update_red)
-{
- // double is good enough for this exercise;
+ ATTR_UNUSED int sync = sync_separator(delta_time, data);
- const time_type ctime = time.as_double();
- m_state.update_red(ctime, data);
-}
+ if (m_last_y < bm->height())
+ {
+ rgb_t col;
-NETDEV_ANALOG_CALLBACK_MEMBER(fixedfreq_device::update_green)
-{
- // double is good enough for this exercise;
+ if (m_vid < m_sync_threshold)
+ // Mark sync areas
+ col = rgb_t(255, 0, 0);
+ else
+ {
+ int colv = (int) ((m_vid - m_sync_threshold) * m_gain * 255.0);
+ if (colv > 255)
+ colv = 255;
+ col = rgb_t(colv, colv, colv);
+ }
- const time_type ctime = time.as_double();
- m_state.update_green(ctime, data);
-}
+ bm->plot_box(m_last_x, m_last_y + m_sig_field * has_fields, pixels - m_last_x, 1, col);
+ m_last_x = pixels;
+ }
+ if (sync & 1)
+ {
+ LOG("VSYNC %d %d\n", pixels, m_last_y + m_sig_field);
+ }
+ if (sync & 2)
+ {
+ LOG("HSYNC up %d\n", pixels);
+ //if (m_last_y == 27) printf("HSYNC up %d %d\n", m_last_y, pixels);
+ }
+ if (sync & 4)
+ {
+ LOG("HSYNC down %f %d %f\n", time.as_double()* 1e6, pixels, m_vid);
+ }
-NETDEV_ANALOG_CALLBACK_MEMBER(fixedfreq_device::update_blue)
-{
- // double is good enough for this exercise;
+ if (sync & 1)
+ {
+ m_last_y = m_vbackporch - m_vsync;
+ // toggle bitmap
+ m_cur_bm ^= 1;
+ update_screen_parameters(time - m_last_vsync_time);
+ m_last_vsync_time = time;
+ }
- const time_type ctime = time.as_double();
- m_state.update_blue(ctime, data);
-}
+ // FIXME: pixels > 50 filters some spurious hysnc on line 27 in breakout
+ if ((sync & 2) && !m_sig_vsync && (pixels > 100))
+ {
+ m_last_y += m_fieldcount;
+ m_last_x = 0;
+ m_line_time = time;
+ }
-NETDEV_ANALOG_CALLBACK_MEMBER(fixedfreq_device::update_sync)
-{
- // double is good enough for this exercise;
+ m_last_time = time;
+ m_vid = data;
- const time_type ctime = time.as_double();
- m_state.update_sync(ctime, data);
}
+
/***************************************************************************/
diff --git a/src/devices/video/fixfreq.h b/src/devices/video/fixfreq.h
index d85056d874b..10c52217e82 100644
--- a/src/devices/video/fixfreq.h
+++ b/src/devices/video/fixfreq.h
@@ -17,245 +17,139 @@
#include "machine/netlist.h"
#include "screen.h"
-struct fixedfreq_monitor_desc
-{
- fixedfreq_monitor_desc()
- // default to NTSC "704x480@30i"
- : m_monitor_clock(13500000),
- m_hvisible(704),
- m_hfrontporch(728),
- m_hsync(791),
- m_hbackporch(858),
- m_vvisible(480),
- m_vfrontporch(486),
- m_vsync(492),
- m_vbackporch(525),
- m_fieldcount(2),
- m_sync_threshold(0.3),
- m_gain(1.0 / 3.7),
- m_hscale(1)
- {}
-
- int minh() const { return (m_hbackporch - m_hfrontporch) * m_hscale; }
- int maxh() const { return (m_hbackporch - m_hfrontporch + m_hvisible) * m_hscale - 1; }
- int minv() const { return m_vbackporch - m_vfrontporch; }
- int maxv() const { return m_vbackporch - m_vfrontporch + m_vvisible - 1; }
-
- uint32_t m_monitor_clock;
- int m_hvisible;
- int m_hfrontporch;
- int m_hsync;
- int m_hbackporch;
- int m_vvisible;
- int m_vfrontporch;
- int m_vsync;
- int m_vbackporch;
- int m_fieldcount;
- double m_sync_threshold;
- double m_gain;
- int m_hscale;
-};
-
-struct fixedfreq_monitor_intf
-{
- virtual ~fixedfreq_monitor_intf() = default;
- virtual void vsync_start_cb(double refresh_time) = 0;
- virtual void plot_hline(int x, int y, int w, uint32_t col) = 0;
-};
-struct fixedfreq_monitor_state
-{
- using time_type = double;
-
- fixedfreq_monitor_state(fixedfreq_monitor_desc &desc, fixedfreq_monitor_intf &intf)
- : m_desc(desc),
- m_intf(intf),
- m_sync_signal(0),
- m_col(0),
- m_last_x(0),
- m_last_y(0),
- m_last_sync_time(time_type(0)),
- m_line_time(time_type(0)),
- m_last_hsync_time(time_type(0)),
- m_last_vsync_time(time_type(0)),
- m_clock_period(time_type(0)),
- m_vsync_filter(0),
- m_vsync_threshold(0),
- m_vsync_filter_timeconst(0),
- m_sig_vsync(0),
- m_sig_composite(0),
- m_sig_field(0)
- {}
-
- /***
- * \brief To be called after monitor parameters are set
- */
- void start()
- {
- // FIXME: once moved to netlist this may no longer be necessary.
- // Only copies constructor init
+#define FIXFREQ_INTERFACE(name) \
+ const fixedfreq_interface (name) =
- m_sync_signal = 0.0;
- m_col = rgb_t(0,0,0);
- m_last_x = 0;
- m_last_y = 0;
- m_last_sync_time = time_type(0);
- m_line_time = time_type(0);
- m_last_hsync_time = time_type(0);
- m_last_vsync_time = time_type(0);
- m_clock_period = time_type(0);
+#define MCFG_FIXFREQ_ADD(_tag, _screen_tag) \
+ MCFG_SCREEN_ADD(_screen_tag, RASTER) \
+ MCFG_SCREEN_RAW_PARAMS(13500000, 858, 0, 858, 525, 0, 525) \
+ MCFG_SCREEN_UPDATE_DEVICE(_tag, fixedfreq_device, screen_update) \
+ MCFG_DEVICE_ADD(_tag, FIXFREQ, 0) \
+ MCFG_VIDEO_SET_SCREEN(_screen_tag)
- /* sync separator */
- m_vsync_filter = 0.0;
- m_vsync_threshold = 0.0;
- m_vsync_filter_timeconst = 0.0;
+#define MCFG_FIXFREQ_MONITOR_CLOCK(_clock) \
+ downcast<fixedfreq_device &>(*device).set_minitor_clock(_clock);
- m_sig_vsync = 0;
- m_sig_composite = 0;
- m_sig_field = 0;
+#define MCFG_FIXFREQ_HORZ_PARAMS(_visible, _frontporch, _sync, _backporch) \
+ downcast<fixedfreq_device &>(*device).set_horz_params(_visible, _frontporch, _sync, _backporch);
- // htotal = m_desc.m_hbackporch;
- // vtotal = m_desc.m_vbackporch;
+#define MCFG_FIXFREQ_VERT_PARAMS(_visible, _frontporch, _sync, _backporch) \
+ downcast<fixedfreq_device &>(*device).set_vert_params(_visible, _frontporch, _sync, _backporch);
- /* sync separator */
+#define MCFG_FIXFREQ_FIELDCOUNT(_count) \
+ downcast<fixedfreq_device &>(*device).set_fieldcount(_count);
- m_vsync_threshold = (exp(- 3.0/(3.0+3.0))) - exp(-1.0);
- m_vsync_filter_timeconst = (double) (m_desc.m_monitor_clock) / (double) m_desc.m_hbackporch * 1.0; // / (3.0 + 3.0);
- //LOG("trigger %f with len %f\n", m_vsync_threshold, 1e6 / m_vsync_filter_timeconst);
+#define MCFG_FIXFREQ_SYNC_THRESHOLD(_threshold) \
+ downcast<fixedfreq_device &>(*device).set_threshold(_threshold);
- m_clock_period = 1.0 / m_desc.m_monitor_clock;
- m_intf.vsync_start_cb(m_clock_period * m_desc.m_vbackporch * m_desc.m_hbackporch);
+#define MCFG_FIXFREQ_GAIN(_gain) \
+ downcast<fixedfreq_device &>(*device).set_gain(_gain);
- }
+// pre-defined configurations
- void reset()
- {
- m_last_sync_time = time_type(0);
- m_line_time = time_type(0);
- m_last_hsync_time = time_type(0);
- m_last_vsync_time = time_type(0);
- m_vsync_filter = 0;
- }
-
- void update_sync_channel(const time_type &time, const double newval);
- void update_bm(const time_type &time);
- void update_composite_monochrome(const time_type &time, const double newval);
- void update_red(const time_type &time, const double data);
- void update_green(const time_type &time, const double data);
- void update_blue(const time_type &time, const double data);
- void update_sync(const time_type &time, const double data);
+//ModeLine "720x480@30i" 13.5 720 736 799 858 480 486 492 525 interlace -hsync -vsync
+#define MCFG_FIXFREQ_MODE_NTSC720 \
+ MCFG_FIXFREQ_MONITOR_CLOCK(13500000) \
+ MCFG_FIXFREQ_HORZ_PARAMS(720, 736, 799, 858) \
+ MCFG_FIXFREQ_VERT_PARAMS(480, 486, 492, 525) \
+ MCFG_FIXFREQ_FIELDCOUNT(2) \
+ MCFG_FIXFREQ_SYNC_THRESHOLD(0.3)
- const fixedfreq_monitor_desc &m_desc;
- fixedfreq_monitor_intf &m_intf;
+//ModeLine "704x480@30i" 13.5 704 728 791 858 480 486 492 525
+#define MCFG_FIXFREQ_MODE_NTSC704 \
+ MCFG_FIXFREQ_MONITOR_CLOCK(13500000) \
+ MCFG_FIXFREQ_HORZ_PARAMS(704, 728, 791, 858) \
+ MCFG_FIXFREQ_VERT_PARAMS(480, 486, 492, 525) \
+ MCFG_FIXFREQ_FIELDCOUNT(2) \
+ MCFG_FIXFREQ_SYNC_THRESHOLD(0.3)
- double m_sync_signal;
- uint32_t m_col;
- int m_last_x;
- int m_last_y;
- time_type m_last_sync_time;
- time_type m_line_time;
- time_type m_last_hsync_time;
- time_type m_last_vsync_time;
- time_type m_clock_period;
-
- /* sync separator */
- double m_vsync_filter;
- double m_vsync_threshold;
- double m_vsync_filter_timeconst;
-
- int m_sig_vsync;
- int m_sig_composite;
- int m_sig_field;
-
-};
-// ======================> fixedfreq_device
+// ======================> vga_device
-class fixedfreq_device : public device_t, public device_video_interface,
- public fixedfreq_monitor_intf
+class fixedfreq_device : public device_t, public device_video_interface
{
public:
-
- using time_type = fixedfreq_monitor_state::time_type;
-
// construction/destruction
- fixedfreq_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ fixedfreq_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration helpers
- void set_monitor_clock(uint32_t clock) { m_monitor.m_monitor_clock = clock; }
- void set_fieldcount(int count) { m_monitor.m_fieldcount = count; }
- void set_threshold(double threshold) { m_monitor.m_sync_threshold = threshold; }
- void set_gain(double gain) { m_monitor.m_gain = gain; }
+ void set_minitor_clock(uint32_t clock) { m_monitor_clock = clock; }
+ void set_fieldcount(int count) { m_fieldcount = count; }
+ void set_threshold(double threshold) { m_sync_threshold = threshold; }
+ void set_gain(double gain) { m_gain = gain; }
void set_horz_params(int visible, int frontporch, int sync, int backporch)
{
- m_monitor.m_hvisible = visible;
- m_monitor.m_hfrontporch = frontporch;
- m_monitor.m_hsync = sync;
- m_monitor.m_hbackporch = backporch;
+ m_hvisible = visible;
+ m_hfrontporch = frontporch;
+ m_hsync = sync;
+ m_hbackporch = backporch;
}
void set_vert_params(int visible, int frontporch, int sync, int backporch)
{
- m_monitor.m_vvisible = visible;
- m_monitor.m_vfrontporch = frontporch;
- m_monitor.m_vsync = sync;
- m_monitor.m_vbackporch = backporch;
- }
- void set_horz_scale(int hscale) { m_monitor.m_hscale = hscale; }
-
- // pre-defined configurations
- void set_mode_ntsc720() //ModeLine "720x480@30i" 13.5 720 736 799 858 480 486 492 525 interlace -hsync -vsync
- {
- set_monitor_clock(13500000);
- set_horz_params(720, 736, 799, 858);
- set_vert_params(480, 486, 492, 525);
- set_fieldcount(2);
- set_threshold(0.3);
- }
- void set_mode_ntsc704() //ModeLine "704x480@30i" 13.5 704 728 791 858 480 486 492 525
- {
- set_monitor_clock(13500000);
- set_horz_params(704, 728, 791, 858);
- set_vert_params(480, 486, 492, 525);
- set_fieldcount(2);
- set_threshold(0.3);
+ m_vvisible = visible;
+ m_vfrontporch = frontporch;
+ m_vsync = sync;
+ m_vbackporch = backporch;
}
virtual uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- NETDEV_ANALOG_CALLBACK_MEMBER(update_composite_monochrome);
- NETDEV_ANALOG_CALLBACK_MEMBER(update_red);
- NETDEV_ANALOG_CALLBACK_MEMBER(update_green);
- NETDEV_ANALOG_CALLBACK_MEMBER(update_blue);
- NETDEV_ANALOG_CALLBACK_MEMBER(update_sync);
-
+ NETDEV_ANALOG_CALLBACK_MEMBER(update_vid);
protected:
-
fixedfreq_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
- virtual void device_config_complete() override;
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_post_load() override;
//virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
- void vsync_start_cb(double refresh_time) override;
- void plot_hline(int x, int y, int w, uint32_t col) override;
+ void recompute_parameters(bool postload);
+ void update_screen_parameters(const attotime &refresh);
private:
- std::unique_ptr<bitmap_rgb32> m_bitmap[2];
- int m_cur_bm;
+ int sync_separator(const attotime &time, double newval);
+
int m_htotal;
int m_vtotal;
- time_type m_refresh_period;
+ double m_vid;
+ int m_last_x;
+ int m_last_y;
+ attotime m_last_time;
+ attotime m_line_time;
+ attotime m_last_hsync_time;
+ attotime m_last_vsync_time;
+ attotime m_refresh;
+ attotime m_clock_period;
+ std::unique_ptr<bitmap_rgb32> m_bitmap[2];
+ int m_cur_bm;
/* adjustable by drivers */
- fixedfreq_monitor_desc m_monitor;
- fixedfreq_monitor_state m_state;
+ uint32_t m_monitor_clock;
+ int m_hvisible;
+ int m_hfrontporch;
+ int m_hsync;
+ int m_hbackporch;
+ int m_vvisible;
+ int m_vfrontporch;
+ int m_vsync;
+ int m_vbackporch;
+ int m_fieldcount;
+ double m_sync_threshold;
+ double m_gain;
+
+ /* sync separator */
+ double m_vint;
+ double m_int_trig;
+ double m_mult;
+ int m_sig_vsync;
+ int m_sig_composite;
+ int m_sig_field;
};
diff --git a/src/devices/video/gba_lcd.cpp b/src/devices/video/gba_lcd.cpp
index 36214bb1ad4..36c8e83b27e 100644
--- a/src/devices/video/gba_lcd.cpp
+++ b/src/devices/video/gba_lcd.cpp
@@ -1807,12 +1807,11 @@ void gba_lcd_device::device_reset()
m_hbl_timer->adjust(attotime::never);
}
-void gba_lcd_device::device_add_mconfig(machine_config &config)
-{
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD));
- screen.set_raw(XTAL(16'777'216) / 4, 308, 0, 240, 228, 0, 160);
- screen.set_screen_update(FUNC(gba_lcd_device::screen_update));
- screen.set_palette("palette");
+MACHINE_CONFIG_START(gba_lcd_device::device_add_mconfig)
+ MCFG_SCREEN_ADD("screen", LCD)
+ MCFG_SCREEN_RAW_PARAMS(XTAL(16'777'216) / 4, 308, 0, 240, 228, 0, 160)
+ MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, gba_lcd_device, screen_update)
+ MCFG_SCREEN_PALETTE("palette")
PALETTE(config, "palette", FUNC(gba_lcd_device::gba_palette), 32768);
-}
+MACHINE_CONFIG_END
diff --git a/src/devices/video/gba_lcd.h b/src/devices/video/gba_lcd.h
index ed4c258acad..1332340e175 100644
--- a/src/devices/video/gba_lcd.h
+++ b/src/devices/video/gba_lcd.h
@@ -26,6 +26,29 @@ DECLARE_DEVICE_TYPE(GBA_LCD, gba_lcd_device)
//**************************************************************************
+// DEVICE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_GBA_LCD_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, GBA_LCD, 0)
+
+#define MCFG_GBA_LCD_INT_HBLANK(_devcb) \
+ downcast<gba_lcd_device &>(*device).set_int_hblank_callback(DEVCB_##_devcb);
+
+#define MCFG_GBA_LCD_INT_VBLANK(_devcb) \
+ downcast<gba_lcd_device &>(*device).set_int_vblank_callback(DEVCB_##_devcb);
+
+#define MCFG_GBA_LCD_INT_VCOUNT(_devcb) \
+ downcast<gba_lcd_device &>(*device).set_int_vcount_callback(DEVCB_##_devcb);
+
+#define MCFG_GBA_LCD_DMA_HBLANK(_devcb) \
+ downcast<gba_lcd_device &>(*device).set_dma_hblank_callback(DEVCB_##_devcb);
+
+#define MCFG_GBA_LCD_DMA_VBLANK(_devcb) \
+ downcast<gba_lcd_device &>(*device).set_dma_vblank_callback(DEVCB_##_devcb);
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -76,11 +99,11 @@ public:
TIMER_CALLBACK_MEMBER(perform_hbl);
TIMER_CALLBACK_MEMBER(perform_scan);
- auto int_hblank_callback() { return m_int_hblank_cb.bind(); }
- auto int_vblank_callback() { return m_int_vblank_cb.bind(); }
- auto int_vcount_callback() { return m_int_vcount_cb.bind(); }
- auto dma_hblank_callback() { return m_dma_hblank_cb.bind(); }
- auto dma_vblank_callback() { return m_dma_vblank_cb.bind(); }
+ template <class Object> devcb_base &set_int_hblank_callback(Object &&cb) { return m_int_hblank_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_int_vblank_callback(Object &&cb) { return m_int_vblank_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_int_vcount_callback(Object &&cb) { return m_int_vcount_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_dma_hblank_callback(Object &&cb) { return m_dma_hblank_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_dma_vblank_callback(Object &&cb) { return m_dma_vblank_cb.set_callback(std::forward<Object>(cb)); }
protected:
// device-level overrides
diff --git a/src/devices/video/hd44102.h b/src/devices/video/hd44102.h
index 1688a502441..a484ce77478 100644
--- a/src/devices/video/hd44102.h
+++ b/src/devices/video/hd44102.h
@@ -12,6 +12,19 @@
#pragma once
+
+
+///*************************************************************************
+// INTERFACE CONFIGURATION MACROS
+///*************************************************************************
+
+#define MCFG_HD44102_ADD(_tag, _screen_tag, _sx, _sy) \
+ MCFG_DEVICE_ADD(_tag, HD44102, 0) \
+ MCFG_VIDEO_SET_SCREEN(_screen_tag) \
+ downcast<hd44102_device &>(*device).set_offsets(_sx, _sy);
+
+
+
///*************************************************************************
// TYPE DEFINITIONS
///*************************************************************************
@@ -23,14 +36,6 @@ class hd44102_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- hd44102_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&screen_tag, int sx, int sy)
- :hd44102_device(mconfig, tag, owner, clock)
- {
- set_screen(std::forward<T>(screen_tag));
- set_offsets(sx, sy);
- }
-
hd44102_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration helpers
diff --git a/src/devices/video/hd44780.h b/src/devices/video/hd44780.h
index a6572536cf1..65544ef6828 100644
--- a/src/devices/video/hd44780.h
+++ b/src/devices/video/hd44780.h
@@ -12,6 +12,18 @@
#pragma once
+#define MCFG_HD44780_ADD( _tag ) \
+ MCFG_DEVICE_ADD( _tag, HD44780, 0 )
+
+#define MCFG_KS0066_F05_ADD( _tag ) \
+ MCFG_DEVICE_ADD( _tag, KS0066_F05, 0 )
+
+#define MCFG_HD44780_LCD_SIZE(_lines, _chars) \
+ downcast<hd44780_device &>(*device).set_lcd_size(_lines, _chars);
+
+#define MCFG_HD44780_PIXEL_UPDATE_CB(_class, _method) \
+ downcast<hd44780_device &>(*device).set_pixel_update_cb(&_class::_method, #_class "::" #_method, this);
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/devices/video/hd61830.cpp b/src/devices/video/hd61830.cpp
index a608c096b1e..7d0427ff2ba 100644
--- a/src/devices/video/hd61830.cpp
+++ b/src/devices/video/hd61830.cpp
@@ -27,8 +27,7 @@ decltype(HD61830) HD61830B = HD61830;
// default address map
void hd61830_device::hd61830(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, 0xffff).ram();
+ map(0x0000, 0xffff).ram();
}
@@ -85,7 +84,7 @@ hd61830_device::hd61830_device(const machine_config &mconfig, const char *tag, d
m_cac(0),
m_blink(0),
m_cursor(0),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(hd61830_device::hd61830), this)),
+ m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(), address_map_constructor(FUNC(hd61830_device::hd61830), this)),
m_char_rom(*this, "hd61830")
{
}
diff --git a/src/devices/video/hd61830.h b/src/devices/video/hd61830.h
index f8579081ac1..ab4278f9d89 100644
--- a/src/devices/video/hd61830.h
+++ b/src/devices/video/hd61830.h
@@ -12,6 +12,17 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_HD61830_RD_CALLBACK(_read) \
+ downcast<hd61830_device &>(*device).set_rd_rd_callback(DEVCB_##_read);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -26,7 +37,7 @@ public:
// construction/destruction
hd61830_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto rd_rd_callback() { return m_read_rd.bind(); }
+ template <class Object> devcb_base &set_rd_rd_callback(Object &&cb) { return m_read_rd.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( status_r );
DECLARE_WRITE8_MEMBER( control_w );
diff --git a/src/devices/video/hd63484.h b/src/devices/video/hd63484.h
index 73a321fc117..885761d211b 100644
--- a/src/devices/video/hd63484.h
+++ b/src/devices/video/hd63484.h
@@ -13,8 +13,30 @@
#pragma once
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_HD63484_ADD(_tag, _clock, _map) \
+ MCFG_DEVICE_ADD(_tag, HD63484, _clock) \
+ MCFG_DEVICE_ADDRESS_MAP(0, _map)
+
+#define MCFG_HD63484_ADDRESS_MAP(_map) \
+ MCFG_DEVICE_ADDRESS_MAP(0, _map)
+
+#define MCFG_HD63484_DISPLAY_CALLBACK_OWNER(_class, _method) \
+ downcast<hd63484_device &>(*device).set_display_callback(hd63484_device::display_delegate(&_class::_method, #_class "::" #_method, this));
+
+#define MCFG_HD63484_AUTO_CONFIGURE_SCREEN(_val) \
+ downcast<hd63484_device &>(*device).set_auto_configure_screen(_val);
+
#define HD63484_DISPLAY_PIXELS_MEMBER(_name) void _name(bitmap_ind16 &bitmap, const rectangle &cliprect, int y, int x, uint16_t data)
+#define MCFG_HD63484_EXTERNAL_SKEW(_val) \
+ downcast<hd63484_device &>(*device).set_external_skew(_val);
+
+
// ======================> hd63484_device
class hd63484_device : public device_t,
@@ -27,7 +49,7 @@ public:
// construction/destruction
hd63484_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template <typename... T> void set_display_callback(T &&... args) { m_display_cb = display_delegate(std::forward<T>(args)...); }
+ template <typename Object> void set_display_callback(Object &&cb) { m_display_cb = std::forward<Object>(cb); }
void set_auto_configure_screen(bool auto_configure_screen) { m_auto_configure_screen = auto_configure_screen; }
void set_external_skew(int skew) { m_external_skew = skew; }
diff --git a/src/devices/video/hd66421.cpp b/src/devices/video/hd66421.cpp
index bb03b80252e..63283f498b0 100644
--- a/src/devices/video/hd66421.cpp
+++ b/src/devices/video/hd66421.cpp
@@ -74,8 +74,7 @@ DEFINE_DEVICE_TYPE(HD66421, hd66421_device, "hd66421", "Hitachi HD66421 LCD Cont
// default address map
void hd66421_device::hd66421(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, HD66421_RAM_SIZE).ram();
+ map(0x0000, HD66421_RAM_SIZE).ram();
}
//-------------------------------------------------
@@ -126,7 +125,7 @@ inline void hd66421_device::writebyte(offs_t address, uint8_t data)
hd66421_device::hd66421_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, HD66421, tag, owner, clock)
, device_memory_interface(mconfig, *this)
- , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, address_map_constructor(FUNC(hd66421_device::hd66421), this))
+ , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, address_map_constructor(), address_map_constructor(FUNC(hd66421_device::hd66421), this))
, m_cmd(0)
, m_x(0)
, m_y(0)
diff --git a/src/devices/video/hlcd0515.cpp b/src/devices/video/hlcd0515.cpp
index 87abf50bc0e..b7730332bfd 100644
--- a/src/devices/video/hlcd0515.cpp
+++ b/src/devices/video/hlcd0515.cpp
@@ -26,23 +26,27 @@ DEFINE_DEVICE_TYPE(HLCD0530, hlcd0530_device, "hlcd0530", "Hughes HLCD 0530 LCD
// constructor
//-------------------------------------------------
-hlcd0515_device::hlcd0515_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 colmax) :
- device_t(mconfig, type, tag, owner, clock),
- m_colmax(colmax),
- m_write_cols(*this), m_write_data(*this)
-{ }
+hlcd0515_device::hlcd0515_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 colmax)
+ : device_t(mconfig, type, tag, owner, clock)
+ , m_colmax(colmax)
+ , m_write_cols(*this), m_write_data(*this)
+{
+}
-hlcd0515_device::hlcd0515_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- hlcd0515_device(mconfig, HLCD0515, tag, owner, clock, 25)
-{ }
+hlcd0515_device::hlcd0515_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : hlcd0515_device(mconfig, HLCD0515, tag, owner, clock, 25)
+{
+}
-hlcd0569_device::hlcd0569_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- hlcd0515_device(mconfig, HLCD0569, tag, owner, clock, 24)
-{ }
+hlcd0569_device::hlcd0569_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : hlcd0515_device(mconfig, HLCD0569, tag, owner, clock, 24)
+{
+}
-hlcd0530_device::hlcd0530_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- hlcd0515_device(mconfig, HLCD0530, tag, owner, clock, 24)
-{ }
+hlcd0530_device::hlcd0530_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : hlcd0515_device(mconfig, HLCD0530, tag, owner, clock, 24)
+{
+}
@@ -62,7 +66,7 @@ void hlcd0515_device::device_start()
// zerofill
m_cs = 0;
- m_clk = 0;
+ m_pclock = 0;
m_data = 0;
m_count = 0;
m_control = 0;
@@ -75,7 +79,7 @@ void hlcd0515_device::device_start()
// register for savestates
save_item(NAME(m_cs));
- save_item(NAME(m_clk));
+ save_item(NAME(m_pclock));
save_item(NAME(m_data));
save_item(NAME(m_count));
save_item(NAME(m_control));
@@ -153,12 +157,12 @@ void hlcd0515_device::clock_data(int col)
}
-WRITE_LINE_MEMBER(hlcd0515_device::clock_w)
+WRITE_LINE_MEMBER(hlcd0515_device::write_clock)
{
state = (state) ? 1 : 0;
// clock/shift data on falling edge
- if (!m_cs && !state && m_clk)
+ if (!m_cs && !state && m_pclock)
{
if (m_count < 5)
{
@@ -175,11 +179,11 @@ WRITE_LINE_MEMBER(hlcd0515_device::clock_w)
m_count++;
}
- m_clk = state;
+ m_pclock = state;
}
-WRITE_LINE_MEMBER(hlcd0515_device::cs_w)
+WRITE_LINE_MEMBER(hlcd0515_device::write_cs)
{
state = (state) ? 1 : 0;
diff --git a/src/devices/video/hlcd0515.h b/src/devices/video/hlcd0515.h
index 1108890a1fb..5018978226d 100644
--- a/src/devices/video/hlcd0515.h
+++ b/src/devices/video/hlcd0515.h
@@ -50,9 +50,9 @@ public:
auto write_cols() { return m_write_cols.bind(); } // COL/ROW pins (offset for ROW)
auto write_data() { return m_write_data.bind(); } // DATA OUT pin, don't use on HLCD0569
- DECLARE_WRITE_LINE_MEMBER(clock_w);
- DECLARE_WRITE_LINE_MEMBER(cs_w);
- DECLARE_WRITE_LINE_MEMBER(data_w) { m_data = (state) ? 1 : 0; }
+ DECLARE_WRITE_LINE_MEMBER(write_clock);
+ DECLARE_WRITE_LINE_MEMBER(write_cs);
+ DECLARE_WRITE_LINE_MEMBER(write_data) { m_data = (state) ? 1 : 0; }
protected:
hlcd0515_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 colmax);
@@ -67,7 +67,7 @@ protected:
const u8 m_colmax; // number of column pins
int m_cs; // input pin state
- int m_clk; // "
+ int m_pclock; // "
int m_data; // "
int m_count;
u8 m_control;
diff --git a/src/devices/video/hlcd0538.cpp b/src/devices/video/hlcd0538.cpp
index 12a188d07a0..c409e6be528 100644
--- a/src/devices/video/hlcd0538.cpp
+++ b/src/devices/video/hlcd0538.cpp
@@ -23,18 +23,22 @@ DEFINE_DEVICE_TYPE(HLCD0539, hlcd0539_device, "hlcd0539", "Hughes HLCD 0539 LCD
// constructor
//-------------------------------------------------
-hlcd0538_device::hlcd0538_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) :
- device_t(mconfig, type, tag, owner, clock),
- m_write_cols(*this), m_write_interrupt(*this)
-{ }
+hlcd0538_device::hlcd0538_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
+ : device_t(mconfig, type, tag, owner, clock)
+ , m_write_cols(*this), m_write_interrupt(*this)
+{
+}
+
+hlcd0538_device::hlcd0538_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : hlcd0538_device(mconfig, HLCD0538, tag, owner, clock)
+{
+}
-hlcd0538_device::hlcd0538_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- hlcd0538_device(mconfig, HLCD0538, tag, owner, clock)
-{ }
+hlcd0539_device::hlcd0539_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : hlcd0538_device(mconfig, HLCD0539, tag, owner, clock)
+{
+}
-hlcd0539_device::hlcd0539_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- hlcd0538_device(mconfig, HLCD0539, tag, owner, clock)
-{ }
//-------------------------------------------------
@@ -61,11 +65,12 @@ void hlcd0538_device::device_start()
}
+
//-------------------------------------------------
// handlers
//-------------------------------------------------
-WRITE_LINE_MEMBER(hlcd0538_device::clk_w)
+WRITE_LINE_MEMBER(hlcd0538_device::write_clk)
{
state = (state) ? 1 : 0;
@@ -76,7 +81,7 @@ WRITE_LINE_MEMBER(hlcd0538_device::clk_w)
m_clk = state;
}
-WRITE_LINE_MEMBER(hlcd0538_device::lcd_w)
+WRITE_LINE_MEMBER(hlcd0538_device::write_lcd)
{
state = (state) ? 1 : 0;
diff --git a/src/devices/video/hlcd0538.h b/src/devices/video/hlcd0538.h
index bc1a78d16fc..187523e1076 100644
--- a/src/devices/video/hlcd0538.h
+++ b/src/devices/video/hlcd0538.h
@@ -43,15 +43,15 @@
class hlcd0538_device : public device_t
{
public:
- hlcd0538_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
+ hlcd0538_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// configuration helpers
- auto write_cols() { return m_write_cols.bind(); } // C/R pins (0538: d0-d7 for rows)
- auto write_interrupt() { return m_write_interrupt.bind(); } // INTERRUPT pin
+ auto write_cols_callback() { return m_write_cols.bind(); } // C/R pins (0538: d0-d7 for rows)
+ auto write_interrupt_callback() { return m_write_interrupt.bind(); } // INTERRUPT pin
- DECLARE_WRITE_LINE_MEMBER(clk_w);
- DECLARE_WRITE_LINE_MEMBER(lcd_w);
- DECLARE_WRITE_LINE_MEMBER(data_w) { m_data = (state) ? 1 : 0; }
+ DECLARE_WRITE_LINE_MEMBER(write_clk);
+ DECLARE_WRITE_LINE_MEMBER(write_lcd);
+ DECLARE_WRITE_LINE_MEMBER(write_data) { m_data = (state) ? 1 : 0; }
protected:
hlcd0538_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
diff --git a/src/devices/video/huc6202.h b/src/devices/video/huc6202.h
index 3ff175f0ece..a3e1a47b519 100644
--- a/src/devices/video/huc6202.h
+++ b/src/devices/video/huc6202.h
@@ -12,24 +12,61 @@
#pragma once
+#define MCFG_HUC6202_NEXT_PIXEL_0_CB(_devcb) \
+ downcast<huc6202_device &>(*device).set_next_pixel_0_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6202_TIME_TIL_NEXT_EVENT_0_CB(_devcb) \
+ downcast<huc6202_device &>(*device).set_time_til_next_event_0_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6202_VSYNC_CHANGED_0_CB(_devcb) \
+ downcast<huc6202_device &>(*device).set_vsync_changed_0_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6202_HSYNC_CHANGED_0_CB(_devcb) \
+ downcast<huc6202_device &>(*device).set_hsync_changed_0_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6202_READ_0_CB(_devcb) \
+ downcast<huc6202_device &>(*device).set_read_0_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6202_WRITE_0_CB(_devcb) \
+ downcast<huc6202_device &>(*device).set_write_0_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6202_NEXT_PIXEL_1_CB(_devcb) \
+ downcast<huc6202_device &>(*device).set_next_pixel_1_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6202_TIME_TIL_NEXT_EVENT_1_CB(_devcb) \
+ downcast<huc6202_device &>(*device).set_time_til_next_event_1_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6202_VSYNC_CHANGED_1_CB(_devcb) \
+ downcast<huc6202_device &>(*device).set_vsync_changed_1_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6202_HSYNC_CHANGED_1_CB(_devcb) \
+ downcast<huc6202_device &>(*device).set_hsync_changed_1_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6202_READ_1_CB(_devcb) \
+ downcast<huc6202_device &>(*device).set_read_1_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6202_WRITE_1_CB(_devcb) \
+ downcast<huc6202_device &>(*device).set_write_1_callback(DEVCB_##_devcb);
+
+
class huc6202_device : public device_t
{
public:
// construction/destruction
huc6202_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto next_pixel_0_callback() { return m_next_pixel_0_cb.bind(); }
- auto time_til_next_event_0_callback() { return m_time_til_next_event_0_cb.bind(); }
- auto vsync_changed_0_callback() { return m_vsync_changed_0_cb.bind(); }
- auto hsync_changed_0_callback() { return m_hsync_changed_0_cb.bind(); }
- auto read_0_callback() { return m_read_0_cb.bind(); }
- auto write_0_callback() { return m_write_0_cb.bind(); }
- auto next_pixel_1_callback() { return m_next_pixel_1_cb.bind(); }
- auto time_til_next_event_1_callback() { return m_time_til_next_event_1_cb.bind(); }
- auto vsync_changed_1_callback() { return m_vsync_changed_1_cb.bind(); }
- auto hsync_changed_1_callback() { return m_hsync_changed_1_cb.bind(); }
- auto read_1_callback() { return m_read_1_cb.bind(); }
- auto write_1_callback() { return m_write_1_cb.bind(); }
+ template <class Object> devcb_base &set_next_pixel_0_callback(Object &&cb) { return m_next_pixel_0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_time_til_next_event_0_callback(Object &&cb) { return m_time_til_next_event_0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vsync_changed_0_callback(Object &&cb) { return m_vsync_changed_0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_hsync_changed_0_callback(Object &&cb) { return m_hsync_changed_0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_read_0_callback(Object &&cb) { return m_read_0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_write_0_callback(Object &&cb) { return m_write_0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_next_pixel_1_callback(Object &&cb) { return m_next_pixel_1_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_time_til_next_event_1_callback(Object &&cb) { return m_time_til_next_event_1_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vsync_changed_1_callback(Object &&cb) { return m_vsync_changed_1_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_hsync_changed_1_callback(Object &&cb) { return m_hsync_changed_1_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_read_1_callback(Object &&cb) { return m_read_1_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_write_1_callback(Object &&cb) { return m_write_1_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
diff --git a/src/devices/video/huc6260.h b/src/devices/video/huc6260.h
index 695f60c9a05..8737d0432cf 100644
--- a/src/devices/video/huc6260.h
+++ b/src/devices/video/huc6260.h
@@ -12,6 +12,19 @@
#pragma once
+#define MCFG_HUC6260_NEXT_PIXEL_DATA_CB(_devcb) \
+ downcast<huc6260_device &>(*device).set_next_pixel_data_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6260_TIME_TIL_NEXT_EVENT_CB(_devcb) \
+ downcast<huc6260_device &>(*device).set_time_til_next_event_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6260_VSYNC_CHANGED_CB(_devcb) \
+ downcast<huc6260_device &>(*device).set_vsync_changed_callback(DEVCB_##_devcb);
+
+#define MCFG_HUC6260_HSYNC_CHANGED_CB(_devcb) \
+ downcast<huc6260_device &>(*device).set_hsync_changed_callback(DEVCB_##_devcb);
+
+
class huc6260_device : public device_t,
public device_palette_interface,
public device_video_interface
@@ -27,6 +40,10 @@ public:
// construction/destruction
huc6260_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <class Object> devcb_base &set_next_pixel_data_callback(Object &&cb) { return m_next_pixel_data_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_time_til_next_event_callback(Object &&cb) { return m_time_til_next_event_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vsync_changed_callback(Object &&cb) { return m_vsync_changed_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_hsync_changed_callback(Object &&cb) { return m_hsync_changed_cb.set_callback(std::forward<Object>(cb)); }
auto next_pixel_data() { return m_next_pixel_data_cb.bind(); }
auto time_til_next_event() { return m_time_til_next_event_cb.bind(); }
auto vsync_changed() { return m_vsync_changed_cb.bind(); }
diff --git a/src/devices/video/huc6261.h b/src/devices/video/huc6261.h
index 33efd71fcd9..721ef88cc3a 100644
--- a/src/devices/video/huc6261.h
+++ b/src/devices/video/huc6261.h
@@ -15,6 +15,16 @@
#include "video/huc6272.h"
+#define MCFG_HUC6261_VDC1(_tag) \
+ downcast<huc6261_device &>(*device).set_vdc1_tag(_tag);
+
+#define MCFG_HUC6261_VDC2(_tag) \
+ downcast<huc6261_device &>(*device).set_vdc2_tag(_tag);
+
+#define MCFG_HUC6261_KING(_tag) \
+ downcast<huc6261_device &>(*device).set_king_tag(_tag);
+
+
class huc6261_device : public device_t,
public device_video_interface
{
diff --git a/src/devices/video/huc6270.h b/src/devices/video/huc6270.h
index cd3a9f7acee..2ee9e0d6259 100644
--- a/src/devices/video/huc6270.h
+++ b/src/devices/video/huc6270.h
@@ -12,6 +12,12 @@
#pragma once
+#define MCFG_HUC6270_VRAM_SIZE(_size) \
+ downcast<huc6270_device &>(*device).set_vram_size(_size);
+
+#define MCFG_HUC6270_IRQ_CHANGED_CB(_devcb) \
+ downcast<huc6270_device &>(*device).set_irq_changed_callback(DEVCB_##_devcb);
+
class huc6270_device : public device_t
{
public:
@@ -19,6 +25,7 @@ public:
huc6270_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void set_vram_size(uint32_t vram_size) { m_vram_size = vram_size; }
+ template <class Object> devcb_base &set_irq_changed_callback(Object &&cb) { return m_irq_changed_cb.set_callback(std::forward<Object>(cb)); }
auto irq() { return m_irq_changed_cb.bind(); }
DECLARE_READ8_MEMBER( read );
diff --git a/src/devices/video/huc6271.cpp b/src/devices/video/huc6271.cpp
index 9f90ba8c3b3..7af976a820a 100644
--- a/src/devices/video/huc6271.cpp
+++ b/src/devices/video/huc6271.cpp
@@ -29,14 +29,13 @@ DEFINE_DEVICE_TYPE(HUC6271, huc6271_device, "huc6271", "Hudson HuC6271 \"Rainbow
void huc6271_device::data_map(address_map &map)
{
- if (!has_configured_map(0))
- map(0x000000, 0x0fffff).ram();
+ map(0x000000, 0x0fffff).ram();
}
huc6271_device::huc6271_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, HUC6271, tag, owner, clock)
, device_memory_interface(mconfig, *this)
- , m_data_space_config("data", ENDIANNESS_LITTLE, 32, 32, 0, address_map_constructor(FUNC(huc6271_device::data_map), this))
+ , m_data_space_config("data", ENDIANNESS_LITTLE, 32, 32, 0, address_map_constructor(), address_map_constructor(FUNC(huc6271_device::data_map), this))
{
}
diff --git a/src/devices/video/huc6272.cpp b/src/devices/video/huc6272.cpp
index 0fe5ec52159..c6e94bb9810 100644
--- a/src/devices/video/huc6272.cpp
+++ b/src/devices/video/huc6272.cpp
@@ -25,17 +25,13 @@ DEFINE_DEVICE_TYPE(HUC6272, huc6272_device, "huc6272", "Hudson HuC6272 \"King\""
void huc6272_device::microprg_map(address_map &map)
{
- if (!has_configured_map(0))
- map(0x00, 0x0f).ram().share("microprg_ram");
+ map(0x00, 0x0f).ram().share("microprg_ram");
}
void huc6272_device::kram_map(address_map &map)
{
- if (!has_configured_map(1))
- {
- map(0x000000, 0x0fffff).ram().share("kram_page0");
- map(0x100000, 0x1fffff).ram().share("kram_page1");
- }
+ map(0x000000, 0x0fffff).ram().share("kram_page0");
+ map(0x100000, 0x1fffff).ram().share("kram_page1");
}
@@ -53,8 +49,8 @@ huc6272_device::huc6272_device(const machine_config &mconfig, const char *tag, d
m_huc6271(*this, finder_base::DUMMY_TAG),
m_cdda_l(*this, "cdda_l"),
m_cdda_r(*this, "cdda_r"),
- m_program_space_config("microprg", ENDIANNESS_LITTLE, 16, 4, 0, address_map_constructor(FUNC(huc6272_device::microprg_map), this)),
- m_data_space_config("kram", ENDIANNESS_LITTLE, 32, 21, 0, address_map_constructor(FUNC(huc6272_device::kram_map), this)),
+ m_program_space_config("microprg", ENDIANNESS_LITTLE, 16, 4, 0, address_map_constructor(), address_map_constructor(FUNC(huc6272_device::microprg_map), this)),
+ m_data_space_config("kram", ENDIANNESS_LITTLE, 32, 21, 0, address_map_constructor(), address_map_constructor(FUNC(huc6272_device::kram_map), this)),
m_microprg_ram(*this, "microprg_ram"),
m_kram_page0(*this, "kram_page0"),
m_kram_page1(*this, "kram_page1"),
diff --git a/src/devices/video/huc6272.h b/src/devices/video/huc6272.h
index 8d7f0583600..cd931a1dae9 100644
--- a/src/devices/video/huc6272.h
+++ b/src/devices/video/huc6272.h
@@ -18,6 +18,17 @@
//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_HUC6272_IRQ_CHANGED_CB(cb) \
+ downcast<huc6272_device &>(*device).set_irq_changed_callback((DEVCB_##cb));
+
+#define MCFG_HUC6272_RAINBOW(tag) \
+ downcast<huc6272_device &>(*device).set_rainbow_tag((tag));
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -30,7 +41,7 @@ public:
// construction/destruction
huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto irq_changed_callback() { return m_irq_changed_cb.bind(); }
+ template <class Object> devcb_base &set_irq_changed_callback(Object &&cb) { return m_irq_changed_cb.set_callback(std::forward<Object>(cb)); }
template <typename T> void set_rainbow_tag(T &&tag) { m_huc6271.set_tag(std::forward<T>(tag)); }
// I/O operations
diff --git a/src/devices/video/i8244.cpp b/src/devices/video/i8244.cpp
index a2d142b0410..639174a84b8 100644
--- a/src/devices/video/i8244.cpp
+++ b/src/devices/video/i8244.cpp
@@ -130,22 +130,6 @@ i8245_device::i8245_device(const machine_config &mconfig, const char *tag, devic
//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void i8244_device::device_config_complete()
-{
- if (!has_screen())
- return;
-
- if (!screen().refresh_attoseconds())
- screen().set_raw(clock(), LINE_CLOCKS, START_ACTIVE_SCAN, END_ACTIVE_SCAN, m_screen_lines, START_Y, START_Y + SCREEN_HEIGHT);
-}
-
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h
index 2a46163073b..0bf0174cdba 100644
--- a/src/devices/video/i8244.h
+++ b/src/devices/video/i8244.h
@@ -17,6 +17,25 @@
/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_I8244_ADD(_tag, _clock, _screen_tag, _irq_cb, _postprocess_cb) \
+ MCFG_DEVICE_ADD(_tag, I8244, _clock) \
+ MCFG_VIDEO_SET_SCREEN(_screen_tag) \
+ MCFG_I8244_IRQ_CB(_irq_cb) \
+ MCFG_I8244_POSTPROCESS_CB(_postprocess_cb)
+#define MCFG_I8244_IRQ_CB(_devcb) \
+ downcast<i8244_device &>(*device).set_irq_cb(DEVCB_##_devcb);
+#define MCFG_I8244_POSTPROCESS_CB(_devcb) \
+ downcast<i8244_device &>(*device).set_postprocess_cb(DEVCB_##_devcb);
+#define MCFG_I8245_ADD(_tag, _clock, _screen_tag, _irq_cb, _postprocess_cb) \
+ MCFG_DEVICE_ADD(_tag, I8245, _clock) \
+ MCFG_VIDEO_SET_SCREEN(_screen_tag) \
+ MCFG_I8244_IRQ_CB(_irq_cb) \
+ MCFG_I8244_POSTPROCESS_CB(_postprocess_cb )
+
+/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
@@ -32,8 +51,8 @@ public:
i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration helpers
- auto irq_cb() { return m_irq_func.bind(); }
- auto postprocess_cb() { return m_postprocess_func.bind(); }
+ template <class Object> devcb_base &set_irq_cb(Object &&cb) { return m_irq_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_postprocess_cb(Object &&cb) { return m_postprocess_func.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER(read);
DECLARE_WRITE8_MEMBER(write);
@@ -90,7 +109,6 @@ protected:
i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int lines);
// device-level overrides
- virtual void device_config_complete() override;
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
diff --git a/src/devices/video/i8275.h b/src/devices/video/i8275.h
index f5d6b3633bc..44bede3ace4 100644
--- a/src/devices/video/i8275.h
+++ b/src/devices/video/i8275.h
@@ -44,6 +44,26 @@
#define I8275_DRAW_CHARACTER_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, int x, int y, uint8_t linecount, uint8_t charcode, uint8_t lineattr, uint8_t lten, uint8_t rvv, uint8_t vsp, uint8_t gpa, uint8_t hlgt)
+#define MCFG_I8275_CHARACTER_WIDTH(_value) \
+ downcast<i8275_device &>(*device).set_character_width(_value);
+
+#define MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(_class, _method) \
+ downcast<i8275_device &>(*device).set_display_callback(&_class::_method, #_class "::" #_method, this);
+
+#define MCFG_I8275_DRQ_CALLBACK(_write) \
+ downcast<i8275_device &>(*device).set_drq_wr_callback(DEVCB_##_write);
+
+#define MCFG_I8275_IRQ_CALLBACK(_write) \
+ downcast<i8275_device &>(*device).set_irq_wr_callback(DEVCB_##_write);
+
+#define MCFG_I8275_HRTC_CALLBACK(_write) \
+ downcast<i8275_device &>(*device).set_hrtc_wr_callback(DEVCB_##_write);
+
+#define MCFG_I8275_VRTC_CALLBACK(_write) \
+ downcast<i8275_device &>(*device).set_vrtc_wr_callback(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -76,6 +96,10 @@ public:
set_display_callback(draw_character_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr)));
}
+ template <class Object> devcb_base &set_drq_wr_callback(Object &&cb) { return m_write_drq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_irq_wr_callback(Object &&cb) { return m_write_irq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_hrtc_wr_callback(Object &&cb) { return m_write_hrtc.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vrtc_wr_callback(Object &&cb) { return m_write_vrtc.set_callback(std::forward<Object>(cb)); }
auto drq_wr_callback() { return m_write_drq.bind(); }
auto irq_wr_callback() { return m_write_irq.bind(); }
auto hrtc_wr_callback() { return m_write_hrtc.bind(); }
diff --git a/src/devices/video/ims_cvc.cpp b/src/devices/video/ims_cvc.cpp
index 14ae0901769..60b76604ef5 100644
--- a/src/devices/video/ims_cvc.cpp
+++ b/src/devices/video/ims_cvc.cpp
@@ -10,7 +10,7 @@
* http://bitsavers.org/components/inmos/graphics/72-TRN-204-01_Graphics_Databook_Second_Edition_1990.pdf
*
* TODO
- * - cursor
+ * - everything (skeleton only)
*/
#include "emu.h"
@@ -18,10 +18,7 @@
#include "screen.h"
-#define LOG_GENERAL (1U << 0)
-#define LOG_CONFIG (1U << 1)
-
-//#define VERBOSE (LOG_GENERAL|LOG_CONFIG)
+#define VERBOSE 0
#include "logmacro.h"
DEFINE_DEVICE_TYPE(G300, g300_device, "g300", "INMOS G300 Colour Video Controller")
@@ -30,9 +27,9 @@ DEFINE_DEVICE_TYPE(G364, g364_device, "g364", "INMOS G364 Colour Video Controlle
ims_cvc_device::ims_cvc_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_memory_interface(mconfig, *this)
, device_palette_interface(mconfig, *this)
- , m_screen(*this, finder_base::DUMMY_TAG)
- , m_vram(*this, finder_base::DUMMY_TAG)
+ , m_space_config("shared", ENDIANNESS_LITTLE, 32, 24)
{
}
@@ -43,12 +40,11 @@ g300_device::g300_device(const machine_config &mconfig, const char *tag, device_
g332_device::g332_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: ims_cvc_device(mconfig, type, tag, owner, clock)
- , m_microport(*this, "microport")
{
}
g332_device::g332_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : g332_device(mconfig, G332, tag, owner, clock)
+ : ims_cvc_device(mconfig, G332, tag, owner, clock)
{
}
@@ -57,9 +53,11 @@ g364_device::g364_device(const machine_config &mconfig, const char *tag, device_
{
}
-void g332_device::device_add_mconfig(machine_config &config)
+device_memory_interface::space_config_vector ims_cvc_device::memory_space_config() const
{
- ADDRESS_MAP_BANK(config, m_microport).set_map(&g332_device::microport_map).set_options(ENDIANNESS_LITTLE, 32, 32);
+ return space_config_vector{
+ std::make_pair(0, &m_space_config)
+ };
}
void g300_device::map(address_map &map)
@@ -71,18 +69,18 @@ void g300_device::map(address_map &map)
map(0x000 << shift, (0x0ff << shift) | 0x3).rw(FUNC(g300_device::colour_palette_r), FUNC(g300_device::colour_palette_w));
// data path registers
- map(0x121 << shift, (0x121 << shift) | 0x3).rw(FUNC(g300_device::halfsync_r), FUNC(g300_device::halfsync_w));
- map(0x122 << shift, (0x122 << shift) | 0x3).rw(FUNC(g300_device::backporch_r), FUNC(g300_device::backporch_w));
- map(0x123 << shift, (0x123 << shift) | 0x3).rw(FUNC(g300_device::display_r), FUNC(g300_device::display_w));
- map(0x124 << shift, (0x124 << shift) | 0x3).rw(FUNC(g300_device::shortdisplay_r), FUNC(g300_device::shortdisplay_w));
- map(0x125 << shift, (0x125 << shift) | 0x3).rw(FUNC(g300_device::broadpulse_r), FUNC(g300_device::broadpulse_w));
- map(0x126 << shift, (0x126 << shift) | 0x3).rw(FUNC(g300_device::vsync_r), FUNC(g300_device::vsync_w));
- map(0x127 << shift, (0x127 << shift) | 0x3).rw(FUNC(g300_device::vblank_r), FUNC(g300_device::vblank_w));
- map(0x128 << shift, (0x128 << shift) | 0x3).rw(FUNC(g300_device::vdisplay_r), FUNC(g300_device::vdisplay_w));
- map(0x129 << shift, (0x129 << shift) | 0x3).rw(FUNC(g300_device::linetime_r), FUNC(g300_device::linetime_w));
- map(0x12a << shift, (0x12a << shift) | 0x3).rw(FUNC(g300_device::tos_r), FUNC(g300_device::tos_w));
- map(0x12b << shift, (0x12b << shift) | 0x3).rw(FUNC(g300_device::meminit_r), FUNC(g300_device::meminit_w));
- map(0x12c << shift, (0x12c << shift) | 0x3).rw(FUNC(g300_device::transferdelay_r), FUNC(g300_device::transferdelay_w));
+ map(0x121, (0x121 << shift) | 0x3).rw(FUNC(g300_device::halfsync_r), FUNC(g300_device::halfsync_w));
+ map(0x122, (0x122 << shift) | 0x3).rw(FUNC(g300_device::backporch_r), FUNC(g300_device::backporch_w));
+ map(0x123, (0x123 << shift) | 0x3).rw(FUNC(g300_device::display_r), FUNC(g300_device::display_w));
+ map(0x124, (0x124 << shift) | 0x3).rw(FUNC(g300_device::shortdisplay_r), FUNC(g300_device::shortdisplay_w));
+ map(0x125, (0x125 << shift) | 0x3).rw(FUNC(g300_device::broadpulse_r), FUNC(g300_device::broadpulse_w));
+ map(0x126, (0x126 << shift) | 0x3).rw(FUNC(g300_device::vsync_r), FUNC(g300_device::vsync_w));
+ map(0x127, (0x127 << shift) | 0x3).rw(FUNC(g300_device::vblank_r), FUNC(g300_device::vblank_w));
+ map(0x128, (0x128 << shift) | 0x3).rw(FUNC(g300_device::vdisplay_r), FUNC(g300_device::vdisplay_w));
+ map(0x129, (0x129 << shift) | 0x3).rw(FUNC(g300_device::linetime_r), FUNC(g300_device::linetime_w));
+ map(0x12a, (0x12a << shift) | 0x3).rw(FUNC(g300_device::tos_r), FUNC(g300_device::tos_w));
+ map(0x12b, (0x12b << shift) | 0x3).rw(FUNC(g300_device::meminit_r), FUNC(g300_device::meminit_w));
+ map(0x12c, (0x12c << shift) | 0x3).rw(FUNC(g300_device::transferdelay_r), FUNC(g300_device::transferdelay_w));
map(0x140 << shift, (0x140 << shift) | 0x3).rw(FUNC(g300_device::mask_r), FUNC(g300_device::mask_w));
map(0x160 << shift, (0x160 << shift) | 0x3).rw(FUNC(g300_device::control_r), FUNC(g300_device::control_w));
@@ -92,45 +90,37 @@ void g300_device::map(address_map &map)
void g332_device::map(address_map &map)
{
- map(0x0000, 0x1fff).m(m_microport, FUNC(address_map_bank_device::amap32));
-}
-
-void g332_device::microport_map(address_map &map)
-{
- // datasheet uses unshifted addresses: configure the device map for 64 bit
- // address mode, bank device does handles additional shift for 32 bit mode
- const int shift = 3;
+ // datasheet gives unshifted addresses
+ const int shift = 2; // TODO: 64 bit mode
- map(0x000 << shift, (0x000 << shift) | 0x7).w(FUNC(g332_device::boot_w));
+ map(0x000 << shift, (0x000 << shift) | 0x3).w(FUNC(g332_device::boot_w));
// data path registers
- map(0x021 << shift, (0x021 << shift) | 0x7).rw(FUNC(g332_device::halfsync_r), FUNC(g332_device::halfsync_w));
- map(0x022 << shift, (0x022 << shift) | 0x7).rw(FUNC(g332_device::backporch_r), FUNC(g332_device::backporch_w));
- map(0x023 << shift, (0x023 << shift) | 0x7).rw(FUNC(g332_device::display_r), FUNC(g332_device::display_w));
- map(0x024 << shift, (0x024 << shift) | 0x7).rw(FUNC(g332_device::shortdisplay_r), FUNC(g332_device::shortdisplay_w));
- map(0x025 << shift, (0x025 << shift) | 0x7).rw(FUNC(g332_device::broadpulse_r), FUNC(g332_device::broadpulse_w));
- map(0x026 << shift, (0x026 << shift) | 0x7).rw(FUNC(g332_device::vsync_r), FUNC(g332_device::vsync_w));
- map(0x027 << shift, (0x027 << shift) | 0x7).rw(FUNC(g332_device::vpreequalise_r), FUNC(g332_device::vpreequalise_w));
- map(0x028 << shift, (0x028 << shift) | 0x7).rw(FUNC(g332_device::vpostequalise_r), FUNC(g332_device::vpostequalise_w));
- map(0x029 << shift, (0x029 << shift) | 0x7).rw(FUNC(g332_device::vblank_r), FUNC(g332_device::vblank_w));
- map(0x02a << shift, (0x02a << shift) | 0x7).rw(FUNC(g332_device::vdisplay_r), FUNC(g332_device::vdisplay_w));
- map(0x02b << shift, (0x02b << shift) | 0x7).rw(FUNC(g332_device::linetime_r), FUNC(g332_device::linetime_w));
- map(0x02c << shift, (0x02c << shift) | 0x7).rw(FUNC(g332_device::linestart_r), FUNC(g332_device::linestart_w));
- map(0x02d << shift, (0x02d << shift) | 0x7).rw(FUNC(g332_device::meminit_r), FUNC(g332_device::meminit_w));
- map(0x02e << shift, (0x02e << shift) | 0x7).rw(FUNC(g332_device::transferdelay_r), FUNC(g332_device::transferdelay_w));
-
- map(0x040 << shift, (0x040 << shift) | 0x7).rw(FUNC(g332_device::mask_r), FUNC(g332_device::mask_w));
- map(0x060 << shift, (0x060 << shift) | 0x7).rw(FUNC(g332_device::control_a_r), FUNC(g332_device::control_a_w));
- map(0x070 << shift, (0x070 << shift) | 0x7).rw(FUNC(g332_device::control_b_r), FUNC(g332_device::control_b_w));
- map(0x080 << shift, (0x080 << shift) | 0x7).rw(FUNC(g332_device::tos_r), FUNC(g332_device::tos_w));
+ map(0x021, (0x021 << shift) | 0x3).rw(FUNC(g332_device::halfsync_r), FUNC(g332_device::halfsync_w));
+ map(0x022, (0x022 << shift) | 0x3).rw(FUNC(g332_device::backporch_r), FUNC(g332_device::backporch_w));
+ map(0x023, (0x023 << shift) | 0x3).rw(FUNC(g332_device::display_r), FUNC(g332_device::display_w));
+ map(0x024, (0x024 << shift) | 0x3).rw(FUNC(g332_device::shortdisplay_r), FUNC(g332_device::shortdisplay_w));
+ map(0x025, (0x025 << shift) | 0x3).rw(FUNC(g332_device::broadpulse_r), FUNC(g332_device::broadpulse_w));
+ map(0x026, (0x026 << shift) | 0x3).rw(FUNC(g332_device::vsync_r), FUNC(g332_device::vsync_w));
+ map(0x027, (0x027 << shift) | 0x3).rw(FUNC(g332_device::vpreequalise_r), FUNC(g332_device::vpreequalise_w));
+ map(0x028, (0x028 << shift) | 0x3).rw(FUNC(g332_device::vpostequalise_r), FUNC(g332_device::vpostequalise_w));
+ map(0x029, (0x029 << shift) | 0x3).rw(FUNC(g332_device::vblank_r), FUNC(g332_device::vblank_w));
+ map(0x02a, (0x02a << shift) | 0x3).rw(FUNC(g332_device::vdisplay_r), FUNC(g332_device::vdisplay_w));
+ map(0x02b, (0x02b << shift) | 0x3).rw(FUNC(g332_device::linetime_r), FUNC(g332_device::linetime_w));
+ map(0x02c, (0x02c << shift) | 0x3).rw(FUNC(g332_device::linestart_r), FUNC(g332_device::linestart_w));
+ map(0x02d, (0x02d << shift) | 0x3).rw(FUNC(g332_device::meminit_r), FUNC(g332_device::meminit_w));
+ map(0x02e, (0x02e << shift) | 0x3).rw(FUNC(g332_device::transferdelay_r), FUNC(g332_device::transferdelay_w));
+
+ map(0x040 << shift, (0x040 << shift) | 0x3).rw(FUNC(g332_device::mask_r), FUNC(g332_device::mask_w));
+ map(0x060 << shift, (0x060 << shift) | 0x3).rw(FUNC(g332_device::control_a_r), FUNC(g332_device::control_a_w));
+ map(0x070 << shift, (0x070 << shift) | 0x3).rw(FUNC(g332_device::control_b_r), FUNC(g332_device::control_b_w));
+ map(0x080 << shift, (0x080 << shift) | 0x3).rw(FUNC(g332_device::tos_r), FUNC(g332_device::tos_w));
// cursor palette (0a1-0a3)
- map(0x0a1 << shift, (0x0a3 << shift) | 0x7).rw(FUNC(g332_device::cursor_palette_r), FUNC(g332_device::cursor_palette_w));
-
// checksum registers (0c0-0c2)
// colour palette
- map(0x100 << shift, (0x1ff << shift) | 0x7).rw(FUNC(g332_device::colour_palette_r), FUNC(g332_device::colour_palette_w));
+ map(0x100 << shift, (0x1ff << shift) | 0x3).rw(FUNC(g332_device::colour_palette_r), FUNC(g332_device::colour_palette_w));
// cursor store (200-3ff)
// cursor position (0c7)
@@ -138,208 +128,13 @@ void g332_device::microport_map(address_map &map)
void ims_cvc_device::device_start()
{
- save_item(NAME(m_halfsync));
- save_item(NAME(m_backporch));
- save_item(NAME(m_display));
- save_item(NAME(m_shortdisplay));
- save_item(NAME(m_broadpulse));
- save_item(NAME(m_vsync));
- save_item(NAME(m_vblank));
- save_item(NAME(m_vdisplay));
- save_item(NAME(m_linetime));
- save_item(NAME(m_meminit));
- save_item(NAME(m_transferdelay));
-
- save_item(NAME(m_mask));
- save_item(NAME(m_tos));
- save_item(NAME(m_boot));
+ m_space = &space(0);
}
void ims_cvc_device::device_reset()
{
}
-void g300_device::device_start()
-{
- ims_cvc_device::device_start();
-
- save_item(NAME(m_control));
-}
-
-void g332_device::device_start()
-{
- ims_cvc_device::device_start();
-
- save_item(NAME(m_vpreequalise));
- save_item(NAME(m_vpostequalise));
- save_item(NAME(m_linestart));
- save_item(NAME(m_control_a));
- save_item(NAME(m_control_b));
-}
-
-void g332_device::device_reset()
-{
- m_control_a = 0;
-}
-
-u32 g300_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
-{
- offs_t address = m_tos;
-
- for (int y = screen.visible_area().min_y; y <= screen.visible_area().max_y; y++)
- for (int x = screen.visible_area().min_x; x <= screen.visible_area().max_x; x++)
- bitmap.pix(y, x) = pen_color(m_vram->read(address++) & m_mask);
-
- return 0;
-}
-
-u32 g332_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+void ims_cvc_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- offs_t address = m_tos;
-
- switch (m_control_a & PIXEL_BITS)
- {
- case BPP_1:
- for (int y = screen.visible_area().min_y; y <= screen.visible_area().max_y; y++)
- for (int x = screen.visible_area().min_x; x <= screen.visible_area().max_x; x += 8)
- {
- u8 pixel_data = m_vram->read(address++);
-
- bitmap.pix(y, x + 0) = pen_color(pixel_data & 0x1 & m_mask); pixel_data >>= 1;
- bitmap.pix(y, x + 1) = pen_color(pixel_data & 0x1 & m_mask); pixel_data >>= 1;
- bitmap.pix(y, x + 2) = pen_color(pixel_data & 0x1 & m_mask); pixel_data >>= 1;
- bitmap.pix(y, x + 3) = pen_color(pixel_data & 0x1 & m_mask); pixel_data >>= 1;
- bitmap.pix(y, x + 4) = pen_color(pixel_data & 0x1 & m_mask); pixel_data >>= 1;
- bitmap.pix(y, x + 5) = pen_color(pixel_data & 0x1 & m_mask); pixel_data >>= 1;
- bitmap.pix(y, x + 6) = pen_color(pixel_data & 0x1 & m_mask); pixel_data >>= 1;
- bitmap.pix(y, x + 7) = pen_color(pixel_data & 0x1 & m_mask);
- }
- break;
-
- case BPP_2:
- for (int y = screen.visible_area().min_y; y <= screen.visible_area().max_y; y++)
- for (int x = screen.visible_area().min_x; x <= screen.visible_area().max_x; x += 4)
- {
- u8 pixel_data = m_vram->read(address++);
-
- bitmap.pix(y, x + 0) = pen_color(pixel_data & 0x3 & m_mask); pixel_data >>= 2;
- bitmap.pix(y, x + 1) = pen_color(pixel_data & 0x3 & m_mask); pixel_data >>= 2;
- bitmap.pix(y, x + 2) = pen_color(pixel_data & 0x3 & m_mask); pixel_data >>= 2;
- bitmap.pix(y, x + 3) = pen_color(pixel_data & 0x3 & m_mask);
- }
- break;
-
- case BPP_4:
- for (int y = screen.visible_area().min_y; y <= screen.visible_area().max_y; y++)
- for (int x = screen.visible_area().min_x; x <= screen.visible_area().max_x; x += 2)
- {
- u8 pixel_data = m_vram->read(address++);
-
- bitmap.pix(y, x + 0) = pen_color(pixel_data & 0xf & m_mask); pixel_data >>= 4;
- bitmap.pix(y, x + 1) = pen_color(pixel_data & 0xf & m_mask);
- }
- break;
-
- case BPP_8:
- for (int y = screen.visible_area().min_y; y <= screen.visible_area().max_y; y++)
- for (int x = screen.visible_area().min_x; x <= screen.visible_area().max_x; x++)
- bitmap.pix(y, x) = pen_color(m_vram->read(address++) & m_mask);
- break;
- }
-
- return 0;
-}
-
-u32 ims_cvc_device::colour_palette_r(offs_t offset)
-{
- return 0;
-}
-
-void ims_cvc_device::colour_palette_w(offs_t offset, u32 data, u32 mem_mask)
-{
- set_pen_color(offset >> 1, data >> 16, data >> 8, data >> 0);
-}
-
-u32 g332_device::cursor_palette_r(offs_t offset)
-{
- return 0;
-}
-
-void g332_device::cursor_palette_w(offs_t offset, u32 data, u32 mem_mask)
-{
- set_pen_color(256 + (offset >> 1), data >> 16, data >> 8, data >> 0);
-}
-
-void g332_device::boot_w(offs_t offset, u32 data, u32 mem_mask)
-{
- LOG("boot_w %s clock, multiplier %d, %d bit alignment (%s)\n",
- (data & PLL_SELECT) ? "PLL" : "external", (data & PLL_MULTIPLIER),
- (data & ALIGN_64) ? 64 : 32, machine().describe_context());
-
- m_microport->set_shift((data & ALIGN_64) ? 0 : 1);
-
- mem_mask &= 0x00ffffffU;
- COMBINE_DATA(&m_boot);
-}
-
-void g332_device::control_a_w(offs_t offset, u32 data, u32 mem_mask)
-{
- LOG("control_a_w 0x%08x (%s)\n", data, machine().describe_context());
-
- mem_mask &= 0x00ffffffU;
- COMBINE_DATA(&m_control_a);
-
- if (data & VTG_ENABLE)
- {
- LOGMASKED(LOG_CONFIG, "VTG %s, %s, %s mode\n",
- (data & VTG_ENABLE) ? "enabled" : "disabled",
- (data & INTL_ENABLE) ? ((data & INTL_FORMAT) ? "interlaced (CCIR)" : "interlaced (EIA)") : "non-interlaced",
- (data & SLAVE_MODE) ? "slave" : "master");
-
- LOGMASKED(LOG_CONFIG, "%s sync, %s digital sync, analogue %s\n",
- (data & SYNC_PATTERN) ? "plain" : "tesselated",
- (data & SYNC_FORMAT) ? "separate" : "composite",
- (data & VIDEO_FORMAT) ? "video only" : "composite video + sync");
-
- LOGMASKED(LOG_CONFIG, "%s, CBlank is %s, %s, %s\n",
- (data & BLANK_LEVEL) ? "blanking pedestal" : "no blank pedestal",
- (data & BLANK_IO) ? "ouput" : "input",
- (data & BLANK_FUNC) ? "undelayed ClkDisable" : "delayed CBlank",
- (data & BLANK_FORCE) ? "screen blanked" : (data & BLANK_DISABLE) ? "blanking disabled" : "blanking enabled");
-
- LOGMASKED(LOG_CONFIG, "address increment %d, DMA %s, sync delay %d cycles\n",
- (data & ADDR_INC) == INC_1 ? 1 :
- (data & ADDR_INC) == INC_256 ? (data & INTL_ENABLE) ? 2 : 256 :
- (data & ADDR_INC) == INC_512 ? 512 : 1024,
- (data & DMA_DISABLE) ? "disabled" : "enabled",
- (data & SYNC_DELAY) >> 15);
-
- LOGMASKED(LOG_CONFIG, "interleave %s, pixel sampling %s, %s bits per pixel, cursor %s\n",
- (data & INTERLEAVE) ? "enabled" : "disabled",
- (data & SAMPLE_DELAY) ? "delayed" : "standard",
- (data & PIXEL_BITS) == BPP_1 ? "1" :
- (data & PIXEL_BITS) == BPP_2 ? "2" :
- (data & PIXEL_BITS) == BPP_4 ? "4" :
- (data & PIXEL_BITS) == BPP_8 ? "8" :
- (data & PIXEL_BITS) == BPP_15 ? "15" :
- (data & PIXEL_BITS) == BPP_16 ? "16" : "unknown",
- (data & CURSOR_DISABLE) ? "disabled" : "enabled");
-
- LOG("display %d vdisplay %d\n", m_display, m_vdisplay);
- LOG("linetime %d halfsync %d backporch %d broadpulse %d\n", m_linetime, m_halfsync, m_backporch, m_broadpulse);
- LOG("vsync %d vpreequalise %d vpostequalise %d vblank %d\n", m_vsync, m_vpreequalise, m_vpostequalise, m_vblank);
-
- int const hbend = (m_halfsync + m_halfsync + m_backporch) << 2;
- int const vbend = (m_vpreequalise + m_vpostequalise + m_vsync + m_vblank) >> 1;
- int const width = m_linetime << 2;
- int const height = vbend + (m_vdisplay >> 1);
-
- rectangle const visarea(hbend, hbend + (m_display << 2) - 1, vbend, height - 1);
-
- u32 const dotclock = (m_boot & PLL_SELECT) ? clock() * (m_boot & PLL_MULTIPLIER) : clock();
- attotime const refresh = attotime::from_hz(dotclock / (width * height));
-
- m_screen->configure(width, height, visarea, refresh.as_attoseconds());
- m_screen->reset_origin();
- }
}
diff --git a/src/devices/video/ims_cvc.h b/src/devices/video/ims_cvc.h
index 82acfe5c6eb..25c0163642d 100644
--- a/src/devices/video/ims_cvc.h
+++ b/src/devices/video/ims_cvc.h
@@ -5,22 +5,15 @@
#pragma once
-#include "machine/bankdev.h"
-#include "machine/ram.h"
-
-class ims_cvc_device
- : public device_t
- , public device_palette_interface
+class ims_cvc_device :
+ public device_t,
+ public device_memory_interface,
+ public device_palette_interface
{
public:
- static constexpr feature_type imperfect_features() { return feature::GRAPHICS; }
-
- // configuration
- template <typename T> void set_screen(T &&tag) { m_screen.set_tag(std::forward<T>(tag)); }
- template <typename T> void set_vram(T &&tag) { m_vram.set_tag(std::forward<T>(tag)); }
-
virtual void map(address_map &map) = 0;
- virtual u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) = 0;
+
+ void screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
protected:
ims_cvc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -29,47 +22,51 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
+ // device_memory_interface overrides
+ virtual space_config_vector memory_space_config() const override;
+
// device_palette_interface overrides
- virtual u32 palette_entries() const override { return 256; }
+ virtual u32 palette_entries() const override { return 256; } // FIXME
- u32 colour_palette_r(const offs_t offset);
- void colour_palette_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU);
+ u32 colour_palette_r(const offs_t offset) { return 0; }
+ void colour_palette_w(const offs_t offset, const u32 data) {}
u32 halfsync_r() { return m_halfsync; }
- void halfsync_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_halfsync); }
+ void halfsync_w(const u32 data) { m_halfsync = data; }
u32 backporch_r() { return m_backporch; }
- void backporch_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_backporch); }
+ void backporch_w(const u32 data) { m_backporch = data; }
u32 display_r() { return m_display; }
- void display_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_display); }
+ void display_w(const u32 data) { m_display = data; }
u32 shortdisplay_r() { return m_shortdisplay; }
- void shortdisplay_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_shortdisplay); }
+ void shortdisplay_w(const u32 data) { m_shortdisplay = data; }
u32 broadpulse_r() { return m_broadpulse; }
- void broadpulse_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_broadpulse); }
+ void broadpulse_w(const u32 data) { m_broadpulse = data; }
u32 vsync_r() { return m_vsync; }
- void vsync_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_vsync); }
+ void vsync_w(const u32 data) { m_vsync = data; }
u32 vblank_r() { return m_vblank; }
- void vblank_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_vblank); }
+ void vblank_w(const u32 data) { m_vblank = data; }
u32 vdisplay_r() { return m_vdisplay; }
- void vdisplay_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_vdisplay); }
+ void vdisplay_w(const u32 data) { m_vdisplay = data; }
u32 linetime_r() { return m_linetime; }
- void linetime_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_linetime); }
+ void linetime_w(const u32 data) { m_linetime = data; }
//u32 tos_r() { return m_tos; }
//void tos_w(const u32 data) { m_tos = data; }
u32 meminit_r() { return m_meminit; }
- void meminit_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_meminit); }
+ void meminit_w(const u32 data) { m_meminit = data; }
u32 transferdelay_r() { return m_transferdelay; }
- void transferdelay_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_transferdelay); }
+ void transferdelay_w(const u32 data) { m_transferdelay = data; }
u32 mask_r() { return m_mask; }
- void mask_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_mask); }
+ void mask_w(const u32 data) { m_mask = data; }
u32 tos_r() { return m_tos; }
- void tos_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_tos); }
+ void tos_w(const u32 data) { m_tos = data; }
- virtual void boot_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_boot); }
+ void boot_w(const u32 data) { m_boot = data; }
- required_device<screen_device> m_screen;
- required_device<ram_device> m_vram;
+private:
+ // device_memory_interface members
+ const address_space_config m_space_config;
+ address_space *m_space;
-protected:
// device state
u32 m_halfsync;
u32 m_backporch;
@@ -95,13 +92,9 @@ public:
virtual void map(address_map &map) override;
- virtual u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) override;
-
protected:
- virtual void device_start() override;
-
u32 control_r() { return m_control; }
- void control_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_control); }
+ void control_w(const u32 data) { m_control = data; }
private:
u32 m_control;
@@ -114,86 +107,21 @@ public:
virtual void map(address_map &map) override;
- virtual u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) override;
-
- enum boot_mask : u32
- {
- PLL_MULTIPLIER = 0x000001f, // pll multiplier
- PLL_SELECT = 0x0000020, // pll clock select
- ALIGN_64 = 0x0000040, // 64 bit address alignment
- };
-
- enum control_a_mask
- {
- VTG_ENABLE = 0x000001, // video timing generator enable
- INTL_ENABLE = 0x000002, // interlace enable
- INTL_FORMAT = 0x000004, // ccir/eia interlace format
- SLAVE_MODE = 0x000008, // slave/master operating mode
- SYNC_PATTERN = 0x000010, // plain/tesselated sync
- SYNC_FORMAT = 0x000020, // separate/composite sync
- VIDEO_FORMAT = 0x000040, // video only/composite video + sync
- BLANK_LEVEL = 0x000080, // blanking pedestal/no blank pedestal
- BLANK_IO = 0x000100, // CBlank is output/input
- BLANK_FUNC = 0x000200, // undelayed ClkDisable/delayed CBlank
- BLANK_FORCE = 0x000400, // screen blanked/no action
- BLANK_DISABLE = 0x000800, // blanking disabled/enabled
- ADDR_INC = 0x003000, // VRAM address increment
- DMA_DISABLE = 0x004000, // DMA disabled/enabled
- SYNC_DELAY = 0x038000,
- INTERLEAVE = 0x040000, // interleave enabled/disabled
- SAMPLE_DELAY = 0x080000,
- PIXEL_BITS = 0x700000, // bits per pixel
- CURSOR_DISABLE = 0x800000, // cursor disabled/enabled
- };
- enum control_a_addr_inc_mask
- {
- INC_1 = 0x000000,
- INC_256 = 0x001000,
- INC_512 = 0x002000,
- INC_1024 = 0x003000,
- };
- enum control_a_bpp_mask
- {
- BPP_1 = 0x000000,
- BPP_2 = 0x100000,
- BPP_4 = 0x200000,
- BPP_8 = 0x300000,
- BPP_15 = 0x400000,
- BPP_16 = 0x500000,
- };
-
protected:
g332_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
- // device_t overrides
- virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_start() override;
- virtual void device_reset() override;
-
- // device_palette_interface overrides
- virtual u32 palette_entries() const override { return 256 + 3; }
-
- virtual void microport_map(address_map &map);
-
- virtual void boot_w(offs_t offset, u32 data, u32 mem_mask = 0x00ffffffU) override;
-
- u32 cursor_palette_r(const offs_t offset);
- void cursor_palette_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU);
-
u32 vpreequalise_r() { return m_vpreequalise; }
- void vpreequalise_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_vpreequalise); }
+ void vpreequalise_w(const u32 data) { m_vpreequalise = data; }
u32 vpostequalise_r() { return m_vpostequalise; }
- void vpostequalise_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_vpostequalise); }
+ void vpostequalise_w(const u32 data) { m_vpostequalise = data; }
u32 linestart_r() { return m_linestart; }
- void linestart_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_linestart); }
+ void linestart_w(const u32 data) { m_linestart = data; }
u32 control_a_r() { return m_control_a; }
- void control_a_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU);
+ void control_a_w(const u32 data) { m_control_a = data; }
u32 control_b_r() { return m_control_b; }
- void control_b_w(offs_t offset, u32 data, u32 mem_mask = 0xffffffffU) { COMBINE_DATA(&m_control_b); }
+ void control_b_w(const u32 data) { m_control_b = data; }
private:
- required_device<address_map_bank_device> m_microport;
-
u32 m_vpreequalise;
u32 m_vpostequalise;
u32 m_linestart;
diff --git a/src/devices/video/jangou_blitter.h b/src/devices/video/jangou_blitter.h
index 8bf4f4a56ec..3ff34b50ae7 100644
--- a/src/devices/video/jangou_blitter.h
+++ b/src/devices/video/jangou_blitter.h
@@ -7,6 +7,14 @@
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_JANGOU_BLITTER_ADD(_tag,_freq) \
+ MCFG_DEVICE_ADD(_tag, JANGOU_BLITTER, _freq)
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/devices/video/m50458.cpp b/src/devices/video/m50458.cpp
index 59e0f44cc43..41a6bd1651f 100644
--- a/src/devices/video/m50458.cpp
+++ b/src/devices/video/m50458.cpp
@@ -31,18 +31,15 @@ DEFINE_DEVICE_TYPE(M50458, m50458_device, "m50458", "Mitsubishi M50458 OSD")
void m50458_device::m50458_vram(address_map &map)
{
- if (!has_configured_map(0))
- {
- map(0x0000, 0x023f).ram(); // vram
- map(0x0240, 0x0241).w(FUNC(m50458_device::vreg_120_w));
- map(0x0242, 0x0243).w(FUNC(m50458_device::vreg_121_w));
- map(0x0244, 0x0245).w(FUNC(m50458_device::vreg_122_w));
- map(0x0246, 0x0247).w(FUNC(m50458_device::vreg_123_w));
- map(0x0248, 0x0249).w(FUNC(m50458_device::vreg_124_w));
- map(0x024a, 0x024b).w(FUNC(m50458_device::vreg_125_w));
- map(0x024c, 0x024d).w(FUNC(m50458_device::vreg_126_w));
- map(0x024e, 0x024f).w(FUNC(m50458_device::vreg_127_w));
- }
+ map(0x0000, 0x023f).ram(); // vram
+ map(0x0240, 0x0241).w(FUNC(m50458_device::vreg_120_w));
+ map(0x0242, 0x0243).w(FUNC(m50458_device::vreg_121_w));
+ map(0x0244, 0x0245).w(FUNC(m50458_device::vreg_122_w));
+ map(0x0246, 0x0247).w(FUNC(m50458_device::vreg_123_w));
+ map(0x0248, 0x0249).w(FUNC(m50458_device::vreg_124_w));
+ map(0x024a, 0x024b).w(FUNC(m50458_device::vreg_125_w));
+ map(0x024c, 0x024d).w(FUNC(m50458_device::vreg_126_w));
+ map(0x024e, 0x024f).w(FUNC(m50458_device::vreg_127_w));
}
// internal GFX ROM (TODO: GFXs in here should be 12x18, not 16x18)
@@ -183,7 +180,7 @@ m50458_device::m50458_device(const machine_config &mconfig, const char *tag, dev
: device_t(mconfig, M50458, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
- , m_space_config("videoram", ENDIANNESS_LITTLE, 16, 16, 0, address_map_constructor(FUNC(m50458_device::m50458_vram), this))
+ , m_space_config("videoram", ENDIANNESS_LITTLE, 16, 16, 0, address_map_constructor(), address_map_constructor(FUNC(m50458_device::m50458_vram), this))
{
}
diff --git a/src/devices/video/m50458.h b/src/devices/video/m50458.h
index 07113a93afe..5be6ceaf08c 100644
--- a/src/devices/video/m50458.h
+++ b/src/devices/video/m50458.h
@@ -12,6 +12,16 @@ Mitsubishi M50458 OSD chip
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_M50458_ADD(_tag,_freq,_screen) \
+ MCFG_DEVICE_ADD(_tag, M50458,_freq) \
+ MCFG_VIDEO_SET_SCREEN(_screen)
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -24,13 +34,6 @@ class m50458_device : public device_t,
{
public:
// construction/destruction
- template <typename T>
- m50458_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&screen_tag)
- : m50458_device(mconfig, tag, owner, clock)
- {
- set_screen(std::forward<T>(screen_tag));
- }
-
m50458_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// I/O operations
diff --git a/src/devices/video/mb88303.h b/src/devices/video/mb88303.h
index f8804adff61..9c088d8d56b 100644
--- a/src/devices/video/mb88303.h
+++ b/src/devices/video/mb88303.h
@@ -26,6 +26,21 @@
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MB88303_VOW_CALLBACK(_write) \
+ downcast<mb88303_device &>(*device).set_vow_callback(DEVCB_##_write);
+
+#define MCFG_MB88303_VOBN_CALLBACK(_write) \
+ downcast<mb88303_device &>(*device).set_vob_n_callback(DEVCB_##_write);
+
+#define MCFG_MB88303_DO_CALLBACK(_write) \
+ downcast<mb88303_device &>(*device).set_do_callback(DEVCB_##_write);
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -41,9 +56,9 @@ public:
// construction/destruction
mb88303_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto vow_callback() { return m_write_vow.bind(); }
- auto vobn_callback() { return m_write_vobn.bind(); }
- auto do_callback() { return m_write_do.bind(); }
+ template <class Object> devcb_base &set_vow_callback(Object &&cb) { return m_write_vow.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vobn_callback(Object &&cb) { return m_write_vobn.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_do_callback(Object &&cb) { return m_write_do.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE8_MEMBER(da_w);
DECLARE_WRITE_LINE_MEMBER(adm_w);
diff --git a/src/devices/video/mb90082.cpp b/src/devices/video/mb90082.cpp
index 957669fb48b..a3026aeb179 100644
--- a/src/devices/video/mb90082.cpp
+++ b/src/devices/video/mb90082.cpp
@@ -25,13 +25,10 @@ DEFINE_DEVICE_TYPE(MB90082, mb90082_device, "mb90082", "Fujitsu MB90082 OSD")
void mb90082_device::mb90082_vram(address_map &map)
{
- if (!has_configured_map(0))
- {
- map(0x0000, 0x023f).ram(); // main screen vram
- map(0x0400, 0x063f).ram(); // main screen attr
+ map(0x0000, 0x023f).ram(); // main screen vram
+ map(0x0400, 0x063f).ram(); // main screen attr
// AM_RANGE(0x0800, 0x0a3f) AM_RAM // sub screen vram
// AM_RANGE(0x0c00, 0x0e3f) AM_RAM // sub screen attr
- }
}
/* charset is undumped, but apparently a normal ASCII one is enough for the time being (for example "fnt0808.x1" in Sharp X1) */
@@ -94,7 +91,7 @@ inline void mb90082_device::write_word(offs_t address, uint16_t data)
mb90082_device::mb90082_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MB90082, tag, owner, clock)
, device_memory_interface(mconfig, *this)
- , m_space_config("videoram", ENDIANNESS_LITTLE, 16, 16, 0, address_map_constructor(FUNC(mb90082_device::mb90082_vram), this))
+ , m_space_config("videoram", ENDIANNESS_LITTLE, 16, 16, 0, address_map_constructor(), address_map_constructor(FUNC(mb90082_device::mb90082_vram), this))
{
}
diff --git a/src/devices/video/mb90082.h b/src/devices/video/mb90082.h
index 5c6d2c46df3..3fa203f385f 100644
--- a/src/devices/video/mb90082.h
+++ b/src/devices/video/mb90082.h
@@ -12,6 +12,14 @@
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MB90082_ADD(_tag,_freq) \
+ MCFG_DEVICE_ADD(_tag, MB90082, _freq)
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/devices/video/mb_vcu.cpp b/src/devices/video/mb_vcu.cpp
index 96acc945359..8d0f921be12 100644
--- a/src/devices/video/mb_vcu.cpp
+++ b/src/devices/video/mb_vcu.cpp
@@ -38,20 +38,16 @@ DEFINE_DEVICE_TYPE(MB_VCU, mb_vcu_device, "mb_vcu", "Mazer Blazer custom VCU")
void mb_vcu_device::mb_vcu_vram(address_map &map)
{
- if (!has_configured_map(0))
- map(0x00000, 0x7ffff).ram(); // enough for a 256x256x4 x 2 pages of framebuffer with 4 layers (TODO: doubled for simplicity)
+ map(0x00000, 0x7ffff).ram(); // enough for a 256x256x4 x 2 pages of framebuffer with 4 layers (TODO: doubled for simplicity)
}
void mb_vcu_device::mb_vcu_pal_ram(address_map &map)
{
- if (!has_configured_map(1))
- {
- map(0x0000, 0x00ff).ram();
- map(0x0200, 0x02ff).ram();
- map(0x0400, 0x04ff).ram();
- map(0x0600, 0x06ff).rw(FUNC(mb_vcu_device::mb_vcu_paletteram_r), FUNC(mb_vcu_device::mb_vcu_paletteram_w));
- }
+ map(0x0000, 0x00ff).ram();
+ map(0x0200, 0x02ff).ram();
+ map(0x0400, 0x04ff).ram();
+ map(0x0600, 0x06ff).rw(FUNC(mb_vcu_device::mb_vcu_paletteram_r), FUNC(mb_vcu_device::mb_vcu_paletteram_w));
}
READ8_MEMBER( mb_vcu_device::mb_vcu_paletteram_r )
@@ -68,19 +64,19 @@ WRITE8_MEMBER( mb_vcu_device::mb_vcu_paletteram_w )
/* red component */
bit1 = (m_palram[offset] >> 7) & 0x01;
bit0 = (m_palram[offset] >> 6) & 0x01;
- r = combine_weights(m_weights_r, bit0, bit1);
+ r = combine_2_weights(m_weights_r, bit0, bit1);
/* green component */
bit2 = (m_palram[offset] >> 5) & 0x01;
bit1 = (m_palram[offset] >> 4) & 0x01;
bit0 = (m_palram[offset] >> 3) & 0x01;
- g = combine_weights(m_weights_g, bit0, bit1, bit2);
+ g = combine_3_weights(m_weights_g, bit0, bit1, bit2);
/* blue component */
bit2 = (m_palram[offset] >> 2) & 0x01;
bit1 = (m_palram[offset] >> 1) & 0x01;
bit0 = (m_palram[offset] >> 0) & 0x01;
- b = combine_weights(m_weights_b, bit0, bit1, bit2);
+ b = combine_3_weights(m_weights_b, bit0, bit1, bit2);
m_palette->set_pen_color(offset, rgb_t(r, g, b));
}
@@ -151,8 +147,8 @@ mb_vcu_device::mb_vcu_device(const machine_config &mconfig, const char *tag, dev
: device_t(mconfig, MB_VCU, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
- , m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 19, 0, address_map_constructor(FUNC(mb_vcu_device::mb_vcu_vram), this))
- , m_paletteram_space_config("palram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(mb_vcu_device::mb_vcu_pal_ram), this))
+ , m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 19, 0, address_map_constructor(), address_map_constructor(FUNC(mb_vcu_device::mb_vcu_vram), this))
+ , m_paletteram_space_config("palram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(), address_map_constructor(FUNC(mb_vcu_device::mb_vcu_pal_ram), this))
, m_cpu(*this, finder_base::DUMMY_TAG)
, m_palette(*this, finder_base::DUMMY_TAG)
{
@@ -478,19 +474,19 @@ WRITE8_MEMBER( mb_vcu_device::background_color_w )
/* red component */
bit1 = (m_bk_color >> 7) & 0x01;
bit0 = (m_bk_color >> 6) & 0x01;
- r = combine_weights(m_weights_r, bit0, bit1);
+ r = combine_2_weights(m_weights_r, bit0, bit1);
/* green component */
bit2 = (m_bk_color >> 5) & 0x01;
bit1 = (m_bk_color >> 4) & 0x01;
bit0 = (m_bk_color >> 3) & 0x01;
- g = combine_weights(m_weights_g, bit0, bit1, bit2);
+ g = combine_3_weights(m_weights_g, bit0, bit1, bit2);
/* blue component */
bit2 = (m_bk_color >> 2) & 0x01;
bit1 = (m_bk_color >> 1) & 0x01;
bit0 = (m_bk_color >> 0) & 0x01;
- b = combine_weights(m_weights_b, bit0, bit1, bit2);
+ b = combine_3_weights(m_weights_b, bit0, bit1, bit2);
m_palette->set_pen_color(0x100, rgb_t(r, g, b));
}
diff --git a/src/devices/video/mb_vcu.h b/src/devices/video/mb_vcu.h
index 90f0eea422a..a8b53637a7d 100644
--- a/src/devices/video/mb_vcu.h
+++ b/src/devices/video/mb_vcu.h
@@ -23,8 +23,8 @@ public:
mb_vcu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration
- template <typename T> void set_palette_tag(T &&tag) { m_palette.set_tag(std::forward<T>(tag)); }
- template <typename T> void set_cpu_tag(T &&tag) { m_cpu.set_tag(std::forward<T>(tag)); }
+ void set_palette_tag(const char *tag) { m_palette.set_tag(tag); }
+ void set_cpu_tag(const char *tag) { m_cpu.set_tag(tag); }
// I/O operations
DECLARE_WRITE8_MEMBER( write_vregs );
@@ -86,4 +86,15 @@ private:
// device type definition
DECLARE_DEVICE_TYPE(MB_VCU, mb_vcu_device)
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MB_VCU_CPU(_tag) \
+ downcast<mb_vcu_device &>(*device).set_cpu_tag(_tag);
+
+#define MCFG_MB_VCU_PALETTE(_palette_tag) \
+ downcast<mb_vcu_device &>(*device).set_palette_tag(_palette_tag);
+
#endif // MAME_VIDEO_MB_VCU_H
diff --git a/src/devices/video/mc6845.cpp b/src/devices/video/mc6845.cpp
index 82ec8408130..13c1c8a6155 100644
--- a/src/devices/video/mc6845.cpp
+++ b/src/devices/video/mc6845.cpp
@@ -129,13 +129,13 @@ void mc6845_device::call_on_update_address(int strobe)
}
-void mc6845_device::address_w(uint8_t data)
+void mc6845_device::write_address(uint8_t data)
{
m_register_address_latch = data & 0x1f;
}
-uint8_t mc6845_device::status_r()
+uint8_t mc6845_device::read_status()
{
uint8_t ret = 0;
@@ -178,7 +178,7 @@ void mc6845_device::transparent_update()
}
-uint8_t mc6845_device::register_r()
+uint8_t mc6845_device::read_register()
{
uint8_t ret = 0;
@@ -200,7 +200,7 @@ uint8_t mc6845_device::register_r()
}
-void mc6845_device::register_w(uint8_t data)
+void mc6845_device::write_register(uint8_t data)
{
LOG("%s:M6845 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
@@ -253,13 +253,13 @@ void mc6845_device::register_w(uint8_t data)
}
-void mos8563_device::address_w(uint8_t data)
+WRITE8_MEMBER( mos8563_device::address_w )
{
m_register_address_latch = data & 0x3f;
}
-uint8_t mos8563_device::status_r()
+READ8_MEMBER( mos8563_device::status_r )
{
uint8_t ret = m_revision;
@@ -279,7 +279,7 @@ uint8_t mos8563_device::status_r()
}
-uint8_t mos8563_device::register_r()
+READ8_MEMBER( mos8563_device::register_r )
{
uint8_t ret = 0xff;
@@ -329,7 +329,7 @@ uint8_t mos8563_device::register_r()
}
-void mos8563_device::register_w(uint8_t data)
+WRITE8_MEMBER( mos8563_device::register_w )
{
LOG("%s:MOS8563 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
@@ -392,13 +392,13 @@ void mos8563_device::register_w(uint8_t data)
recompute_parameters(false);
}
-void hd6345_device::address_w(uint8_t data)
+WRITE8_MEMBER( hd6345_device::address_w )
{
m_register_address_latch = data & 0x3f;
}
-uint8_t hd6345_device::register_r()
+READ8_MEMBER( hd6345_device::register_r )
{
uint8_t ret = 0xff;
@@ -416,7 +416,7 @@ uint8_t hd6345_device::register_r()
return ret;
}
-void hd6345_device::register_w(uint8_t data)
+WRITE8_MEMBER( hd6345_device::register_w )
{
LOG("%s:HD6345 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
@@ -582,7 +582,7 @@ void mc6845_device::recompute_parameters(bool postload)
m_hsync_off_pos = hsync_off_pos;
m_vsync_on_pos = vsync_on_pos;
m_vsync_off_pos = vsync_off_pos;
- if ( (!m_reconfigure_cb.isnull()) && (!postload) )
+ if (!postload) // set m_line_counter to 0 on normal operation, but not on postload
m_line_counter = 0;
}
}
@@ -659,28 +659,6 @@ void mc6845_device::update_upd_adr_timer()
}
-bool mc6845_device::match_line()
-{
- /* Check if we've reached the end of active display */
- if ( m_line_counter == m_vert_disp )
- {
- m_line_enable_ff = false;
- m_current_disp_addr = m_disp_start_addr;
- }
-
- /* Check if VSYNC should be enabled */
- if ( m_line_counter == m_vert_sync_pos )
- {
- m_vsync_width_counter = 0;
- m_vsync_ff = 1;
-
- return true;
- }
-
- return false;
-}
-
-
void mc6845_device::handle_line_timer()
{
bool new_vsync = m_vsync;
@@ -720,8 +698,21 @@ void mc6845_device::handle_line_timer()
m_line_counter = ( m_line_counter + 1 ) & 0x7F;
m_line_address = ( m_line_address + m_horiz_disp ) & 0x3fff;
- if (match_line())
+ /* Check if we've reached the end of active display */
+ if ( m_line_counter == m_vert_disp )
+ {
+ m_line_enable_ff = false;
+ m_current_disp_addr = m_disp_start_addr;
+ }
+
+ /* Check if VSYNC should be enabled */
+ if ( m_line_counter == m_vert_sync_pos )
+ {
+ m_vsync_width_counter = 0;
+ m_vsync_ff = 1;
+
new_vsync = true;
+ }
}
else
{
@@ -740,13 +731,6 @@ void mc6845_device::handle_line_timer()
m_line_counter = 0;
m_line_address = m_disp_start_addr;
m_line_enable_ff = true;
-
- if (m_supports_vert_sync_width)
- {
- if (match_line())
- new_vsync = true;
- }
-
/* also update the cursor state now */
update_cursor_state();
@@ -1454,8 +1438,7 @@ device_memory_interface::space_config_vector mos8563_device::memory_space_config
// default address maps
void mos8563_device::mos8563_videoram_map(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, 0xffff).ram();
+ map(0x0000, 0xffff).ram();
}
@@ -1522,7 +1505,7 @@ mos8563_device::mos8563_device(const machine_config &mconfig, device_type type,
: mc6845_device(mconfig, type, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_palette_interface(mconfig, *this),
- m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(mos8563_device::mos8563_videoram_map), this))
+ m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(), address_map_constructor(FUNC(mos8563_device::mos8563_videoram_map), this))
{
set_clock_scale(1.0/8);
}
diff --git a/src/devices/video/mc6845.h b/src/devices/video/mc6845.h
index 1bb0683ee85..1233651e07b 100644
--- a/src/devices/video/mc6845.h
+++ b/src/devices/video/mc6845.h
@@ -61,16 +61,20 @@ public:
auto out_vsync_callback() { return m_out_vsync_cb.bind(); }
/* select one of the registers for reading or writing */
- void address_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( address_w ) { write_address(data); }
+ void write_address(uint8_t data);
/* read from the status register */
- uint8_t status_r();
+ DECLARE_READ8_MEMBER( status_r ) { return read_status(); }
+ uint8_t read_status();
/* read from the currently selected register */
- uint8_t register_r();
+ DECLARE_READ8_MEMBER( register_r ) { return read_register(); }
+ uint8_t read_register();
/* write to the currently selected register */
- void register_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( register_w ) { write_register(data); }
+ void write_register(uint8_t data);
// read display enable line state
DECLARE_READ_LINE_MEMBER( de_r );
@@ -211,7 +215,6 @@ protected:
void set_hsync(int state);
void set_vsync(int state);
void set_cur(int state);
- bool match_line();
void handle_line_timer();
virtual void update_cursor_state();
virtual uint8_t draw_scanline(int y, bitmap_rgb32 &bitmap, const rectangle &cliprect);
@@ -344,9 +347,9 @@ class hd6345_device : public mc6845_device
public:
hd6345_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void address_w(uint8_t data);
- uint8_t register_r();
- void register_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER(address_w);
+ DECLARE_READ8_MEMBER(register_r);
+ DECLARE_WRITE8_MEMBER(register_w);
protected:
virtual void device_start() override;
@@ -380,10 +383,10 @@ class mos8563_device : public mc6845_device,
public:
mos8563_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void address_w(uint8_t data);
- uint8_t status_r();
- uint8_t register_r();
- void register_w(uint8_t data);
+ DECLARE_WRITE8_MEMBER( address_w );
+ DECLARE_READ8_MEMBER( status_r );
+ DECLARE_READ8_MEMBER( register_r );
+ DECLARE_WRITE8_MEMBER( register_w );
inline uint8_t read_videoram(offs_t offset);
inline void write_videoram(offs_t offset, uint8_t data);
diff --git a/src/devices/video/mc6847.cpp b/src/devices/video/mc6847.cpp
index 4ef156632b0..84b48bc1526 100644
--- a/src/devices/video/mc6847.cpp
+++ b/src/devices/video/mc6847.cpp
@@ -132,14 +132,14 @@ const uint32_t mc6847_base_device::s_palette[mc6847_base_device::PALETTE_LENGTH]
mc6847_friend_device::mc6847_friend_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock,
const uint8_t *fontdata, bool is_mc6847t1, double tpfs, int field_sync_falling_edge_scanline, int divider, bool supports_partial_body_scanlines)
: device_t(mconfig, type, tag, owner, clock)
- , device_video_interface(mconfig, *this)
, m_write_hsync(*this)
, m_write_fsync(*this)
, m_character_map(fontdata, is_mc6847t1)
- , m_tpfs(tpfs)
- , m_divider(divider)
- , m_supports_partial_body_scanlines(supports_partial_body_scanlines)
{
+ m_tpfs = tpfs;
+ m_divider = divider;
+ m_supports_partial_body_scanlines = supports_partial_body_scanlines;
+
// The MC6847 and the GIME apply field sync on different scanlines
m_field_sync_falling_edge_scanline = field_sync_falling_edge_scanline;
}
@@ -577,31 +577,6 @@ void mc6847_base_device::setup_fixed_mode()
//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void mc6847_base_device::device_config_complete()
-{
- if (!has_screen())
- return;
-
- if (!screen().refresh_attoseconds())
- {
- // FIXME: use correct raw parameters rather than this nonsense
- screen().set_refresh_hz(m_tpfs > 310.0 ? 50 : 60);
- screen().set_size(320, 243);
- screen().set_visarea(0, 320-1, 1, 241-1);
- screen().set_vblank_time(0);
- }
-
- if (!screen().has_screen_update())
- screen().set_screen_update(screen_update_rgb32_delegate(FUNC(mc6847_base_device::screen_update), this));
-}
-
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
diff --git a/src/devices/video/mc6847.h b/src/devices/video/mc6847.h
index b9e8e02ed4c..3868420280b 100644
--- a/src/devices/video/mc6847.h
+++ b/src/devices/video/mc6847.h
@@ -19,6 +19,41 @@
// MC6847 CONFIGURATION / INTERFACE
//**************************************************************************
+#define MCFG_SCREEN_MC6847_NTSC_ADD(_tag, _mctag) \
+ MCFG_SCREEN_ADD(_tag, RASTER) \
+ MCFG_SCREEN_UPDATE_DEVICE(_mctag, mc6847_base_device, screen_update) \
+ MCFG_SCREEN_REFRESH_RATE(60) \
+ MCFG_SCREEN_SIZE(320, 243) \
+ MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 1, 241-1) \
+ MCFG_SCREEN_VBLANK_TIME(0)
+
+#define MCFG_SCREEN_MC6847_PAL_ADD(_tag, _mctag) \
+ MCFG_SCREEN_ADD(_tag, RASTER) \
+ MCFG_SCREEN_UPDATE_DEVICE(_mctag, mc6847_base_device, screen_update) \
+ MCFG_SCREEN_REFRESH_RATE(50) \
+ MCFG_SCREEN_SIZE(320, 243) \
+ MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 1, 241-1) \
+ MCFG_SCREEN_VBLANK_TIME(0)
+
+#define MCFG_MC6847_HSYNC_CALLBACK(_write) \
+ downcast<mc6847_friend_device &>(*device).set_hsync_wr_callback(DEVCB_##_write);
+
+#define MCFG_MC6847_FSYNC_CALLBACK(_write) \
+ downcast<mc6847_friend_device &>(*device).set_fsync_wr_callback(DEVCB_##_write);
+
+#define MCFG_MC6847_CHARROM_CALLBACK(_class, _method) \
+ downcast<mc6847_friend_device &>(*device).set_get_char_rom(mc6847_friend_device::get_char_rom_delegate(&_class::_method, #_class "::" #_method, this));
+
+#define MCFG_MC6847_INPUT_CALLBACK(_read) \
+ downcast<mc6847_base_device &>(*device).set_input_callback(DEVCB_##_read);
+
+#define MCFG_MC6847_FIXED_MODE(_mode) \
+ downcast<mc6847_base_device &>(*device).set_get_fixed_mode(_mode);
+
+#define MCFG_MC6847_BW(_bw) \
+ downcast<mc6847_base_device &>(*device).set_black_and_white(_bw);
+
+
#define MC6847_GET_CHARROM_MEMBER(_name) uint8_t _name(uint8_t ch, int line)
@@ -32,7 +67,7 @@ INPUT_PORTS_EXTERN(mc6847_artifacting);
//**************************************************************************
// base class so that the GIME emulation can access mc6847 stuff
-class mc6847_friend_device : public device_t, public device_video_interface
+class mc6847_friend_device : public device_t
{
public:
// video mode constants
@@ -51,19 +86,12 @@ public:
bool hs_r() const { return m_horizontal_sync; }
bool fs_r() const { return m_field_sync; }
+ template <class Object> devcb_base &set_hsync_wr_callback(Object &&cb) { return m_write_hsync.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_fsync_wr_callback(Object &&cb) { return m_write_fsync.set_callback(std::forward<Object>(cb)); }
auto hsync_wr_callback() { return m_write_hsync.bind(); }
auto fsync_wr_callback() { return m_write_fsync.bind(); }
template <typename Object> void set_get_char_rom(Object &&cb) { m_charrom_cb = std::forward<Object>(cb); }
- void set_get_char_rom(get_char_rom_delegate cb) { m_charrom_cb = cb; }
- template <class FunctionClass> void set_get_char_rom(const char *devname, uint8_t (FunctionClass::*cb)(uint8_t, int), const char *name)
- {
- set_get_char_rom(get_char_rom_delegate(cb, name, devname, static_cast<FunctionClass *>(nullptr)));
- }
- template <class FunctionClass> void set_get_char_rom(uint8_t (FunctionClass::*cb)(uint8_t, int), const char *name)
- {
- set_get_char_rom(get_char_rom_delegate(cb, name, nullptr, static_cast<FunctionClass *>(nullptr)));
- }
protected:
mc6847_friend_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock,
@@ -451,19 +479,16 @@ private:
emu_timer *m_hsync_off_timer;
emu_timer *m_fsync_timer;
-protected:
- const double m_tpfs;
-
-private:
// incidentals
- const int m_divider;
+ double m_tpfs;
+ int m_divider;
int m_field_sync_falling_edge_scanline;
bool m_wide;
bool m_video_changed;
uint16_t m_top_border_scanlines;
uint16_t m_body_scanlines;
bool m_recording_scanline;
- const bool m_supports_partial_body_scanlines;
+ bool m_supports_partial_body_scanlines;
// video state
uint16_t m_physical_scanline;
@@ -488,6 +513,7 @@ private:
class mc6847_base_device : public mc6847_friend_device
{
public:
+ template <class Object> devcb_base &set_input_callback(Object &&cb) { return m_input_cb.set_callback(std::forward<Object>(cb)); }
auto input_callback() { return m_input_cb.bind(); }
void set_get_fixed_mode(uint8_t mode) { m_fixed_mode = mode; }
@@ -498,6 +524,18 @@ public:
updating is complete, end_update() */
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ template <typename T, typename U>
+ static screen_device &add_pal_screen(machine_config &config, T &&screen_tag, U &&mc_tag)
+ {
+ screen_device &screen(SCREEN(config, std::forward<T>(screen_tag), SCREEN_TYPE_RASTER));
+ screen.set_screen_update(std::forward<U>(mc_tag), FUNC(mc6847_base_device::screen_update));
+ screen.set_refresh_hz(50);
+ screen.set_size(320, 243);
+ screen.set_visarea(0, 320-1, 1, 241-1);
+ screen.set_vblank_time(0);
+ return screen;
+ }
+
// mode changing operations
DECLARE_WRITE_LINE_MEMBER( ag_w ) { change_mode(MODE_AG, state); }
DECLARE_WRITE_LINE_MEMBER( gm2_w ) { change_mode(MODE_GM2, state); }
@@ -512,7 +550,6 @@ protected:
mc6847_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const uint8_t *fontdata, double tpfs);
// device-level overrides
- virtual void device_config_complete() override;
virtual void device_start() override;
virtual void device_reset() override;
virtual ioport_constructor device_input_ports() const override;
diff --git a/src/devices/video/mm5445.cpp b/src/devices/video/mm5445.cpp
deleted file mode 100644
index 6b857ed19b3..00000000000
--- a/src/devices/video/mm5445.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:hap
-/*
-
- National Semiconductor MM5445 series VFD Driver
-
- TODO:
- - brightness control input pin (sets output voltage level)
-
-*/
-
-#include "emu.h"
-#include "video/mm5445.h"
-
-
-DEFINE_DEVICE_TYPE(MM5445, mm5445_device, "mm5445", "MM5445 VFD Driver")
-DEFINE_DEVICE_TYPE(MM5446, mm5446_device, "mm5446", "MM5446 VFD Driver")
-DEFINE_DEVICE_TYPE(MM5447, mm5447_device, "mm5447", "MM5447 VFD Driver")
-DEFINE_DEVICE_TYPE(MM5448, mm5448_device, "mm5448", "MM5448 VFD Driver")
-
-//-------------------------------------------------
-// constructor
-//-------------------------------------------------
-
-mm5445_device::mm5445_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 outpins) :
- device_t(mconfig, type, tag, owner, clock),
- m_outmask((u64(1) << outpins) - 1),
- m_write_output(*this)
-{ }
-
-mm5445_device::mm5445_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- mm5445_device(mconfig, MM5445, tag, owner, clock, 33)
-{ }
-
-mm5446_device::mm5446_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- mm5445_device(mconfig, MM5446, tag, owner, clock, 34)
-{ }
-
-mm5447_device::mm5447_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- mm5445_device(mconfig, MM5447, tag, owner, clock, 34)
-{ }
-
-mm5448_device::mm5448_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- mm5445_device(mconfig, MM5448, tag, owner, clock, 35)
-{ }
-
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void mm5445_device::device_start()
-{
- // resolve callbacks
- m_write_output.resolve_safe();
-
- // zerofill
- m_clk = 0;
- m_enable = 0;
- m_data = 0;
- m_shiftreg = 0;
- m_shiftcount = 0;
-
- // register for savestates
- save_item(NAME(m_clk));
- save_item(NAME(m_enable));
- save_item(NAME(m_data));
- save_item(NAME(m_shiftreg));
- save_item(NAME(m_shiftcount));
-}
-
-
-//-------------------------------------------------
-// handlers
-//-------------------------------------------------
-
-WRITE_LINE_MEMBER(mm5445_device::clock_w)
-{
- state = (state) ? 1 : 0;
- bool rise = state && !m_clk;
- m_clk = state;
-
- // clock on rising edge
- if (rise)
- {
- u64 data_in = u64(m_data & ~m_enable) << 34;
- u64 lead_in = ~m_shiftreg & data_in;
- m_shiftreg = (m_shiftreg & ((u64(1) << 34) - 1)) | data_in;
-
- // leading 1 triggers shift start
- if (m_shiftcount == 0 && !lead_in)
- return;
-
- // output on 35th clock
- if (m_shiftcount == 35)
- {
- m_shiftcount = 0;
- m_write_output(0, m_shiftreg & m_outmask, ~u64(0));
- }
- else
- {
- m_shiftreg >>= 1;
- m_shiftcount++;
- }
- }
-}
diff --git a/src/devices/video/mm5445.h b/src/devices/video/mm5445.h
deleted file mode 100644
index 7d16d4f2ee2..00000000000
--- a/src/devices/video/mm5445.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:hap
-/*
-
- National Semiconductor MM5445 series VFD Driver
-
-*/
-
-#ifndef MAME_VIDEO_MM5445_H
-#define MAME_VIDEO_MM5445_H
-
-#pragma once
-
-// pinout reference
-
-/*
- ____ ____
- VDD 1 |* \_/ | 40 O18
- O17 2 | | 39 O19
- O16 3 | | 38 O20
- O15 4 | | 37 O21
- O14 5 | | 36 O22
- O13 6 | | 35 O23
- O12 7 | | 34 O24
- O11 8 | | 33 O25
- O10 9 | | 32 O26
- O9 10 | MM5445N | 31 O27
- O8 11 | | 30 O28
- O7 12 | | 29 O29
- O6 13 | | 28 O30
- O5 14 | | 27 O31
- O4 15 | | 26 O32
- O3 16 | | 25 O33
- O2 17 | | 24 BRIGHTNESS CONTROL
- O1 18 | | 23 _DATA ENABLE
- VGG 19 | | 22 DATA IN
- VSS 20 |___________| 21 CLOCK IN
-
- O# = OUTPUT BIT #
- MM5446, MM5448 don't have the brightness control pin, an extra output pin instead
- MM5447, MM5448 don't have the data enable pin(always enabled), but another extra output pin
-*/
-
-
-class mm5445_device : public device_t
-{
-public:
- mm5445_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
-
- // configuration helpers
- auto output_cb() { return m_write_output.bind(); }
-
- DECLARE_WRITE_LINE_MEMBER(clock_w);
- DECLARE_WRITE_LINE_MEMBER(enable_w) { m_enable = (state) ? 1 : 0; } // active low, unused on MM5447 and MM5448
- DECLARE_WRITE_LINE_MEMBER(data_w) { m_data = (state) ? 1 : 0; }
-
-protected:
- mm5445_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 outpins);
-
- // device-level overrides
- virtual void device_start() override;
-
- const u64 m_outmask;
-
- int m_clk; // input pin state
- int m_enable; // "
- int m_data; // "
-
- u64 m_shiftreg;
- int m_shiftcount;
-
- // callbacks
- devcb_write64 m_write_output;
-};
-
-
-class mm5446_device : public mm5445_device
-{
-public:
- mm5446_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-};
-
-class mm5447_device : public mm5445_device
-{
-public:
- mm5447_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-};
-
-class mm5448_device : public mm5445_device
-{
-public:
- mm5448_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
-};
-
-
-DECLARE_DEVICE_TYPE(MM5445, mm5445_device)
-DECLARE_DEVICE_TYPE(MM5446, mm5446_device)
-DECLARE_DEVICE_TYPE(MM5447, mm5447_device)
-DECLARE_DEVICE_TYPE(MM5448, mm5448_device)
-
-#endif // MAME_VIDEO_MM5445_H
diff --git a/src/devices/video/mos6566.cpp b/src/devices/video/mos6566.cpp
index b88cad06c64..a671448a4ab 100644
--- a/src/devices/video/mos6566.cpp
+++ b/src/devices/video/mos6566.cpp
@@ -227,14 +227,12 @@ DEFINE_DEVICE_TYPE(MOS8566, mos8566_device, "mos8566", "MOS 8566 VIC-II")
// default address maps
void mos6566_device::mos6566_videoram_map(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, 0x3fff).ram();
+ map(0x0000, 0x3fff).ram();
}
void mos6566_device::mos6566_colorram_map(address_map &map)
{
- if (!has_configured_map(1))
- map(0x000, 0x3ff).ram();
+ map(0x000, 0x3ff).ram();
}
@@ -589,8 +587,8 @@ mos6566_device::mos6566_device(const machine_config &mconfig, device_type type,
device_execute_interface(mconfig, *this),
m_icount(0),
m_variant(variant),
- m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, address_map_constructor(FUNC(mos6566_device::mos6566_videoram_map), this)),
- m_colorram_space_config("colorram", ENDIANNESS_LITTLE, 8, 10, 0, address_map_constructor(FUNC(mos6566_device::mos6566_colorram_map), this)),
+ m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, address_map_constructor(), address_map_constructor(FUNC(mos6566_device::mos6566_videoram_map), this)),
+ m_colorram_space_config("colorram", ENDIANNESS_LITTLE, 8, 10, 0, address_map_constructor(), address_map_constructor(FUNC(mos6566_device::mos6566_colorram_map), this)),
m_write_irq(*this),
m_write_ba(*this),
m_write_aec(*this),
@@ -2448,7 +2446,7 @@ uint32_t mos6566_device::screen_update(screen_device &screen, bitmap_rgb32 &bitm
// read -
//-------------------------------------------------
-uint8_t mos6566_device::read(offs_t offset)
+READ8_MEMBER( mos6566_device::read )
{
uint8_t val = 0;
@@ -2593,7 +2591,7 @@ uint8_t mos6566_device::read(offs_t offset)
// write -
//-------------------------------------------------
-void mos6566_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( mos6566_device::write )
{
DBG_LOG(2, "vic write", ("%.2x:%.2x\n", offset, data));
offset &= 0x3f;
diff --git a/src/devices/video/mos6566.h b/src/devices/video/mos6566.h
index d1d7338e151..6f3a52dbab5 100644
--- a/src/devices/video/mos6566.h
+++ b/src/devices/video/mos6566.h
@@ -199,8 +199,8 @@ public:
virtual space_config_vector memory_space_config() const override;
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( lp_w );
diff --git a/src/devices/video/msm6222b.h b/src/devices/video/msm6222b.h
index 7a2cb00fd89..9cf3623e25f 100644
--- a/src/devices/video/msm6222b.h
+++ b/src/devices/video/msm6222b.h
@@ -15,6 +15,11 @@
#pragma once
+#define MCFG_MSM6222B_ADD( _tag ) \
+ MCFG_DEVICE_ADD( _tag, MSM6222B, 0 )
+
+#define MCFG_MSM6222B_01_ADD( _tag ) \
+ MCFG_DEVICE_ADD( _tag, MSM6222B_01, 0 )
class msm6222b_device : public device_t {
public:
diff --git a/src/devices/video/msm6255.cpp b/src/devices/video/msm6255.cpp
index b1c83556103..ffca4414314 100644
--- a/src/devices/video/msm6255.cpp
+++ b/src/devices/video/msm6255.cpp
@@ -63,8 +63,7 @@ void msm6255_device::map(address_map &map)
// default address map
void msm6255_device::msm6255(address_map &map)
{
- if (!has_configured_map(0))
- map(0x00000, 0xfffff).ram();
+ map(0x00000, 0xfffff).ram();
}
@@ -81,7 +80,7 @@ msm6255_device::msm6255_device(const machine_config &mconfig, const char *tag, d
device_t(mconfig, MSM6255, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 20, 0, address_map_constructor(FUNC(msm6255_device::msm6255), this)),
+ m_space_config("videoram", ENDIANNESS_LITTLE, 8, 20, 0, address_map_constructor(), address_map_constructor(FUNC(msm6255_device::msm6255), this)),
m_cursor(0)
{
}
diff --git a/src/devices/video/nt7534.h b/src/devices/video/nt7534.h
index 75390f8acaa..06e37d2bd26 100644
--- a/src/devices/video/nt7534.h
+++ b/src/devices/video/nt7534.h
@@ -12,6 +12,9 @@
#pragma once
+#define MCFG_NT7534_PIXEL_UPDATE_CB(_class, _method) \
+ downcast<nt7534_device &>(*device).set_pixel_update_cb(nt7534_device::pixel_update_delegate(&_class::_method, #_class "::" #_method, this));
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -29,7 +32,7 @@ public:
// construction/destruction
nt7534_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
- template <typename... T> void set_pixel_update_cb(T &&... args) { m_pixel_update_cb = pixel_update_delegate(std::forward<T>(args)...); }
+ template <typename Object> void set_pixel_update_cb(Object &&cb) { m_pixel_update_cb = std::forward<Object>(cb); }
// device interface
virtual DECLARE_WRITE8_MEMBER(write);
diff --git a/src/devices/video/pc_vga.cpp b/src/devices/video/pc_vga.cpp
index 1170693a2db..9bf529f7213 100644
--- a/src/devices/video/pc_vga.cpp
+++ b/src/devices/video/pc_vga.cpp
@@ -2220,16 +2220,14 @@ WRITE8_MEMBER(vga_device::mem_linear_w)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-void ati_vga_device::device_add_mconfig(machine_config &config)
-{
- MACH8(config, "8514a", 0).set_vga_owner();
+MACHINE_CONFIG_START(ati_vga_device::device_add_mconfig)
+ MCFG_MACH8_ADD_OWNER("8514a")
EEPROM_93C46_16BIT(config, "ati_eeprom");
-}
+MACHINE_CONFIG_END
-void s3_vga_device::device_add_mconfig(machine_config &config)
-{
- IBM8514A(config, "8514a", 0).set_vga_owner();
-}
+MACHINE_CONFIG_START(s3_vga_device::device_add_mconfig)
+ MCFG_8514A_ADD_OWNER("8514a")
+MACHINE_CONFIG_END
/******************************************
diff --git a/src/devices/video/pc_vga.h b/src/devices/video/pc_vga.h
index bab15da5673..afde9bfdfd6 100644
--- a/src/devices/video/pc_vga.h
+++ b/src/devices/video/pc_vga.h
@@ -415,6 +415,14 @@ private:
// device type definition
DECLARE_DEVICE_TYPE(IBM8514A, ibm8514a_device)
+#define MCFG_8514A_ADD(_tag, _param) \
+ MCFG_DEVICE_ADD(_tag, IBM8514A, 0) \
+ downcast<ibm8514a_device*>(device)->set_vga(_param);
+
+#define MCFG_8514A_ADD_OWNER(_tag) \
+ MCFG_DEVICE_ADD(_tag, IBM8514A, 0) \
+ downcast<ibm8514a_device*>(device)->set_vga_owner();
+
class mach8_device : public ibm8514a_device
{
@@ -488,6 +496,13 @@ private:
// device type definition
DECLARE_DEVICE_TYPE(MACH8, mach8_device)
+#define MCFG_MACH8_ADD(_tag, _param) \
+ MCFG_DEVICE_ADD(_tag, MACH8, 0) \
+ downcast<mach8_device*>(device)->set_vga(_param);
+
+#define MCFG_MACH8_ADD_OWNER(_tag) \
+ MCFG_DEVICE_ADD(_tag, MACH8, 0) \
+ downcast<mach8_device*>(device)->set_vga_owner();
// ======================> tseng_vga_device
diff --git a/src/devices/video/pcd8544.h b/src/devices/video/pcd8544.h
index 069984e9483..fee6fad00d8 100644
--- a/src/devices/video/pcd8544.h
+++ b/src/devices/video/pcd8544.h
@@ -18,6 +18,12 @@
#define PCD8544_SCREEN_UPDATE(name) void name(device_t &device, bitmap_ind16 &bitmap, const rectangle &cliprect , uint8_t *vram, int inv)
+#define MCFG_PCD8544_ADD( _tag ) \
+ MCFG_DEVICE_ADD( _tag, PCD8544, 0 )
+
+#define MCFG_PCD8544_SCREEN_UPDATE_CALLBACK(_class, _method) \
+ downcast<pcd8544_device &>(*device).set_screen_update_cb(pcd8544_device::screen_update_delegate(&_class::_method, #_class "::" #_method, this));
+
// ======================> pcd8544_device
@@ -28,7 +34,7 @@ public:
// construction/destruction
pcd8544_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template <typename... T> void set_screen_update_cb(T &&... args) { m_screen_update_cb = screen_update_delegate(std::forward<T>(args)...); }
+ template <typename Object> void set_screen_update_cb(Object &&cb) { m_screen_update_cb = std::forward<Object>(cb); }
// device interface
DECLARE_WRITE_LINE_MEMBER(sdin_w);
diff --git a/src/devices/video/ppu2c0x.cpp b/src/devices/video/ppu2c0x.cpp
index 8aa57660318..341271ed6bf 100644
--- a/src/devices/video/ppu2c0x.cpp
+++ b/src/devices/video/ppu2c0x.cpp
@@ -89,12 +89,9 @@ DEFINE_DEVICE_TYPE(PPU_2C05_04, ppu2c05_04_device, "ppu2c05_04", "2C05_04 PPU")
// default address map
void ppu2c0x_device::ppu2c0x(address_map &map)
{
- if (!has_configured_map(0))
- {
- map(0x0000, 0x3eff).ram();
- map(0x3f00, 0x3fff).rw(FUNC(ppu2c0x_device::palette_read), FUNC(ppu2c0x_device::palette_write));
+ map(0x0000, 0x3eff).ram();
+ map(0x3f00, 0x3fff).rw(FUNC(ppu2c0x_device::palette_read), FUNC(ppu2c0x_device::palette_write));
// AM_RANGE(0x0000, 0x3fff) AM_RAM
- }
}
//-------------------------------------------------
@@ -128,7 +125,7 @@ ppu2c0x_device::ppu2c0x_device(const machine_config &mconfig, device_type type,
, device_memory_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
, device_palette_interface(mconfig, *this)
- , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, address_map_constructor(FUNC(ppu2c0x_device::ppu2c0x), this))
+ , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, address_map_constructor(), address_map_constructor(FUNC(ppu2c0x_device::ppu2c0x), this))
, m_cpu(*this, finder_base::DUMMY_TAG)
, m_scanline(0) // reset the scanline count
, m_int_callback(*this)
@@ -232,7 +229,7 @@ void ppu2c0x_device::device_start()
/* initialize the scanline handling portion */
m_scanline_timer->adjust(screen().time_until_pos(1));
- m_hblank_timer->adjust(m_cpu->cycles_to_attotime(260) / 3); // ??? FIXME - hardcoding NTSC, need better calculation
+ m_hblank_timer->adjust(m_cpu->cycles_to_attotime(86.67)); // ??? FIXME - hardcoding NTSC, need better calculation
m_nmi_timer->adjust(attotime::never);
/* allocate a screen bitmap, videomem and spriteram, a dirtychar array and the monochromatic colortable */
@@ -561,7 +558,7 @@ void ppu2c0x_device::device_timer(emu_timer &timer, device_timer_id id, int para
next_scanline = 0;
// Call us back when the hblank starts for this scanline
- m_hblank_timer->adjust(m_cpu->cycles_to_attotime(260) / 3); // ??? FIXME - hardcoding NTSC, need better calculation
+ m_hblank_timer->adjust(m_cpu->cycles_to_attotime(86.67)); // ??? FIXME - hardcoding NTSC, need better calculation
// trigger again at the start of the next scanline
m_scanline_timer->adjust(screen().time_until_pos(next_scanline * m_scan_scale));
diff --git a/src/devices/video/ps2gs.cpp b/src/devices/video/ps2gs.cpp
index 298b3779bbe..79ba24339d2 100644
--- a/src/devices/video/ps2gs.cpp
+++ b/src/devices/video/ps2gs.cpp
@@ -52,10 +52,9 @@ ps2_gs_device::~ps2_gs_device()
{
}
-void ps2_gs_device::device_add_mconfig(machine_config &config)
-{
- SONYPS2_GIF(config, m_gif, clock(), DEVICE_SELF, m_vu1);
-}
+MACHINE_CONFIG_START(ps2_gs_device::device_add_mconfig)
+ MCFG_DEVICE_ADD(m_gif, SONYPS2_GIF, clock(), DEVICE_SELF, m_vu1)
+MACHINE_CONFIG_END
void ps2_gs_device::device_start()
{
diff --git a/src/devices/video/ramdac.cpp b/src/devices/video/ramdac.cpp
index d651235f60c..dc45e106711 100644
--- a/src/devices/video/ramdac.cpp
+++ b/src/devices/video/ramdac.cpp
@@ -19,13 +19,10 @@
// default address map
void ramdac_device::ramdac_palram(address_map &map)
{
- if (!has_configured_map(0))
- {
- map(0x000, 0x0ff).ram(); // R bank
- map(0x100, 0x1ff).ram(); // G bank
- map(0x200, 0x2ff).ram(); // B bank
- map(0x300, 0x3ff).noprw();
- }
+ map(0x000, 0x0ff).ram(); // R bank
+ map(0x100, 0x1ff).ram(); // G bank
+ map(0x200, 0x2ff).ram(); // B bank
+ map(0x300, 0x3ff).noprw();
}
//**************************************************************************
@@ -47,7 +44,7 @@ DEFINE_DEVICE_TYPE(RAMDAC, ramdac_device, "ramdac", "RAMDAC")
ramdac_device::ramdac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, RAMDAC, tag, owner, clock),
device_memory_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 10, 0, address_map_constructor(FUNC(ramdac_device::ramdac_palram), this)),
+ m_space_config("videoram", ENDIANNESS_LITTLE, 8, 10, 0, address_map_constructor(), address_map_constructor(FUNC(ramdac_device::ramdac_palram), this)),
m_palette(*this, finder_base::DUMMY_TAG),
m_color_base(0),
m_split_read_reg(0)
diff --git a/src/devices/video/saa5050.h b/src/devices/video/saa5050.h
index a9bb680f347..6e1aa5cec6a 100644
--- a/src/devices/video/saa5050.h
+++ b/src/devices/video/saa5050.h
@@ -29,6 +29,21 @@
#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_SAA5050_D_CALLBACK(_read) \
+ downcast<saa5050_device &>(*device).set_d_rd_callback(DEVCB_##_read);
+
+
+#define MCFG_SAA5050_SCREEN_SIZE(_cols, _rows, _size) \
+ downcast<saa5050_device &>(*device).set_screen_size(_cols, _rows, _size);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -43,6 +58,7 @@ public:
void set_screen_size(int cols, int rows, int size) { m_cols = cols; m_rows = rows; m_size = size; }
+ template <class Object> devcb_base &set_d_rd_callback(Object &&cb) { return m_read_d.set_callback(std::forward<Object>(cb)); }
auto d_cb() { return m_read_d.bind(); }
// optional information overrides
diff --git a/src/devices/video/scn2674.cpp b/src/devices/video/scn2674.cpp
index 1e6cf3d68b5..9baae770f4c 100644
--- a/src/devices/video/scn2674.cpp
+++ b/src/devices/video/scn2674.cpp
@@ -25,8 +25,7 @@ DEFINE_DEVICE_TYPE(SCN2674, scn2674_device, "scn2674", "Signetics SCN2674 AVDC")
// default address map
void scn2674_device::scn2674_vram(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, (1 << space_config(0)->addr_width()) - 1).noprw();
+ map(0x0000, (1 << space_config(0)->addr_width()) - 1).noprw();
}
scn2672_device::scn2672_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
@@ -45,15 +44,12 @@ scn2674_device::scn2674_device(const machine_config &mconfig, device_type type,
, device_memory_interface(mconfig, *this)
, m_intr_cb(*this)
, m_breq_cb(*this)
- , m_mbc_cb(*this)
- , m_mbc_char_cb(*this)
- , m_mbc_attr_cb(*this)
, m_IR_pointer(0)
, m_screen1_address(0), m_screen2_address(0)
, m_cursor_address(0)
, m_irq_register(0), m_status_register(0), m_irq_mask(0)
, m_gfx_enabled(false)
- , m_display_enabled(false), m_dadd_enabled(false), m_display_enabled_field(false), m_display_enabled_scanline(false)
+ , m_display_enabled(false), m_display_enabled_field(false), m_display_enabled_scanline(false)
, m_cursor_enabled(false)
, m_hpixels_per_column(0)
, m_double_ht_wd(false)
@@ -87,11 +83,9 @@ scn2674_device::scn2674_device(const machine_config &mconfig, device_type type,
, m_char_buffer(0), m_attr_buffer(0)
, m_linecounter(0), m_address(0), m_start1change(0)
, m_scanline_timer(nullptr)
- , m_breq_timer(nullptr)
- , m_vblank_timer(nullptr)
, m_char_space(nullptr), m_attr_space(nullptr)
- , m_char_space_config("charram", ENDIANNESS_LITTLE, 8, extend_addressing ? 16 : 14, 0, address_map_constructor(FUNC(scn2674_device::scn2674_vram), this))
- , m_attr_space_config("attrram", ENDIANNESS_LITTLE, 8, extend_addressing ? 16 : 14, 0)
+ , m_char_space_config("charram", ENDIANNESS_LITTLE, 8, extend_addressing ? 16 : 14, 0, address_map_constructor(), address_map_constructor(FUNC(scn2674_device::scn2674_vram), this))
+ , m_attr_space_config("attrram", ENDIANNESS_LITTLE, 8, extend_addressing ? 16 : 14, 0, address_map_constructor(), address_map_constructor(FUNC(scn2674_device::scn2674_vram), this))
{
}
@@ -111,12 +105,7 @@ void scn2674_device::device_start()
m_display_cb.bind_relative_to(*owner());
m_intr_cb.resolve_safe();
m_breq_cb.resolve_safe();
- m_mbc_cb.resolve_safe();
- m_mbc_char_cb.resolve();
- m_mbc_attr_cb.resolve();
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scn2674_device::scanline_timer), this));
- m_breq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scn2674_device::breq_timer), this));
- m_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scn2674_device::vblank_timer), this));
+ m_scanline_timer = timer_alloc(TIMER_SCANLINE);
screen().register_screen_bitmap(m_bitmap);
m_char_space = &space(0);
@@ -134,7 +123,6 @@ void scn2674_device::device_start()
save_item(NAME(m_irq_mask));
save_item(NAME(m_gfx_enabled));
save_item(NAME(m_display_enabled));
- save_item(NAME(m_dadd_enabled));
save_item(NAME(m_display_enabled_field));
save_item(NAME(m_display_enabled_scanline));
save_item(NAME(m_cursor_enabled));
@@ -186,7 +174,6 @@ void scn2674_device::device_reset()
m_irq_mask = 0;
m_gfx_enabled = false;
m_display_enabled = false;
- m_dadd_enabled = false;
m_display_enabled_field = false;
m_display_enabled_scanline = false;
m_cursor_enabled = false;
@@ -564,15 +551,9 @@ void scn2674_device::set_display_enabled(bool enabled, int n)
m_display_enabled = false;
if (n == 1)
- {
LOGMASKED(LOG_COMMAND, "%s: Display off - float DADD bus\n", machine().describe_context());
- m_dadd_enabled = false;
- }
else
- {
LOGMASKED(LOG_COMMAND, "%s: Display off - no float DADD bus\n", machine().describe_context());
- m_dadd_enabled = true;
- }
}
else
{
@@ -729,9 +710,6 @@ void scn2674_device::write_delayed_command(uint8_t data)
case 0xbb:
// write from cursor address to pointer address
// TODO: transfer only during blank
- m_display_enabled = false;
- m_display_enabled_field = true;
- m_display_enabled_scanline = false;
for (i = m_cursor_address; i != m_screen2_address; i = ((i + 1) & 0xffff))
{
m_char_space->write_byte(i, m_char_buffer);
@@ -784,17 +762,13 @@ void scn2674_device::write_command(uint8_t data)
m_IR_pointer = 0;
m_irq_register = 0x00;
m_status_register = 0x20; // RDFLG activated
+ m_linecounter = 0;
m_irq_mask = 0x00;
m_gfx_enabled = false;
m_display_enabled = false;
- m_dadd_enabled = false;
m_cursor_enabled = false;
m_use_row_table = false;
m_intr_cb(CLEAR_LINE);
- m_breq_cb(CLEAR_LINE);
- m_mbc_cb(0);
- m_breq_timer->adjust(attotime::never);
- m_vblank_timer->adjust(attotime::never);
}
else
{
@@ -937,8 +911,6 @@ void scn2674_device::write(offs_t offset, uint8_t data)
m_screen1_address = (m_screen1_address & 0x3f00) | data;
if (!screen().vblank())
m_start1change = (m_linecounter / m_scanline_per_char_row) + 1;
- else
- m_start1change = 0;
break;
case 3:
@@ -952,8 +924,6 @@ void scn2674_device::write(offs_t offset, uint8_t data)
}
if (!screen().vblank())
m_start1change = (m_linecounter / m_scanline_per_char_row) + 1;
- else
- m_start1change = 0;
break;
case 4:
@@ -997,200 +967,154 @@ void scn2674_device::recompute_parameters()
rectangle visarea(0, max_visible_x, 0, max_visible_y);
screen().configure(horiz_pix_total, vert_pix_total, visarea, refresh.as_attoseconds());
- m_linecounter = screen().vpos();
- m_scanline_timer->adjust(screen().time_until_pos((m_linecounter + 1) % vert_pix_total, 0), 0, screen().scan_period());
+ m_scanline_timer->adjust(screen().time_until_pos(0, 0), 0, screen().scan_period());
}
-TIMER_CALLBACK_MEMBER(scn2674_device::scanline_timer)
+void scn2674_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- int dw = m_double_ht_wd ? m_double[0] : 0; // double width
- if (((m_display_enabled_scanline) || (m_display_enabled_field && !m_interlace_enable)) && (!m_display_enabled))
+ switch (id)
{
- m_display_enabled = true;
- m_dadd_enabled = true;
- m_display_enabled_scanline = false;
- m_display_enabled_field = false;
- }
+ case TIMER_SCANLINE:
+ {
+ int dw = m_double_ht_wd ? m_double[0] : 0; // double width
+ if (((m_display_enabled_scanline) || (m_display_enabled_field && !m_interlace_enable)) && (!m_display_enabled))
+ {
+ m_display_enabled = true;
+ m_display_enabled_scanline = false;
+ m_display_enabled_field = false;
+ }
- m_linecounter++;
+ m_linecounter++;
- if (m_linecounter >= screen().height())
- {
- m_linecounter = 0;
- m_address = m_screen1_address;
- }
+ if (m_linecounter >= screen().height())
+ {
+ m_linecounter = 0;
+ m_address = m_screen1_address;
+ }
- bool lastscan = m_linecounter == (m_rows_per_screen * m_scanline_per_char_row) - 1;
- if (lastscan)
- {
- int horz_sync_begin = 2 * (m_equalizing_constant + 2 * m_horz_sync_width) - m_horz_sync_width - m_horz_back_porch;
- m_vblank_timer->adjust(clocks_to_attotime(horz_sync_begin));
- }
+ if (m_linecounter == (m_rows_per_screen * m_scanline_per_char_row))
+ {
+ m_status_register |= 0x10;
+ if (BIT(m_irq_mask, 4))
+ {
+ LOGMASKED(LOG_INTR, "V-Blank interrupt at line %d\n", m_linecounter);
+ m_irq_register |= 0x10;
+ m_intr_cb(ASSERT_LINE);
+ }
+ }
- if (m_linecounter >= (m_rows_per_screen * m_scanline_per_char_row))
- {
- if (m_buffer_mode_select == 3 && m_linecounter == (screen().height() - 1))
- m_breq_timer->adjust(clocks_to_attotime(m_character_per_row + 1), ASSERT_LINE);
- return;
- }
+ if (m_linecounter >= (m_rows_per_screen * m_scanline_per_char_row))
+ break;
- int charrow = m_linecounter % m_scanline_per_char_row;
- int tilerow = charrow;
+ int charrow = m_linecounter % m_scanline_per_char_row;
+ int tilerow = charrow;
- // should be triggered at the start of each ROW (line zero for that row)
- if (charrow == 0)
- {
- m_status_register |= 0x08;
- if (BIT(m_irq_mask, 3))
- {
- LOGMASKED(LOG_INTR, "Line Zero interrupt at line %d\n", m_linecounter);
- m_irq_register |= 0x08;
- m_intr_cb(ASSERT_LINE);
- }
- if (m_buffer_mode_select == 3)
- {
- m_mbc_cb(1);
- m_breq_timer->adjust(clocks_to_attotime(m_character_per_row + 1), CLEAR_LINE);
- }
- }
- else if (m_buffer_mode_select == 3 && charrow == (m_scanline_per_char_row - 1) && !lastscan)
- m_breq_timer->adjust(clocks_to_attotime(m_character_per_row + 1), ASSERT_LINE);
+ // should be triggered at the start of each ROW (line zero for that row)
+ if (charrow == 0)
+ {
+ m_status_register |= 0x08;
+ if (BIT(m_irq_mask, 3))
+ {
+ LOGMASKED(LOG_INTR, "Line Zero interrupt at line %d\n", m_linecounter);
+ m_irq_register |= 0x08;
+ m_intr_cb(ASSERT_LINE);
+ }
+ if (m_buffer_mode_select == 3)
+ m_breq_cb(ASSERT_LINE);
+ }
+ else if (m_buffer_mode_select == 3)
+ m_breq_cb(CLEAR_LINE);
- // Handle screen splits
- for (int s = 0; s < 2; s++)
- {
- if ((m_linecounter == ((m_split_register[s] + 1) * m_scanline_per_char_row)) && m_linecounter)
- {
- uint8_t flag = (s == 0) ? 0x04 : 0x01;
- m_status_register |= flag;
- if ((m_irq_mask & flag) != 0)
+ // Handle screen splits
+ for (int s = 0; s < 2; s++)
{
- LOGMASKED(LOG_INTR, "Split Screen %d interrupt at line %d\n", s + 1, m_linecounter);
- m_irq_register |= flag;
- m_intr_cb(ASSERT_LINE);
+ if ((m_linecounter == ((m_split_register[s] + 1) * m_scanline_per_char_row)) && m_linecounter)
+ {
+ uint8_t flag = (s == 0) ? 0x04 : 0x01;
+ m_status_register |= flag;
+ if ((m_irq_mask & flag) != 0)
+ {
+ LOGMASKED(LOG_INTR, "Split Screen %d interrupt at line %d\n", s + 1, m_linecounter);
+ m_irq_register |= flag;
+ m_intr_cb(ASSERT_LINE);
+ }
+ if (m_spl[s])
+ m_address = m_screen2_address;
+ if (!m_double_ht_wd)
+ dw = m_double[s];
+ }
}
- if (m_spl[s])
- m_address = m_screen2_address;
- if (!m_double_ht_wd)
- dw = m_double[s];
- }
- }
- // WY-50 requires that normal row buffering take place even after a "display off" command
- if (!m_dadd_enabled)
- return;
+ if (!m_display_enabled)
+ break;
- if (m_use_row_table)
- {
- if (m_double_ht_wd)
- dw = m_screen1_address >> 14;
- if (!charrow)
- {
- uint16_t addr = m_screen2_address;
- uint16_t line = m_char_space->read_word(addr);
- m_screen1_address = line;
- if (m_double_ht_wd)
+ if (m_use_row_table)
{
- dw = line >> 14;
- line &= ~0xc000;
+ if (m_double_ht_wd)
+ dw = m_screen1_address >> 14;
+ if (!charrow)
+ {
+ uint16_t addr = m_screen2_address;
+ uint16_t line = m_char_space->read_word(addr);
+ m_screen1_address = line;
+ if (m_double_ht_wd)
+ {
+ dw = line >> 14;
+ line &= ~0xc000;
+ }
+ m_address = line;
+ addr += 2;
+ m_screen2_address = addr & 0x3fff;
+ }
+ }
+ else if (m_start1change && (m_start1change == (m_linecounter / m_scanline_per_char_row)))
+ {
+ m_address = m_screen1_address;
+ m_start1change = 0;
}
- m_address = line;
- addr += 2;
- m_screen2_address = addr & 0x3fff;
- }
- }
- else if (m_start1change && (m_start1change == (m_linecounter / m_scanline_per_char_row)))
- {
- m_address = m_screen1_address;
- m_start1change = 0;
- }
- if (dw == 2)
- tilerow >>= 1;
- else if (dw == 3)
- tilerow = (charrow + m_scanline_per_char_row) >> 1;
+ if (dw == 2)
+ tilerow >>= 1;
+ else if (dw == 3)
+ tilerow = (charrow + m_scanline_per_char_row) >> 1;
- uint16_t address = m_address;
+ uint16_t address = m_address;
- const bool mbc = (charrow == 0) && (m_buffer_mode_select == 3);
- const bool blink_on = (screen().frame_number() & (m_character_blink_rate_divisor >> 1)) != 0;
- for (int i = 0; i < m_character_per_row; i++)
- {
- u8 charcode, attrcode = 0;
- if (mbc && !m_mbc_char_cb.isnull())
- {
- // row buffering DMA
- charcode = m_mbc_char_cb(address);
- m_char_space->write_byte(address, charcode);
- if (m_attr_space != nullptr && !m_mbc_attr_cb.isnull())
+ for (int i = 0; i < m_character_per_row; i++)
{
- attrcode = m_mbc_attr_cb(address);
- m_attr_space->write_byte(address, attrcode);
+ bool cursor_on = ((address & 0x3fff) == m_cursor_address);
+
+ if (!m_display_cb.isnull())
+ m_display_cb(m_bitmap,
+ i * m_hpixels_per_column,
+ m_linecounter,
+ tilerow,
+ m_char_space->read_byte(address),
+ m_attr_space != nullptr ? m_attr_space->read_byte(address) : 0,
+ address,
+ (charrow >= m_cursor_first_scanline) && (charrow <= m_cursor_last_scanline) && cursor_on,
+ dw != 0,
+ m_gfx_enabled,
+ charrow == m_cursor_underline_position,
+ m_cursor_blink && (screen().frame_number() & m_cursor_rate_divisor));
+ address = (address + 1) & 0xffff;
+
+ if (address > ((m_display_buffer_last_address << 10) | 0x3ff))
+ address = m_display_buffer_first_address;
}
- }
- else
- {
- charcode = m_char_space->read_byte(address);
- if (m_attr_space != nullptr)
- attrcode = m_attr_space->read_byte(address);
- }
-
- if (m_display_enabled && !m_display_cb.isnull())
- {
- bool cursor_on = ((address & 0x3fff) == m_cursor_address)
- && m_cursor_enabled
- && (charrow >= m_cursor_first_scanline)
- && (charrow <= m_cursor_last_scanline)
- && (!m_cursor_blink || (screen().frame_number() & (m_cursor_rate_divisor >> 1)) != 0);
- m_display_cb(m_bitmap,
- i * m_hpixels_per_column,
- m_linecounter,
- tilerow,
- charcode,
- attrcode,
- address,
- cursor_on,
- dw != 0,
- m_gfx_enabled,
- charrow == m_cursor_underline_position,
- blink_on);
+ if (m_gfx_enabled || (charrow == (m_scanline_per_char_row - 1)))
+ m_address = address;
}
- address = (address + 1) & 0xffff;
-
- if (address > ((m_display_buffer_last_address << 10) | 0x3ff))
- address = m_display_buffer_first_address;
- }
-
- if (!m_display_enabled)
- std::fill_n(&m_bitmap.pix32(m_linecounter), m_character_per_row * m_hpixels_per_column, rgb_t::black());
-
- if (m_gfx_enabled || (charrow == (m_scanline_per_char_row - 1)))
- m_address = address;
-}
-
-TIMER_CALLBACK_MEMBER(scn2674_device::breq_timer)
-{
- LOGMASKED(LOG_INTR, "BREQ %sasserted at line %d\n", (param == ASSERT_LINE) ? "" : "de", m_linecounter);
- m_breq_cb(param);
- if (param == CLEAR_LINE)
- m_mbc_cb(0);
-}
-
-TIMER_CALLBACK_MEMBER(scn2674_device::vblank_timer)
-{
- m_status_register |= 0x10;
- if (BIT(m_irq_mask, 4))
- {
- LOGMASKED(LOG_INTR, "V-Blank interrupt at line %d\n", m_linecounter);
- m_irq_register |= 0x10;
- m_intr_cb(ASSERT_LINE);
}
}
uint32_t scn2674_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
+ if (!m_display_enabled)
+ m_bitmap.fill(rgb_t::black(), cliprect);
+ else
+ copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
return 0;
}
diff --git a/src/devices/video/scn2674.h b/src/devices/video/scn2674.h
index 2b7367eeed0..3090f740f8d 100644
--- a/src/devices/video/scn2674.h
+++ b/src/devices/video/scn2674.h
@@ -23,9 +23,6 @@ public:
// static configuration
auto intr_callback() { return m_intr_cb.bind(); }
auto breq_callback() { return m_breq_cb.bind(); }
- auto mbc_callback() { return m_mbc_cb.bind(); }
- auto mbc_char_callback() { return m_mbc_char_cb.bind(); }
- auto mbc_attr_callback() { return m_mbc_attr_cb.bind(); }
void set_character_width(int value) { m_hpixels_per_column = value; }
template <class FunctionClass>
@@ -57,20 +54,14 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual space_config_vector memory_space_config() const override;
- TIMER_CALLBACK_MEMBER(scanline_timer);
- TIMER_CALLBACK_MEMBER(breq_timer);
- TIMER_CALLBACK_MEMBER(vblank_timer);
-
//protected:
bitmap_rgb32 m_bitmap;
devcb_write_line m_intr_cb;
devcb_write_line m_breq_cb;
- devcb_write_line m_mbc_cb;
- devcb_read8 m_mbc_char_cb;
- devcb_read8 m_mbc_attr_cb;
uint8_t m_IR_pointer;
uint16_t m_screen1_address;
@@ -81,7 +72,6 @@ protected:
uint8_t m_irq_mask;
bool m_gfx_enabled;
bool m_display_enabled;
- bool m_dadd_enabled;
bool m_display_enabled_field;
bool m_display_enabled_scanline;
bool m_cursor_enabled;
@@ -139,12 +129,14 @@ protected:
draw_character_delegate m_display_cb;
emu_timer *m_scanline_timer;
- emu_timer *m_breq_timer;
- emu_timer *m_vblank_timer;
address_space *m_char_space;
address_space *m_attr_space;
const address_space_config m_char_space_config;
const address_space_config m_attr_space_config;
+ enum
+ {
+ TIMER_SCANLINE
+ };
};
class scn2672_device : public scn2674_device
diff --git a/src/devices/video/sda5708.h b/src/devices/video/sda5708.h
index 4237675b95e..eecb36e032c 100644
--- a/src/devices/video/sda5708.h
+++ b/src/devices/video/sda5708.h
@@ -41,6 +41,13 @@
*
*/
+///*************************************************************************
+// INTERFACE CONFIGURATION MACROS
+///*************************************************************************
+
+#define MCFG_SDA5708_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, SDA5708, 0)
+
///*************************************************************************
// TYPE DEFINITIONS
diff --git a/src/devices/video/sed1200.h b/src/devices/video/sed1200.h
index d6590af49ab..521bd4e027c 100644
--- a/src/devices/video/sed1200.h
+++ b/src/devices/video/sed1200.h
@@ -17,6 +17,17 @@
#pragma once
+#define MCFG_SED1200D0A_ADD( _tag ) \
+ MCFG_DEVICE_ADD( _tag, SED1200D0A, 0 )
+
+#define MCFG_SED1200F0A_ADD( _tag ) \
+ MCFG_DEVICE_ADD( _tag, SED1200F0A, 0 )
+
+#define MCFG_SED1200D0B_ADD( _tag ) \
+ MCFG_DEVICE_ADD( _tag, SED1200D0B, 0 )
+
+#define MCFG_SED1200F0B_ADD( _tag ) \
+ MCFG_DEVICE_ADD( _tag, SED1200F0B, 0 )
class sed1200_device : public device_t {
public:
diff --git a/src/devices/video/sed1330.cpp b/src/devices/video/sed1330.cpp
index 75eefb18c9d..5015bb0d43b 100644
--- a/src/devices/video/sed1330.cpp
+++ b/src/devices/video/sed1330.cpp
@@ -68,8 +68,7 @@ DEFINE_DEVICE_TYPE(SED1330, sed1330_device, "sed1330", "Epson SED1330")
// default address map
void sed1330_device::sed1330(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, 0xffff).ram();
+ map(0x0000, 0xffff).ram();
}
@@ -146,7 +145,7 @@ sed1330_device::sed1330_device(const machine_config &mconfig, const char *tag, d
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_bf(0),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(sed1330_device::sed1330), this))
+ m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(), address_map_constructor(FUNC(sed1330_device::sed1330), this))
{
}
diff --git a/src/devices/video/t6a04.h b/src/devices/video/t6a04.h
index 38906063f02..0232ffc71a6 100644
--- a/src/devices/video/t6a04.h
+++ b/src/devices/video/t6a04.h
@@ -65,4 +65,7 @@ private:
// device type definition
DECLARE_DEVICE_TYPE(T6A04, t6a04_device)
+#define MCFG_T6A04_SIZE(_width, _height) \
+ downcast<t6a04_device &>(*device).set_size(_width, _height);
+
#endif // MAME_VIDEO_T6A04_H
diff --git a/src/devices/video/tea1002.h b/src/devices/video/tea1002.h
index 44898c625ac..067ec5583bc 100644
--- a/src/devices/video/tea1002.h
+++ b/src/devices/video/tea1002.h
@@ -25,6 +25,15 @@
#pragma once
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_TEA1002_ADD(_tag, _clock) \
+ MCFG_DEVICE_ADD(_tag, TEA1002, _clock)
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/devices/video/tlc34076.cpp b/src/devices/video/tlc34076.cpp
index 37dd95a40b1..c33b302a3b8 100644
--- a/src/devices/video/tlc34076.cpp
+++ b/src/devices/video/tlc34076.cpp
@@ -127,7 +127,7 @@ void tlc34076_device::update_pen(uint8_t i)
// read - read access
//-------------------------------------------------
-u8 tlc34076_device::read(offs_t offset)
+READ8_MEMBER( tlc34076_device::read )
{
uint8_t result;
@@ -161,7 +161,7 @@ u8 tlc34076_device::read(offs_t offset)
// write - write access
//-------------------------------------------------
-void tlc34076_device::write(offs_t offset, u8 data)
+WRITE8_MEMBER( tlc34076_device::write )
{
// uint8_t oldval;
diff --git a/src/devices/video/tlc34076.h b/src/devices/video/tlc34076.h
index 7c4b021bd27..fb816dd1181 100644
--- a/src/devices/video/tlc34076.h
+++ b/src/devices/video/tlc34076.h
@@ -41,8 +41,8 @@ public:
void set_bits(tlc34076_bits bits) { m_dacbits = bits; }
// public interface
- u8 read(offs_t offset);
- void write(offs_t offset, u8 data);
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
protected:
// device-level overrides
@@ -66,6 +66,15 @@ private:
};
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_TLC34076_ADD(tag, bits) \
+ MCFG_DEVICE_ADD((tag), TLC34076, 0) \
+ downcast<tlc34076_device &>(*device).set_bits((tlc34076_device::bits));
+
+
DECLARE_DEVICE_TYPE(TLC34076, tlc34076_device)
#endif // MAME_VIDEO_TLC34076_H
diff --git a/src/devices/video/tms34061.cpp b/src/devices/video/tms34061.cpp
index 8204facf1a1..397b412e586 100644
--- a/src/devices/video/tms34061.cpp
+++ b/src/devices/video/tms34061.cpp
@@ -32,7 +32,7 @@
DEFINE_DEVICE_TYPE(TMS34061, tms34061_device, "tms34061", "TI TMS34061 VSC")
-tms34061_device::tms34061_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+tms34061_device::tms34061_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, TMS34061, tag, owner, clock),
device_video_interface(mconfig, *this),
m_rowshift(0),
@@ -64,10 +64,10 @@ void tms34061_device::device_start()
m_vrammask = m_vramsize - 1;
/* allocate memory for VRAM */
- m_vram = auto_alloc_array_clear(machine(), u8, m_vramsize + 256 * 2);
+ m_vram = auto_alloc_array_clear(machine(), uint8_t, m_vramsize + 256 * 2);
/* allocate memory for latch RAM */
- m_latchram = auto_alloc_array_clear(machine(), u8, m_vramsize + 256 * 2);
+ m_latchram = auto_alloc_array_clear(machine(), uint8_t, m_vramsize + 256 * 2);
/* add some buffer space for VRAM and latch RAM */
m_vram += 256;
@@ -171,7 +171,7 @@ TIMER_CALLBACK_MEMBER( tms34061_device::interrupt )
*
*************************************/
-void tms34061_device::register_w(offs_t offset, u8 data)
+void tms34061_device::register_w(address_space &space, offs_t offset, uint8_t data)
{
int scanline;
int regnum = offset >> 2;
@@ -242,10 +242,10 @@ void tms34061_device::register_w(offs_t offset, u8 data)
*
*************************************/
-u8 tms34061_device::register_r(offs_t offset)
+uint8_t tms34061_device::register_r(address_space &space, offs_t offset)
{
int regnum = offset >> 2;
- u16 result;
+ uint16_t result;
/* extract the correct portion of the register */
if (regnum < ARRAY_LENGTH(m_regs))
@@ -364,7 +364,7 @@ void tms34061_device::adjust_xyaddress(int offset)
}
-void tms34061_device::xypixel_w(int offset, u8 data)
+void tms34061_device::xypixel_w(address_space &space, int offset, uint8_t data)
{
/* determine the offset, then adjust it */
offs_t pixeloffs = m_regs[TMS34061_XYADDRESS];
@@ -384,7 +384,7 @@ void tms34061_device::xypixel_w(int offset, u8 data)
}
-u8 tms34061_device::xypixel_r(int offset)
+uint8_t tms34061_device::xypixel_r(address_space &space, int offset)
{
/* determine the offset, then adjust it */
offs_t pixeloffs = m_regs[TMS34061_XYADDRESS];
@@ -409,7 +409,7 @@ u8 tms34061_device::xypixel_r(int offset)
*
*************************************/
-void tms34061_device::write(int col, int row, int func, u8 data)
+void tms34061_device::write(address_space &space, int col, int row, int func, uint8_t data)
{
offs_t offs;
@@ -419,12 +419,12 @@ void tms34061_device::write(int col, int row, int func, u8 data)
/* both 0 and 2 map to register access */
case 0:
case 2:
- register_w(col, data);
+ register_w(space, col, data);
break;
/* function 1 maps to XY access; col is the address adjustment */
case 1:
- xypixel_w(col, data);
+ xypixel_w(space, col, data);
break;
/* function 3 maps to direct access */
@@ -471,7 +471,7 @@ void tms34061_device::write(int col, int row, int func, u8 data)
}
-u8 tms34061_device::read(int col, int row, int func)
+uint8_t tms34061_device::read(address_space &space, int col, int row, int func)
{
int result = 0;
offs_t offs;
@@ -482,12 +482,12 @@ u8 tms34061_device::read(int col, int row, int func)
/* both 0 and 2 map to register access */
case 0:
case 2:
- result = register_r(col);
+ result = register_r(space, col);
break;
/* function 1 maps to XY access; col is the address adjustment */
case 1:
- result = xypixel_r(col);
+ result = xypixel_r(space, col);
break;
/* function 3 maps to direct access */
@@ -535,13 +535,13 @@ u8 tms34061_device::read(int col, int row, int func)
*
*************************************/
-u8 tms34061_device::latch_r()
+READ8_MEMBER( tms34061_device::latch_r )
{
return m_latchdata;
}
-void tms34061_device::latch_w(u8 data)
+WRITE8_MEMBER( tms34061_device::latch_w )
{
LOG("tms34061_latch = %02X\n", data);
m_latchdata = data;
diff --git a/src/devices/video/tms34061.h b/src/devices/video/tms34061.h
index 3b3e3d5f552..e4f92e75ac2 100644
--- a/src/devices/video/tms34061.h
+++ b/src/devices/video/tms34061.h
@@ -15,6 +15,17 @@
#pragma once
+#define MCFG_TMS34061_ROWSHIFT(_shift) \
+ downcast<tms34061_device &>(*device).set_rowshift(_shift);
+
+#define MCFG_TMS34061_VRAM_SIZE(_size) \
+ downcast<tms34061_device &>(*device).set_vram_size(_size);
+
+#define MCFG_TMS34061_INTERRUPT_CB(_devcb) \
+ downcast<tms34061_device &>(*device).set_interrupt_callback(DEVCB_##_devcb);
+
+
+
// ======================> tms34061_device
class tms34061_device : public device_t, public device_video_interface
@@ -23,35 +34,36 @@ public:
/* display state structure */
struct tms34061_display
{
- u8 blanked; /* true if blanked */
- u8 *vram; /* base of VRAM */
- u8 *latchram; /* base of latch RAM */
- u16 *regs; /* pointer to array of registers */
+ uint8_t blanked; /* true if blanked */
+ uint8_t *vram; /* base of VRAM */
+ uint8_t *latchram; /* base of latch RAM */
+ uint16_t *regs; /* pointer to array of registers */
offs_t dispstart; /* display start */
};
// construction/destruction
- tms34061_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ tms34061_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void set_rowshift(u8 rowshift) { m_rowshift = rowshift; }
- void set_vram_size(u32 vramsize) { m_vramsize = vramsize; }
+ void set_rowshift(uint8_t rowshift) { m_rowshift = rowshift; }
+ void set_vram_size(uint32_t vramsize) { m_vramsize = vramsize; }
+ template <class Object> devcb_base &set_interrupt_callback(Object &&cb) { return m_interrupt_cb.set_callback(std::forward<Object>(cb)); }
auto int_callback() { return m_interrupt_cb.bind(); }
/* reads/writes to the 34061 */
- u8 read(int col, int row, int func);
- void write(int col, int row, int func, u8 data);
+ uint8_t read(address_space &space, int col, int row, int func);
+ void write(address_space &space, int col, int row, int func, uint8_t data);
/* latch settings */
- u8 latch_r();
- void latch_w(u8 data);
+ DECLARE_READ8_MEMBER( latch_r );
+ DECLARE_WRITE8_MEMBER( latch_w );
/* video update handling */
void get_display_state();
bool blanked() const { return bool(m_display.blanked); }
- u8 const &vram(unsigned row) const { return m_display.vram[row << m_rowshift]; }
- u16 xyoffset() const { return m_display.regs[TMS34061_XYOFFSET]; }
- u16 xyaddress() const { return m_display.regs[TMS34061_XYADDRESS]; }
+ uint8_t const &vram(unsigned row) const { return m_display.vram[row << m_rowshift]; }
+ uint16_t xyoffset() const { return m_display.regs[TMS34061_XYOFFSET]; }
+ uint16_t xyaddress() const { return m_display.regs[TMS34061_XYADDRESS]; }
// TODO: encapsulate this properly
tms34061_display m_display;
@@ -86,27 +98,27 @@ private:
TMS34061_REGCOUNT
};
- u8 m_rowshift; /* VRAM address is (row << rowshift) | col */
- u32 m_vramsize; /* size of video RAM */
+ uint8_t m_rowshift; /* VRAM address is (row << rowshift) | col */
+ uint32_t m_vramsize; /* size of video RAM */
devcb_write_line m_interrupt_cb; /* interrupt gen callback */
- u16 m_regs[TMS34061_REGCOUNT];
- u16 m_xmask;
- u8 m_yshift;
- u32 m_vrammask;
- u8 * m_vram;
- u8 * m_latchram;
- u8 m_latchdata;
- u8 * m_shiftreg;
- emu_timer * m_timer;
+ uint16_t m_regs[TMS34061_REGCOUNT];
+ uint16_t m_xmask;
+ uint8_t m_yshift;
+ uint32_t m_vrammask;
+ uint8_t * m_vram;
+ uint8_t * m_latchram;
+ uint8_t m_latchdata;
+ uint8_t * m_shiftreg;
+ emu_timer * m_timer;
void update_interrupts();
TIMER_CALLBACK_MEMBER( interrupt );
- void register_w(offs_t offset, u8 data);
- u8 register_r(offs_t offset);
+ void register_w(address_space &space, offs_t offset, uint8_t data);
+ uint8_t register_r(address_space &space, offs_t offset);
void adjust_xyaddress(int offset);
- void xypixel_w(int offset, u8 data);
- u8 xypixel_r(int offset);
+ void xypixel_w(address_space &space, int offset, uint8_t data);
+ uint8_t xypixel_r(address_space &space, int offset);
};
// device type definition
diff --git a/src/devices/video/tms3556.cpp b/src/devices/video/tms3556.cpp
index 80280fe5364..c856735756f 100644
--- a/src/devices/video/tms3556.cpp
+++ b/src/devices/video/tms3556.cpp
@@ -59,8 +59,7 @@ DEFINE_DEVICE_TYPE(TMS3556, tms3556_device, "tms3556", "Texas Instruments TMS355
// default address map
void tms3556_device::tms3556(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, 0xffff).ram();
+ map(0x0000, 0xffff).ram();
}
//-------------------------------------------------
@@ -112,7 +111,7 @@ tms3556_device::tms3556_device(const machine_config &mconfig, const char *tag, d
: device_t(mconfig, TMS3556, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, address_map_constructor(FUNC(tms3556_device::tms3556), this)),
+ m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, address_map_constructor(), address_map_constructor(FUNC(tms3556_device::tms3556), this)),
m_reg(0), m_reg2(0),
m_reg_access_phase(0),
m_row_col_written(0),
diff --git a/src/devices/video/tms3556.h b/src/devices/video/tms3556.h
index e20e02d09c3..11146f8b21f 100644
--- a/src/devices/video/tms3556.h
+++ b/src/devices/video/tms3556.h
@@ -19,6 +19,12 @@
/* if DOUBLE_WIDTH set, the horizontal resolution is doubled */
#define TMS3556_DOUBLE_WIDTH 0
+///*************************************************************************
+// INTERFACE CONFIGURATION MACROS
+///*************************************************************************
+
+#define MCFG_TMS3556_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, TMS3556, 0)
///*************************************************************************
// TYPE DEFINITIONS
diff --git a/src/devices/video/tms9927.cpp b/src/devices/video/tms9927.cpp
index bc8e187f8e8..9a43cb1f635 100644
--- a/src/devices/video/tms9927.cpp
+++ b/src/devices/video/tms9927.cpp
@@ -81,7 +81,7 @@ crt5057_device::crt5057_device(const machine_config &mconfig, const char *tag, d
void tms9927_device::device_start()
{
assert(clock() > 0);
- if (!(m_hpixels_per_column > 0)) fatalerror("TMS9927: number of pixels per column must be explicitly set using set_char_width()!\n");
+ if (!(m_hpixels_per_column > 0)) fatalerror("TMS9927: number of pixels per column must be explicitly set using MCFG_TMS9927_CHAR_WIDTH()!\n");
// resolve callbacks
m_write_vsyn.resolve_safe();
diff --git a/src/devices/video/tms9928a.cpp b/src/devices/video/tms9928a.cpp
index c068d8b4ce8..bc31b1b1db9 100644
--- a/src/devices/video/tms9928a.cpp
+++ b/src/devices/video/tms9928a.cpp
@@ -52,11 +52,11 @@ DEFINE_DEVICE_TYPE(EFO90501, efo90501_device, "efo90501", "EFO90501 VDP")
*/
void tms9928a_device::memmap(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, 0x3fff).ram();
+ map.global_mask(0x3fff);
+ map(0x0000, 0x3fff).ram();
}
-tms9928a_device::tms9928a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint16_t horz_total, bool is_50hz, bool is_reva, bool is_99)
+tms9928a_device::tms9928a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool is_50hz, bool is_reva, bool is_99)
: device_t(mconfig, type, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, device_palette_interface(mconfig, *this)
@@ -64,11 +64,10 @@ tms9928a_device::tms9928a_device(const machine_config &mconfig, device_type type
, m_vram_size(0)
, m_out_int_line_cb(*this)
, m_out_gromclk_cb(*this)
- , m_total_horz(horz_total)
, m_50hz(is_50hz)
, m_reva(is_reva)
, m_99(is_99)
- , m_space_config("vram", ENDIANNESS_BIG, 8, 14, 0, address_map_constructor(FUNC(tms9928a_device::memmap), this))
+ , m_space_config("vram", ENDIANNESS_BIG, 8, 14, 0, address_map_constructor(), address_map_constructor(FUNC(tms9928a_device::memmap), this))
{
}
@@ -83,57 +82,57 @@ void tms9928a_device::device_config_complete()
if (!screen().refresh_attoseconds())
{
if (m_50hz)
- screen().set_raw(clock() / 2, m_total_horz, HORZ_DISPLAY_START - 12, HORZ_DISPLAY_START + 256 + 12,
+ screen().set_raw(clock() / 2, TOTAL_HORZ, HORZ_DISPLAY_START - 12, HORZ_DISPLAY_START + 256 + 12,
TOTAL_VERT_PAL, VERT_DISPLAY_START_PAL - 12, VERT_DISPLAY_START_PAL + 192 + 12);
else
- screen().set_raw(clock() / 2, m_total_horz, HORZ_DISPLAY_START - 12, HORZ_DISPLAY_START + 256 + 12,
+ screen().set_raw(clock() / 2, TOTAL_HORZ, HORZ_DISPLAY_START - 12, HORZ_DISPLAY_START + 256 + 12,
TOTAL_VERT_NTSC, VERT_DISPLAY_START_NTSC - 12, VERT_DISPLAY_START_NTSC + 192 + 12);
}
}
tms9928a_device::tms9928a_device( const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device(mconfig, TMS9928A, tag, owner, clock, 342, false, true, true)
+ : tms9928a_device(mconfig, TMS9928A, tag, owner, clock, false, true, true)
{
}
tms9129_device::tms9129_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device(mconfig, TMS9129, tag, owner, clock, 342, true, true, false)
+ : tms9928a_device(mconfig, TMS9129, tag, owner, clock, true, true, false)
{
}
tms9918_device::tms9918_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device(mconfig, TMS9918, tag, owner, clock, 342, false, false, true)
+ : tms9928a_device(mconfig, TMS9918, tag, owner, clock, false, false, true)
{
}
tms9918a_device::tms9918a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device(mconfig, TMS9918A, tag, owner, clock, 342, false, true, true)
+ : tms9928a_device(mconfig, TMS9918A, tag, owner, clock, false, true, true)
{
}
tms9118_device::tms9118_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device(mconfig, TMS9118, tag, owner, clock, 342, false, true, false)
+ : tms9928a_device(mconfig, TMS9118, tag, owner, clock, false, true, false)
{
}
tms9128_device::tms9128_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device(mconfig, TMS9128, tag, owner, clock, 342, false, true, false)
+ : tms9928a_device(mconfig, TMS9128, tag, owner, clock, false, true, false)
{
}
tms9929_device::tms9929_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device(mconfig, TMS9929, tag, owner, clock, 342, true, false, true)
+ : tms9928a_device(mconfig, TMS9929, tag, owner, clock, true, false, true)
{
}
tms9929a_device::tms9929a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device(mconfig, TMS9929A, tag, owner, clock, 342, true, true, true)
+ : tms9928a_device(mconfig, TMS9929A, tag, owner, clock, true, true, true)
{
}
efo90501_device::efo90501_device( const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device(mconfig, EFO90501, tag, owner, clock, 346, true, true, true)
+ : tms9928a_device(mconfig, EFO90501, tag, owner, clock, true, true, true)
{
}
@@ -144,7 +143,7 @@ device_memory_interface::space_config_vector tms9928a_device::memory_space_confi
};
}
-uint8_t tms9928a_device::read(offs_t offset)
+READ8_MEMBER( tms9928a_device::read )
{
uint8_t value = 0;
@@ -156,7 +155,7 @@ uint8_t tms9928a_device::read(offs_t offset)
return value;
}
-void tms9928a_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( tms9928a_device::write )
{
if ((offset & 1) == 0)
vram_write(data);
@@ -166,10 +165,10 @@ void tms9928a_device::write(offs_t offset, uint8_t data)
u8 tms9928a_device::vram_read()
{
- uint8_t data = m_ReadAhead;
-
// prevent debugger from changing the address base
- if (machine().side_effects_disabled()) return data;
+ if (machine().side_effects_disabled()) return 0;
+
+ uint8_t data = m_ReadAhead;
m_ReadAhead = m_vram_space->read_byte(m_Addr);
m_Addr = (m_Addr + 1) & (m_vram_size - 1);
@@ -193,10 +192,10 @@ void tms9928a_device::vram_write(u8 data)
u8 tms9928a_device::register_read()
{
- uint8_t data = m_StatusReg;
-
// prevent debugger from changing the internal state
- if (machine().side_effects_disabled()) return data;
+ if (machine().side_effects_disabled()) return 0;
+
+ uint8_t data = m_StatusReg;
m_StatusReg = m_FifthSprite;
check_interrupt();
@@ -372,7 +371,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
if ( y < 0 || y >= 192 || ! (m_Regs[1] & 0x40) )
{
/* Draw backdrop colour */
- for ( int i = 0; i < m_total_horz; i++ )
+ for ( int i = 0; i < TOTAL_HORZ; i++ )
p[i] = pen(BackColour);
/* vblank is set at the last cycle of the first inactive line */
@@ -651,7 +650,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
}
/* Right border */
- for ( int i = HORZ_DISPLAY_START + 256; i < m_total_horz; i++ )
+ for ( int i = HORZ_DISPLAY_START + 256; i < TOTAL_HORZ; i++ )
p[i] = pen(BackColour);
}
@@ -735,7 +734,7 @@ void tms9928a_device::device_start()
m_vram_space = &space(AS_DATA);
/* back bitmap */
- m_tmpbmp.allocate(m_total_horz, TOTAL_VERT_PAL);
+ m_tmpbmp.allocate(TOTAL_HORZ, TOTAL_VERT_PAL);
m_line_timer = timer_alloc(TIMER_LINE);
m_gromclk_timer = timer_alloc(GROMCLK);
diff --git a/src/devices/video/tms9928a.h b/src/devices/video/tms9928a.h
index 72c466d464b..0798183f0ea 100644
--- a/src/devices/video/tms9928a.h
+++ b/src/devices/video/tms9928a.h
@@ -73,8 +73,13 @@ public:
auto int_callback() { return m_out_int_line_cb.bind(); }
auto gromclk_callback() { return m_out_gromclk_cb.bind(); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
+
+ DECLARE_READ8_MEMBER( vram_r ) { return vram_read(); }
+ DECLARE_WRITE8_MEMBER( vram_w ) { vram_write(data); }
+ DECLARE_READ8_MEMBER( register_r ) { return register_read(); }
+ DECLARE_WRITE8_MEMBER( register_w ) { register_write(data); }
u8 vram_read();
void vram_write(u8 data);
@@ -89,7 +94,7 @@ public:
void reset_line(int state) { if (state==ASSERT_LINE) device_reset(); }
protected:
- tms9928a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint16_t horz_total, bool is_50hz, bool is_reva, bool is_99);
+ tms9928a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool is_50hz, bool is_reva, bool is_99);
// device-level overrides
virtual void device_config_complete() override;
@@ -134,7 +139,6 @@ private:
uint16_t m_spritepattern;
int m_colourmask;
int m_patternmask;
- const uint16_t m_total_horz;
const bool m_50hz;
const bool m_reva;
const bool m_99;
diff --git a/src/devices/video/upd3301.h b/src/devices/video/upd3301.h
index 147c12c5b7d..80e9346eb6c 100644
--- a/src/devices/video/upd3301.h
+++ b/src/devices/video/upd3301.h
@@ -43,6 +43,26 @@
#define UPD3301_DRAW_CHARACTER_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, int y, int sx, uint8_t cc, uint8_t lc, int hlgt, int rvv, int vsp, int sl0, int sl12, int csr, int gpa)
+#define MCFG_UPD3301_CHARACTER_WIDTH(_value) \
+ downcast<upd3301_device &>(*device).set_character_width(_value);
+
+#define MCFG_UPD3301_DRAW_CHARACTER_CALLBACK_OWNER(_class, _method) \
+ downcast<upd3301_device &>(*device).set_display_callback(&_class::_method, #_class "::" #_method, this);
+
+#define MCFG_UPD3301_DRQ_CALLBACK(_write) \
+ downcast<upd3301_device &>(*device).set_drq_wr_callback(DEVCB_##_write);
+
+#define MCFG_UPD3301_INT_CALLBACK(_write) \
+ downcast<upd3301_device &>(*device).set_int_wr_callback(DEVCB_##_write);
+
+#define MCFG_UPD3301_HRTC_CALLBACK(_write) \
+ downcast<upd3301_device &>(*device).set_hrtc_wr_callback(DEVCB_##_write);
+
+#define MCFG_UPD3301_VRTC_CALLBACK(_write) \
+ downcast<upd3301_device &>(*device).set_vrtc_wr_callback(DEVCB_##_write);
+
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -73,6 +93,10 @@ public:
set_display_callback(draw_character_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr)));
}
+ template <class Object> devcb_base &set_drq_wr_callback(Object &&cb) { return m_write_drq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_int_wr_callback(Object &&cb) { return m_write_int.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_hrtc_wr_callback(Object &&cb) { return m_write_hrtc.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_vrtc_wr_callback(Object &&cb) { return m_write_vrtc.set_callback(std::forward<Object>(cb)); }
auto drq_wr_callback() { return m_write_drq.bind(); }
auto int_wr_callback() { return m_write_int.bind(); }
auto hrtc_wr_callback() { return m_write_hrtc.bind(); }
diff --git a/src/devices/video/upd7220.cpp b/src/devices/video/upd7220.cpp
index d8697222485..16bbc507a5a 100644
--- a/src/devices/video/upd7220.cpp
+++ b/src/devices/video/upd7220.cpp
@@ -151,8 +151,7 @@ DEFINE_DEVICE_TYPE(UPD7220, upd7220_device, "upd7220", "NEC uPD7220")
// default address map
void upd7220_device::upd7220_vram(address_map &map)
{
- if (!has_configured_map(0))
- map(0x00000, 0x3ffff).ram();
+ map(0x00000, 0x3ffff).ram();
}
@@ -650,7 +649,7 @@ upd7220_device::upd7220_device(const machine_config &mconfig, const char *tag, d
m_disp(0),
m_gchr(0),
m_bitmap_mod(0),
- m_space_config("videoram", ENDIANNESS_LITTLE, 16, 18, 0, address_map_constructor(FUNC(upd7220_device::upd7220_vram), this))
+ m_space_config("videoram", ENDIANNESS_LITTLE, 16, 18, 0, address_map_constructor(), address_map_constructor(FUNC(upd7220_device::upd7220_vram), this))
{
for (int i = 0; i < 16; i++)
{
@@ -1448,7 +1447,7 @@ void upd7220_device::continue_command()
// read -
//-------------------------------------------------
-uint8_t upd7220_device::read(offs_t offset)
+READ8_MEMBER( upd7220_device::read )
{
uint8_t data;
@@ -1479,7 +1478,7 @@ uint8_t upd7220_device::read(offs_t offset)
// write -
//-------------------------------------------------
-void upd7220_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( upd7220_device::write )
{
if (offset & 1)
{
@@ -1502,7 +1501,7 @@ void upd7220_device::write(offs_t offset, uint8_t data)
// dack_r -
//-------------------------------------------------
-uint8_t upd7220_device::dack_r()
+READ8_MEMBER( upd7220_device::dack_r )
{
return 0;
}
@@ -1512,7 +1511,7 @@ uint8_t upd7220_device::dack_r()
// dack_w -
//-------------------------------------------------
-void upd7220_device::dack_w(uint8_t data)
+WRITE8_MEMBER( upd7220_device::dack_w )
{
}
diff --git a/src/devices/video/upd7220.h b/src/devices/video/upd7220.h
index 7c7370c0cd9..6a9837d90eb 100644
--- a/src/devices/video/upd7220.h
+++ b/src/devices/video/upd7220.h
@@ -62,58 +62,19 @@ public:
// construction/destruction
upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // FIXME: these should be aware of current device for resolving the tag
- template <class FunctionClass>
- void set_display_pixels(void (FunctionClass::*init)(bitmap_rgb32 &, int, int, uint32_t), const char *name)
- {
- m_display_cb = display_pixels_delegate(init, name, nullptr, static_cast<FunctionClass *>(nullptr));
- }
- template <class FunctionClass>
- void set_display_pixels(void (FunctionClass::*init)(bitmap_rgb32 &, int, int, uint32_t) const, const char *name)
- {
- m_display_cb = display_pixels_delegate(init, name, nullptr, static_cast<FunctionClass *>(nullptr));
- }
- template <class FunctionClass>
- void set_display_pixels(const char *devname, void (FunctionClass::*init)(bitmap_rgb32 &, int, int, uint32_t), const char *name)
- {
- m_display_cb = display_pixels_delegate(init, name, devname, static_cast<FunctionClass *>(nullptr));
- }
- template <class FunctionClass>
- void set_display_pixels(const char *devname, void (FunctionClass::*init)(bitmap_rgb32 &, int, int, uint32_t) const, const char *name)
- {
- m_display_cb = display_pixels_delegate(init, name, devname, static_cast<FunctionClass *>(nullptr));
- }
- template <class FunctionClass>
- void set_draw_text(void (FunctionClass::*init)(bitmap_rgb32 &, uint32_t, int, int, int, int, int, int), const char *name)
- {
- m_draw_text_cb = draw_text_delegate(init, name, nullptr, static_cast<FunctionClass *>(nullptr));
- }
- template <class FunctionClass>
- void set_draw_text(void (FunctionClass::*init)(bitmap_rgb32 &, uint32_t, int, int, int, int, int, int) const, const char *name)
- {
- m_draw_text_cb = draw_text_delegate(init, name, nullptr, static_cast<FunctionClass *>(nullptr));
- }
- template <class FunctionClass>
- void set_draw_text(const char *devname, void (FunctionClass::*init)(bitmap_rgb32 &, uint32_t, int, int, int, int, int, int), const char *name)
- {
- m_draw_text_cb = draw_text_delegate(init, name, devname, static_cast<FunctionClass *>(nullptr));
- }
- template <class FunctionClass>
- void set_draw_text(const char *devname, void (FunctionClass::*init)(bitmap_rgb32 &, uint32_t, int, int, int, int, int, int) const, const char *name)
- {
- m_draw_text_cb = draw_text_delegate(init, name, devname, static_cast<FunctionClass *>(nullptr));
- }
+ template <typename... T> void set_display_pixels_callback(T &&... args) { m_display_cb = display_pixels_delegate(std::forward<T>(args)...); }
+ template <typename... T> void set_draw_text_callback(T &&... args) { m_draw_text_cb = draw_text_delegate(std::forward<T>(args)...); }
auto drq_wr_callback() { return m_write_drq.bind(); }
auto hsync_wr_callback() { return m_write_hsync.bind(); }
auto vsync_wr_callback() { return m_write_vsync.bind(); }
auto blank_wr_callback() { return m_write_blank.bind(); }
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
- uint8_t dack_r();
- void dack_w(uint8_t data);
+ DECLARE_READ8_MEMBER( dack_r );
+ DECLARE_WRITE8_MEMBER( dack_w );
DECLARE_WRITE_LINE_MEMBER( ext_sync_w );
DECLARE_WRITE_LINE_MEMBER( lpen_w );
diff --git a/src/devices/video/v9938.cpp b/src/devices/video/v9938.cpp
index f7368efc485..d33331eaa32 100644
--- a/src/devices/video/v9938.cpp
+++ b/src/devices/video/v9938.cpp
@@ -369,7 +369,7 @@ uint32_t v99x8_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap
return 0;
}
-uint8_t v99x8_device::read(offs_t offset)
+READ8_MEMBER( v99x8_device::read )
{
switch (offset & 3)
{
@@ -379,7 +379,7 @@ uint8_t v99x8_device::read(offs_t offset)
return 0xff;
}
-void v99x8_device::write(offs_t offset, uint8_t data)
+WRITE8_MEMBER( v99x8_device::write )
{
switch (offset & 3)
{
diff --git a/src/devices/video/v9938.h b/src/devices/video/v9938.h
index d0bbf7c48c5..0e1a3640cb9 100644
--- a/src/devices/video/v9938.h
+++ b/src/devices/video/v9938.h
@@ -54,8 +54,8 @@ public:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- uint8_t read(offs_t offset);
- void write(offs_t offset, uint8_t data);
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
uint8_t vram_r();
uint8_t status_r();
diff --git a/src/devices/video/vector.h b/src/devices/video/vector.h
index 6b473c3501c..919395f043a 100644
--- a/src/devices/video/vector.h
+++ b/src/devices/video/vector.h
@@ -62,4 +62,7 @@ private:
// device type definition
DECLARE_DEVICE_TYPE(VECTOR, vector_device)
+#define MCFG_VECTOR_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, VECTOR, 0)
+
#endif // MAME_VIDEO_VECTOR_H
diff --git a/src/devices/video/vic4567.h b/src/devices/video/vic4567.h
index ecadbfe19d9..e680a3ff0cf 100644
--- a/src/devices/video/vic4567.h
+++ b/src/devices/video/vic4567.h
@@ -110,16 +110,16 @@ public:
vic3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template <typename T> void set_cpu_tag(T &&tag) { m_cpu.set_tag(std::forward<T>(tag)); }
+ void set_cpu_tag(const char *tag) { m_cpu.set_tag(tag); }
void set_vic3_type(vic3_type type) { m_type = type; }
- auto dma_read_callback() { return m_dma_read_cb.bind(); }
- auto dma_read_color_callback() { return m_dma_read_color_cb.bind(); }
- auto interrupt_callback() { return m_interrupt_cb.bind(); }
- auto port_changed_callback() { return m_port_changed_cb.bind(); }
- auto lightpen_button_callback() { return m_lightpen_button_cb.bind(); }
- auto lightpen_x_callback() { return m_lightpen_x_cb.bind(); }
- auto lightpen_y_callback() { return m_lightpen_y_cb.bind(); }
- auto c64_mem_r_callback() { return m_c64_mem_r_cb.bind(); }
+ template <class Object> devcb_base &set_dma_read_callback(Object &&cb) { return m_dma_read_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_dma_read_color_callback(Object &&cb) { return m_dma_read_color_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_interrupt_callback(Object &&cb) { return m_interrupt_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_port_changed_callback(Object &&cb) { return m_port_changed_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_lightpen_button_callback(Object &&cb) { return m_lightpen_button_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_lightpen_x_callback(Object &&cb) { return m_lightpen_x_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_lightpen_y_callback(Object &&cb) { return m_lightpen_y_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_c64_mem_r_callback(Object &&cb) { return m_c64_mem_r_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE8_MEMBER(port_w);
DECLARE_WRITE8_MEMBER(palette_w);
@@ -236,4 +236,35 @@ private:
DECLARE_DEVICE_TYPE(VIC3, vic3_device)
+
+#define MCFG_VIC3_CPU(tag) \
+ downcast<vic3_device &>(*device).set_cpu_tag(tag);
+
+#define MCFG_VIC3_TYPE(type) \
+ downcast<vic3_device &>(*device).set_vic3_type((vic3_device::vic3_type::type));
+
+#define MCFG_VIC3_DMA_READ_CB(cb) \
+ downcast<vic3_device &>(*device).set_dma_read_callback((DEVCB_##cb));
+
+#define MCFG_VIC3_DMA_READ_COLOR_CB(cb) \
+ downcast<vic3_device &>(*device).set_dma_read_color_callback((DEVCB_##cb));
+
+#define MCFG_VIC3_INTERRUPT_CB(cb) \
+ downcast<vic3_device &>(*device).set_interrupt_callback((DEVCB_##cb));
+
+#define MCFG_VIC3_PORT_CHANGED_CB(cb) \
+ downcast<vic3_device &>(*device).set_port_changed_callback((DEVCB_##cb));
+
+#define MCFG_VIC3_LIGHTPEN_BUTTON_CB(cb) \
+ downcast<vic3_device &>(*device).set_lightpen_button_callback((DEVCB_##cb));
+
+#define MCFG_VIC3_LIGHTPEN_X_CB(cb) \
+ downcast<vic3_device &>(*device).set_lightpen_x_callback((DEVCB_##cb));
+
+#define MCFG_VIC3_LIGHTPEN_Y_CB(cb) \
+ downcast<vic3_device &>(*device).set_lightpen_y_callback((DEVCB_##cb));
+
+#define MCFG_VIC3_C64_MEM_R_CB(cb) \
+ downcast<vic3_device &>(*device).set_c64_mem_r_callback((DEVCB_##cb));
+
#endif // MAME_VIDEO_VIC4567_H
diff --git a/src/devices/video/voodoo.h b/src/devices/video/voodoo.h
index 26475f527de..5c39e867d85 100644
--- a/src/devices/video/voodoo.h
+++ b/src/devices/video/voodoo.h
@@ -1429,6 +1429,32 @@ enum
#define STD_VOODOO_3_CLOCK 132000000
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_VOODOO_FBMEM(_value) \
+ downcast<voodoo_device &>(*device).set_fbmem(_value);
+
+#define MCFG_VOODOO_TMUMEM(_value1, _value2) \
+ downcast<voodoo_device &>(*device).set_tmumem(_value1, _value2);
+
+#define MCFG_VOODOO_SCREEN_TAG(_tag) \
+ downcast<voodoo_device &>(*device).set_screen_tag(_tag);
+
+#define MCFG_VOODOO_CPU_TAG(_tag) \
+ downcast<voodoo_device &>(*device).set_cpu_tag(_tag);
+
+#define MCFG_VOODOO_VBLANK_CB(_devcb) \
+ downcast<voodoo_device &>(*device).set_vblank_callback(DEVCB_##_devcb);
+
+#define MCFG_VOODOO_STALL_CB(_devcb) \
+ downcast<voodoo_device &>(*device).set_stall_callback(DEVCB_##_devcb);
+
+#define MCFG_VOODOO_PCIINT_CB(_devcb) \
+ downcast<voodoo_device &>(*device).set_pciint_callback(DEVCB_##_devcb);
+
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
@@ -1444,6 +1470,9 @@ public:
void set_tmumem(int value1, int value2) { m_tmumem0 = value1; m_tmumem1 = value2; }
template <typename T> void set_screen_tag(T &&tag) { m_screen_finder.set_tag(std::forward<T>(tag)); }
template <typename T> void set_cpu_tag(T &&tag) { m_cpu_finder.set_tag(std::forward<T>(tag)); }
+ template <class Object> devcb_base &set_vblank_callback(Object &&cb) { return m_vblank.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_stall_callback(Object &&cb) { return m_stall.set_callback(std::forward<Object>(cb)); }
+ template <class Object> devcb_base &set_pciint_callback(Object &&cb) { return m_pciint.set_callback(std::forward<Object>(cb)); }
auto vblank_callback() { return m_vblank.bind(); }
auto stall_callback() { return m_stall.bind(); }
auto pciint_callback() { return m_pciint.bind(); }
diff --git a/src/devices/video/voodoo_pci.cpp b/src/devices/video/voodoo_pci.cpp
index 5a78099e01a..82fc89aaa9a 100644
--- a/src/devices/video/voodoo_pci.cpp
+++ b/src/devices/video/voodoo_pci.cpp
@@ -6,31 +6,27 @@
#include "screen.h"
-void voodoo_1_pci_device::device_add_mconfig(machine_config &config)
-{
- VOODOO_1(config, m_voodoo, STD_VOODOO_1_CLOCK);
- m_voodoo->set_fbmem(4);
- m_voodoo->set_tmumem(1, 0);
-}
-
-void voodoo_2_pci_device::device_add_mconfig(machine_config &config)
-{
- VOODOO_2(config, m_voodoo, STD_VOODOO_2_CLOCK);
- m_voodoo->set_fbmem(4);
- m_voodoo->set_tmumem(1, 0);
-}
-
-void voodoo_banshee_pci_device::device_add_mconfig(machine_config &config)
-{
- VOODOO_BANSHEE(config, m_voodoo, STD_VOODOO_BANSHEE_CLOCK);
- m_voodoo->set_fbmem(16);
-}
-
-void voodoo_3_pci_device::device_add_mconfig(machine_config &config)
-{
- VOODOO_3(config, m_voodoo, STD_VOODOO_3_CLOCK);
- m_voodoo->set_fbmem(16);
-}
+MACHINE_CONFIG_START(voodoo_1_pci_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("voodoo", VOODOO_1, STD_VOODOO_1_CLOCK)
+ MCFG_VOODOO_FBMEM(4)
+ MCFG_VOODOO_TMUMEM(1, 0)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(voodoo_2_pci_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("voodoo", VOODOO_2, STD_VOODOO_2_CLOCK)
+ MCFG_VOODOO_FBMEM(4)
+ MCFG_VOODOO_TMUMEM(1, 0)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(voodoo_banshee_pci_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("voodoo", VOODOO_BANSHEE, STD_VOODOO_BANSHEE_CLOCK)
+ MCFG_VOODOO_FBMEM(16)
+MACHINE_CONFIG_END
+
+MACHINE_CONFIG_START(voodoo_3_pci_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("voodoo", VOODOO_3, STD_VOODOO_3_CLOCK)
+ MCFG_VOODOO_FBMEM(16)
+MACHINE_CONFIG_END
DEFINE_DEVICE_TYPE(VOODOO_1_PCI, voodoo_1_pci_device, "voodoo_1_pci", "Voodoo 1 PCI")
DEFINE_DEVICE_TYPE(VOODOO_2_PCI, voodoo_2_pci_device, "voodoo_2_pci", "Voodoo 2 PCI")
@@ -46,22 +42,22 @@ void voodoo_pci_device::config_map(address_map &map)
// VOODOO_1 & VOODOO_2 map
void voodoo_pci_device::voodoo_reg_map(address_map &map)
{
- map(0x0, 0x00ffffff).rw(m_voodoo, FUNC(voodoo_device::voodoo_r), FUNC(voodoo_device::voodoo_w));
+ map(0x0, 0x00ffffff).rw("voodoo", FUNC(voodoo_device::voodoo_r), FUNC(voodoo_device::voodoo_w));
}
// VOODOO_BANSHEE and VOODOO_3 maps
void voodoo_pci_device::banshee_reg_map(address_map &map)
{
- map(0x0, 0x01ffffff).rw(m_voodoo, FUNC(voodoo_banshee_device::banshee_r), FUNC(voodoo_banshee_device::banshee_w));
+ map(0x0, 0x01ffffff).rw("voodoo", FUNC(voodoo_banshee_device::banshee_r), FUNC(voodoo_banshee_device::banshee_w));
}
void voodoo_pci_device::lfb_map(address_map &map)
{
- map(0x0, 0x01ffffff).rw(m_voodoo, FUNC(voodoo_banshee_device::banshee_fb_r), FUNC(voodoo_banshee_device::banshee_fb_w));
+ map(0x0, 0x01ffffff).rw("voodoo", FUNC(voodoo_banshee_device::banshee_fb_r), FUNC(voodoo_banshee_device::banshee_fb_w));
}
void voodoo_pci_device::io_map(address_map &map)
{
- map(0x000, 0x0ff).rw(m_voodoo, FUNC(voodoo_banshee_device::banshee_io_r), FUNC(voodoo_banshee_device::banshee_io_w));
+ map(0x000, 0x0ff).rw("voodoo", FUNC(voodoo_banshee_device::banshee_io_r), FUNC(voodoo_banshee_device::banshee_io_w));
}
voodoo_pci_device::voodoo_pci_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)