summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/devices/bus/a2bus/a2cffa.cpp12
-rw-r--r--src/devices/bus/a2bus/a2mcms.cpp4
-rw-r--r--src/devices/bus/a2bus/a2mcms.h2
-rw-r--r--src/devices/bus/coco/coco_ssc.cpp10
-rw-r--r--src/devices/bus/isa/gus.cpp4
-rw-r--r--src/devices/bus/isa/gus.h2
-rw-r--r--src/devices/bus/neogeo/prot_fatfury2.cpp86
-rw-r--r--src/devices/bus/neogeo/prot_fatfury2.h6
-rw-r--r--src/devices/bus/uts_kbd/400kbd.cpp2
-rw-r--r--src/devices/cpu/mcs48/mcs48.cpp2
-rw-r--r--src/devices/cpu/pdp1/pdp1.cpp93
-rw-r--r--src/devices/cpu/pdp1/pdp1.h31
-rw-r--r--src/devices/cpu/pdp1/pdp1dasm.cpp4
-rw-r--r--src/devices/cpu/pdp1/tx0.cpp4
-rw-r--r--src/devices/cpu/pdp8/pdp8.cpp2
-rw-r--r--src/devices/cpu/pdp8/pdp8dasm.cpp4
-rw-r--r--src/devices/cpu/tms57002/tms57002.cpp37
-rw-r--r--src/devices/cpu/tms57002/tms57002.h2
-rw-r--r--src/devices/cpu/z80/kc82.cpp6
-rw-r--r--src/devices/cpu/z80/kl5c80a12.cpp9
-rw-r--r--src/devices/cpu/z80/kl5c80a16.cpp10
-rw-r--r--src/devices/cpu/z80/kp63.cpp477
-rw-r--r--src/devices/cpu/z80/kp63.h98
-rw-r--r--src/devices/cpu/z80/kp69.cpp10
-rw-r--r--src/devices/imagedev/cassette.cpp4
-rw-r--r--src/devices/imagedev/cassette.h2
-rw-r--r--src/devices/imagedev/floppy.cpp6
-rw-r--r--src/devices/imagedev/floppy.h2
-rw-r--r--src/devices/machine/6522via.cpp11
-rw-r--r--src/devices/machine/8364_paula.cpp6
-rw-r--r--src/devices/machine/8364_paula.h2
-rw-r--r--src/devices/machine/acorn_vidc.cpp2
-rw-r--r--src/devices/machine/alpha_8921.cpp212
-rw-r--r--src/devices/machine/alpha_8921.h67
-rw-r--r--src/devices/machine/generalplus_gpl16250soc.cpp9
-rw-r--r--src/devices/machine/laserdsc.cpp6
-rw-r--r--src/devices/machine/laserdsc.h2
-rw-r--r--src/devices/machine/netlist.cpp60
-rw-r--r--src/devices/machine/netlist.h23
-rw-r--r--src/devices/machine/s2636.cpp6
-rw-r--r--src/devices/machine/s2636.h2
-rw-r--r--src/devices/machine/sensorboard.cpp9
-rw-r--r--src/devices/machine/spg2xx_audio.cpp4
-rw-r--r--src/devices/machine/spg2xx_audio.h2
-rw-r--r--src/devices/sound/2203intf.cpp6
-rw-r--r--src/devices/sound/2203intf.h2
-rw-r--r--src/devices/sound/2608intf.cpp6
-rw-r--r--src/devices/sound/2608intf.h2
-rw-r--r--src/devices/sound/2610intf.cpp10
-rw-r--r--src/devices/sound/2610intf.h4
-rw-r--r--src/devices/sound/2612intf.cpp8
-rw-r--r--src/devices/sound/2612intf.h2
-rw-r--r--src/devices/sound/262intf.cpp6
-rw-r--r--src/devices/sound/262intf.h2
-rw-r--r--src/devices/sound/3526intf.cpp6
-rw-r--r--src/devices/sound/3526intf.h2
-rw-r--r--src/devices/sound/3812intf.cpp6
-rw-r--r--src/devices/sound/3812intf.h2
-rw-r--r--src/devices/sound/8950intf.cpp6
-rw-r--r--src/devices/sound/8950intf.h2
-rw-r--r--src/devices/sound/aica.cpp31
-rw-r--r--src/devices/sound/aica.h9
-rw-r--r--src/devices/sound/asc.cpp38
-rw-r--r--src/devices/sound/asc.h2
-rw-r--r--src/devices/sound/astrocde.cpp19
-rw-r--r--src/devices/sound/astrocde.h2
-rw-r--r--src/devices/sound/awacs.cpp23
-rw-r--r--src/devices/sound/awacs.h2
-rw-r--r--src/devices/sound/ay8910.cpp60
-rw-r--r--src/devices/sound/ay8910.h10
-rw-r--r--src/devices/sound/beep.cpp16
-rw-r--r--src/devices/sound/beep.h4
-rw-r--r--src/devices/sound/bsmt2000.cpp10
-rw-r--r--src/devices/sound/bsmt2000.h2
-rw-r--r--src/devices/sound/c140.cpp40
-rw-r--r--src/devices/sound/c140.h4
-rw-r--r--src/devices/sound/c352.cpp25
-rw-r--r--src/devices/sound/c352.h2
-rw-r--r--src/devices/sound/c6280.cpp33
-rw-r--r--src/devices/sound/c6280.h2
-rw-r--r--src/devices/sound/cdda.cpp27
-rw-r--r--src/devices/sound/cdda.h4
-rw-r--r--src/devices/sound/cdp1863.cpp25
-rw-r--r--src/devices/sound/cdp1863.h4
-rw-r--r--src/devices/sound/cdp1864.cpp25
-rw-r--r--src/devices/sound/cdp1864.h4
-rw-r--r--src/devices/sound/cdp1869.cpp23
-rw-r--r--src/devices/sound/cdp1869.h4
-rw-r--r--src/devices/sound/cem3394.cpp444
-rw-r--r--src/devices/sound/cem3394.h52
-rw-r--r--src/devices/sound/dac.h77
-rw-r--r--src/devices/sound/dac76.cpp11
-rw-r--r--src/devices/sound/dac76.h2
-rw-r--r--src/devices/sound/dave.cpp22
-rw-r--r--src/devices/sound/dave.h2
-rw-r--r--src/devices/sound/digitalk.cpp26
-rw-r--r--src/devices/sound/digitalk.h2
-rw-r--r--src/devices/sound/disc_cls.h12
-rw-r--r--src/devices/sound/disc_inp.hxx20
-rw-r--r--src/devices/sound/discrete.cpp16
-rw-r--r--src/devices/sound/discrete.h4
-rw-r--r--src/devices/sound/dmadac.cpp61
-rw-r--r--src/devices/sound/dmadac.h7
-rw-r--r--src/devices/sound/dspv.cpp2
-rw-r--r--src/devices/sound/dspv.h2
-rw-r--r--src/devices/sound/es1373.cpp12
-rw-r--r--src/devices/sound/es1373.h2
-rw-r--r--src/devices/sound/es5503.cpp6
-rw-r--r--src/devices/sound/es5503.h2
-rw-r--r--src/devices/sound/es5506.cpp14
-rw-r--r--src/devices/sound/es5506.h8
-rw-r--r--src/devices/sound/esqpump.cpp4
-rw-r--r--src/devices/sound/esqpump.h2
-rw-r--r--src/devices/sound/flt_rc.cpp8
-rw-r--r--src/devices/sound/flt_rc.h2
-rw-r--r--src/devices/sound/flt_vol.cpp8
-rw-r--r--src/devices/sound/flt_vol.h2
-rw-r--r--src/devices/sound/fm.cpp6
-rw-r--r--src/devices/sound/fm.h8
-rw-r--r--src/devices/sound/fm2612.cpp2
-rw-r--r--src/devices/sound/gaelco.cpp4
-rw-r--r--src/devices/sound/gaelco.h2
-rw-r--r--src/devices/sound/gb.cpp12
-rw-r--r--src/devices/sound/gb.h2
-rw-r--r--src/devices/sound/hc55516.cpp14
-rw-r--r--src/devices/sound/hc55516.h6
-rw-r--r--src/devices/sound/huc6230.cpp4
-rw-r--r--src/devices/sound/huc6230.h2
-rw-r--r--src/devices/sound/i5000.cpp4
-rw-r--r--src/devices/sound/i5000.h2
-rw-r--r--src/devices/sound/ics2115.cpp6
-rw-r--r--src/devices/sound/ics2115.h4
-rw-r--r--src/devices/sound/iopspu.cpp2
-rw-r--r--src/devices/sound/iopspu.h2
-rw-r--r--src/devices/sound/iremga20.cpp6
-rw-r--r--src/devices/sound/iremga20.h2
-rw-r--r--src/devices/sound/k005289.cpp6
-rw-r--r--src/devices/sound/k005289.h2
-rw-r--r--src/devices/sound/k007232.cpp6
-rw-r--r--src/devices/sound/k007232.h2
-rw-r--r--src/devices/sound/k051649.cpp6
-rw-r--r--src/devices/sound/k051649.h2
-rw-r--r--src/devices/sound/k053260.cpp8
-rw-r--r--src/devices/sound/k053260.h2
-rw-r--r--src/devices/sound/k054539.cpp13
-rw-r--r--src/devices/sound/k054539.h2
-rw-r--r--src/devices/sound/ks0164.cpp4
-rw-r--r--src/devices/sound/ks0164.h2
-rw-r--r--src/devices/sound/l7a1045_l6028_dsp_a.cpp6
-rw-r--r--src/devices/sound/l7a1045_l6028_dsp_a.h2
-rw-r--r--src/devices/sound/lmc1992.cpp4
-rw-r--r--src/devices/sound/lmc1992.h2
-rw-r--r--src/devices/sound/mas3507d.cpp10
-rw-r--r--src/devices/sound/mas3507d.h4
-rw-r--r--src/devices/sound/mea8000.cpp4
-rw-r--r--src/devices/sound/mea8000.h2
-rw-r--r--src/devices/sound/mos6560.cpp6
-rw-r--r--src/devices/sound/mos6560.h2
-rw-r--r--src/devices/sound/mos6581.cpp6
-rw-r--r--src/devices/sound/mos6581.h2
-rw-r--r--src/devices/sound/mos7360.cpp6
-rw-r--r--src/devices/sound/mos7360.h2
-rw-r--r--src/devices/sound/msm5205.cpp23
-rw-r--r--src/devices/sound/msm5205.h4
-rw-r--r--src/devices/sound/msm5232.cpp6
-rw-r--r--src/devices/sound/msm5232.h2
-rw-r--r--src/devices/sound/multipcm.cpp38
-rw-r--r--src/devices/sound/multipcm.h2
-rw-r--r--src/devices/sound/n63701x.cpp6
-rw-r--r--src/devices/sound/n63701x.h2
-rw-r--r--src/devices/sound/namco.cpp139
-rw-r--r--src/devices/sound/namco.h10
-rw-r--r--src/devices/sound/namco_163.cpp4
-rw-r--r--src/devices/sound/namco_163.h2
-rw-r--r--src/devices/sound/nes_apu.cpp11
-rw-r--r--src/devices/sound/nes_apu.h2
-rw-r--r--src/devices/sound/nile.cpp6
-rw-r--r--src/devices/sound/nile.h2
-rw-r--r--src/devices/sound/okim6258.cpp6
-rw-r--r--src/devices/sound/okim6258.h2
-rw-r--r--src/devices/sound/okim6295.cpp53
-rw-r--r--src/devices/sound/okim6295.h20
-rw-r--r--src/devices/sound/okim6376.cpp25
-rw-r--r--src/devices/sound/okim6376.h7
-rw-r--r--src/devices/sound/okim9810.cpp6
-rw-r--r--src/devices/sound/okim9810.h4
-rw-r--r--src/devices/sound/pcd3311.cpp4
-rw-r--r--src/devices/sound/pcd3311.h2
-rw-r--r--src/devices/sound/pokey.cpp47
-rw-r--r--src/devices/sound/pokey.h4
-rw-r--r--src/devices/sound/qs1000.cpp6
-rw-r--r--src/devices/sound/qs1000.h2
-rw-r--r--src/devices/sound/qsound.cpp6
-rw-r--r--src/devices/sound/qsound.h2
-rw-r--r--src/devices/sound/qsoundhle.cpp6
-rw-r--r--src/devices/sound/qsoundhle.h2
-rw-r--r--src/devices/sound/rf5c400.cpp6
-rw-r--r--src/devices/sound/rf5c400.h2
-rw-r--r--src/devices/sound/rf5c68.cpp6
-rw-r--r--src/devices/sound/rf5c68.h2
-rw-r--r--src/devices/sound/rolandpcm.cpp6
-rw-r--r--src/devices/sound/rolandpcm.h2
-rw-r--r--src/devices/sound/rp2c33_snd.cpp6
-rw-r--r--src/devices/sound/rp2c33_snd.h2
-rw-r--r--src/devices/sound/s14001a.cpp6
-rw-r--r--src/devices/sound/s14001a.h2
-rw-r--r--src/devices/sound/s_dsp.cpp10
-rw-r--r--src/devices/sound/s_dsp.h2
-rw-r--r--src/devices/sound/saa1099.cpp6
-rw-r--r--src/devices/sound/saa1099.h2
-rw-r--r--src/devices/sound/samples.cpp83
-rw-r--r--src/devices/sound/samples.h15
-rw-r--r--src/devices/sound/scsp.cpp16
-rw-r--r--src/devices/sound/scsp.h6
-rw-r--r--src/devices/sound/segapcm.cpp6
-rw-r--r--src/devices/sound/segapcm.h2
-rw-r--r--src/devices/sound/sn76477.cpp6
-rw-r--r--src/devices/sound/sn76477.h2
-rw-r--r--src/devices/sound/sn76496.cpp17
-rw-r--r--src/devices/sound/sn76496.h2
-rw-r--r--src/devices/sound/snkwave.cpp6
-rw-r--r--src/devices/sound/snkwave.h2
-rw-r--r--src/devices/sound/sp0250.cpp30
-rw-r--r--src/devices/sound/sp0250.h2
-rw-r--r--src/devices/sound/sp0256.cpp6
-rw-r--r--src/devices/sound/sp0256.h2
-rw-r--r--src/devices/sound/spkrdev.cpp6
-rw-r--r--src/devices/sound/spkrdev.h2
-rw-r--r--src/devices/sound/spu.cpp16
-rw-r--r--src/devices/sound/spu.h8
-rw-r--r--src/devices/sound/st0016.cpp6
-rw-r--r--src/devices/sound/st0016.h2
-rw-r--r--src/devices/sound/swp00.cpp4
-rw-r--r--src/devices/sound/swp00.h2
-rw-r--r--src/devices/sound/swp20.cpp2
-rw-r--r--src/devices/sound/swp20.h2
-rw-r--r--src/devices/sound/swp30.cpp4
-rw-r--r--src/devices/sound/swp30.h2
-rw-r--r--src/devices/sound/t6721a.cpp6
-rw-r--r--src/devices/sound/t6721a.h2
-rw-r--r--src/devices/sound/t6w28.cpp6
-rw-r--r--src/devices/sound/t6w28.h2
-rw-r--r--src/devices/sound/tc8830f.cpp4
-rw-r--r--src/devices/sound/tc8830f.h2
-rw-r--r--src/devices/sound/tiaintf.cpp6
-rw-r--r--src/devices/sound/tiaintf.h2
-rw-r--r--src/devices/sound/tms3615.cpp27
-rw-r--r--src/devices/sound/tms3615.h2
-rw-r--r--src/devices/sound/tms36xx.cpp6
-rw-r--r--src/devices/sound/tms36xx.h2
-rw-r--r--src/devices/sound/tms5110.cpp6
-rw-r--r--src/devices/sound/tms5110.h2
-rw-r--r--src/devices/sound/tms5220.cpp19
-rw-r--r--src/devices/sound/tms5220.h2
-rw-r--r--src/devices/sound/upd1771.cpp6
-rw-r--r--src/devices/sound/upd1771.h2
-rw-r--r--src/devices/sound/upd7752.cpp6
-rw-r--r--src/devices/sound/upd7752.h2
-rw-r--r--src/devices/sound/upd7759.cpp77
-rw-r--r--src/devices/sound/upd7759.h26
-rw-r--r--src/devices/sound/upd934g.cpp6
-rw-r--r--src/devices/sound/upd934g.h2
-rw-r--r--src/devices/sound/vgm_visualizer.cpp34
-rw-r--r--src/devices/sound/vgm_visualizer.h6
-rw-r--r--src/devices/sound/vlm5030.cpp6
-rw-r--r--src/devices/sound/vlm5030.h2
-rw-r--r--src/devices/sound/volt_reg.cpp11
-rw-r--r--src/devices/sound/volt_reg.h6
-rw-r--r--src/devices/sound/votrax.cpp10
-rw-r--r--src/devices/sound/votrax.h4
-rw-r--r--src/devices/sound/vrc6.cpp6
-rw-r--r--src/devices/sound/vrc6.h2
-rw-r--r--src/devices/sound/vrender0.cpp6
-rw-r--r--src/devices/sound/vrender0.h2
-rw-r--r--src/devices/sound/wave.cpp8
-rw-r--r--src/devices/sound/wave.h2
-rw-r--r--src/devices/sound/x1_010.cpp6
-rw-r--r--src/devices/sound/x1_010.h2
-rw-r--r--src/devices/sound/ym2151.cpp13
-rw-r--r--src/devices/sound/ym2151.h2
-rw-r--r--src/devices/sound/ym2413.cpp6
-rw-r--r--src/devices/sound/ym2413.h2
-rw-r--r--src/devices/sound/ymf262.cpp2
-rw-r--r--src/devices/sound/ymf262.h2
-rw-r--r--src/devices/sound/ymf271.cpp6
-rw-r--r--src/devices/sound/ymf271.h2
-rw-r--r--src/devices/sound/ymf278b.cpp6
-rw-r--r--src/devices/sound/ymf278b.h2
-rw-r--r--src/devices/sound/ymz280b.cpp6
-rw-r--r--src/devices/sound/ymz280b.h2
-rw-r--r--src/devices/sound/ymz770.cpp6
-rw-r--r--src/devices/sound/ymz770.h2
-rw-r--r--src/devices/sound/zsg2.cpp6
-rw-r--r--src/devices/sound/zsg2.h2
-rw-r--r--src/devices/video/i8244.cpp8
-rw-r--r--src/devices/video/i8244.h3
-rw-r--r--src/devices/video/pwm.cpp28
-rw-r--r--src/devices/video/pwm.h4
-rw-r--r--src/emu/debug/dvmemory.cpp2
-rw-r--r--src/emu/devfind.h11
-rw-r--r--src/emu/disound.cpp105
-rw-r--r--src/emu/disound.h18
-rw-r--r--src/emu/inpttype.ipp29
-rw-r--r--src/emu/ioport.h19
-rw-r--r--src/emu/layout/exorterm155.lay9
-rw-r--r--src/emu/layout/ie15.lay2
-rw-r--r--src/emu/render.cpp6
-rw-r--r--src/emu/render.h46
-rw-r--r--src/emu/rendlay.cpp723
-rw-r--r--src/emu/rendutil.cpp3
-rw-r--r--src/emu/save.cpp6
-rw-r--r--src/emu/save.h185
-rw-r--r--src/emu/sound.cpp1699
-rw-r--r--src/emu/sound.h821
-rw-r--r--src/emu/speaker.cpp76
-rw-r--r--src/emu/speaker.h16
-rw-r--r--src/emu/xtal.cpp2
-rw-r--r--src/frontend/mame/luaengine.cpp7
-rw-r--r--src/frontend/mame/ui/ui.cpp10
-rw-r--r--src/lib/formats/p2000t_cas.cpp321
-rw-r--r--src/lib/formats/p2000t_cas.h19
-rw-r--r--src/lib/netlist/analog/nld_generic_models.h1
-rw-r--r--src/lib/netlist/core/setup.h19
-rw-r--r--src/lib/netlist/devices/net_lib.h2
-rwxr-xr-xsrc/lib/netlist/generated/nlm_modules_lib.cpp4
-rw-r--r--src/lib/netlist/generated/static_solvers.cpp8
-rw-r--r--src/lib/netlist/macro/modules/nlmod_ICL8038_DIP.cpp61
-rw-r--r--src/lib/netlist/macro/modules/nlmod_NE556_DIP.cpp24
-rw-r--r--src/lib/netlist/macro/nlm_base_lib.cpp21
-rw-r--r--src/lib/netlist/nl_base.cpp4
-rw-r--r--src/lib/netlist/nl_parser.cpp22
-rw-r--r--src/lib/netlist/nl_parser.h23
-rw-r--r--src/lib/netlist/nl_setup.cpp24
-rw-r--r--src/lib/netlist/nl_setup.h3
-rw-r--r--src/lib/netlist/nltypes.h16
-rw-r--r--src/lib/netlist/plib/pexception.h4
-rw-r--r--src/lib/netlist/plib/ptokenizer.h46
-rw-r--r--src/lib/netlist/plib/ptypes.h24
-rw-r--r--src/lib/netlist/prg/nltool.cpp4
-rw-r--r--src/lib/netlist/solver/nld_solver.cpp2
-rw-r--r--src/mame/audio/arcadia.cpp6
-rw-r--r--src/mame/audio/arcadia.h2
-rw-r--r--src/mame/audio/atarisac.cpp2
-rw-r--r--src/mame/audio/channelf.cpp6
-rw-r--r--src/mame/audio/channelf.h2
-rw-r--r--src/mame/audio/cheekyms.cpp2
-rw-r--r--src/mame/audio/cinemat.cpp26
-rw-r--r--src/mame/audio/cmi01a.cpp4
-rw-r--r--src/mame/audio/cmi01a.h2
-rw-r--r--src/mame/audio/cps3.cpp6
-rw-r--r--src/mame/audio/cps3.h2
-rw-r--r--src/mame/audio/dai_snd.cpp6
-rw-r--r--src/mame/audio/dai_snd.h2
-rw-r--r--src/mame/audio/dsbz80.cpp4
-rw-r--r--src/mame/audio/dsbz80.h2
-rw-r--r--src/mame/audio/elan_eu3a05.cpp6
-rw-r--r--src/mame/audio/elan_eu3a05.h2
-rw-r--r--src/mame/audio/exidy.cpp6
-rw-r--r--src/mame/audio/exidy.h2
-rw-r--r--src/mame/audio/exidy440.cpp6
-rw-r--r--src/mame/audio/exidy440.h2
-rw-r--r--src/mame/audio/flower.cpp4
-rw-r--r--src/mame/audio/flower.h2
-rw-r--r--src/mame/audio/geebee.cpp6
-rw-r--r--src/mame/audio/geebee.h2
-rw-r--r--src/mame/audio/gomoku.cpp6
-rw-r--r--src/mame/audio/gomoku.h2
-rw-r--r--src/mame/audio/gottlieb.cpp6
-rw-r--r--src/mame/audio/gridlee.cpp6
-rw-r--r--src/mame/audio/hyprolyb.cpp6
-rw-r--r--src/mame/audio/hyprolyb.h2
-rw-r--r--src/mame/audio/irem.cpp6
-rw-r--r--src/mame/audio/lynx.cpp12
-rw-r--r--src/mame/audio/lynx.h4
-rw-r--r--src/mame/audio/mario.cpp2
-rw-r--r--src/mame/audio/micro3d.cpp6
-rw-r--r--src/mame/audio/micro3d.h2
-rw-r--r--src/mame/audio/mw8080bw.cpp6
-rw-r--r--src/mame/audio/nl_astrob.cpp7
-rw-r--r--src/mame/audio/nl_cinemat_common.h24
-rw-r--r--src/mame/audio/nl_destroyr.cpp21
-rw-r--r--src/mame/audio/nl_elim.cpp5
-rw-r--r--src/mame/audio/nl_fireone.cpp84
-rw-r--r--src/mame/audio/nl_flyball.cpp21
-rw-r--r--src/mame/audio/nl_spacfury.cpp8
-rw-r--r--src/mame/audio/nl_starfire.cpp79
-rw-r--r--src/mame/audio/phoenix.cpp6
-rw-r--r--src/mame/audio/phoenix.h2
-rw-r--r--src/mame/audio/pleiads.cpp14
-rw-r--r--src/mame/audio/pleiads.h6
-rw-r--r--src/mame/audio/polepos.cpp6
-rw-r--r--src/mame/audio/polepos.h2
-rw-r--r--src/mame/audio/redbaron.cpp6
-rw-r--r--src/mame/audio/redbaron.h2
-rw-r--r--src/mame/audio/segag80.cpp8
-rw-r--r--src/mame/audio/segag80r.cpp6
-rw-r--r--src/mame/audio/segausb.cpp6
-rw-r--r--src/mame/audio/segausb.h2
-rw-r--r--src/mame/audio/seibu.cpp6
-rw-r--r--src/mame/audio/seibu.h2
-rw-r--r--src/mame/audio/sente6vb.cpp138
-rw-r--r--src/mame/audio/sente6vb.h14
-rw-r--r--src/mame/audio/snk6502.cpp6
-rw-r--r--src/mame/audio/snk6502.h2
-rw-r--r--src/mame/audio/socrates.cpp6
-rw-r--r--src/mame/audio/socrates.h2
-rw-r--r--src/mame/audio/special.cpp6
-rw-r--r--src/mame/audio/special.h2
-rw-r--r--src/mame/audio/svis_snd.cpp6
-rw-r--r--src/mame/audio/svis_snd.h2
-rw-r--r--src/mame/audio/taito_en.cpp20
-rw-r--r--src/mame/audio/tiamc1.cpp6
-rw-r--r--src/mame/audio/tiamc1.h2
-rw-r--r--src/mame/audio/timeplt.cpp6
-rw-r--r--src/mame/audio/timeplt.h2
-rw-r--r--src/mame/audio/trackfld.cpp6
-rw-r--r--src/mame/audio/trackfld.h2
-rw-r--r--src/mame/audio/turrett.cpp6
-rw-r--r--src/mame/audio/tvc.cpp12
-rw-r--r--src/mame/audio/tvc.h2
-rw-r--r--src/mame/audio/tx1.cpp12
-rw-r--r--src/mame/audio/tx1.h4
-rw-r--r--src/mame/audio/vboy.cpp6
-rw-r--r--src/mame/audio/vboy.h2
-rw-r--r--src/mame/audio/vc4000.cpp6
-rw-r--r--src/mame/audio/vc4000.h2
-rw-r--r--src/mame/audio/warpwarp.cpp6
-rw-r--r--src/mame/audio/warpwarp.h2
-rw-r--r--src/mame/audio/wiping.cpp6
-rw-r--r--src/mame/audio/wiping.h2
-rw-r--r--src/mame/audio/wswan.cpp12
-rw-r--r--src/mame/audio/wswan.h2
-rw-r--r--src/mame/audio/xavix.cpp4
-rw-r--r--src/mame/audio/zaccaria.cpp6
-rw-r--r--src/mame/drivers/1942.cpp2
-rw-r--r--src/mame/drivers/5clown.cpp2
-rw-r--r--src/mame/drivers/abc1600.cpp41
-rw-r--r--src/mame/drivers/apple3.cpp10
-rw-r--r--src/mame/drivers/aristmk4.cpp2
-rw-r--r--src/mame/drivers/bmcpokr.cpp4
-rw-r--r--src/mame/drivers/bublbobl.cpp9
-rw-r--r--src/mame/drivers/carpolo.cpp2
-rw-r--r--src/mame/drivers/chance32.cpp4
-rw-r--r--src/mame/drivers/cocoloco.cpp2
-rw-r--r--src/mame/drivers/compis.cpp4
-rw-r--r--src/mame/drivers/dblcrown.cpp2
-rw-r--r--src/mame/drivers/destroyr.cpp2
-rw-r--r--src/mame/drivers/emu3.cpp2
-rw-r--r--src/mame/drivers/esq1.cpp6
-rw-r--r--src/mame/drivers/flyball.cpp2
-rw-r--r--src/mame/drivers/galaxian.cpp4
-rw-r--r--src/mame/drivers/gamemachine.cpp2
-rw-r--r--src/mame/drivers/generalplus_gpl16250_nand.cpp9
-rw-r--r--src/mame/drivers/ginganin.cpp18
-rw-r--r--src/mame/drivers/goldnpkr.cpp2
-rw-r--r--src/mame/drivers/hh_tms1k.cpp2
-rw-r--r--src/mame/drivers/informer_207_376.cpp111
-rw-r--r--src/mame/drivers/informer_213.cpp (renamed from src/mame/drivers/informer_213ae.cpp)54
-rw-r--r--src/mame/drivers/istrebiteli.cpp6
-rw-r--r--src/mame/drivers/jaguar.cpp21
-rw-r--r--src/mame/drivers/konmedal68k.cpp61
-rw-r--r--src/mame/drivers/mac.cpp300
-rw-r--r--src/mame/drivers/mac128.cpp254
-rw-r--r--src/mame/drivers/majorpkr.cpp2
-rw-r--r--src/mame/drivers/megaplay.cpp4
-rw-r--r--src/mame/drivers/microdar.cpp1
-rw-r--r--src/mame/drivers/milton6805.cpp6
-rw-r--r--src/mame/drivers/mpu4vid.cpp4
-rw-r--r--src/mame/drivers/naomi.cpp79
-rw-r--r--src/mame/drivers/news_38xx.cpp6
-rw-r--r--src/mame/drivers/news_68k.cpp6
-rw-r--r--src/mame/drivers/ninjaw.cpp6
-rw-r--r--src/mame/drivers/norautp.cpp8
-rw-r--r--src/mame/drivers/p2000t.cpp9
-rw-r--r--src/mame/drivers/pdp1.cpp714
-rw-r--r--src/mame/drivers/popeye.cpp2
-rw-r--r--src/mame/drivers/prehisle.cpp9
-rw-r--r--src/mame/drivers/pv1000.cpp8
-rw-r--r--src/mame/drivers/roland_jd800.cpp74
-rw-r--r--src/mame/drivers/rx78.cpp14
-rw-r--r--src/mame/drivers/segas16b.cpp8
-rw-r--r--src/mame/drivers/seta2.cpp4
-rw-r--r--src/mame/drivers/sigmab52.cpp36
-rw-r--r--src/mame/drivers/sigmab98.cpp84
-rw-r--r--src/mame/drivers/starcrus.cpp2
-rw-r--r--src/mame/drivers/starfire.cpp4
-rw-r--r--src/mame/drivers/statriv2.cpp32
-rw-r--r--src/mame/drivers/subsino.cpp116
-rw-r--r--src/mame/drivers/summit.cpp2
-rw-r--r--src/mame/drivers/tankbatt.cpp2
-rw-r--r--src/mame/drivers/thedealr.cpp2
-rw-r--r--src/mame/drivers/unkpoker.cpp2
-rw-r--r--src/mame/drivers/vpoker.cpp2
-rw-r--r--src/mame/drivers/zeebo_qualcomm_adreno130.cpp2
-rw-r--r--src/mame/drivers/zn.cpp62
-rw-r--r--src/mame/includes/gridlee.h2
-rw-r--r--src/mame/includes/mac.h94
-rw-r--r--src/mame/includes/p2000t.h4
-rw-r--r--src/mame/includes/pdp1.h262
-rw-r--r--src/mame/includes/segag80r.h2
-rw-r--r--src/mame/includes/turrett.h2
-rw-r--r--src/mame/includes/xavix.h2
-rw-r--r--src/mame/layout/aci_ggm.lay184
-rw-r--r--src/mame/layout/alphie.lay8
-rw-r--r--src/mame/layout/apollo.lay6
-rw-r--r--src/mame/layout/apollo_15i.lay6
-rw-r--r--src/mame/layout/apollo_dsp.lay6
-rw-r--r--src/mame/layout/conic_cchess2.lay4
-rw-r--r--src/mame/layout/copycat.lay12
-rw-r--r--src/mame/layout/ctstein.lay8
-rw-r--r--src/mame/layout/esq1by22.lay2
-rw-r--r--src/mame/layout/gp_1.lay101
-rw-r--r--src/mame/layout/gp_2.lay101
-rw-r--r--src/mame/layout/h8.lay3
-rw-r--r--src/mame/layout/matchme.lay20
-rw-r--r--src/mame/layout/matchnum.lay4
-rw-r--r--src/mame/layout/megacd.lay4
-rw-r--r--src/mame/layout/mephisto_1.lay4
-rw-r--r--src/mame/layout/mephisto_3.lay2
-rw-r--r--src/mame/layout/mephisto_alm16.lay8
-rw-r--r--src/mame/layout/mephisto_alm32.lay8
-rw-r--r--src/mame/layout/mephisto_esb2.lay6
-rw-r--r--src/mame/layout/mephisto_gen32.lay8
-rw-r--r--src/mame/layout/mephisto_mirage.lay12
-rw-r--r--src/mame/layout/mgavegas.lay2
-rw-r--r--src/mame/layout/micropin.lay2
-rw-r--r--src/mame/layout/microvision.lay4
-rw-r--r--src/mame/layout/novag_savant.lay4
-rw-r--r--src/mame/layout/novag_supercon.lay42
-rw-r--r--src/mame/layout/qfire.lay4
-rw-r--r--src/mame/layout/saitek_mark5.lay154
-rw-r--r--src/mame/layout/saitek_mark6.lay154
-rw-r--r--src/mame/layout/saitek_ssystem3.lay16
-rw-r--r--src/mame/layout/saitek_ssystem4.lay4
-rw-r--r--src/mame/layout/savia84.lay3
-rw-r--r--src/mame/layout/simon.lay8
-rw-r--r--src/mame/layout/speedfrk.lay8
-rw-r--r--src/mame/layout/ssimon.lay32
-rw-r--r--src/mame/layout/super80.lay6
-rw-r--r--src/mame/layout/tisub.lay6
-rw-r--r--src/mame/layout/touchme.lay6
-rw-r--r--src/mame/layout/vk100.lay2
-rw-r--r--src/mame/layout/vt100.lay2
-rw-r--r--src/mame/layout/x68000.lay6
-rw-r--r--src/mame/layout/zodiac.lay2
-rw-r--r--src/mame/machine/abc1600mac.cpp12
-rw-r--r--src/mame/machine/compiskb.cpp6
-rw-r--r--src/mame/machine/cuda.cpp2
-rw-r--r--src/mame/machine/dec_lk201.cpp6
-rw-r--r--src/mame/machine/dmac_0266.cpp54
-rw-r--r--src/mame/machine/dmac_0266.h20
-rw-r--r--src/mame/machine/dmv_keyb.cpp8
-rw-r--r--src/mame/machine/egret.cpp15
-rw-r--r--src/mame/machine/egret.h4
-rw-r--r--src/mame/machine/k7659kb.cpp102
-rw-r--r--src/mame/machine/kay_kbd.cpp2
-rw-r--r--src/mame/machine/kb_poisk1.h16
-rw-r--r--src/mame/machine/mac.cpp503
-rw-r--r--src/mame/machine/macadb.cpp490
-rw-r--r--src/mame/machine/macadb.h110
-rw-r--r--src/mame/machine/mbc55x_kbd.cpp30
-rw-r--r--src/mame/machine/mega32x.cpp4
-rw-r--r--src/mame/machine/mega32x.h2
-rw-r--r--src/mame/machine/mm1kb.cpp2
-rw-r--r--src/mame/machine/nl_tank.cpp21
-rw-r--r--src/mame/machine/octo_kbd.cpp8
-rw-r--r--src/mame/machine/p2000t.cpp107
-rw-r--r--src/mame/machine/p2000t_mdcr.cpp321
-rw-r--r--src/mame/machine/p2000t_mdcr.h177
-rw-r--r--src/mame/mame.lst11
-rw-r--r--src/mame/mess.flt3
-rw-r--r--src/mame/video/gic.cpp4
-rw-r--r--src/mame/video/gic.h2
-rw-r--r--src/mame/video/pdp1.cpp66
-rw-r--r--src/mame/video/prehisle.cpp8
-rw-r--r--src/tools/castool.cpp2
-rw-r--r--src/tools/unidasm.cpp4
577 files changed, 8918 insertions, 6215 deletions
diff --git a/src/devices/bus/a2bus/a2cffa.cpp b/src/devices/bus/a2bus/a2cffa.cpp
index 7f6104310be..d08ac21f017 100644
--- a/src/devices/bus/a2bus/a2cffa.cpp
+++ b/src/devices/bus/a2bus/a2cffa.cpp
@@ -2,7 +2,7 @@
// copyright-holders:R. Belmont
/*********************************************************************
- a2cffa.c
+ a2cffa.cpp
Implementation of Rich Dreher's IDE/CompactFlash card
for the Apple II.
@@ -16,18 +16,12 @@
#include "imagedev/harddriv.h"
#include "softlist.h"
-/***************************************************************************
- PARAMETERS
-***************************************************************************/
-
-#define LOG_A2CFFA 1
-
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
-DEFINE_DEVICE_TYPE(A2BUS_CFFA2, a2bus_cffa2_device, "a2cffa2", "CFFA2000 Compact Flash (65C02 firmware, www.dreher.net)")
-DEFINE_DEVICE_TYPE(A2BUS_CFFA2_6502, a2bus_cffa2_6502_device, "a2cffa02", "CFFA2000 Compact Flash (6502 firmware, www.dreher.net)")
+DEFINE_DEVICE_TYPE(A2BUS_CFFA2, a2bus_cffa2_device, "a2cffa2", "CFFA 2.0 Compact Flash (65C02 firmware, www.dreher.net)")
+DEFINE_DEVICE_TYPE(A2BUS_CFFA2_6502, a2bus_cffa2_6502_device, "a2cffa02", "CFFA 2.0 Compact Flash (6502 firmware, www.dreher.net)")
#define CFFA2_ROM_REGION "cffa2_rom"
#define CFFA2_ATA_TAG "cffa2_ata"
diff --git a/src/devices/bus/a2bus/a2mcms.cpp b/src/devices/bus/a2bus/a2mcms.cpp
index 7e2cab57b6b..f9de57897f8 100644
--- a/src/devices/bus/a2bus/a2mcms.cpp
+++ b/src/devices/bus/a2bus/a2mcms.cpp
@@ -206,7 +206,7 @@ mcms_device::mcms_device(const machine_config &mconfig, const char *tag, device_
void mcms_device::device_start()
{
m_write_irq.resolve();
- m_stream = machine().sound().stream_alloc(*this, 0, 2, 31250);
+ m_stream = stream_alloc_legacy(0, 2, 31250);
m_timer = timer_alloc(0, nullptr);
m_clrtimer = timer_alloc(1, nullptr);
m_enabled = false;
@@ -252,7 +252,7 @@ void mcms_device::device_timer(emu_timer &timer, device_timer_id tid, int param,
}
}
-void mcms_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void mcms_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *outL, *outR;
int i, v;
diff --git a/src/devices/bus/a2bus/a2mcms.h b/src/devices/bus/a2bus/a2mcms.h
index 9a183a9313d..11e8b332ee0 100644
--- a/src/devices/bus/a2bus/a2mcms.h
+++ b/src/devices/bus/a2bus/a2mcms.h
@@ -42,7 +42,7 @@ protected:
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
sound_stream *m_stream;
diff --git a/src/devices/bus/coco/coco_ssc.cpp b/src/devices/bus/coco/coco_ssc.cpp
index 2f7a1793071..63f6e90fcc5 100644
--- a/src/devices/bus/coco/coco_ssc.cpp
+++ b/src/devices/bus/coco/coco_ssc.cpp
@@ -130,7 +130,7 @@ namespace
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
sound_stream* m_stream;
@@ -535,17 +535,17 @@ cocossc_sac_device::cocossc_sac_device(const machine_config &mconfig, const char
void cocossc_sac_device::device_start()
{
- m_stream = stream_alloc(1, 1, machine().sample_rate());
+ m_stream = stream_alloc_legacy(1, 1, machine().sample_rate());
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void cocossc_sac_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void cocossc_sac_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
- stream_sample_t *src = inputs[0];
+ stream_sample_t const *src = inputs[0];
stream_sample_t *dst = outputs[0];
double n = samples;
diff --git a/src/devices/bus/isa/gus.cpp b/src/devices/bus/isa/gus.cpp
index 239b8a6d2d2..a1c3f39612e 100644
--- a/src/devices/bus/isa/gus.cpp
+++ b/src/devices/bus/isa/gus.cpp
@@ -243,7 +243,7 @@ void gf1_device::device_timer(emu_timer &timer, device_timer_id id, int param, v
}
}
-void gf1_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void gf1_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int x,y;
//uint32_t count;
@@ -403,7 +403,7 @@ void gf1_device::device_start()
m_wave_ram.resize(1024*1024);
memset(&m_wave_ram[0], 0, 1024*1024);
- m_stream = stream_alloc(0,2,clock() / (14 * 16));
+ m_stream = stream_alloc_legacy(0,2,clock() / (14 * 16));
// init timers
m_timer1 = timer_alloc(ADLIB_TIMER1);
diff --git a/src/devices/bus/isa/gus.h b/src/devices/bus/isa/gus.h
index ec2e4168142..3f637bee84d 100644
--- a/src/devices/bus/isa/gus.h
+++ b/src/devices/bus/isa/gus.h
@@ -123,7 +123,7 @@ public:
// optional information overrides
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
protected:
// voice-specific registers
diff --git a/src/devices/bus/neogeo/prot_fatfury2.cpp b/src/devices/bus/neogeo/prot_fatfury2.cpp
index bd7af9247db..c8e7151e6e8 100644
--- a/src/devices/bus/neogeo/prot_fatfury2.cpp
+++ b/src/devices/bus/neogeo/prot_fatfury2.cpp
@@ -11,14 +11,18 @@ DEFINE_DEVICE_TYPE(NG_FATFURY2_PROT, fatfury2_prot_device, "ng_fatfury_prot", "N
fatfury2_prot_device::fatfury2_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, NG_FATFURY2_PROT, tag, owner, clock),
- m_prot_data(0)
+ m_pro_ct0(*this, "pro_ct0")
{
}
+void fatfury2_prot_device::device_add_mconfig(machine_config &config)
+{
+ ALPHA_8921(config, m_pro_ct0, 0); // PRO-CT0 or SNK-9201
+}
+
void fatfury2_prot_device::device_start()
{
- save_item(NAME(m_prot_data));
}
void fatfury2_prot_device::device_reset()
@@ -33,69 +37,27 @@ void fatfury2_prot_device::device_reset()
/* 0x2xxxxx range. There are several checks all around the code. */
uint16_t fatfury2_prot_device::protection_r(offs_t offset)
{
- uint16_t res = m_prot_data >> 24;
-
- switch (offset)
- {
- case 0x55550/2:
- case 0xffff0/2:
- case 0x00000/2:
- case 0xff000/2:
- case 0x36000/2:
- case 0x36008/2:
- return res;
-
- case 0x36004/2:
- case 0x3600c/2:
- return ((res & 0xf0) >> 4) | ((res & 0x0f) << 4);
-
- default:
- logerror("unknown protection read at %s, offset %08x\n", machine().describe_context(), offset << 1);
- return 0;
- }
+ m_pro_ct0->even_w(BIT(offset, 1));
+ m_pro_ct0->h_w(BIT(offset, 2));
+ u8 gad = m_pro_ct0->gad_r();
+ u8 gbd = m_pro_ct0->gbd_r();
+ return (BIT(gbd, 0, 2) << 6) | (BIT(gbd, 2, 2) << 4) | (BIT(gad, 0, 2) << 6) | (BIT(gad, 2, 2) << 4);
}
void fatfury2_prot_device::protection_w(offs_t offset, uint16_t data)
{
- switch (offset)
- {
- case 0x11112/2: /* data == 0x1111; expects 0xff000000 back */
- m_prot_data = 0xff000000;
- break;
-
- case 0x33332/2: /* data == 0x3333; expects 0x0000ffff back */
- m_prot_data = 0x0000ffff;
- break;
-
- case 0x44442/2: /* data == 0x4444; expects 0x00ff0000 back */
- m_prot_data = 0x00ff0000;
- break;
-
- case 0x55552/2: /* data == 0x5555; read back from 55550, ffff0, 00000, ff000 */
- m_prot_data = 0xff00ff00;
- break;
-
- case 0x56782/2: /* data == 0x1234; read back from 36000 *or* 36004 */
- m_prot_data = 0xf05a3601;
- break;
-
- case 0x42812/2: /* data == 0x1824; read back from 36008 *or* 3600c */
- m_prot_data = 0x81422418;
- break;
-
- case 0x55550/2:
- case 0xffff0/2:
- case 0xff000/2:
- case 0x36000/2:
- case 0x36004/2:
- case 0x36008/2:
- case 0x3600c/2:
- m_prot_data <<= 8;
- break;
-
- default:
- logerror("unknown protection write at %s, offset %08x, data %02x\n", machine().describe_context(), offset, data);
- break;
- }
+ // /PORTOEL connected into PRO-CT0 CLK pin
+ m_pro_ct0->clk_w(true);
+
+ m_pro_ct0->load_w(BIT(offset, 0)); // A1
+ m_pro_ct0->even_w(BIT(offset, 1)); // A2
+ m_pro_ct0->h_w(BIT(offset, 2)); // A3
+
+ // C16-31 = A4-A19, C0-C15 = D0-D15
+ m_pro_ct0->c_w((u32(bitswap<16>(BIT(offset, 3, 16), 15, 13, 11, 9, 14, 12, 10, 8, 7, 5, 3, 1, 6, 4, 2, 0)) << 16) |
+ bitswap<16>(data, 15, 13, 11, 9, 14, 12, 10, 8, 7, 5, 3, 1, 6, 4, 2, 0));
+
+ // release /PORTOEL
+ m_pro_ct0->clk_w(false);
}
diff --git a/src/devices/bus/neogeo/prot_fatfury2.h b/src/devices/bus/neogeo/prot_fatfury2.h
index 111b9f7388b..1cab87cb26a 100644
--- a/src/devices/bus/neogeo/prot_fatfury2.h
+++ b/src/devices/bus/neogeo/prot_fatfury2.h
@@ -6,6 +6,8 @@
#pragma once
+#include "machine/alpha_8921.h"
+
DECLARE_DEVICE_TYPE(NG_FATFURY2_PROT, fatfury2_prot_device)
@@ -19,10 +21,12 @@ public:
void protection_w(offs_t offset, uint16_t data);
protected:
+ virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- uint32_t m_prot_data;
+private:
+ required_device<alpha_8921_device> m_pro_ct0; // PRO-CT0 or SNK-9201
};
#endif // MAME_BUS_NEOGEO_PROT_FATFURY2_H
diff --git a/src/devices/bus/uts_kbd/400kbd.cpp b/src/devices/bus/uts_kbd/400kbd.cpp
index 38d35fda607..50e05d4eddf 100644
--- a/src/devices/bus/uts_kbd/400kbd.cpp
+++ b/src/devices/bus/uts_kbd/400kbd.cpp
@@ -112,7 +112,7 @@ static INPUT_PORTS_START(uts_400kbd)
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(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)
diff --git a/src/devices/cpu/mcs48/mcs48.cpp b/src/devices/cpu/mcs48/mcs48.cpp
index f43e25e7986..58f3d31b150 100644
--- a/src/devices/cpu/mcs48/mcs48.cpp
+++ b/src/devices/cpu/mcs48/mcs48.cpp
@@ -889,10 +889,10 @@ OPHANDLER( stop_tcnt ) { burn_cycles(1); m_timecount_enabled = 0; }
OPHANDLER( strt_t ) { burn_cycles(1); m_timecount_enabled = TIMER_ENABLED; m_prescaler = 0; }
OPHANDLER( strt_cnt )
{
+ burn_cycles(1);
if (!(m_timecount_enabled & COUNTER_ENABLED))
m_t1_history = test_r(1);
- burn_cycles(1);
m_timecount_enabled = COUNTER_ENABLED;
}
diff --git a/src/devices/cpu/pdp1/pdp1.cpp b/src/devices/cpu/pdp1/pdp1.cpp
index a8704ad29d3..2d04709a4a9 100644
--- a/src/devices/cpu/pdp1/pdp1.cpp
+++ b/src/devices/cpu/pdp1/pdp1.cpp
@@ -348,8 +348,8 @@
#define LOG_EXTRA 0
#define LOG_IOT_EXTRA 0
-#define READ_PDP_18BIT(A) ((signed)m_program->read_dword((A)<<2))
-#define WRITE_PDP_18BIT(A,V) (m_program->write_dword((A)<<2,(V)))
+#define READ_PDP_18BIT(A) ((signed)m_program->read_dword(A))
+#define WRITE_PDP_18BIT(A,V) (m_program->write_dword((A),(V)))
#define PC m_pc
@@ -378,12 +378,14 @@
#define PREVIOUS_PC ((PC & ADDRESS_EXTENSION_MASK) | ((PC-1) & BASE_ADDRESS_MASK))
-DEFINE_DEVICE_TYPE(PDP1, pdp1_device, "pdp1_cpu", "DEC PDP1")
+DEFINE_DEVICE_TYPE(PDP1, pdp1_device, "pdp1_cpu", "DEC PDP-1 Central Processor")
pdp1_device::pdp1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: cpu_device(mconfig, PDP1, tag, owner, clock)
- , m_program_config("program", ENDIANNESS_BIG, 32, 18, 0)
+ , m_program_config("program", ENDIANNESS_BIG, 32, 18, -2) // data is actually 18 bits wide
+ , m_extern_iot(*this)
+ , m_io_sc_callback(*this)
{
m_program_config.m_is_octal = true;
}
@@ -405,16 +407,9 @@ void pdp1_device::device_config_complete()
// or initialize to defaults if none provided
else
{
- memset(&read_binary_word, 0, sizeof(read_binary_word));
- memset(&io_sc_callback, 0, sizeof(io_sc_callback));
extend_support = 0;
hw_mul_div = 0;
type_20_sbs = 0;
-
- for (auto & elem : extern_iot)
- {
- memset(&elem, 0, sizeof(elem));
- }
}
}
@@ -495,34 +490,6 @@ void pdp1_device::execute_set_input(int irqline, int state)
}
-static void null_iot(device_t *device, int op2, int nac, int mb, int *io, int ac)
-{
- pdp1_device *pdp1 = dynamic_cast<pdp1_device*>(device);
-
- pdp1->pdp1_null_iot(op2, nac, mb, io, ac);
-}
-
-static void lem_eem_iot(device_t *device, int op2, int nac, int mb, int *io, int ac)
-{
- pdp1_device *pdp1 = dynamic_cast<pdp1_device*>(device);
-
- pdp1->pdp1_lem_eem_iot(op2, nac, mb, io, ac);
-}
-
-static void sbs_iot(device_t *device, int op2, int nac, int mb, int *io, int ac)
-{
- pdp1_device *pdp1 = dynamic_cast<pdp1_device*>(device);
-
- pdp1->pdp1_sbs_iot(op2, nac, mb, io, ac);
-}
-
-static void type_20_sbs_iot(device_t *device, int op2, int nac, int mb, int *io, int ac)
-{
- pdp1_device *pdp1 = dynamic_cast<pdp1_device*>(device);
-
- pdp1->pdp1_type_20_sbs_iot(op2, nac, mb, io, ac);
-}
-
void pdp1_device::device_start()
{
int i;
@@ -569,12 +536,11 @@ void pdp1_device::device_start()
/* set up params and callbacks */
for (i=0; i<64; i++)
{
- m_extern_iot[i] = (extern_iot[i])
- ? extern_iot[i]
- : null_iot;
+ m_extern_iot[i].resolve();
+ if (m_extern_iot[i].isnull())
+ m_extern_iot[i] = iot_delegate(*this, FUNC(pdp1_device::null_iot));
}
- m_read_binary_word = read_binary_word;
- m_io_sc_callback = io_sc_callback;
+ m_io_sc_callback.resolve();
m_extend_support = extend_support;
m_hw_mul_div = hw_mul_div;
m_type_20_sbs = type_20_sbs;
@@ -599,13 +565,13 @@ void pdp1_device::device_start()
if (m_extend_support)
{
- m_extern_iot[074] = lem_eem_iot;
+ m_extern_iot[074] = iot_delegate(*this, FUNC(pdp1_device::lem_eem_iot));
}
- m_extern_iot[054] = m_extern_iot[055] = m_extern_iot[056] = sbs_iot;
+ m_extern_iot[054] = m_extern_iot[055] = m_extern_iot[056] = iot_delegate(*this, FUNC(pdp1_device::sbs_iot));
if (m_type_20_sbs)
{
m_extern_iot[050] = m_extern_iot[051] = m_extern_iot[052] = m_extern_iot[053]
- = type_20_sbs_iot;
+ = iot_delegate(*this, FUNC(pdp1_device::type_20_sbs_iot));
}
state_add( PDP1_PC, "PC", m_pc).formatstr("%06O");
@@ -796,9 +762,6 @@ void pdp1_device::execute_run()
{
do
{
- debugger_instruction_hook(PC);
-
-
/* ioh should be cleared at the end of the instruction cycle, and ios at the
start of next instruction cycle, but who cares? */
if (m_ioh && m_ios)
@@ -808,15 +771,19 @@ void pdp1_device::execute_run()
if ((! m_run) && (! m_rim))
+ {
+ debugger_instruction_hook(PC);
m_icount = 0; /* if processor is stopped, just burn cycles */
+ }
else if (m_rim)
{
switch (m_rim_step)
{
case 0:
/* read first word as instruction */
- if (m_read_binary_word)
- (*m_read_binary_word)(this); /* data will be transferred to IO register */
+ MB = 0;
+ /* data will be transferred to IO register in response to RPB */
+ m_extern_iot[2](2, 0, 1, IO, AC);
m_rim_step = 1;
m_ios = 0;
break;
@@ -860,8 +827,9 @@ void pdp1_device::execute_run()
case 2:
/* read second word as data */
- if (m_read_binary_word)
- (*m_read_binary_word)(this); /* data will be transferred to IO register */
+ MB = 0;
+ /* data will be transferred to IO register in response to RPB */
+ m_extern_iot[2](2, 0, 1, IO, AC);
m_rim_step = 3;
m_ios = 0;
break;
@@ -940,6 +908,7 @@ void pdp1_device::execute_run()
if (! m_cycle)
{ /* no instruction in progress: time to fetch a new instruction, I guess */
+ debugger_instruction_hook(PC);
MB = READ_PDP_18BIT(MA = PC);
INCREMENT_PC;
IR = MB >> 13; /* basic opcode */
@@ -1564,7 +1533,7 @@ void pdp1_device::execute_instruction()
{ /* IOT with IO wait */
if (m_ioc)
{ /* the iot command line is pulsed only if ioc is asserted */
- (*m_extern_iot[MB & 0000077])(this, MB & 0000077, (MB & 0004000) == 0, MB, &IO, AC);
+ m_extern_iot[MB & 0000077](MB & 0000077, (MB & 0004000) == 0, MB, IO, AC);
m_ioh = 1; /* enable io wait */
@@ -1587,7 +1556,7 @@ void pdp1_device::execute_instruction()
}
else
{ /* IOT with no IO wait */
- (*m_extern_iot[MB & 0000077])(this, MB & 0000077, (MB & 0004000) != 0, MB, &IO, AC);
+ m_extern_iot[MB & 0000077](MB & 0000077, (MB & 0004000) != 0, MB, IO, AC);
}
break;
case OPR: /* Operate Instruction Group */
@@ -1639,7 +1608,7 @@ no_fetch:
/*
Handle unimplemented IOT
*/
-void pdp1_device::pdp1_null_iot(int op2, int nac, int mb, int *io, int ac)
+void pdp1_device::null_iot(int op2, int nac, int mb, int &io, int ac)
{
/* Note that the dummy IOT 0 is used to wait for the completion pulse
generated by the a pending IOT (IOT with completion pulse but no IO wait) */
@@ -1661,7 +1630,7 @@ void pdp1_device::pdp1_null_iot(int op2, int nac, int mb, int *io, int ac)
IOT 74: LEM/EEM
*/
-void pdp1_device::pdp1_lem_eem_iot(int op2, int nac, int mb, int *io, int ac)
+void pdp1_device::lem_eem_iot(int op2, int nac, int mb, int &io, int ac)
{
if (! m_extend_support) /* extend mode supported? */
{
@@ -1684,7 +1653,7 @@ void pdp1_device::pdp1_lem_eem_iot(int op2, int nac, int mb, int *io, int ac)
IOT 55: esm
IOT 56: cbs
*/
-void pdp1_device::pdp1_sbs_iot(int op2, int nac, int mb, int *io, int ac)
+void pdp1_device::sbs_iot(int op2, int nac, int mb, int &io, int ac)
{
switch (op2)
{
@@ -1727,7 +1696,7 @@ void pdp1_device::pdp1_sbs_iot(int op2, int nac, int mb, int *io, int ac)
IOT 52: isb
IOT 53: cac
*/
-void pdp1_device::pdp1_type_20_sbs_iot(int op2, int nac, int mb, int *io, int ac)
+void pdp1_device::type_20_sbs_iot(int op2, int nac, int mb, int &io, int ac)
{
int channel, mask;
if (! m_type_20_sbs) /* type 20 sequence break system supported? */
@@ -1820,6 +1789,6 @@ void pdp1_device::pulse_start_clear()
field_interrupt();
/* now, we kindly ask IO devices to reset, too */
- if (m_io_sc_callback)
- (*m_io_sc_callback)(this);
+ if (!m_io_sc_callback.isnull())
+ m_io_sc_callback();
}
diff --git a/src/devices/cpu/pdp1/pdp1.h b/src/devices/cpu/pdp1/pdp1.h
index 1c2d5c7eea3..0a81c8177d4 100644
--- a/src/devices/cpu/pdp1/pdp1.h
+++ b/src/devices/cpu/pdp1/pdp1.h
@@ -20,20 +20,8 @@ enum
};
-typedef void (*pdp1_extern_iot_func)(device_t *device, int op2, int nac, int mb, int *io, int ac);
-typedef void (*pdp1_read_binary_word_func)(device_t *device);
-typedef void (*pdp1_io_sc_func)(device_t *device);
-
-
struct pdp1_reset_param_t
{
- /* callbacks for iot instructions (required for any I/O) */
- pdp1_extern_iot_func extern_iot[64];
- /* read a word from the perforated tape reader (required for read-in mode) */
- pdp1_read_binary_word_func read_binary_word;
- /* callback called when sc is pulsed: IO devices should reset */
- pdp1_io_sc_func io_sc_callback;
-
/* 0: no extend support, 1: extend with 15-bit address, 2: extend with 16-bit address */
int extend_support;
/* 1 to use hardware multiply/divide (MUL, DIV) instead of MUS, DIS */
@@ -49,6 +37,9 @@ class pdp1_device : public cpu_device
, public pdp1_reset_param_t
{
public:
+ typedef device_delegate<void (int op2, int nac, int mb, int &io, int ac)> iot_delegate;
+ typedef device_delegate<void ()> io_sc_delegate;
+
enum opcode
{
AND = 001,
@@ -83,14 +74,16 @@ public:
// construction/destruction
pdp1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <int I, typename... T> void set_iot_callback(T &&... args) { m_extern_iot[I].set(std::forward<T>(args)...); }
+ template <typename... T> void set_io_sc_callback(T &&... args) { m_io_sc_callback.set(std::forward<T>(args)...); }
void set_reset_param(const pdp1_reset_param_t *param) { m_reset_param = param; }
void pulse_start_clear();
void io_complete() { m_ios = 1; }
- void pdp1_null_iot(int op2, int nac, int mb, int *io, int ac);
- void pdp1_lem_eem_iot(int op2, int nac, int mb, int *io, int ac);
- void pdp1_sbs_iot(int op2, int nac, int mb, int *io, int ac);
- void pdp1_type_20_sbs_iot(int op2, int nac, int mb, int *io, int ac);
+ void null_iot(int op2, int nac, int mb, int &io, int ac);
+ void lem_eem_iot(int op2, int nac, int mb, int &io, int ac);
+ void sbs_iot(int op2, int nac, int mb, int &io, int ac);
+ void type_20_sbs_iot(int op2, int nac, int mb, int &io, int ac);
protected:
// device-level overrides
@@ -167,11 +160,9 @@ private:
int m_no_sequence_break; /* disable sequence break recognition for one cycle */
/* callbacks for iot instructions (required for any I/O) */
- pdp1_extern_iot_func m_extern_iot[64];
- /* read a word from the perforated tape reader (required for read-in mode) */
- pdp1_read_binary_word_func m_read_binary_word;
+ iot_delegate::array<64> m_extern_iot;
/* callback called when sc is pulsed: IO devices should reset */
- pdp1_io_sc_func m_io_sc_callback;
+ io_sc_delegate m_io_sc_callback;
/* 0: no extend support, 1: extend with 15-bit address, 2: extend with 16-bit address */
int m_extend_support;
diff --git a/src/devices/cpu/pdp1/pdp1dasm.cpp b/src/devices/cpu/pdp1/pdp1dasm.cpp
index 9b04c91ec87..0c3286a9257 100644
--- a/src/devices/cpu/pdp1/pdp1dasm.cpp
+++ b/src/devices/cpu/pdp1/pdp1dasm.cpp
@@ -19,7 +19,7 @@ inline void pdp1_disassembler::ea()
u32 pdp1_disassembler::opcode_alignment() const
{
- return 4;
+ return 1;
}
offs_t pdp1_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params)
@@ -290,5 +290,5 @@ offs_t pdp1_disassembler::disassemble(std::ostream &stream, offs_t pc, const dat
//etime = 5;
break;
}
- return 4;
+ return 1;
}
diff --git a/src/devices/cpu/pdp1/tx0.cpp b/src/devices/cpu/pdp1/tx0.cpp
index 99636fcb9c2..19ec75f223b 100644
--- a/src/devices/cpu/pdp1/tx0.cpp
+++ b/src/devices/cpu/pdp1/tx0.cpp
@@ -19,8 +19,8 @@
#define LOG_EXTRA 0
-#define READ_TX0_18BIT(A) ((signed)m_program->read_dword((A)<<2))
-#define WRITE_TX0_18BIT(A,V) (m_program->write_dword((A)<<2,(V)))
+#define READ_TX0_18BIT(A) ((signed)m_program->read_dword(A))
+#define WRITE_TX0_18BIT(A,V) (m_program->write_dword((A),(V)))
#define io_handler_rim 3
diff --git a/src/devices/cpu/pdp8/pdp8.cpp b/src/devices/cpu/pdp8/pdp8.cpp
index 3084c1bb29d..e8090c8dfde 100644
--- a/src/devices/cpu/pdp8/pdp8.cpp
+++ b/src/devices/cpu/pdp8/pdp8.cpp
@@ -51,7 +51,7 @@ DEFINE_DEVICE_TYPE(PDP8, pdp8_device, "pdp8_cpu", "DEC PDP8")
pdp8_device::pdp8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: cpu_device(mconfig, PDP8, tag, owner, clock),
- m_program_config("program", ENDIANNESS_BIG, 12, 12),
+ m_program_config("program", ENDIANNESS_BIG, 12, 12, -1),
m_pc(0),
m_ac(0),
m_mb(0),
diff --git a/src/devices/cpu/pdp8/pdp8dasm.cpp b/src/devices/cpu/pdp8/pdp8dasm.cpp
index 389cf11fda7..8c2e57573b5 100644
--- a/src/devices/cpu/pdp8/pdp8dasm.cpp
+++ b/src/devices/cpu/pdp8/pdp8dasm.cpp
@@ -11,7 +11,7 @@
u32 pdp8_disassembler::opcode_alignment() const
{
- return 2;
+ return 1;
}
offs_t pdp8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params)
@@ -164,5 +164,5 @@ offs_t pdp8_disassembler::disassemble(std::ostream &stream, offs_t pc, const dat
}
}
- return 2 | SUPPORTED;
+ return 1 | SUPPORTED | (opcode == 4 ? STEP_OVER : 0);
}
diff --git a/src/devices/cpu/tms57002/tms57002.cpp b/src/devices/cpu/tms57002/tms57002.cpp
index 8464a10e2f0..c2cf28f3f92 100644
--- a/src/devices/cpu/tms57002/tms57002.cpp
+++ b/src/devices/cpu/tms57002/tms57002.cpp
@@ -918,28 +918,22 @@ void tms57002_device::execute_run()
icount = 0;
}
-void tms57002_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void tms57002_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- assert(samples == 1);
+ assert(inputs[0].samples() == 1);
+ assert(outputs[0].samples() == 1);
- if (st0 & ST0_SIM)
- {
- si[0] = (inputs[0][0] << 8) & 0xffffff;
- si[1] = (inputs[1][0] << 8) & 0xffffff;
- si[2] = (inputs[2][0] << 8) & 0xffffff;
- si[3] = (inputs[3][0] << 8) & 0xffffff;
- }
- else
- {
- si[0] = inputs[0][0] & 0xffffff;
- si[1] = inputs[1][0] & 0xffffff;
- si[2] = inputs[2][0] & 0xffffff;
- si[3] = inputs[3][0] & 0xffffff;
- }
- outputs[0][0] = int16_t(so[0] >> 8);
- outputs[1][0] = int16_t(so[1] >> 8);
- outputs[2][0] = int16_t(so[2] >> 8);
- outputs[3][0] = int16_t(so[3] >> 8);
+ stream_buffer::sample_t in_scale = 32768.0 * ((st0 & ST0_SIM) ? 256.0 : 1.0);
+ si[0] = s32(inputs[0].get(0) * in_scale) & 0xffffff;
+ si[1] = s32(inputs[1].get(0) * in_scale) & 0xffffff;
+ si[2] = s32(inputs[2].get(0) * in_scale) & 0xffffff;
+ si[3] = s32(inputs[3].get(0) * in_scale) & 0xffffff;
+
+ stream_buffer::sample_t out_scale = 1.0 / (32768.0 * 65536.0);
+ outputs[0].put(0, stream_buffer::sample_t(s32(so[0] << 8)) * out_scale);
+ outputs[1].put(0, stream_buffer::sample_t(s32(so[1] << 8)) * out_scale);
+ outputs[2].put(0, stream_buffer::sample_t(s32(so[2] << 8)) * out_scale);
+ outputs[3].put(0, stream_buffer::sample_t(s32(so[3] << 8)) * out_scale);
sync_w(1);
}
@@ -981,8 +975,7 @@ void tms57002_device::device_start()
state_add(TMS57002_HOST3, "HOST3", host[3]);
set_icountptr(icount);
-
- stream_alloc(4, 4, STREAM_SYNC);
+ stream_alloc(4, 4, SAMPLE_RATE_INPUT_ADAPTIVE, STREAM_SYNCHRONOUS);
save_item(NAME(macc));
save_item(NAME(macc_read));
diff --git a/src/devices/cpu/tms57002/tms57002.h b/src/devices/cpu/tms57002/tms57002.h
index b1a96823b06..12bcd732120 100644
--- a/src/devices/cpu/tms57002/tms57002.h
+++ b/src/devices/cpu/tms57002/tms57002.h
@@ -36,7 +36,7 @@ protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
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 sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
virtual space_config_vector memory_space_config() const override;
virtual u32 execute_min_cycles() const noexcept override;
virtual u32 execute_max_cycles() const noexcept override;
diff --git a/src/devices/cpu/z80/kc82.cpp b/src/devices/cpu/z80/kc82.cpp
index dbea8fc70f5..bf0a26290c4 100644
--- a/src/devices/cpu/z80/kc82.cpp
+++ b/src/devices/cpu/z80/kc82.cpp
@@ -64,13 +64,11 @@ void kc82_device::device_start()
for (int n = 1; n <= 4; n++)
{
- state_add<u8>(KC82_B1 + n - 1, string_format("B%d", n).c_str(),
- [this, n]() { return m_mmu_b[n]; },
+ state_add(KC82_B1 + n - 1, string_format("B%d", n).c_str(), m_mmu_b[n],
[this, n](u8 data) { m_mmu_b[n] = data; mmu_remap_pages(); }
).mask(0x3f);
if (n != 4)
- state_add<u16>(KC82_A1 + n - 1, string_format("A%d", n).c_str(),
- [this, n]() { return m_mmu_a[n]; },
+ state_add(KC82_A1 + n - 1, string_format("A%d", n).c_str(), m_mmu_a[n],
[this, n](u16 data) { m_mmu_a[n] = data; mmu_remap_pages(); }
).mask(0x3ff);
}
diff --git a/src/devices/cpu/z80/kl5c80a12.cpp b/src/devices/cpu/z80/kl5c80a12.cpp
index dd7bd6060a6..7f79c37dec9 100644
--- a/src/devices/cpu/z80/kl5c80a12.cpp
+++ b/src/devices/cpu/z80/kl5c80a12.cpp
@@ -12,7 +12,7 @@
Important functional blocks:
— MMU
— USART (KP51) (unemulated)
- — 16-bit timer/counters (KP64, KP63) (unemulated)
+ — 16-bit timer/counters (KP64, KP63) (KP64 unemulated)
— 16-level interrupt controller (KP69)
— Parallel ports (KP65, KP66) (unemulated)
— 512-byte high-speed RAM
@@ -22,6 +22,7 @@
#include "emu.h"
#include "kl5c80a12.h"
+#include "kp63.h"
// device type definition
DEFINE_DEVICE_TYPE(KL5C80A12, kl5c80a12_device, "kl5c80a12", "Kawasaki Steel KL5C80A12")
@@ -59,6 +60,7 @@ void kl5c80a12_device::internal_ram(address_map &map)
void kl5c80a12_device::internal_io(address_map &map)
{
map(0x00, 0x07).mirror(0xff00).rw(FUNC(kl5c80a12_device::mmu_r), FUNC(kl5c80a12_device::mmu_w));
+ map(0x20, 0x25).mirror(0xff00).rw("timerb", FUNC(kp63_3channel_device::read), FUNC(kp63_3channel_device::write));
map(0x34, 0x34).mirror(0xff00).rw(m_kp69, FUNC(kp69_device::isrl_r), FUNC(kp69_device::lerl_pgrl_w));
map(0x35, 0x35).mirror(0xff00).rw(m_kp69, FUNC(kp69_device::isrh_r), FUNC(kp69_device::lerh_pgrh_w));
map(0x36, 0x36).mirror(0xff00).rw(m_kp69, FUNC(kp69_device::imrl_r), FUNC(kp69_device::imrl_w));
@@ -97,6 +99,11 @@ void kl5c80a12_device::device_add_mconfig(machine_config &config)
{
KP69(config, m_kp69);
m_kp69->int_callback().set_inputline(*this, INPUT_LINE_IRQ0);
+
+ kp63_3channel_device &timerb(KP63_3CHANNEL(config, "timerb", DERIVED_CLOCK(1, 2)));
+ timerb.outs_callback<0>().set(m_kp69, FUNC(kp69_device::ir_w<13>));
+ timerb.outs_callback<1>().set(m_kp69, FUNC(kp69_device::ir_w<14>));
+ timerb.outs_callback<2>().set(m_kp69, FUNC(kp69_device::ir_w<15>));
}
diff --git a/src/devices/cpu/z80/kl5c80a16.cpp b/src/devices/cpu/z80/kl5c80a16.cpp
index 6328a7322f4..8fa31925366 100644
--- a/src/devices/cpu/z80/kl5c80a16.cpp
+++ b/src/devices/cpu/z80/kl5c80a16.cpp
@@ -9,7 +9,7 @@
— DMA controller (KP27) (unemulated)
— UART (KP61) (unemulated)
— Synchronous serial port (KP62) (unemulated)
- — 16-bit timer/counters (KP63A) (unemulated)
+ — 16-bit timer/counters (KP63A)
— 16-level interrupt controller (KP69)
— Parallel ports (KP67) (unemulated)
— External bus/DRAM interface unit (unemulated)
@@ -18,6 +18,7 @@
#include "emu.h"
#include "kl5c80a16.h"
+#include "kp63.h"
// device type definition
DEFINE_DEVICE_TYPE(KL5C80A16, kl5c80a16_device, "kl5c80a16", "Kawasaki Steel KL5C80A16")
@@ -45,6 +46,7 @@ kl5c80a16_device::kl5c80a16_device(const machine_config &mconfig, const char *ta
void kl5c80a16_device::internal_io(address_map &map)
{
map(0x00, 0x07).mirror(0xff00).rw(FUNC(kl5c80a16_device::mmu_r), FUNC(kl5c80a16_device::mmu_w));
+ map(0x20, 0x27).mirror(0xff00).rw("timer", FUNC(kp63a_device::read), FUNC(kp63a_device::write));
map(0x34, 0x34).mirror(0xff00).rw(m_kp69, FUNC(kp69_device::isrl_r), FUNC(kp69_device::lerl_pgrl_w));
map(0x35, 0x35).mirror(0xff00).rw(m_kp69, FUNC(kp69_device::isrh_r), FUNC(kp69_device::lerh_pgrh_w));
map(0x36, 0x36).mirror(0xff00).rw(m_kp69, FUNC(kp69_device::imrl_r), FUNC(kp69_device::imrl_w));
@@ -83,6 +85,12 @@ void kl5c80a16_device::device_add_mconfig(machine_config &config)
{
KP69(config, m_kp69);
m_kp69->int_callback().set_inputline(*this, INPUT_LINE_IRQ0);
+
+ kp63a_device &timer(KP63A(config, "timer", DERIVED_CLOCK(1, 2)));
+ timer.outs_callback<0>().set(m_kp69, FUNC(kp69_device::ir_w<12>));
+ timer.outs_callback<1>().set(m_kp69, FUNC(kp69_device::ir_w<13>));
+ //timer.outs_callback<2>().set(m_kp69, FUNC(kp69_device::ir_w<0>)); // TODO: multiplexed with P20 input by SCR1 bit 4
+ //timer.outs_callback<3>().set(m_kp69, FUNC(kp69_device::ir_w<1>)); // TODO: multiplexed with P21 input by SCR1 bit 5 (may also be NMI)
}
diff --git a/src/devices/cpu/z80/kp63.cpp b/src/devices/cpu/z80/kp63.cpp
new file mode 100644
index 00000000000..a1a9e5913c8
--- /dev/null
+++ b/src/devices/cpu/z80/kp63.cpp
@@ -0,0 +1,477 @@
+// license:BSD-3-Clause
+// copyright-holders:AJR
+/***************************************************************************
+
+ Kawasaki Steel (Kawatetsu) KP63(A) Timer/Counter
+
+ These macro cells provide 4 independent 16-bit down counters (reduced
+ to 3 in some versions) driven by an 8-bit prescaler attached to the
+ system clock. This prescaler is not fully emulated here, since its
+ operations are mostly transparent, though a divide-by-4 clock output
+ (SYNC) may be selected to appear on a port pin.
+
+ Each counter has a single and optional external input (GATEn), which
+ on the KP63 can only be used to gate a divide-by-4 count but can also
+ be configured as an input clock on the KP63A.
+
+ Two outputs are generated for each counter. The pulse or toggle output
+ (OUTPn) has configurable polarity and can be used for 8-bit PWM. The
+ strobe output (OUTSn) goes active high for 4 clock cycles when the
+ counter underflows and is connected to the interrupt controller.
+
+ Writing the initial count register (CR) and reading the current count
+ are two-step processes, effective at the second write or first read.
+ These must not be overlapped with each other since they share a
+ temporary register.
+
+***************************************************************************/
+
+#include "emu.h"
+#include "kp63.h"
+
+#define VERBOSE 1
+#include "logmacro.h"
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+// device type definitions
+DEFINE_DEVICE_TYPE(KP63_3CHANNEL, kp63_3channel_device, "kp63_3channel", "Kawasaki Steel KP63 Timer/Counter (3 channels)")
+DEFINE_DEVICE_TYPE(KP63A, kp63a_device, "kp63a", "Kawasaki Steel KP63A Timer/Counter")
+
+const char *const kp63_device::s_count_modes[4] =
+{
+ "one-shot",
+ "continuous count",
+ "WDT",
+ "PWM"
+};
+
+
+//**************************************************************************
+// KP63 DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// kp63_device - constructor
+//-------------------------------------------------
+
+kp63_device::kp63_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 num_counters, u8 mode_mask)
+ : device_t(mconfig, type, tag, owner, clock)
+ , m_out_pulse_callback(*this)
+ , m_out_strobe_callback(*this)
+ , c_num_counters(num_counters)
+ , c_mode_mask(mode_mask)
+ , m_timer{0}
+ , m_strobe_timer{0}
+ , m_pwm_timer{0}
+ , m_cr{0}
+ , m_last_count{0}
+ , m_count_tmp{0}
+ , m_status{0}
+ , m_rw_seq(0)
+ , m_timer_started(0)
+ , m_gate_input(0xf)
+{
+}
+
+
+//-------------------------------------------------
+// kp63_3channel_device - constructor
+//-------------------------------------------------
+
+kp63_3channel_device::kp63_3channel_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : kp63_device(mconfig, KP63_3CHANNEL, tag, owner, clock, 3, 0x1f)
+{
+}
+
+
+//-------------------------------------------------
+// kp63a_device - constructor
+//-------------------------------------------------
+
+kp63a_device::kp63a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : kp63_device(mconfig, KP63A, tag, owner, clock, 4, 0x3f)
+{
+}
+
+
+//-------------------------------------------------
+// device_resolve_objects - resolve objects that
+// may be needed for other devices to set
+// initial conditions at start time
+//-------------------------------------------------
+
+void kp63_device::device_resolve_objects()
+{
+ // Resolve output callbacks
+ m_out_pulse_callback.resolve_all_safe();
+ m_out_strobe_callback.resolve_all_safe();
+}
+
+
+//-------------------------------------------------
+// timer_expired - handle timed count underflow
+//-------------------------------------------------
+
+template <int N>
+TIMER_CALLBACK_MEMBER(kp63_device::timer_expired)
+{
+ timer_pulse(N);
+}
+
+
+//-------------------------------------------------
+// strobe_off - handle end of strobe output
+//-------------------------------------------------
+
+template <int N>
+TIMER_CALLBACK_MEMBER(kp63_device::strobe_off)
+{
+ m_out_strobe_callback[N](0);
+}
+
+
+//-------------------------------------------------
+// pwm_off - handle PWM phase change
+//-------------------------------------------------
+
+template <int N>
+TIMER_CALLBACK_MEMBER(kp63_device::pwm_off)
+{
+ m_status[N] &= 0x7f;
+ m_out_pulse_callback[N](BIT(m_status[N], 4) ? 1 : 0);
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void kp63_device::device_start()
+{
+ // Setup timers
+ m_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::timer_expired<0>), this));
+ m_strobe_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::strobe_off<0>), this));
+ m_pwm_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::pwm_off<0>), this));
+ m_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::timer_expired<1>), this));
+ m_strobe_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::strobe_off<1>), this));
+ m_pwm_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::pwm_off<1>), this));
+ m_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::timer_expired<2>), this));
+ m_strobe_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::strobe_off<2>), this));
+ m_pwm_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::pwm_off<2>), this));
+ if (c_num_counters > 3)
+ {
+ m_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::timer_expired<3>), this));
+ m_strobe_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::strobe_off<3>), this));
+ m_pwm_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::pwm_off<3>), this));
+ }
+
+ // Save state
+ save_item(NAME(m_cr));
+ save_item(NAME(m_last_count));
+ save_item(NAME(m_count_tmp));
+ save_item(NAME(m_status));
+ save_item(NAME(m_rw_seq));
+ save_item(NAME(m_timer_started));
+ save_item(NAME(m_gate_input));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void kp63_device::device_reset()
+{
+ for (unsigned n = 0; n < c_num_counters; n++)
+ {
+ // Turn off timers
+ m_timer[n]->adjust(attotime::never);
+ m_strobe_timer[n]->adjust(attotime::never);
+ m_pwm_timer[n]->adjust(attotime::never);
+
+ // Reset status and count
+ m_status[n] = 0;
+ m_cr[n] = 0xffff;
+ m_last_count[n] = 0xffff;
+
+ // Clear outputs
+ m_out_pulse_callback[n](0);
+ m_out_strobe_callback[n](0);
+ }
+
+ // Clear read/write sequence for all counters
+ m_rw_seq = 0;
+ m_timer_started = 0;
+}
+
+
+//-------------------------------------------------
+// timer_pulse - change outputs and stop or
+// reload timer as count underflows
+//-------------------------------------------------
+
+void kp63_device::timer_pulse(unsigned n)
+{
+ // Toggle pulse output
+ m_status[n] ^= 0x80;
+ m_out_pulse_callback[n](BIT(m_status[n], 7) != BIT(m_status[n], 4) ? 1 : 0);
+
+ // Begin strobe output
+ m_out_strobe_callback[n](1);
+ m_strobe_timer[n]->adjust(clocks_to_attotime(4));
+
+ // Reload timer in continuous count and PWM modes
+ if (BIT(m_status[n], 2))
+ timer_reload(n);
+ else
+ {
+ // Stop count at FFFF in one-shot and WDT modes
+ m_last_count[n] = 0xffff;
+ m_timer_started &= ~(1 << n);
+ }
+}
+
+
+//-------------------------------------------------
+// timer_reload - reload timer from CR
+//-------------------------------------------------
+
+void kp63_device::timer_reload(unsigned n)
+{
+ m_timer_started |= 1 << n;
+
+ if (BIT(m_status[n], 5) || ((m_status[n] & 0x03) == 0x03 && !BIT(m_gate_input, n)))
+ m_last_count[n] = m_cr[n];
+ else
+ {
+ unsigned prescale = BIT(m_status[n], 1) ? 4 : BIT(m_status[n], 0) ? 16 : 256;
+ if ((m_status[n] & 0x0c) == 0x0c)
+ {
+ // PWM
+ m_timer[n]->adjust(clocks_to_attotime(prescale * ((m_cr[n] & 0x00ff) + 1)));
+ m_pwm_timer[n]->adjust(clocks_to_attotime(prescale * ((m_cr[n] >> 8) + 1)));
+ }
+ else
+ m_timer[n]->adjust(clocks_to_attotime(prescale * (u32(m_cr[n]) + 1)));
+ }
+}
+
+
+//-------------------------------------------------
+// timer_resume_count - start counting again
+//-------------------------------------------------
+
+void kp63_device::timer_resume_count(unsigned n)
+{
+ if (!BIT(m_status[n], 5) || ((m_status[n] & 0x03) != 0x03 || BIT(m_gate_input, n)))
+ {
+ unsigned prescale = BIT(m_status[n], 1) ? 4 : BIT(m_status[n], 0) ? 16 : 256;
+ if ((m_status[n] & 0x0c) == 0x0c)
+ {
+ // PWM
+ m_timer[n]->adjust(clocks_to_attotime(prescale * ((m_last_count[n] & 0x00ff) + 1)));
+ m_pwm_timer[n]->adjust(clocks_to_attotime(prescale * ((m_last_count[n] >> 8) + 1)));
+ }
+ else
+ m_timer[n]->adjust(clocks_to_attotime(prescale * (u32(m_last_count[n]) + 1)));
+ }
+}
+
+
+//-------------------------------------------------
+// timer_get_count - obtain the instant count in
+// case of a readout or pause
+//-------------------------------------------------
+
+u16 kp63_device::timer_get_count(unsigned n) const
+{
+ if (!BIT(m_timer_started, n) || BIT(m_status[n], 5) || ((m_status[n] & 0x03) == 0x03 && !BIT(m_gate_input, n)))
+ return m_last_count[n];
+ else
+ {
+ unsigned prescale = BIT(m_status[n], 1) ? 4 : BIT(m_status[n], 0) ? 16 : 256;
+ if ((m_status[n] & 0x0c) == 0x0c)
+ {
+ // PWM
+ u8 ticks = attotime_to_clocks(m_timer[n]->remaining()) / prescale;
+ return ticks | ((m_cr[n] - (u16(ticks) << 8)) & 0xff00);
+ }
+ else
+ return attotime_to_clocks(m_timer[n]->remaining()) / prescale;
+ }
+}
+
+
+//-------------------------------------------------
+// read - read count or status register
+//-------------------------------------------------
+
+u8 kp63_device::read(offs_t offset)
+{
+ const unsigned n = offset >> 1;
+ assert(n < c_num_counters);
+
+ if (BIT(offset, 0))
+ {
+ // Status read clears read/write sequence
+ if (!machine().side_effects_disabled())
+ m_rw_seq &= ~(1 << n);
+ return m_status[n];
+ }
+ else if (BIT(m_rw_seq, n))
+ {
+ // Second step of counter readout
+ if (!machine().side_effects_disabled())
+ m_rw_seq &= ~(1 << n);
+ return m_count_tmp[n];
+ }
+ else
+ {
+ // First step of counter readout
+ u16 count = timer_get_count(n);
+ if (!machine().side_effects_disabled())
+ {
+ // Latch high byte into TMP register
+ m_rw_seq |= 1 << n;
+ m_count_tmp[n] = count >> 8;
+ }
+ return count & 0x00ff;
+ }
+}
+
+//-------------------------------------------------
+// write - set CR or mode register
+//-------------------------------------------------
+
+void kp63_device::write(offs_t offset, u8 data)
+{
+ const unsigned n = offset >> 1;
+ assert(n < c_num_counters);
+
+ if (BIT(offset, 0))
+ {
+ bool old_outp = BIT(m_status[n], 7) != BIT(m_status[n], 4);
+
+ // Stop count before setting mode
+ if (BIT(m_timer_started, n))
+ {
+ if (!BIT(m_status[n], 5) || ((m_status[n] & 0x03) != 0x03 || BIT(m_gate_input, n)))
+ {
+ m_last_count[n] = timer_get_count(n);
+ m_timer[n]->adjust(attotime::never);
+ m_pwm_timer[n]->adjust(attotime::never);
+ }
+ m_timer_started &= ~(1 << n);
+ }
+
+ if (BIT(data & c_mode_mask, 5))
+ LOG("%s: Timer #%d configured for %s mode, %s edges of GATE, initial output %c\n",
+ machine().describe_context(),
+ n,
+ s_count_modes[BIT(data, 2, 2)],
+ BIT(data, 1) ? "???" : BIT(data, 0) ? "falling" : "rising",
+ BIT(data, 4) ? 'H' : 'L');
+ else
+ LOG("%s: Timer #%d configured for %s mode, 1/%d system clock (GATE %s), initial output %c\n",
+ machine().describe_context(),
+ n,
+ s_count_modes[BIT(data, 2, 2)],
+ BIT(data, 1) ? 4 : BIT(data, 0) ? 16 : 256,
+ (data & 0x03) == 0x03 ? "effective" : "ignored",
+ BIT(data, 4) ? 'H' : 'L');
+ m_status[n] = data & c_mode_mask;
+
+ // Update OUTP
+ if (old_outp != BIT(data, 4))
+ m_out_pulse_callback[n](BIT(data, 4) ? 1 : 0);
+ }
+ else if ((m_status[n] & 0x0c) == 0x08)
+ {
+ // WDT retrigger (data ignored; initial count must be written using a different mode)
+ timer_reload(n);
+ }
+ else if (BIT(m_rw_seq, n))
+ {
+ // Second step of initial count write
+ m_rw_seq &= ~(1 << n);
+ m_cr[n] = u16(data) << 8 | m_count_tmp[n];
+
+ LOG("%s: Timer #%d initial count = %d\n", machine().describe_context(), n, (m_status[n] == 0x0c) ? m_cr[n] & 0x00ff : m_cr[n]);
+
+ // Automatic retrigger in one-shot and continuous modes
+ if (!BIT(m_status[n], 3) || !BIT(m_timer_started, n))
+ {
+ if (!BIT(m_status[n], 7))
+ {
+ // Toggle OUTP
+ m_status[n] |= 0x80;
+ m_out_pulse_callback[n](BIT(m_status[n], 4) ? 0 : 1);
+ }
+ timer_reload(n);
+ }
+ }
+ else
+ {
+ // First step of initial count write (held in TMP register)
+ m_rw_seq |= 1 << n;
+ m_count_tmp[n] = data;
+ }
+}
+
+//-------------------------------------------------
+// write_gate - handle gate inputs
+//-------------------------------------------------
+
+void kp63_device::write_gate(unsigned n, bool state)
+{
+ assert(n < c_num_counters);
+
+ if (BIT(m_gate_input, n) != state)
+ return;
+
+ if (state)
+ m_gate_input |= 1 << n;
+ else
+ m_gate_input &= ~(1 << n);
+
+ if (BIT(m_timer_started, n))
+ {
+ if ((m_status[n] & 0x23) == 0x03)
+ {
+ // Timer gated on or off
+ if (state)
+ timer_resume_count(n);
+ else
+ {
+ m_last_count[n] = timer_get_count(n);
+ m_timer[n]->adjust(attotime::never);
+ }
+ }
+ else if ((m_status[n] & 0x23) == (state ? 0x21 : 0x20))
+ {
+ // Count edges of gate input
+ if ((m_status[n] & 0x0c) == 0x0c)
+ {
+ // PWM: count is in lower 8 bits
+ if ((m_last_count[n] & 0x00ff) == 0)
+ timer_pulse(n);
+ else
+ {
+ // Decrement both halves and check for underflow in upper half
+ m_last_count[n] -= 0x0101;
+ if (m_last_count[n] >= 0xff00)
+ {
+ m_status[n] &= 0x7f;
+ m_out_pulse_callback[n](BIT(m_status[n], 4) ? 1 : 0);
+ }
+ }
+ }
+ else if (m_last_count[n]-- == 0)
+ timer_pulse(n);
+ }
+ }
+}
diff --git a/src/devices/cpu/z80/kp63.h b/src/devices/cpu/z80/kp63.h
new file mode 100644
index 00000000000..73e269fb72b
--- /dev/null
+++ b/src/devices/cpu/z80/kp63.h
@@ -0,0 +1,98 @@
+// license:BSD-3-Clause
+// copyright-holders:AJR
+/***************************************************************************
+
+ Kawasaki Steel (Kawatetsu) KP63(A) Timer/Counter
+
+***************************************************************************/
+
+#ifndef MAME_CPU_Z80_KP63_H
+#define MAME_CPU_Z80_KP63_H
+
+#pragma once
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+class kp63_device : public device_t
+{
+public:
+ // callback configuration
+ template <int N> auto outp_callback() { return m_out_pulse_callback[N].bind(); }
+ template <int N> auto outs_callback() { return m_out_strobe_callback[N].bind(); }
+
+ // register interface
+ u8 read(offs_t offset);
+ void write(offs_t offset, u8 data);
+
+ // input line interface
+ template <int N> DECLARE_WRITE_LINE_MEMBER(gate_w) { write_gate(N, state); }
+
+protected:
+ // construction/destruction
+ kp63_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 num_counters, u8 mode_mask);
+
+ // device-level overrides
+ virtual void device_resolve_objects() override;
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+private:
+ static const char *const s_count_modes[4];
+
+ // timer callbacks
+ template <int N> TIMER_CALLBACK_MEMBER(timer_expired);
+ template <int N> TIMER_CALLBACK_MEMBER(strobe_off);
+ template <int N> TIMER_CALLBACK_MEMBER(pwm_off);
+
+ // internal helpers
+ void timer_pulse(unsigned n);
+ void timer_reload(unsigned n);
+ void timer_resume_count(unsigned n);
+ u16 timer_get_count(unsigned n) const;
+ void write_gate(unsigned n, bool state);
+
+ // callback objects
+ devcb_write_line::array<4> m_out_pulse_callback;
+ devcb_write_line::array<4> m_out_strobe_callback;
+
+ // constant parameters
+ const u8 c_num_counters;
+ const u8 c_mode_mask;
+
+ // internal timers
+ emu_timer *m_timer[4];
+ emu_timer *m_strobe_timer[4];
+ emu_timer *m_pwm_timer[4];
+
+ // internal state
+ u16 m_cr[4];
+ u16 m_last_count[4];
+ u8 m_count_tmp[4];
+ u8 m_status[4];
+ u8 m_rw_seq;
+ u8 m_timer_started;
+ u8 m_gate_input;
+};
+
+class kp63_3channel_device : public kp63_device
+{
+public:
+ // device type constructor
+ kp63_3channel_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+};
+
+class kp63a_device : public kp63_device
+{
+public:
+ // device type constructor
+ kp63a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+};
+
+// device type declarations
+DECLARE_DEVICE_TYPE(KP63_3CHANNEL, kp63_3channel_device)
+DECLARE_DEVICE_TYPE(KP63A, kp63a_device)
+
+#endif // MAME_CPU_Z80_KP63_H
diff --git a/src/devices/cpu/z80/kp69.cpp b/src/devices/cpu/z80/kp69.cpp
index dca74ff3b25..84be060c4c7 100644
--- a/src/devices/cpu/z80/kp69.cpp
+++ b/src/devices/cpu/z80/kp69.cpp
@@ -107,12 +107,12 @@ void kp69_device::device_start()
void kp69_base_device::add_to_state(device_state_interface &state, int index)
{
- state.state_add<u16>(index, "IRR", [this]() { return m_irr; }, [this](u16 data) { set_irr(data); });
- state.state_add<u16>(index + 1, "ISR", [this]() { return m_isr; }, [this](u16 data) { set_isr(data); });
+ state.state_add(index, "IRR", m_irr, [this](u16 data) { set_irr(data); });
+ state.state_add(index + 1, "ISR", m_isr, [this](u16 data) { set_isr(data); });
state.state_add(index + 2, "IVR", m_ivr).mask(0xe0);
- state.state_add<u16>(index + 3, "LER", [this]() { return m_ler; }, [this](u16 data) { set_ler(data); });
- state.state_add<u16>(index + 4, "PGR", [this]() { return m_pgr; }, [this](u16 data) { set_pgr(data); });
- state.state_add<u16>(index + 5, "IMR", [this]() { return m_imr; }, [this](u16 data) { set_imr(data); });
+ state.state_add(index + 3, "LER", m_ler, [this](u16 data) { set_ler(data); });
+ state.state_add(index + 4, "PGR", m_pgr, [this](u16 data) { set_pgr(data); });
+ state.state_add(index + 5, "IMR", m_imr, [this](u16 data) { set_imr(data); });
}
diff --git a/src/devices/imagedev/cassette.cpp b/src/devices/imagedev/cassette.cpp
index 473dfe0ce7b..c6e20ba66dd 100644
--- a/src/devices/imagedev/cassette.cpp
+++ b/src/devices/imagedev/cassette.cpp
@@ -236,7 +236,7 @@ void cassette_image_device::device_start()
m_state = m_default_state;
m_value = 0;
- machine().sound().stream_alloc(*this, 0, (m_stereo? 2:1), machine().sample_rate());
+ stream_alloc_legacy(0, (m_stereo? 2:1), machine().sample_rate());
}
image_init_result cassette_image_device::call_create(int format_type, util::option_resolution *format_options)
@@ -404,7 +404,7 @@ std::string cassette_image_device::call_display()
// Cassette sound
//-------------------------------------------------
-void cassette_image_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void cassette_image_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *left_buffer = outputs[0];
stream_sample_t *right_buffer = nullptr;
diff --git a/src/devices/imagedev/cassette.h b/src/devices/imagedev/cassette.h
index 790b2e0d8c3..a661e8312a8 100644
--- a/src/devices/imagedev/cassette.h
+++ b/src/devices/imagedev/cassette.h
@@ -102,7 +102,7 @@ public:
void seek(double time, int origin);
// sound stream update overrides
- void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
device_sound_interface& set_stereo() { m_stereo = true; return *this; }
protected:
diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp
index f725845fa0d..3dd96644f1a 100644
--- a/src/devices/imagedev/floppy.cpp
+++ b/src/devices/imagedev/floppy.cpp
@@ -1248,7 +1248,7 @@ void floppy_sound_device::device_start()
// If we don't have all samples, don't allocate a stream or access sample data.
if (m_loaded)
{
- m_sound = machine().sound().stream_alloc(*this, 0, 1, clock()); // per-floppy stream
+ m_sound = stream_alloc_legacy(0, 1, clock()); // per-floppy stream
}
register_for_save_states();
}
@@ -1369,10 +1369,10 @@ void floppy_sound_device::step(int zone)
}
//-------------------------------------------------
-// sound_stream_update - update the sound stream
+// sound_stream_update_legacy - update the sound stream
//-------------------------------------------------
-void floppy_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void floppy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// We are using only one stream, unlike the parent class
// Also, there is no need for interpolation, as we only expect
diff --git a/src/devices/imagedev/floppy.h b/src/devices/imagedev/floppy.h
index 4fa16d3c338..d07a12c146c 100644
--- a/src/devices/imagedev/floppy.h
+++ b/src/devices/imagedev/floppy.h
@@ -294,7 +294,7 @@ protected:
private:
// device_sound_interface overrides
- void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
sound_stream* m_sound;
int m_step_base;
diff --git a/src/devices/machine/6522via.cpp b/src/devices/machine/6522via.cpp
index 37c7237db52..06f557c4355 100644
--- a/src/devices/machine/6522via.cpp
+++ b/src/devices/machine/6522via.cpp
@@ -587,17 +587,6 @@ u8 via6522_device::read(offs_t offset)
{
LOGINT("PB INT ");
CLR_PB_INT();
-
- if (m_out_cb2 && (CB2_PULSE_OUTPUT(m_pcr) || CB2_AUTO_HS(m_pcr)))
- {
- m_out_cb2 = 0;
- m_cb2_handler(m_out_cb2);
- }
-
- if (CB2_PULSE_OUTPUT(m_pcr))
- {
- m_cb2_timer->adjust(clocks_to_attotime(1));
- }
}
break;
diff --git a/src/devices/machine/8364_paula.cpp b/src/devices/machine/8364_paula.cpp
index a340b5a523c..1e10ca55b3e 100644
--- a/src/devices/machine/8364_paula.cpp
+++ b/src/devices/machine/8364_paula.cpp
@@ -58,7 +58,7 @@ void paula_8364_device::device_start()
}
// create the stream
- m_stream = machine().sound().stream_alloc(*this, 0, 4, clock() / CLOCK_DIVIDER);
+ m_stream = stream_alloc_legacy(0, 4, clock() / CLOCK_DIVIDER);
}
//-------------------------------------------------
@@ -159,10 +159,10 @@ void paula_8364_device::dma_reload(audio_channel *chan)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void paula_8364_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void paula_8364_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int channum, sampoffs = 0;
diff --git a/src/devices/machine/8364_paula.h b/src/devices/machine/8364_paula.h
index 0a7016c4496..a2ac2feab26 100644
--- a/src/devices/machine/8364_paula.h
+++ b/src/devices/machine/8364_paula.h
@@ -68,7 +68,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
enum
diff --git a/src/devices/machine/acorn_vidc.cpp b/src/devices/machine/acorn_vidc.cpp
index 65487e2b63a..36733555e7d 100644
--- a/src/devices/machine/acorn_vidc.cpp
+++ b/src/devices/machine/acorn_vidc.cpp
@@ -416,7 +416,7 @@ inline void acorn_vidc10_device::refresh_stereo_image(u8 channel)
m_lspeaker->set_input_gain(channel,left_gain[m_stereo_image[channel]]*m_sound_input_gain);
m_rspeaker->set_input_gain(channel,right_gain[m_stereo_image[channel]]*m_sound_input_gain);
- //printf("%d %f %f\n",channel,m_lspeaker->input_gain(channel),m_rspeaker->input_gain(channel));
+ //printf("%d %f %f\n",channel,m_lspeaker->input(channel).gain(),m_rspeaker->input(channel).gain());
}
diff --git a/src/devices/machine/alpha_8921.cpp b/src/devices/machine/alpha_8921.cpp
new file mode 100644
index 00000000000..bf57902b31e
--- /dev/null
+++ b/src/devices/machine/alpha_8921.cpp
@@ -0,0 +1,212 @@
+// license:BSD-3-Clause
+// copyright-holders:cam900
+/***************************************************************************
+
+ Alpha denshi ALPHA-8921 emulation
+
+ Also known as
+ SNK PRO-CT0
+ SNK-9201
+
+ This chip is sprite ROM data serializer, or optional security device.
+ used in some later 80s Alpha Denshi hardware(ex: Gang Wars),
+ Some early Neogeo MVS motherboards, AES cartridges.
+ also integrated in NEO-ZMC2, NEO-CMC.
+
+ reference: https://wiki.neogeodev.org/index.php?title=PRO-CT0
+
+***************************************************************************/
+
+#include "emu.h"
+#include "alpha_8921.h"
+#include <algorithm>
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+// device type definition
+DEFINE_DEVICE_TYPE(ALPHA_8921, alpha_8921_device, "alpha_8921", "Alpha denshi ALPHA-8921")
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// alpha_8921_device - constructor
+//-------------------------------------------------
+
+alpha_8921_device::alpha_8921_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, ALPHA_8921, tag, owner, clock)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void alpha_8921_device::device_start()
+{
+ // save states
+ save_item(NAME(m_clk));
+ save_item(NAME(m_load));
+ save_item(NAME(m_even));
+ save_item(NAME(m_h));
+ save_item(NAME(m_c));
+ save_item(NAME(m_gad));
+ save_item(NAME(m_gbd));
+ save_item(NAME(m_dota));
+ save_item(NAME(m_dotb));
+ save_item(NAME(m_sr));
+ save_item(NAME(m_old_sr));
+ save_item(NAME(m_old_even));
+ save_item(NAME(m_old_h));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void alpha_8921_device::device_reset()
+{
+ // force update outputs
+ m_old_sr = ~m_sr;
+ m_old_even = !m_even;
+ m_old_h = !m_h;
+ update_output();
+}
+
+
+//**************************************************************************
+// READ/WRITE HANDLERS
+//**************************************************************************
+
+//-------------------------------------------------
+// clk_w - Change clock pin status
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER(alpha_8921_device::clk_w)
+{
+ if (m_clk != state)
+ {
+ m_clk = state;
+ if (!m_clk) // falling edge
+ {
+ if (m_load)
+ m_sr = m_c;
+ else if (m_h)
+ m_sr = (BIT(m_sr, 24, 6) << 26) | (BIT(m_sr, 16, 6) << 18) | (BIT(m_sr, 8, 6) << 10) | (BIT(m_sr, 0, 6) << 2);
+ else
+ m_sr = ((BIT(m_sr, 26, 6)) << 24) | ((BIT(m_sr, 18, 6)) << 16) | ((BIT(m_sr, 10, 6)) << 8) | (BIT(m_sr, 2, 6));
+ }
+ }
+}
+
+//-------------------------------------------------
+// load_w - Change LOAD pin status
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER(alpha_8921_device::load_w)
+{
+ m_load = state;
+}
+
+//-------------------------------------------------
+// even_w - Change EVEN pin status
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER(alpha_8921_device::even_w)
+{
+ m_even = state;
+}
+
+//-------------------------------------------------
+// h_w - Change H pin status
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER(alpha_8921_device::h_w)
+{
+ m_h = state;
+}
+
+//-------------------------------------------------
+// c_w - Change C data
+//-------------------------------------------------
+
+void alpha_8921_device::c_w(u32 data)
+{
+ m_c = data;
+}
+
+//-------------------------------------------------
+// update_output - Update output results
+//-------------------------------------------------
+
+void alpha_8921_device::update_output()
+{
+ if ((m_old_sr != m_sr) || (m_old_even != m_even) || (m_old_h != m_h))
+ {
+ if (m_h)
+ {
+ m_gbd = bitswap<4>(m_sr, 30, 22, 14, 6);
+ m_gad = bitswap<4>(m_sr, 31, 23, 15, 7);
+ }
+ else
+ {
+ m_gbd = bitswap<4>(m_sr, 25, 17, 9, 1);
+ m_gad = bitswap<4>(m_sr, 24, 16, 8, 0);
+ }
+ if (m_even)
+ std::swap<u8>(m_gad, m_gbd);
+
+ m_dota = m_gad ? true : false;
+ m_dotb = m_gbd ? true : false;
+ m_old_sr = m_sr;
+ m_old_even = m_even;
+ m_old_h = m_h;
+ }
+}
+
+//-------------------------------------------------
+// gad_r - Read GAD data
+//-------------------------------------------------
+
+u8 alpha_8921_device::gad_r()
+{
+ update_output();
+ return m_gad & 0xf;
+}
+
+//-------------------------------------------------
+// gbd_r - Read GBD data
+//-------------------------------------------------
+
+u8 alpha_8921_device::gbd_r()
+{
+ update_output();
+ return m_gbd & 0xf;
+}
+
+//-------------------------------------------------
+// dota_r - Read DOTA pin data (GAD isn't 0)
+//-------------------------------------------------
+
+READ_LINE_MEMBER(alpha_8921_device::dota_r)
+{
+ update_output();
+ return m_dota;
+}
+
+//-------------------------------------------------
+// dotb_r - Read DOTB pin data (GBD isn't 0)
+//-------------------------------------------------
+
+READ_LINE_MEMBER(alpha_8921_device::dotb_r)
+{
+ update_output();
+ return m_dotb;
+}
diff --git a/src/devices/machine/alpha_8921.h b/src/devices/machine/alpha_8921.h
new file mode 100644
index 00000000000..88ecd850eb9
--- /dev/null
+++ b/src/devices/machine/alpha_8921.h
@@ -0,0 +1,67 @@
+// license:BSD-3-Clause
+// copyright-holders:cam900
+/***************************************************************************
+
+ Alpha denshi ALPHA-8921 emulation
+
+***************************************************************************/
+
+#ifndef MAME_MACHINE_ALPHA_8921_H
+#define MAME_MACHINE_ALPHA_8921_H
+
+#pragma once
+
+
+// ======================> alpha_8921_device
+
+class alpha_8921_device : public device_t
+{
+public:
+ // construction/destruction
+ alpha_8921_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ // inputs
+ DECLARE_WRITE_LINE_MEMBER(clk_w);
+ DECLARE_WRITE_LINE_MEMBER(load_w);
+ DECLARE_WRITE_LINE_MEMBER(even_w);
+ DECLARE_WRITE_LINE_MEMBER(h_w);
+ void c_w(u32 data);
+
+ // outputs
+ u8 gad_r();
+ u8 gbd_r();
+ DECLARE_READ_LINE_MEMBER(dota_r);
+ DECLARE_READ_LINE_MEMBER(dotb_r);
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+private:
+ // inputs
+ bool m_clk = false; // CLK pin
+ bool m_load = false; // LOAD pin
+ bool m_even = false; // EVEN pin
+ bool m_h = false; // H pin
+ u32 m_c = 0; // C data (32 bit)
+
+ // outputs
+ u8 m_gad = 0; // GAD data (4 bit)
+ u8 m_gbd = 0; // GBD data (4 bit)
+ bool m_dota = false; // DOTA pin
+ bool m_dotb = false; // DOTB pin
+
+ // internal status
+ u32 m_sr = 0;
+ u32 m_old_sr = ~0;
+ bool m_old_even = true;
+ bool m_old_h = true;
+ void update_output();
+};
+
+
+// device type definition
+DECLARE_DEVICE_TYPE(ALPHA_8921, alpha_8921_device)
+
+#endif // MAME_MACHINE_ALPHA_8921_H
diff --git a/src/devices/machine/generalplus_gpl16250soc.cpp b/src/devices/machine/generalplus_gpl16250soc.cpp
index ac0c99f480e..2548929027c 100644
--- a/src/devices/machine/generalplus_gpl16250soc.cpp
+++ b/src/devices/machine/generalplus_gpl16250soc.cpp
@@ -203,7 +203,7 @@ void sunplus_gcm394_base_device::trigger_systemm_dma(int channel)
// note, these patch the code copied to SRAM so the 'PROGRAM ROM' check fails (it passes otherwise)
- //address_space& mem = this->space(AS_PROGRAM);
+ address_space& mem = this->space(AS_PROGRAM);
//if (mem.read_word(0x4368c) == 0x4846)
// mem.write_word(0x4368c, 0x4840); // cars 2 force service mode
@@ -218,6 +218,13 @@ void sunplus_gcm394_base_device::trigger_systemm_dma(int channel)
//if (mem.read_word(0x4d8d4) == 0x4840)
// mem.write_word(0x4d8d4, 0x4841); // golden tee IRQ? wait hack
+ //if (mem.read_word(0x3510f) == 0x4845)
+ // mem.write_word(0x3510f, 0x4840); // camp rock force service mode
+
+ if (mem.read_word(0x4abe7) == 0x4840)
+ mem.write_word(0x4abe7, 0x4841); // camp rock IRQ? wait hack
+
+
// clear params after operation
m_dma_params[0][channel] = m_dma_params[0][channel] & 0x00f7;
diff --git a/src/devices/machine/laserdsc.cpp b/src/devices/machine/laserdsc.cpp
index 8176ac14f29..ef3df359859 100644
--- a/src/devices/machine/laserdsc.cpp
+++ b/src/devices/machine/laserdsc.cpp
@@ -308,11 +308,11 @@ void laserdisc_device::device_timer(emu_timer &timer, device_timer_id id, int pa
//-------------------------------------------------
-// sound_stream_update - audio streamer for
+// sound_stream_update_legacy - audio streamer for
// laserdiscs
//-------------------------------------------------
-void laserdisc_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void laserdisc_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// compute AND values based on the squelch
int16_t leftand = (m_audiosquelch & 1) ? 0x0000 : 0xffff;
@@ -762,7 +762,7 @@ void laserdisc_device::init_audio()
m_audio_callback.resolve();
// allocate a stream
- m_stream = stream_alloc(0, 2, 48000);
+ m_stream = stream_alloc_legacy(0, 2, 48000);
// allocate audio buffers
m_audiomaxsamples = ((uint64_t)m_samplerate * 1000000 + m_fps_times_1million - 1) / m_fps_times_1million;
diff --git a/src/devices/machine/laserdsc.h b/src/devices/machine/laserdsc.h
index e2877a4a216..8ca3abad222 100644
--- a/src/devices/machine/laserdsc.h
+++ b/src/devices/machine/laserdsc.h
@@ -220,7 +220,7 @@ protected:
virtual void device_validity_check(validity_checker &valid) const override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// subclass helpers
void set_audio_squelch(bool squelchleft, bool squelchright) { m_stream->update(); m_audiosquelch = (squelchleft ? 1 : 0) | (squelchright ? 2 : 0); }
diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp
index 10208d8e357..988c21c33e1 100644
--- a/src/devices/machine/netlist.cpp
+++ b/src/devices/machine/netlist.cpp
@@ -263,7 +263,7 @@ plib::istream_uptr netlist_data_memregions_t::stream(const pstring &name)
// sound_in
// ----------------------------------------------------------------------------------------
-using sound_in_type = netlist::interface::NETLIB_NAME(buffered_param_setter)<stream_sample_t *>;
+using sound_in_type = netlist::interface::NETLIB_NAME(buffered_param_setter)<netlist_mame_sound_input_buffer>;
class NETLIB_NAME(sound_in) : public sound_in_type
{
@@ -820,17 +820,15 @@ void netlist_mame_stream_output_device::device_reset()
#endif
}
-void netlist_mame_stream_output_device::sound_update_fill(std::size_t samples, stream_sample_t *target)
+void netlist_mame_stream_output_device::sound_update_fill(write_stream_view &target)
{
- if (samples < m_buffer.size())
- osd_printf_warning("sound %s: samples %d less bufsize %d\n", name(), samples, m_buffer.size());
+ if (target.samples() < m_buffer.size())
+ osd_printf_warning("sound %s: samples %d less bufsize %d\n", name(), target.samples(), m_buffer.size());
- std::copy(m_buffer.begin(), m_buffer.end(), target);
- std::size_t pos = m_buffer.size();
- while (pos < samples)
- {
- target[pos++] = m_cur;
- }
+ int sampindex;
+ for (sampindex = 0; sampindex < m_buffer.size(); sampindex++)
+ target.put(sampindex, m_buffer[sampindex]);
+ target.fill(m_cur, sampindex);
}
@@ -868,19 +866,10 @@ void netlist_mame_stream_output_device::process(netlist::netlist_time_ext tim, n
// throw emu_fatalerror("sound %s: pos %d exceeded bufsize %d\n", name().c_str(), pos, m_bufsize);
while (m_buffer.size() < pos )
{
- m_buffer.push_back(static_cast<stream_sample_t>(m_cur));
+ m_buffer.push_back(static_cast<stream_buffer::sample_t>(m_cur));
}
- // clamp to avoid spikes, but not too hard, as downstream processing, volume
- // controls, etc may bring values above 32767 back down in range; some clamping
- // is still useful, however, as the mixing is done with integral values
- if (plib::abs(val) < 32767.0*256.0)
- m_cur = val;
- else if (val > 0.0)
- m_cur = 32767.0*256.0;
- else
- m_cur = -32767.0*256.0;
-
+ m_cur = val;
}
@@ -1409,8 +1398,10 @@ void netlist_mame_sound_device::device_start()
if (e.first < 0 || e.first >= m_in.size())
fatalerror("illegal input channel number %d", e.first);
}
+ m_inbuffer.resize(m_in.size());
+
/* initialize the stream(s) */
- m_stream = machine().sound().stream_alloc(*this, m_in.size(), m_out.size(), m_sound_clock);
+ m_stream = stream_alloc(m_in.size(), m_out.size(), m_sound_clock, STREAM_DISABLE_INPUT_RESAMPLING);
LOGDEVCALLS("sound device_start exit\n");
}
@@ -1453,26 +1444,25 @@ void netlist_mame_sound_device::update_to_current_time()
LOGTIMING("%s : %f us before machine time\n", this->name(), (cur - mtime).as_double() * 1000000.0);
}
-void netlist_mame_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void netlist_mame_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- const auto mtime = machine().time();
- if (mtime < m_last_update_to_current_time)
- LOGTIMING("machine.time() decreased 1\n");
- m_last_update_to_current_time = mtime;
- LOGDEBUG("samples %d\n", samples);
-
for (auto &e : m_in)
{
- auto sample_time = netlist::netlist_time::from_raw(static_cast<netlist::netlist_time::internal_type>(nltime_from_attotime(m_attotime_per_clock).as_raw()));
- e.second->buffer_reset(sample_time, samples, &inputs[e.first]);
+ auto clock_period = inputs[e.first].sample_period();
+ auto sample_time = netlist::netlist_time::from_raw(static_cast<netlist::netlist_time::internal_type>(nltime_from_attotime(clock_period).as_raw()));
+ m_inbuffer[e.first] = netlist_mame_sound_input_buffer(inputs[e.first]);
+ e.second->buffer_reset(sample_time, m_inbuffer[e.first].samples(), &m_inbuffer[e.first]);
}
- m_cur_time += (samples * m_attotime_per_clock);
+ int samples = outputs[0].samples();
+ LOGDEBUG("samples %d\n", samples);
- auto nl_target_time = std::min(nltime_from_attotime(mtime), nltime_from_attotime(m_cur_time));
+ // end_time() is the time at the END of the last sample we're generating
+ // however, the sample value is the value at the START of that last sample,
+ // so subtract one sample period so that we only process up to the minimum
+ auto nl_target_time = nltime_from_attotime(outputs[0].end_time() - outputs[0].sample_period());
auto nltime(netlist().exec().time());
-
if (nltime < nl_target_time)
{
netlist().exec().process_queue(nl_target_time - nltime);
@@ -1480,7 +1470,7 @@ void netlist_mame_sound_device::sound_stream_update(sound_stream &stream, stream
for (auto &e : m_out)
{
- e.second->sound_update_fill(samples, outputs[e.first]);
+ e.second->sound_update_fill(outputs[e.first]);
e.second->buffer_reset(nl_target_time);
}
diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h
index b7a78c0bd77..8b9e156adba 100644
--- a/src/devices/machine/netlist.h
+++ b/src/devices/machine/netlist.h
@@ -229,6 +229,22 @@ private:
};
// ----------------------------------------------------------------------------------------
+// netlist_mame_sound_input_buffer
+// ----------------------------------------------------------------------------------------
+
+class netlist_mame_sound_input_buffer : public read_stream_view
+{
+public:
+ netlist_mame_sound_input_buffer() :
+ read_stream_view() { }
+
+ netlist_mame_sound_input_buffer(read_stream_view const &src) :
+ read_stream_view(src) { }
+
+ stream_buffer::sample_t operator[](std::size_t index) { return get(index); }
+};
+
+// ----------------------------------------------------------------------------------------
// netlist_mame_sound_device
// ----------------------------------------------------------------------------------------
@@ -266,13 +282,14 @@ protected:
// device_t overrides
virtual void device_start() override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
virtual void device_validity_check(validity_checker &valid) const override;
//virtual void device_reset() override;
private:
std::map<int, netlist_mame_stream_output_device *> m_out;
std::map<std::size_t, nld_sound_in *> m_in;
+ std::vector<netlist_mame_sound_input_buffer> m_inbuffer;
sound_stream *m_stream;
attotime m_cur_time;
uint32_t m_sound_clock;
@@ -593,7 +610,7 @@ public:
m_buffer.clear();
}
- void sound_update_fill(std::size_t samples, stream_sample_t *target);
+ void sound_update_fill(write_stream_view &target);
void set_sample_time(netlist::netlist_time t) { m_sample_time = t; }
@@ -608,7 +625,7 @@ private:
uint32_t m_channel;
const char * m_out_name;
- std::vector<stream_sample_t> m_buffer;
+ std::vector<stream_buffer::sample_t> m_buffer;
double m_cur;
netlist::netlist_time m_sample_time;
diff --git a/src/devices/machine/s2636.cpp b/src/devices/machine/s2636.cpp
index ddc46adf81c..bdf95dc69d0 100644
--- a/src/devices/machine/s2636.cpp
+++ b/src/devices/machine/s2636.cpp
@@ -203,7 +203,7 @@ void s2636_device::device_start()
save_item(NAME(m_intreq));
save_item(NAME(m_intack));
- m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_stream = stream_alloc_legacy(0, 1, machine().sample_rate());
save_item(NAME(m_sample_cnt));
save_item(NAME(m_sound_lvl));
@@ -447,10 +447,10 @@ void s2636_device::write_intack(int state)
//-------------------------------------------------
-// sound_stream_update - generate audio output
+// sound_stream_update_legacy - generate audio output
//-------------------------------------------------
-void s2636_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void s2636_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
while (samples--)
diff --git a/src/devices/machine/s2636.h b/src/devices/machine/s2636.h
index bc82ed68903..b5e41b83499 100644
--- a/src/devices/machine/s2636.h
+++ b/src/devices/machine/s2636.h
@@ -58,7 +58,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
enum
diff --git a/src/devices/machine/sensorboard.cpp b/src/devices/machine/sensorboard.cpp
index e3e168d6e16..0a5767aef3e 100644
--- a/src/devices/machine/sensorboard.cpp
+++ b/src/devices/machine/sensorboard.cpp
@@ -49,9 +49,10 @@ To prevent the possibility of a piece/sensor having opposite states (iow: piece
selected but sensor deactivated, the button is not clicked when dropping a piece
at the same position it was before.
-Hold CTRL while clicking to activate the piece but ignore the sensor beneath it.
-Hold SHIFT while clicking to activate the sensor but ignore the piece (sidenote:
-it will invert the sensor state for magnet boards).
+Hold CTRL while clicking to activate the piece but ignore the sensor beneath it,
+on magnet boards this only applies during piece capture. Hold SHIFT while clicking
+to activate the sensor but ignore the piece, on magnet boards it will invert the
+sensor state instead.
*/
@@ -261,7 +262,7 @@ u8 sensorboard_device::read_sensor(u8 x, u8 y)
if (m_magnets)
{
u8 piece = read_piece(x, y);
- u8 state = (piece != 0 && pos != m_handpos && pos != m_droppos) ? 1 : 0;
+ u8 state = (piece != 0 && pos != m_handpos && (m_inp_ui->read() & 2 || pos != m_droppos)) ? 1 : 0;
// piece recognition: return piece id
if (m_inductive)
diff --git a/src/devices/machine/spg2xx_audio.cpp b/src/devices/machine/spg2xx_audio.cpp
index f1ffd871f28..07d01e88be5 100644
--- a/src/devices/machine/spg2xx_audio.cpp
+++ b/src/devices/machine/spg2xx_audio.cpp
@@ -76,7 +76,7 @@ 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_stream = stream_alloc_legacy(0, 2, 281250/4);
m_channel_debug = -1;
@@ -887,7 +887,7 @@ void spg2xx_audio_device::audio_w(offs_t offset, uint16_t data)
}
}
-void spg2xx_audio_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void spg2xx_audio_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *out_l = outputs[0];
stream_sample_t *out_r = outputs[1];
diff --git a/src/devices/machine/spg2xx_audio.h b/src/devices/machine/spg2xx_audio.h
index 30b001edfb2..59d7635198d 100644
--- a/src/devices/machine/spg2xx_audio.h
+++ b/src/devices/machine/spg2xx_audio.h
@@ -33,7 +33,7 @@ public:
protected:
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
void audio_beat_tick();
void audio_rampdown_tick(const uint32_t channel);
diff --git a/src/devices/sound/2203intf.cpp b/src/devices/sound/2203intf.cpp
index 9b49479af97..6b579f486a3 100644
--- a/src/devices/sound/2203intf.cpp
+++ b/src/devices/sound/2203intf.cpp
@@ -54,11 +54,11 @@ void ym2203_device::timer_handler(int c, int count, int clock)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void ym2203_device::stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ym2203_device::stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
ym2203_update_one(m_chip, outputs[0], samples);
}
@@ -108,7 +108,7 @@ void ym2203_device::calculate_rates()
if (m_stream != nullptr)
m_stream->set_sample_rate(rate);
else
- m_stream = machine().sound().stream_alloc(*this,0,1,rate, stream_update_delegate(&ym2203_device::stream_generate,this));
+ m_stream = machine().sound().stream_alloc_legacy(*this,0,1,rate, stream_update_legacy_delegate(&ym2203_device::stream_generate,this));
}
//-------------------------------------------------
diff --git a/src/devices/sound/2203intf.h b/src/devices/sound/2203intf.h
index ff4af97c667..ccb5841cd82 100644
--- a/src/devices/sound/2203intf.h
+++ b/src/devices/sound/2203intf.h
@@ -39,7 +39,7 @@ protected:
virtual void device_clock_changed() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- void stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
+ void stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples);
private:
enum
diff --git a/src/devices/sound/2608intf.cpp b/src/devices/sound/2608intf.cpp
index 1bc634d34c2..4ca366fa117 100644
--- a/src/devices/sound/2608intf.cpp
+++ b/src/devices/sound/2608intf.cpp
@@ -63,10 +63,10 @@ void ym2608_device::timer_handler(int c,int count,int clock)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void ym2608_device::stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ym2608_device::stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
ym2608_update_one(m_chip, outputs, samples);
}
@@ -93,7 +93,7 @@ void ym2608_device::device_start()
m_timer[1] = timer_alloc(1);
/* stream system initialize */
- m_stream = machine().sound().stream_alloc(*this,0,2,rate, stream_update_delegate(&ym2608_device::stream_generate,this));
+ m_stream = machine().sound().stream_alloc_legacy(*this,0,2,rate, stream_update_legacy_delegate(&ym2608_device::stream_generate,this));
/* initialize YM2608 */
m_chip = ym2608_init(this,clock(),rate,
diff --git a/src/devices/sound/2608intf.h b/src/devices/sound/2608intf.h
index 97e488805c4..c6a3fec6fc9 100644
--- a/src/devices/sound/2608intf.h
+++ b/src/devices/sound/2608intf.h
@@ -39,7 +39,7 @@ protected:
virtual void rom_bank_updated() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- void stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
+ void stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples);
private:
void irq_handler(int irq);
diff --git a/src/devices/sound/2610intf.cpp b/src/devices/sound/2610intf.cpp
index 03c3fc218a2..2f6e3e08620 100644
--- a/src/devices/sound/2610intf.cpp
+++ b/src/devices/sound/2610intf.cpp
@@ -62,18 +62,18 @@ void ym2610_device::timer_handler(int c,int count,int clock)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void ym2610_device::stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ym2610_device::stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
ym2610_update_one(m_chip, outputs, samples);
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void ym2610b_device::stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ym2610b_device::stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
ym2610b_update_one(m_chip, outputs, samples);
}
@@ -102,7 +102,7 @@ void ym2610_device::device_start()
m_timer[1] = timer_alloc(1);
/* stream system initialize */
- m_stream = machine().sound().stream_alloc(*this,0,2,rate, stream_update_delegate(&ym2610_device::stream_generate,this));
+ m_stream = machine().sound().stream_alloc_legacy(*this,0,2,rate, stream_update_legacy_delegate(&ym2610_device::stream_generate,this));
if (!has_configured_map(0) && !has_configured_map(1))
{
diff --git a/src/devices/sound/2610intf.h b/src/devices/sound/2610intf.h
index 91de98a41a4..a305f9d352d 100644
--- a/src/devices/sound/2610intf.h
+++ b/src/devices/sound/2610intf.h
@@ -40,7 +40,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- virtual void stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
+ virtual void stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples);
void * m_chip;
@@ -75,7 +75,7 @@ public:
ym2610b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
- virtual void stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
};
diff --git a/src/devices/sound/2612intf.cpp b/src/devices/sound/2612intf.cpp
index 4c09413339c..679333cdcf3 100644
--- a/src/devices/sound/2612intf.cpp
+++ b/src/devices/sound/2612intf.cpp
@@ -56,10 +56,10 @@ void ym2612_device::timer_handler(int c,int count,int clock)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void ym2612_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ym2612_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
ym2612_update_one(m_chip, outputs, samples, m_output_bits);
}
@@ -87,7 +87,7 @@ void ym2612_device::device_start()
m_timer[1] = timer_alloc(1);
/* stream system initialize */
- m_stream = machine().sound().stream_alloc(*this,0,2,rate);
+ m_stream = stream_alloc_legacy(0,2,rate);
/**** initialize YM2612 ****/
m_chip = ym2612_init(this,clock(),rate,&ym2612_device::static_timer_handler,&ym2612_device::static_irq_handler);
@@ -108,7 +108,7 @@ void ym2612_device::calculate_rates()
if (m_stream != nullptr)
m_stream->set_sample_rate(rate);
else
- m_stream = machine().sound().stream_alloc(*this,0,2,rate);
+ m_stream = stream_alloc_legacy(0,2,rate);
}
//-------------------------------------------------
diff --git a/src/devices/sound/2612intf.h b/src/devices/sound/2612intf.h
index 1bbf9ea3bf9..f9447081d9b 100644
--- a/src/devices/sound/2612intf.h
+++ b/src/devices/sound/2612intf.h
@@ -33,7 +33,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
u8 m_output_bits;
private:
diff --git a/src/devices/sound/262intf.cpp b/src/devices/sound/262intf.cpp
index f2aee977b30..0a76cdf6d2b 100644
--- a/src/devices/sound/262intf.cpp
+++ b/src/devices/sound/262intf.cpp
@@ -50,10 +50,10 @@ void ymf262_device::timer_handler(int c, const attotime &period)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void ymf262_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ymf262_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
ymf262_update_one(m_chip, outputs, samples);
}
@@ -81,7 +81,7 @@ void ymf262_device::device_start()
if (!m_chip)
throw emu_fatalerror("ymf262_device(%s): Error creating YMF262 chip", tag());
- m_stream = machine().sound().stream_alloc(*this,0,4,rate);
+ m_stream = stream_alloc_legacy(0,4,rate);
/* YMF262 setup */
ymf262_set_timer_handler (m_chip, &ymf262_device::static_timer_handler, this);
diff --git a/src/devices/sound/262intf.h b/src/devices/sound/262intf.h
index 816b2903831..09ae497748d 100644
--- a/src/devices/sound/262intf.h
+++ b/src/devices/sound/262intf.h
@@ -27,7 +27,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
void irq_handler(int irq);
diff --git a/src/devices/sound/3526intf.cpp b/src/devices/sound/3526intf.cpp
index dd81b0d7eb0..dce29c78440 100644
--- a/src/devices/sound/3526intf.cpp
+++ b/src/devices/sound/3526intf.cpp
@@ -60,10 +60,10 @@ void ym3526_device::timer_handler(int c,const attotime &period)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void ym3526_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ym3526_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
ym3526_update_one(m_chip, outputs[0], samples);
}
@@ -109,7 +109,7 @@ void ym3526_device::calculate_rates()
if (m_stream != nullptr)
m_stream->set_sample_rate(rate);
else
- m_stream = machine().sound().stream_alloc(*this,0,1,rate);
+ m_stream = stream_alloc_legacy(0,1,rate);
}
//-------------------------------------------------
diff --git a/src/devices/sound/3526intf.h b/src/devices/sound/3526intf.h
index 0e57a08e36d..5b425f41241 100644
--- a/src/devices/sound/3526intf.h
+++ b/src/devices/sound/3526intf.h
@@ -32,7 +32,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
void irq_handler(int irq);
diff --git a/src/devices/sound/3812intf.cpp b/src/devices/sound/3812intf.cpp
index c5f5aeabb05..b9287f21d9e 100644
--- a/src/devices/sound/3812intf.cpp
+++ b/src/devices/sound/3812intf.cpp
@@ -62,10 +62,10 @@ void ym3812_device::timer_handler(int c, const attotime &period)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void ym3812_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ym3812_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
ym3812_update_one(m_chip, outputs[0], samples);
}
@@ -110,7 +110,7 @@ void ym3812_device::calculate_rates()
if (m_stream != nullptr)
m_stream->set_sample_rate(rate);
else
- m_stream = machine().sound().stream_alloc(*this, 0, 1, rate);
+ m_stream = stream_alloc_legacy(0, 1, rate);
}
//-------------------------------------------------
diff --git a/src/devices/sound/3812intf.h b/src/devices/sound/3812intf.h
index 1bf4e536370..46266bbbca2 100644
--- a/src/devices/sound/3812intf.h
+++ b/src/devices/sound/3812intf.h
@@ -30,7 +30,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
enum
diff --git a/src/devices/sound/8950intf.cpp b/src/devices/sound/8950intf.cpp
index 3907daa4700..63056582a0e 100644
--- a/src/devices/sound/8950intf.cpp
+++ b/src/devices/sound/8950intf.cpp
@@ -56,10 +56,10 @@ void y8950_device::timer_handler(int c, const attotime &period)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void y8950_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void y8950_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
y8950_update_one(m_chip, outputs[0], samples);
}
@@ -87,7 +87,7 @@ void y8950_device::device_start()
/* ADPCM ROM data */
y8950_set_delta_t_memory(m_chip, &y8950_device::static_read_byte, &y8950_device::static_write_byte);
- m_stream = machine().sound().stream_alloc(*this,0,1,rate);
+ m_stream = stream_alloc_legacy(0,1,rate);
/* port and keyboard handler */
y8950_set_port_handler(m_chip, &y8950_device::static_port_handler_w, &y8950_device::static_port_handler_r, this);
y8950_set_keyboard_handler(m_chip, &y8950_device::static_keyboard_handler_w, &y8950_device::static_keyboard_handler_r, this);
diff --git a/src/devices/sound/8950intf.h b/src/devices/sound/8950intf.h
index 221c02bfb20..d1ba497c08d 100644
--- a/src/devices/sound/8950intf.h
+++ b/src/devices/sound/8950intf.h
@@ -41,7 +41,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
void irq_handler(int irq);
diff --git a/src/devices/sound/aica.cpp b/src/devices/sound/aica.cpp
index f3ce7c337e0..7bedf5d660a 100644
--- a/src/devices/sound/aica.cpp
+++ b/src/devices/sound/aica.cpp
@@ -1229,17 +1229,12 @@ s32 aica_device::UpdateSlot(AICA_SLOT *slot)
return sample;
}
-void aica_device::DoMasterSamples(int nsamples)
+void aica_device::DoMasterSamples(std::vector<read_stream_view> const &inputs, write_stream_view &bufl, write_stream_view &bufr)
{
- stream_sample_t *exts[2];
int i;
- stream_sample_t *bufr = m_bufferr;
- stream_sample_t *bufl = m_bufferl;
- exts[0] = m_exts0;
- exts[1] = m_exts1;
-
- for (int s = 0; s < nsamples; ++s)
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / stream_buffer::sample_t(32768 << SHIFT);
+ for (int s = 0; s < bufl.samples(); ++s)
{
s32 smpl = 0, smpr = 0;
@@ -1280,7 +1275,7 @@ void aica_device::DoMasterSamples(int nsamples)
{
if (EFSDL(i + 16)) // 16,17 for EXTS
{
- m_DSP.EXTS[i] = exts[i][s];
+ m_DSP.EXTS[i] = s16(inputs[i].get(s) * 32767.0);
u32 Enc = ((EFPAN(i + 16)) << 0x8) | ((EFSDL(i + 16)) << 0xd);
smpl += (m_DSP.EXTS[i] * m_LPANTABLE[Enc]) >> SHIFT;
smpr += (m_DSP.EXTS[i] * m_RPANTABLE[Enc]) >> SHIFT;
@@ -1298,8 +1293,8 @@ void aica_device::DoMasterSamples(int nsamples)
smpr = clip16(smpr >> 3);
}
- *bufl++ = (smpl * m_LPANTABLE[MVOL() << 0xd]) >> SHIFT;
- *bufr++ = (smpr * m_LPANTABLE[MVOL() << 0xd]) >> SHIFT;
+ bufl.put(s, stream_buffer::sample_t(smpl * m_LPANTABLE[MVOL() << 0xd]) * sample_scale);
+ bufr.put(s, stream_buffer::sample_t(smpr * m_LPANTABLE[MVOL() << 0xd]) * sample_scale);
}
}
@@ -1393,13 +1388,9 @@ int aica_device::IRQCB(void *param)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void aica_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void aica_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- m_bufferl = outputs[0];
- m_bufferr = outputs[1];
- m_exts0 = inputs[0];
- m_exts1 = inputs[1];
- DoMasterSamples(samples);
+ DoMasterSamples(inputs, outputs[0], outputs[1]);
}
//-------------------------------------------------
@@ -1418,7 +1409,7 @@ void aica_device::device_start()
m_irq_cb.resolve_safe();
m_main_irq_cb.resolve_safe();
- m_stream = machine().sound().stream_alloc(*this, 2, 2, (int)m_rate);
+ m_stream = stream_alloc(2, 2, (int)m_rate);
// save state
save_item(NAME(m_udata.data));
@@ -1568,10 +1559,6 @@ aica_device::aica_device(const machine_config &mconfig, const char *tag, device_
, m_MidiR(0)
, m_mcieb(0)
, m_mcipd(0)
- , m_bufferl(nullptr)
- , m_bufferr(nullptr)
- , m_exts0(nullptr)
- , m_exts1(nullptr)
{
memset(&m_udata.data, 0, sizeof(m_udata.data));
diff --git a/src/devices/sound/aica.h b/src/devices/sound/aica.h
index 7c5597b5aa6..8509953a228 100644
--- a/src/devices/sound/aica.h
+++ b/src/devices/sound/aica.h
@@ -39,7 +39,7 @@ protected:
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;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
@@ -124,7 +124,7 @@ private:
void w16(u32 addr,u16 val);
u16 r16(u32 addr);
inline s32 UpdateSlot(AICA_SLOT *slot);
- void DoMasterSamples(int nsamples);
+ void DoMasterSamples(std::vector<read_stream_view> const &inputs, write_stream_view &bufl, write_stream_view &bufr);
void exec_dma();
@@ -184,11 +184,6 @@ private:
AICADSP m_DSP;
- stream_sample_t *m_bufferl;
- stream_sample_t *m_bufferr;
- stream_sample_t *m_exts0;
- stream_sample_t *m_exts1;
-
s32 m_EG_TABLE[0x400];
int m_PLFO_TRI[256],m_PLFO_SQR[256],m_PLFO_SAW[256],m_PLFO_NOI[256];
int m_ALFO_TRI[256],m_ALFO_SQR[256],m_ALFO_SAW[256],m_ALFO_NOI[256];
diff --git a/src/devices/sound/asc.cpp b/src/devices/sound/asc.cpp
index f007f4131fb..e03494040ab 100644
--- a/src/devices/sound/asc.cpp
+++ b/src/devices/sound/asc.cpp
@@ -62,7 +62,7 @@ asc_device::asc_device(const machine_config &mconfig, const char *tag, device_t
void asc_device::device_start()
{
// create the stream
- m_stream = machine().sound().stream_alloc(*this, 0, 2, 22257);
+ m_stream = stream_alloc(0, 2, 22257);
memset(m_regs, 0, sizeof(m_regs));
@@ -117,22 +117,19 @@ void asc_device::device_timer(emu_timer &timer, device_timer_id tid, int param,
// our sound stream
//-------------------------------------------------
-void asc_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void asc_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *outL, *outR;
int i, ch;
static uint32_t wtoffs[2] = { 0, 0x200 };
- outL = outputs[0];
- outR = outputs[1];
+ auto &outL = outputs[0];
+ auto &outR = outputs[1];
switch (m_regs[R_MODE-0x800] & 3)
{
case 0: // chip off
- for (i = 0; i < samples; i++)
- {
- outL[i] = outR[i] = 0;
- }
+ outL.fill(0);
+ outR.fill(0);
// IIvx/IIvi bootrom indicates VASP updates this flag even when the chip is off
if (m_chip_type == asc_type::VASP)
@@ -140,12 +137,19 @@ void asc_device::sound_stream_update(sound_stream &stream, stream_sample_t **inp
if (m_fifo_cap_a < 0x1ff)
{
m_regs[R_FIFOSTAT-0x800] |= 1; // fifo A less than half full
+
+ if (m_fifo_cap_a == 0) // fifo A fully empty
+ {
+ m_regs[R_FIFOSTAT-0x800] |= 2; // fifo A empty
+ }
}
}
break;
case 1: // FIFO mode
- for (i = 0; i < samples; i++)
+ {
+ constexpr stream_buffer::sample_t sample_scale = 64.0 / 32768.0;
+ for (i = 0; i < outL.samples(); i++)
{
int8_t smpll, smplr;
@@ -230,13 +234,16 @@ void asc_device::sound_stream_update(sound_stream &stream, stream_sample_t **inp
break;
}
- outL[i] = smpll * 64;
- outR[i] = smplr * 64;
+ outL.put(i, stream_buffer::sample_t(smpll) * sample_scale);
+ outR.put(i, stream_buffer::sample_t(smplr) * sample_scale);
}
break;
+ }
case 2: // wavetable mode
- for (i = 0; i < samples; i++)
+ {
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / (32768.0 * 4.0);
+ for (i = 0; i < outL.samples(); i++)
{
int32_t mixL, mixR;
int8_t smpl;
@@ -262,10 +269,11 @@ void asc_device::sound_stream_update(sound_stream &stream, stream_sample_t **inp
mixR += smpl*256;
}
- outL[i] = mixL>>2;
- outR[i] = mixR>>2;
+ outL.put(i, stream_buffer::sample_t(mixL) * sample_scale);
+ outR.put(i, stream_buffer::sample_t(mixR) * sample_scale);
}
break;
+ }
}
// printf("rdA %04x rdB %04x wrA %04x wrB %04x (capA %04x B %04x)\n", m_fifo_a_rdptr, m_fifo_b_rdptr, m_fifo_a_wrptr, m_fifo_b_wrptr, m_fifo_cap_a, m_fifo_cap_b);
diff --git a/src/devices/sound/asc.h b/src/devices/sound/asc.h
index e720aab4efa..f1dff62ffc2 100644
--- a/src/devices/sound/asc.h
+++ b/src/devices/sound/asc.h
@@ -76,7 +76,7 @@ protected:
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
devcb_write_line write_irq;
diff --git a/src/devices/sound/astrocde.cpp b/src/devices/sound/astrocde.cpp
index 63f900b4806..17df6999989 100644
--- a/src/devices/sound/astrocde.cpp
+++ b/src/devices/sound/astrocde.cpp
@@ -126,12 +126,12 @@ void astrocade_io_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void astrocade_io_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void astrocade_io_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *dest = outputs[0];
+ auto &dest = outputs[0];
uint16_t noise_state;
uint8_t master_count;
uint8_t noise_clock;
@@ -142,17 +142,16 @@ void astrocade_io_device::sound_stream_update(sound_stream &stream, stream_sampl
noise_state = m_noise_state;
/* loop over samples */
- while (samples > 0)
+ int samples_this_time;
+ constexpr stream_buffer::sample_t sample_scale = 1.0f / 60.0f;
+ for (int sampindex = 0; sampindex < dest.samples(); sampindex += samples_this_time)
{
stream_sample_t cursample = 0;
- int samples_this_time;
- int samp;
/* compute the number of cycles until the next master oscillator reset */
/* or until the next noise boundary */
- samples_this_time = std::min(samples, 256 - master_count);
+ samples_this_time = std::min<int>(dest.samples() - sampindex, 256 - master_count);
samples_this_time = std::min(samples_this_time, 64 - noise_clock);
- samples -= samples_this_time;
/* sum the output of the tone generators */
if (m_a_state)
@@ -167,9 +166,7 @@ void astrocade_io_device::sound_stream_update(sound_stream &stream, stream_sampl
cursample += m_reg[7] >> 4;
/* scale to max and output */
- cursample = cursample * 32767 / 60;
- for (samp = 0; samp < samples_this_time; samp++)
- *dest++ = cursample;
+ dest.fill(stream_buffer::sample_t(cursample) * sample_scale, sampindex, samples_this_time);
/* clock the noise; a 2-bit counter clocks a 4-bit counter which clocks the LFSR */
noise_clock += samples_this_time;
diff --git a/src/devices/sound/astrocde.h b/src/devices/sound/astrocde.h
index 40bf8cc1448..387ef7f9ca3 100644
--- a/src/devices/sound/astrocde.h
+++ b/src/devices/sound/astrocde.h
@@ -58,7 +58,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
public:
void write(offs_t offset, uint8_t data);
diff --git a/src/devices/sound/awacs.cpp b/src/devices/sound/awacs.cpp
index c03c2d9eb11..19f734cd468 100644
--- a/src/devices/sound/awacs.cpp
+++ b/src/devices/sound/awacs.cpp
@@ -42,7 +42,7 @@ awacs_device::awacs_device(const machine_config &mconfig, const char *tag, devic
void awacs_device::device_start()
{
// create the stream
- m_stream = machine().sound().stream_alloc(*this, 0, 2, 22050);
+ m_stream = stream_alloc(0, 2, 22050);
memset(m_regs, 0, sizeof(m_regs));
@@ -86,20 +86,20 @@ void awacs_device::device_timer(emu_timer &timer, device_timer_id tid, int param
// our sound stream
//-------------------------------------------------
-void awacs_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void awacs_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *outL, *outR;
int offset = (m_buffer_num == 0) ? m_dma_offset_0 : m_dma_offset_1;
- outL = outputs[0];
- outR = outputs[1];
+ auto &outL = outputs[0];
+ auto &outR = outputs[1];
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
if (m_playback_enable)
{
- for (int i = 0; i < samples; i++)
+ for (int i = 0; i < outL.samples(); i++)
{
- outL[i] = (int16_t)m_dma_space->read_word(offset + m_play_ptr);
- outR[i] = (int16_t)m_dma_space->read_word(offset + m_play_ptr + 2);
+ outL.put(i, stream_buffer::sample_t(s16(m_dma_space->read_word(offset + m_play_ptr))) * sample_scale);
+ outR.put(i, stream_buffer::sample_t(s16(m_dma_space->read_word(offset + m_play_ptr + 2))) * sample_scale);
m_play_ptr += 4;
}
@@ -115,11 +115,8 @@ void awacs_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
}
else
{
- for (int i = 0; i < samples; i++)
- {
- outL[i] = 0;
- outR[i] = 0;
- }
+ outL.fill(0);
+ outR.fill(0);
}
}
diff --git a/src/devices/sound/awacs.h b/src/devices/sound/awacs.h
index 4ef4a800a24..0840d21d0d9 100644
--- a/src/devices/sound/awacs.h
+++ b/src/devices/sound/awacs.h
@@ -36,7 +36,7 @@ protected:
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
sound_stream *m_stream;
diff --git a/src/devices/sound/ay8910.cpp b/src/devices/sound/ay8910.cpp
index 1b1026b9e57..26e99cf1bc7 100644
--- a/src/devices/sound/ay8910.cpp
+++ b/src/devices/sound/ay8910.cpp
@@ -593,7 +593,7 @@ YM2203 Japanese datasheet contents, translated: http://www.larwe.com/technical/c
#define ENABLE_REGISTER_TEST (0) /* Enable preprogrammed registers */
#define LOG_IGNORED_WRITES (0)
-static constexpr int MAX_OUTPUT = 0x7fff;
+static constexpr stream_buffer::sample_t MAX_OUTPUT = 1.0;
/*************************************
*
@@ -770,7 +770,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, stream_buffer::sample_t *tab)
{
double min = 10.0, max = 0.0;
@@ -829,7 +829,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, stream_buffer::sample_t *tab, int zero_is_off)
{
double rt;
double rw;
@@ -867,7 +867,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, stream_buffer::sample_t *tab)
{
for (int j = 0; j < par.m_count; j++)
{
@@ -878,18 +878,14 @@ static inline void build_mosfet_resistor_table(const ay8910_device::mosfet_param
const double Vs = p2 - sqrt(p2 * p2 - Vg * Vg);
const double res = rd * (Vd / Vs - 1.0);
- /* That's the biggest value we can stream on to netlist. */
- if (res > (1 << 28))
- tab[j] = (1 << 28);
- else
- tab[j] = res;
+ tab[j] = res;
//printf("%d %f %10d\n", j, rd / (res + rd) * 5.0, tab[j]);
}
}
-u16 ay8910_device::mix_3D()
+stream_buffer::sample_t ay8910_device::mix_3D()
{
int indx = 0;
@@ -1085,27 +1081,18 @@ void ay8910_device::ay8910_write_reg(int r, int v)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void ay8910_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ay8910_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *buf[NUM_CHANNELS];
tone_t *tone;
envelope_t *envelope;
- buf[0] = outputs[0];
- buf[1] = nullptr;
- buf[2] = nullptr;
- if (m_streams == NUM_CHANNELS)
- {
- buf[1] = outputs[1];
- buf[2] = outputs[2];
- }
+ int samples = outputs[0].samples();
/* hack to prevent us from hanging when starting filtered outputs */
if (!m_ready)
{
- for (int chan = 0; chan < NUM_CHANNELS; chan++)
- if (buf[chan] != nullptr)
- memset(buf[chan], 0, samples * sizeof(*buf[chan]));
+ for (int chan = 0; chan < m_streams; chan++)
+ outputs[chan].fill(0);
}
/* The 8910 has three outputs, each output is the mix of one of the three */
@@ -1116,7 +1103,7 @@ void ay8910_device::sound_stream_update(sound_stream &stream, stream_sample_t **
/* is 1, not 0, and can be modulated changing the volume. */
/* buffering loop */
- while (samples)
+ for (int sampindex = 0; sampindex < samples; sampindex++)
{
for (int chan = 0; chan < NUM_CHANNELS; chan++)
{
@@ -1212,40 +1199,39 @@ void ay8910_device::sound_stream_update(sound_stream &stream, stream_sample_t **
{
env_volume >>= 1;
if (m_feature & PSG_EXTENDED_ENVELOPE) // AY8914 Has a two bit tone_envelope field
- *(buf[chan]++) = m_vol_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0];
+ outputs[chan].put(sampindex, m_vol_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]);
else
- *(buf[chan]++) = m_vol_table[chan][m_vol_enabled[chan] ? env_volume : 0];
+ outputs[chan].put(sampindex, m_vol_table[chan][m_vol_enabled[chan] ? env_volume : 0]);
}
else
{
if (m_feature & PSG_EXTENDED_ENVELOPE) // AY8914 Has a two bit tone_envelope field
- *(buf[chan]++) = m_env_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0];
+ outputs[chan].put(sampindex, m_env_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]);
else
- *(buf[chan]++) = m_env_table[chan][m_vol_enabled[chan] ? env_volume : 0];
+ outputs[chan].put(sampindex, m_env_table[chan][m_vol_enabled[chan] ? env_volume : 0]);
}
}
else
{
if (m_feature & PSG_EXTENDED_ENVELOPE) // AY8914 Has a two bit tone_envelope field
- *(buf[chan]++) = m_env_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0];
+ outputs[chan].put(sampindex, m_env_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]);
else
- *(buf[chan]++) = m_env_table[chan][m_vol_enabled[chan] ? env_volume : 0];
+ outputs[chan].put(sampindex, m_env_table[chan][m_vol_enabled[chan] ? env_volume : 0]);
}
}
else
{
if (is_expanded_mode())
- *(buf[chan]++) = m_env_table[chan][m_vol_enabled[chan] ? tone_volume(tone) : 0];
+ outputs[chan].put(sampindex, m_env_table[chan][m_vol_enabled[chan] ? tone_volume(tone) : 0]);
else
- *(buf[chan]++) = m_vol_table[chan][m_vol_enabled[chan] ? tone_volume(tone) : 0];
+ outputs[chan].put(sampindex, m_vol_table[chan][m_vol_enabled[chan] ? tone_volume(tone) : 0]);
}
}
}
else
{
- *(buf[0]++) = mix_3D();
+ outputs[0].put(sampindex, mix_3D());
}
- samples--;
}
}
@@ -1344,13 +1330,13 @@ 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<stream_buffer::sample_t[]>(8*32*32*32);
build_mixer_table();
/* The envelope is pacing twice as fast for the YM2149 as for the AY-3-8910, */
/* This handled by the step parameter. Consequently we use a multipler of 2 here. */
- m_channel = machine().sound().stream_alloc(*this, 0, m_streams, (m_feature & PSG_HAS_EXPANDED_MODE) ? master_clock * 2 : master_clock / 8);
+ m_channel = stream_alloc(0, m_streams, (m_feature & PSG_HAS_EXPANDED_MODE) ? master_clock * 2 : master_clock / 8);
ay_set_clock(master_clock);
ay8910_statesave();
@@ -1396,7 +1382,7 @@ void ay8910_device::set_volume(int channel,int volume)
{
for (int ch = 0; ch < m_streams; ch++)
if (channel == ch || m_streams == 1 || channel == ALL_8910_CHANNELS)
- m_channel->set_output_gain(ch, volume / 100.0);
+ set_output_gain(ch, volume / 100.0);
}
void ay8910_device::ay_set_clock(int clock)
diff --git a/src/devices/sound/ay8910.h b/src/devices/sound/ay8910.h
index d9af1b6b86f..373a850b662 100644
--- a/src/devices/sound/ay8910.h
+++ b/src/devices/sound/ay8910.h
@@ -135,7 +135,7 @@ protected:
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;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
// trampolines for callbacks from fm.cpp
static void psg_set_clock(device_t *device, int clock) { downcast<ay8910_device *>(device)->ay_set_clock(clock); }
@@ -276,7 +276,7 @@ private:
// internal helpers
void set_type(psg_type_t psg_type);
- inline u16 mix_3D();
+ inline stream_buffer::sample_t mix_3D();
void ay8910_write_reg(int r, int v);
void build_mixer_table();
void ay8910_statesave();
@@ -308,9 +308,9 @@ private:
u8 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;
+ stream_buffer::sample_t m_vol_table[NUM_CHANNELS][16];
+ stream_buffer::sample_t m_env_table[NUM_CHANNELS][32];
+ std::unique_ptr<stream_buffer::sample_t[]> m_vol3d_table;
int m_flags; /* Flags */
int m_feature; /* Chip specific features */
int m_res_load[3]; /* Load on channel in ohms */
diff --git a/src/devices/sound/beep.cpp b/src/devices/sound/beep.cpp
index 8c5a404afd0..58096c4b561 100644
--- a/src/devices/sound/beep.cpp
+++ b/src/devices/sound/beep.cpp
@@ -49,7 +49,7 @@ void beep_device::device_start()
{
m_stream = stream_alloc(0, 1, BEEP_RATE);
m_enable = 0;
- m_signal = 0x07fff;
+ m_signal = 1.0;
// register for savestates
save_item(NAME(m_enable));
@@ -63,9 +63,9 @@ void beep_device::device_start()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void beep_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void beep_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *buffer = outputs[0];
+ auto &buffer = outputs[0];
int16_t signal = m_signal;
int clock = 0, rate = BEEP_RATE / 2;
@@ -78,14 +78,14 @@ void beep_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
/* if we're not enabled, just fill with 0 */
if ( !m_enable || clock == 0 )
{
- memset( buffer, 0, samples * sizeof(*buffer) );
+ buffer.fill(0);
return;
}
/* fill in the sample */
- while( samples-- > 0 )
+ for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
{
- *buffer++ = signal;
+ buffer.put(sampindex, signal);
incr -= clock;
while( incr < 0 )
{
@@ -116,7 +116,7 @@ WRITE_LINE_MEMBER(beep_device::set_state)
/* restart wave from beginning */
m_incr = 0;
- m_signal = 0x07fff;
+ m_signal = 1.0;
}
@@ -131,6 +131,6 @@ void beep_device::set_clock(uint32_t frequency)
m_stream->update();
m_frequency = frequency;
- m_signal = 0x07fff;
+ m_signal = 1.0;
m_incr = 0;
}
diff --git a/src/devices/sound/beep.h b/src/devices/sound/beep.h
index 388d0fa6261..6c5ef2ae65f 100644
--- a/src/devices/sound/beep.h
+++ b/src/devices/sound/beep.h
@@ -22,7 +22,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
public:
DECLARE_WRITE_LINE_MEMBER(set_state); // enable/disable sound output
@@ -33,7 +33,7 @@ private:
int m_enable; /* enable beep */
int m_frequency; /* set frequency - this can be changed using the appropriate function */
int m_incr; /* initial wave state */
- int16_t m_signal; /* current signal */
+ stream_buffer::sample_t m_signal; /* current signal */
};
DECLARE_DEVICE_TYPE(BEEP, beep_device)
diff --git a/src/devices/sound/bsmt2000.cpp b/src/devices/sound/bsmt2000.cpp
index 05ea982bb8e..09392661079 100644
--- a/src/devices/sound/bsmt2000.cpp
+++ b/src/devices/sound/bsmt2000.cpp
@@ -175,14 +175,12 @@ void bsmt2000_device::device_timer(emu_timer &timer, device_timer_id id, int par
// for our sound stream
//-------------------------------------------------
-void bsmt2000_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void bsmt2000_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
// 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;
- }
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
+ outputs[0].fill(stream_buffer::sample_t(m_left_data) * sample_scale);
+ outputs[1].fill(stream_buffer::sample_t(m_right_data) * sample_scale);
}
diff --git a/src/devices/sound/bsmt2000.h b/src/devices/sound/bsmt2000.h
index ef3c13e045f..289457cffd9 100644
--- a/src/devices/sound/bsmt2000.h
+++ b/src/devices/sound/bsmt2000.h
@@ -53,7 +53,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/c140.cpp b/src/devices/sound/c140.cpp
index 7f3780c8ed3..0edb1920a8c 100644
--- a/src/devices/sound/c140.cpp
+++ b/src/devices/sound/c140.cpp
@@ -77,9 +77,9 @@ DEFINE_DEVICE_TYPE(C219, c219_device, "c219", "Namco C219")
// LIVE DEVICE
//**************************************************************************
-static inline int limit(s32 in)
+static inline stream_buffer::sample_t limit(stream_buffer::sample_t in)
{
- return std::max(-0x7fff, std::min(0x8000, in));
+ return std::max(-1.0f, std::min(1.0f, in));
}
@@ -220,7 +220,7 @@ void c140_device::rom_bank_updated()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void c140_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void c140_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
s32 dt;
@@ -228,6 +228,7 @@ void c140_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
s16 *lmix, *rmix;
+ int samples = outputs[0].samples();
if (samples > m_sample_rate) samples = m_sample_rate;
/* zap the contents of the mixer buffer */
@@ -323,21 +324,22 @@ void c140_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
lmix = m_mixer_buffer_left.get();
rmix = m_mixer_buffer_right.get();
{
- stream_sample_t *dest1 = outputs[0];
- stream_sample_t *dest2 = outputs[1];
+ auto &dest1 = outputs[0];
+ auto &dest2 = outputs[1];
+ constexpr stream_buffer::sample_t sample_scale = 8.0 / 32768.0;
for (int i = 0; i < samples; i++)
{
- s32 val;
+ stream_buffer::sample_t val;
- val = 8 * (*lmix++);
- *dest1++ = limit(val);
- val = 8 * (*rmix++);
- *dest2++ = limit(val);
+ val = stream_buffer::sample_t(*lmix++) * sample_scale;
+ dest1.put(i, limit(val));
+ val = stream_buffer::sample_t(*rmix++) * sample_scale;
+ dest2.put(i, limit(val));
}
}
}
-void c219_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void c219_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
s32 dt;
@@ -345,6 +347,7 @@ void c219_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
s16 *lmix, *rmix;
+ int samples = outputs[0].samples();
if (samples > m_sample_rate) samples = m_sample_rate;
/* zap the contents of the mixer buffer */
@@ -460,16 +463,17 @@ void c219_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
lmix = m_mixer_buffer_left.get();
rmix = m_mixer_buffer_right.get();
{
- stream_sample_t *dest1 = outputs[0];
- stream_sample_t *dest2 = outputs[1];
+ auto &dest1 = outputs[0];
+ auto &dest2 = outputs[1];
+ constexpr stream_buffer::sample_t sample_scale = 8.0 / 32768.0;
for (int i = 0; i < samples; i++)
{
- s32 val;
+ stream_buffer::sample_t val;
- val = 8 * (*lmix++);
- *dest1++ = limit(val);
- val = 8 * (*rmix++);
- *dest2++ = limit(val);
+ val = stream_buffer::sample_t(*lmix++) * sample_scale;
+ dest1.put(i, limit(val));
+ val = stream_buffer::sample_t(*rmix++) * sample_scale;
+ dest2.put(i, limit(val));
}
}
}
diff --git a/src/devices/sound/c140.h b/src/devices/sound/c140.h
index 6f645a06d9e..3008d964a9d 100644
--- a/src/devices/sound/c140.h
+++ b/src/devices/sound/c140.h
@@ -44,7 +44,7 @@ protected:
virtual void rom_bank_updated() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
virtual int find_sample(int adrs, int bank, int voice);
@@ -116,7 +116,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
virtual int find_sample(int adrs, int bank, int voice) override;
diff --git a/src/devices/sound/c352.cpp b/src/devices/sound/c352.cpp
index 5038e0aaee2..826f194437a 100644
--- a/src/devices/sound/c352.cpp
+++ b/src/devices/sound/c352.cpp
@@ -122,14 +122,15 @@ void c352_device::ramp_volume(c352_voice_t &v, int ch, u8 val)
v.curr_vol[ch] += (vol_delta > 0) ? -1 : 1;
}
-void c352_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void c352_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *buffer_fl = outputs[0];
- stream_sample_t *buffer_fr = outputs[1];
- stream_sample_t *buffer_rl = outputs[2];
- stream_sample_t *buffer_rr = outputs[3];
+ auto &buffer_fl = outputs[0];
+ auto &buffer_fr = outputs[1];
+ auto &buffer_rl = outputs[2];
+ auto &buffer_rr = outputs[3];
- for (int i = 0; i < samples; i++)
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
+ for (int i = 0; i < buffer_fl.samples(); i++)
{
int out[4] = { 0, 0, 0, 0 };
@@ -173,10 +174,10 @@ void c352_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
out[3] += (((v.flags & C352_FLG_PHASEFR) ? -s : s) * v.curr_vol[3]) >> 8;
}
- *buffer_fl++ = (s16)(out[0] >> 3);
- *buffer_fr++ = (s16)(out[1] >> 3);
- *buffer_rl++ = (s16)(out[2] >> 3);
- *buffer_rr++ = (s16)(out[3] >> 3);
+ buffer_fl.put(i, stream_buffer::sample_t(s16(out[0] >> 3)) * sample_scale);
+ buffer_fr.put(i, stream_buffer::sample_t(s16(out[1] >> 3)) * sample_scale);
+ buffer_rl.put(i, stream_buffer::sample_t(s16(out[2] >> 3)) * sample_scale);
+ buffer_rr.put(i, stream_buffer::sample_t(s16(out[3] >> 3)) * sample_scale);
}
}
@@ -358,14 +359,14 @@ void c352_device::device_clock_changed()
if (m_stream != nullptr)
m_stream->set_sample_rate(m_sample_rate_base);
else
- m_stream = machine().sound().stream_alloc(*this, 0, 4, m_sample_rate_base);
+ m_stream = stream_alloc(0, 4, m_sample_rate_base);
}
void c352_device::device_start()
{
m_sample_rate_base = clock() / m_divider;
- m_stream = machine().sound().stream_alloc(*this, 0, 4, m_sample_rate_base);
+ m_stream = stream_alloc(0, 4, m_sample_rate_base);
// generate mulaw table (Output similar to namco's VC emulator)
int j = 0;
diff --git a/src/devices/sound/c352.h b/src/devices/sound/c352.h
index 2a8ea946c5b..d21ac96cd86 100644
--- a/src/devices/sound/c352.h
+++ b/src/devices/sound/c352.h
@@ -39,7 +39,7 @@ protected:
virtual void device_clock_changed() override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/c6280.cpp b/src/devices/sound/c6280.cpp
index 0278620d943..d01dd74125a 100644
--- a/src/devices/sound/c6280.cpp
+++ b/src/devices/sound/c6280.cpp
@@ -42,15 +42,16 @@
#include <algorithm>
-void c6280_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void c6280_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
const u8 lmal = (m_balance >> 4) & 0x0f;
const u8 rmal = (m_balance >> 0) & 0x0f;
/* Clear buffer */
- std::fill_n(&outputs[0][0], samples, 0);
- std::fill_n(&outputs[1][0], samples, 0);
+ outputs[0].fill(0);
+ outputs[1].fill(0);
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
for (int ch = 0; ch < 6; ch++)
{
channel *chan = &m_channel[ch];
@@ -76,7 +77,7 @@ void c6280_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
{
/* Noise mode */
const u32 step = (chan->noise_control & 0x1f) ^ 0x1f;
- for (int i = 0; i < samples; i += 1)
+ for (int i = 0; i < outputs[0].samples(); i += 1)
{
s16 data = BIT(chan->noise_seed, 0) ? 0x1f : 0;
chan->noise_counter--;
@@ -87,18 +88,18 @@ void c6280_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
// based on Charles MacDonald's research
chan->noise_seed = (seed >> 1) | ((BIT(seed, 0) ^ BIT(seed, 1) ^ BIT(seed, 11) ^ BIT(seed, 12) ^ BIT(seed, 17)) << 17);
}
- outputs[0][i] += (s16)(vll * (data - 16));
- outputs[1][i] += (s16)(vlr * (data - 16));
+ outputs[0].add(i, stream_buffer::sample_t(s16(vll * (data - 16))) * sample_scale);
+ outputs[1].add(i, stream_buffer::sample_t(s16(vlr * (data - 16))) * sample_scale);
}
}
else
if (chan->control & 0x40)
{
/* DDA mode */
- for (int i = 0; i < samples; i++)
+ for (int i = 0; i < outputs[0].samples(); i++)
{
- outputs[0][i] += (s16)(vll * (chan->dda - 16));
- outputs[1][i] += (s16)(vlr * (chan->dda - 16));
+ outputs[0].add(i, stream_buffer::sample_t(s16(vll * (chan->dda - 16))) * sample_scale);
+ outputs[1].add(i, stream_buffer::sample_t(s16(vlr * (chan->dda - 16))) * sample_scale);
}
}
else
@@ -111,7 +112,7 @@ void c6280_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
channel *lfo_srcchan = &m_channel[1];
channel *lfo_dstchan = &m_channel[0];
const u16 lfo_step = lfo_srcchan->frequency ? lfo_srcchan->frequency : 0x1000;
- for (int i = 0; i < samples; i += 1)
+ for (int i = 0; i < outputs[0].samples(); i += 1)
{
s32 step = lfo_dstchan->frequency ? lfo_dstchan->frequency : 0x1000;
if (m_lfo_control & 0x80) // reset LFO
@@ -137,8 +138,8 @@ void c6280_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
lfo_dstchan->tick = step;
lfo_dstchan->index = (lfo_dstchan->index + 1) & 0x1f;
}
- outputs[0][i] += (s16)(vll * (data - 16));
- outputs[1][i] += (s16)(vlr * (data - 16));
+ outputs[0].add(i, stream_buffer::sample_t(s16(vll * (data - 16))) * sample_scale);
+ outputs[1].add(i, stream_buffer::sample_t(s16(vlr * (data - 16))) * sample_scale);
}
}
}
@@ -146,7 +147,7 @@ void c6280_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
{
/* Waveform mode */
const u32 step = chan->frequency ? chan->frequency : 0x1000;
- for (int i = 0; i < samples; i += 1)
+ for (int i = 0; i < outputs[0].samples(); i += 1)
{
const s16 data = chan->waveform[chan->index];
chan->tick--;
@@ -155,8 +156,8 @@ void c6280_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
chan->tick = step;
chan->index = (chan->index + 1) & 0x1f;
}
- outputs[0][i] += (s16)(vll * (data - 16));
- outputs[1][i] += (s16)(vlr * (data - 16));
+ outputs[0].add(i, stream_buffer::sample_t(s16(vll * (data - 16))) * sample_scale);
+ outputs[1].add(i, stream_buffer::sample_t(s16(vlr * (data - 16))) * sample_scale);
}
}
}
@@ -319,7 +320,7 @@ void c6280_device::device_start()
m_lfo_control = 0;
memset(m_channel, 0, sizeof(channel) * 8);
- m_stream = machine().sound().stream_alloc(*this, 0, 2, clock());
+ m_stream = stream_alloc(0, 2, clock());
/* Make volume table */
/* PSG has 48dB volume range spread over 32 steps */
diff --git a/src/devices/sound/c6280.h b/src/devices/sound/c6280.h
index 9a778c31a9d..60ea993f71b 100644
--- a/src/devices/sound/c6280.h
+++ b/src/devices/sound/c6280.h
@@ -22,7 +22,7 @@ protected:
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;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
struct channel {
diff --git a/src/devices/sound/cdda.cpp b/src/devices/sound/cdda.cpp
index 1b2d766493e..ca2bd280de8 100644
--- a/src/devices/sound/cdda.cpp
+++ b/src/devices/sound/cdda.cpp
@@ -15,11 +15,11 @@
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void cdda_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void cdda_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- get_audio_data(&outputs[0][0], &outputs[1][0], samples);
- m_audio_volume[0] = int16_t(outputs[0][0]);
- m_audio_volume[1] = int16_t(outputs[1][0]);
+ get_audio_data(outputs[0], outputs[1]);
+ m_audio_volume[0] = outputs[0].get(0);
+ m_audio_volume[1] = outputs[1].get(0);
}
//-------------------------------------------------
@@ -31,7 +31,7 @@ void cdda_device::device_start()
/* allocate an audio cache */
m_audio_cache = std::make_unique<uint8_t[]>(CD_MAX_SECTOR_DATA * MAX_SECTORS );
- m_stream = machine().sound().stream_alloc(*this, 0, 2, clock());
+ m_stream = stream_alloc(0, 2, clock());
m_audio_playing = 0;
m_audio_pause = 0;
@@ -159,12 +159,13 @@ int cdda_device::audio_ended()
converts it to 2 16-bit 44.1 kHz streams
-------------------------------------------------*/
-void cdda_device::get_audio_data(stream_sample_t *bufL, stream_sample_t *bufR, uint32_t samples_wanted)
+void cdda_device::get_audio_data(write_stream_view &bufL, write_stream_view &bufR)
{
int i;
int16_t *audio_cache = (int16_t *) m_audio_cache.get();
- while (samples_wanted > 0)
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
+ for (int sampindex = 0; sampindex < bufL.samples(); )
{
/* if no file, audio not playing, audio paused, or out of disc data,
just zero fill */
@@ -176,12 +177,12 @@ void cdda_device::get_audio_data(stream_sample_t *bufL, stream_sample_t *bufR, u
m_audio_ended_normally = true;
}
- memset(bufL, 0, sizeof(stream_sample_t)*samples_wanted);
- memset(bufR, 0, sizeof(stream_sample_t)*samples_wanted);
+ bufL.fill(0, sampindex);
+ bufR.fill(0, sampindex);
return;
}
- int samples = samples_wanted;
+ int samples = bufL.samples() - sampindex;
if (samples > m_audio_samples)
{
samples = m_audio_samples;
@@ -190,11 +191,11 @@ void cdda_device::get_audio_data(stream_sample_t *bufL, stream_sample_t *bufR, u
for (i = 0; i < samples; i++)
{
/* CD-DA data on the disc is big-endian */
- *bufL++ = (int16_t) big_endianize_int16( audio_cache[ m_audio_bptr ] ); m_audio_bptr++;
- *bufR++ = (int16_t) big_endianize_int16( audio_cache[ m_audio_bptr ] ); m_audio_bptr++;
+ bufL.put(sampindex + i, stream_buffer::sample_t(s16(big_endianize_int16( audio_cache[ m_audio_bptr ] ))) * sample_scale); m_audio_bptr++;
+ bufR.put(sampindex + i, stream_buffer::sample_t(s16(big_endianize_int16( audio_cache[ m_audio_bptr ] ))) * sample_scale); m_audio_bptr++;
}
- samples_wanted -= samples;
+ sampindex += samples;
m_audio_samples -= samples;
if (m_audio_samples == 0)
diff --git a/src/devices/sound/cdda.h b/src/devices/sound/cdda.h
index 73a1e1a237d..b0c7b7f81e8 100644
--- a/src/devices/sound/cdda.h
+++ b/src/devices/sound/cdda.h
@@ -30,10 +30,10 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
- void get_audio_data(stream_sample_t *bufL, stream_sample_t *bufR, uint32_t samples_wanted);
+ void get_audio_data(write_stream_view &bufL, write_stream_view &bufR);
cdrom_file * m_disc;
diff --git a/src/devices/sound/cdp1863.cpp b/src/devices/sound/cdp1863.cpp
index 0f480f05bb6..984a306b28a 100644
--- a/src/devices/sound/cdp1863.cpp
+++ b/src/devices/sound/cdp1863.cpp
@@ -64,7 +64,7 @@ cdp1863_device::cdp1863_device(const machine_config &mconfig, const char *tag, d
void cdp1863_device::device_start()
{
// create sound stream
- m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_stream = stream_alloc(0, 1, SAMPLE_RATE_OUTPUT_ADAPTIVE);
// register for state saving
save_item(NAME(m_clock1));
@@ -81,20 +81,15 @@ void cdp1863_device::device_start()
// our sound stream
//-------------------------------------------------
-void cdp1863_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void cdp1863_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- // reset the output stream
- memset(outputs[0], 0, samples * sizeof(*outputs[0]));
-
- int16_t signal = m_signal;
- stream_sample_t *buffer = outputs[0];
-
- memset( buffer, 0, samples * sizeof(*buffer) );
+ stream_buffer::sample_t signal = m_signal;
+ auto &buffer = outputs[0];
if (m_oe)
{
double frequency;
- int rate = machine().sample_rate() / 2;
+ int rate = buffer.sample_rate() / 2;
// get progress through wave
int incr = m_incr;
@@ -112,16 +107,16 @@ void cdp1863_device::sound_stream_update(sound_stream &stream, stream_sample_t *
if (signal < 0)
{
- signal = -0x7fff;
+ signal = -1.0;
}
else
{
- signal = 0x7fff;
+ signal = 1.0;
}
- while( samples-- > 0 )
+ for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
{
- *buffer++ = signal;
+ buffer.put(sampindex, signal);
incr -= frequency;
while( incr < 0 )
{
@@ -134,6 +129,8 @@ void cdp1863_device::sound_stream_update(sound_stream &stream, stream_sample_t *
m_incr = incr;
m_signal = signal;
}
+ else
+ buffer.fill(0);
}
diff --git a/src/devices/sound/cdp1863.h b/src/devices/sound/cdp1863.h
index e44b65a6f9d..ec0706e9a7c 100644
--- a/src/devices/sound/cdp1863.h
+++ b/src/devices/sound/cdp1863.h
@@ -54,7 +54,7 @@ protected:
virtual void device_start() override;
// internal callbacks
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
sound_stream *m_stream;
@@ -65,7 +65,7 @@ private:
// sound state
int m_oe; // output enable
int m_latch; // sound latch
- int16_t m_signal; // current signal
+ stream_buffer::sample_t m_signal;// current signal
int m_incr; // initial wave state
};
diff --git a/src/devices/sound/cdp1864.cpp b/src/devices/sound/cdp1864.cpp
index ba026792c49..e8168004811 100644
--- a/src/devices/sound/cdp1864.cpp
+++ b/src/devices/sound/cdp1864.cpp
@@ -119,7 +119,7 @@ void cdp1864_device::device_start()
initialize_palette();
// create sound stream
- m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_stream = stream_alloc(0, 1, SAMPLE_RATE_OUTPUT_ADAPTIVE);
// allocate timers
m_int_timer = timer_alloc(TIMER_INT);
@@ -257,36 +257,31 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para
// our sound stream
//-------------------------------------------------
-void cdp1864_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void cdp1864_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- // reset the output stream
- memset(outputs[0], 0, samples * sizeof(*outputs[0]));
-
- int16_t signal = m_signal;
- stream_sample_t *buffer = outputs[0];
-
- memset( buffer, 0, samples * sizeof(*buffer) );
+ stream_buffer::sample_t signal = m_signal;
+ auto &buffer = outputs[0];
if (m_aoe)
{
double frequency = unscaled_clock() / 8 / 4 / (m_latch + 1) / 2;
- int rate = machine().sample_rate() / 2;
+ int rate = buffer.sample_rate() / 2;
/* get progress through wave */
int incr = m_incr;
if (signal < 0)
{
- signal = -0x7fff;
+ signal = -1.0;
}
else
{
- signal = 0x7fff;
+ signal = 1.0;
}
- while( samples-- > 0 )
+ for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
{
- *buffer++ = signal;
+ buffer.put(sampindex, signal);
incr -= frequency;
while( incr < 0 )
{
@@ -299,6 +294,8 @@ void cdp1864_device::sound_stream_update(sound_stream &stream, stream_sample_t *
m_incr = incr;
m_signal = signal;
}
+ else
+ buffer.fill(0);
}
diff --git a/src/devices/sound/cdp1864.h b/src/devices/sound/cdp1864.h
index 54c8f3b8ab2..6c589128ef7 100644
--- a/src/devices/sound/cdp1864.h
+++ b/src/devices/sound/cdp1864.h
@@ -115,7 +115,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// internal callbacks
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
enum
@@ -157,7 +157,7 @@ private:
// sound state
int m_aoe; // audio on
int m_latch; // sound latch
- int16_t m_signal; // current signal
+ stream_buffer::sample_t m_signal; // current signal
int m_incr; // initial wave state
// timers
diff --git a/src/devices/sound/cdp1869.cpp b/src/devices/sound/cdp1869.cpp
index 02977b6d860..98580d7ae54 100644
--- a/src/devices/sound/cdp1869.cpp
+++ b/src/devices/sound/cdp1869.cpp
@@ -400,7 +400,7 @@ void cdp1869_device::device_start()
m_bkg = 0;
// create sound stream
- m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_stream = stream_alloc(0, 1, SAMPLE_RATE_OUTPUT_ADAPTIVE);
// initialize other
m_tonediv = 0;
@@ -510,36 +510,33 @@ void cdp1869_device::cdp1869_palette(palette_device &palette) const
// our sound stream
//-------------------------------------------------
-void cdp1869_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void cdp1869_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- // reset the output stream
- memset(outputs[0], 0, samples * sizeof(*outputs[0]));
-
- int16_t signal = m_signal;
- stream_sample_t *buffer = outputs[0];
+ stream_buffer::sample_t signal = m_signal;
+ auto &buffer = outputs[0];
if (!m_toneoff && m_toneamp)
{
double frequency = (clock() / 2) / (512 >> m_tonefreq) / (m_tonediv + 1);
// double amplitude = m_toneamp * ((0.78*5) / 15);
- int rate = machine().sample_rate() / 2;
+ int rate = buffer.sample_rate() / 2;
/* get progress through wave */
int incr = m_incr;
if (signal < 0)
{
- signal = -(m_toneamp * (0x07fff / 15));
+ signal = -(stream_buffer::sample_t(m_toneamp) / 15.0);
}
else
{
- signal = m_toneamp * (0x07fff / 15);
+ signal = stream_buffer::sample_t(m_toneamp) / 15.0;
}
- while( samples-- > 0 )
+ for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
{
- *buffer++ = signal;
+ buffer.put(sampindex, signal);
incr -= frequency;
while( incr < 0 )
{
@@ -552,6 +549,8 @@ void cdp1869_device::sound_stream_update(sound_stream &stream, stream_sample_t *
m_incr = incr;
m_signal = signal;
}
+ else
+ buffer.fill(0);
/*
if (!m_wnoff)
{
diff --git a/src/devices/sound/cdp1869.h b/src/devices/sound/cdp1869.h
index be366a8d029..dc9c1501ea0 100644
--- a/src/devices/sound/cdp1869.h
+++ b/src/devices/sound/cdp1869.h
@@ -216,7 +216,7 @@ protected:
virtual space_config_vector memory_space_config() const override;
// device_sound_interface callbacks
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
inline bool is_ntsc();
inline uint8_t read_page_ram_byte(offs_t address);
@@ -264,7 +264,7 @@ private:
uint16_t m_hma; // home memory address
// sound state
- int16_t m_signal; // current signal
+ stream_buffer::sample_t m_signal; // current signal
int m_incr; // initial wave state
int m_toneoff; // tone off
int m_wnoff; // white noise off
diff --git a/src/devices/sound/cem3394.cpp b/src/devices/sound/cem3394.cpp
index 60381d97723..5b288d2d700 100644
--- a/src/devices/sound/cem3394.cpp
+++ b/src/devices/sound/cem3394.cpp
@@ -19,23 +19,36 @@
#include <algorithm>
-/* waveform generation parameters */
+// use 0.25 as the base volume for pulses
+static constexpr double PULSE_VOLUME = 0.25;
+
+// sawtooth is 27% larger than pulses
+static constexpr double SAWTOOTH_VOLUME = PULSE_VOLUME * 1.27f;
+
+// triangle is 27% larger than sawtooth
+static constexpr double TRIANGLE_VOLUME = SAWTOOTH_VOLUME * 1.27f;
+
+// external input is unknown but let's make it the same as the pulse
+static constexpr double EXTERNAL_VOLUME = PULSE_VOLUME;
+
+
+// waveform generation parameters
#define ENABLE_PULSE 1
#define ENABLE_TRIANGLE 1
#define ENABLE_SAWTOOTH 1
#define ENABLE_EXTERNAL 1
-/* pulse shaping parameters */
-/* examples: */
-/* hat trick - skidding ice sounds too loud if minimum width is too big */
-/* snake pit - melody during first level too soft if minimum width is too small */
-/* snake pit - bonus counter at the end of level */
-/* snacks'n jaxson - laugh at end of level is too soft if minimum width is too small */
+// pulse shaping parameters
+// examples:
+// hat trick - skidding ice sounds too loud if minimum width is too big
+// snake pit - melody during first level too soft if minimum width is too small
+// snake pit - bonus counter at the end of level
+// snacks'n jaxson - laugh at end of level is too soft if minimum width is too small
#define LIMIT_WIDTH 1
-#define MINIMUM_WIDTH 0.25
-#define MAXIMUM_WIDTH 0.75
+#define MINIMUM_WIDTH 0.2
+#define MAXIMUM_WIDTH 0.8
/********************************************************************************
@@ -97,13 +110,6 @@
#define WAVE_SAWTOOTH 2
#define WAVE_PULSE 4
-// keep lots of fractional bits
-#define FRACTION_BITS 28
-#define FRACTION_ONE (1 << FRACTION_BITS)
-#define FRACTION_ONE_D ((double)(1 << FRACTION_BITS))
-#define FRACTION_MASK (FRACTION_ONE - 1)
-#define FRACTION_MULT(a,b) (((a) >> (FRACTION_BITS / 2)) * ((b) >> (FRACTION_BITS - FRACTION_BITS / 2)))
-
// device type definition
DEFINE_DEVICE_TYPE(CEM3394, cem3394_device, "cem3394", "CEM3394 Synthesizer Voice")
@@ -116,208 +122,143 @@ DEFINE_DEVICE_TYPE(CEM3394, cem3394_device, "cem3394", "CEM3394 Synthesizer Voic
// cem3394_device - constructor
//-------------------------------------------------
-cem3394_device::cem3394_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, CEM3394, tag, owner, clock),
- device_sound_interface(mconfig, *this),
- m_ext_cb(*this),
- m_stream(nullptr),
- m_vco_zero_freq(0.0),
- m_filter_zero_freq(0.0),
- m_wave_select(0),
- m_volume(0),
- m_mixer_internal(0),
- m_mixer_external(0),
- m_position(0),
- m_step(0),
- m_filter_position(0),
- m_filter_step(0),
- m_modulation_depth(0),
- m_last_ext(0),
- m_pulse_width(0),
- m_inv_sample_rate(0.0),
- m_sample_rate(0),
- m_mixer_buffer(nullptr),
- m_external_buffer(nullptr)
+cem3394_device::cem3394_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
+ device_t(mconfig, CEM3394, tag, owner, clock),
+ device_sound_interface(mconfig, *this),
+ m_stream(nullptr),
+ m_vco_zero_freq(500.0),
+ m_filter_zero_freq(1300.0),
+ m_values{0},
+ m_wave_select(0),
+ m_volume(0),
+ m_mixer_internal(0),
+ m_mixer_external(0),
+ m_vco_position(0),
+ m_vco_step(0),
+ m_filter_frequency(1300),
+ m_filter_modulation(0),
+ m_filter_resonance(0),
+ m_filter_in{0},
+ m_filter_out{0},
+ m_pulse_width(0),
+ m_inv_sample_rate(1.0/48000.0)
{
- std::fill(std::begin(m_values), std::end(m_values), 0.0);
}
//-------------------------------------------------
-// sound_stream_update - generate sound to the mix buffer in mono
+// sound_stream_update - generate sound to the mix
+// buffer in mono
//-------------------------------------------------
-void cem3394_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+double cem3394_device::filter(double input, double cutoff)
{
- int int_volume = (m_volume * m_mixer_internal) / 256;
- int ext_volume = (m_volume * m_mixer_external) / 256;
- uint32_t step = m_step, position, end_position = 0;
- stream_sample_t *buffer = outputs[0];
- int16_t *mix, *ext;
- int i;
-
- /* external volume is effectively 0 if no external function */
- if (m_ext_cb.isnull() || !ENABLE_EXTERNAL)
- ext_volume = 0;
-
- /* adjust the volume for the filter */
- if (step > m_filter_step)
- int_volume /= step - m_filter_step;
-
- /* bail if nothing's going on */
- if (int_volume == 0 && ext_volume == 0)
+ // clamp cutoff to useful range, 20Hz-20kHz
+ cutoff = std::max(std::min(cutoff, 20000.0), 20.0);
+
+ // clamp resonance to 0.95 to prevent infinite gain
+ double r = 4.0 * std::min(m_filter_resonance, 0.95);
+
+ double g = 2 * M_PI * cutoff;
+ double zc = g / tan(g/2 * m_inv_sample_rate);
+
+ double gzc = zc / g;
+ double gzc2 = gzc * gzc;
+ double gzc3 = gzc2 * gzc;
+ double gzc4 = gzc3 * gzc;
+ double r1 = 1 + r;
+
+ double a0 = r1;
+ double a1 = 4 * r1;
+ double a2 = 6 * r1;
+ double a3 = 4 * r1;
+ double a4 = r1;
+
+ double b0 = r1 + 4 * gzc + 6 * gzc2 + 4 * gzc3 + gzc4;
+ double b1 = 4 * (r1 + 2 * gzc - 2 * gzc3 - gzc4);
+ double b2 = 6 * (r1 - 2 * gzc2 + gzc4);
+ double b3 = 4 * (r1 - 2 * gzc + 2 * gzc3 - gzc4);
+ double b4 = r1 - 4 * gzc + 6 * gzc2 - 4 * gzc3 + gzc4;
+
+ double output = (input * a0
+ + m_filter_in[0] * a1 + m_filter_in[1] * a2 + m_filter_in[2] * a3 + m_filter_in[3] * a4
+ - m_filter_out[0] * b1 - m_filter_out[1] * b2 - m_filter_out[2] * b3 - m_filter_out[3] * b4) / b0;
+
+// sound_assert(!std::isnan(output));
+// sound_assert(output >= -1.5 && output <= 1.5);
+ if (output < -1.5 || output > 1.5 || std::isnan(output))
{
- memset(buffer, 0, sizeof(*buffer) * samples);
- return;
+ if (m_filter_out[0] > -1.5 && m_filter_out[0] < 1.5)
+ printf("cutoff: %6.0f res: %.5f output: %.5f\n", cutoff, m_filter_resonance, output);
}
+ if (std::isnan(output)) output = 0;
+
+ m_filter_in[3] = m_filter_in[2];
+ m_filter_in[2] = m_filter_in[1];
+ m_filter_in[1] = m_filter_in[0];
+ m_filter_in[0] = input;
+
+ m_filter_out[3] = m_filter_out[2];
+ m_filter_out[2] = m_filter_out[1];
+ m_filter_out[1] = m_filter_out[0];
+ m_filter_out[0] = output;
+
+ if (output < -1.0)
+ output = -1.0;
+ else if (output > 1.0)
+ output = 1.0;
+ return output;
+}
- /* if there's external stuff, fetch and process it now */
- if (ext_volume != 0)
- {
- uint32_t fposition = m_filter_position, fstep = m_filter_step, depth;
- int16_t last_ext = m_last_ext;
-
- /* fetch the external data */
- m_ext_cb(samples, m_external_buffer.get());
-
- /* compute the modulation depth, and adjust fstep to the maximum frequency */
- /* we lop off 13 bits of depth so that we can multiply by stepadjust, below, */
- /* which has 13 bits of precision */
- depth = FRACTION_MULT(fstep, m_modulation_depth);
- fstep += depth;
- depth >>= 13;
-
- /* "apply" the filter: note this is pretty cheesy; it basically just downsamples the
- external sample to filter_freq by allowing only 2 transitions for every cycle */
- for (i = 0, ext = m_external_buffer.get(), position = m_position; i < samples; i++, ext++)
- {
- uint32_t newposition;
- int32_t stepadjust;
-
- /* update the position and compute the adjustment from a triangle wave */
- if (position & (1 << (FRACTION_BITS - 1)))
- stepadjust = 0x2000 - ((position >> (FRACTION_BITS - 14)) & 0x1fff);
- else
- stepadjust = (position >> (FRACTION_BITS - 14)) & 0x1fff;
- position += step;
-
- /* if we cross a half-step boundary, allow the next byte of the external input */
- newposition = fposition + fstep - (stepadjust * depth);
- if ((newposition ^ fposition) & ~(FRACTION_MASK >> 1))
- last_ext = *ext;
- else
- *ext = last_ext;
- fposition = newposition & FRACTION_MASK;
- }
+void cem3394_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+{
+ auto &external = inputs[0];
+ auto &buffer = outputs[0];
- /* update the final filter values */
- m_filter_position = fposition;
- m_last_ext = last_ext;
- }
+ if (m_wave_select == 0 && m_mixer_external == 0)
+ logerror("%f V didn't cut it\n", m_values[WAVE_SELECT]);
- /* if there's internal stuff, generate it */
- if (int_volume != 0)
+ // loop over samples
+ for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
{
- if (m_wave_select == 0 && !ext_volume)
- logerror("%f V didn't cut it\n", m_values[WAVE_SELECT]);
-
- /* handle the pulse component; it maxes out at 0x1932, which is 27% smaller than */
- /* the sawtooth (since the value is constant, this is the best place to have an */
- /* odd value for volume) */
- if (ENABLE_PULSE && (m_wave_select & WAVE_PULSE))
- {
- uint32_t pulse_width = m_pulse_width;
+ // get the current VCO position and step it forward
+ double vco_position = m_vco_position;
+ m_vco_position += m_vco_step;
- /* if the width is wider than the step, we're guaranteed to hit it once per cycle */
- if (pulse_width >= step)
- {
- for (i = 0, mix = m_mixer_buffer.get(), position = m_position; i < samples; i++, mix++)
- {
- if (position < pulse_width)
- *mix = 0x1932;
- else
- *mix = 0x0000;
- position = (position + step) & FRACTION_MASK;
- }
- }
-
- /* otherwise, we compute a volume and watch for cycle boundary crossings */
- else
- {
- int16_t volume = 0x1932 * pulse_width / step;
- for (i = 0, mix = m_mixer_buffer.get(), position = m_position; i < samples; i++, mix++)
- {
- uint32_t newposition = position + step;
- if ((newposition ^ position) & ~FRACTION_MASK)
- *mix = volume;
- else
- *mix = 0x0000;
- position = newposition & FRACTION_MASK;
- }
- }
- end_position = position;
- }
+ // clamp VCO position to a fraction
+ if (m_vco_position >= 1.0)
+ m_vco_position -= floor(m_vco_position);
- /* otherwise, clear the mixing buffer */
- else
- memset(m_mixer_buffer.get(), 0, sizeof(int16_t) * samples);
+ // handle the pulse component; might need some more thought here
+ double result = 0;
+ if (ENABLE_PULSE && (m_wave_select & WAVE_PULSE))
+ if (vco_position < m_pulse_width)
+ result += PULSE_VOLUME * m_mixer_internal;
- /* handle the sawtooth component; it maxes out at 0x2000, which is 27% larger */
- /* than the pulse */
+ // handle the sawtooth component
if (ENABLE_SAWTOOTH && (m_wave_select & WAVE_SAWTOOTH))
- {
- for (i = 0, mix = m_mixer_buffer.get(), position = m_position; i < samples; i++, mix++)
- {
- *mix += ((position >> (FRACTION_BITS - 14)) & 0x3fff) - 0x2000;
- position += step;
- }
- end_position = position & FRACTION_MASK;
- }
+ result += SAWTOOTH_VOLUME * m_mixer_internal * vco_position;
- /* handle the triangle component; it maxes out at 0x2800, which is 25% larger */
- /* than the sawtooth (should be 27% according to the specs, but 25% saves us */
- /* a multiplication) */
+ // always compute the triangle waveform which is also used for filter modulation
+ double triangle = 2.0 * vco_position;
+ if (triangle > 1.0)
+ triangle = 2.0 - triangle;
+
+ // handle the triangle component
if (ENABLE_TRIANGLE && (m_wave_select & WAVE_TRIANGLE))
- {
- for (i = 0, mix = m_mixer_buffer.get(), position = m_position; i < samples; i++, mix++)
- {
- int16_t value;
- if (position & (1 << (FRACTION_BITS - 1)))
- value = 0x2000 - ((position >> (FRACTION_BITS - 14)) & 0x1fff);
- else
- value = (position >> (FRACTION_BITS - 14)) & 0x1fff;
- *mix += value + (value >> 2);
- position += step;
- }
- end_position = position & FRACTION_MASK;
- }
+ result += TRIANGLE_VOLUME * m_mixer_internal * triangle;
- /* update the final position */
- m_position = end_position;
- }
+ // compute extension input (for Bally/Sente this is the noise)
+ if (ENABLE_EXTERNAL)
+ result += EXTERNAL_VOLUME * m_mixer_external * external.get(sampindex);
- /* mix it down */
- mix = m_mixer_buffer.get();
- ext = m_external_buffer.get();
- {
- /* internal + external */
- if (ext_volume != 0 && int_volume != 0)
- {
- for (i = 0; i < samples; i++, mix++, ext++)
- *buffer++ = (*mix * int_volume + *ext * ext_volume) / 128;
- }
- /* internal only */
- else if (int_volume != 0)
- {
- for (i = 0; i < samples; i++, mix++)
- *buffer++ = *mix * int_volume / 128;
- }
- /* external only */
- else
- {
- for (i = 0; i < samples; i++, ext++)
- *buffer++ = *ext * ext_volume / 128;
- }
+ // compute the modulated filter frequency and apply the filter
+ // modulation tracks the VCO triangle
+ double filter_freq = m_filter_frequency * (1 + m_filter_modulation * (triangle - 0.5));
+ result = filter(result, filter_freq);
+
+ // write the sample
+ buffer.put(sampindex, result * m_volume);
}
}
@@ -328,51 +269,49 @@ void cem3394_device::sound_stream_update(sound_stream &stream, stream_sample_t *
void cem3394_device::device_start()
{
- /* copy global parameters */
- m_sample_rate = SAMPLE_RATE;
- m_inv_sample_rate = 1.0 / (double)m_sample_rate;
-
- /* allocate stream channels, 1 per chip */
- m_stream = stream_alloc(0, 1, m_sample_rate);
-
- m_ext_cb.resolve();
+ // compute a sample rate
+ // VCO can range up to pow(2, 4.0/.75) = ~40.3 * zero-voltage-freq (ZVF)
+ int sample_rate = m_vco_zero_freq * pow(2, 4.0 / 0.75) * 5;
+ m_inv_sample_rate = 1.0 / double(sample_rate);
- /* allocate memory for a mixer buffer and external buffer (1 second should do it!) */
- m_mixer_buffer = std::make_unique<int16_t[]>(m_sample_rate);
- m_external_buffer = std::make_unique<int16_t[]>(m_sample_rate);
+ // allocate stream channels, 1 per chip, with one external input
+ m_stream = stream_alloc(1, 1, sample_rate);
save_item(NAME(m_values));
save_item(NAME(m_wave_select));
+
save_item(NAME(m_volume));
save_item(NAME(m_mixer_internal));
save_item(NAME(m_mixer_external));
- save_item(NAME(m_position));
- save_item(NAME(m_step));
- save_item(NAME(m_filter_position));
- save_item(NAME(m_filter_step));
- save_item(NAME(m_modulation_depth));
- save_item(NAME(m_last_ext));
+
+ save_item(NAME(m_vco_position));
+ save_item(NAME(m_vco_step));
+
+ save_item(NAME(m_filter_frequency));
+ save_item(NAME(m_filter_modulation));
+ save_item(NAME(m_filter_resonance));
+
save_item(NAME(m_pulse_width));
}
double cem3394_device::compute_db(double voltage)
{
- /* assumes 0.0 == full off, 4.0 == full on, with linear taper, as described in the datasheet */
+ // assumes 0.0 == full off, 4.0 == full on, with linear taper, as described in the datasheet
- /* above 4.0, maximum volume */
+ // above 4.0, maximum volume
if (voltage >= 4.0)
return 0.0;
- /* below 0.0, minimum volume */
+ // below 0.0, minimum volume
else if (voltage <= 0.0)
return 90.0;
- /* between 2.5 and 4.0, linear from 20dB to 0dB */
+ // between 2.5 and 4.0, linear from 20dB to 0dB
else if (voltage >= 2.5)
return (4.0 - voltage) * (1.0 / 1.5) * 20.0;
- /* between 0.0 and 2.5, exponential to 20dB */
+ // between 0.0 and 2.5, exponential to 20dB
else
{
double temp = 20.0 * pow(2.0, 2.5 - voltage);
@@ -382,33 +321,33 @@ double cem3394_device::compute_db(double voltage)
}
-uint32_t cem3394_device::compute_db_volume(double voltage)
+stream_buffer::sample_t cem3394_device::compute_db_volume(double voltage)
{
double temp;
- /* assumes 0.0 == full off, 4.0 == full on, with linear taper, as described in the datasheet */
+ // assumes 0.0 == full off, 4.0 == full on, with linear taper, as described in the datasheet
- /* above 4.0, maximum volume */
+ // above 4.0, maximum volume
if (voltage >= 4.0)
- return 256;
+ return 1.0;
- /* below 0.0, minimum volume */
+ // below 0.0, minimum volume
else if (voltage <= 0.0)
return 0;
- /* between 2.5 and 4.0, linear from 20dB to 0dB */
+ // between 2.5 and 4.0, linear from 20dB to 0dB
else if (voltage >= 2.5)
temp = (4.0 - voltage) * (1.0 / 1.5) * 20.0;
- /* between 0.0 and 2.5, exponential to 20dB */
+ // between 0.0 and 2.5, exponential to 20dB
else
{
temp = 20.0 * pow(2.0, 2.5 - voltage);
if (temp < 50.0) return 0;
}
- /* convert from dB to volume and return */
- return (uint32_t)(256.0 * pow(0.891251, temp));
+ // convert from dB to volume and return
+ return powf(0.891251f, temp);
}
@@ -416,24 +355,24 @@ void cem3394_device::set_voltage(int input, double voltage)
{
double temp;
- /* don't do anything if no change */
+ // don't do anything if no change
if (voltage == m_values[input])
return;
m_values[input] = voltage;
- /* update the stream first */
+ // update the stream first
m_stream->update();
- /* switch off the input */
+ // switch off the input
switch (input)
{
- /* frequency varies from -4.0 to +4.0, at 0.75V/octave */
+ // frequency varies from -4.0 to +4.0, at 0.75V/octave
case VCO_FREQUENCY:
temp = m_vco_zero_freq * pow(2.0, -voltage * (1.0 / 0.75));
- m_step = (uint32_t)(temp * m_inv_sample_rate * FRACTION_ONE_D);
+ m_vco_step = temp * m_inv_sample_rate;
break;
- /* wave select determines triangle/sawtooth enable */
+ // wave select determines triangle/sawtooth enable
case WAVE_SELECT:
m_wave_select &= ~(WAVE_TRIANGLE | WAVE_SAWTOOTH);
if (voltage >= -0.5 && voltage <= -0.2)
@@ -444,7 +383,7 @@ void cem3394_device::set_voltage(int input, double voltage)
m_wave_select |= WAVE_SAWTOOTH;
break;
- /* pulse width determines duty cycle; 0.0 means 0%, 2.0 means 100% */
+ // pulse width determines duty cycle; 0.0 means 0%, 2.0 means 100%
case PULSE_WIDTH:
if (voltage < 0.0)
{
@@ -453,21 +392,20 @@ void cem3394_device::set_voltage(int input, double voltage)
}
else
{
- temp = voltage * 0.5;
+ m_pulse_width = voltage * 0.5;
if (LIMIT_WIDTH)
- temp = MINIMUM_WIDTH + (MAXIMUM_WIDTH - MINIMUM_WIDTH) * temp;
- m_pulse_width = (uint32_t)(temp * FRACTION_ONE_D);
+ m_pulse_width = MINIMUM_WIDTH + (MAXIMUM_WIDTH - MINIMUM_WIDTH) * m_pulse_width;
m_wave_select |= WAVE_PULSE;
}
break;
- /* final gain is pretty self-explanatory; 0.0 means ~90dB, 4.0 means 0dB */
+ // final gain is pretty self-explanatory; 0.0 means ~90dB, 4.0 means 0dB
case FINAL_GAIN:
m_volume = compute_db_volume(voltage);
break;
- /* mixer balance is a pan between the external input and the internal input */
- /* 0.0 is equal parts of both; positive values favor external, negative favor internal */
+ // mixer balance is a pan between the external input and the internal input
+ // 0.0 is equal parts of both; positive values favor external, negative favor internal
case MIXER_BALANCE:
if (voltage >= 0.0)
{
@@ -481,25 +419,29 @@ void cem3394_device::set_voltage(int input, double voltage)
}
break;
- /* filter frequency varies from -4.0 to +4.0, at 0.375V/octave */
+ // filter frequency varies from -3.0 to +4.0, at 0.375V/octave
case FILTER_FREQENCY:
- temp = m_filter_zero_freq * pow(2.0, -voltage * (1.0 / 0.375));
- m_filter_step = (uint32_t)(temp * m_inv_sample_rate * FRACTION_ONE_D);
+ m_filter_frequency = m_filter_zero_freq * pow(2.0, -voltage * (1.0 / 0.375));
break;
- /* modulation depth is 0.01 at 0V and 2.0 at 3.5V; how it grows from one to the other */
- /* is still unclear at this point */
+ // modulation depth is 0.01*freq at 0V and 2.0*freq at 3.5V
case MODULATION_AMOUNT:
if (voltage < 0.0)
- m_modulation_depth = (uint32_t)(0.01 * FRACTION_ONE_D);
+ m_filter_modulation = 0.01;
else if (voltage > 3.5)
- m_modulation_depth = (uint32_t)(2.00 * FRACTION_ONE_D);
+ m_filter_modulation = 1.99;
else
- m_modulation_depth = (uint32_t)(((voltage * (1.0 / 3.5)) * 1.99 + 0.01) * FRACTION_ONE_D);
+ m_filter_modulation = (voltage * (1.0 / 3.5)) * 1.98 + 0.01;
break;
- /* this is not yet implemented */
+ // this is not yet implemented
case FILTER_RESONANCE:
+ if (voltage < 0.0)
+ m_filter_resonance = 0.0;
+ else if (voltage > 2.5)
+ m_filter_resonance = 1.0;
+ else
+ m_filter_resonance = voltage * (1.0 / 2.5);
break;
}
}
@@ -535,9 +477,9 @@ double cem3394_device::get_parameter(int input)
if (voltage < 0.0)
return 0.01;
else if (voltage > 3.5)
- return 2.0;
+ return 1.99;
else
- return (voltage * (1.0 / 3.5)) * 1.99 + 0.01;
+ return (voltage * (1.0 / 3.5)) * 1.98 + 0.01;
case FILTER_RESONANCE:
if (voltage < 0.0)
diff --git a/src/devices/sound/cem3394.h b/src/devices/sound/cem3394.h
index 40a6a2d0204..a3e5e3a85ea 100644
--- a/src/devices/sound/cem3394.h
+++ b/src/devices/sound/cem3394.h
@@ -5,14 +5,10 @@
#pragma once
-#define CEM3394_EXT_INPUT(_name) void _name(int count, short *buffer)
-
class cem3394_device : public device_t, public device_sound_interface
{
public:
- static constexpr unsigned SAMPLE_RATE = 44100*4;
-
// inputs
enum
{
@@ -26,11 +22,8 @@ public:
FINAL_GAIN
};
- typedef device_delegate<void (int count, short *buffer)> ext_input_delegate;
+ cem3394_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
- cem3394_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- template <typename... T> void set_ext_input_callback(T &&... args) { m_ext_cb.set(std::forward<T>(args)...); }
void set_vco_zero_freq(double freq) { m_vco_zero_freq = freq; }
void set_filter_zero_freq(double freq) { m_filter_zero_freq = freq; }
@@ -39,7 +32,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
public:
// Set the voltage going to a particular parameter
@@ -58,37 +51,34 @@ public:
private:
double compute_db(double voltage);
- uint32_t compute_db_volume(double voltage);
+ stream_buffer::sample_t compute_db_volume(double voltage);
private:
- ext_input_delegate m_ext_cb; /* callback to generate external samples */
-
- sound_stream *m_stream; /* our stream */
- double m_vco_zero_freq; /* frequency of VCO at 0.0V */
- double m_filter_zero_freq; /* frequency of filter at 0.0V */
+ double filter(double input, double cutoff);
- double m_values[8]; /* raw values of registers */
- uint8_t m_wave_select; /* flags which waveforms are enabled */
+ sound_stream *m_stream; // our stream
+ double m_vco_zero_freq; // frequency of VCO at 0.0V
+ double m_filter_zero_freq; // frequency of filter at 0.0V
- uint32_t m_volume; /* linear overall volume (0-256) */
- uint32_t m_mixer_internal; /* linear internal volume (0-256) */
- uint32_t m_mixer_external; /* linear external volume (0-256) */
+ double m_values[8]; // raw values of registers
+ u8 m_wave_select; // flags which waveforms are enabled
- uint32_t m_position; /* current VCO frequency position (0.FRACTION_BITS) */
- uint32_t m_step; /* per-sample VCO step (0.FRACTION_BITS) */
+ double m_volume; // linear overall volume (0-1)
+ double m_mixer_internal; // linear internal volume (0-1)
+ double m_mixer_external; // linear external volume (0-1)
- uint32_t m_filter_position; /* current filter frequency position (0.FRACTION_BITS) */
- uint32_t m_filter_step; /* per-sample filter step (0.FRACTION_BITS) */
- uint32_t m_modulation_depth; /* fraction of total by which we modulate (0.FRACTION_BITS) */
- int16_t m_last_ext; /* last external sample we read */
+ double m_vco_position; // current VCO frequency position (always < 1.0)
+ double m_vco_step; // per-sample VCO step
- uint32_t m_pulse_width; /* fractional pulse width (0.FRACTION_BITS) */
+ double m_filter_frequency; // baseline filter frequency
+ double m_filter_modulation; // depth of modulation (up to 1.0)
+ double m_filter_resonance; // depth of modulation (up to 1.0)
+ double m_filter_in[4]; // filter input history
+ double m_filter_out[4]; // filter output history
- double m_inv_sample_rate;
- int m_sample_rate;
+ double m_pulse_width; // fractional pulse width
- std::unique_ptr<int16_t[]> m_mixer_buffer;
- std::unique_ptr<int16_t[]> m_external_buffer;
+ double m_inv_sample_rate; // 1/current sample rate
};
DECLARE_DEVICE_TYPE(CEM3394, cem3394_device)
diff --git a/src/devices/sound/dac.h b/src/devices/sound/dac.h
index f1793b5f569..7a48ba80998 100644
--- a/src/devices/sound/dac.h
+++ b/src/devices/sound/dac.h
@@ -45,9 +45,10 @@ public:
};
template <unsigned bits>
-constexpr stream_sample_t dac_multiply(const double vref, const stream_sample_t code)
+constexpr stream_buffer::sample_t dac_multiply(const double vref, const s32 code)
{
- return (bits > 1) ? ((vref * code) / (1 << (bits))) : (vref * code);
+ constexpr stream_buffer::sample_t scale = 1.0 / stream_buffer::sample_t((bits > 1) ? (1 << (bits)) : 1);
+ return vref * scale * stream_buffer::sample_t(code);
}
template <unsigned bits>
@@ -62,12 +63,12 @@ protected:
}
sound_stream * m_stream;
- stream_sample_t m_code;
+ s32 m_code;
const double m_gain;
- inline void setCode(stream_sample_t code)
+ inline void setCode(s32 code)
{
- code &= ~(~std::make_unsigned_t<stream_sample_t>(0) << bits);
+ code &= ~(~u32(0) << bits);
if (m_code != code)
{
m_stream->update();
@@ -75,7 +76,7 @@ protected:
}
}
- virtual void sound_stream_update_tag(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) = 0;
+ virtual void sound_stream_update_tag(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) = 0;
};
template <unsigned bits>
@@ -84,14 +85,14 @@ class dac_code_binary : protected dac_code<bits>
protected:
using dac_code<bits>::dac_code;
- virtual void sound_stream_update_tag(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override
+ virtual void sound_stream_update_tag(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override
{
- for (int samp = 0; samp < samples; samp++)
+ for (int samp = 0; samp < outputs[0].samples(); samp++)
{
- double const vref_pos = inputs[DAC_VREF_POS_INPUT][samp] * this->m_gain;
- double const vref_neg = inputs[DAC_VREF_NEG_INPUT][samp] * this->m_gain;
- stream_sample_t const vout = vref_neg + dac_multiply<bits>(vref_pos - vref_neg, this->m_code);
- outputs[0][samp] = vout;
+ double const vref_pos = inputs[DAC_VREF_POS_INPUT].get(samp) * this->m_gain;
+ double const vref_neg = inputs[DAC_VREF_NEG_INPUT].get(samp) * this->m_gain;
+ stream_buffer::sample_t const vout = vref_neg + dac_multiply<bits>(vref_pos - vref_neg, this->m_code);
+ outputs[0].put(samp, vout);
}
}
};
@@ -102,24 +103,24 @@ class dac_code_ones_complement : protected dac_code<bits>
protected:
using dac_code<bits>::dac_code;
- virtual void sound_stream_update_tag(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override
+ virtual void sound_stream_update_tag(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override
{
if (this->m_code & (1 << (bits - 1)))
{
- for (int samp = 0; samp < samples; samp++)
+ for (int samp = 0; samp < outputs[0].samples(); samp++)
{
- double const vref_neg = inputs[DAC_VREF_NEG_INPUT][samp] * this->m_gain;
- stream_sample_t const vout = dac_multiply<bits - 1>(vref_neg, this->m_code ^ ~(~0U << bits));
- outputs[0][samp] = vout;
+ double const vref_neg = inputs[DAC_VREF_NEG_INPUT].get(samp) * this->m_gain;
+ stream_buffer::sample_t const vout = dac_multiply<bits - 1>(vref_neg, this->m_code ^ ~(~0U << bits));
+ outputs[0].put(samp, vout);
}
}
else
{
- for (int samp = 0; samp < samples; samp++)
+ for (int samp = 0; samp < outputs[0].samples(); samp++)
{
- double const vref_pos = inputs[DAC_VREF_POS_INPUT][samp] * this->m_gain;
- stream_sample_t const vout = dac_multiply<bits - 1>(vref_pos, this->m_code);
- outputs[0][samp] = vout;
+ double const vref_pos = inputs[DAC_VREF_POS_INPUT].get(samp) * this->m_gain;
+ stream_buffer::sample_t const vout = dac_multiply<bits - 1>(vref_pos, this->m_code);
+ outputs[0].put(samp, vout);
}
}
}
@@ -131,14 +132,14 @@ class dac_code_twos_complement : protected dac_code<bits>
protected:
using dac_code<bits>::dac_code;
- virtual void sound_stream_update_tag(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override
+ virtual void sound_stream_update_tag(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override
{
- for (int samp = 0; samp < samples; samp++)
+ for (int samp = 0; samp < outputs[0].samples(); samp++)
{
- double const vref_pos = inputs[DAC_VREF_POS_INPUT][samp] * this->m_gain;
- double const vref_neg = inputs[DAC_VREF_NEG_INPUT][samp] * this->m_gain;
- stream_sample_t const vout = vref_neg + dac_multiply<bits>(vref_pos - vref_neg, this->m_code ^ (1 << (bits - 1)));
- outputs[0][samp] = vout;
+ double const vref_pos = inputs[DAC_VREF_POS_INPUT].get(samp) * this->m_gain;
+ double const vref_neg = inputs[DAC_VREF_NEG_INPUT].get(samp) * this->m_gain;
+ stream_buffer::sample_t const vout = vref_neg + dac_multiply<bits>(vref_pos - vref_neg, this->m_code ^ (1 << (bits - 1)));
+ outputs[0].put(samp, vout);
}
}
};
@@ -149,24 +150,24 @@ class dac_code_sign_magntitude : protected dac_code<bits>
protected:
using dac_code<bits>::dac_code;
- virtual void sound_stream_update_tag(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override
+ virtual void sound_stream_update_tag(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override
{
if (this->m_code & (1 << (bits - 1)))
{
- for (int samp = 0; samp < samples; samp++)
+ for (int samp = 0; samp < outputs[0].samples(); samp++)
{
- double const vref_neg = inputs[DAC_VREF_NEG_INPUT][samp] * this->m_gain;
- stream_sample_t const vout = dac_multiply<bits - 1>(vref_neg, this->m_code ^ (1 << (bits - 1)));
- outputs[0][samp] = vout;
+ double const vref_neg = inputs[DAC_VREF_NEG_INPUT].get(samp) * this->m_gain;
+ stream_buffer::sample_t const vout = dac_multiply<bits - 1>(vref_neg, this->m_code ^ (1 << (bits - 1)));
+ outputs[0].put(samp, vout);
}
}
else
{
- for (int samp = 0; samp < samples; samp++)
+ for (int samp = 0; samp < outputs[0].samples(); samp++)
{
- double const vref_pos = inputs[DAC_VREF_POS_INPUT][samp] * this->m_gain;
- stream_sample_t const vout = dac_multiply<bits - 1>(vref_pos, this->m_code);
- outputs[0][samp] = vout;
+ double const vref_pos = inputs[DAC_VREF_POS_INPUT].get(samp) * this->m_gain;
+ stream_buffer::sample_t const vout = dac_multiply<bits - 1>(vref_pos, this->m_code);
+ outputs[0].put(samp, vout);
}
}
}
@@ -193,9 +194,9 @@ protected:
save_item(NAME(this->m_code));
}
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override
{
- _dac_code::sound_stream_update_tag(stream, inputs, outputs, samples);
+ _dac_code::sound_stream_update_tag(stream, inputs, outputs);
}
};
diff --git a/src/devices/sound/dac76.cpp b/src/devices/sound/dac76.cpp
index 846ae2306bd..bbeb5728577 100644
--- a/src/devices/sound/dac76.cpp
+++ b/src/devices/sound/dac76.cpp
@@ -51,7 +51,7 @@ dac76_device::dac76_device(const machine_config &mconfig, const char *tag, devic
void dac76_device::device_start()
{
// create sound stream
- m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate() * 8);
+ m_stream = stream_alloc(0, 1, machine().sample_rate() * 8);
// register for save states
save_item(NAME(m_chord));
@@ -75,7 +75,7 @@ void dac76_device::device_reset()
// our sound stream
//-------------------------------------------------
-void dac76_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void dac76_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
// get current output level
int step_size = (2 << m_chord);
@@ -84,9 +84,6 @@ void dac76_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
// apply sign bit
vout *= (m_sb ? +1 : -1);
- // range is 0-8031, normalize to about 0-32768 range
- vout *= 4;
-
- for (int i = 0; i < samples; i++)
- outputs[0][i] = vout;
+ // range is 0-8031, normalize to 0-1 range
+ outputs[0].fill(stream_buffer::sample_t(vout) * (1.0 / 8031.0));
}
diff --git a/src/devices/sound/dac76.h b/src/devices/sound/dac76.h
index f986b319917..74f51690082 100644
--- a/src/devices/sound/dac76.h
+++ b/src/devices/sound/dac76.h
@@ -57,7 +57,7 @@ protected:
virtual void device_start() override;
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 sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
static constexpr int m_level[8] = { 0, 33, 99, 231, 495, 1023, 2079, 4191 };
diff --git a/src/devices/sound/dave.cpp b/src/devices/sound/dave.cpp
index bac697ca619..f26ea891879 100644
--- a/src/devices/sound/dave.cpp
+++ b/src/devices/sound/dave.cpp
@@ -122,7 +122,7 @@ void dave_device::device_start()
the volumes are mixed internally and output as left and right volume */
/* 3 tone channels + 1 noise channel */
- m_sound_stream_var = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate());
+ m_sound_stream_var = stream_alloc(0, 2, machine().sample_rate());
}
@@ -190,9 +190,8 @@ device_memory_interface::space_config_vector dave_device::memory_space_config()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void dave_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void dave_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *buffer1, *buffer2;
/* 0 = channel 0 left volume, 1 = channel 0 right volume,
2 = channel 1 left volume, 3 = channel 1 right volume,
4 = channel 2 left volume, 5 = channel 2 right volume
@@ -203,10 +202,11 @@ void dave_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
//logerror("sound update!\n");
- buffer1 = outputs[0];
- buffer2 = outputs[1];
+ auto &buffer1 = outputs[0];
+ auto &buffer2 = outputs[1];
- while (samples)
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / (4.0 * 32768.0);
+ for (int sampindex = 0; sampindex < buffer1.samples(); sampindex++)
{
int vol[4];
@@ -261,13 +261,11 @@ void dave_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
output_volumes[6] = ((m_level[3] & m_level_and[6]) | m_level_or[6]) & m_mame_volumes[3];
output_volumes[7] = ((m_level[3] & m_level_and[7]) | m_level_or[7]) & m_mame_volumes[7];
- left_volume = (output_volumes[0] + output_volumes[2] + output_volumes[4] + output_volumes[6])>>2;
- right_volume = (output_volumes[1] + output_volumes[3] + output_volumes[5] + output_volumes[7])>>2;
+ left_volume = output_volumes[0] + output_volumes[2] + output_volumes[4] + output_volumes[6];
+ right_volume = output_volumes[1] + output_volumes[3] + output_volumes[5] + output_volumes[7];
- *(buffer1++) = left_volume;
- *(buffer2++) = right_volume;
-
- samples--;
+ buffer1.put(sampindex, stream_buffer::sample_t(left_volume) * sample_scale);
+ buffer2.put(sampindex, stream_buffer::sample_t(right_volume) * sample_scale);
}
}
diff --git a/src/devices/sound/dave.h b/src/devices/sound/dave.h
index bd5cb6a8445..7d2da120658 100644
--- a/src/devices/sound/dave.h
+++ b/src/devices/sound/dave.h
@@ -47,7 +47,7 @@ protected:
virtual space_config_vector memory_space_config() const override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
uint8_t program_r(offs_t offset);
void program_w(offs_t offset, uint8_t data);
diff --git a/src/devices/sound/digitalk.cpp b/src/devices/sound/digitalk.cpp
index 9992d6b160d..9ca0e6fa5f0 100644
--- a/src/devices/sound/digitalk.cpp
+++ b/src/devices/sound/digitalk.cpp
@@ -544,29 +544,29 @@ void digitalker_device::digitalker_step()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void digitalker_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void digitalker_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *sout = outputs[0];
+ auto &sout = outputs[0];
int cpos = 0;
- while(cpos != samples) {
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
+ while(cpos != sout.samples()) {
if(m_zero_count == 0 && m_dac_index == 128)
digitalker_step();
if(m_zero_count) {
- int n = samples - cpos;
- int i;
+ int n = sout.samples() - cpos;
if(n > m_zero_count)
n = m_zero_count;
- for(i=0; i != n; i++)
- sout[cpos++] = 0;
+ sout.fill(0, cpos, n);
+ cpos += n;
m_zero_count -= n;
} else if(m_dac_index != 128) {
- while(cpos != samples && m_dac_index != 128) {
- short v = m_dac[m_dac_index];
+ while(cpos != sout.samples() && m_dac_index != 128) {
+ stream_buffer::sample_t v = stream_buffer::sample_t(m_dac[m_dac_index]) * sample_scale;
int pp = m_pitch_pos;
- while(cpos != samples && pp != m_pitch) {
- sout[cpos++] = v;
+ while(cpos != sout.samples() && pp != m_pitch) {
+ sout.put(cpos++, v);
pp++;
}
if(pp == m_pitch) {
@@ -577,8 +577,8 @@ void digitalker_device::sound_stream_update(sound_stream &stream, stream_sample_
}
} else {
- while(cpos != samples)
- sout[cpos++] = 0;
+ sout.fill(0, cpos);
+ break;
}
}
}
diff --git a/src/devices/sound/digitalk.h b/src/devices/sound/digitalk.h
index 44eff1e0343..18cc32fd3bd 100644
--- a/src/devices/sound/digitalk.h
+++ b/src/devices/sound/digitalk.h
@@ -29,7 +29,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
void digitalker_write(uint8_t *adr, uint8_t vol, int8_t dac);
diff --git a/src/devices/sound/disc_cls.h b/src/devices/sound/disc_cls.h
index 1855fbc5444..cb043557734 100644
--- a/src/devices/sound/disc_cls.h
+++ b/src/devices/sound/disc_cls.h
@@ -118,12 +118,13 @@ public:
/* Add gain to the output and put into the buffers */
/* Clipping will be handled by the main sound system */
double val = DISCRETE_INPUT(0) * DISCRETE_INPUT(1);
- *m_ptr++ = val;
+ m_outview->put(m_outview_sample++, val * (1.0 / 32768.0));
}
virtual int max_output(void) override { return 0; }
- virtual void set_output_ptr(stream_sample_t *ptr) override { m_ptr = ptr; }
+ virtual void set_output_ptr(write_stream_view &view) override { m_outview = &view; m_outview_sample = 0; }
private:
- stream_sample_t *m_ptr;
+ write_stream_view *m_outview;
+ u32 m_outview_sample;
};
DISCRETE_CLASS(dso_csvlog, 0,
@@ -230,9 +231,10 @@ public:
//protected:
uint32_t m_stream_in_number;
- stream_sample_t *m_ptr; /* current in ptr for stream */
+ read_stream_view const *m_inview; /* current in ptr for stream */
+ uint32_t m_inview_sample;
private:
- void stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
+ void stream_generate(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs);
double m_gain; /* node gain */
double m_offset; /* node offset */
diff --git a/src/devices/sound/disc_inp.hxx b/src/devices/sound/disc_inp.hxx
index 2b39825f9f3..1c6c9a6dba5 100644
--- a/src/devices/sound/disc_inp.hxx
+++ b/src/devices/sound/disc_inp.hxx
@@ -242,21 +242,17 @@ void DISCRETE_CLASS_FUNC(dss_input_pulse, input_write)(int sub_node, uint8_t dat
#define DSS_INPUT_STREAM__GAIN DISCRETE_INPUT(1)
#define DSS_INPUT_STREAM__OFFSET DISCRETE_INPUT(2)
-void discrete_dss_input_stream_node::stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void discrete_dss_input_stream_node::stream_generate(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *ptr = outputs[0];
- int samplenum = samples;
-
- while (samplenum-- > 0)
- *(ptr++) = m_data;
+ outputs[0].fill(m_data * (1.0 / 32768.0));
}
DISCRETE_STEP(dss_input_stream)
{
/* the context pointer is set to point to the current input stream data in discrete_stream_update */
- if (EXPECTED(m_ptr))
+ if (EXPECTED(m_inview))
{
- set_output(0, (*m_ptr) * m_gain + m_offset);
- m_ptr++;
+ set_output(0, m_inview->get(m_inview_sample) * 32768.0 * m_gain + m_offset);
+ m_inview_sample++;
}
else
set_output(0, 0);
@@ -264,7 +260,7 @@ DISCRETE_STEP(dss_input_stream)
DISCRETE_RESET(dss_input_stream)
{
- m_ptr = nullptr;
+ m_inview = nullptr;
m_data = 0;
}
@@ -304,7 +300,7 @@ DISCRETE_START(dss_input_stream)
m_stream_in_number = DSS_INPUT_STREAM__STREAM;
m_gain = DSS_INPUT_STREAM__GAIN;
m_offset = DSS_INPUT_STREAM__OFFSET;
- m_ptr = nullptr;
+ m_inview = nullptr;
m_is_buffered = is_buffered();
m_buffer_stream = nullptr;
@@ -318,7 +314,7 @@ void DISCRETE_CLASS_NAME(dss_input_stream)::stream_start(void)
discrete_sound_device *snd_device = downcast<discrete_sound_device *>(m_device);
//assert(DSS_INPUT_STREAM__STREAM < snd_device->m_input_stream_list.count());
- m_buffer_stream = m_device->machine().sound().stream_alloc(*snd_device, 0, 1, this->sample_rate(), stream_update_delegate(&discrete_dss_input_stream_node::stream_generate,this));
+ m_buffer_stream = m_device->machine().sound().stream_alloc(*snd_device, 0, 1, this->sample_rate(), stream_update_delegate(&discrete_dss_input_stream_node::stream_generate,this), STREAM_DEFAULT_FLAGS);
snd_device->get_stream()->set_input(m_stream_in_number, m_buffer_stream);
}
diff --git a/src/devices/sound/discrete.cpp b/src/devices/sound/discrete.cpp
index 2e90311ac46..7d6a84a4fc7 100644
--- a/src/devices/sound/discrete.cpp
+++ b/src/devices/sound/discrete.cpp
@@ -862,7 +862,7 @@ discrete_device::~discrete_device(void)
void discrete_device::device_start()
{
// create the stream
- //m_stream = machine().sound().stream_alloc(*this, 0, 2, 22257);
+ //m_stream = stream_alloc_legacy(0, 2, 22257);
const discrete_block *intf_start = m_intf;
@@ -988,7 +988,7 @@ void discrete_sound_device::device_start()
fatalerror("init_nodes() - Couldn't find an output node\n");
/* initialize the stream(s) */
- m_stream = machine().sound().stream_alloc(*this,m_input_stream_list.count(), m_output_list.count(), m_sample_rate);
+ m_stream = stream_alloc(m_input_stream_list.count(), m_output_list.count(), m_sample_rate);
/* Finalize stream_input_nodes */
for_each(discrete_dss_input_stream_node **, node, &m_input_stream_list)
@@ -1060,17 +1060,14 @@ void discrete_device::process(int samples)
}
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void discrete_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void discrete_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
int outputnum = 0;
- if (samples == 0)
- return;
-
/* Setup any output streams */
for_each(discrete_sound_output_interface **, node, &m_output_list)
{
@@ -1081,11 +1078,12 @@ void discrete_sound_device::sound_stream_update(sound_stream &stream, stream_sam
/* Setup any input streams */
for_each(discrete_dss_input_stream_node **, node, &m_input_stream_list)
{
- (*node)->m_ptr = (stream_sample_t *) inputs[(*node)->m_stream_in_number];
+ (*node)->m_inview = &inputs[(*node)->m_stream_in_number];
+ (*node)->m_inview_sample = 0;
}
/* just process it */
- process(samples);
+ process(outputs[0].samples());
}
//-------------------------------------------------
diff --git a/src/devices/sound/discrete.h b/src/devices/sound/discrete.h
index d06a18bf3a5..65879da211f 100644
--- a/src/devices/sound/discrete.h
+++ b/src/devices/sound/discrete.h
@@ -4248,7 +4248,7 @@ class discrete_sound_output_interface
public:
virtual ~discrete_sound_output_interface() { }
- virtual void set_output_ptr(stream_sample_t *ptr) = 0;
+ virtual void set_output_ptr(write_stream_view &view) = 0;
};
//**************************************************************************
@@ -4387,7 +4387,7 @@ protected:
virtual void device_reset() override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
/* the output stream */
diff --git a/src/devices/sound/dmadac.cpp b/src/devices/sound/dmadac.cpp
index 59fe5b15546..b3a7d84bbf5 100644
--- a/src/devices/sound/dmadac.cpp
+++ b/src/devices/sound/dmadac.cpp
@@ -21,7 +21,7 @@
*
*************************************/
-#define DEFAULT_SAMPLE_RATE (44100)
+#define DEFAULT_SAMPLE_RATE (48000)
#define BUFFER_SIZE 32768
@@ -38,14 +38,11 @@
void dmadac_sound_device::device_start()
{
- /* allocate a clear a buffer */
- m_buffer = make_unique_clear<int16_t[]>(BUFFER_SIZE);
-
/* reset the state */
- m_volume = 0x100;
+ m_volume = 1.0;
/* allocate a stream channel */
- m_channel = machine().sound().stream_alloc(*this, 0, 1, DEFAULT_SAMPLE_RATE);
+ m_channel = stream_alloc(0, 1, DEFAULT_SAMPLE_RATE);
/* register with the save state system */
save_item(NAME(m_bufin));
@@ -53,7 +50,7 @@ void dmadac_sound_device::device_start()
save_item(NAME(m_volume));
save_item(NAME(m_enabled));
save_item(NAME(m_frequency));
- save_pointer(NAME(m_buffer), BUFFER_SIZE);
+ save_item(NAME(m_buffer));
}
@@ -91,6 +88,7 @@ void dmadac_sound_device::transfer(int channel, offs_t channel_spacing, offs_t f
int j;
/* loop over all channels and accumulate the data */
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
if (m_enabled)
{
int maxin = (m_bufout + BUFFER_SIZE - 1) % BUFFER_SIZE;
@@ -100,6 +98,35 @@ void dmadac_sound_device::transfer(int channel, offs_t channel_spacing, offs_t f
/* copy the data */
for (j = 0; j < total_frames && curin != maxin; j++)
{
+ m_buffer[curin] = stream_buffer::sample_t(*src) * sample_scale;
+ curin = (curin + 1) % BUFFER_SIZE;
+ src += frame_spacing;
+ }
+ m_bufin = curin;
+
+ /* log overruns */
+ if (j != total_frames)
+ logerror("dmadac_transfer: buffer overrun (short %d frames)\n", total_frames - j);
+ }
+
+ // FIXME: this line has rotted and can no longer compile - it should be fixed and uncommented or removed
+ //LOG("dmadac_transfer - %d samples, %d effective, %d in buffer\n", total_frames, int(total_frames * double(DEFAULT_SAMPLE_RATE) / dmadac[first_channel].frequency), dmadac[first_channel].curinpos - dmadac[first_channel].curoutpos);
+}
+
+void dmadac_sound_device::transfer(int channel, offs_t channel_spacing, offs_t frame_spacing, offs_t total_frames, stream_buffer::sample_t *data)
+{
+ int j;
+
+ /* loop over all channels and accumulate the data */
+ if (m_enabled)
+ {
+ int maxin = (m_bufout + BUFFER_SIZE - 1) % BUFFER_SIZE;
+ stream_buffer::sample_t *src = data + channel * channel_spacing;
+ int curin = m_bufin;
+
+ /* copy the data */
+ for (j = 0; j < total_frames && curin != maxin; j++)
+ {
m_buffer[curin] = *src;
curin = (curin + 1) % BUFFER_SIZE;
src += frame_spacing;
@@ -187,7 +214,7 @@ void dmadac_set_volume(dmadac_sound_device **devlist, uint8_t num_channels, uint
void dmadac_sound_device::set_volume(uint16_t volume)
{
m_channel->update();
- m_volume = volume;
+ m_volume = stream_buffer::sample_t(volume) * (1.0 / 256.0);
}
DEFINE_DEVICE_TYPE(DMADAC, dmadac_sound_device, "dmadac", "DMA-driven DAC")
@@ -195,7 +222,7 @@ DEFINE_DEVICE_TYPE(DMADAC, dmadac_sound_device, "dmadac", "DMA-driven DAC")
dmadac_sound_device::dmadac_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, DMADAC, tag, owner, clock),
device_sound_interface(mconfig, *this),
- m_buffer(nullptr),
+ m_buffer(BUFFER_SIZE),
m_bufin(0),
m_bufout(0),
m_volume(0),
@@ -205,27 +232,25 @@ dmadac_sound_device::dmadac_sound_device(const machine_config &mconfig, const ch
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void dmadac_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void dmadac_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *output = outputs[0];
- int16_t *source = m_buffer.get();
+ auto &output = outputs[0];
uint32_t curout = m_bufout;
uint32_t curin = m_bufin;
- int volume = m_volume;
/* feed as much as we can */
- while (curout != curin && samples-- > 0)
+ int sampindex;
+ for (sampindex = 0; curout != curin && sampindex < output.samples(); sampindex++)
{
- *output++ = (source[curout] * volume) >> 8;
+ output.put(sampindex, stream_buffer::sample_t(m_buffer[curout]) * m_volume);
curout = (curout + 1) % BUFFER_SIZE;
}
/* fill the rest with silence */
- while (samples-- > 0)
- *output++ = 0;
+ output.fill(0, sampindex);
/* save the new output pointer */
m_bufout = curout;
diff --git a/src/devices/sound/dmadac.h b/src/devices/sound/dmadac.h
index 5bcffecc35f..eb73d338eb9 100644
--- a/src/devices/sound/dmadac.h
+++ b/src/devices/sound/dmadac.h
@@ -20,6 +20,7 @@ public:
void flush();
void transfer(int channel, offs_t channel_spacing, offs_t frame_spacing, offs_t total_frames, int16_t *data);
+ void transfer(int channel, offs_t channel_spacing, offs_t frame_spacing, offs_t total_frames, stream_buffer::sample_t *data);
void enable(uint8_t enable);
void set_frequency(double frequency);
void set_volume(uint16_t volume);
@@ -29,18 +30,18 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
// internal state
/* sound stream and buffers */
sound_stream * m_channel;
- std::unique_ptr<int16_t[]> m_buffer;
+ std::vector<stream_buffer::sample_t> m_buffer;
uint32_t m_bufin;
uint32_t m_bufout;
/* per-channel parameters */
- int16_t m_volume;
+ stream_buffer::sample_t m_volume;
uint8_t m_enabled;
double m_frequency;
};
diff --git a/src/devices/sound/dspv.cpp b/src/devices/sound/dspv.cpp
index 4df5846d721..7305c1c5298 100644
--- a/src/devices/sound/dspv.cpp
+++ b/src/devices/sound/dspv.cpp
@@ -93,7 +93,7 @@ void dspv_device::snd_w(offs_t offset, u16 data)
logerror("w %02x, %04x %s\n", offset, data, machine().describe_context());
}
-void dspv_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void dspv_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
}
diff --git a/src/devices/sound/dspv.h b/src/devices/sound/dspv.h
index ba39428005f..fb68acda569 100644
--- a/src/devices/sound/dspv.h
+++ b/src/devices/sound/dspv.h
@@ -29,7 +29,7 @@ protected:
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;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
address_space_config m_program_config, m_data_config;
diff --git a/src/devices/sound/es1373.cpp b/src/devices/sound/es1373.cpp
index 6ff92fcc90b..9475b410f0b 100644
--- a/src/devices/sound/es1373.cpp
+++ b/src/devices/sound/es1373.cpp
@@ -120,7 +120,7 @@ void es1373_device::device_start()
add_map(0x40, M_IO, FUNC(es1373_device::map));
// create the stream
- m_stream = machine().sound().stream_alloc(*this, 0, 2, 44100/2);
+ m_stream = stream_alloc_legacy(0, 2, 44100/2);
m_timer = timer_alloc(0, nullptr);
m_timer->adjust(attotime::zero, 0, attotime::from_hz(44100/2/16));
@@ -230,13 +230,13 @@ void es1373_device::device_timer(emu_timer &timer, device_timer_id tid, int para
}
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void es1373_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void es1373_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
if (m_dac1.enable) {
- logerror("%s: sound_stream_update DAC1 not implemented yet\n", tag());
+ logerror("%s: sound_stream_update_legacy DAC1 not implemented yet\n", tag());
}
if (m_dac2.enable) {
@@ -245,7 +245,7 @@ void es1373_device::sound_stream_update(sound_stream &stream, stream_sample_t **
if (m_adc.enable) {
if (m_adc.format!=SCTRL_16BIT_MONO) {
- logerror("%s: sound_stream_update Only SCTRL_16BIT_MONO recorded supported\n", tag());
+ logerror("%s: sound_stream_update_legacy Only SCTRL_16BIT_MONO recorded supported\n", tag());
} else {
for (int i=0; i<samples; i++) {
if (m_adc.buf_count<=m_adc.buf_size) {
@@ -345,7 +345,7 @@ void es1373_device::send_audio_out(chan_info& chan, uint32_t intr_mask, stream_s
}
if (LOG_ES_FILE && m_tempCount<1000000) {
m_tempCount++;
- //logerror("es1373_device::sound_stream_update count: %i samp16: %X\n", i, samp16);
+ //logerror("es1373_device::sound_stream_update_legacy count: %i samp16: %X\n", i, samp16);
//if (LOG_ES_FILE && m_eslog)
//fprintf(m_eslog, "%i\n", samp16);
}
diff --git a/src/devices/sound/es1373.h b/src/devices/sound/es1373.h
index e5f107eed11..856d90d7af8 100644
--- a/src/devices/sound/es1373.h
+++ b/src/devices/sound/es1373.h
@@ -29,7 +29,7 @@ protected:
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;
virtual void device_post_load() override;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// Sound stream
sound_stream *m_stream;
diff --git a/src/devices/sound/es5503.cpp b/src/devices/sound/es5503.cpp
index fccc2f3a6e4..36fcaaf8af1 100644
--- a/src/devices/sound/es5503.cpp
+++ b/src/devices/sound/es5503.cpp
@@ -128,7 +128,7 @@ void es5503_device::halt_osc(int onum, int type, uint32_t *accumulator, int ress
}
}
-void es5503_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void es5503_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
static int32_t mix[(44100/60)*2*8];
int32_t *mixp;
@@ -201,7 +201,7 @@ void es5503_device::sound_stream_update(sound_stream &stream, stream_sample_t **
mixp = &mix[0];
for (i = 0; i < samples; i++)
for (int chan = 0; chan < output_channels; chan++)
- outputs[chan][i] = (*mixp++)>>1;
+ outputs[chan][i] = (*mixp++)>>3;
}
@@ -224,7 +224,7 @@ void es5503_device::device_start()
save_pointer(STRUCT_MEMBER(oscillators, irqpend), 32);
output_rate = (clock() / 8) / (2 + oscsenabled);
- m_stream = machine().sound().stream_alloc(*this, 0, output_channels, output_rate);
+ m_stream = stream_alloc_legacy(0, output_channels, output_rate);
m_timer = timer_alloc(0, nullptr);
attotime update_rate = output_rate ? attotime::from_hz(output_rate) : attotime::never;
diff --git a/src/devices/sound/es5503.h b/src/devices/sound/es5503.h
index 18305d500bb..1483e91c8ac 100644
--- a/src/devices/sound/es5503.h
+++ b/src/devices/sound/es5503.h
@@ -36,7 +36,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/es5506.cpp b/src/devices/sound/es5506.cpp
index 481830271b5..b238409a1fa 100644
--- a/src/devices/sound/es5506.cpp
+++ b/src/devices/sound/es5506.cpp
@@ -159,7 +159,7 @@ es550x_device::es550x_device(const machine_config &mconfig, device_type type, co
, m_volume_shift(0)
, m_volume_acc_shift(0)
, m_current_page(0)
- , m_active_voices(0)
+ , m_active_voices(0x1f)
, m_mode(0)
, m_irqv(0x80)
, m_voice_index(0)
@@ -249,7 +249,7 @@ void es5506_device::device_start()
channels = m_channels;
// create the stream
- m_stream = machine().sound().stream_alloc(*this, 0, 2 * channels, clock() / (16*32));
+ m_stream = stream_alloc_legacy(0, 2 * channels, clock() / (16*32));
// initialize the regions
if (m_region0 && !has_configured_map(0))
@@ -378,7 +378,7 @@ void es5505_device::device_start()
channels = m_channels;
// create the stream
- m_stream = machine().sound().stream_alloc(*this, 0, 2 * channels, clock() / (16*32));
+ m_stream = stream_alloc_legacy(0, 2 * channels, clock() / (16*32));
// initialize the regions
if (m_region0 && !has_configured_map(0))
@@ -1022,7 +1022,7 @@ inline void es550x_device::generate_irq(es550x_voice *voice, int v)
***********************************************************************************************/
-void es5506_device::generate_samples(s32 **outputs, int offset, int samples)
+void es5506_device::generate_samples(s32 * const *outputs, int offset, int samples)
{
// skip if nothing to do
if (!samples)
@@ -1067,7 +1067,7 @@ void es5506_device::generate_samples(s32 **outputs, int offset, int samples)
}
}
-void es5505_device::generate_samples(s32 **outputs, int offset, int samples)
+void es5505_device::generate_samples(s32 * const *outputs, int offset, int samples)
{
// skip if nothing to do
if (!samples)
@@ -2123,10 +2123,10 @@ u16 es5505_device::read(offs_t offset)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void es550x_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void es550x_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
#if ES5506_MAKE_WAVS
// start the logging once we have a sample rate
diff --git a/src/devices/sound/es5506.h b/src/devices/sound/es5506.h
index 30e79d5f0ae..da438066ceb 100644
--- a/src/devices/sound/es5506.h
+++ b/src/devices/sound/es5506.h
@@ -84,7 +84,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
void update_irq_state();
void update_internal_irq_state();
@@ -114,7 +114,7 @@ protected:
void generate_ulaw(es550x_voice *voice, s32 *lbuffer, s32 *rbuffer, int samples);
void generate_pcm(es550x_voice *voice, s32 *lbuffer, s32 *rbuffer, int samples);
inline void generate_irq(es550x_voice *voice, int v);
- virtual void generate_samples(s32 **outputs, int offset, int samples) {};
+ virtual void generate_samples(s32 * const *outputs, int offset, int samples) {};
inline void update_index(es550x_voice *voice) { m_voice_index = voice->index; }
virtual inline u16 read_sample(es550x_voice *voice, offs_t addr) { return 0; }
@@ -190,7 +190,7 @@ protected:
virtual void update_envelopes(es550x_voice *voice) override;
virtual void check_for_end_forward(es550x_voice *voice, u64 &accum) override;
virtual void check_for_end_reverse(es550x_voice *voice, u64 &accum) override;
- virtual void generate_samples(s32 **outputs, int offset, int samples) override;
+ virtual void generate_samples(s32 * const *outputs, int offset, int samples) override;
virtual inline u16 read_sample(es550x_voice *voice, offs_t addr) override { update_index(voice); return m_cache[get_bank(voice->control)].read_word(addr); }
@@ -244,7 +244,7 @@ protected:
virtual void update_envelopes(es550x_voice *voice) override;
virtual void check_for_end_forward(es550x_voice *voice, u64 &accum) override;
virtual void check_for_end_reverse(es550x_voice *voice, u64 &accum) override;
- virtual void generate_samples(s32 **outputs, int offset, int samples) override;
+ virtual void generate_samples(s32 * const *outputs, int offset, int samples) override;
virtual inline u16 read_sample(es550x_voice *voice, offs_t addr) override { update_index(voice); return m_cache[get_bank(voice->control)].read_word(addr); }
diff --git a/src/devices/sound/esqpump.cpp b/src/devices/sound/esqpump.cpp
index 5ed977b9f81..7b37a2c9abd 100644
--- a/src/devices/sound/esqpump.cpp
+++ b/src/devices/sound/esqpump.cpp
@@ -32,7 +32,7 @@ void esq_5505_5510_pump_device::device_start()
{
logerror("Clock = %d\n", clock());
- m_stream = machine().sound().stream_alloc(*this, 8, 2, clock());
+ m_stream = stream_alloc_legacy(8, 2, clock());
m_timer = timer_alloc(0);
m_timer->enable(false);
@@ -73,7 +73,7 @@ void esq_5505_5510_pump_device::device_clock_changed()
m_timer->adjust(attotime::zero, 0, attotime::from_hz(clock()));
}
-void esq_5505_5510_pump_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void esq_5505_5510_pump_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
if (samples != 1) {
logerror("Pump: request for %d samples\n", samples);
diff --git a/src/devices/sound/esqpump.h b/src/devices/sound/esqpump.h
index 8ebd12bccb0..a4fb62b60ff 100644
--- a/src/devices/sound/esqpump.h
+++ b/src/devices/sound/esqpump.h
@@ -75,7 +75,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// timer callback overrides
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
diff --git a/src/devices/sound/flt_rc.cpp b/src/devices/sound/flt_rc.cpp
index 88fb3c7624f..8de64b37a40 100644
--- a/src/devices/sound/flt_rc.cpp
+++ b/src/devices/sound/flt_rc.cpp
@@ -37,7 +37,7 @@ filter_rc_device::filter_rc_device(const machine_config &mconfig, const char *ta
void filter_rc_device::device_start()
{
- m_stream = stream_alloc(1, 1, machine().sample_rate());
+ m_stream = stream_alloc_legacy(1, 1, machine().sample_rate());
recalc();
save_item(NAME(m_k));
@@ -51,12 +51,12 @@ void filter_rc_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void filter_rc_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void filter_rc_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
- stream_sample_t *src = inputs[0];
+ stream_sample_t const *src = inputs[0];
stream_sample_t *dst = outputs[0];
int memory = m_memory;
diff --git a/src/devices/sound/flt_rc.h b/src/devices/sound/flt_rc.h
index cbf5772607e..9c1bc7f3381 100644
--- a/src/devices/sound/flt_rc.h
+++ b/src/devices/sound/flt_rc.h
@@ -109,7 +109,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
void recalc();
diff --git a/src/devices/sound/flt_vol.cpp b/src/devices/sound/flt_vol.cpp
index eec55c413f8..8b8438f9b94 100644
--- a/src/devices/sound/flt_vol.cpp
+++ b/src/devices/sound/flt_vol.cpp
@@ -27,17 +27,17 @@ filter_volume_device::filter_volume_device(const machine_config &mconfig, const
void filter_volume_device::device_start()
{
m_gain = 0x100;
- m_stream = stream_alloc(1, 1, machine().sample_rate());
+ m_stream = stream_alloc_legacy(1, 1, machine().sample_rate());
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void filter_volume_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void filter_volume_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
- stream_sample_t *src = inputs[0];
+ stream_sample_t const *src = inputs[0];
stream_sample_t *dst = outputs[0];
while (samples--)
diff --git a/src/devices/sound/flt_vol.h b/src/devices/sound/flt_vol.h
index bcd4a05d399..034c3a3cf79 100644
--- a/src/devices/sound/flt_vol.h
+++ b/src/devices/sound/flt_vol.h
@@ -24,7 +24,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
sound_stream* m_stream;
diff --git a/src/devices/sound/fm.cpp b/src/devices/sound/fm.cpp
index 23ea6633674..5679860a2f2 100644
--- a/src/devices/sound/fm.cpp
+++ b/src/devices/sound/fm.cpp
@@ -2727,7 +2727,7 @@ static inline void YM2608IRQMaskWrite(FM_OPN *OPN, ym2608_state *F2608, int v)
}
/* Generate samples for one of the YM2608s */
-void ym2608_update_one(void *chip, FMSAMPLE **buffer, int length)
+void ym2608_update_one(void *chip, FMSAMPLE * const *buffer, int length)
{
ym2608_state *F2608 = (ym2608_state *)chip;
FM_OPN *OPN = &F2608->OPN;
@@ -3275,7 +3275,7 @@ int ym2608_timer_over(void *chip,int c)
/* YM2610(OPNB) */
/* Generate samples for one of the YM2610s */
-void ym2610_update_one(void *chip, FMSAMPLE **buffer, int length)
+void ym2610_update_one(void *chip, FMSAMPLE * const *buffer, int length)
{
ym2610_state *F2610 = (ym2610_state *)chip;
FM_OPN *OPN = &F2610->OPN;
@@ -3411,7 +3411,7 @@ void ym2610_update_one(void *chip, FMSAMPLE **buffer, int length)
#if BUILD_YM2610B
/* Generate samples for one of the YM2610Bs */
-void ym2610b_update_one(void *chip, FMSAMPLE **buffer, int length)
+void ym2610b_update_one(void *chip, FMSAMPLE * const *buffer, int length)
{
ym2610_state *F2610 = (ym2610_state *)chip;
FM_OPN *OPN = &F2610->OPN;
diff --git a/src/devices/sound/fm.h b/src/devices/sound/fm.h
index d49c5a40e99..d5d8760a449 100644
--- a/src/devices/sound/fm.h
+++ b/src/devices/sound/fm.h
@@ -142,7 +142,7 @@ void * ym2608_init(device_t *device, int baseclock, int rate,
void ym2608_clock_changed(void *chip, int clock, int rate);
void ym2608_shutdown(void *chip);
void ym2608_reset_chip(void *chip);
-void ym2608_update_one(void *chip, FMSAMPLE **buffer, int length);
+void ym2608_update_one(void *chip, FMSAMPLE * const *buffer, int length);
int ym2608_write(void *chip, int a,unsigned char v);
unsigned char ym2608_read(void *chip,int a);
@@ -158,10 +158,10 @@ void * ym2610_init(device_t *device, int baseclock, int rate,
void ym2610_clock_changed(void *chip, int clock, int rate);
void ym2610_shutdown(void *chip);
void ym2610_reset_chip(void *chip);
-void ym2610_update_one(void *chip, FMSAMPLE **buffer, int length);
+void ym2610_update_one(void *chip, FMSAMPLE * const *buffer, int length);
#if BUILD_YM2610B
-void ym2610b_update_one(void *chip, FMSAMPLE **buffer, int length);
+void ym2610b_update_one(void *chip, FMSAMPLE * const *buffer, int length);
#endif /* BUILD_YM2610B */
int ym2610_write(void *chip, int a,unsigned char v);
@@ -176,7 +176,7 @@ void * ym2612_init(device_t *device, int baseclock, int rate,
void ym2612_clock_changed(void *chip, int clock, int rate);
void ym2612_shutdown(void *chip);
void ym2612_reset_chip(void *chip);
-void ym2612_update_one(void *chip, FMSAMPLE **buffer, int length, u8 output_bits);
+void ym2612_update_one(void *chip, FMSAMPLE * const *buffer, int length, u8 output_bits);
int ym2612_write(void *chip, int a,unsigned char v);
unsigned char ym2612_read(void *chip,int a);
diff --git a/src/devices/sound/fm2612.cpp b/src/devices/sound/fm2612.cpp
index 6d5f71dac55..b3482d0ac72 100644
--- a/src/devices/sound/fm2612.cpp
+++ b/src/devices/sound/fm2612.cpp
@@ -2174,7 +2174,7 @@ static void init_tables(void)
/*******************************************************************************/
/* Generate samples for one of the YM2612s */
-void ym2612_update_one(void *chip, FMSAMPLE **buffer, int length, u8 output_bits)
+void ym2612_update_one(void *chip, FMSAMPLE * const *buffer, int length, u8 output_bits)
{
// TODO : 'ladder' effects for Mega Drive/Genesis
const u8 output_shift = (output_bits > 14) ? 0 : (14 - output_bits);
diff --git a/src/devices/sound/gaelco.cpp b/src/devices/sound/gaelco.cpp
index 0c2495a4d64..41fbfc0a4c4 100644
--- a/src/devices/sound/gaelco.cpp
+++ b/src/devices/sound/gaelco.cpp
@@ -76,7 +76,7 @@ gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, device_typ
Writes length bytes to the sound buffer
============================================================================*/
-void gaelco_gae1_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void gaelco_gae1_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
/* fill all data needed */
for (int j = 0; j < samples; j++)
@@ -253,7 +253,7 @@ void gaelco_gae1_device::gaelcosnd_w(offs_t offset, uint16_t data, uint16_t mem_
void gaelco_gae1_device::device_start()
{
u32 rate = clock() / 128;
- m_stream = stream_alloc(0, 2, rate);
+ m_stream = stream_alloc_legacy(0, 2, rate);
/* init volume table */
for (int vol = 0; vol < VOLUME_LEVELS; vol++)
diff --git a/src/devices/sound/gaelco.h b/src/devices/sound/gaelco.h
index 07af14a73ec..4f7eeaeb7a7 100644
--- a/src/devices/sound/gaelco.h
+++ b/src/devices/sound/gaelco.h
@@ -43,7 +43,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/gb.cpp b/src/devices/sound/gb.cpp
index e5fe37688cc..42944daf152 100644
--- a/src/devices/sound/gb.cpp
+++ b/src/devices/sound/gb.cpp
@@ -142,7 +142,7 @@ cgb04_apu_device::cgb04_apu_device(const machine_config &mconfig, const char *ta
void gameboy_sound_device::device_start()
{
- m_channel = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate());
+ m_channel = stream_alloc_legacy(0, 2, machine().sample_rate());
m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gameboy_sound_device::timer_callback),this));
m_timer->adjust(clocks_to_attotime(FRAME_CYCLES/128), 0, clocks_to_attotime(FRAME_CYCLES/128));
@@ -1211,11 +1211,13 @@ void cgb04_apu_device::apu_power_off()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void gameboy_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void gameboy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
+ stream_sample_t *outputl = outputs[0];
+ stream_sample_t *outputr = outputs[1];
while (samples-- > 0)
{
stream_sample_t sample;
@@ -1272,7 +1274,7 @@ void gameboy_sound_device::sound_stream_update(sound_stream &stream, stream_samp
right <<= 6;
/* Update the buffers */
- *(outputs[0]++) = left;
- *(outputs[1]++) = right;
+ *outputl++ = left;
+ *outputr++ = right;
}
}
diff --git a/src/devices/sound/gb.h b/src/devices/sound/gb.h
index 989871fe08c..a0ea67ed0a8 100644
--- a/src/devices/sound/gb.h
+++ b/src/devices/sound/gb.h
@@ -25,7 +25,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
protected:
enum
diff --git a/src/devices/sound/hc55516.cpp b/src/devices/sound/hc55516.cpp
index 99cc782dc20..6397d2c927c 100644
--- a/src/devices/sound/hc55516.cpp
+++ b/src/devices/sound/hc55516.cpp
@@ -115,7 +115,7 @@ void hc55516_device::start_common(uint8_t _shiftreg_mask, int _active_clock_hi)
m_last_clock_state = 0;
/* create the stream */
- m_channel = machine().sound().stream_alloc(*this, 0, 1, SAMPLE_RATE);
+ m_channel = stream_alloc_legacy(0, 1, SAMPLE_RATE);
save_item(NAME(m_last_clock_state));
save_item(NAME(m_digit));
@@ -241,10 +241,10 @@ int hc55516_device::clock_state_r()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void hc55516_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void hc55516_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
int i;
@@ -301,12 +301,12 @@ void hc55516_device::sound_stream_update(sound_stream &stream, stream_sample_t *
*buffer++ = sample;
}
-void mc3417_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void mc3417_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
- hc55516_device::sound_stream_update(stream, inputs, outputs, samples);
+ hc55516_device::sound_stream_update_legacy(stream, inputs, outputs, samples);
}
-void mc3418_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void mc3418_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
- hc55516_device::sound_stream_update(stream, inputs, outputs, samples);
+ hc55516_device::sound_stream_update_legacy(stream, inputs, outputs, samples);
}
diff --git a/src/devices/sound/hc55516.h b/src/devices/sound/hc55516.h
index d375de7c413..96284167c52 100644
--- a/src/devices/sound/hc55516.h
+++ b/src/devices/sound/hc55516.h
@@ -27,7 +27,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
void start_common(uint8_t _shiftreg_mask, int _active_clock_hi);
@@ -70,7 +70,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
};
@@ -84,7 +84,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
};
diff --git a/src/devices/sound/huc6230.cpp b/src/devices/sound/huc6230.cpp
index 88206877a36..fd2ef5b9689 100644
--- a/src/devices/sound/huc6230.cpp
+++ b/src/devices/sound/huc6230.cpp
@@ -21,7 +21,7 @@
constexpr int clamp(int val, int min, int max) { return std::min(max, std::max(min, val)); }
-void huc6230_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void huc6230_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
for (int i = 0; i < samples; i++)
{
@@ -172,7 +172,7 @@ void huc6230_device::device_start()
m_vca_cb.resolve_safe();
- m_stream = machine().sound().stream_alloc(*this, 2, 2, clock() / 6);
+ m_stream = stream_alloc_legacy(2, 2, clock() / 6);
m_adpcm_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(huc6230_device::adpcm_timer),this));
for (int i = 0; i < 2; i++)
diff --git a/src/devices/sound/huc6230.h b/src/devices/sound/huc6230.h
index 0337d3165e5..27e67ce41a3 100644
--- a/src/devices/sound/huc6230.h
+++ b/src/devices/sound/huc6230.h
@@ -28,7 +28,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
struct adpcm_channel {
diff --git a/src/devices/sound/i5000.cpp b/src/devices/sound/i5000.cpp
index c317d976d9f..747d5e96e19 100644
--- a/src/devices/sound/i5000.cpp
+++ b/src/devices/sound/i5000.cpp
@@ -44,7 +44,7 @@ void i5000snd_device::device_start()
m_lut_volume[0xff] = 0;
// create the stream
- m_stream = machine().sound().stream_alloc(*this, 0, 2, clock() / 0x400);
+ m_stream = stream_alloc_legacy(0, 2, clock() / 0x400);
m_rom_base = (uint16_t *)device().machine().root_device().memregion(":i5000snd")->base();
m_rom_mask = device().machine().root_device().memregion(":i5000snd")->bytes() / 2 - 1;
@@ -114,7 +114,7 @@ bool i5000snd_device::read_sample(int ch)
}
-void i5000snd_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void i5000snd_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
for (int i = 0; i < samples; i++)
{
diff --git a/src/devices/sound/i5000.h b/src/devices/sound/i5000.h
index 9a9a8efb3af..0bb994ebdb6 100644
--- a/src/devices/sound/i5000.h
+++ b/src/devices/sound/i5000.h
@@ -33,7 +33,7 @@ protected:
virtual void device_start() override;
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 sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
sound_stream *m_stream;
diff --git a/src/devices/sound/ics2115.cpp b/src/devices/sound/ics2115.cpp
index c61ddd819b2..fa570814019 100644
--- a/src/devices/sound/ics2115.cpp
+++ b/src/devices/sound/ics2115.cpp
@@ -63,7 +63,7 @@ void ics2115_device::device_start()
m_timer[0].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ics2115_device::timer_cb_0),this), this);
m_timer[1].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ics2115_device::timer_cb_1),this), this);
- m_stream = machine().sound().stream_alloc(*this, 0, 2, clock() / (32 * 32));
+ m_stream = stream_alloc_legacy(0, 2, clock() / (32 * 32));
m_irq_cb.resolve_safe();
@@ -385,7 +385,7 @@ void ics2115_device::ics2115_voice::update_ramp()
}
}
-int ics2115_device::fill_output(ics2115_voice& voice, stream_sample_t *outputs[2], int samples)
+int ics2115_device::fill_output(ics2115_voice& voice, stream_sample_t * const outputs[2], int samples)
{
bool irq_invalid = false;
const u16 fine = 1 << (3*(voice.vol.incr >> 6));
@@ -426,7 +426,7 @@ int ics2115_device::fill_output(ics2115_voice& voice, stream_sample_t *outputs[2
return irq_invalid;
}
-void ics2115_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ics2115_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
memset(outputs[0], 0, samples * sizeof(stream_sample_t));
memset(outputs[1], 0, samples * sizeof(stream_sample_t));
diff --git a/src/devices/sound/ics2115.h b/src/devices/sound/ics2115.h
index ea26826da4a..777ee8eabf4 100644
--- a/src/devices/sound/ics2115.h
+++ b/src/devices/sound/ics2115.h
@@ -39,7 +39,7 @@ protected:
virtual void device_clock_changed() override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
@@ -119,7 +119,7 @@ private:
void recalc_irq();
// stream helper functions
- int fill_output(ics2115_voice& voice, stream_sample_t *outputs[2], int samples);
+ int fill_output(ics2115_voice& voice, stream_sample_t * const outputs[2], int samples);
stream_sample_t get_sample(ics2115_voice& voice);
u8 read_sample(ics2115_voice& voice, u32 addr) { return m_cache.read_byte((voice.osc.saddr << 20) | (addr & 0xfffff)); }
diff --git a/src/devices/sound/iopspu.cpp b/src/devices/sound/iopspu.cpp
index 1d4e78f879c..73399b1ef2c 100644
--- a/src/devices/sound/iopspu.cpp
+++ b/src/devices/sound/iopspu.cpp
@@ -89,7 +89,7 @@ void iop_spu_device::dma_done(int bank)
core.m_status &= ~STATUS_DMA_ACTIVE;
}
-void iop_spu_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void iop_spu_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// TODO
}
diff --git a/src/devices/sound/iopspu.h b/src/devices/sound/iopspu.h
index 6a9e6235409..4348e471051 100644
--- a/src/devices/sound/iopspu.h
+++ b/src/devices/sound/iopspu.h
@@ -48,7 +48,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// HACK: This timer is currently used to trigger an interrupt after the auto-DMA-transferred buffer would have been
// mixed and played back, as the PS2 BIOS pulls a null return address and crashes if we trigger the auto-DMA-complete
diff --git a/src/devices/sound/iremga20.cpp b/src/devices/sound/iremga20.cpp
index 041ec44241e..ba49eaa75c4 100644
--- a/src/devices/sound/iremga20.cpp
+++ b/src/devices/sound/iremga20.cpp
@@ -73,7 +73,7 @@ iremga20_device::iremga20_device(const machine_config &mconfig, const char *tag,
void iremga20_device::device_start()
{
- m_stream = stream_alloc(0, 2, clock()/4);
+ m_stream = stream_alloc_legacy(0, 2, clock()/4);
save_item(NAME(m_regs));
for (int i = 0; i < 4; i++)
@@ -126,10 +126,10 @@ void iremga20_device::rom_bank_updated()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void iremga20_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void iremga20_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *outL, *outR;
diff --git a/src/devices/sound/iremga20.h b/src/devices/sound/iremga20.h
index dfe5040f65e..df9942c9ccb 100644
--- a/src/devices/sound/iremga20.h
+++ b/src/devices/sound/iremga20.h
@@ -36,7 +36,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/k005289.cpp b/src/devices/sound/k005289.cpp
index 26d14258406..bf07743f7d3 100644
--- a/src/devices/sound/k005289.cpp
+++ b/src/devices/sound/k005289.cpp
@@ -74,7 +74,7 @@ void k005289_device::device_start()
{
/* get stream channels */
m_rate = clock() / CLOCK_DIVIDER;
- m_stream = stream_alloc(0, 1, m_rate);
+ m_stream = stream_alloc_legacy(0, 1, m_rate);
/* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */
m_mixer_buffer = std::make_unique<short[]>(2 * m_rate);
@@ -101,10 +101,10 @@ void k005289_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void k005289_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void k005289_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
short *mix;
diff --git a/src/devices/sound/k005289.h b/src/devices/sound/k005289.h
index 39cac2cc300..a8dc7b1d0b0 100644
--- a/src/devices/sound/k005289.h
+++ b/src/devices/sound/k005289.h
@@ -26,7 +26,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
void make_mixer_table(int voices);
diff --git a/src/devices/sound/k007232.cpp b/src/devices/sound/k007232.cpp
index 2795053520d..3b35eeb9d5c 100644
--- a/src/devices/sound/k007232.cpp
+++ b/src/devices/sound/k007232.cpp
@@ -86,7 +86,7 @@ void k007232_device::device_start()
for (auto & elem : m_wreg)
elem = 0;
- m_stream = machine().sound().stream_alloc(*this, 0, 2, clock()/128);
+ m_stream = stream_alloc_legacy(0, 2, clock()/128);
save_item(STRUCT_MEMBER(m_channel, vol));
save_item(STRUCT_MEMBER(m_channel, addr));
@@ -206,10 +206,10 @@ void k007232_device::set_bank(int chan_a_bank, int chan_b_bank)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void k007232_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void k007232_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
memset(outputs[0], 0, samples * sizeof(stream_sample_t));
memset(outputs[1], 0, samples * sizeof(stream_sample_t));
diff --git a/src/devices/sound/k007232.h b/src/devices/sound/k007232.h
index 72d5e701dc9..e9a4ba255da 100644
--- a/src/devices/sound/k007232.h
+++ b/src/devices/sound/k007232.h
@@ -37,7 +37,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
diff --git a/src/devices/sound/k051649.cpp b/src/devices/sound/k051649.cpp
index 07df808d42f..0e39a94230a 100644
--- a/src/devices/sound/k051649.cpp
+++ b/src/devices/sound/k051649.cpp
@@ -71,7 +71,7 @@ void k051649_device::device_start()
{
// get stream channels
m_rate = clock()/16;
- m_stream = stream_alloc(0, 1, m_rate);
+ m_stream = stream_alloc_legacy(0, 1, m_rate);
// allocate a buffer to mix into - 1 second's worth should be more than enough
m_mixer_buffer.resize(2 * m_rate);
@@ -140,10 +140,10 @@ void k051649_device::device_clock_changed()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void k051649_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void k051649_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// zap the contents of the mixer buffer
std::fill(m_mixer_buffer.begin(), m_mixer_buffer.end(), 0);
diff --git a/src/devices/sound/k051649.h b/src/devices/sound/k051649.h
index f69ae00b707..2fda5936685 100644
--- a/src/devices/sound/k051649.h
+++ b/src/devices/sound/k051649.h
@@ -38,7 +38,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
// Parameters for a channel
diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp
index 181c992f360..ff2356ac600 100644
--- a/src/devices/sound/k053260.cpp
+++ b/src/devices/sound/k053260.cpp
@@ -115,7 +115,7 @@ void k053260_device::device_start()
m_sh1_cb.resolve_safe();
m_sh2_cb.resolve_safe();
- m_stream = stream_alloc( 0, 2, clock() / CLOCKS_PER_SAMPLE );
+ m_stream = stream_alloc_legacy( 0, 2, clock() / CLOCKS_PER_SAMPLE );
/* register with the save state system */
save_item(NAME(m_portdata));
@@ -310,10 +310,10 @@ static constexpr s32 MAXOUT = 0x7fff;
static constexpr s32 MINOUT = -0x8000;
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void k053260_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void k053260_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
if (m_mode & 2)
{
@@ -429,7 +429,7 @@ void k053260_device::KDSC_Voice::update_pan_volume()
void k053260_device::KDSC_Voice::key_on()
{
m_position = m_kadpcm ? 1 : 0; // for kadpcm low bit is nybble offset, so must start at 1 due to preincrement
- m_counter = 0x1000 - CLOCKS_PER_SAMPLE; // force update on next sound_stream_update
+ m_counter = 0x1000 - CLOCKS_PER_SAMPLE; // force update on next sound_stream_update_legacy
m_output = 0;
m_playing = true;
if (LOG) m_device.logerror("K053260: start = %06x, length = %06x, pitch = %04x, vol = %02x:%x, loop = %s, %s\n",
diff --git a/src/devices/sound/k053260.h b/src/devices/sound/k053260.h
index 648fa00cb58..4288b603d5a 100644
--- a/src/devices/sound/k053260.h
+++ b/src/devices/sound/k053260.h
@@ -42,7 +42,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/k054539.cpp b/src/devices/sound/k054539.cpp
index 5fbeaa14b3d..2ed7dc134a2 100644
--- a/src/devices/sound/k054539.cpp
+++ b/src/devices/sound/k054539.cpp
@@ -105,7 +105,7 @@ void k054539_device::keyoff(int channel)
regs[0x22c] &= ~(1 << channel);
}
-void k054539_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void k054539_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
#define VOL_CAP 1.80
@@ -118,9 +118,14 @@ void k054539_device::sound_stream_update(sound_stream &stream, stream_sample_t *
int16_t *rbase = (int16_t *)ram.get();
if(!(regs[0x22f] & 1))
+ {
+ outputs[0].fill(0);
+ outputs[1].fill(0);
return;
+ }
- for(int sample = 0; sample != samples; sample++) {
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
+ for(int sample = 0; sample != outputs[0].samples(); sample++) {
double lval, rval;
if(!(flags & DISABLE_REVERB))
lval = rval = rbase[reverb_pos];
@@ -298,8 +303,8 @@ void k054539_device::sound_stream_update(sound_stream &stream, stream_sample_t *
}
}
reverb_pos = (reverb_pos + 1) & 0x1fff;
- outputs[0][sample] = int16_t(lval);
- outputs[1][sample] = int16_t(rval);
+ outputs[0].put(sample, stream_buffer::sample_t(lval) * sample_scale);
+ outputs[1].put(sample, stream_buffer::sample_t(rval) * sample_scale);
}
}
diff --git a/src/devices/sound/k054539.h b/src/devices/sound/k054539.h
index ba1c96ffc64..6e4b6c10c8c 100644
--- a/src/devices/sound/k054539.h
+++ b/src/devices/sound/k054539.h
@@ -67,7 +67,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/ks0164.cpp b/src/devices/sound/ks0164.cpp
index 8974ddeaa74..5280af611f6 100644
--- a/src/devices/sound/ks0164.cpp
+++ b/src/devices/sound/ks0164.cpp
@@ -50,7 +50,7 @@ void ks0164_device::device_start()
space().install_rom(0, rend, ((1 << 23) - 1) ^ rmask, m_mem_region->base());
}
- m_stream = stream_alloc(0, 2, clock()/3/2/2/32);
+ m_stream = stream_alloc_legacy(0, 2, clock()/3/2/2/32);
space().cache(m_mem_cache);
m_timer = timer_alloc(0);
@@ -368,7 +368,7 @@ u16 ks0164_device::uncomp_8_16(u8 value)
return o;
}
-void ks0164_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ks0164_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
for(int sample = 0; sample != samples; sample++) {
s32 suml = 0, sumr = 0;
diff --git a/src/devices/sound/ks0164.h b/src/devices/sound/ks0164.h
index bb654c83cc4..a668753f250 100644
--- a/src/devices/sound/ks0164.h
+++ b/src/devices/sound/ks0164.h
@@ -23,7 +23,7 @@ public:
protected:
virtual void device_start() override;
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 sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
virtual void device_add_mconfig(machine_config &config) 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;
diff --git a/src/devices/sound/l7a1045_l6028_dsp_a.cpp b/src/devices/sound/l7a1045_l6028_dsp_a.cpp
index 1c7cf2631c1..280d12a20d9 100644
--- a/src/devices/sound/l7a1045_l6028_dsp_a.cpp
+++ b/src/devices/sound/l7a1045_l6028_dsp_a.cpp
@@ -117,7 +117,7 @@ l7a1045_sound_device::l7a1045_sound_device(const machine_config &mconfig, const
void l7a1045_sound_device::device_start()
{
/* Allocate the stream */
- m_stream = stream_alloc(0, 2, 66150); //clock() / 384);
+ m_stream = stream_alloc_legacy(0, 2, 66150); //clock() / 384);
for (int voice = 0; voice < 32; voice++)
{
@@ -143,10 +143,10 @@ void l7a1045_sound_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void l7a1045_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void l7a1045_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
/* Clear the buffers */
memset(outputs[0], 0, samples*sizeof(*outputs[0]));
diff --git a/src/devices/sound/l7a1045_l6028_dsp_a.h b/src/devices/sound/l7a1045_l6028_dsp_a.h
index 06cdd5b7509..bc9c3b5d500 100644
--- a/src/devices/sound/l7a1045_l6028_dsp_a.h
+++ b/src/devices/sound/l7a1045_l6028_dsp_a.h
@@ -33,7 +33,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
struct l7a1045_voice
diff --git a/src/devices/sound/lmc1992.cpp b/src/devices/sound/lmc1992.cpp
index 84eb7f7c9d7..ad412395d9d 100644
--- a/src/devices/sound/lmc1992.cpp
+++ b/src/devices/sound/lmc1992.cpp
@@ -171,11 +171,11 @@ void lmc1992_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void lmc1992_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void lmc1992_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
}
diff --git a/src/devices/sound/lmc1992.h b/src/devices/sound/lmc1992.h
index 88763628999..cfaffc1f13f 100644
--- a/src/devices/sound/lmc1992.h
+++ b/src/devices/sound/lmc1992.h
@@ -71,7 +71,7 @@ protected:
virtual void device_start() override;
// internal callbacks
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
inline void execute_command(int addr, int data);
diff --git a/src/devices/sound/mas3507d.cpp b/src/devices/sound/mas3507d.cpp
index 9fa4eeadbc9..641ec52a06e 100644
--- a/src/devices/sound/mas3507d.cpp
+++ b/src/devices/sound/mas3507d.cpp
@@ -29,7 +29,7 @@ mas3507d_device::mas3507d_device(const machine_config &mconfig, const char *tag,
void mas3507d_device::device_start()
{
current_rate = 44100;
- stream = stream_alloc(0, 2, current_rate);
+ stream = stream_alloc_legacy(0, 2, current_rate);
cb_sample.resolve();
}
@@ -290,7 +290,7 @@ void mas3507d_device::mem_write(int bank, uint32_t adr, uint32_t val)
case 0x0032f: logerror("MAS3507D: OutputConfig = %05x\n", val); break;
case 0x107f8:
logerror("MAS3507D: left->left gain = %05x (%d dB, %f%%)\n", val, gain_to_db(val), gain_to_percentage(val));
- stream->set_output_gain(0, gain_to_percentage(val));
+ set_output_gain(0, gain_to_percentage(val));
break;
case 0x107f9:
logerror("MAS3507D: left->right gain = %05x (%d dB, %f%%)\n", val, gain_to_db(val), gain_to_percentage(val));
@@ -300,7 +300,7 @@ void mas3507d_device::mem_write(int bank, uint32_t adr, uint32_t val)
break;
case 0x107fb:
logerror("MAS3507D: right->right gain = %05x (%d dB, %f%%)\n", val, gain_to_db(val), gain_to_percentage(val));
- stream->set_output_gain(1, gain_to_percentage(val));
+ set_output_gain(1, gain_to_percentage(val));
break;
default: logerror("MAS3507D: %d:%04x = %05x\n", bank, adr, val); break;
}
@@ -359,7 +359,7 @@ void mas3507d_device::fill_buffer()
}
}
-void mas3507d_device::append_buffer(stream_sample_t **outputs, int &pos, int scount)
+void mas3507d_device::append_buffer(stream_sample_t * const *outputs, int &pos, int scount)
{
if(!sample_count)
return;
@@ -400,7 +400,7 @@ void mas3507d_device::append_buffer(stream_sample_t **outputs, int &pos, int sco
total_frame_count += s1;
}
-void mas3507d_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int csamples)
+void mas3507d_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int csamples)
{
int pos = 0;
diff --git a/src/devices/sound/mas3507d.h b/src/devices/sound/mas3507d.h
index 64876cb321b..31410fa576e 100644
--- a/src/devices/sound/mas3507d.h
+++ b/src/devices/sound/mas3507d.h
@@ -27,7 +27,7 @@ public:
protected:
virtual void device_start() override;
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 sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
devcb_read16 cb_sample;
@@ -63,7 +63,7 @@ private:
void reg_write(uint32_t adr, uint32_t val);
void fill_buffer();
- void append_buffer(stream_sample_t **outputs, int &pos, int samples);
+ void append_buffer(stream_sample_t * const *outputs, int &pos, int samples);
};
diff --git a/src/devices/sound/mea8000.cpp b/src/devices/sound/mea8000.cpp
index ef528309897..4f7fbc453ac 100644
--- a/src/devices/sound/mea8000.cpp
+++ b/src/devices/sound/mea8000.cpp
@@ -134,7 +134,7 @@ void mea8000_device::device_start()
init_tables();
- m_stream = stream_alloc(0, 1, clock() / 60);
+ m_stream = stream_alloc_legacy(0, 1, clock() / 60);
save_item(NAME(m_output));
m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mea8000_device::timer_expire),this));
@@ -422,7 +422,7 @@ void mea8000_device::stop_frame()
-void mea8000_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void mea8000_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
for (int samp = 0; samp < samples; samp++)
{
diff --git a/src/devices/sound/mea8000.h b/src/devices/sound/mea8000.h
index 77c61669721..14cb0384d09 100644
--- a/src/devices/sound/mea8000.h
+++ b/src/devices/sound/mea8000.h
@@ -29,7 +29,7 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
/* filter coefficients from frequencies */
diff --git a/src/devices/sound/mos6560.cpp b/src/devices/sound/mos6560.cpp
index a0121a79e08..05ab0bcd08e 100644
--- a/src/devices/sound/mos6560.cpp
+++ b/src/devices/sound/mos6560.cpp
@@ -622,7 +622,7 @@ void mos6560_device::sound_start()
{
int i;
- m_channel = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
/* buffer for fastest played sample for 5 second so we have enough data for min 5 second */
m_noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC;
@@ -888,10 +888,10 @@ void mos6560_device::device_timer(emu_timer &timer, device_timer_id id, int para
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void mos6560_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void mos6560_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int i, v;
stream_sample_t *buffer = outputs[0];
diff --git a/src/devices/sound/mos6560.h b/src/devices/sound/mos6560.h
index ecee2ec3f82..cf657255198 100644
--- a/src/devices/sound/mos6560.h
+++ b/src/devices/sound/mos6560.h
@@ -124,7 +124,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
inline uint8_t read_videoram(offs_t offset);
inline uint8_t read_colorram(offs_t offset);
diff --git a/src/devices/sound/mos6581.cpp b/src/devices/sound/mos6581.cpp
index 99b3620c228..2fe073a1347 100644
--- a/src/devices/sound/mos6581.cpp
+++ b/src/devices/sound/mos6581.cpp
@@ -199,7 +199,7 @@ void mos6581_device::device_start()
m_read_poty.resolve_safe(0xff);
// create sound stream
- m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_stream = stream_alloc_legacy(0, 1, machine().sample_rate());
// initialize SID engine
m_token->device = this;
@@ -235,11 +235,11 @@ void mos6581_device::device_post_load()
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void mos6581_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void mos6581_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
m_token->fill_buffer(outputs[0], samples);
}
diff --git a/src/devices/sound/mos6581.h b/src/devices/sound/mos6581.h
index e6d694ae90d..47e5959ef41 100644
--- a/src/devices/sound/mos6581.h
+++ b/src/devices/sound/mos6581.h
@@ -65,7 +65,7 @@ protected:
virtual void device_post_load() override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
void save_state(SID6581_t *token);
private:
diff --git a/src/devices/sound/mos7360.cpp b/src/devices/sound/mos7360.cpp
index 09f0a310b45..9105fd656e3 100644
--- a/src/devices/sound/mos7360.cpp
+++ b/src/devices/sound/mos7360.cpp
@@ -297,7 +297,7 @@ void mos7360_device::device_start()
screen().register_screen_bitmap(m_bitmap);
// create sound stream
- m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_stream = stream_alloc_legacy(0, 1, machine().sample_rate());
// buffer for fastest played sample for 5 second so we have enough data for min 5 second
m_noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC;
@@ -454,11 +454,11 @@ void mos7360_device::device_timer(emu_timer &timer, device_timer_id id, int para
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void mos7360_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void mos7360_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int i, v, a;
stream_sample_t *buffer = outputs[0];
diff --git a/src/devices/sound/mos7360.h b/src/devices/sound/mos7360.h
index 93ec30b2277..7e41bddb7c6 100644
--- a/src/devices/sound/mos7360.h
+++ b/src/devices/sound/mos7360.h
@@ -110,7 +110,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_sound_interface callbacks
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
inline void set_interrupt(int mask);
inline void clear_interrupt(int mask);
diff --git a/src/devices/sound/msm5205.cpp b/src/devices/sound/msm5205.cpp
index 718f82530e7..9e889503ed9 100644
--- a/src/devices/sound/msm5205.cpp
+++ b/src/devices/sound/msm5205.cpp
@@ -98,7 +98,7 @@ void msm5205_device::device_start()
compute_tables();
/* stream system initialize */
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock());
+ m_stream = stream_alloc(0, 1, clock());
m_vck_timer = timer_alloc(TIMER_VCK);
m_capture_timer = timer_alloc(TIMER_ADPCM_CAPTURE);
@@ -360,23 +360,20 @@ void msm5205_device::device_clock_changed()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void msm5205_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void msm5205_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *buffer = outputs[0];
+ auto &output = outputs[0];
/* if this voice is active */
- if(m_signal)
+ if (m_signal)
{
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / double(1 << 12);
const int dac_mask = (m_dac_bits >= 12) ? 0 : (1 << (12 - m_dac_bits)) - 1;
- short val = (m_signal & ~dac_mask) * 16; // 10 bit DAC
- while (samples)
- {
- *buffer++ = val;
- samples--;
- }
+ stream_buffer::sample_t val = stream_buffer::sample_t(m_signal & ~dac_mask) * sample_scale;
+ output.fill(val);
}
else
- memset(buffer, 0, samples * sizeof(*buffer));
+ output.fill(0);
}
@@ -407,8 +404,8 @@ void msm6585_device::device_timer(emu_timer &timer, device_timer_id id, int para
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void msm6585_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void msm6585_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
// should this be different?
- msm5205_device::sound_stream_update(stream, inputs, outputs,samples);
+ msm5205_device::sound_stream_update(stream, inputs, outputs);
}
diff --git a/src/devices/sound/msm5205.h b/src/devices/sound/msm5205.h
index 87df5e870f8..02b8bc3746c 100644
--- a/src/devices/sound/msm5205.h
+++ b/src/devices/sound/msm5205.h
@@ -65,7 +65,7 @@ protected:
void update_adpcm();
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
void compute_tables();
virtual int get_prescaler() const;
@@ -108,7 +108,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
};
diff --git a/src/devices/sound/msm5232.cpp b/src/devices/sound/msm5232.cpp
index 9a4317491e3..da8fc499dc7 100644
--- a/src/devices/sound/msm5232.cpp
+++ b/src/devices/sound/msm5232.cpp
@@ -34,7 +34,7 @@ void msm5232_device::device_start()
init(clock(), rate);
- m_stream = machine().sound().stream_alloc(*this, 0, 11, rate);
+ m_stream = stream_alloc_legacy(0, 11, rate);
/* register with the save state system */
save_item(NAME(m_EN_out16));
@@ -725,10 +725,10 @@ void msm5232_device::set_clock(int clock)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void msm5232_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void msm5232_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buf1 = outputs[0];
stream_sample_t *buf2 = outputs[1];
diff --git a/src/devices/sound/msm5232.h b/src/devices/sound/msm5232.h
index 2dd3997a346..364f944353b 100644
--- a/src/devices/sound/msm5232.h
+++ b/src/devices/sound/msm5232.h
@@ -26,7 +26,7 @@ protected:
virtual void device_post_load() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
struct VOICE {
diff --git a/src/devices/sound/multipcm.cpp b/src/devices/sound/multipcm.cpp
index 6698792fbe1..c4a5892990f 100644
--- a/src/devices/sound/multipcm.cpp
+++ b/src/devices/sound/multipcm.cpp
@@ -450,22 +450,22 @@ void multipcm_device::write(offs_t offset, uint8_t data)
DEFINE_DEVICE_TYPE(MULTIPCM, multipcm_device, "ymw258f", "Yamaha YMW-258-F")
-multipcm_device::multipcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, MULTIPCM, tag, owner, clock),
- device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this),
- m_stream(nullptr),
- m_slots(nullptr),
- m_cur_slot(0),
- m_address(0),
- m_rate(0),
- m_attack_step(nullptr),
- m_decay_release_step(nullptr),
- m_freq_step_table(nullptr),
- m_left_pan_table(nullptr),
- m_right_pan_table(nullptr),
- m_linear_to_exp_volume(nullptr),
- m_total_level_steps(nullptr)
+multipcm_device::multipcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, MULTIPCM, tag, owner, clock),
+ device_sound_interface(mconfig, *this),
+ device_rom_interface(mconfig, *this),
+ m_stream(nullptr),
+ m_slots(nullptr),
+ m_cur_slot(0),
+ m_address(0),
+ m_rate(0),
+ m_attack_step(nullptr),
+ m_decay_release_step(nullptr),
+ m_freq_step_table(nullptr),
+ m_left_pan_table(nullptr),
+ m_right_pan_table(nullptr),
+ m_linear_to_exp_volume(nullptr),
+ m_total_level_steps(nullptr)
{
}
@@ -479,7 +479,7 @@ void multipcm_device::device_start()
const float clock_divider = 180.0f;
m_rate = (float)clock() / clock_divider;
- m_stream = machine().sound().stream_alloc(*this, 0, 2, m_rate);
+ m_stream = stream_alloc_legacy(0, 2, m_rate);
// Volume + pan table
m_left_pan_table = make_unique_clear<int32_t[]>(0x800);
@@ -677,10 +677,10 @@ void multipcm_device::dump_sample(slot_t &slot)
#endif
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void multipcm_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int32_t samples)
+void multipcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int32_t samples)
{
stream_sample_t *datap[2];
diff --git a/src/devices/sound/multipcm.h b/src/devices/sound/multipcm.h
index 7a4bc55fc2c..4308703b9dc 100644
--- a/src/devices/sound/multipcm.h
+++ b/src/devices/sound/multipcm.h
@@ -29,7 +29,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/n63701x.cpp b/src/devices/sound/n63701x.cpp
index 7ba7eb2af7f..f9dea8e4509 100644
--- a/src/devices/sound/n63701x.cpp
+++ b/src/devices/sound/n63701x.cpp
@@ -46,7 +46,7 @@ namco_63701x_device::namco_63701x_device(const machine_config &mconfig, const ch
void namco_63701x_device::device_start()
{
- m_stream = stream_alloc(0, 2, clock()/1000);
+ m_stream = stream_alloc_legacy(0, 2, clock()/1000);
for (int i = 0; i < 2; i++)
{
@@ -61,10 +61,10 @@ void namco_63701x_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void namco_63701x_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void namco_63701x_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int ch;
diff --git a/src/devices/sound/n63701x.h b/src/devices/sound/n63701x.h
index 0bb48b5afc8..4992065d7bf 100644
--- a/src/devices/sound/n63701x.h
+++ b/src/devices/sound/n63701x.h
@@ -25,7 +25,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
struct voice_63701x
diff --git a/src/devices/sound/namco.cpp b/src/devices/sound/namco.cpp
index 3eeb77617bc..830f3713b45 100644
--- a/src/devices/sound/namco.cpp
+++ b/src/devices/sound/namco.cpp
@@ -43,6 +43,8 @@
/* a position of waveform sample */
#define WAVEFORM_POSITION(n) (((n) >> m_f_fracbits) & 0x1f)
+static constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
+
DEFINE_DEVICE_TYPE(NAMCO, namco_device, "namco", "Namco")
DEFINE_DEVICE_TYPE(NAMCO_15XX, namco_15xx_device, "namco_15xx", "Namco 15xx")
DEFINE_DEVICE_TYPE(NAMCO_CUS30, namco_cus30_device, "namco_cus30", "Namco CUS30")
@@ -99,9 +101,9 @@ void namco_audio_device::device_start()
/* get stream channels */
if (m_stereo)
- m_stream = machine().sound().stream_alloc(*this, 0, 2, 192000);
+ m_stream = stream_alloc(0, 2, 192000);
else
- m_stream = machine().sound().stream_alloc(*this, 0, 1, 192000);
+ m_stream = stream_alloc(0, 1, 192000);
/* start with sound enabled, many games don't have a sound enable register */
m_sound_enable = true;
@@ -233,11 +235,11 @@ void namco_audio_device::build_decoded_waveform(uint8_t *rgnbase)
/* generate sound by oversampling */
-uint32_t namco_audio_device::namco_update_one(stream_sample_t *buffer, int length, const int16_t *wave, uint32_t counter, uint32_t freq)
+uint32_t namco_audio_device::namco_update_one(write_stream_view &buffer, const int16_t *wave, uint32_t counter, uint32_t freq)
{
- while (length-- > 0)
+ for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
{
- *buffer++ += wave[WAVEFORM_POSITION(counter)];
+ buffer.add(sampindex, stream_buffer::sample_t(wave[WAVEFORM_POSITION(counter)]) * sample_scale);
counter += freq;
}
@@ -655,25 +657,23 @@ void namco_15xx_device::sharedram_w(offs_t offset, uint8_t data)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void namco_audio_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void namco_audio_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
if (m_stereo)
{
- sound_channel *voice;
-
/* zap the contents of the buffers */
- memset(outputs[0], 0, samples * sizeof(*outputs[0]));
- memset(outputs[1], 0, samples * sizeof(*outputs[1]));
+ outputs[0].fill(0);
+ outputs[1].fill(0);
/* if no sound, we're done */
if (!m_sound_enable)
return;
/* loop over each voice and add its contribution */
- for (voice = m_channel_list; voice < m_last_channel; voice++)
+ for (sound_channel *voice = m_channel_list; voice < m_last_channel; voice++)
{
- stream_sample_t *lmix = outputs[0];
- stream_sample_t *rmix = outputs[1];
+ auto &lmix = outputs[0];
+ auto &rmix = outputs[1];
int lv = voice->volume[0];
int rv = voice->volume[1];
@@ -693,19 +693,19 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, stream_sample
int i;
/* add our contribution */
- for (i = 0; i < samples; i++)
+ for (i = 0; i < lmix.samples(); i++)
{
int cnt;
if (voice->noise_state)
{
- *lmix++ += l_noise_data;
- *rmix++ += r_noise_data;
+ lmix.add(i, stream_buffer::sample_t(l_noise_data) * sample_scale);
+ rmix.add(i, stream_buffer::sample_t(r_noise_data) * sample_scale);
}
else
{
- *lmix++ -= l_noise_data;
- *rmix++ -= r_noise_data;
+ lmix.add(i, stream_buffer::sample_t(-l_noise_data) * sample_scale);
+ rmix.add(i, stream_buffer::sample_t(-r_noise_data) * sample_scale);
}
if (hold)
@@ -746,7 +746,7 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, stream_sample
const int16_t *lw = &m_waveform[lv][voice->waveform_select * 32];
/* generate sound into the buffer */
- c = namco_update_one(lmix, samples, lw, voice->counter, voice->frequency);
+ c = namco_update_one(lmix, lw, voice->counter, voice->frequency);
}
/* only update if we have non-zero right volume */
@@ -755,7 +755,7 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, stream_sample
const int16_t *rw = &m_waveform[rv][voice->waveform_select * 32];
/* generate sound into the buffer */
- c = namco_update_one(rmix, samples, rw, voice->counter, voice->frequency);
+ c = namco_update_one(rmix, rw, voice->counter, voice->frequency);
}
/* update the counter for this voice */
@@ -768,9 +768,9 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, stream_sample
{
sound_channel *voice;
- stream_sample_t *buffer = outputs[0];
+ auto &buffer = outputs[0];
/* zap the contents of the buffer */
- memset(buffer, 0, samples * sizeof(*buffer));
+ buffer.fill(0);
/* if no sound, we're done */
if (!m_sound_enable)
@@ -779,81 +779,80 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, stream_sample
/* loop over each voice and add its contribution */
for (voice = m_channel_list; voice < m_last_channel; voice++)
{
- stream_sample_t *mix = buffer;
int v = voice->volume[0];
- if (voice->noise_sw)
- {
+ if (voice->noise_sw)
+ {
int f = voice->frequency & 0xff;
/* only update if we have non-zero volume and frequency */
if (v && f)
{
- int hold_time = 1 << (m_f_fracbits - 16);
- int hold = voice->noise_hold;
- uint32_t delta = f << 4;
- uint32_t c = voice->noise_counter;
- int16_t noise_data = OUTPUT_LEVEL(0x07 * (v >> 1));
- int i;
-
- /* add our contribution */
- for (i = 0; i < samples; i++)
+ int hold_time = 1 << (m_f_fracbits - 16);
+ int hold = voice->noise_hold;
+ uint32_t delta = f << 4;
+ uint32_t c = voice->noise_counter;
+ int16_t noise_data = OUTPUT_LEVEL(0x07 * (v >> 1));
+ int i;
+
+ /* add our contribution */
+ for (i = 0; i < buffer.samples(); i++)
+ {
+ int cnt;
+
+ if (voice->noise_state)
+ buffer.add(i, stream_buffer::sample_t(noise_data) * sample_scale);
+ else
+ buffer.add(i, stream_buffer::sample_t(-noise_data) * sample_scale);
+
+ if (hold)
{
- int cnt;
-
- if (voice->noise_state)
- *mix++ += noise_data;
- else
- *mix++ -= noise_data;
-
- if (hold)
- {
- hold--;
- continue;
- }
-
- hold = hold_time;
-
- c += delta;
- cnt = (c >> 12);
- c &= (1 << 12) - 1;
- for( ;cnt > 0; cnt--)
- {
- if ((voice->noise_seed + 1) & 2) voice->noise_state ^= 1;
- if (voice->noise_seed & 1) voice->noise_seed ^= 0x28000;
- voice->noise_seed >>= 1;
- }
+ hold--;
+ continue;
}
- /* update the counter and hold time for this voice */
- voice->noise_counter = c;
- voice->noise_hold = hold;
+ hold = hold_time;
+
+ c += delta;
+ cnt = (c >> 12);
+ c &= (1 << 12) - 1;
+ for( ;cnt > 0; cnt--)
+ {
+ if ((voice->noise_seed + 1) & 2) voice->noise_state ^= 1;
+ if (voice->noise_seed & 1) voice->noise_seed ^= 0x28000;
+ voice->noise_seed >>= 1;
+ }
}
+
+ /* update the counter and hold time for this voice */
+ voice->noise_counter = c;
+ voice->noise_hold = hold;
}
- else
- {
+ }
+ else
+ {
/* only update if we have non-zero volume and frequency */
if (v && voice->frequency)
{
const int16_t *w = &m_waveform[v][voice->waveform_select * 32];
/* generate sound into buffer and update the counter for this voice */
- voice->counter = namco_update_one(mix, samples, w, voice->counter, voice->frequency);
+ voice->counter = namco_update_one(buffer, w, voice->counter, voice->frequency);
}
}
}
}
}
-void namco_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void namco_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- namco_audio_device::sound_stream_update(stream, inputs, outputs, samples);
+ namco_audio_device::sound_stream_update(stream, inputs, outputs);
}
-void namco_15xx_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void namco_15xx_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- namco_audio_device::sound_stream_update(stream, inputs, outputs, samples);
+ namco_audio_device::sound_stream_update(stream, inputs, outputs);
}
-void namco_cus30_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void namco_cus30_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- namco_audio_device::sound_stream_update(stream, inputs, outputs, samples);
+ namco_audio_device::sound_stream_update(stream, inputs, outputs);
}
diff --git a/src/devices/sound/namco.h b/src/devices/sound/namco.h
index 770e0e287c8..6b3cee6a1f5 100644
--- a/src/devices/sound/namco.h
+++ b/src/devices/sound/namco.h
@@ -44,7 +44,7 @@ protected:
void build_decoded_waveform( uint8_t *rgnbase );
void update_namco_waveform(int offset, uint8_t data);
- uint32_t namco_update_one(stream_sample_t *buffer, int length, const int16_t *wave, uint32_t counter, uint32_t freq);
+ uint32_t namco_update_one(write_stream_view &buffer, const int16_t *wave, uint32_t counter, uint32_t freq);
/* waveform region */
optional_region_ptr<uint8_t> m_wave_ptr;
@@ -69,7 +69,7 @@ protected:
/* decoded waveform table */
int16_t *m_waveform[MAX_VOLUME];
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
};
class namco_device : public namco_audio_device
@@ -85,7 +85,7 @@ public:
void polepos_sound_w(offs_t offset, uint8_t data);
protected:
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
};
@@ -99,7 +99,7 @@ public:
void sharedram_w(offs_t offset, uint8_t data);
protected:
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
};
@@ -115,7 +115,7 @@ public:
void pacman_sound_w(offs_t offset, uint8_t data);
protected:
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
};
diff --git a/src/devices/sound/namco_163.cpp b/src/devices/sound/namco_163.cpp
index 11ff6ed1eb5..153b0bfe042 100644
--- a/src/devices/sound/namco_163.cpp
+++ b/src/devices/sound/namco_163.cpp
@@ -34,7 +34,7 @@ namco_163_sound_device::namco_163_sound_device(const machine_config &mconfig, co
void namco_163_sound_device::device_start()
{
m_ram = make_unique_clear<u8[]>(0x80);
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() / 15);
+ m_stream = stream_alloc_legacy(0, 1, clock() / 15);
save_pointer(NAME(m_ram), 0x80);
save_item(NAME(m_reg_addr));
@@ -143,7 +143,7 @@ u8 namco_163_sound_device::data_r()
}
-void namco_163_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void namco_163_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
std::fill_n(&outputs[0][0], samples, 0);
diff --git a/src/devices/sound/namco_163.h b/src/devices/sound/namco_163.h
index 1256884242b..74d2ceacb68 100644
--- a/src/devices/sound/namco_163.h
+++ b/src/devices/sound/namco_163.h
@@ -34,7 +34,7 @@ protected:
// internals
inline s8 get_sample(u16 addr);
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
};
DECLARE_DEVICE_TYPE(NAMCO_163, namco_163_sound_device)
diff --git a/src/devices/sound/nes_apu.cpp b/src/devices/sound/nes_apu.cpp
index 3f5c7787a93..1e79304fb3a 100644
--- a/src/devices/sound/nes_apu.cpp
+++ b/src/devices/sound/nes_apu.cpp
@@ -134,7 +134,7 @@ void nesapu_device::calculate_rates()
if (m_stream != nullptr)
m_stream->set_sample_rate(rate);
else
- m_stream = machine().sound().stream_alloc(*this, 0, 1, rate);
+ m_stream = stream_alloc_legacy(0, 1, rate);
}
//-------------------------------------------------
@@ -725,13 +725,14 @@ void nesapu_device::write(offs_t address, u8 value)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void nesapu_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void nesapu_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int accum;
- memset( outputs[0], 0, samples*sizeof(*outputs[0]) );
+ stream_sample_t *output = outputs[0];
+ memset( output, 0, samples*sizeof(*output) );
while (samples--)
{
@@ -747,6 +748,6 @@ void nesapu_device::sound_stream_update(sound_stream &stream, stream_sample_t **
else if (accum < -128)
accum = -128;
- *(outputs[0]++)=accum<<8;
+ *output++=accum<<8;
}
}
diff --git a/src/devices/sound/nes_apu.h b/src/devices/sound/nes_apu.h
index 731bf565940..c0e2e02244b 100644
--- a/src/devices/sound/nes_apu.h
+++ b/src/devices/sound/nes_apu.h
@@ -60,7 +60,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
/* GLOBAL CONSTANTS */
diff --git a/src/devices/sound/nile.cpp b/src/devices/sound/nile.cpp
index 80023870593..aeaeeaca59c 100644
--- a/src/devices/sound/nile.cpp
+++ b/src/devices/sound/nile.cpp
@@ -68,7 +68,7 @@ nile_device::nile_device(const machine_config &mconfig, const char *tag, device_
void nile_device::device_start()
{
- m_stream = stream_alloc(0, 2, 44100);
+ m_stream = stream_alloc_legacy(0, 2, 44100);
save_item(NAME(m_sound_regs));
save_item(NAME(m_vpos));
save_item(NAME(m_frac));
@@ -78,11 +78,11 @@ void nile_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle update requests
+// sound_stream_update_legacy - handle update requests
// for our sound stream
//-------------------------------------------------
-void nile_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void nile_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
uint8_t *sound_ram = &m_sound_ram[0];
int v, i, snum;
diff --git a/src/devices/sound/nile.h b/src/devices/sound/nile.h
index 169c90c9e4d..a87fb875c11 100644
--- a/src/devices/sound/nile.h
+++ b/src/devices/sound/nile.h
@@ -23,7 +23,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
public:
void nile_snd_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
diff --git a/src/devices/sound/okim6258.cpp b/src/devices/sound/okim6258.cpp
index 639c6fde50d..5f063f4cd87 100644
--- a/src/devices/sound/okim6258.cpp
+++ b/src/devices/sound/okim6258.cpp
@@ -114,7 +114,7 @@ void okim6258_device::device_start()
m_divider = dividers[m_start_divider];
- m_stream = stream_alloc(0, 1, clock()/m_divider);
+ m_stream = stream_alloc_legacy(0, 1, clock()/m_divider);
m_signal = -2;
m_step = 0;
@@ -138,10 +138,10 @@ void okim6258_device::device_reset()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void okim6258_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void okim6258_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
diff --git a/src/devices/sound/okim6258.h b/src/devices/sound/okim6258.h
index 57f764d4eb7..c8397b998bf 100644
--- a/src/devices/sound/okim6258.h
+++ b/src/devices/sound/okim6258.h
@@ -47,7 +47,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
void state_save_register();
diff --git a/src/devices/sound/okim6295.cpp b/src/devices/sound/okim6295.cpp
index 63a039a0b32..c3aee26e52e 100644
--- a/src/devices/sound/okim6295.cpp
+++ b/src/devices/sound/okim6295.cpp
@@ -56,24 +56,24 @@ DEFINE_DEVICE_TYPE(OKIM6295, okim6295_device, "okim6295", "OKI MSM6295 ADPCM")
// volume lookup table. The manual lists only 9 steps, ~3dB per step. Given the dB values,
// that seems to map to a 5-bit volume control. Any volume parameter beyond the 9th index
// results in silent playback.
-const uint8_t okim6295_device::s_volume_table[16] =
+const stream_buffer::sample_t okim6295_device::s_volume_table[16] =
{
- 0x20, // 0 dB
- 0x16, // -3.2 dB
- 0x10, // -6.0 dB
- 0x0b, // -9.2 dB
- 0x08, // -12.0 dB
- 0x06, // -14.5 dB
- 0x04, // -18.0 dB
- 0x03, // -20.5 dB
- 0x02, // -24.0 dB
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
+ stream_buffer::sample_t(0x20) / stream_buffer::sample_t(0x20), // 0 dB
+ stream_buffer::sample_t(0x16) / stream_buffer::sample_t(0x20), // -3.2 dB
+ stream_buffer::sample_t(0x10) / stream_buffer::sample_t(0x20), // -6.0 dB
+ stream_buffer::sample_t(0x0b) / stream_buffer::sample_t(0x20), // -9.2 dB
+ stream_buffer::sample_t(0x08) / stream_buffer::sample_t(0x20), // -12.0 dB
+ stream_buffer::sample_t(0x06) / stream_buffer::sample_t(0x20), // -14.5 dB
+ stream_buffer::sample_t(0x04) / stream_buffer::sample_t(0x20), // -18.0 dB
+ stream_buffer::sample_t(0x03) / stream_buffer::sample_t(0x20), // -20.5 dB
+ stream_buffer::sample_t(0x02) / stream_buffer::sample_t(0x20), // -24.0 dB
+ stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
+ stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
+ stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
+ stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
+ stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
+ stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
+ stream_buffer::sample_t(0x00) / stream_buffer::sample_t(0x20),
};
@@ -118,7 +118,7 @@ void okim6295_device::device_start()
// create the stream
int divisor = m_pin7_state ? 132 : 165;
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() / divisor);
+ m_stream = stream_alloc(0, 1, clock() / divisor);
save_item(NAME(m_command));
save_item(NAME(m_pin7_state));
@@ -171,18 +171,18 @@ void okim6295_device::device_clock_changed()
//-------------------------------------------------
-// stream_generate - handle update requests for
+// sound_stream_update - handle update requests for
// our sound stream
//-------------------------------------------------
-void okim6295_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void okim6295_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
// reset the output stream
- memset(outputs[0], 0, samples * sizeof(*outputs[0]));
+ outputs[0].fill(0);
// iterate over voices and accumulate sample data
for (auto & elem : m_voice)
- elem.generate_adpcm(*this, outputs[0], samples);
+ elem.generate_adpcm(*this, outputs[0]);
}
@@ -337,21 +337,22 @@ okim6295_device::okim_voice::okim_voice()
// add them to an output stream
//-------------------------------------------------
-void okim6295_device::okim_voice::generate_adpcm(device_rom_interface &rom, stream_sample_t *buffer, int samples)
+void okim6295_device::okim_voice::generate_adpcm(device_rom_interface &rom, write_stream_view &buffer)
{
// skip if not active
if (!m_playing)
return;
// loop while we still have samples to generate
- while (samples-- != 0)
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 2048.0;
+ for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
{
// fetch the next sample byte
int nibble = rom.read_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4);
// output to the buffer, scaling by the volume
- // signal in range -2048..2047, volume in range 2..32 => signal * volume / 2 in range -32768..32767
- *buffer++ += m_adpcm.clock(nibble) * m_volume / 2;
+ // signal in range -2048..2047
+ buffer.add(sampindex, m_adpcm.clock(nibble) * sample_scale * m_volume);
// next!
if (++m_sample >= m_count)
diff --git a/src/devices/sound/okim6295.h b/src/devices/sound/okim6295.h
index ee7c38f03c1..29f0a17f1a1 100644
--- a/src/devices/sound/okim6295.h
+++ b/src/devices/sound/okim6295.h
@@ -60,7 +60,7 @@ protected:
virtual void device_clock_changed() override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
@@ -70,14 +70,14 @@ protected:
{
public:
okim_voice();
- void generate_adpcm(device_rom_interface &rom, stream_sample_t *buffer, int samples);
+ void generate_adpcm(device_rom_interface &rom, write_stream_view &buffer);
- oki_adpcm_state m_adpcm; // current ADPCM state
+ oki_adpcm_state m_adpcm; // current ADPCM state
bool m_playing;
- offs_t m_base_offset; // pointer to the base memory location
- uint32_t m_sample; // current sample number
- uint32_t m_count; // total samples to play
- int8_t m_volume; // output volume
+ offs_t m_base_offset; // pointer to the base memory location
+ uint32_t m_sample; // current sample number
+ uint32_t m_count; // total samples to play
+ stream_buffer::sample_t m_volume; // output volume
};
// configuration state
@@ -86,12 +86,12 @@ protected:
// internal state
static constexpr int OKIM6295_VOICES = 4;
- okim_voice m_voice[OKIM6295_VOICES];
+ okim_voice m_voice[OKIM6295_VOICES];
int32_t m_command;
- sound_stream * m_stream;
+ sound_stream * m_stream;
uint8_t m_pin7_state;
- static const uint8_t s_volume_table[16];
+ static const stream_buffer::sample_t s_volume_table[16];
};
diff --git a/src/devices/sound/okim6376.cpp b/src/devices/sound/okim6376.cpp
index 76ee6a5f0a7..3cb3e6fc17b 100644
--- a/src/devices/sound/okim6376.cpp
+++ b/src/devices/sound/okim6376.cpp
@@ -169,7 +169,7 @@ void okim6376_device::device_start()
m_ch2_update = 0;
m_st_pulses = 0;
/* generate the name and create the stream */
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() / m_divisor);
+ m_stream = stream_alloc_legacy(0, 1, get_sample_rate());
/* initialize the voices */
for (voice = 0; voice < OKIM6376_VOICES; voice++)
@@ -252,6 +252,18 @@ offs_t okim6650_device::get_start_position(int channel)
}
+u32 okim6376_device::get_sample_rate()
+{
+ return clock() / m_divisor;
+}
+
+u32 okim6650_device::get_sample_rate()
+{
+ return clock() / 64 / m_divisor;
+}
+
+
+
void okim6376_device::oki_process(int channel, int command)
{
/* if a command is pending, process the second half */
@@ -433,12 +445,7 @@ void okim6376_device::okim6376_state_save_register()
void okim6376_device::device_clock_changed()
{
- m_stream->set_sample_rate(clock() / m_divisor);
-}
-
-void okim6650_device::device_clock_changed()
-{
- m_stream->set_sample_rate(clock() / 64 / m_divisor);
+ m_stream->set_sample_rate(get_sample_rate());
}
@@ -571,10 +578,10 @@ void okim6376_device::write(uint8_t data)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void okim6376_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void okim6376_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int i;
diff --git a/src/devices/sound/okim6376.h b/src/devices/sound/okim6376.h
index 5a73bae88e3..83be973fadf 100644
--- a/src/devices/sound/okim6376.h
+++ b/src/devices/sound/okim6376.h
@@ -32,12 +32,13 @@ protected:
virtual void device_post_load() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
virtual offs_t get_start_position(int channel);
+ virtual u32 get_sample_rate();
/* struct describing a single playing ADPCM voice */
struct ADPCMVoice
@@ -88,10 +89,8 @@ public:
DECLARE_WRITE_LINE_MEMBER( cmd_w );
protected:
- // device-level overrides
- virtual void device_clock_changed() override;
-
virtual offs_t get_start_position(int channel) override;
+ virtual u32 get_sample_rate() override;
};
DECLARE_DEVICE_TYPE(OKIM6376, okim6376_device)
diff --git a/src/devices/sound/okim9810.cpp b/src/devices/sound/okim9810.cpp
index 78717fd9ae9..a28cfb1af79 100644
--- a/src/devices/sound/okim9810.cpp
+++ b/src/devices/sound/okim9810.cpp
@@ -112,7 +112,7 @@ okim9810_device::okim9810_device(const machine_config &mconfig, const char *tag,
void okim9810_device::device_start()
{
// create the stream
- m_stream = machine().sound().stream_alloc(*this, 0, 2, clock());
+ m_stream = stream_alloc_legacy(0, 2, clock());
// save state stuff
save_item(NAME(m_TMP_register));
@@ -214,7 +214,7 @@ void okim9810_device::rom_bank_updated()
// our sound stream
//-------------------------------------------------
-void okim9810_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void okim9810_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// reset the output streams
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
@@ -613,7 +613,7 @@ okim9810_device::okim_voice::okim_voice()
//-------------------------------------------------
void okim9810_device::okim_voice::generate_audio(device_rom_interface &rom,
- stream_sample_t **buffers,
+ stream_sample_t * const *buffers,
int samples,
const uint8_t global_volume,
const uint8_t filter_type)
diff --git a/src/devices/sound/okim9810.h b/src/devices/sound/okim9810.h
index b5c8d566de0..dfb4cd047aa 100644
--- a/src/devices/sound/okim9810.h
+++ b/src/devices/sound/okim9810.h
@@ -87,7 +87,7 @@ protected:
virtual void device_clock_changed() override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
@@ -98,7 +98,7 @@ protected:
public:
okim_voice();
void generate_audio(device_rom_interface &rom,
- stream_sample_t **buffers,
+ stream_sample_t * const *buffers,
int samples,
const uint8_t global_volume,
const uint8_t filter_type);
diff --git a/src/devices/sound/pcd3311.cpp b/src/devices/sound/pcd3311.cpp
index d332caa3400..deae4f61062 100644
--- a/src/devices/sound/pcd3311.cpp
+++ b/src/devices/sound/pcd3311.cpp
@@ -48,10 +48,10 @@ void pcd3311_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void pcd3311_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void pcd3311_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
}
diff --git a/src/devices/sound/pcd3311.h b/src/devices/sound/pcd3311.h
index 25c5c630fc6..f56d63633ba 100644
--- a/src/devices/sound/pcd3311.h
+++ b/src/devices/sound/pcd3311.h
@@ -48,7 +48,7 @@ protected:
virtual void device_start() override;
// internal callbacks
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
int m_a0;
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
index 3b174c22766..f749afad2ae 100644
--- a/src/devices/sound/pokey.cpp
+++ b/src/devices/sound/pokey.cpp
@@ -677,14 +677,13 @@ void pokey_device::step_one_clock(void)
}
//-------------------------------------------------
-// stream_generate - handle update requests for
+// sound_stream_update - handle update requests for
// our sound stream
//-------------------------------------------------
-
-void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void pokey_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *buffer = outputs[0];
+ auto &buffer = outputs[0];
if (m_output_type == LEGACY_LINEAR)
{
@@ -693,26 +692,21 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
out += ((m_out_raw >> (4*i)) & 0x0f);
out *= POKEY_DEFAULT_GAIN;
out = (out > 0x7fff) ? 0x7fff : out;
- while( samples > 0 )
- {
- *buffer++ = out;
- samples--;
- }
+ stream_buffer::sample_t outsamp = out * stream_buffer::sample_t(1.0 / 32768.0);
+ buffer.fill(outsamp);
}
else if (m_output_type == RC_LOWPASS)
{
double rTot = m_voltab[m_out_raw];
- double V0 = rTot / (rTot+m_r_pullup) * m_v_ref / 5.0 * 32767.0;
+ double V0 = rTot / (rTot+m_r_pullup) * m_v_ref / 5.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());
- while( samples > 0 )
+ for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
{
/* store sum of output signals into the buffer */
m_out_filter += (V0 - m_out_filter) * mult;
- *buffer++ = m_out_filter;
- samples--;
-
+ buffer.put(sampindex, m_out_filter);
}
}
else if (m_output_type == OPAMP_C_TO_GROUND)
@@ -727,15 +721,8 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
* It is approximated by eliminating m_v_ref ( -1.0 term)
*/
- double V0 = ((rTot+m_r_pullup) / rTot - 1.0) * m_v_ref / 5.0 * 32767.0;
-
- while( samples > 0 )
- {
- /* store sum of output signals into the buffer */
- *buffer++ = V0;
- samples--;
-
- }
+ double V0 = ((rTot+m_r_pullup) / rTot - 1.0) * m_v_ref / 5.0;
+ buffer.fill(V0);
}
else if (m_output_type == OPAMP_LOW_PASS)
{
@@ -744,25 +731,19 @@ void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **i
* It is approximated by not adding in VRef below.
*/
- double V0 = (m_r_pullup / rTot) * m_v_ref / 5.0 * 32767.0;
+ double V0 = (m_r_pullup / rTot) * m_v_ref / 5.0;
double mult = (m_cap == 0.0) ? 1.0 : 1.0 - exp(-1.0 / (m_cap * m_r_pullup) * m_clock_period.as_double());
- while( samples > 0 )
+ for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
{
/* store sum of output signals into the buffer */
m_out_filter += (V0 - m_out_filter) * mult;
- *buffer++ = m_out_filter /* + m_v_ref */; // see above
- samples--;
+ buffer.put(sampindex, m_out_filter);
}
}
else if (m_output_type == DISCRETE_VAR_R)
{
- int32_t out = m_voltab[m_out_raw];
- while( samples > 0 )
- {
- *buffer++ = out;
- samples--;
- }
+ buffer.fill(m_voltab[m_out_raw]);
}
}
diff --git a/src/devices/sound/pokey.h b/src/devices/sound/pokey.h
index 47ad6519ab8..0717429aff3 100644
--- a/src/devices/sound/pokey.h
+++ b/src/devices/sound/pokey.h
@@ -193,7 +193,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
virtual void execute_run() override;
@@ -306,7 +306,7 @@ private:
uint32_t m_poly5[0x1f];
uint32_t m_poly9[0x1ff];
uint32_t m_poly17[0x1ffff];
- uint32_t m_voltab[0x10000];
+ stream_buffer::sample_t m_voltab[0x10000];
output_type m_output_type;
double m_r_pullup;
diff --git a/src/devices/sound/qs1000.cpp b/src/devices/sound/qs1000.cpp
index 0fd23945a2e..5674ab6db18 100644
--- a/src/devices/sound/qs1000.cpp
+++ b/src/devices/sound/qs1000.cpp
@@ -229,7 +229,7 @@ void qs1000_device::device_start()
// The QS1000 operates at 24MHz. Creating a stream at that rate
// would be overkill so we opt for a fraction of that rate which
// gives reasonable results
- m_stream = stream_alloc(0, 2, clock() / 32);
+ m_stream = stream_alloc_legacy(0, 2, clock() / 32);
// Resolve CPU port callbacks
m_in_p1_cb.resolve_safe(0);
@@ -466,9 +466,9 @@ void qs1000_device::wave_w(offs_t offset, uint8_t data)
//-------------------------------------------------
-// sound_stream_update -
+// sound_stream_update_legacy -
//-------------------------------------------------
-void qs1000_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void qs1000_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// Rset the output stream
memset(outputs[0], 0x0, samples * sizeof(*outputs[0]));
diff --git a/src/devices/sound/qs1000.h b/src/devices/sound/qs1000.h
index d8e5fa8c545..0c16e69b193 100644
--- a/src/devices/sound/qs1000.h
+++ b/src/devices/sound/qs1000.h
@@ -73,7 +73,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/qsound.cpp b/src/devices/sound/qsound.cpp
index 05410b73c6c..232e367f1d2 100644
--- a/src/devices/sound/qsound.cpp
+++ b/src/devices/sound/qsound.cpp
@@ -207,7 +207,7 @@ void qsound_device::device_add_mconfig(machine_config &config)
void qsound_device::device_start()
{
// hope we get good synchronisation between the DSP and the sound system
- m_stream = stream_alloc(0, 2, clock() / 2 / 1248);
+ m_stream = stream_alloc_legacy(0, 2, clock() / 2 / 1248);
// save DSP communication state
save_item(NAME(m_rom_bank));
@@ -251,10 +251,10 @@ void qsound_device::device_reset()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void qsound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void qsound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
std::fill_n(outputs[0], samples, m_samples[0]);
std::fill_n(outputs[1], samples, m_samples[1]);
diff --git a/src/devices/sound/qsound.h b/src/devices/sound/qsound.h
index 401991c6a59..ac0a1053ffe 100644
--- a/src/devices/sound/qsound.h
+++ b/src/devices/sound/qsound.h
@@ -32,7 +32,7 @@ protected:
virtual void device_reset() override;
// device_sound_interface implementation
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface implementation
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/qsoundhle.cpp b/src/devices/sound/qsoundhle.cpp
index ef99f0ee837..9ff99ee8cab 100644
--- a/src/devices/sound/qsoundhle.cpp
+++ b/src/devices/sound/qsoundhle.cpp
@@ -64,7 +64,7 @@ void qsound_hle_device::rom_bank_updated()
void qsound_hle_device::device_start()
{
- m_stream = stream_alloc(0, 2, clock() / 2 / 1248); // DSP program uses 1248 machine cycles per iteration
+ m_stream = stream_alloc_legacy(0, 2, clock() / 2 / 1248); // DSP program uses 1248 machine cycles per iteration
init_register_map();
@@ -158,10 +158,10 @@ void qsound_hle_device::device_reset()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void qsound_hle_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void qsound_hle_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// Clear the buffers
std::fill_n(outputs[0], samples, 0);
diff --git a/src/devices/sound/qsoundhle.h b/src/devices/sound/qsoundhle.h
index 6c9872fcc9d..23b92738b9b 100644
--- a/src/devices/sound/qsoundhle.h
+++ b/src/devices/sound/qsoundhle.h
@@ -30,7 +30,7 @@ protected:
virtual void device_reset() override;
// device_sound_interface implementation
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface implementation
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/rf5c400.cpp b/src/devices/sound/rf5c400.cpp
index d61ccb65337..b8de150f7f6 100644
--- a/src/devices/sound/rf5c400.cpp
+++ b/src/devices/sound/rf5c400.cpp
@@ -180,7 +180,7 @@ void rf5c400_device::device_start()
save_item(STRUCT_MEMBER(m_channels, env_step));
save_item(STRUCT_MEMBER(m_channels, env_scale));
- m_stream = stream_alloc(0, 2, clock() / 384);
+ m_stream = stream_alloc_legacy(0, 2, clock() / 384);
}
//-------------------------------------------------
@@ -195,10 +195,10 @@ void rf5c400_device::device_clock_changed()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void rf5c400_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void rf5c400_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int i, ch;
uint64_t end, loop;
diff --git a/src/devices/sound/rf5c400.h b/src/devices/sound/rf5c400.h
index faccf327bf2..fdd82910b76 100644
--- a/src/devices/sound/rf5c400.h
+++ b/src/devices/sound/rf5c400.h
@@ -34,7 +34,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/rf5c68.cpp b/src/devices/sound/rf5c68.cpp
index adb544afc64..1c00941000b 100644
--- a/src/devices/sound/rf5c68.cpp
+++ b/src/devices/sound/rf5c68.cpp
@@ -81,7 +81,7 @@ void rf5c68_device::device_start()
m_sample_end_cb.resolve();
/* allocate the stream */
- m_stream = stream_alloc(0, 2, clock() / 384);
+ m_stream = stream_alloc_legacy(0, 2, clock() / 384);
save_item(STRUCT_MEMBER(m_chan, enable));
save_item(STRUCT_MEMBER(m_chan, env));
@@ -116,10 +116,10 @@ device_memory_interface::space_config_vector rf5c68_device::memory_space_config(
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void rf5c68_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void rf5c68_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *left = outputs[0];
stream_sample_t *right = outputs[1];
diff --git a/src/devices/sound/rf5c68.h b/src/devices/sound/rf5c68.h
index f5585506828..4a1d465e291 100644
--- a/src/devices/sound/rf5c68.h
+++ b/src/devices/sound/rf5c68.h
@@ -45,7 +45,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
diff --git a/src/devices/sound/rolandpcm.cpp b/src/devices/sound/rolandpcm.cpp
index 08e8158afbe..4916605dd7e 100644
--- a/src/devices/sound/rolandpcm.cpp
+++ b/src/devices/sound/rolandpcm.cpp
@@ -61,7 +61,7 @@ void mb87419_mb87420_device::device_start()
m_clock = clock() / 2;
m_rate = m_clock / 512; // usually 32 KHz
- m_stream = machine().sound().stream_alloc(*this, 0, 2, m_rate);
+ m_stream = stream_alloc_legacy(0, 2, m_rate);
logerror("Roland PCM: Clock %u, Rate %u\n", m_clock, m_rate);
}
@@ -266,10 +266,10 @@ void mb87419_mb87420_device::write(offs_t offset, u8 data)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void mb87419_mb87420_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void mb87419_mb87420_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
memset(outputs[0], 0, samples * sizeof(stream_sample_t));
memset(outputs[1], 0, samples * sizeof(stream_sample_t));
diff --git a/src/devices/sound/rolandpcm.h b/src/devices/sound/rolandpcm.h
index 42dfa91efba..5d1e814d517 100644
--- a/src/devices/sound/rolandpcm.h
+++ b/src/devices/sound/rolandpcm.h
@@ -24,7 +24,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/rp2c33_snd.cpp b/src/devices/sound/rp2c33_snd.cpp
index 15446374ac1..57e60cf9fb5 100644
--- a/src/devices/sound/rp2c33_snd.cpp
+++ b/src/devices/sound/rp2c33_snd.cpp
@@ -56,7 +56,7 @@ void rp2c33_sound_device::device_start()
for (int i = 0; i < 4; i++)
m_mvol_table[i] = int((65536.0 / (32.0 * 64.0)) * 2.0 / double(i + 2));
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock());
+ m_stream = stream_alloc_legacy(0, 1, clock());
// save states
save_item(NAME(m_regs));
@@ -218,10 +218,10 @@ void rp2c33_sound_device::write(offs_t offset, u8 data)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void rp2c33_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void rp2c33_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
for (int i = 0; i < samples; i++)
{
diff --git a/src/devices/sound/rp2c33_snd.h b/src/devices/sound/rp2c33_snd.h
index cf3c5c23b55..73b737409c2 100644
--- a/src/devices/sound/rp2c33_snd.h
+++ b/src/devices/sound/rp2c33_snd.h
@@ -43,7 +43,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
sound_stream *m_stream = nullptr;
diff --git a/src/devices/sound/s14001a.cpp b/src/devices/sound/s14001a.cpp
index c7ceacb59a5..5230a66b534 100644
--- a/src/devices/sound/s14001a.cpp
+++ b/src/devices/sound/s14001a.cpp
@@ -226,7 +226,7 @@ ALLOW_SAVE_TYPE(s14001a_device::states); // allow save_item on a non-fundamental
void s14001a_device::device_start()
{
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() ? clock() : machine().sample_rate());
+ m_stream = stream_alloc_legacy(0, 1, clock() ? clock() : machine().sample_rate());
// resolve callbacks
m_ext_read_handler.resolve();
@@ -311,10 +311,10 @@ void s14001a_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void s14001a_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void s14001a_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
for (int i = 0; i < samples; i++)
{
diff --git a/src/devices/sound/s14001a.h b/src/devices/sound/s14001a.h
index 819cfba1920..09f985a51dc 100644
--- a/src/devices/sound/s14001a.h
+++ b/src/devices/sound/s14001a.h
@@ -31,7 +31,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
uint8_t readmem(uint16_t offset, bool phase);
diff --git a/src/devices/sound/s_dsp.cpp b/src/devices/sound/s_dsp.cpp
index 487b77bff2f..9385273ba66 100644
--- a/src/devices/sound/s_dsp.cpp
+++ b/src/devices/sound/s_dsp.cpp
@@ -160,7 +160,7 @@ void s_dsp_device::device_start()
space().cache(m_cache);
space().specific(m_data);
- m_channel = machine().sound().stream_alloc(*this, 0, 2, clock() / 64);
+ m_channel = stream_alloc_legacy(0, 2, clock() / 64);
state_register();
}
@@ -965,8 +965,8 @@ int s_dsp_device::advance_envelope( int v )
void s_dsp_device::set_volume(int volume)
{
- m_channel->set_output_gain(0, volume / 100.0);
- m_channel->set_output_gain(1, volume / 100.0);
+ set_output_gain(0, volume / 100.0);
+ set_output_gain(1, volume / 100.0);
}
@@ -1061,10 +1061,10 @@ void s_dsp_device::state_register()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void s_dsp_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void s_dsp_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
s16 mix[2];
diff --git a/src/devices/sound/s_dsp.h b/src/devices/sound/s_dsp.h
index 953991dcd2c..4ab841d0ebd 100644
--- a/src/devices/sound/s_dsp.h
+++ b/src/devices/sound/s_dsp.h
@@ -30,7 +30,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
diff --git a/src/devices/sound/saa1099.cpp b/src/devices/sound/saa1099.cpp
index 9edec91113a..cad84d184bb 100644
--- a/src/devices/sound/saa1099.cpp
+++ b/src/devices/sound/saa1099.cpp
@@ -161,7 +161,7 @@ saa1099_device::saa1099_device(const machine_config &mconfig, const char *tag, d
void saa1099_device::device_start()
{
/* for each chip allocate one stream */
- m_stream = stream_alloc(0, 2, clock()/clock_divider);
+ m_stream = stream_alloc_legacy(0, 2, clock()/clock_divider);
save_item(NAME(m_noise_params));
save_item(NAME(m_env_enable));
@@ -200,10 +200,10 @@ void saa1099_device::device_clock_changed()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void saa1099_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void saa1099_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int j, ch;
/* if the channels are disabled we're done */
diff --git a/src/devices/sound/saa1099.h b/src/devices/sound/saa1099.h
index 2831b4b1f73..2f9361d5ce8 100644
--- a/src/devices/sound/saa1099.h
+++ b/src/devices/sound/saa1099.h
@@ -32,7 +32,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
struct saa1099_channel
diff --git a/src/devices/sound/samples.cpp b/src/devices/sound/samples.cpp
index 82ce481e72e..5c8d129b799 100644
--- a/src/devices/sound/samples.cpp
+++ b/src/devices/sound/samples.cpp
@@ -86,12 +86,11 @@ void samples_device::start(uint8_t channel, uint32_t samplenum, bool loop)
// update the parameters
sample_t &sample = m_sample[samplenum];
chan.source = (sample.data.size() > 0) ? &sample.data[0] : nullptr;
- chan.source_length = sample.data.size();
- chan.source_num = (chan.source_length > 0) ? samplenum : -1;
+ chan.source_num = (chan.source_len > 0) ? samplenum : -1;
+ chan.source_len = sample.data.size();
chan.pos = 0;
- chan.frac = 0;
chan.basefreq = sample.frequency;
- chan.step = (int64_t(chan.basefreq) << FRAC_BITS) / machine().sample_rate();
+ chan.curfreq = sample.frequency;
chan.loop = loop;
}
@@ -111,12 +110,11 @@ void samples_device::start_raw(uint8_t channel, const int16_t *sampledata, uint3
// update the parameters
chan.source = sampledata;
- chan.source_length = samples;
chan.source_num = -1;
+ chan.source_len = samples;
chan.pos = 0;
- chan.frac = 0;
chan.basefreq = frequency;
- chan.step = (int64_t(chan.basefreq) << FRAC_BITS) / machine().sample_rate();
+ chan.curfreq = frequency;
chan.loop = loop;
}
@@ -133,7 +131,7 @@ void samples_device::set_frequency(uint8_t channel, uint32_t freq)
// force an update before we start
channel_t &chan = m_channel[channel];
chan.stream->update();
- chan.step = (int64_t(freq) << FRAC_BITS) / machine().sample_rate();
+ chan.curfreq = freq;
}
@@ -147,8 +145,7 @@ void samples_device::set_volume(uint8_t channel, float volume)
assert(channel < m_channels);
// force an update before we start
- channel_t &chan = m_channel[channel];
- chan.stream->set_output_gain(0, volume);
+ set_output_gain(channel, volume);
}
@@ -201,11 +198,7 @@ void samples_device::stop_all()
uint32_t samples_device::base_frequency(uint8_t channel) const
{
assert(channel < m_channels);
-
- // force an update before we start
- const channel_t &chan = m_channel[channel];
- chan.stream->update();
- return chan.basefreq;
+ return m_channel[channel].basefreq;
}
@@ -245,19 +238,17 @@ void samples_device::device_start()
{
// initialize channel
channel_t &chan = m_channel[channel];
- chan.stream = stream_alloc(0, 1, machine().sample_rate());
+ chan.stream = stream_alloc(0, 1, SAMPLE_RATE_OUTPUT_ADAPTIVE);
chan.source = nullptr;
chan.source_num = -1;
- chan.step = 0;
+ chan.pos = 0;
chan.loop = 0;
chan.paused = 0;
// register with the save state system
- save_item(NAME(chan.source_length), channel);
save_item(NAME(chan.source_num), channel);
+ save_item(NAME(chan.source_len), channel);
save_item(NAME(chan.pos), channel);
- save_item(NAME(chan.frac), channel);
- save_item(NAME(chan.step), channel);
save_item(NAME(chan.loop), channel);
save_item(NAME(chan.paused), channel);
}
@@ -296,16 +287,21 @@ void samples_device::device_post_load()
{
sample_t &sample = m_sample[chan.source_num];
chan.source = &sample.data[0];
- chan.source_length = sample.data.size();
+ chan.source_len = sample.data.size();
if (sample.data.empty())
chan.source_num = -1;
}
// validate the position against the length in case the sample is smaller
- if (chan.source != nullptr && chan.pos >= chan.source_length)
+ double endpos = chan.source_len;
+ if (chan.source != nullptr && chan.pos >= endpos)
{
if (chan.loop)
- chan.pos %= chan.source_length;
+ {
+ double posfloor = floor(chan.pos);
+ chan.pos -= posfloor;
+ chan.pos += double(int32_t(posfloor) % chan.source_len);
+ }
else
{
chan.source = nullptr;
@@ -320,60 +316,55 @@ void samples_device::device_post_load()
// sound_stream_update - update a sound stream
//-------------------------------------------------
-void samples_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void samples_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
// find the channel with this stream
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
for (int channel = 0; channel < m_channels; channel++)
if (&stream == m_channel[channel].stream)
{
channel_t &chan = m_channel[channel];
- stream_sample_t *buffer = outputs[0];
+ auto &buffer = outputs[0];
// process if we still have a source and we're not paused
if (chan.source != nullptr && !chan.paused)
{
// load some info locally
- uint32_t pos = chan.pos;
- uint32_t frac = chan.frac;
- uint32_t step = chan.step;
+ double step = double(chan.curfreq) / double(buffer.sample_rate());
+ double endpos = chan.source_len;
const int16_t *sample = chan.source;
- uint32_t sample_length = chan.source_length;
- while (samples--)
+ for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
{
// do a linear interp on the sample
- int32_t sample1 = sample[pos];
- int32_t sample2 = sample[(pos + 1) % sample_length];
- int32_t fracmult = frac >> (FRAC_BITS - 14);
- *buffer++ = ((0x4000 - fracmult) * sample1 + fracmult * sample2) >> 14;
+ double pos_floor = floor(chan.pos);
+ double frac = chan.pos - pos_floor;
+ int32_t ipos = int32_t(pos_floor);
+
+ stream_buffer::sample_t sample1 = stream_buffer::sample_t(sample[ipos++]);
+ stream_buffer::sample_t sample2 = stream_buffer::sample_t(sample[(ipos + 1) % chan.source_len]);
+ buffer.put(sampindex, sample_scale * ((1.0 - frac) * sample1 + frac * sample2));
// advance
- frac += step;
- pos += frac >> FRAC_BITS;
- frac = frac & ((1 << FRAC_BITS) - 1);
+ chan.pos += step;
// handle looping/ending
- if (pos >= sample_length)
+ if (chan.pos >= endpos)
{
if (chan.loop)
- pos %= sample_length;
+ chan.pos -= endpos;
else
{
chan.source = nullptr;
chan.source_num = -1;
- if (samples > 0)
- memset(buffer, 0, samples * sizeof(*buffer));
+ buffer.fill(0, sampindex);
break;
}
}
}
-
- // push position back out
- chan.pos = pos;
- chan.frac = frac;
}
else
- memset(buffer, 0, samples * sizeof(*buffer));
+ buffer.fill(0);
break;
}
}
diff --git a/src/devices/sound/samples.h b/src/devices/sound/samples.h
index aae6aa2cef1..394af9d0fdf 100644
--- a/src/devices/sound/samples.h
+++ b/src/devices/sound/samples.h
@@ -85,19 +85,18 @@ protected:
virtual void device_post_load() override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
// internal classes
struct channel_t
{
sound_stream * stream;
- const int16_t * source;
- int32_t source_length;
- int32_t source_num;
- uint32_t pos;
- uint32_t frac;
- uint32_t step;
- uint32_t basefreq;
+ const int16_t * source;
+ int32_t source_num;
+ uint32_t source_len;
+ double pos;
+ uint32_t basefreq;
+ uint32_t curfreq;
bool loop;
bool paused;
};
diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp
index 97256bfe01a..143be37ca40 100644
--- a/src/devices/sound/scsp.cpp
+++ b/src/devices/sound/scsp.cpp
@@ -212,7 +212,7 @@ void scsp_device::device_start()
m_main_irq_cb.resolve_safe();
// Stereo output with EXTS0,1 Input (External digital audio output)
- m_stream = machine().sound().stream_alloc(*this, 2, 2, clock() / 512);
+ m_stream = stream_alloc_legacy(2, 2, clock() / 512);
for (int slot = 0; slot < 32; slot++)
{
@@ -297,8 +297,8 @@ void scsp_device::device_post_load()
for (int slot = 0; slot < 32; slot++)
Compute_LFO(&m_Slots[slot]);
- m_stream->set_output_gain(0, MVOL() / 15.0);
- m_stream->set_output_gain(1, MVOL() / 15.0);
+ set_output_gain(0, MVOL() / 15.0);
+ set_output_gain(1, MVOL() / 15.0);
}
//-------------------------------------------------
@@ -317,10 +317,10 @@ void scsp_device::rom_bank_updated()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void scsp_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void scsp_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
m_exts0 = inputs[0];
m_exts1 = inputs[1];
@@ -738,8 +738,8 @@ void scsp_device::UpdateReg(int reg)
switch (reg & 0x3f)
{
case 0x0:
- m_stream->set_output_gain(0, MVOL() / 15.0);
- m_stream->set_output_gain(1, MVOL() / 15.0);
+ set_output_gain(0, MVOL() / 15.0);
+ set_output_gain(1, MVOL() / 15.0);
break;
case 0x2:
case 0x3:
@@ -1279,7 +1279,7 @@ inline s32 scsp_device::UpdateSlot(SCSP_SLOT *slot)
void scsp_device::DoMasterSamples(int nsamples)
{
stream_sample_t *bufr,*bufl;
- stream_sample_t *exts[2];
+ stream_sample_t const *exts[2];
bufr = m_bufferr;
bufl = m_bufferl;
diff --git a/src/devices/sound/scsp.h b/src/devices/sound/scsp.h
index 3a4e94074a6..4fe8c5e2a91 100644
--- a/src/devices/sound/scsp.h
+++ b/src/devices/sound/scsp.h
@@ -45,7 +45,7 @@ protected:
virtual void rom_bank_updated() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
enum SCSP_STATE { SCSP_ATTACK, SCSP_DECAY1, SCSP_DECAY2, SCSP_RELEASE };
@@ -150,8 +150,8 @@ private:
stream_sample_t *m_bufferl;
stream_sample_t *m_bufferr;
- stream_sample_t *m_exts0;
- stream_sample_t *m_exts1;
+ stream_sample_t const *m_exts0;
+ stream_sample_t const *m_exts1;
int m_length;
diff --git a/src/devices/sound/segapcm.cpp b/src/devices/sound/segapcm.cpp
index 576bc3d2cd0..e93bbaec7ee 100644
--- a/src/devices/sound/segapcm.cpp
+++ b/src/devices/sound/segapcm.cpp
@@ -39,7 +39,7 @@ void segapcm_device::device_start()
std::fill(&m_ram[0], &m_ram[0x800], 0xff);
- m_stream = stream_alloc(0, 2, clock() / 128);
+ m_stream = stream_alloc_legacy(0, 2, clock() / 128);
save_item(NAME(m_low));
save_pointer(NAME(m_ram), 0x800);
@@ -68,10 +68,10 @@ void segapcm_device::rom_bank_updated()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void segapcm_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void segapcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
/* clear the buffers */
memset(outputs[0], 0, samples*sizeof(*outputs[0]));
diff --git a/src/devices/sound/segapcm.h b/src/devices/sound/segapcm.h
index 666a0efed2c..8b9942a5727 100644
--- a/src/devices/sound/segapcm.h
+++ b/src/devices/sound/segapcm.h
@@ -41,7 +41,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/sn76477.cpp b/src/devices/sound/sn76477.cpp
index 3a487d29edf..2903af1904b 100644
--- a/src/devices/sound/sn76477.cpp
+++ b/src/devices/sound/sn76477.cpp
@@ -203,7 +203,7 @@ sn76477_device::sn76477_device(const machine_config &mconfig, const char *tag, d
void sn76477_device::device_start()
{
- m_channel = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
if (clock() > 0)
{
@@ -1698,10 +1698,10 @@ void sn76477_device::state_save_register()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void sn76477_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void sn76477_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
double one_shot_cap_charging_step;
double one_shot_cap_discharging_step;
diff --git a/src/devices/sound/sn76477.h b/src/devices/sound/sn76477.h
index 5e58407cb50..42fa82e5efc 100644
--- a/src/devices/sound/sn76477.h
+++ b/src/devices/sound/sn76477.h
@@ -147,7 +147,7 @@ protected:
virtual void device_stop() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
/* chip's external interface */
diff --git a/src/devices/sound/sn76496.cpp b/src/devices/sound/sn76496.cpp
index 83f2d0c5e50..9bc686dedb2 100644
--- a/src/devices/sound/sn76496.cpp
+++ b/src/devices/sound/sn76496.cpp
@@ -233,7 +233,7 @@ void sn76496_base_device::device_start()
m_ready_handler.resolve_safe();
- m_sound = machine().sound().stream_alloc(*this, 0, (m_stereo? 2:1), sample_rate);
+ m_sound = stream_alloc(0, (m_stereo? 2:1), sample_rate);
for (i = 0; i < 4; i++) m_volume[i] = 0;
@@ -369,16 +369,17 @@ inline bool sn76496_base_device::in_noise_mode()
return ((m_register[6] & 4)!=0);
}
-void sn76496_base_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void sn76496_base_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
int i;
- stream_sample_t *lbuffer = outputs[0];
- stream_sample_t *rbuffer = (m_stereo)? outputs[1] : nullptr;
+ auto *lbuffer = &outputs[0];
+ auto *rbuffer = m_stereo ? &outputs[1] : nullptr;
int16_t out;
int16_t out2 = 0;
- while (samples > 0)
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
+ for (int sampindex = 0; sampindex < lbuffer->samples(); sampindex++)
{
// clock chip once
if (m_current_clock > 0) // not ready for new divided clock
@@ -444,9 +445,9 @@ void sn76496_base_device::sound_stream_update(sound_stream &stream, stream_sampl
if (m_negate) { out = -out; out2 = -out2; }
- *(lbuffer++) = out;
- if (m_stereo) *(rbuffer++) = out2;
- samples--;
+ lbuffer->put(sampindex, stream_buffer::sample_t(out) * sample_scale);
+ if (m_stereo)
+ rbuffer->put(sampindex, stream_buffer::sample_t(out2) * sample_scale);
}
}
diff --git a/src/devices/sound/sn76496.h b/src/devices/sound/sn76496.h
index f58e259b439..da6ec178f3e 100644
--- a/src/devices/sound/sn76496.h
+++ b/src/devices/sound/sn76496.h
@@ -44,7 +44,7 @@ protected:
virtual void device_start() override;
virtual void device_clock_changed() override;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
inline bool in_noise_mode();
diff --git a/src/devices/sound/snkwave.cpp b/src/devices/sound/snkwave.cpp
index 2c9e9b75f9f..718dde017fb 100644
--- a/src/devices/sound/snkwave.cpp
+++ b/src/devices/sound/snkwave.cpp
@@ -44,7 +44,7 @@ void snkwave_device::device_start()
m_sample_rate = m_external_clock >> CLOCK_SHIFT;
/* get stream channels */
- m_stream = stream_alloc(0, 1, m_sample_rate);
+ m_stream = stream_alloc_legacy(0, 1, m_sample_rate);
/* reset all the voices */
m_frequency = 0;
@@ -60,11 +60,11 @@ void snkwave_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle update requests
+// sound_stream_update_legacy - handle update requests
// for our sound stream
//-------------------------------------------------
-void snkwave_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void snkwave_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
diff --git a/src/devices/sound/snkwave.h b/src/devices/sound/snkwave.h
index 6777118c7ca..2ecb5f7715d 100644
--- a/src/devices/sound/snkwave.h
+++ b/src/devices/sound/snkwave.h
@@ -26,7 +26,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
static constexpr unsigned WAVEFORM_LENGTH = 16;
diff --git a/src/devices/sound/sp0250.cpp b/src/devices/sound/sp0250.cpp
index 1ced1f3ff87..e18143a29b0 100644
--- a/src/devices/sound/sp0250.cpp
+++ b/src/devices/sound/sp0250.cpp
@@ -63,10 +63,7 @@ void sp0250_device::device_start()
// output PWM data at the ROMCLOCK frequency
int sample_rate = clock() / 2;
int frame_rate = sample_rate / (4 * PWM_CLOCKS);
- if (!m_pwm_mode)
- m_stream = machine().sound().stream_alloc(*this, 0, 1, frame_rate);
- else
- m_stream = machine().sound().stream_alloc(*this, 0, 1, sample_rate);
+ m_stream = stream_alloc(0, 1, m_pwm_mode ? sample_rate : frame_rate);
// if a DRQ callback is offered, run a timer at the frame rate
// to ensure the DRQ gets picked up in a timely manner
@@ -255,17 +252,19 @@ int8_t sp0250_device::next()
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void sp0250_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void sp0250_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *output = outputs[0];
+ auto &output = outputs[0];
+
if (!m_pwm_mode)
{
- while (samples-- != 0)
- *output++ = next() << 8;
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 128.0;
+ for (int sampindex = 0; sampindex < output.samples(); sampindex++)
+ output.put(sampindex, stream_buffer::sample_t(next()) * sample_scale);
}
else
{
- while (samples != 0)
+ for (int sampindex = 0; sampindex < output.samples(); )
{
// see where we're at in the current PWM cycle
if (m_pwm_index >= PWM_CLOCKS)
@@ -279,28 +278,27 @@ void sp0250_device::sound_stream_update(sound_stream &stream, stream_sample_t **
// determine the value to fill and the number of samples remaining
// until it changes
- stream_sample_t value;
+ stream_buffer::sample_t value;
int remaining;
if (m_pwm_index < m_pwm_count)
{
- value = 32767;
+ value = 1.0;
remaining = m_pwm_count - m_pwm_index;
}
else
{
- value = 0;
+ value = 0.0;
remaining = PWM_CLOCKS - m_pwm_index;
}
// clamp to the number of samples requested and advance the counters
- if (remaining > samples)
- remaining = samples;
+ if (remaining > output.samples() - sampindex)
+ remaining = output.samples() - sampindex;
m_pwm_index += remaining;
- samples -= remaining;
// fill the output
while (remaining-- != 0)
- *output++ = value;
+ outputs[0].put(sampindex++, value);
}
}
}
diff --git a/src/devices/sound/sp0250.h b/src/devices/sound/sp0250.h
index 48f77a69d01..d51ab2286bd 100644
--- a/src/devices/sound/sp0250.h
+++ b/src/devices/sound/sp0250.h
@@ -22,7 +22,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
// internal helpers
diff --git a/src/devices/sound/sp0256.cpp b/src/devices/sound/sp0256.cpp
index 54c17fcaf21..b4d18e6d6d3 100644
--- a/src/devices/sound/sp0256.cpp
+++ b/src/devices/sound/sp0256.cpp
@@ -74,7 +74,7 @@ void sp0256_device::device_start()
m_drq_cb(1);
m_sby_cb(1);
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() / CLOCK_DIVIDER);
+ m_stream = stream_alloc_legacy(0, 1, clock() / CLOCK_DIVIDER);
/* -------------------------------------------------------------------- */
/* Configure our internal variables. */
@@ -1260,10 +1260,10 @@ TIMER_CALLBACK_MEMBER(sp0256_device::set_lrq_timer_proc)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void sp0256_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void sp0256_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *output = outputs[0];
int output_index = 0;
diff --git a/src/devices/sound/sp0256.h b/src/devices/sound/sp0256.h
index 83a3aa75c5d..3720b3429ed 100644
--- a/src/devices/sound/sp0256.h
+++ b/src/devices/sound/sp0256.h
@@ -61,7 +61,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
struct lpc12_t
diff --git a/src/devices/sound/spkrdev.cpp b/src/devices/sound/spkrdev.cpp
index c44e00f5708..3fc3467771e 100644
--- a/src/devices/sound/spkrdev.cpp
+++ b/src/devices/sound/spkrdev.cpp
@@ -102,7 +102,7 @@ void speaker_sound_device::device_start()
int i;
double x;
- m_channel = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
m_level = 0;
for (i = 0; i < FILTER_LENGTH; i++)
@@ -198,11 +198,11 @@ void speaker_sound_device::device_post_load()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
// This can be triggered by the core (based on emulated time) or via level_w().
-void speaker_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void speaker_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
int volume = m_levels[m_level];
diff --git a/src/devices/sound/spkrdev.h b/src/devices/sound/spkrdev.h
index 49e953b5d40..7411e47170d 100644
--- a/src/devices/sound/spkrdev.h
+++ b/src/devices/sound/spkrdev.h
@@ -32,7 +32,7 @@ protected:
virtual void device_post_load() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
// Length of anti-aliasing filter kernel, measured in number of intermediate samples
diff --git a/src/devices/sound/spu.cpp b/src/devices/sound/spu.cpp
index c4550e928c7..82f5d3973ac 100644
--- a/src/devices/sound/spu.cpp
+++ b/src/devices/sound/spu.cpp
@@ -444,7 +444,7 @@ struct spu_device::voiceinfo
//
//
-class stream_buffer
+class spu_stream_buffer
{
public:
struct stream_marker
@@ -466,7 +466,7 @@ public:
stream_marker *marker_head,
*marker_tail;
- stream_buffer(const unsigned int _sector_size,
+ spu_stream_buffer(const unsigned int _sector_size,
const unsigned int _num_sectors)
: head(0),
tail(0),
@@ -481,7 +481,7 @@ public:
memset(&buffer[0], 0, buffer_size);
}
- ~stream_buffer()
+ ~spu_stream_buffer()
{
flush_all();
}
@@ -969,8 +969,8 @@ void spu_device::device_start()
voice=new voiceinfo [24];
spu_ram=new unsigned char [spu_ram_size];
- xa_buffer=new stream_buffer(xa_sector_size,xa_buffer_sectors);
- cdda_buffer=new stream_buffer(cdda_sector_size,cdda_buffer_sectors);
+ xa_buffer=new spu_stream_buffer(xa_sector_size,xa_buffer_sectors);
+ cdda_buffer=new spu_stream_buffer(cdda_sector_size,cdda_buffer_sectors);
init_stream();
@@ -1093,7 +1093,7 @@ void spu_device::init_stream()
{
const unsigned int hz=44100;
- m_stream = machine().sound().stream_alloc(*this, 0, 2, hz);
+ m_stream = stream_alloc_legacy(0, 2, hz);
rev=new reverb(hz);
@@ -2761,7 +2761,7 @@ void spu_device::update_timing()
//
//
-void spu_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void spu_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *outL, *outR;
int16_t temp[44100], *src;
@@ -3034,7 +3034,7 @@ bool spu_device::play_cdda(const unsigned int sector, const unsigned char *cdda)
flip[i] = flip[i+1];
flip[i+1] = temp;
}
- // this should be done in generate but sound_stream_update may not be called frequently enough
+ // this should be done in generate but sound_stream_update_legacy may not be called frequently enough
if(((spureg.irq_addr << 3) < 0x800) && (spureg.ctrl & spuctrl_irq_enable))
m_irq_handler(1);
diff --git a/src/devices/sound/spu.h b/src/devices/sound/spu.h
index b4e73c04726..7913670c667 100644
--- a/src/devices/sound/spu.h
+++ b/src/devices/sound/spu.h
@@ -7,7 +7,7 @@
// ======================> spu_device
-class stream_buffer;
+class spu_stream_buffer;
class psxcpu_device;
class spu_device : public device_t, public device_sound_interface
@@ -35,7 +35,7 @@ protected:
virtual void device_post_load() override;
virtual void device_stop() override;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
static constexpr float ms_to_rate(float ms) { return 1.0f / (ms * (float(spu_base_frequency_hz) / 1000.0f)); }
static constexpr float s_to_rate(float s) { return ms_to_rate(s * 1000.0f); }
@@ -54,8 +54,8 @@ protected:
unsigned int taddr;
unsigned int sample_t;
- stream_buffer *xa_buffer;
- stream_buffer *cdda_buffer;
+ spu_stream_buffer *xa_buffer;
+ spu_stream_buffer *cdda_buffer;
unsigned int xa_cnt;
unsigned int cdda_cnt;
unsigned int xa_freq;
diff --git a/src/devices/sound/st0016.cpp b/src/devices/sound/st0016.cpp
index 6ba2a8ec015..e0318eca466 100644
--- a/src/devices/sound/st0016.cpp
+++ b/src/devices/sound/st0016.cpp
@@ -43,7 +43,7 @@ st0016_device::st0016_device(const machine_config &mconfig, const char *tag, dev
void st0016_device::device_start()
{
- m_stream = stream_alloc(0, 2, 44100);
+ m_stream = stream_alloc_legacy(0, 2, 44100);
m_ram_read_cb.resolve_safe(0);
save_item(NAME(m_vpos));
@@ -54,10 +54,10 @@ void st0016_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void st0016_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void st0016_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int v, i, snum;
unsigned char *slot;
diff --git a/src/devices/sound/st0016.h b/src/devices/sound/st0016.h
index 4dde038cfe8..21dd14e07c7 100644
--- a/src/devices/sound/st0016.h
+++ b/src/devices/sound/st0016.h
@@ -27,7 +27,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
sound_stream *m_stream;
diff --git a/src/devices/sound/swp00.cpp b/src/devices/sound/swp00.cpp
index 0fa494658b1..d4d323af0a5 100644
--- a/src/devices/sound/swp00.cpp
+++ b/src/devices/sound/swp00.cpp
@@ -21,7 +21,7 @@ void swp00_device::device_add_mconfig(machine_config &config)
void swp00_device::device_start()
{
- m_stream = stream_alloc(0, 2, 44100);
+ m_stream = stream_alloc_legacy(0, 2, 44100);
}
void swp00_device::device_reset()
@@ -97,6 +97,6 @@ void swp00_device::snd_w(offs_t offset, u8 data)
// Synthesis
-void swp00_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void swp00_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
}
diff --git a/src/devices/sound/swp00.h b/src/devices/sound/swp00.h
index 9ada0cdaadb..0bf2d8b43d3 100644
--- a/src/devices/sound/swp00.h
+++ b/src/devices/sound/swp00.h
@@ -21,7 +21,7 @@ public:
protected:
virtual void device_start() override;
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 sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
virtual void rom_bank_updated() override;
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/sound/swp20.cpp b/src/devices/sound/swp20.cpp
index c5127168f11..c1c92c8cb27 100644
--- a/src/devices/sound/swp20.cpp
+++ b/src/devices/sound/swp20.cpp
@@ -69,7 +69,7 @@ void swp20_device::snd_w(offs_t offset, u8 data)
logerror("w %02x, %02x %s\n", offset, data, machine().describe_context());
}
-void swp20_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void swp20_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
}
diff --git a/src/devices/sound/swp20.h b/src/devices/sound/swp20.h
index b2aca4c8a71..a65bae793a3 100644
--- a/src/devices/sound/swp20.h
+++ b/src/devices/sound/swp20.h
@@ -20,7 +20,7 @@ public:
protected:
virtual void device_start() override;
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 sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
virtual void rom_bank_updated() override;
private:
diff --git a/src/devices/sound/swp30.cpp b/src/devices/sound/swp30.cpp
index 18b4f498c1b..849af9f9946 100644
--- a/src/devices/sound/swp30.cpp
+++ b/src/devices/sound/swp30.cpp
@@ -163,7 +163,7 @@ void swp30_device::device_add_mconfig(machine_config &config)
void swp30_device::device_start()
{
- m_stream = stream_alloc(0, 2, 44100);
+ m_stream = stream_alloc_legacy(0, 2, 44100);
// 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
@@ -761,7 +761,7 @@ void swp30_device::snd_w(offs_t offset, u16 data)
// Synthesis
-void swp30_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void swp30_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// Loop first on the samples and not on the channels otherwise
// effects will be annoying to implement.
diff --git a/src/devices/sound/swp30.h b/src/devices/sound/swp30.h
index 35a90341bf3..fc8424b66d2 100644
--- a/src/devices/sound/swp30.h
+++ b/src/devices/sound/swp30.h
@@ -21,7 +21,7 @@ public:
protected:
virtual void device_start() override;
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 sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
virtual void rom_bank_updated() override;
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/sound/t6721a.cpp b/src/devices/sound/t6721a.cpp
index 423cd3edc19..7c0c07544e0 100644
--- a/src/devices/sound/t6721a.cpp
+++ b/src/devices/sound/t6721a.cpp
@@ -56,16 +56,16 @@ void t6721a_device::device_start()
m_write_apd.resolve_safe();
// create sound stream
- m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_stream = stream_alloc_legacy(0, 1, machine().sample_rate());
}
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void t6721a_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void t6721a_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
}
diff --git a/src/devices/sound/t6721a.h b/src/devices/sound/t6721a.h
index ebc7ea6924e..208cd7e8896 100644
--- a/src/devices/sound/t6721a.h
+++ b/src/devices/sound/t6721a.h
@@ -65,7 +65,7 @@ protected:
virtual void device_start() override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
enum
diff --git a/src/devices/sound/t6w28.cpp b/src/devices/sound/t6w28.cpp
index cc7324d41f1..6c024c37757 100644
--- a/src/devices/sound/t6w28.cpp
+++ b/src/devices/sound/t6w28.cpp
@@ -101,10 +101,10 @@ void t6w28_device::write(offs_t offset, uint8_t data)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void t6w28_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void t6w28_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int i;
stream_sample_t *buffer0 = outputs[0];
@@ -296,7 +296,7 @@ void t6w28_device::device_start()
int i;
m_sample_rate = clock() / 16;
- m_channel = machine().sound().stream_alloc(*this, 0, 2, m_sample_rate);
+ m_channel = stream_alloc_legacy(0, 2, m_sample_rate);
for (i = 0;i < 8;i++) m_volume[i] = 0;
diff --git a/src/devices/sound/t6w28.h b/src/devices/sound/t6w28.h
index e6cc2d9319d..f1112f58839 100644
--- a/src/devices/sound/t6w28.h
+++ b/src/devices/sound/t6w28.h
@@ -18,7 +18,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
void set_gain(int gain);
diff --git a/src/devices/sound/tc8830f.cpp b/src/devices/sound/tc8830f.cpp
index 37a6fecdbe3..e387cc746f7 100644
--- a/src/devices/sound/tc8830f.cpp
+++ b/src/devices/sound/tc8830f.cpp
@@ -46,7 +46,7 @@ tc8830f_device::tc8830f_device(const machine_config &mconfig, const char *tag, d
void tc8830f_device::device_start()
{
// create the stream
- m_stream = stream_alloc(0, 1, clock() / 0x10);
+ m_stream = stream_alloc_legacy(0, 1, clock() / 0x10);
// register for savestates
save_item(NAME(m_playing));
@@ -79,7 +79,7 @@ void tc8830f_device::device_clock_changed()
-void tc8830f_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void tc8830f_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int32_t mix = 0;
diff --git a/src/devices/sound/tc8830f.h b/src/devices/sound/tc8830f.h
index f108eb72f69..e0e715ccbef 100644
--- a/src/devices/sound/tc8830f.h
+++ b/src/devices/sound/tc8830f.h
@@ -32,7 +32,7 @@ protected:
virtual void device_post_load() override;
virtual void device_clock_changed() override;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
sound_stream *m_stream;
diff --git a/src/devices/sound/tiaintf.cpp b/src/devices/sound/tiaintf.cpp
index d382707612a..5c85db19b91 100644
--- a/src/devices/sound/tiaintf.cpp
+++ b/src/devices/sound/tiaintf.cpp
@@ -31,7 +31,7 @@ tia_device::tia_device(const machine_config &mconfig, const char *tag, device_t
void tia_device::device_start()
{
- m_channel = stream_alloc(0, 1, clock());
+ m_channel = stream_alloc_legacy(0, 1, clock());
m_chip = tia_sound_init(this, clock(), clock(), 16);
if (!m_chip)
throw emu_fatalerror("tia_device(%s): Error creating TIA chip", tag());
@@ -49,10 +49,10 @@ void tia_device::device_stop()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void tia_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void tia_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
tia_process(m_chip, outputs[0], samples);
}
diff --git a/src/devices/sound/tiaintf.h b/src/devices/sound/tiaintf.h
index 140c4f3de65..c86be7173a9 100644
--- a/src/devices/sound/tiaintf.h
+++ b/src/devices/sound/tiaintf.h
@@ -24,7 +24,7 @@ protected:
virtual void device_stop() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
sound_stream *m_channel;
diff --git a/src/devices/sound/tms3615.cpp b/src/devices/sound/tms3615.cpp
index 85f1ec5ece0..e59c64eab04 100644
--- a/src/devices/sound/tms3615.cpp
+++ b/src/devices/sound/tms3615.cpp
@@ -3,9 +3,6 @@
#include "emu.h"
#include "tms3615.h"
-#define VMIN 0x0000
-#define VMAX 0x7fff
-
const int tms3615_device::divisor[TMS3615_TONES] = { 478, 451, 426, 402, 379, 358, 338, 319, 301, 284, 268, 253, 239 };
@@ -49,20 +46,22 @@ void tms3615_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void tms3615_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void tms3615_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- int samplerate = m_samplerate;
- stream_sample_t *buffer8 = outputs[FOOTAGE_8];
- stream_sample_t *buffer16 = outputs[FOOTAGE_16];
+ auto &buffer8 = outputs[FOOTAGE_8];
+ auto &buffer16 = outputs[FOOTAGE_16];
+
+ int samplerate = buffer8.sample_rate();
- while( samples-- > 0 )
+ constexpr stream_buffer::sample_t VMAX = 1.0f / stream_buffer::sample_t(TMS3615_TONES);
+ for (int sampindex = 0; sampindex < buffer8.samples(); sampindex++)
{
- int sum8 = 0, sum16 = 0, tone = 0;
+ stream_buffer::sample_t sum8 = 0, sum16 = 0;
- for (tone = 0; tone < TMS3615_TONES; tone++)
+ for (int tone = 0; tone < TMS3615_TONES; tone++)
{
// 8'
@@ -95,11 +94,9 @@ void tms3615_device::sound_stream_update(sound_stream &stream, stream_sample_t *
}
}
- *buffer8++ = sum8 / TMS3615_TONES;
- *buffer16++ = sum16 / TMS3615_TONES;
+ buffer8.put(sampindex, sum8);
+ buffer16.put(sampindex, sum16);
}
-
- m_enable = 0;
}
diff --git a/src/devices/sound/tms3615.h b/src/devices/sound/tms3615.h
index b3325ebc354..a1eeaab5318 100644
--- a/src/devices/sound/tms3615.h
+++ b/src/devices/sound/tms3615.h
@@ -28,7 +28,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
static constexpr unsigned TMS3615_TONES = 13;
diff --git a/src/devices/sound/tms36xx.cpp b/src/devices/sound/tms36xx.cpp
index 89211700a7d..73ec59b4121 100644
--- a/src/devices/sound/tms36xx.cpp
+++ b/src/devices/sound/tms36xx.cpp
@@ -355,7 +355,7 @@ void tms36xx_device::device_start()
{
int enable = 0;
- m_channel = stream_alloc(0, 1, clock() * 64);
+ m_channel = stream_alloc_legacy(0, 1, clock() * 64);
m_samplerate = clock() * 64;
m_basefreq = clock();
@@ -394,10 +394,10 @@ void tms36xx_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void tms36xx_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void tms36xx_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int samplerate = m_samplerate;
stream_sample_t *buffer = outputs[0];
diff --git a/src/devices/sound/tms36xx.h b/src/devices/sound/tms36xx.h
index 3e517a09f77..03dd5dc2412 100644
--- a/src/devices/sound/tms36xx.h
+++ b/src/devices/sound/tms36xx.h
@@ -63,7 +63,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
public:
// MM6221AA interface functions
diff --git a/src/devices/sound/tms5110.cpp b/src/devices/sound/tms5110.cpp
index d9d8427688a..73f5244738e 100644
--- a/src/devices/sound/tms5110.cpp
+++ b/src/devices/sound/tms5110.cpp
@@ -1048,7 +1048,7 @@ void tms5110_device::device_start()
m_data_cb.resolve();
/* initialize a stream */
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() / 80);
+ m_stream = stream_alloc_legacy(0, 1, clock() / 80);
m_state = CTL_STATE_INPUT; /* most probably not defined */
m_romclk_hack_timer = timer_alloc(0);
@@ -1220,10 +1220,10 @@ int tms5110_device::romclk_hack_r()
******************************************************************************/
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void tms5110_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void tms5110_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int16_t sample_data[MAX_SAMPLE_CHUNK];
stream_sample_t *buffer = outputs[0];
diff --git a/src/devices/sound/tms5110.h b/src/devices/sound/tms5110.h
index d873da55db4..84c7f68fc73 100644
--- a/src/devices/sound/tms5110.h
+++ b/src/devices/sound/tms5110.h
@@ -60,7 +60,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
uint8_t TALK_STATUS() const { return m_SPEN | m_TALKD; }
diff --git a/src/devices/sound/tms5220.cpp b/src/devices/sound/tms5220.cpp
index 4889cd85c60..9c4974c34e2 100644
--- a/src/devices/sound/tms5220.cpp
+++ b/src/devices/sound/tms5220.cpp
@@ -1649,7 +1649,7 @@ void tms5220_device::device_start()
m_data_cb.resolve();
/* initialize a stream */
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() / 80);
+ m_stream = stream_alloc(0, 1, clock() / 80);
m_timer_io_ready = timer_alloc(0);
@@ -2055,24 +2055,21 @@ READ_LINE_MEMBER( tms5220_device::intq_r )
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void tms5220_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void tms5220_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
int16_t sample_data[MAX_SAMPLE_CHUNK];
- stream_sample_t *buffer = outputs[0];
+ auto &output = outputs[0];
/* loop while we still have samples to generate */
- while (samples)
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
+ for (int sampindex = 0; sampindex < output.samples(); )
{
- int length = (samples > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : samples;
- int index;
+ int length = (output.samples() > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : output.samples();
/* generate the samples and copy to the target buffer */
process(sample_data, length);
- for (index = 0; index < length; index++)
- *buffer++ = sample_data[index];
-
- /* account for the samples */
- samples -= length;
+ for (int index = 0; index < length; index++)
+ output.put(sampindex++, sample_data[index] * sample_scale);
}
}
diff --git a/src/devices/sound/tms5220.h b/src/devices/sound/tms5220.h
index bc844b04e7b..5c45a685e21 100644
--- a/src/devices/sound/tms5220.h
+++ b/src/devices/sound/tms5220.h
@@ -75,7 +75,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
static constexpr unsigned FIFO_SIZE = 16;
diff --git a/src/devices/sound/upd1771.cpp b/src/devices/sound/upd1771.cpp
index c646f9954a6..bb8e61f2d00 100644
--- a/src/devices/sound/upd1771.cpp
+++ b/src/devices/sound/upd1771.cpp
@@ -255,7 +255,7 @@ void upd1771c_device::device_start()
m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(upd1771c_device::ack_callback),this));
- m_channel = machine().sound().stream_alloc(*this, 0, 1, clock() / 4);
+ m_channel = stream_alloc_legacy(0, 1, clock() / 4);
save_item(NAME(m_packet));
save_item(NAME(m_index));
@@ -476,10 +476,10 @@ TIMER_CALLBACK_MEMBER( upd1771c_device::ack_callback )
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void upd1771c_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void upd1771c_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
diff --git a/src/devices/sound/upd1771.h b/src/devices/sound/upd1771.h
index 7dfc7ae32e5..9fe86b58c1d 100644
--- a/src/devices/sound/upd1771.h
+++ b/src/devices/sound/upd1771.h
@@ -32,7 +32,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
static constexpr unsigned MAX_PACKET_SIZE = 0x8000;
diff --git a/src/devices/sound/upd7752.cpp b/src/devices/sound/upd7752.cpp
index c1253da1a2b..19977dcafdc 100644
--- a/src/devices/sound/upd7752.cpp
+++ b/src/devices/sound/upd7752.cpp
@@ -72,7 +72,7 @@ device_memory_interface::space_config_vector upd7752_device::memory_space_config
void upd7752_device::device_start()
{
/* TODO: clock */
- m_stream = stream_alloc(0, 1, clock() / 64);
+ m_stream = stream_alloc_legacy(0, 1, clock() / 64);
m_status = 0;
}
@@ -96,10 +96,10 @@ void upd7752_device::device_stop()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void upd7752_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void upd7752_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
}
diff --git a/src/devices/sound/upd7752.h b/src/devices/sound/upd7752.h
index 85c3cd82d3c..b65048624f1 100644
--- a/src/devices/sound/upd7752.h
+++ b/src/devices/sound/upd7752.h
@@ -30,7 +30,7 @@ protected:
virtual void device_stop() override;
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 sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
virtual space_config_vector memory_space_config() const override;
private:
diff --git a/src/devices/sound/upd7759.cpp b/src/devices/sound/upd7759.cpp
index 35a66d0b736..fc07c0f95ab 100644
--- a/src/devices/sound/upd7759.cpp
+++ b/src/devices/sound/upd7759.cpp
@@ -210,7 +210,7 @@ upd7756_device::upd7756_device(const machine_config &mconfig, device_type type,
void upd775x_device::device_start()
{
// allocate a stream channel
- m_channel = machine().sound().stream_alloc(*this, 0, 1, clock()/4);
+ m_channel = stream_alloc(0, 1, clock()/4);
// compute the stepping rate based on the chip's clock speed
m_step = 4 * FRAC_ONE;
@@ -264,7 +264,7 @@ void upd7759_device::device_start()
// chip configuration
m_sample_offset_shift = 1;
- m_timer = timer_alloc(TIMER_SLAVE_UPDATE);
+ m_timer = timer_alloc(TID_SLAVE_UPDATE);
m_drqcallback.resolve_safe();
@@ -599,24 +599,35 @@ void upd7759_device::device_timer(emu_timer &timer, device_timer_id id, int para
switch (id)
{
- case TIMER_SLAVE_UPDATE:
+ case TID_PORT_WRITE:
+ m_fifo_in = param;
+ break;
+
+ case TID_RESET_WRITE:
+ internal_reset_w(param);
+ break;
+
+ case TID_START_WRITE:
+ internal_start_w(param);
+ break;
- /* update the stream */
- m_channel->update();
+ case TID_SLAVE_UPDATE:
+ /* update the stream */
+ m_channel->update();
- /* advance the state */
- advance_state();
+ /* advance the state */
+ advance_state();
- /* if the DRQ changed, update it */
- if (DEBUG_STATES)
- logerror("upd7759_slave_update: DRQ %d->%d\n", olddrq, m_drq);
- if (olddrq != m_drq)
- m_drqcallback(m_drq);
+ /* if the DRQ changed, update it */
+ if (DEBUG_STATES)
+ logerror("upd7759_slave_update: DRQ %d->%d\n", olddrq, m_drq);
+ if (olddrq != m_drq)
+ m_drqcallback(m_drq);
- /* set a timer to go off when that is done */
- if (m_state != STATE_IDLE)
- m_timer->adjust(m_clock_period * m_clocks_left);
- break;
+ /* set a timer to go off when that is done */
+ if (m_state != STATE_IDLE)
+ m_timer->adjust(m_clock_period * m_clocks_left);
+ break;
default:
throw emu_fatalerror("Unknown id in upd7759_device::device_timer");
@@ -631,6 +642,11 @@ void upd7759_device::device_timer(emu_timer &timer, device_timer_id id, int para
WRITE_LINE_MEMBER( upd775x_device::reset_w )
{
+ synchronize(TID_RESET_WRITE, state);
+}
+
+void upd775x_device::internal_reset_w(int state)
+{
/* update the reset value */
uint8_t oldreset = m_reset;
m_reset = (state != 0);
@@ -643,12 +659,12 @@ WRITE_LINE_MEMBER( upd775x_device::reset_w )
device_reset();
}
-WRITE_LINE_MEMBER(upd7759_device::md_w)
+WRITE_LINE_MEMBER( upd775x_device::start_w )
{
- m_md = state;
+ synchronize(TID_START_WRITE, state);
}
-WRITE_LINE_MEMBER( upd7759_device::start_w )
+void upd7759_device::internal_start_w(int state)
{
/* update the start value */
uint8_t oldstart = m_start;
@@ -671,8 +687,9 @@ WRITE_LINE_MEMBER( upd7759_device::start_w )
}
}
-WRITE_LINE_MEMBER( upd7756_device::start_w )
+void upd7756_device::internal_start_w(int state)
{
+
/* update the start value */
uint8_t oldstart = m_start;
m_start = (state != 0);
@@ -694,7 +711,7 @@ WRITE_LINE_MEMBER( upd7756_device::start_w )
void upd775x_device::port_w(u8 data)
{
/* update the FIFO value */
- m_fifo_in = data;
+ synchronize(TID_PORT_WRITE, data);
}
@@ -712,21 +729,21 @@ READ_LINE_MEMBER( upd775x_device::busy_r )
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void upd775x_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void upd775x_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
+ constexpr stream_buffer::sample_t sample_scale = 128.0 / 32768.0;
+ stream_buffer::sample_t sample = stream_buffer::sample_t(m_sample) * sample_scale;
int32_t clocks_left = m_clocks_left;
- int16_t sample = m_sample;
uint32_t step = m_step;
uint32_t pos = m_pos;
- stream_sample_t *buffer = outputs[0];
/* loop until done */
+ u32 index = 0;
if (m_state != STATE_IDLE)
- while (samples != 0)
+ for ( ; index < outputs[0].samples(); index++)
{
/* store the current sample */
- *buffer++ = sample << 7;
- samples--;
+ outputs[0].put(index, sample);
/* advance by the number of clocks/output sample */
pos += step;
@@ -752,14 +769,14 @@ void upd775x_device::sound_stream_update(sound_stream &stream, stream_sample_t *
/* reimport the variables that we cached */
clocks_left = m_clocks_left;
- sample = m_sample;
+ sample = stream_buffer::sample_t(m_sample) * sample_scale;
}
}
}
/* if we got out early, just zap the rest of the buffer */
- if (samples != 0)
- memset(buffer, 0, samples * sizeof(*buffer));
+ for (; index < outputs[0].samples(); index++)
+ outputs[0].put(index, 0);
/* flush the state back */
m_clocks_left = clocks_left;
diff --git a/src/devices/sound/upd7759.h b/src/devices/sound/upd7759.h
index 813f5270d89..ab1ff98e3a2 100644
--- a/src/devices/sound/upd7759.h
+++ b/src/devices/sound/upd7759.h
@@ -23,11 +23,23 @@ public:
enum : u32 { STANDARD_CLOCK = 640'000 };
DECLARE_WRITE_LINE_MEMBER( reset_w );
+ DECLARE_WRITE_LINE_MEMBER( start_w );
DECLARE_READ_LINE_MEMBER( busy_r );
virtual void port_w(u8 data);
void set_start_delay(uint32_t data) { m_start_delay = data; };
protected:
+ virtual void internal_start_w(int state) = 0;
+ virtual void internal_reset_w(int state);
+
+ enum
+ {
+ TID_PORT_WRITE,
+ TID_START_WRITE,
+ TID_RESET_WRITE,
+ TID_SLAVE_UPDATE
+ };
+
// chip states
enum
{
@@ -56,7 +68,7 @@ protected:
virtual void rom_bank_updated() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
void update_adpcm(int data);
virtual void advance_state();
@@ -110,14 +122,10 @@ public:
upd7759_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = STANDARD_CLOCK);
- DECLARE_WRITE_LINE_MEMBER( md_w );
- DECLARE_WRITE_LINE_MEMBER( start_w );
+ DECLARE_WRITE_LINE_MEMBER( md_w ) { m_md = state; }
protected:
- enum
- {
- TIMER_SLAVE_UPDATE
- };
+ virtual void internal_start_w(int state) override;
upd7759_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -136,9 +144,9 @@ public:
virtual void device_reset() override;
- DECLARE_WRITE_LINE_MEMBER( start_w );
-
protected:
+ virtual void internal_start_w(int state) override;
+
upd7756_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_start() override;
diff --git a/src/devices/sound/upd934g.cpp b/src/devices/sound/upd934g.cpp
index 75ba3fb4186..fecb6fc8a18 100644
--- a/src/devices/sound/upd934g.cpp
+++ b/src/devices/sound/upd934g.cpp
@@ -49,7 +49,7 @@ upd934g_device::upd934g_device(const machine_config &mconfig, const char *tag, d
void upd934g_device::device_start()
{
// create sound stream
- m_stream = machine().sound().stream_alloc(*this, 0, 4, 20000);
+ m_stream = stream_alloc_legacy(0, 4, 20000);
// resolve callbacks
m_data_cb.resolve_safe(0);
@@ -81,11 +81,11 @@ void upd934g_device::device_reset()
}
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void upd934g_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void upd934g_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
for (unsigned ch = 0; ch < 4; ch++)
{
diff --git a/src/devices/sound/upd934g.h b/src/devices/sound/upd934g.h
index 9d872104617..ed145671c38 100644
--- a/src/devices/sound/upd934g.h
+++ b/src/devices/sound/upd934g.h
@@ -36,7 +36,7 @@ protected:
virtual void device_start() override;
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 sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
devcb_read8 m_data_cb;
diff --git a/src/devices/sound/vgm_visualizer.cpp b/src/devices/sound/vgm_visualizer.cpp
index 129f84c0a5a..c1f438f2b2c 100644
--- a/src/devices/sound/vgm_visualizer.cpp
+++ b/src/devices/sound/vgm_visualizer.cpp
@@ -283,35 +283,25 @@ void vgmviz_device::cycle_viz_mode()
// audio stream and process as necessary
//-------------------------------------------------
-void vgmviz_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void vgmviz_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- // clear output buffers
- for (int output = 0; output < m_outputs; output++)
- std::fill_n(outputs[output], samples, 0);
+ // call the normal interface to actually mix
+ device_mixer_interface::sound_stream_update(stream, inputs, outputs);
- m_current_rate = stream.sample_rate();
-
- // loop over samples
- const u8 *outmap = &m_outputmap[0];
-
- // for each input, add it to the appropriate output
- for (int pos = 0; pos < samples; pos++)
+ // now consume the outputs
+ for (int pos = 0; pos < outputs[0].samples(); pos++)
{
- for (int inp = 0; inp < m_auto_allocated_inputs; inp++)
- {
- outputs[outmap[inp]][pos] += inputs[inp][pos];
- }
-
- for (int i = 0; i < m_outputs; i++)
+ for (int i = 0; i < outputs.size(); i++)
{
- const float sample = (float)(int16_t)outputs[i][pos] / 65336.0f;
+ // Original code took 16-bit sample / 65536.0 instead of 32768.0, so multiply by 0.5 here but is it necessary?
+ const float sample = outputs[i].get(pos) * 0.5f;
m_audio_buf[m_audio_fill_index][i][m_audio_count[m_audio_fill_index]] = sample + 0.5f;
}
switch (m_viz_mode)
{
default:
- update_waveform(outputs);
+ update_waveform();
break;
case VIZ_WATERFALL:
case VIZ_RAW_SPEC:
@@ -325,7 +315,7 @@ void vgmviz_device::sound_stream_update(sound_stream &stream, stream_sample_t **
case VIZ_TOP_SPEC4:
case VIZ_TOP_SPEC8:
case VIZ_TOP_SPEC16:
- update_fft(outputs);
+ update_fft();
break;
}
}
@@ -336,7 +326,7 @@ void vgmviz_device::sound_stream_update(sound_stream &stream, stream_sample_t **
// update_waveform - perform a wave-style update
//-------------------------------------------------
-void vgmviz_device::update_waveform(stream_sample_t **outputs)
+void vgmviz_device::update_waveform()
{
m_history_length++;
m_audio_count[m_audio_fill_index]++;
@@ -355,7 +345,7 @@ void vgmviz_device::update_waveform(stream_sample_t **outputs)
// update_fft - keep the FFT up-to-date
//-------------------------------------------------
-void vgmviz_device::update_fft(stream_sample_t **outputs)
+void vgmviz_device::update_fft()
{
m_audio_count[m_audio_fill_index]++;
if (m_audio_count[m_audio_fill_index] >= FFT_LENGTH)
diff --git a/src/devices/sound/vgm_visualizer.h b/src/devices/sound/vgm_visualizer.h
index 8455b3d2bc0..516e4e4bfad 100644
--- a/src/devices/sound/vgm_visualizer.h
+++ b/src/devices/sound/vgm_visualizer.h
@@ -91,10 +91,10 @@ protected:
virtual void device_reset() override;
// device_sound_interface-level overrides
- void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
- void update_waveform(stream_sample_t **outputs);
- void update_fft(stream_sample_t **outputs);
+ void update_waveform();
+ void update_fft();
void init_palette(palette_device &palette) const;
diff --git a/src/devices/sound/vlm5030.cpp b/src/devices/sound/vlm5030.cpp
index 0d71f7e60b9..3d3cc7863fd 100644
--- a/src/devices/sound/vlm5030.cpp
+++ b/src/devices/sound/vlm5030.cpp
@@ -214,7 +214,7 @@ void vlm5030_device::device_start()
device_reset();
m_phase = PH_IDLE;
- m_channel = machine().sound().stream_alloc(*this, 0, 1, clock() / 440);
+ m_channel = stream_alloc_legacy(0, 1, clock() / 440);
save_item(NAME(m_address));
save_item(NAME(m_pin_BSY));
@@ -491,10 +491,10 @@ if( m_interp_step != 1)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void vlm5030_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void vlm5030_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int buf_count=0;
int interp_effect;
diff --git a/src/devices/sound/vlm5030.h b/src/devices/sound/vlm5030.h
index 891fb7ca595..7520bf76007 100644
--- a/src/devices/sound/vlm5030.h
+++ b/src/devices/sound/vlm5030.h
@@ -34,7 +34,7 @@ protected:
virtual void device_post_load() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/volt_reg.cpp b/src/devices/sound/volt_reg.cpp
index dbd922a808f..48693204e46 100644
--- a/src/devices/sound/volt_reg.cpp
+++ b/src/devices/sound/volt_reg.cpp
@@ -21,19 +21,16 @@ 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(1.0)
{
}
void voltage_regulator_device::device_start()
{
- m_stream = stream_alloc(0, 1, 48000 * 4);
+ m_stream = stream_alloc(0, 1, SAMPLE_RATE_OUTPUT_ADAPTIVE);
}
-void voltage_regulator_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void voltage_regulator_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- for (int samp = 0; samp < samples; samp++)
- {
- outputs[0][samp] = m_output;
- }
+ outputs[0].fill(m_output);
}
diff --git a/src/devices/sound/volt_reg.h b/src/devices/sound/volt_reg.h
index 516039aac17..c672878fd4b 100644
--- a/src/devices/sound/volt_reg.h
+++ b/src/devices/sound/volt_reg.h
@@ -17,7 +17,7 @@
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 / 5.0f; return *this; }
voltage_regulator_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
@@ -28,11 +28,11 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
sound_stream* m_stream;
- stream_sample_t m_output;
+ stream_buffer::sample_t m_output;
};
DECLARE_DEVICE_TYPE(VOLTAGE_REGULATOR, voltage_regulator_device)
diff --git a/src/devices/sound/votrax.cpp b/src/devices/sound/votrax.cpp
index 8b416da6188..000a568d2a3 100644
--- a/src/devices/sound/votrax.cpp
+++ b/src/devices/sound/votrax.cpp
@@ -131,13 +131,13 @@ void votrax_sc01_device::inflection_w(uint8_t data)
// for our sound stream
//-------------------------------------------------
-void votrax_sc01_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void votrax_sc01_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- for(int i=0; i<samples; i++) {
+ for(int i=0; i<outputs[0].samples(); i++) {
m_sample_count++;
if(m_sample_count & 1)
chip_update();
- outputs[0][i] = analog_calc();
+ outputs[0].put(i, analog_calc());
}
}
@@ -568,7 +568,7 @@ void votrax_sc01_device::filters_commit(bool force)
m_filt_fa, m_filt_va, m_filt_fc, m_filt_f1, m_filt_f2, m_filt_f2q, m_filt_f3);
}
-stream_sample_t votrax_sc01_device::analog_calc()
+stream_buffer::sample_t votrax_sc01_device::analog_calc()
{
// Voice-only path.
// 1. Pick up the pitch wave
@@ -632,7 +632,7 @@ stream_sample_t votrax_sc01_device::analog_calc()
vn = apply_filter(m_vn_5, m_vn_6, m_fx_a, m_fx_b);
shift_hist(vn, m_vn_6);
- return int(vn*50000);
+ return vn*1.5;
}
/*
diff --git a/src/devices/sound/votrax.h b/src/devices/sound/votrax.h
index aa3b88cc7e3..19d98ca1da7 100644
--- a/src/devices/sound/votrax.h
+++ b/src/devices/sound/votrax.h
@@ -37,7 +37,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
private:
// Possible timer parameters
@@ -177,7 +177,7 @@ private:
void chip_update(); // Global update called at 20KHz (main/36)
void filters_commit(bool force); // Commit the currently computed interpolation values to the filters
void phone_commit(); // Commit the current phone id
- stream_sample_t analog_calc(); // Compute one more sample
+ stream_buffer::sample_t analog_calc(); // Compute one more sample
};
diff --git a/src/devices/sound/vrc6.cpp b/src/devices/sound/vrc6.cpp
index 237a8487bc9..58022411766 100644
--- a/src/devices/sound/vrc6.cpp
+++ b/src/devices/sound/vrc6.cpp
@@ -45,7 +45,7 @@ vrc6snd_device::vrc6snd_device(const machine_config &mconfig, const char *tag, d
void vrc6snd_device::device_start()
{
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock());
+ m_stream = stream_alloc_legacy(0, 1, clock());
m_freqctrl = m_pulsectrl[0] = m_pulsectrl[1] = 0;
m_pulsefrql[0] = m_pulsefrql[1] = m_pulsefrqh[0] = m_pulsefrqh[1] = 0;
@@ -89,11 +89,11 @@ void vrc6snd_device::device_reset()
}
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void vrc6snd_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void vrc6snd_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
std::fill_n(&outputs[0][0], samples, 0);
diff --git a/src/devices/sound/vrc6.h b/src/devices/sound/vrc6.h
index f1ea8f5c9e3..0c1dd422d14 100644
--- a/src/devices/sound/vrc6.h
+++ b/src/devices/sound/vrc6.h
@@ -31,7 +31,7 @@ protected:
virtual void device_start() override;
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 sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
u8 m_freqctrl, m_pulsectrl[2], m_sawrate, m_master_freq;
diff --git a/src/devices/sound/vrender0.cpp b/src/devices/sound/vrender0.cpp
index 370bc2f44e0..09fb0f14940 100644
--- a/src/devices/sound/vrender0.cpp
+++ b/src/devices/sound/vrender0.cpp
@@ -148,7 +148,7 @@ void vr0sound_device::device_start()
for (auto &elem : m_channel)
elem.Cache = &m_fbcache;
- m_stream = stream_alloc(0, 2, clock() / 972); // TODO : Correct source / divider?
+ m_stream = stream_alloc_legacy(0, 2, clock() / 972); // TODO : Correct source / divider?
save_item(STRUCT_MEMBER(m_channel, CurSAddr));
save_item(STRUCT_MEMBER(m_channel, EnvVol));
@@ -208,11 +208,11 @@ device_memory_interface::space_config_vector vr0sound_device::memory_space_confi
}
//-------------------------------------------------
-// sound_stream_update - handle update requests
+// sound_stream_update_legacy - handle update requests
// for our sound stream
//-------------------------------------------------
-void vr0sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void vr0sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
VR0_RenderAudio(samples, outputs[0], outputs[1]);
}
diff --git a/src/devices/sound/vrender0.h b/src/devices/sound/vrender0.h
index 324276b8ff0..99e2235a1be 100644
--- a/src/devices/sound/vrender0.h
+++ b/src/devices/sound/vrender0.h
@@ -78,7 +78,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
diff --git a/src/devices/sound/wave.cpp b/src/devices/sound/wave.cpp
index 6506ef41d13..27407a2dbd2 100644
--- a/src/devices/sound/wave.cpp
+++ b/src/devices/sound/wave.cpp
@@ -43,16 +43,16 @@ void wave_device::device_start()
speaker_device_iterator spkiter(*owner());
int speakers = spkiter.count();
if (speakers > 1)
- machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate());
+ stream_alloc_legacy(0, 2, machine().sample_rate());
else
- machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ stream_alloc_legacy(0, 1, machine().sample_rate());
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void wave_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void wave_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *left_buffer = outputs[0];
stream_sample_t *right_buffer = nullptr;
diff --git a/src/devices/sound/wave.h b/src/devices/sound/wave.h
index fe5cf6b51a2..9f2a834d6c1 100644
--- a/src/devices/sound/wave.h
+++ b/src/devices/sound/wave.h
@@ -30,7 +30,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
required_device<cassette_image_device> m_cass;
diff --git a/src/devices/sound/x1_010.cpp b/src/devices/sound/x1_010.cpp
index fdb824c0df7..8334db4a299 100644
--- a/src/devices/sound/x1_010.cpp
+++ b/src/devices/sound/x1_010.cpp
@@ -119,7 +119,7 @@ void x1_010_device::device_start()
LOG_SOUND("masterclock = %d rate = %d\n", clock(), m_rate);
/* get stream channels */
- m_stream = machine().sound().stream_alloc(*this, 0, 2, m_rate);
+ m_stream = stream_alloc_legacy(0, 2, m_rate);
m_reg = make_unique_clear<u8[]>(0x2000);
m_HI_WORD_BUF = make_unique_clear<u8[]>(0x2000);
@@ -204,10 +204,10 @@ void x1_010_device::word_w(offs_t offset, u16 data)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void x1_010_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void x1_010_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// mixer buffer zero clear
memset(outputs[0], 0, samples*sizeof(*outputs[0]));
diff --git a/src/devices/sound/x1_010.h b/src/devices/sound/x1_010.h
index 1664e2abd4c..3c8f1e60dc6 100644
--- a/src/devices/sound/x1_010.h
+++ b/src/devices/sound/x1_010.h
@@ -26,7 +26,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/ym2151.cpp b/src/devices/sound/ym2151.cpp
index 744fec923ad..b519d9a1224 100644
--- a/src/devices/sound/ym2151.cpp
+++ b/src/devices/sound/ym2151.cpp
@@ -1836,16 +1836,17 @@ WRITE_LINE_MEMBER(ym2151_device::reset_w)
// sound_stream_update - handle a stream update
//-------------------------------------------------
-void ym2151_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ym2151_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
if (m_reset_active)
{
- std::fill(&outputs[0][0], &outputs[0][samples], 0);
- std::fill(&outputs[1][0], &outputs[1][samples], 0);
+ outputs[0].fill(0);
+ outputs[1].fill(0);
return;
}
- for (int i=0; i<samples; i++)
+ constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
+ for (int sampindex=0; sampindex<outputs[0].samples(); sampindex++)
{
advance_eg();
@@ -1871,8 +1872,8 @@ void ym2151_device::sound_stream_update(sound_stream &stream, stream_sample_t **
outr = 32767;
else if (outr < -32768)
outr = -32768;
- outputs[0][i] = outl;
- outputs[1][i] = outr;
+ outputs[0].put(sampindex, stream_buffer::sample_t(outl) * sample_scale);
+ outputs[1].put(sampindex, stream_buffer::sample_t(outr) * sample_scale);
advance();
}
diff --git a/src/devices/sound/ym2151.h b/src/devices/sound/ym2151.h
index 51020ec12d2..3f3f07bae91 100644
--- a/src/devices/sound/ym2151.h
+++ b/src/devices/sound/ym2151.h
@@ -75,7 +75,7 @@ protected:
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;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
virtual void calculate_timers();
virtual void write_reg(int r, int v);
diff --git a/src/devices/sound/ym2413.cpp b/src/devices/sound/ym2413.cpp
index 0f78fad1daa..ca4a9acb874 100644
--- a/src/devices/sound/ym2413.cpp
+++ b/src/devices/sound/ym2413.cpp
@@ -1470,10 +1470,10 @@ void ym2413_device::write_reg(int r, int v)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void ym2413_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ym2413_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
for(int i=0; i < samples ; i++ )
{
@@ -1511,7 +1511,7 @@ void ym2413_device::device_start()
{
int rate = clock()/72;
- m_stream = machine().sound().stream_alloc(*this,0,2,rate);
+ m_stream = stream_alloc_legacy(0,2,rate);
for (int x=0; x<TL_RES_LEN; x++)
{
diff --git a/src/devices/sound/ym2413.h b/src/devices/sound/ym2413.h
index 52bd1907ecc..2e1db357150 100644
--- a/src/devices/sound/ym2413.h
+++ b/src/devices/sound/ym2413.h
@@ -25,7 +25,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
uint8_t m_inst_table[19][8];
diff --git a/src/devices/sound/ymf262.cpp b/src/devices/sound/ymf262.cpp
index 2117b972dce..6ec8e081021 100644
--- a/src/devices/sound/ymf262.cpp
+++ b/src/devices/sound/ymf262.cpp
@@ -2618,7 +2618,7 @@ void ymf262_set_update_handler(void *chip, OPL3_UPDATEHANDLER UpdateHandler, dev
** '**buffers' is table of 4 pointers to the buffers: CH.A, CH.B, CH.C and CH.D
** 'length' is the number of samples that should be generated
*/
-void ymf262_update_one(void *_chip, OPL3SAMPLE **buffers, int length)
+void ymf262_update_one(void *_chip, OPL3SAMPLE * const *buffers, int length)
{
int i;
OPL3 *chip = (OPL3 *)_chip;
diff --git a/src/devices/sound/ymf262.h b/src/devices/sound/ymf262.h
index e7451216b95..d459a9a68ee 100644
--- a/src/devices/sound/ymf262.h
+++ b/src/devices/sound/ymf262.h
@@ -33,7 +33,7 @@ void ymf262_reset_chip(void *chip);
int ymf262_write(void *chip, int a, int v);
unsigned char ymf262_read(void *chip, int a);
int ymf262_timer_over(void *chip, int c);
-void ymf262_update_one(void *chip, OPL3SAMPLE **buffers, int length);
+void ymf262_update_one(void *chip, OPL3SAMPLE * const *buffers, int length);
void ymf262_set_timer_handler(void *chip, OPL3_TIMERHANDLER TimerHandler, device_t *device);
void ymf262_set_irq_handler(void *chip, OPL3_IRQHANDLER IRQHandler, device_t *device);
diff --git a/src/devices/sound/ymf271.cpp b/src/devices/sound/ymf271.cpp
index 4032a2b6bd8..03ca33a2382 100644
--- a/src/devices/sound/ymf271.cpp
+++ b/src/devices/sound/ymf271.cpp
@@ -563,10 +563,10 @@ void ymf271_device::set_feedback(int slotnum, int64_t inp)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ymf271_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int i, j;
int op;
@@ -1748,7 +1748,7 @@ void ymf271_device::device_start()
init_state();
m_mix_buffer.resize(m_master_clock/(384/4));
- m_stream = machine().sound().stream_alloc(*this, 0, 4, m_master_clock/384);
+ m_stream = stream_alloc_legacy(0, 4, m_master_clock/384);
}
//-------------------------------------------------
diff --git a/src/devices/sound/ymf271.h b/src/devices/sound/ymf271.h
index 18ddd4e7b67..87f06eb8e73 100644
--- a/src/devices/sound/ymf271.h
+++ b/src/devices/sound/ymf271.h
@@ -28,7 +28,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/ymf278b.cpp b/src/devices/sound/ymf278b.cpp
index 4e8ed1005ee..7bda7b6b8ef 100644
--- a/src/devices/sound/ymf278b.cpp
+++ b/src/devices/sound/ymf278b.cpp
@@ -212,10 +212,10 @@ void ymf278b_device::compute_envelope(YMF278BSlot *slot)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ymf278b_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int i, j;
YMF278BSlot *slot;
@@ -1009,7 +1009,7 @@ void ymf278b_device::device_start()
m_slots[i].num = i;
}
- m_stream = machine().sound().stream_alloc(*this, 0, 6, m_rate);
+ m_stream = stream_alloc_legacy(0, 6, m_rate);
m_mix_buffer.resize(m_rate*4,0);
// rate tables
diff --git a/src/devices/sound/ymf278b.h b/src/devices/sound/ymf278b.h
index 039662fed1a..03fa9880442 100644
--- a/src/devices/sound/ymf278b.h
+++ b/src/devices/sound/ymf278b.h
@@ -29,7 +29,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/ymz280b.cpp b/src/devices/sound/ymz280b.cpp
index f5a69bc6d37..94ef134bd4c 100644
--- a/src/devices/sound/ymz280b.cpp
+++ b/src/devices/sound/ymz280b.cpp
@@ -412,10 +412,10 @@ int ymz280b_device::generate_pcm16(struct YMZ280BVoice *voice, s16 *buffer, int
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void ymz280b_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ymz280b_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *lacc = outputs[0];
stream_sample_t *racc = outputs[1];
@@ -565,7 +565,7 @@ void ymz280b_device::device_start()
}
/* create the stream */
- m_stream = machine().sound().stream_alloc(*this, 0, 2, INTERNAL_SAMPLE_RATE);
+ m_stream = stream_alloc_legacy(0, 2, INTERNAL_SAMPLE_RATE);
/* allocate memory */
assert(MAX_SAMPLE_CHUNK < 0x10000);
diff --git a/src/devices/sound/ymz280b.h b/src/devices/sound/ymz280b.h
index a375f4a7ed0..ccbcb393bd8 100644
--- a/src/devices/sound/ymz280b.h
+++ b/src/devices/sound/ymz280b.h
@@ -36,7 +36,7 @@ protected:
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;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_rom_interface overrides
virtual void rom_bank_updated() override;
diff --git a/src/devices/sound/ymz770.cpp b/src/devices/sound/ymz770.cpp
index bba6ca59622..3934c6ac6dd 100644
--- a/src/devices/sound/ymz770.cpp
+++ b/src/devices/sound/ymz770.cpp
@@ -77,7 +77,7 @@ ymz770_device::ymz770_device(const machine_config &mconfig, device_type type, co
void ymz770_device::device_start()
{
// create the stream
- m_stream = machine().sound().stream_alloc(*this, 0, 2, m_sclock);
+ m_stream = stream_alloc_legacy(0, 2, m_sclock);
for (auto & channel : m_channels)
{
@@ -178,11 +178,11 @@ void ymz770_device::device_reset()
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void ymz770_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void ymz770_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *outL, *outR;
diff --git a/src/devices/sound/ymz770.h b/src/devices/sound/ymz770.h
index 6d322490e46..ade24f61501 100644
--- a/src/devices/sound/ymz770.h
+++ b/src/devices/sound/ymz770.h
@@ -33,7 +33,7 @@ protected:
virtual void device_start() override;
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 sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
virtual void internal_reg_write(uint8_t reg, uint8_t data);
virtual uint32_t get_phrase_offs(int phrase) { return m_rom[(4 * phrase) + 1] << 16 | m_rom[(4 * phrase) + 2] << 8 | m_rom[(4 * phrase) + 3]; };
diff --git a/src/devices/sound/zsg2.cpp b/src/devices/sound/zsg2.cpp
index 3376f466b19..b964bce5f14 100644
--- a/src/devices/sound/zsg2.cpp
+++ b/src/devices/sound/zsg2.cpp
@@ -134,7 +134,7 @@ void zsg2_device::device_start()
memset(&m_chan, 0, sizeof(m_chan));
- m_stream = stream_alloc(0, 4, clock() / 768);
+ m_stream = stream_alloc_legacy(0, 4, clock() / 768);
m_mem_blocks = m_mem_base.length();
m_mem_copy = make_unique_clear<uint32_t[]>(m_mem_blocks);
@@ -280,10 +280,10 @@ void zsg2_device::filter_samples(zchan *ch)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void zsg2_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void zsg2_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
for (int i = 0; i < samples; i++)
{
diff --git a/src/devices/sound/zsg2.h b/src/devices/sound/zsg2.h
index b0506927440..592cbf83787 100644
--- a/src/devices/sound/zsg2.h
+++ b/src/devices/sound/zsg2.h
@@ -29,7 +29,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
const uint16_t STATUS_ACTIVE = 0x8000;
diff --git a/src/devices/video/i8244.cpp b/src/devices/video/i8244.cpp
index 5e7893aa6ae..8288dd9e552 100644
--- a/src/devices/video/i8244.cpp
+++ b/src/devices/video/i8244.cpp
@@ -740,16 +740,16 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap
}
-void i8244_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void i8244_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
u8 volume = m_vdc.s.sound & 0xf;
- int sample_on = (m_sh_output & m_vdc.s.sound >> 7) * 0x4000;
+ stream_buffer::sample_t sample_on = (m_sh_output & m_vdc.s.sound >> 7) * 0.5;
- for (int i = 0; i < samples; i++)
+ for (int i = 0; i < outputs[0].samples(); i++)
{
// clock duty cycle
m_sh_duty = (m_sh_duty + 1) & 0xf;
- outputs[0][i] = (m_sh_duty < volume) ? sample_on : 0;
+ outputs[0].put(i, (m_sh_duty < volume) ? sample_on : 0.0);
}
}
diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h
index c46034dd2b4..3568f5a613d 100644
--- a/src/devices/video/i8244.h
+++ b/src/devices/video/i8244.h
@@ -97,11 +97,10 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
virtual void set_default_params();
- //void render_scanline(int vpos);
int get_y_beam();
int get_x_beam();
offs_t fix_register_mirrors( offs_t offset );
diff --git a/src/devices/video/pwm.cpp b/src/devices/video/pwm.cpp
index 50b608759ef..453216ded7d 100644
--- a/src/devices/video/pwm.cpp
+++ b/src/devices/video/pwm.cpp
@@ -6,7 +6,7 @@ This thing is a generic helper for PWM(strobed) display elements, to prevent fli
and optionally handle perceived brightness levels.
Common usecase is to call matrix(selmask, datamask), a collision between the 2 masks
-implies a powered-on display element (eg, a LED, or VFD sprite). The maximum matrix
+implies a powered-on display element (eg. a LED, or VFD sprite). The maximum matrix
size is 64 by 64, simply due to uint64_t constraints. If a larger size is needed,
create an array of pwm_display_device.
@@ -112,8 +112,7 @@ void pwm_display_device::device_start()
save_item(NAME(m_bri));
save_item(NAME(m_update_time));
- save_item(NAME(m_acc_attos));
- save_item(NAME(m_acc_secs));
+ save_item(NAME(m_acc));
}
void pwm_display_device::device_reset()
@@ -128,29 +127,6 @@ void pwm_display_device::device_reset()
//-------------------------------------------------
-// custom savestate handling (MAME doesn't save array of attotime)
-//-------------------------------------------------
-
-void pwm_display_device::device_pre_save()
-{
- for (int y = 0; y < ARRAY_LENGTH(m_acc); y++)
- for (int x = 0; x < ARRAY_LENGTH(m_acc[0]); x++)
- {
- m_acc_attos[y][x] = m_acc[y][x].attoseconds();
- m_acc_secs[y][x] = m_acc[y][x].seconds();
- }
-}
-
-void pwm_display_device::device_post_load()
-{
- for (int y = 0; y < ARRAY_LENGTH(m_acc); y++)
- for (int x = 0; x < ARRAY_LENGTH(m_acc[0]); x++)
- m_acc[y][x] = attotime(m_acc_secs[y][x], m_acc_attos[y][x]);
-}
-
-
-
-//-------------------------------------------------
// public handlers (most of the interface is in the .h file)
//-------------------------------------------------
diff --git a/src/devices/video/pwm.h b/src/devices/video/pwm.h
index 4fba10e00d4..91a04b06620 100644
--- a/src/devices/video/pwm.h
+++ b/src/devices/video/pwm.h
@@ -59,8 +59,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_pre_save() override;
- virtual void device_post_load() override;
private:
output_finder<0x40, 0x40> m_out_x;
@@ -90,8 +88,6 @@ private:
double m_bri[0x40][0x41];
attotime m_update_time;
attotime m_acc[0x40][0x41];
- attoseconds_t m_acc_attos[0x40][0x41];
- seconds_t m_acc_secs[0x40][0x41];
emu_timer *m_frame_timer;
TIMER_CALLBACK_MEMBER(frame_tick);
diff --git a/src/emu/debug/dvmemory.cpp b/src/emu/debug/dvmemory.cpp
index 7f07e48b6ed..fe1b9da419a 100644
--- a/src/emu/debug/dvmemory.cpp
+++ b/src/emu/debug/dvmemory.cpp
@@ -84,7 +84,7 @@ debug_view_memory_source::debug_view_memory_source(std::string &&name, void *bas
, m_base(base)
, m_blocklength(element_size * num_elements)
, m_numblocks(num_blocks)
- , m_blockstride(element_size * block_stride)
+ , m_blockstride(block_stride)
, m_offsetxor(0)
, m_endianness(ENDIANNESS_NATIVE)
, m_prefsize(std::min(element_size, 8))
diff --git a/src/emu/devfind.h b/src/emu/devfind.h
index 668defe4523..958ae16c3bc 100644
--- a/src/emu/devfind.h
+++ b/src/emu/devfind.h
@@ -15,6 +15,7 @@
#include <functional>
#include <iterator>
+#include <memory>
#include <stdexcept>
#include <string>
#include <type_traits>
@@ -1063,11 +1064,11 @@ public:
// dynamic allocation of a shared pointer
void allocate(u32 entries)
{
- assert(m_allocated.empty());
- m_allocated.resize(entries);
- this->m_target = &m_allocated[0];
+ assert(!m_allocated);
+ m_allocated = std::make_unique<PointerType []>(entries);
+ this->m_target = m_allocated.get();
m_bytes = entries * sizeof(PointerType);
- this->m_base.get().save_item(m_allocated, this->m_tag);
+ this->m_base.get().save_pointer(m_allocated, this->m_tag, entries);
}
private:
@@ -1086,7 +1087,7 @@ private:
// internal state
u8 const m_width;
size_t m_bytes;
- std::vector<PointerType> m_allocated;
+ std::unique_ptr<PointerType []> m_allocated;
};
template <typename PointerType> using optional_shared_ptr = shared_ptr_finder<PointerType, false>;
diff --git a/src/emu/disound.cpp b/src/emu/disound.cpp
index 4d7d60265b6..d2c063ff205 100644
--- a/src/emu/disound.cpp
+++ b/src/emu/disound.cpp
@@ -66,13 +66,23 @@ device_sound_interface &device_sound_interface::add_route(u32 output, device_t &
//-------------------------------------------------
-// stream_alloc - allocate a stream implicitly
+// stream_alloc_legacy - allocate a stream implicitly
// associated with this device
//-------------------------------------------------
+sound_stream *device_sound_interface::stream_alloc_legacy(int inputs, int outputs, int sample_rate)
+{
+ return device().machine().sound().stream_alloc_legacy(*this, inputs, outputs, sample_rate, stream_update_legacy_delegate(&device_sound_interface::sound_stream_update_legacy, this));
+}
+
sound_stream *device_sound_interface::stream_alloc(int inputs, int outputs, int sample_rate)
{
- return device().machine().sound().stream_alloc(*this, inputs, outputs, sample_rate);
+ return device().machine().sound().stream_alloc(*this, inputs, outputs, sample_rate, stream_update_delegate(&device_sound_interface::sound_stream_update, this), STREAM_DEFAULT_FLAGS);
+}
+
+sound_stream *device_sound_interface::stream_alloc(int inputs, int outputs, int sample_rate, sound_stream_flags flags)
+{
+ return device().machine().sound().stream_alloc(*this, inputs, outputs, sample_rate, stream_update_delegate(&device_sound_interface::sound_stream_update, this), flags);
}
@@ -171,7 +181,7 @@ float device_sound_interface::input_gain(int inputnum) const
{
int stream_inputnum;
sound_stream *stream = input_to_stream_input(inputnum, stream_inputnum);
- return (stream != nullptr) ? stream->input_gain(stream_inputnum) : 0.0f;
+ return (stream != nullptr) ? stream->input(stream_inputnum).gain() : 0.0f;
}
@@ -184,7 +194,7 @@ float device_sound_interface::output_gain(int outputnum) const
{
int stream_outputnum;
sound_stream *stream = output_to_stream_output(outputnum, stream_outputnum);
- return (stream != nullptr) ? stream->output_gain(stream_outputnum) : 0.0f;
+ return (stream != nullptr) ? stream->output(stream_outputnum).gain() : 0.0f;
}
@@ -198,7 +208,7 @@ void device_sound_interface::set_input_gain(int inputnum, float gain)
int stream_inputnum;
sound_stream *stream = input_to_stream_input(inputnum, stream_inputnum);
if (stream != nullptr)
- stream->set_input_gain(stream_inputnum, gain);
+ stream->input(stream_inputnum).set_gain(gain);
}
@@ -215,7 +225,7 @@ void device_sound_interface::set_output_gain(int outputnum, float gain)
for (auto &stream : device().machine().sound().streams())
if (&stream->device() == &device())
for (int num = 0; num < stream->output_count(); num++)
- stream->set_output_gain(num, gain);
+ stream->output(num).set_gain(gain);
}
// look up the stream and stream output index
@@ -224,7 +234,7 @@ void device_sound_interface::set_output_gain(int outputnum, float gain)
int stream_outputnum;
sound_stream *stream = output_to_stream_output(outputnum, stream_outputnum);
if (stream != nullptr)
- stream->set_output_gain(stream_outputnum, gain);
+ stream->output(stream_outputnum).set_gain(gain);
}
}
@@ -240,8 +250,11 @@ int device_sound_interface::inputnum_from_device(device_t &source_device, int ou
for (auto &stream : device().machine().sound().streams())
if (&stream->device() == &device())
for (int inputnum = 0; inputnum < stream->input_count(); inputnum++, overall++)
- if (stream->input_source_device(inputnum) == &source_device && stream->input_source_outputnum(inputnum) == outputnum)
+ {
+ auto &input = stream->input(inputnum);
+ if (input.valid() && &input.source().stream().device() == &source_device && input.source().index() == outputnum)
return overall;
+ }
return -1;
}
@@ -368,6 +381,28 @@ void device_sound_interface::interface_pre_reset()
}
+//-------------------------------------------------
+// sound_stream_update_legacy - implementation
+// that should be overridden by legacy devices
+//-------------------------------------------------
+
+void device_sound_interface::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+{
+ throw emu_fatalerror("sound_stream_update_legacy called but not overridden by owning class");
+}
+
+
+//-------------------------------------------------
+// sound_stream_update - default implementation
+// that should be overridden
+//-------------------------------------------------
+
+void device_sound_interface::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+{
+ throw emu_fatalerror("sound_stream_update called but not overridden by owning class");
+}
+
+
//**************************************************************************
// SIMPLE DERIVED MIXER INTERFACE
@@ -430,8 +465,11 @@ void device_mixer_interface::interface_pre_start()
}
}
+ // keep a small buffer handy for tracking cleared buffers
+ m_output_clear.resize(m_outputs);
+
// allocate the mixer stream
- m_mixer_stream = stream_alloc(m_auto_allocated_inputs, m_outputs, device().machine().sample_rate());
+ m_mixer_stream = stream_alloc(m_auto_allocated_inputs, m_outputs, device().machine().sample_rate(), STREAM_DEFAULT_FLAGS);
}
@@ -443,9 +481,8 @@ void device_mixer_interface::interface_pre_start()
void device_mixer_interface::interface_post_load()
{
- // Beware that there's not going to be a mixer stream if there was
- // no inputs
- if (m_mixer_stream)
+ // mixer stream could be null if no inputs were specified
+ if (m_mixer_stream != nullptr)
m_mixer_stream->set_sample_rate(device().machine().sample_rate());
// call our parent
@@ -454,21 +491,43 @@ void device_mixer_interface::interface_post_load()
//-------------------------------------------------
-// mixer_update - mix all inputs to one output
+// sound_stream_update - mix all inputs to one
+// output
//-------------------------------------------------
-void device_mixer_interface::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void device_mixer_interface::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- // clear output buffers
- for (int output = 0; output < m_outputs; output++)
- std::fill_n(outputs[output], samples, 0);
+ // special case: single input, single output, same rate
+ if (inputs.size() == 1 && outputs.size() == 1 && inputs[0].sample_rate() == outputs[0].sample_rate())
+ {
+ outputs[0] = inputs[0];
+ return;
+ }
+
+ // reset the clear flags
+ std::fill(std::begin(m_output_clear), std::end(m_output_clear), false);
- // loop over samples
- const u8 *outmap = &m_outputmap[0];
- for (int pos = 0; pos < samples; pos++)
+ // loop over inputs
+ for (int inputnum = 0; inputnum < m_auto_allocated_inputs; inputnum++)
{
- // for each input, add it to the appropriate output
- for (int inp = 0; inp < m_auto_allocated_inputs; inp++)
- outputs[outmap[inp]][pos] += inputs[inp][pos];
+ // skip if the gain is 0
+ auto &input = inputs[inputnum];
+ if (input.gain() == 0)
+ continue;
+
+ // either store or accumulate
+ int outputnum = m_outputmap[inputnum];
+ auto &output = outputs[outputnum];
+ if (!m_output_clear[outputnum])
+ output.copy(input);
+ else
+ output.add(input);
+
+ m_output_clear[outputnum] = true;
}
+
+ // clear anything unused
+ for (int outputnum = 0; outputnum < m_outputs; outputnum++)
+ if (!m_output_clear[outputnum])
+ outputs[outputnum].fill(0);
}
diff --git a/src/emu/disound.h b/src/emu/disound.h
index 37a7df462be..d6135123ddb 100644
--- a/src/emu/disound.h
+++ b/src/emu/disound.h
@@ -34,6 +34,10 @@ constexpr int AUTO_ALLOC_INPUT = 65535;
// TYPE DEFINITIONS
//**************************************************************************
+class read_stream_view;
+class write_stream_view;
+enum sound_stream_flags : u32;
+
// ======================> device_sound_interface
@@ -73,10 +77,13 @@ public:
device_sound_interface &reset_routes() { m_route_list.clear(); return *this; }
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) = 0;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples);
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs);
// stream creation
+ sound_stream *stream_alloc_legacy(int inputs, int outputs, int sample_rate);
sound_stream *stream_alloc(int inputs, int outputs, int sample_rate);
+ sound_stream *stream_alloc(int inputs, int outputs, int sample_rate, sound_stream_flags flags);
// helpers
int inputs() const;
@@ -126,12 +133,13 @@ protected:
virtual void interface_post_load() override;
// sound interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
// internal state
- u8 m_outputs; // number of outputs
- std::vector<u8> m_outputmap; // map of inputs to outputs
- sound_stream * m_mixer_stream; // mixing stream
+ u8 m_outputs; // number of outputs
+ std::vector<u8> m_outputmap; // map of inputs to outputs
+ std::vector<bool> m_output_clear; // flag for tracking cleared buffers
+ sound_stream *m_mixer_stream; // mixing stream
};
// iterator
diff --git a/src/emu/inpttype.ipp b/src/emu/inpttype.ipp
index cef6f36d1f4..f16677cf5c9 100644
--- a/src/emu/inpttype.ipp
+++ b/src/emu/inpttype.ipp
@@ -73,13 +73,13 @@ namespace {
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_CHI, "P1 Mahjong Chi", input_seq(KEYCODE_SPACE) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_REACH, "P1 Mahjong Reach", input_seq(KEYCODE_LSHIFT) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_RON, "P1 Mahjong Ron", input_seq(KEYCODE_Z) ) \
+ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_FLIP_FLOP, "P1 Mahjong Flip Flop", input_seq(KEYCODE_Y) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_BET, "P1 Mahjong Bet", input_seq(KEYCODE_3) ) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_LAST_CHANCE, "P1 Mahjong Last Chance", input_seq(KEYCODE_RALT) ) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_SCORE, "P1 Mahjong Score", input_seq(KEYCODE_RCONTROL) ) \
+ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_SCORE, "P1 Mahjong Take Score", input_seq(KEYCODE_RCONTROL) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_DOUBLE_UP, "P1 Mahjong Double Up", input_seq(KEYCODE_RSHIFT) ) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_FLIP_FLOP, "P1 Mahjong Flip Flop", input_seq(KEYCODE_Y) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_BIG, "P1 Mahjong Big", input_seq(KEYCODE_ENTER) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_SMALL, "P1 Mahjong Small", input_seq(KEYCODE_BACKSPACE) ) \
+ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_LAST_CHANCE, "P1 Mahjong Last Chance", input_seq(KEYCODE_RALT) ) \
CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P1_HANAFUDA \
@@ -98,20 +98,20 @@ namespace {
#define CORE_INPUT_TYPES_GAMBLE \
CORE_INPUT_TYPES_BEGIN(gamble) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_HIGH, "High", input_seq(KEYCODE_A) ) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_LOW, "Low", input_seq(KEYCODE_S) ) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_HALF, "Half Gamble", input_seq(KEYCODE_D) ) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_DEAL, "Deal", input_seq(KEYCODE_2) ) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_D_UP, "Double Up", input_seq(KEYCODE_3) ) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_TAKE, "Take", input_seq(KEYCODE_4) ) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_STAND, "Stand", input_seq(KEYCODE_L) ) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_BET, "Bet", input_seq(KEYCODE_M) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_KEYIN, "Key In", input_seq(KEYCODE_Q) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_KEYOUT, "Key Out", input_seq(KEYCODE_W) ) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_PAYOUT, "Payout", input_seq(KEYCODE_I) ) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_DOOR, "Door", input_seq(KEYCODE_O) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_SERVICE, "Service", input_seq(KEYCODE_9) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_BOOK, "Book-Keeping", input_seq(KEYCODE_0) ) \
+ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_DOOR, "Door", input_seq(KEYCODE_O) ) \
+ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_PAYOUT, "Payout", input_seq(KEYCODE_I) ) \
+ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_BET, "Bet", input_seq(KEYCODE_M) ) \
+ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_DEAL, "Deal", input_seq(KEYCODE_2) ) \
+ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_STAND, "Stand", input_seq(KEYCODE_L) ) \
+ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_TAKE, "Take Score", input_seq(KEYCODE_4) ) \
+ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_D_UP, "Double Up", input_seq(KEYCODE_3) ) \
+ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_HALF, "Half Gamble", input_seq(KEYCODE_D) ) \
+ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_HIGH, "High", input_seq(KEYCODE_A) ) \
+ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_LOW, "Low", input_seq(KEYCODE_S) ) \
CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_POKER \
@@ -122,7 +122,6 @@ namespace {
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, POKER_HOLD4, "Hold 4", input_seq(KEYCODE_V) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, POKER_HOLD5, "Hold 5", input_seq(KEYCODE_B) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, POKER_CANCEL, "Cancel", input_seq(KEYCODE_N) ) \
- INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, POKER_BET, "Bet", input_seq(KEYCODE_1) ) \
CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_SLOT \
@@ -194,7 +193,7 @@ namespace {
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_RON, "P2 Mahjong Ron", input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_BET, "P2 Mahjong Bet", input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_LAST_CHANCE, "P2 Mahjong Last Chance", input_seq() ) \
- INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_SCORE, "P2 Mahjong Score", input_seq() ) \
+ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_SCORE, "P2 Mahjong Take Score", input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_DOUBLE_UP, "P2 Mahjong Double Up", input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_FLIP_FLOP, "P2 Mahjong Flip Flop", input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_BIG, "P2 Mahjong Big", input_seq() ) \
diff --git a/src/emu/ioport.h b/src/emu/ioport.h
index 9df5e8f533a..72add6abb41 100644
--- a/src/emu/ioport.h
+++ b/src/emu/ioport.h
@@ -217,13 +217,13 @@ enum ioport_type
IPT_MAHJONG_CHI,
IPT_MAHJONG_REACH,
IPT_MAHJONG_RON,
+ IPT_MAHJONG_FLIP_FLOP,
IPT_MAHJONG_BET,
- IPT_MAHJONG_LAST_CHANCE,
IPT_MAHJONG_SCORE,
IPT_MAHJONG_DOUBLE_UP,
- IPT_MAHJONG_FLIP_FLOP,
IPT_MAHJONG_BIG,
IPT_MAHJONG_SMALL,
+ IPT_MAHJONG_LAST_CHANCE,
IPT_MAHJONG_LAST,
@@ -256,15 +256,15 @@ enum ioport_type
// IPT_GAMBLE_DOOR4,
// IPT_GAMBLE_DOOR5,
- IPT_GAMBLE_HIGH, // player
- IPT_GAMBLE_LOW, // player
- IPT_GAMBLE_HALF, // player
+ IPT_GAMBLE_PAYOUT, // player
+ IPT_GAMBLE_BET, // player
IPT_GAMBLE_DEAL, // player
- IPT_GAMBLE_D_UP, // player
- IPT_GAMBLE_TAKE, // player
IPT_GAMBLE_STAND, // player
- IPT_GAMBLE_BET, // player
- IPT_GAMBLE_PAYOUT, // player
+ IPT_GAMBLE_TAKE, // player
+ IPT_GAMBLE_D_UP, // player
+ IPT_GAMBLE_HALF, // player
+ IPT_GAMBLE_HIGH, // player
+ IPT_GAMBLE_LOW, // player
// poker-specific inputs
IPT_POKER_HOLD1,
@@ -273,7 +273,6 @@ enum ioport_type
IPT_POKER_HOLD4,
IPT_POKER_HOLD5,
IPT_POKER_CANCEL,
- IPT_POKER_BET,
// slot-specific inputs
IPT_SLOT_STOP1,
diff --git a/src/emu/layout/exorterm155.lay b/src/emu/layout/exorterm155.lay
index 6a47f6869e7..9da2b5ed7ef 100644
--- a/src/emu/layout/exorterm155.lay
+++ b/src/emu/layout/exorterm155.lay
@@ -8,7 +8,7 @@ LEDs for the Motorola EXORterm 155
<mamelayout version="2">
<element name="red_led">
- <disk>
+ <disk state="0">
<color red="1.0" green="0.0" blue="0.0" />
</disk>
</element>
@@ -35,12 +35,13 @@ LEDs for the Motorola EXORterm 155
</element>
<element name="background">
<rect>
- <bounds left="0" top="0" right="1" bottom="1" />
<color red="0.0" green="0.0" blue="0.0" />
</rect>
</element>
<view name="Keyboard LEDs">
+ <bounds left="0" top="0" right="720" bottom="544" />
+
<screen index="0">
<bounds x="0" y="0" width="720" height="512" />
</screen>
@@ -71,10 +72,6 @@ LEDs for the Motorola EXORterm 155
<element name="insert_char_led" ref="red_led">
<bounds left="312" right="320" top="532" bottom="540" />
</element>
-
- <element ref="background">
- <bounds left="0" top="540" right="720" bottom="544" />
- </element>
</view>
</mamelayout>
diff --git a/src/emu/layout/ie15.lay b/src/emu/layout/ie15.lay
index 90ed8816edb..255e2022ef8 100644
--- a/src/emu/layout/ie15.lay
+++ b/src/emu/layout/ie15.lay
@@ -5,7 +5,7 @@ license:CC0
<mamelayout version="2">
<element name="e_led">
- <disk>
+ <disk state="0">
<color red="1.0" green="0.0" blue="0.0" />
</disk>
</element>
diff --git a/src/emu/render.cpp b/src/emu/render.cpp
index 221ce9fc929..46123a02b3f 100644
--- a/src/emu/render.cpp
+++ b/src/emu/render.cpp
@@ -2511,15 +2511,13 @@ void render_target::add_container_primitives(render_primitive_list &list, const
void render_target::add_element_primitives(render_primitive_list &list, const object_transform &xform, layout_element &element, int state, int blendmode)
{
- // if we're out of range, bail
- if (state > element.maxstate())
- return;
+ // limit state range to non-negative values
if (state < 0)
state = 0;
// get a pointer to the relevant texture
render_texture *texture = element.state_texture(state);
- if (texture != nullptr)
+ if (texture)
{
render_primitive *prim = list.alloc(render_primitive::QUAD);
diff --git a/src/emu/render.h b/src/emu/render.h
index b0d0df82d3c..1545a3f041d 100644
--- a/src/emu/render.h
+++ b/src/emu/render.h
@@ -579,7 +579,6 @@ public:
// getters
running_machine &machine() const { return m_machine; }
int default_state() const { return m_defstate; }
- int maxstate() const { return m_maxstate; }
render_texture *state_texture(int state);
private:
@@ -603,17 +602,22 @@ private:
void normalize_bounds(float xoffs, float yoffs, float xscale, float yscale);
// getters
- int state() const { return m_state; }
- virtual int maxstate() const { return m_state; }
- const render_bounds &bounds() const { return m_bounds; }
- const render_color &color() const { return m_color; }
+ int statemask() const { return m_statemask; }
+ int stateval() const { return m_stateval; }
+ std::pair<int, bool> statewrap() const;
+ render_bounds overall_bounds() const;
+ render_bounds bounds(int state) const;
+ render_color color(int state) const;
// operations
virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) = 0;
protected:
- // helpers
- void draw_text(render_font &font, bitmap_argb32 &dest, const rectangle &bounds, const char *str, int align);
+ // helper
+ virtual int maxstate() const { return -1; }
+
+ // drawing helpers
+ void draw_text(render_font &font, bitmap_argb32 &dest, const rectangle &bounds, const char *str, int align, const render_color &color);
void draw_segment_horizontal_caps(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, int caps, rgb_t color);
void draw_segment_horizontal(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, rgb_t color);
void draw_segment_vertical_caps(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, int caps, rgb_t color);
@@ -625,10 +629,27 @@ private:
void apply_skew(bitmap_argb32 &dest, int skewwidth);
private:
+ struct bounds_step
+ {
+ int state;
+ render_bounds bounds;
+ render_bounds delta;
+ };
+ using bounds_vector = std::vector<bounds_step>;
+
+ struct color_step
+ {
+ int state;
+ render_color color;
+ render_color delta;
+ };
+ using color_vector = std::vector<color_step>;
+
// internal state
- int m_state; // state where this component is visible (-1 means all states)
- render_bounds m_bounds; // bounds of the element
- render_color m_color; // color of the element
+ int const m_statemask; // bits of state used to control visibility
+ int const m_stateval; // masked state value to make component visible
+ bounds_vector m_bounds; // bounds of the element
+ color_vector m_color; // color of the element
};
// component implementations
@@ -677,8 +698,9 @@ private:
// internal state
running_machine & m_machine; // reference to the owning machine
std::vector<component::ptr> m_complist; // list of components
- int m_defstate; // default state of this element
- int m_maxstate; // maximum state value for all components
+ int const m_defstate; // default state of this element
+ int m_statemask; // mask to apply to state values
+ bool m_foldhigh; // whether we need to fold state values above the mask range
std::vector<texture> m_elemtex; // array of element textures used for managing the scaled bitmaps
};
diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp
index 72c50a3db3b..198fa03998a 100644
--- a/src/emu/rendlay.cpp
+++ b/src/emu/rendlay.cpp
@@ -9,12 +9,14 @@
***************************************************************************/
#include "emu.h"
+#include "render.h"
+#include "rendlay.h"
#include "emuopts.h"
-#include "render.h"
#include "rendfont.h"
-#include "rendlay.h"
#include "rendutil.h"
+#include "video/rgbutil.h"
+
#include "vecstream.h"
#include "xmlfile.h"
@@ -938,12 +940,10 @@ layout_element::make_component_map const layout_element::s_make_component{
layout_element::layout_element(environment &env, util::xml::data_node const &elemnode, const char *dirname)
: m_machine(env.machine())
- , m_defstate(0)
- , m_maxstate(0)
+ , m_defstate(env.get_attribute_int(elemnode, "defstate", -1))
+ , m_statemask(0)
+ , m_foldhigh(false)
{
- // get the default state
- m_defstate = env.get_attribute_int(elemnode, "defstate", -1);
-
// parse components in order
bool first = true;
render_bounds bounds = { 0.0, 0.0, 0.0, 0.0 };
@@ -958,13 +958,15 @@ layout_element::layout_element(environment &env, util::xml::data_node const &ele
// accumulate bounds
if (first)
- bounds = newcomp.bounds();
+ bounds = newcomp.overall_bounds();
else
- union_render_bounds(bounds, newcomp.bounds());
+ union_render_bounds(bounds, newcomp.overall_bounds());
first = false;
// determine the maximum state
- m_maxstate = std::max(m_maxstate, newcomp.maxstate());
+ std::pair<int, bool> const wrap(newcomp.statewrap());
+ m_statemask |= wrap.first;
+ m_foldhigh = m_foldhigh || wrap.second;
}
if (!m_complist.empty())
@@ -972,8 +974,8 @@ layout_element::layout_element(environment &env, util::xml::data_node const &ele
// determine the scale/offset for normalization
float xoffs = bounds.x0;
float yoffs = bounds.y0;
- float xscale = 1.0f / (bounds.x1 - bounds.x0);
- float yscale = 1.0f / (bounds.y1 - bounds.y0);
+ float xscale = 1.0F / (bounds.x1 - bounds.x0);
+ float yscale = 1.0F / (bounds.y1 - bounds.y0);
// normalize all the component bounds
for (component::ptr const &curcomp : m_complist)
@@ -981,7 +983,7 @@ layout_element::layout_element(environment &env, util::xml::data_node const &ele
}
// allocate an array of element textures for the states
- m_elemtex.resize(m_maxstate + 1);
+ m_elemtex.resize((m_statemask + 1) << (m_foldhigh ? 1 : 0));
}
@@ -1005,7 +1007,7 @@ layout_element::~layout_element()
layout_group::layout_group(util::xml::data_node const &groupnode)
: m_groupnode(groupnode)
- , m_bounds{ 0.0f, 0.0f, 0.0f, 0.0f }
+ , m_bounds{ 0.0F, 0.0F, 0.0F, 0.0F }
, m_bounds_resolved(false)
{
}
@@ -1284,8 +1286,12 @@ void layout_group::resolve_bounds(
render_texture *layout_element::state_texture(int state)
{
- assert(state <= m_maxstate);
- if (m_elemtex[state].m_texture == nullptr)
+ if (m_foldhigh && (state & ~m_statemask))
+ state = (state & m_statemask) | (((m_statemask << 1) | 1) & ~m_statemask);
+ else
+ state &= m_statemask;
+ assert(m_elemtex.size() > state);
+ if (!m_elemtex[state].m_texture)
{
m_elemtex[state].m_element = this;
m_elemtex[state].m_state = state;
@@ -1303,23 +1309,26 @@ render_texture *layout_element::state_texture(int state)
void layout_element::element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param)
{
- texture *elemtex = (texture *)param;
+ texture const &elemtex(*reinterpret_cast<texture const *>(param));
// iterate over components that are part of the current state
- for (auto &curcomp : elemtex->m_element->m_complist)
- if (curcomp->state() == -1 || curcomp->state() == elemtex->m_state)
+ for (auto const &curcomp : elemtex.m_element->m_complist)
+ {
+ if ((elemtex.m_state & curcomp->statemask()) == curcomp->stateval())
{
// get the local scaled bounds
+ render_bounds const compbounds(curcomp->bounds(elemtex.m_state));
rectangle bounds(
- render_round_nearest(curcomp->bounds().x0 * dest.width()),
- render_round_nearest(curcomp->bounds().x1 * dest.width()),
- render_round_nearest(curcomp->bounds().y0 * dest.height()),
- render_round_nearest(curcomp->bounds().y1 * dest.height()));
+ render_round_nearest(compbounds.x0 * dest.width()),
+ render_round_nearest(compbounds.x1 * dest.width()),
+ render_round_nearest(compbounds.y0 * dest.height()),
+ render_round_nearest(compbounds.y1 * dest.height()));
bounds &= dest.cliprect();
// based on the component type, add to the texture
- curcomp->draw(elemtex->m_element->machine(), dest, bounds, elemtex->m_state);
+ curcomp->draw(elemtex.m_element->machine(), dest, bounds, elemtex.m_state);
}
+ }
}
@@ -1330,13 +1339,10 @@ public:
// construction/destruction
image_component(environment &env, util::xml::data_node const &compnode, const char *dirname)
: component(env, compnode, dirname)
- , m_hasalpha(false)
+ , m_dirname(dirname ? dirname : "")
+ , m_imagefile(env.get_attribute_string(compnode, "file", ""))
+ , m_alphafile(env.get_attribute_string(compnode, "alphafile", ""))
{
- if (dirname != nullptr)
- m_dirname = dirname;
- m_imagefile = env.get_attribute_string(compnode, "file", "");
- m_alphafile = env.get_attribute_string(compnode, "alphafile", "");
- m_file = std::make_unique<emu_file>(env.machine().options().art_path(), OPEN_FLAG_READ);
}
protected:
@@ -1344,19 +1350,56 @@ protected:
virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override
{
if (!m_bitmap.valid())
- load_bitmap();
+ load_bitmap(machine);
- bitmap_argb32 destsub(dest, bounds);
- render_resample_argb_bitmap_hq(destsub, m_bitmap, color());
+ render_color const c(color(state));
+ if (m_hasalpha || (1.0F > c.a))
+ {
+ bitmap_argb32 tempbitmap(dest.width(), dest.height());
+ render_resample_argb_bitmap_hq(tempbitmap, m_bitmap, c);
+ for (s32 y0 = 0, y1 = bounds.top(); bounds.bottom() >= y1; ++y0, ++y1)
+ {
+ u32 const *src(&tempbitmap.pix(y0, 0));
+ u32 *dst(&dest.pix(y1, bounds.left()));
+ for (s32 x1 = bounds.left(); bounds.right() >= x1; ++x1, ++src, ++dst)
+ {
+ rgb_t const a(*src);
+ u32 const aa(a.a());
+ if (aa)
+ {
+ rgb_t const b(*dst);
+ u32 const ba(b.a());
+ if (ba)
+ {
+ u32 const ca((aa * 255) + (ba * (255 - aa)));
+ *dst = rgb_t(
+ u8(ca / 255),
+ u8(((a.r() * aa * 255) + (b.r() * ba * (255 - aa))) / ca),
+ u8(((a.g() * aa * 255) + (b.g() * ba * (255 - aa))) / ca),
+ u8(((a.b() * aa * 255) + (b.b() * ba * (255 - aa))) / ca));
+ }
+ else
+ {
+ *dst = *src;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ bitmap_argb32 destsub(dest, bounds);
+ render_resample_argb_bitmap_hq(destsub, m_bitmap, c);
+ }
}
private:
// internal helpers
- void load_bitmap()
+ void load_bitmap(running_machine &machine)
{
- assert(m_file != nullptr);
+ emu_file file(machine.options().art_path(), OPEN_FLAG_READ);
- ru_imgformat const format = render_detect_image(*m_file, m_dirname.c_str(), m_imagefile.c_str());
+ ru_imgformat const format = render_detect_image(file, m_dirname.c_str(), m_imagefile.c_str());
switch (format)
{
case RENDUTIL_IMGFORMAT_ERROR:
@@ -1364,18 +1407,18 @@ private:
case RENDUTIL_IMGFORMAT_PNG:
// load the basic bitmap
- m_hasalpha = render_load_png(m_bitmap, *m_file, m_dirname.c_str(), m_imagefile.c_str());
+ m_hasalpha = render_load_png(m_bitmap, file, m_dirname.c_str(), m_imagefile.c_str());
break;
default:
// try JPG
- render_load_jpeg(m_bitmap, *m_file, m_dirname.c_str(), m_imagefile.c_str());
+ render_load_jpeg(m_bitmap, file, m_dirname.c_str(), m_imagefile.c_str());
break;
}
// load the alpha bitmap if specified
if (m_bitmap.valid() && !m_alphafile.empty())
- render_load_png(m_bitmap, *m_file, m_dirname.c_str(), m_alphafile.c_str(), true);
+ render_load_png(m_bitmap, file, m_dirname.c_str(), m_alphafile.c_str(), true);
// if we can't load the bitmap, allocate a dummy one and report an error
if (!m_bitmap.valid())
@@ -1397,11 +1440,10 @@ private:
// internal state
bitmap_argb32 m_bitmap; // source bitmap for images
- std::string m_dirname; // directory name of image file (for lazy loading)
- std::unique_ptr<emu_file> m_file; // file object for reading image/alpha files
- std::string m_imagefile; // name of the image file (for lazy loading)
- std::string m_alphafile; // name of the alpha file (for lazy loading)
- bool m_hasalpha; // is there any alpha component present?
+ std::string const m_dirname; // directory name of image file (for lazy loading)
+ std::string const m_imagefile; // name of the image file (for lazy loading)
+ std::string const m_alphafile; // name of the alpha file (for lazy loading)
+ bool m_hasalpha = false; // is there any alpha component present?
};
@@ -1420,10 +1462,11 @@ protected:
virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override
{
// compute premultiplied colors
- u32 const r = color().r * color().a * 255.0f;
- u32 const g = color().g * color().a * 255.0f;
- u32 const b = color().b * color().a * 255.0f;
- u32 const inva = (1.0f - color().a) * 255.0f;
+ render_color const c = color(state);
+ u32 const r = c.r * c.a * 255.0f;
+ u32 const g = c.g * c.a * 255.0f;
+ u32 const b = c.b * c.a * 255.0f;
+ u32 const inva = (1.0f - c.a) * 255.0f;
// iterate over X and Y
for (u32 y = bounds.top(); y <= bounds.bottom(); y++)
@@ -1466,10 +1509,11 @@ protected:
virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override
{
// compute premultiplied colors
- u32 const r = color().r * color().a * 255.0f;
- u32 const g = color().g * color().a * 255.0f;
- u32 const b = color().b * color().a * 255.0f;
- u32 const inva = (1.0f - color().a) * 255.0f;
+ render_color const c(color(state));
+ u32 const r = c.r * c.a * 255.0f;
+ u32 const g = c.g * c.a * 255.0f;
+ u32 const b = c.b * c.a * 255.0f;
+ u32 const inva = (1.0f - c.a) * 255.0f;
// find the center
float const xcenter = float(bounds.xcenter());
@@ -1481,7 +1525,7 @@ protected:
// iterate over y
for (u32 y = bounds.top(); y <= bounds.bottom(); y++)
{
- float ycoord = ycenter - ((float)y + 0.5f);
+ float ycoord = ycenter - (float(y) + 0.5f);
float xval = xradius * sqrtf(1.0f - (ycoord * ycoord) * ooyradius2);
// compute left/right coordinates
@@ -1529,7 +1573,7 @@ protected:
virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override
{
render_font *font = machine.render().font_alloc("default");
- draw_text(*font, dest, bounds, m_string.c_str(), m_textalign);
+ draw_text(*font, dest, bounds, m_string.c_str(), m_textalign, color(state));
machine.render().font_free(font);
}
@@ -1556,14 +1600,14 @@ protected:
virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override
{
- const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff);
- const rgb_t offpen = rgb_t(0x20,0xff,0xff,0xff);
+ rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
+ rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff);
// sizes for computation
- int bmwidth = 250;
- int bmheight = 400;
- int segwidth = 40;
- int skewwidth = 40;
+ int const bmwidth = 250;
+ int const bmheight = 400;
+ int const segwidth = 40;
+ int const skewwidth = 40;
// allocate a temporary bitmap for drawing
bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
@@ -1597,7 +1641,7 @@ protected:
draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, BIT(state, 7) ? onpen : offpen);
// resample to the target size
- render_resample_argb_bitmap_hq(dest, tempbitmap, color());
+ render_resample_argb_bitmap_hq(dest, tempbitmap, color(state));
}
};
@@ -1618,15 +1662,15 @@ protected:
virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override
{
- const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff);
- const rgb_t offpen = rgb_t(0x20,0xff,0xff,0xff);
- const rgb_t backpen = rgb_t(0x00,0x00,0x00,0x00);
+ rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
+ rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff);
+ rgb_t const backpen = rgb_t(0x00, 0x00, 0x00, 0x00);
// sizes for computation
- int bmwidth = 250;
- int bmheight = 400;
- int segwidth = 40;
- int skewwidth = 40;
+ int const bmwidth = 250;
+ int const bmheight = 400;
+ int const segwidth = 40;
+ int const skewwidth = 40;
// allocate a temporary bitmap for drawing
bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
@@ -1665,7 +1709,7 @@ protected:
apply_skew(tempbitmap, 40);
// resample to the target size
- render_resample_argb_bitmap_hq(dest, tempbitmap, color());
+ render_resample_argb_bitmap_hq(dest, tempbitmap, color(state));
}
};
@@ -1686,14 +1730,14 @@ protected:
virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override
{
- const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
- const rgb_t offpen = rgb_t(0x20, 0xff, 0xff, 0xff);
+ rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
+ rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff);
// sizes for computation
- int bmwidth = 250;
- int bmheight = 400;
- int segwidth = 40;
- int skewwidth = 40;
+ int const bmwidth = 250;
+ int const bmheight = 400;
+ int const segwidth = 40;
+ int const skewwidth = 40;
// allocate a temporary bitmap for drawing
bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight);
@@ -1701,83 +1745,83 @@ protected:
// top bar
draw_segment_horizontal(tempbitmap,
- 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2,
- segwidth, (state & (1 << 0)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2,
+ segwidth, (state & (1 << 0)) ? onpen : offpen);
// right-top bar
draw_segment_vertical(tempbitmap,
- 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
- segwidth, (state & (1 << 1)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
+ segwidth, (state & (1 << 1)) ? onpen : offpen);
// right-bottom bar
draw_segment_vertical(tempbitmap,
- bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
- segwidth, (state & (1 << 2)) ? onpen : offpen);
+ bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
+ segwidth, (state & (1 << 2)) ? onpen : offpen);
// bottom bar
draw_segment_horizontal(tempbitmap,
- 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
- segwidth, (state & (1 << 3)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
+ segwidth, (state & (1 << 3)) ? onpen : offpen);
// left-bottom bar
draw_segment_vertical(tempbitmap,
- bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
- segwidth, (state & (1 << 4)) ? onpen : offpen);
+ bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
+ segwidth, (state & (1 << 4)) ? onpen : offpen);
// left-top bar
draw_segment_vertical(tempbitmap,
- 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
- segwidth, (state & (1 << 5)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
+ segwidth, (state & (1 << 5)) ? onpen : offpen);
// horizontal-middle-left bar
draw_segment_horizontal_caps(tempbitmap,
- 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
- segwidth, LINE_CAP_START, (state & (1 << 6)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
+ segwidth, LINE_CAP_START, (state & (1 << 6)) ? onpen : offpen);
// horizontal-middle-right bar
draw_segment_horizontal_caps(tempbitmap,
- 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
- segwidth, LINE_CAP_END, (state & (1 << 7)) ? onpen : offpen);
+ 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
+ segwidth, LINE_CAP_END, (state & (1 << 7)) ? onpen : offpen);
// vertical-middle-top bar
draw_segment_vertical_caps(tempbitmap,
- 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
- segwidth, LINE_CAP_NONE, (state & (1 << 8)) ? onpen : offpen);
+ 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
+ segwidth, LINE_CAP_NONE, (state & (1 << 8)) ? onpen : offpen);
// vertical-middle-bottom bar
draw_segment_vertical_caps(tempbitmap,
- bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
- segwidth, LINE_CAP_NONE, (state & (1 << 9)) ? onpen : offpen);
+ bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
+ segwidth, LINE_CAP_NONE, (state & (1 << 9)) ? onpen : offpen);
// diagonal-left-bottom bar
draw_segment_diagonal_1(tempbitmap,
- 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
- bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
- segwidth, (state & (1 << 10)) ? onpen : offpen);
+ 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
+ bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
+ segwidth, (state & (1 << 10)) ? onpen : offpen);
// diagonal-left-top bar
draw_segment_diagonal_2(tempbitmap,
- 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
- 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
- segwidth, (state & (1 << 11)) ? onpen : offpen);
+ 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
+ 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
+ segwidth, (state & (1 << 11)) ? onpen : offpen);
// diagonal-right-top bar
draw_segment_diagonal_1(tempbitmap,
- bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
- 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
- segwidth, (state & (1 << 12)) ? onpen : offpen);
+ bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
+ 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
+ segwidth, (state & (1 << 12)) ? onpen : offpen);
// diagonal-right-bottom bar
draw_segment_diagonal_2(tempbitmap,
- bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
- bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
- segwidth, (state & (1 << 13)) ? onpen : offpen);
+ bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
+ bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
+ segwidth, (state & (1 << 13)) ? onpen : offpen);
// apply skew
apply_skew(tempbitmap, 40);
// resample to the target size
- render_resample_argb_bitmap_hq(dest, tempbitmap, color());
+ render_resample_argb_bitmap_hq(dest, tempbitmap, color(state));
}
};
@@ -1899,7 +1943,7 @@ protected:
apply_skew(tempbitmap, 40);
// resample to the target size
- render_resample_argb_bitmap_hq(dest, tempbitmap, color());
+ render_resample_argb_bitmap_hq(dest, tempbitmap, color(state));
}
};
@@ -1920,14 +1964,14 @@ protected:
virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override
{
- const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
- const rgb_t offpen = rgb_t(0x20, 0xff, 0xff, 0xff);
+ rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
+ rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff);
// sizes for computation
- int bmwidth = 250;
- int bmheight = 400;
- int segwidth = 40;
- int skewwidth = 40;
+ int const bmwidth = 250;
+ int const bmheight = 400;
+ int const segwidth = 40;
+ int const skewwidth = 40;
// allocate a temporary bitmap for drawing, adding some extra space for the tail
bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth);
@@ -1935,92 +1979,94 @@ protected:
// top bar
draw_segment_horizontal(tempbitmap,
- 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2,
- segwidth, (state & (1 << 0)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2,
+ segwidth, (state & (1 << 0)) ? onpen : offpen);
// right-top bar
draw_segment_vertical(tempbitmap,
- 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
- segwidth, (state & (1 << 1)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
+ segwidth, (state & (1 << 1)) ? onpen : offpen);
// right-bottom bar
draw_segment_vertical(tempbitmap,
- bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
- segwidth, (state & (1 << 2)) ? onpen : offpen);
+ bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
+ segwidth, (state & (1 << 2)) ? onpen : offpen);
// bottom bar
draw_segment_horizontal(tempbitmap,
- 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
- segwidth, (state & (1 << 3)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
+ segwidth, (state & (1 << 3)) ? onpen : offpen);
// left-bottom bar
draw_segment_vertical(tempbitmap,
- bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
- segwidth, (state & (1 << 4)) ? onpen : offpen);
+ bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
+ segwidth, (state & (1 << 4)) ? onpen : offpen);
// left-top bar
draw_segment_vertical(tempbitmap,
- 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
- segwidth, (state & (1 << 5)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
+ segwidth, (state & (1 << 5)) ? onpen : offpen);
// horizontal-middle-left bar
draw_segment_horizontal_caps(tempbitmap,
- 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
- segwidth, LINE_CAP_START, (state & (1 << 6)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
+ segwidth, LINE_CAP_START, (state & (1 << 6)) ? onpen : offpen);
// horizontal-middle-right bar
draw_segment_horizontal_caps(tempbitmap,
- 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
- segwidth, LINE_CAP_END, (state & (1 << 7)) ? onpen : offpen);
+ 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
+ segwidth, LINE_CAP_END, (state & (1 << 7)) ? onpen : offpen);
// vertical-middle-top bar
draw_segment_vertical_caps(tempbitmap,
- 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
- segwidth, LINE_CAP_NONE, (state & (1 << 8)) ? onpen : offpen);
+ 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
+ segwidth, LINE_CAP_NONE, (state & (1 << 8)) ? onpen : offpen);
// vertical-middle-bottom bar
draw_segment_vertical_caps(tempbitmap,
- bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
- segwidth, LINE_CAP_NONE, (state & (1 << 9)) ? onpen : offpen);
+ bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
+ segwidth, LINE_CAP_NONE, (state & (1 << 9)) ? onpen : offpen);
// diagonal-left-bottom bar
draw_segment_diagonal_1(tempbitmap,
- 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
- bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
- segwidth, (state & (1 << 10)) ? onpen : offpen);
+ 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
+ bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
+ segwidth, (state & (1 << 10)) ? onpen : offpen);
// diagonal-left-top bar
draw_segment_diagonal_2(tempbitmap,
- 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
- 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
- segwidth, (state & (1 << 11)) ? onpen : offpen);
+ 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
+ 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
+ segwidth, (state & (1 << 11)) ? onpen : offpen);
// diagonal-right-top bar
draw_segment_diagonal_1(tempbitmap,
- bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
- 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
- segwidth, (state & (1 << 12)) ? onpen : offpen);
+ bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
+ 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
+ segwidth, (state & (1 << 12)) ? onpen : offpen);
// diagonal-right-bottom bar
draw_segment_diagonal_2(tempbitmap,
- bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
- bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
- segwidth, (state & (1 << 13)) ? onpen : offpen);
+ bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
+ bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
+ segwidth, (state & (1 << 13)) ? onpen : offpen);
// apply skew
apply_skew(tempbitmap, 40);
// comma tail
draw_segment_diagonal_1(tempbitmap,
- bmwidth - (segwidth/2), bmwidth + segwidth,
- bmheight - (segwidth), bmheight + segwidth*1.5,
- segwidth/2, (state & (1 << 15)) ? onpen : offpen);
+ bmwidth - (segwidth/2), bmwidth + segwidth,
+ bmheight - (segwidth), bmheight + segwidth*1.5,
+ segwidth/2, (state & (1 << 15)) ? onpen : offpen);
// decimal point
- draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (state & (1 << 14)) ? onpen : offpen);
+ draw_segment_decimal(tempbitmap,
+ bmwidth + segwidth/2, bmheight - segwidth/2,
+ segwidth, (state & (1 << 14)) ? onpen : offpen);
// resample to the target size
- render_resample_argb_bitmap_hq(dest, tempbitmap, color());
+ render_resample_argb_bitmap_hq(dest, tempbitmap, color(state));
}
};
@@ -2041,14 +2087,14 @@ protected:
virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override
{
- const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
- const rgb_t offpen = rgb_t(0x20, 0xff, 0xff, 0xff);
+ rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
+ rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff);
// sizes for computation
- int bmwidth = 250;
- int bmheight = 400;
- int segwidth = 40;
- int skewwidth = 40;
+ int const bmwidth = 250;
+ int const bmheight = 400;
+ int const segwidth = 40;
+ int const skewwidth = 40;
// allocate a temporary bitmap for drawing
bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth);
@@ -2056,102 +2102,103 @@ protected:
// top-left bar
draw_segment_horizontal_caps(tempbitmap,
- 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2,
- segwidth, LINE_CAP_START, (state & (1 << 0)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2,
+ segwidth, LINE_CAP_START, (state & (1 << 0)) ? onpen : offpen);
// top-right bar
draw_segment_horizontal_caps(tempbitmap,
- 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2,
- segwidth, LINE_CAP_END, (state & (1 << 1)) ? onpen : offpen);
+ 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2,
+ segwidth, LINE_CAP_END, (state & (1 << 1)) ? onpen : offpen);
// right-top bar
draw_segment_vertical(tempbitmap,
- 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
- segwidth, (state & (1 << 2)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2,
+ segwidth, (state & (1 << 2)) ? onpen : offpen);
// right-bottom bar
draw_segment_vertical(tempbitmap,
- bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
- segwidth, (state & (1 << 3)) ? onpen : offpen);
+ bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2,
+ segwidth, (state & (1 << 3)) ? onpen : offpen);
// bottom-right bar
draw_segment_horizontal_caps(tempbitmap,
- 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
- segwidth, LINE_CAP_END, (state & (1 << 4)) ? onpen : offpen);
+ 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2,
+ segwidth, LINE_CAP_END, (state & (1 << 4)) ? onpen : offpen);
// bottom-left bar
draw_segment_horizontal_caps(tempbitmap,
- 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2,
- segwidth, LINE_CAP_START, (state & (1 << 5)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2,
+ segwidth, LINE_CAP_START, (state & (1 << 5)) ? onpen : offpen);
// left-bottom bar
draw_segment_vertical(tempbitmap,
- bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
- segwidth, (state & (1 << 6)) ? onpen : offpen);
+ bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2,
+ segwidth, (state & (1 << 6)) ? onpen : offpen);
// left-top bar
draw_segment_vertical(tempbitmap,
- 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
- segwidth, (state & (1 << 7)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2,
+ segwidth, (state & (1 << 7)) ? onpen : offpen);
// horizontal-middle-left bar
draw_segment_horizontal_caps(tempbitmap,
- 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
- segwidth, LINE_CAP_START, (state & (1 << 8)) ? onpen : offpen);
+ 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2,
+ segwidth, LINE_CAP_START, (state & (1 << 8)) ? onpen : offpen);
// horizontal-middle-right bar
draw_segment_horizontal_caps(tempbitmap,
- 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
- segwidth, LINE_CAP_END, (state & (1 << 9)) ? onpen : offpen);
+ 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2,
+ segwidth, LINE_CAP_END, (state & (1 << 9)) ? onpen : offpen);
// vertical-middle-top bar
draw_segment_vertical_caps(tempbitmap,
- 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
- segwidth, LINE_CAP_NONE, (state & (1 << 10)) ? onpen : offpen);
+ 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2,
+ segwidth, LINE_CAP_NONE, (state & (1 << 10)) ? onpen : offpen);
// vertical-middle-bottom bar
draw_segment_vertical_caps(tempbitmap,
- bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
- segwidth, LINE_CAP_NONE, (state & (1 << 11)) ? onpen : offpen);
+ bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2,
+ segwidth, LINE_CAP_NONE, (state & (1 << 11)) ? onpen : offpen);
// diagonal-left-bottom bar
draw_segment_diagonal_1(tempbitmap,
- 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
- bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
- segwidth, (state & (1 << 12)) ? onpen : offpen);
+ 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
+ bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
+ segwidth, (state & (1 << 12)) ? onpen : offpen);
// diagonal-left-top bar
draw_segment_diagonal_2(tempbitmap,
- 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
- 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
- segwidth, (state & (1 << 13)) ? onpen : offpen);
+ 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5,
+ 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
+ segwidth, (state & (1 << 13)) ? onpen : offpen);
// diagonal-right-top bar
draw_segment_diagonal_1(tempbitmap,
- bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
- 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
- segwidth, (state & (1 << 14)) ? onpen : offpen);
+ bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
+ 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3,
+ segwidth, (state & (1 << 14)) ? onpen : offpen);
// diagonal-right-bottom bar
draw_segment_diagonal_2(tempbitmap,
- bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
- bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
- segwidth, (state & (1 << 15)) ? onpen : offpen);
+ bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5,
+ bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3,
+ segwidth, (state & (1 << 15)) ? onpen : offpen);
+
+ // apply skew
+ apply_skew(tempbitmap, 40);
// comma tail
draw_segment_diagonal_1(tempbitmap,
- bmwidth - (segwidth/2), bmwidth + segwidth,
- bmheight - (segwidth), bmheight + segwidth*1.5,
- segwidth/2, (state & (1 << 17)) ? onpen : offpen);
+ bmwidth - (segwidth/2), bmwidth + segwidth, bmheight - (segwidth), bmheight + segwidth*1.5,
+ segwidth/2, (state & (1 << 17)) ? onpen : offpen);
// decimal point (draw last for priority)
- draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (state & (1 << 16)) ? onpen : offpen);
-
- // apply skew
- apply_skew(tempbitmap, 40);
+ draw_segment_decimal(tempbitmap,
+ bmwidth + segwidth/2, bmheight - segwidth/2,
+ segwidth, (state & (1 << 16)) ? onpen : offpen);
// resample to the target size
- render_resample_argb_bitmap_hq(dest, tempbitmap, color());
+ render_resample_argb_bitmap_hq(dest, tempbitmap, color(state));
}
};
@@ -2188,7 +2235,7 @@ protected:
draw_segment_decimal(tempbitmap, ((dotwidth / 2) + (i * dotwidth)), bmheight / 2, dotwidth, BIT(state, i) ? onpen : offpen);
// resample to the target size
- render_resample_argb_bitmap_hq(dest, tempbitmap, color());
+ render_resample_argb_bitmap_hq(dest, tempbitmap, color(state));
}
private:
@@ -2216,9 +2263,8 @@ protected:
virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override
{
- render_font *font = machine.render().font_alloc("default");
- std::string temp = string_format("%0*d", m_digits, state);
- draw_text(*font, dest, bounds, temp.c_str(), m_textalign);
+ render_font *const font = machine.render().font_alloc("default");
+ draw_text(*font, dest, bounds, string_format("%0*d", m_digits, state).c_str(), m_textalign, color(state));
machine.render().font_free(font);
}
@@ -2307,10 +2353,11 @@ protected:
int use_state = (state + m_stateoffset) % max_state_used;
// compute premultiplied colors
- u32 r = color().r * 255.0f;
- u32 g = color().g * 255.0f;
- u32 b = color().b * 255.0f;
- u32 a = color().a * 255.0f;
+ render_color const c(color(state));
+ u32 const r = c.r * 255.0f;
+ u32 const g = c.g * 255.0f;
+ u32 const b = c.b * 255.0f;
+ u32 const a = c.a * 255.0f;
// get the width of the string
render_font *font = machine.render().font_alloc("default");
@@ -2367,7 +2414,7 @@ protected:
if (m_bitmap[fruit].valid())
{
- render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], color());
+ render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], c);
for (int y = 0; y < ourheight/num_shown; y++)
{
@@ -2468,10 +2515,11 @@ private:
int use_state = (state + m_stateoffset) % max_state_used;
// compute premultiplied colors
- u32 r = color().r * 255.0f;
- u32 g = color().g * 255.0f;
- u32 b = color().b * 255.0f;
- u32 a = color().a * 255.0f;
+ render_color const c(color(state));
+ u32 const r = c.r * 255.0f;
+ u32 const g = c.g * 255.0f;
+ u32 const b = c.b * 255.0f;
+ u32 const a = c.a * 255.0f;
// get the width of the string
render_font *font = machine.render().font_alloc("default");
@@ -2526,7 +2574,7 @@ private:
if (m_bitmap[fruit].valid())
{
- render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], color());
+ render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], c);
for (int y = 0; y < dest.height(); y++)
{
@@ -2736,10 +2784,206 @@ layout_element::texture &layout_element::texture::operator=(texture &&that)
//-------------------------------------------------
layout_element::component::component(environment &env, util::xml::data_node const &compnode, const char *dirname)
- : m_state(env.get_attribute_int(compnode, "state", -1))
- , m_color(env.parse_color(compnode.get_child("color")))
+ : m_statemask(env.get_attribute_int(compnode, "statemask", env.get_attribute_string(compnode, "state", "")[0] ? ~0 : 0))
+ , m_stateval(env.get_attribute_int(compnode, "state", m_statemask) & m_statemask)
+{
+ for (util::xml::data_node const *child = compnode.get_first_child(); child; child = child->get_next_sibling())
+ {
+ if (!strcmp(child->get_name(), "bounds"))
+ {
+ int const state(env.get_attribute_int(*child, "state", 0));
+ auto const pos(
+ std::lower_bound(
+ m_bounds.begin(),
+ m_bounds.end(),
+ state,
+ [] (bounds_step const &lhs, int rhs) { return lhs.state < rhs; }));
+ if ((m_bounds.end() != pos) && (state == pos->state))
+ {
+ throw layout_syntax_error(
+ util::string_format(
+ "%s component has duplicate bounds for state %d",
+ compnode.get_name(),
+ state));
+ }
+ bounds_step &ins(*m_bounds.emplace(pos, bounds_step{ state, { 0.0F, 0.0F, 0.0F, 0.0F }, { 0.0F, 0.0F, 0.0F, 0.0F } }));
+ env.parse_bounds(child, ins.bounds);
+ }
+ else if (!strcmp(child->get_name(), "color"))
+ {
+ int const state(env.get_attribute_int(*child, "state", 0));
+ auto const pos(
+ std::lower_bound(
+ m_color.begin(),
+ m_color.end(),
+ state,
+ [] (color_step const &lhs, int rhs) { return lhs.state < rhs; }));
+ if ((m_color.end() != pos) && (state == pos->state))
+ {
+ throw layout_syntax_error(
+ util::string_format(
+ "%s component has duplicate color for state %d",
+ compnode.get_name(),
+ state));
+ }
+ m_color.emplace(pos, color_step{ state, env.parse_color(child), { 0.0F, 0.0F, 0.0F, 0.0F } });
+ }
+ }
+ if (m_bounds.empty())
+ {
+ m_bounds.emplace_back(bounds_step{ 0, { 0.0F, 0.0F, 1.0F, 1.0F }, { 0.0F, 0.0F, 0.0F, 0.0F } });
+ }
+ else
+ {
+ auto i(m_bounds.begin());
+ auto j(i);
+ while (m_bounds.end() != ++j)
+ {
+ assert(j->state > i->state);
+
+ i->delta.x0 = (j->bounds.x0 - i->bounds.x0) / (j->state - i->state);
+ i->delta.x1 = (j->bounds.x1 - i->bounds.x1) / (j->state - i->state);
+ i->delta.y0 = (j->bounds.y0 - i->bounds.y0) / (j->state - i->state);
+ i->delta.y1 = (j->bounds.y1 - i->bounds.y1) / (j->state - i->state);
+
+ i = j;
+ }
+ }
+ if (m_color.empty())
+ {
+ m_color.emplace_back(color_step{ 0, { 1.0F, 1.0F, 1.0F, 1.0F }, { 0.0F, 0.0F, 0.0F, 0.0F } });
+ }
+ else
+ {
+ auto i(m_color.begin());
+ auto j(i);
+ while (m_color.end() != ++j)
+ {
+ assert(j->state > i->state);
+
+ i->delta.a = (j->color.a - i->color.a) / (j->state - i->state);
+ i->delta.r = (j->color.r - i->color.r) / (j->state - i->state);
+ i->delta.g = (j->color.g - i->color.g) / (j->state - i->state);
+ i->delta.b = (j->color.b - i->color.b) / (j->state - i->state);
+
+ i = j;
+ }
+ }
+}
+
+
+//-------------------------------------------------
+// statewrap - get state wraparound requirements
+//-------------------------------------------------
+
+std::pair<int, bool> layout_element::component::statewrap() const
+{
+ int result(0);
+ bool fold;
+ auto const adjustmask =
+ [&result, &fold] (int val, int mask)
+ {
+ assert(!(val & ~mask));
+ auto const splatright =
+ [] (int x)
+ {
+ for (unsigned shift = 1; (sizeof(x) * 4) >= shift; shift <<= 1)
+ x |= (x >> shift);
+ return x;
+ };
+ int const unfolded(splatright(mask));
+ int const folded(splatright(~mask | splatright(val)));
+ if (unsigned(folded) < unsigned(unfolded))
+ {
+ result |= folded;
+ fold = true;
+ }
+ else
+ {
+ result |= unfolded;
+ }
+ };
+ adjustmask(stateval(), statemask());
+ int max(maxstate());
+ if (m_bounds.size() > 1U)
+ max = (std::max)(max, m_bounds.back().state);
+ if (m_color.size() > 1U)
+ max = (std::max)(max, m_color.back().state);
+ if (0 <= max)
+ adjustmask(max, ~0);
+ return std::make_pair(result, fold);
+}
+
+
+//-------------------------------------------------
+// overall_bounds - maximum bounds for all states
+//-------------------------------------------------
+
+render_bounds layout_element::component::overall_bounds() const
{
- env.parse_bounds(compnode.get_child("bounds"), m_bounds);
+ auto i(m_bounds.begin());
+ render_bounds result(i->bounds);
+ while (m_bounds.end() != ++i)
+ union_render_bounds(result, i->bounds);
+ return result;
+}
+
+
+//-------------------------------------------------
+// bounds - bounds for a given state
+//-------------------------------------------------
+
+render_bounds layout_element::component::bounds(int state) const
+{
+ auto pos(
+ std::lower_bound(
+ m_bounds.begin(),
+ m_bounds.end(),
+ state,
+ [] (bounds_step const &lhs, int rhs) { return lhs.state < rhs; }));
+ if (m_bounds.begin() == pos)
+ {
+ return pos->bounds;
+ }
+ else
+ {
+ --pos;
+ render_bounds result(pos->bounds);
+ result.x0 += pos->delta.x0 * (state - pos->state);
+ result.x1 += pos->delta.x1 * (state - pos->state);
+ result.y0 += pos->delta.y0 * (state - pos->state);
+ result.y1 += pos->delta.y1 * (state - pos->state);
+ return result;
+ }
+}
+
+
+//-------------------------------------------------
+// color - color for a given state
+//-------------------------------------------------
+
+render_color layout_element::component::color(int state) const
+{
+ auto pos(
+ std::lower_bound(
+ m_color.begin(),
+ m_color.end(),
+ state,
+ [] (color_step const &lhs, int rhs) { return lhs.state < rhs; }));
+ if (m_color.begin() == pos)
+ {
+ return pos->color;
+ }
+ else
+ {
+ --pos;
+ render_color result(pos->color);
+ result.a += pos->delta.a * (state - pos->state);
+ result.r += pos->delta.r * (state - pos->state);
+ result.g += pos->delta.g * (state - pos->state);
+ result.b += pos->delta.b * (state - pos->state);
+ return result;
+ }
}
@@ -2749,10 +2993,27 @@ layout_element::component::component(environment &env, util::xml::data_node cons
void layout_element::component::normalize_bounds(float xoffs, float yoffs, float xscale, float yscale)
{
- m_bounds.x0 = (m_bounds.x0 - xoffs) * xscale;
- m_bounds.x1 = (m_bounds.x1 - xoffs) * xscale;
- m_bounds.y0 = (m_bounds.y0 - yoffs) * yscale;
- m_bounds.y1 = (m_bounds.y1 - yoffs) * yscale;
+ auto i(m_bounds.begin());
+ i->bounds.x0 = (i->bounds.x0 - xoffs) * xscale;
+ i->bounds.x1 = (i->bounds.x1 - xoffs) * xscale;
+ i->bounds.y0 = (i->bounds.y0 - yoffs) * yscale;
+ i->bounds.y1 = (i->bounds.y1 - yoffs) * yscale;
+
+ auto j(i);
+ while (m_bounds.end() != ++j)
+ {
+ j->bounds.x0 = (j->bounds.x0 - xoffs) * xscale;
+ j->bounds.x1 = (j->bounds.x1 - xoffs) * xscale;
+ j->bounds.y0 = (j->bounds.y0 - yoffs) * yscale;
+ j->bounds.y1 = (j->bounds.y1 - yoffs) * yscale;
+
+ i->delta.x0 = (j->bounds.x0 - i->bounds.x0) / (j->state - i->state);
+ i->delta.x1 = (j->bounds.x1 - i->bounds.x1) / (j->state - i->state);
+ i->delta.y0 = (j->bounds.y0 - i->bounds.y0) / (j->state - i->state);
+ i->delta.y1 = (j->bounds.y1 - i->bounds.y1) / (j->state - i->state);
+
+ i = j;
+ }
}
@@ -2760,13 +3021,19 @@ void layout_element::component::normalize_bounds(float xoffs, float yoffs, float
// draw_text - draw text in the specified color
//-------------------------------------------------
-void layout_element::component::draw_text(render_font &font, bitmap_argb32 &dest, const rectangle &bounds, const char *str, int align)
+void layout_element::component::draw_text(
+ render_font &font,
+ bitmap_argb32 &dest,
+ const rectangle &bounds,
+ const char *str,
+ int align,
+ const render_color &color)
{
// compute premultiplied colors
- u32 r = color().r * 255.0f;
- u32 g = color().g * 255.0f;
- u32 b = color().b * 255.0f;
- u32 a = color().a * 255.0f;
+ u32 const r(color.r * 255.0f);
+ u32 const g(color.g * 255.0f);
+ u32 const b(color.b * 255.0f);
+ u32 const a(color.a * 255.0f);
// get the width of the string
float aspect = 1.0f;
diff --git a/src/emu/rendutil.cpp b/src/emu/rendutil.cpp
index 8baf312d224..f3e4950f598 100644
--- a/src/emu/rendutil.cpp
+++ b/src/emu/rendutil.cpp
@@ -9,12 +9,13 @@
***************************************************************************/
#include "emu.h"
-#include "render.h"
#include "rendutil.h"
+
#include "png.h"
#include "jpeglib.h"
+
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
diff --git a/src/emu/save.cpp b/src/emu/save.cpp
index b2456d17b6f..b95ff1796b4 100644
--- a/src/emu/save.cpp
+++ b/src/emu/save.cpp
@@ -416,7 +416,7 @@ inline save_error save_manager::do_write(T check_space, U write_block, V start_h
{
const u32 blocksize = entry->m_typesize * entry->m_typecount;
const u8 *data = reinterpret_cast<const u8 *>(entry->m_data);
- for (u32 b = 0; entry->m_blockcount > b; ++b, data += (entry->m_typesize * entry->m_stride))
+ for (u32 b = 0; entry->m_blockcount > b; ++b, data += entry->m_stride)
if (!write_block(data, blocksize))
return STATERR_WRITE_ERROR;
}
@@ -460,7 +460,7 @@ inline save_error save_manager::do_read(T check_length, U read_block, V start_he
{
const u32 blocksize = entry->m_typesize * entry->m_typecount;
u8 *data = reinterpret_cast<u8 *>(entry->m_data);
- for (u32 b = 0; entry->m_blockcount > b; ++b, data += (entry->m_typesize * entry->m_stride))
+ for (u32 b = 0; entry->m_blockcount > b; ++b, data += entry->m_stride)
if (!read_block(data, blocksize))
return STATERR_READ_ERROR;
@@ -984,7 +984,7 @@ save_manager::state_entry::state_entry(void *data, const char *name, device_t *d
void save_manager::state_entry::flip_data()
{
u8 *data = reinterpret_cast<u8 *>(m_data);
- for (u32 b = 0; m_blockcount > b; ++b, data += (m_typesize * m_stride))
+ for (u32 b = 0; m_blockcount > b; ++b, data += m_stride)
{
u16 *data16;
u32 *data32;
diff --git a/src/emu/save.h b/src/emu/save.h
index f015534f02c..f31e3762d5b 100644
--- a/src/emu/save.h
+++ b/src/emu/save.h
@@ -55,12 +55,12 @@ typedef named_delegate<void ()> save_prepost_delegate;
// saved; in general, this is intended only to be used for specific enum types
// defined by your device
#define ALLOW_SAVE_TYPE(TYPE) \
- template <> struct save_manager::type_checker<TYPE> { static constexpr bool is_atom = true; static constexpr bool is_pointer = false; }
+ template <> struct save_manager::is_atom<TYPE> { static constexpr bool value = true; };
// use this as above, but also to declare that std::vector<TYPE> is safe as well
-#define ALLOW_SAVE_TYPE_AND_ARRAY(TYPE) \
- ALLOW_SAVE_TYPE(TYPE); \
- template <> inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, std::vector<TYPE> &value, const char *name) { save_memory(device, module, tag, index, name, &value[0], sizeof(TYPE), value.size()); }
+#define ALLOW_SAVE_TYPE_AND_VECTOR(TYPE) \
+ ALLOW_SAVE_TYPE(TYPE) \
+ template <> struct save_manager::is_vector_safe<TYPE> { static constexpr bool value = true; };
// use this for saving members of structures in arrays
#define STRUCT_MEMBER(s, m) s, &save_manager::pointer_unwrap<decltype(s)>::underlying_type::m, #s "." #m
@@ -98,9 +98,9 @@ class save_manager
static underlying_type *ptr(std::array<T, N> &value) { return array_unwrap<T>::ptr(value[0]); }
};
- // type_checker is a set of templates to identify valid save types
- template <typename ItemType> struct type_checker { static constexpr bool is_atom = false; static constexpr bool is_pointer = false; };
- template <typename ItemType> struct type_checker<ItemType *> { static constexpr bool is_atom = false; static constexpr bool is_pointer = true; };
+ // set of templates to identify valid save types
+ template <typename ItemType> struct is_atom { static constexpr bool value = false; };
+ template <typename ItemType> struct is_vector_safe { static constexpr bool value = false; };
class state_entry
{
@@ -160,10 +160,9 @@ public:
// templatized wrapper for general objects and arrays
template <typename ItemType>
- void save_item(device_t *device, const char *module, const char *tag, int index, ItemType &value, const char *valname)
+ std::enable_if_t<is_atom<typename array_unwrap<ItemType>::underlying_type>::value> save_item(device_t *device, const char *module, const char *tag, int index, ItemType &value, const char *valname)
{
- static_assert(!type_checker<ItemType>::is_pointer, "Called save_item on a pointer with no count!");
- static_assert(type_checker<typename array_unwrap<ItemType>::underlying_type>::is_atom, "Called save_item on a non-fundamental type!");
+ static_assert(!std::is_pointer<ItemType>::value, "Called save_item on a pointer with no count!");
save_memory(device, module, tag, index, valname, array_unwrap<ItemType>::ptr(value), array_unwrap<ItemType>::SIZE, array_unwrap<ItemType>::SAVE_COUNT);
}
@@ -172,17 +171,15 @@ public:
void save_item(device_t *device, const char *module, const char *tag, int index, ItemType &value, ElementType StructType::*element, const char *valname)
{
static_assert(std::is_base_of<StructType, typename array_unwrap<ItemType>::underlying_type>::value, "Called save_item on a non-matching struct member pointer!");
- static_assert(!(sizeof(typename array_unwrap<ItemType>::underlying_type) % sizeof(typename array_unwrap<ElementType>::underlying_type)), "Called save_item on an unaligned struct member!");
- static_assert(!type_checker<ElementType>::is_pointer, "Called save_item on a struct member pointer!");
- static_assert(type_checker<typename array_unwrap<ElementType>::underlying_type>::is_atom, "Called save_item on a non-fundamental type!");
- save_memory(device, module, tag, index, valname, array_unwrap<ElementType>::ptr(array_unwrap<ItemType>::ptr(value)->*element), array_unwrap<ElementType>::SIZE, array_unwrap<ElementType>::SAVE_COUNT, array_unwrap<ItemType>::SAVE_COUNT, sizeof(typename array_unwrap<ItemType>::underlying_type) / sizeof(typename array_unwrap<ElementType>::underlying_type));
+ static_assert(!std::is_pointer<ElementType>::value, "Called save_item on a struct member pointer!");
+ static_assert(is_atom<typename array_unwrap<ElementType>::underlying_type>::value, "Called save_item on a non-fundamental type!");
+ save_memory(device, module, tag, index, valname, array_unwrap<ElementType>::ptr(array_unwrap<ItemType>::ptr(value)->*element), array_unwrap<ElementType>::SIZE, array_unwrap<ElementType>::SAVE_COUNT, array_unwrap<ItemType>::SAVE_COUNT, sizeof(typename array_unwrap<ItemType>::underlying_type));
}
// templatized wrapper for pointers
template <typename ItemType>
- void save_pointer(device_t *device, const char *module, const char *tag, int index, ItemType *value, const char *valname, u32 count)
+ std::enable_if_t<is_atom<typename array_unwrap<ItemType>::underlying_type>::value> save_pointer(device_t *device, const char *module, const char *tag, int index, ItemType *value, const char *valname, u32 count)
{
- static_assert(type_checker<typename array_unwrap<ItemType>::underlying_type>::is_atom, "Called save_pointer on a non-fundamental type!");
save_memory(device, module, tag, index, valname, array_unwrap<ItemType>::ptr(value[0]), array_unwrap<ItemType>::SIZE, array_unwrap<ItemType>::SAVE_COUNT * count);
}
@@ -190,17 +187,15 @@ public:
void save_pointer(device_t *device, const char *module, const char *tag, int index, ItemType *value, ElementType StructType::*element, const char *valname, u32 count)
{
static_assert(std::is_base_of<StructType, typename array_unwrap<ItemType>::underlying_type>::value, "Called save_pointer on a non-matching struct member pointer!");
- static_assert(!(sizeof(typename array_unwrap<ItemType>::underlying_type) % sizeof(typename array_unwrap<ElementType>::underlying_type)), "Called save_pointer on an unaligned struct member!");
- static_assert(!type_checker<ElementType>::is_pointer, "Called save_pointer on a struct member pointer!");
- static_assert(type_checker<typename array_unwrap<ElementType>::underlying_type>::is_atom, "Called save_pointer on a non-fundamental type!");
- save_memory(device, module, tag, index, valname, array_unwrap<ElementType>::ptr(array_unwrap<ItemType>::ptr(value[0])->*element), array_unwrap<ElementType>::SIZE, array_unwrap<ElementType>::SAVE_COUNT, array_unwrap<ItemType>::SAVE_COUNT * count, sizeof(typename array_unwrap<ItemType>::underlying_type) / sizeof(typename array_unwrap<ElementType>::underlying_type));
+ static_assert(!std::is_pointer<ElementType>::value, "Called save_pointer on a struct member pointer!");
+ static_assert(is_atom<typename array_unwrap<ElementType>::underlying_type>::value, "Called save_pointer on a non-fundamental type!");
+ save_memory(device, module, tag, index, valname, array_unwrap<ElementType>::ptr(array_unwrap<ItemType>::ptr(value[0])->*element), array_unwrap<ElementType>::SIZE, array_unwrap<ElementType>::SAVE_COUNT, array_unwrap<ItemType>::SAVE_COUNT * count, sizeof(typename array_unwrap<ItemType>::underlying_type));
}
// templatized wrapper for std::unique_ptr
template <typename ItemType>
- void save_pointer(device_t *device, const char *module, const char *tag, int index, const std::unique_ptr<ItemType []> &value, const char *valname, u32 count)
+ std::enable_if_t<is_atom<typename array_unwrap<ItemType>::underlying_type>::value> save_pointer(device_t *device, const char *module, const char *tag, int index, const std::unique_ptr<ItemType []> &value, const char *valname, u32 count)
{
- static_assert(type_checker<typename array_unwrap<ItemType>::underlying_type>::is_atom, "Called save_pointer on a non-fundamental type!");
save_memory(device, module, tag, index, valname, array_unwrap<ItemType>::ptr(value[0]), array_unwrap<ItemType>::SIZE, array_unwrap<ItemType>::SAVE_COUNT * count);
}
@@ -208,10 +203,68 @@ public:
void save_pointer(device_t *device, const char *module, const char *tag, int index, const std::unique_ptr<ItemType []> &value, ElementType StructType::*element, const char *valname, u32 count)
{
static_assert(std::is_base_of<StructType, typename array_unwrap<ItemType>::underlying_type>::value, "Called save_pointer on a non-matching struct member pointer!");
- static_assert(!(sizeof(typename array_unwrap<ItemType>::underlying_type) % sizeof(typename array_unwrap<ElementType>::underlying_type)), "Called save_pointer on an unaligned struct member!");
- static_assert(!type_checker<ElementType>::is_pointer, "Called save_pointer on a struct member pointer!");
- static_assert(type_checker<typename array_unwrap<ElementType>::underlying_type>::is_atom, "Called save_pointer on a non-fundamental type!");
- save_memory(device, module, tag, index, valname, array_unwrap<ElementType>::ptr(array_unwrap<ItemType>::ptr(value[0])->*element), array_unwrap<ElementType>::SIZE, array_unwrap<ElementType>::SAVE_COUNT, array_unwrap<ItemType>::SAVE_COUNT * count, sizeof(typename array_unwrap<ItemType>::underlying_type) / sizeof(typename array_unwrap<ElementType>::underlying_type));
+ static_assert(!std::is_pointer<ElementType>::value, "Called save_pointer on a struct member pointer!");
+ static_assert(is_atom<typename array_unwrap<ElementType>::underlying_type>::value, "Called save_pointer on a non-fundamental type!");
+ save_memory(device, module, tag, index, valname, array_unwrap<ElementType>::ptr(array_unwrap<ItemType>::ptr(value[0])->*element), array_unwrap<ElementType>::SIZE, array_unwrap<ElementType>::SAVE_COUNT, array_unwrap<ItemType>::SAVE_COUNT * count, sizeof(typename array_unwrap<ItemType>::underlying_type));
+ }
+
+ // templatized wrapper for std::vector
+ template <typename ItemType>
+ std::enable_if_t<is_vector_safe<typename array_unwrap<ItemType>::underlying_type>::value> save_item(device_t *device, const char *module, const char *tag, int index, std::vector<ItemType> &value, const char *valname)
+ {
+ save_pointer(device, module, tag, index, &value[0], valname, value.size());
+ }
+
+ // specializations for bitmaps
+ void save_item(device_t *device, const char *module, const char *tag, int index, bitmap_ind8 &value, const char *valname)
+ {
+ save_memory(device, module, tag, index, valname, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height());
+ }
+
+ void save_item(device_t *device, const char *module, const char *tag, int index, bitmap_ind16 &value, const char *valname)
+ {
+ save_memory(device, module, tag, index, valname, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height());
+ }
+
+ void save_item(device_t *device, const char *module, const char *tag, int index, bitmap_ind32 &value, const char *valname)
+ {
+ save_memory(device, module, tag, index, valname, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height());
+ }
+
+ void save_item(device_t *device, const char *module, const char *tag, int index, bitmap_rgb32 &value, const char *valname)
+ {
+ save_memory(device, module, tag, index, valname, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height());
+ }
+
+ // specializations for attotimes
+ template <typename ItemType>
+ std::enable_if_t<std::is_same<typename save_manager::array_unwrap<ItemType>::underlying_type, attotime>::value> save_item(device_t *device, const char *module, const char *tag, int index, ItemType &value, const char *valname)
+ {
+ std::string tempstr;
+ tempstr.assign(valname).append(".attoseconds");
+ save_item(device, module, tag, index, value, &attotime::m_attoseconds, tempstr.c_str());
+ tempstr.assign(valname).append(".seconds");
+ save_item(device, module, tag, index, value, &attotime::m_seconds, tempstr.c_str());
+ }
+
+ template <typename ItemType>
+ std::enable_if_t<std::is_same<typename save_manager::array_unwrap<ItemType>::underlying_type, attotime>::value> save_pointer(device_t *device, const char *module, const char *tag, int index, ItemType *value, const char *valname, u32 count)
+ {
+ std::string tempstr;
+ tempstr.assign(valname).append(".attoseconds");
+ save_item(device, module, tag, index, value, &attotime::m_attoseconds, tempstr.c_str(), count);
+ tempstr.assign(valname).append(".seconds");
+ save_item(device, module, tag, index, value, &attotime::m_seconds, tempstr.c_str(), count);
+ }
+
+ template <typename ItemType>
+ std::enable_if_t<std::is_same<typename save_manager::array_unwrap<ItemType>::underlying_type, attotime>::value> save_pointer(device_t *device, const char *module, const char *tag, int index, const std::unique_ptr<ItemType []> &value, const char *valname, u32 count)
+ {
+ std::string tempstr;
+ tempstr.assign(valname).append(".attoseconds");
+ save_item(device, module, tag, index, value, &attotime::m_attoseconds, tempstr.c_str(), count);
+ tempstr.assign(valname).append(".seconds");
+ save_item(device, module, tag, index, value, &attotime::m_seconds, tempstr.c_str(), count);
}
// global memory registration
@@ -325,70 +378,22 @@ public:
// template specializations to enumerate the fundamental atomic types you are allowed to save
-ALLOW_SAVE_TYPE_AND_ARRAY(char)
-ALLOW_SAVE_TYPE (bool); // std::vector<bool> may be packed internally
-ALLOW_SAVE_TYPE_AND_ARRAY(osd::s8)
-ALLOW_SAVE_TYPE_AND_ARRAY(osd::u8)
-ALLOW_SAVE_TYPE_AND_ARRAY(osd::s16)
-ALLOW_SAVE_TYPE_AND_ARRAY(osd::u16)
-ALLOW_SAVE_TYPE_AND_ARRAY(osd::s32)
-ALLOW_SAVE_TYPE_AND_ARRAY(osd::u32)
-ALLOW_SAVE_TYPE_AND_ARRAY(osd::s64)
-ALLOW_SAVE_TYPE_AND_ARRAY(osd::u64)
-ALLOW_SAVE_TYPE_AND_ARRAY(PAIR)
-ALLOW_SAVE_TYPE_AND_ARRAY(PAIR64)
-ALLOW_SAVE_TYPE_AND_ARRAY(float)
-ALLOW_SAVE_TYPE_AND_ARRAY(double)
-ALLOW_SAVE_TYPE_AND_ARRAY(endianness_t)
-ALLOW_SAVE_TYPE_AND_ARRAY(rgb_t)
-
-
-
-//**************************************************************************
-// INLINE FUNCTIONS
-//**************************************************************************
-
-//-------------------------------------------------
-// save_item - specialized save_item for bitmaps
-//-------------------------------------------------
-
-template <>
-inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, bitmap_ind8 &value, const char *name)
-{
- save_memory(device, module, tag, index, name, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height());
-}
-
-template <>
-inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, bitmap_ind16 &value, const char *name)
-{
- save_memory(device, module, tag, index, name, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height());
-}
-
-template <>
-inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, bitmap_ind32 &value, const char *name)
-{
- save_memory(device, module, tag, index, name, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height());
-}
-
-template <>
-inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, bitmap_rgb32 &value, const char *name)
-{
- save_memory(device, module, tag, index, name, &value.pix(0), value.bpp() / 8, value.rowpixels() * value.height());
-}
-
-
-//-------------------------------------------------
-// save_item - specialized save_item for attotimes
-//-------------------------------------------------
-
-template <>
-inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, attotime &value, const char *name)
-{
- std::string tempstr = std::string(name).append(".attoseconds");
- save_memory(device, module, tag, index, tempstr.c_str(), &value.m_attoseconds, sizeof(value.m_attoseconds));
- tempstr.assign(name).append(".seconds");
- save_memory(device, module, tag, index, tempstr.c_str(), &value.m_seconds, sizeof(value.m_seconds));
-}
+ALLOW_SAVE_TYPE_AND_VECTOR(char)
+ALLOW_SAVE_TYPE (bool) // std::vector<bool> may be packed internally
+ALLOW_SAVE_TYPE_AND_VECTOR(osd::s8)
+ALLOW_SAVE_TYPE_AND_VECTOR(osd::u8)
+ALLOW_SAVE_TYPE_AND_VECTOR(osd::s16)
+ALLOW_SAVE_TYPE_AND_VECTOR(osd::u16)
+ALLOW_SAVE_TYPE_AND_VECTOR(osd::s32)
+ALLOW_SAVE_TYPE_AND_VECTOR(osd::u32)
+ALLOW_SAVE_TYPE_AND_VECTOR(osd::s64)
+ALLOW_SAVE_TYPE_AND_VECTOR(osd::u64)
+ALLOW_SAVE_TYPE_AND_VECTOR(PAIR)
+ALLOW_SAVE_TYPE_AND_VECTOR(PAIR64)
+ALLOW_SAVE_TYPE_AND_VECTOR(float)
+ALLOW_SAVE_TYPE_AND_VECTOR(double)
+ALLOW_SAVE_TYPE_AND_VECTOR(endianness_t)
+ALLOW_SAVE_TYPE_AND_VECTOR(rgb_t)
#endif // MAME_EMU_SAVE_H
diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp
index b59b2304edd..6b54797de36 100644
--- a/src/emu/sound.cpp
+++ b/src/emu/sound.cpp
@@ -25,6 +25,8 @@
#define VPRINTF(x) do { if (VERBOSE) osd_printf_debug x; } while (0)
+#define LOG_OUTPUT_WAV (0)
+
//**************************************************************************
@@ -42,783 +44,1081 @@ const attotime sound_manager::STREAMS_UPDATE_ATTOTIME = attotime::from_hz(STREAM
//**************************************************************************
-// INITIALIZATION
+// STREAM BUFFER
//**************************************************************************
//-------------------------------------------------
-// sound_stream - constructor
-//-------------------------------------------------
-
-sound_stream::sound_stream(device_t &device, int inputs, int outputs, int sample_rate, stream_update_delegate callback)
- : m_device(device),
- m_next(nullptr),
- m_sample_rate(sample_rate),
- m_new_sample_rate(0xffffffff),
- m_attoseconds_per_sample(0),
- m_max_samples_per_update(0),
- m_input(inputs),
- m_input_array(inputs),
- m_resample_bufalloc(0),
- m_output(outputs),
- m_output_array(outputs),
- m_output_bufalloc(0),
- m_output_sampindex(0),
- m_output_update_sampindex(0),
- m_output_base_sampindex(0),
- m_callback(std::move(callback))
+// stream_buffer - constructor
+//-------------------------------------------------
+
+stream_buffer::stream_buffer(u32 sample_rate) :
+ m_end_second(0),
+ m_end_sample(0),
+ m_sample_rate(sample_rate),
+ m_sample_attos((sample_rate == 0) ? ATTOSECONDS_PER_SECOND : ((ATTOSECONDS_PER_SECOND + sample_rate - 1) / sample_rate)),
+ m_buffer(sample_rate)
{
- // get the device's sound interface
- device_sound_interface *sound;
- if (!device.interface(sound))
- throw emu_fatalerror("Attempted to create a sound_stream with a non-sound device");
+}
- if(m_callback.isnull())
- m_callback = stream_update_delegate(&device_sound_interface::sound_stream_update,(device_sound_interface *)sound);
- // create a unique tag for saving
- std::string state_tag = string_format("%d", m_device.machine().sound().m_stream_list.size());
- m_device.machine().save().save_item(&m_device, "stream", state_tag.c_str(), 0, NAME(m_sample_rate));
- m_device.machine().save().register_postload(save_prepost_delegate(FUNC(sound_stream::postload), this));
+//-------------------------------------------------
+// stream_buffer - destructor
+//-------------------------------------------------
- // save the gain of each input and output
- for (unsigned int inputnum = 0; inputnum < m_input.size(); inputnum++)
+stream_buffer::~stream_buffer()
+{
+#if (SOUND_DEBUG)
+ if (m_wav_file != nullptr)
{
- m_device.machine().save().save_item(&m_device, "stream", state_tag.c_str(), inputnum, NAME(m_input[inputnum].m_gain));
- m_device.machine().save().save_item(&m_device, "stream", state_tag.c_str(), inputnum, NAME(m_input[inputnum].m_user_gain));
+ flush_wav();
+ close_wav();
}
- for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++)
+#endif
+}
+
+
+//-------------------------------------------------
+// set_sample_rate - set a new sample rate for
+// this buffer
+//-------------------------------------------------
+
+void stream_buffer::set_sample_rate(u32 rate, bool resample)
+{
+ // skip if nothing is actually changing
+ if (rate == m_sample_rate)
+ return;
+
+ // force resampling off if coming to or from an invalid rate
+ sound_assert(rate >= SAMPLE_RATE_MINIMUM - 1);
+ if (rate < SAMPLE_RATE_MINIMUM || m_sample_rate < SAMPLE_RATE_MINIMUM)
+ resample = false;
+
+ // note the time and period of the current buffer (end_time is AFTER the final sample)
+ attotime prevperiod = sample_period();
+ attotime prevend = end_time();
+
+ // compute the time and period of the new buffer
+ attotime newperiod = attotime(0, (ATTOSECONDS_PER_SECOND + rate - 1) / rate);
+ attotime newend = attotime(prevend.seconds(), (prevend.attoseconds() / newperiod.attoseconds()) * newperiod.attoseconds());
+
+ // buffer a short runway of previous samples; in order to support smooth
+ // sample rate changes (needed by, e.g., Q*Bert's Votrax), we buffer a few
+ // samples at the previous rate, and then reconstitute them resampled
+ // (via simple point sampling) at the new rate. The litmus test is the
+ // voice when jumping off the edge in Q*Bert; without this extra effort
+ // it is crackly and/or glitchy at times
+ sample_t buffer[64];
+ int buffered_samples = std::min(m_sample_rate, std::min(rate, u32(ARRAY_LENGTH(buffer))));
+
+ // if the new rate is lower, downsample into our holding buffer;
+ // otherwise just copy into our holding buffer for later upsampling
+ bool new_rate_higher = (rate > m_sample_rate);
+ if (resample)
{
- m_output[outputnum].m_stream = this;
- m_device.machine().save().save_item(&m_device, "stream", state_tag.c_str(), outputnum, NAME(m_output[outputnum].m_gain));
+ if (!new_rate_higher)
+ backfill_downsample(&buffer[0], buffered_samples, newend, newperiod);
+ else
+ {
+ u32 end = m_end_sample;
+ for (int index = 0; index < buffered_samples; index++)
+ {
+ end = prev_index(end);
+ buffer[index] = get(end);
+ }
+ }
}
- // Mark synchronous streams as such
- m_synchronous = m_sample_rate == STREAM_SYNC;
- if (m_synchronous)
+ // ensure our buffer is large enough to hold a full second at the new rate
+ if (m_buffer.size() < rate)
+ m_buffer.resize(rate);
+
+ // set the new rate
+ m_sample_rate = rate;
+ m_sample_attos = newperiod.attoseconds();
+
+ // compute the new end sample index based on the buffer time
+ m_end_sample = time_to_buffer_index(prevend, false, true);
+
+ // if the new rate is higher, upsample from our temporary buffer;
+ // otherwise just copy our previously-downsampled data
+ if (resample)
{
- m_sample_rate = 0;
- m_sync_timer = m_device.machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sound_stream::sync_update), this));
- }
- else
- m_sync_timer = nullptr;
+#if (SOUND_DEBUG)
+ // for aggressive debugging, fill the buffer with NANs to catch anyone
+ // reading beyond what we resample below
+ fill(NAN);
+#endif
- // force an update to the sample rates; this will cause everything to be recomputed
- // and will generate the initial resample buffers for our inputs
- recompute_sample_rate_data();
+ if (new_rate_higher)
+ backfill_upsample(&buffer[0], buffered_samples, prevend, prevperiod);
+ else
+ {
+ u32 end = m_end_sample;
+ for (int index = 0; index < buffered_samples; index++)
+ {
+ end = prev_index(end);
+ put(end, buffer[index]);
+ }
+ }
+ }
- // set up the initial output buffer positions now that we have data
- m_output_base_sampindex = -m_max_samples_per_update;
+ // if not resampling, clear the buffer
+ else
+ fill(0);
}
//-------------------------------------------------
-// sample_time - return the emulation time of the
-// next sample to be generated on the stream
+// open_wav - open a WAV file for logging purposes
//-------------------------------------------------
-attotime sound_stream::sample_time() const
+#if (SOUND_DEBUG)
+void stream_buffer::open_wav(char const *filename)
{
- return attotime(m_device.machine().sound().last_update().seconds(), 0) + attotime(0, m_output_sampindex * m_attoseconds_per_sample);
+ // always open at 48k so that sound programs can handle it
+ // re-sample as needed
+ m_wav_file = wav_open(filename, 48000, 1);
}
+#endif
//-------------------------------------------------
-// user_gain - return the user-controllable gain
-// on a given stream's input
+// flush_wav - flush data to the WAV file
//-------------------------------------------------
-float sound_stream::user_gain(int inputnum) const
+#if (SOUND_DEBUG)
+void stream_buffer::flush_wav()
{
- assert(inputnum >= 0 && inputnum < m_input.size());
- return float(m_input[inputnum].m_user_gain) / 256.0f;
+ // skip if no file
+ if (m_wav_file == nullptr)
+ return;
+
+ // grab a view of the data from the last-written point
+ read_stream_view view(this, m_last_written, m_end_sample, 1.0f);
+ m_last_written = m_end_sample;
+
+ // iterate over chunks for conversion
+ s16 buffer[1024];
+ for (int samplebase = 0; samplebase < view.samples(); samplebase += ARRAY_LENGTH(buffer))
+ {
+ // clamp to the buffer size
+ int cursamples = view.samples() - samplebase;
+ if (cursamples > ARRAY_LENGTH(buffer))
+ cursamples = ARRAY_LENGTH(buffer);
+
+ // convert and fill
+ for (int sampindex = 0; sampindex < cursamples; sampindex++)
+ buffer[sampindex] = s16(view.get(samplebase + sampindex) * 32768.0);
+
+ // write to the WAV
+ wav_add_data_16(m_wav_file, buffer, cursamples);
+ }
}
+#endif
//-------------------------------------------------
-// input_gain - return the input gain on a
-// given stream's input
+// close_wav - close the logging WAV file
//-------------------------------------------------
-float sound_stream::input_gain(int inputnum) const
+#if (SOUND_DEBUG)
+void stream_buffer::close_wav()
{
- assert(inputnum >= 0 && inputnum < m_input.size());
- return float(m_input[inputnum].m_gain) / 256.0f;
+ if (m_wav_file != nullptr)
+ wav_close(m_wav_file);
+ m_wav_file = nullptr;
}
+#endif
//-------------------------------------------------
-// output_gain - return the output gain on a
-// given stream's output
+// index_time - return the attotime of a given
+// index within the buffer
//-------------------------------------------------
-float sound_stream::output_gain(int outputnum) const
+attotime stream_buffer::index_time(s32 index) const
{
- assert(outputnum >= 0 && outputnum < m_output.size());
- return float(m_output[outputnum].m_gain) / 256.0f;
+ index = clamp_index(index);
+ return attotime(m_end_second - ((index > m_end_sample) ? 1 : 0), index * m_sample_attos);
}
//-------------------------------------------------
-// input_name - return the original input gain
-// on a given stream's input
+// time_to_buffer_index - given an attotime,
+// return the buffer index corresponding to it
//-------------------------------------------------
-std::string sound_stream::input_name(int inputnum) const
+u32 stream_buffer::time_to_buffer_index(attotime time, bool round_up, bool allow_expansion)
{
- std::ostringstream str;
-
- // start with our device name and tag
- assert(inputnum >= 0 && inputnum < m_input.size());
- util::stream_format(str, "%s '%s': ", m_device.name(), m_device.tag());
+ // compute the sample index within the second
+ int sample = (time.attoseconds() + (round_up ? (m_sample_attos - 1) : 0)) / m_sample_attos;
+ sound_assert(sample >= 0 && sample <= size());
- // if we have a source, indicate where the sound comes from by device name and tag
- if (m_input[inputnum].m_source != nullptr && m_input[inputnum].m_source->m_stream != nullptr)
+ // if the time is past the current end, make it the end
+ if (time.seconds() > m_end_second || (time.seconds() == m_end_second && sample > m_end_sample))
{
- device_t &source = m_input[inputnum].m_source->m_stream->device();
- util::stream_format(str, "%s '%s'", source.name(), source.tag());
+ sound_assert(allow_expansion);
+
+ m_end_sample = sample;
+ m_end_second = time.m_seconds;
- // get the sound interface; if there is more than 1 output we need to figure out which one
- device_sound_interface *sound;
- if (source.interface(sound) && sound->outputs() > 1)
+ // due to round_up, we could tweak over the line into the next second
+ if (sample >= size())
{
- // iterate over outputs until we find the stream that matches our source
- // then look for a match on the output number
- sound_stream *outstream;
- int streamoutputnum;
- for (int outputnum = 0; (outstream = sound->output_to_stream_output(outputnum, streamoutputnum)) != nullptr; outputnum++)
- if (outstream == m_input[inputnum].m_source->m_stream && m_input[inputnum].m_source == &outstream->m_output[streamoutputnum])
- {
- util::stream_format(str, " Ch.%d", outputnum);
- break;
- }
+ m_end_sample -= size();
+ m_end_second++;
}
}
- return str.str();
+
+ // if the time is before the start, fail
+ if (time.seconds() + 1 < m_end_second || (time.seconds() + 1 == m_end_second && sample < m_end_sample))
+ throw emu_fatalerror("Attempt to create an out-of-bounds view");
+
+ return clamp_index(sample);
}
//-------------------------------------------------
-// input_source_device - return the device
-// attached as a given input's source
+// backfill_downsample - this is called BEFORE
+// the sample rate change to downsample from the
+// end of the current buffer into a temporary
+// holding location
//-------------------------------------------------
-device_t *sound_stream::input_source_device(int inputnum) const
+void stream_buffer::backfill_downsample(sample_t *dest, int samples, attotime newend, attotime newperiod)
{
- assert(inputnum >= 0 && inputnum < m_input.size());
- return (m_input[inputnum].m_source != nullptr) ? &m_input[inputnum].m_source->m_stream->device() : nullptr;
+ // compute the time of the first sample to be backfilled; start one period before
+ attotime time = newend - newperiod;
+
+ // loop until we run out of buffered data
+ int dstindex;
+ for (dstindex = 0; dstindex < samples && time.seconds() >= 0; dstindex++)
+ {
+ u32 srcindex = time_to_buffer_index(time, false);
+#if (SOUND_DEBUG)
+ // multiple resamples can occur before clearing out old NaNs so
+ // neuter them for this specific case
+ if (std::isnan(m_buffer[srcindex]))
+ dest[dstindex] = 0;
+ else
+#endif
+ dest[dstindex] = get(srcindex);
+ time -= newperiod;
+ }
+ for ( ; dstindex < samples; dstindex++)
+ dest[dstindex] = 0;
}
//-------------------------------------------------
-// input_source_device - return the output number
-// attached as a given input's source
+// backfill_upsample - this is called AFTER the
+// sample rate change to take a copied buffer
+// of samples at the old rate and upsample them
+// to the new (current) rate
//-------------------------------------------------
-int sound_stream::input_source_outputnum(int inputnum) const
+void stream_buffer::backfill_upsample(sample_t const *src, int samples, attotime prevend, attotime prevperiod)
{
- assert(inputnum >= 0 && inputnum < m_input.size());
- return (m_input[inputnum].m_source != nullptr) ? (m_input[inputnum].m_source - &m_input[inputnum].m_source->m_stream->m_output[0]) : -1;
+ // compute the time of the first sample to be backfilled; start one period before
+ attotime time = end_time() - sample_period();
+
+ // also adjust the buffered sample end time to point to the sample time of the
+ // final sample captured
+ prevend -= prevperiod;
+
+ // loop until we run out of buffered data
+ u32 end = m_end_sample;
+ int srcindex = 0;
+ while (1)
+ {
+ // if our backfill time is before the current buffered sample time,
+ // back up until we have a sample that covers this time
+ while (time < prevend && srcindex < samples)
+ {
+ prevend -= prevperiod;
+ srcindex++;
+ }
+
+ // stop when we run out of source
+ if (srcindex >= samples)
+ break;
+
+ // write this sample at the pevious position
+ end = prev_index(end);
+ put(end, src[srcindex]);
+
+ // back up to the next sample time
+ time -= sample_period();
+ }
}
+
+//**************************************************************************
+// SOUND STREAM OUTPUT
+//**************************************************************************
+
//-------------------------------------------------
-// set_input - configure a stream's input
+// sound_stream_output - constructor
//-------------------------------------------------
-void sound_stream::set_input(int index, sound_stream *input_stream, int output_index, float gain)
+sound_stream_output::sound_stream_output() :
+ m_stream(nullptr),
+ m_index(0),
+ m_gain(1.0)
{
- VPRINTF(("stream_set_input(%p, '%s', %d, %p, %d, %f)\n", (void *)this, m_device.tag(),
- index, (void *)input_stream, output_index, (double) gain));
+}
- // make sure it's a valid input
- if (index >= m_input.size())
- fatalerror("stream_set_input attempted to configure nonexistent input %d (%d max)\n", index, int(m_input.size()));
- // make sure it's a valid output
- if (input_stream != nullptr && output_index >= input_stream->m_output.size())
- fatalerror("stream_set_input attempted to use a nonexistent output %d (%d max)\n", output_index, int(m_output.size()));
+//-------------------------------------------------
+// init - initialization
+//-------------------------------------------------
- // if this input is already wired, update the dependent info
- stream_input &input = m_input[index];
- if (input.m_source != nullptr)
- input.m_source->m_dependents--;
+void sound_stream_output::init(sound_stream &stream, u32 index, char const *tag)
+{
+ // set the passed-in data
+ m_stream = &stream;
+ m_index = index;
+
+ // save our state
+ auto &save = stream.device().machine().save();
+ save.save_item(&stream.device(), "stream.output", tag, index, NAME(m_gain));
+
+#if (LOG_OUTPUT_WAV)
+ std::string filename = stream.device().machine().basename();
+ filename += stream.device().tag();
+ for (int index = 0; index < filename.size(); index++)
+ if (filename[index] == ':')
+ filename[index] = '_';
+ if (dynamic_cast<default_resampler_stream *>(&stream) != nullptr)
+ filename += "_resampler";
+ filename += "_OUT_";
+ char buf[10];
+ sprintf(buf, "%d", index);
+ filename += buf;
+ filename += ".wav";
+ m_buffer.open_wav(filename.c_str());
+#endif
+}
- // wire it up
- input.m_source = (input_stream != nullptr) ? &input_stream->m_output[output_index] : nullptr;
- input.m_gain = int(0x100 * gain);
- input.m_user_gain = 0x100;
- // update the dependent info
- if (input.m_source != nullptr)
- input.m_source->m_dependents++;
+//-------------------------------------------------
+// name - return the friendly name of this output
+//-------------------------------------------------
- // update sample rates now that we know the input
- recompute_sample_rate_data();
+std::string sound_stream_output::name() const
+{
+ // start with our owning stream's name
+ std::ostringstream str;
+ util::stream_format(str, "%s Ch.%d", m_stream->name(), m_stream->output_base() + m_index);
+ return str.str();
}
//-------------------------------------------------
-// update - force a stream to update to
-// the current emulated time
+// optimize_resampler - optimize resamplers by
+// either returning the native rate or another
+// input's resampler if they can be reused
//-------------------------------------------------
-void sound_stream::update()
+sound_stream_output &sound_stream_output::optimize_resampler(sound_stream_output *input_resampler)
{
- if (!m_attoseconds_per_sample)
- return;
+ // if no resampler, or if the resampler rate matches our rate, return ourself
+ if (input_resampler == nullptr || buffer_sample_rate() == input_resampler->buffer_sample_rate())
+ return *this;
+
+ // scan our list of resamplers to see if there's another match
+ for (auto &resampler : m_resampler_list)
+ if (resampler->buffer_sample_rate() == input_resampler->buffer_sample_rate())
+ return *resampler;
+
+ // add the input to our list and return the one we were given back
+ m_resampler_list.push_back(input_resampler);
+ return *input_resampler;
+}
- // determine the number of samples since the start of this second
- attotime time = m_device.machine().time();
- s32 update_sampindex = s32(time.attoseconds() / m_attoseconds_per_sample);
- // if we're ahead of the last update, then adjust upwards
- attotime last_update = m_device.machine().sound().last_update();
- if (time.seconds() > last_update.seconds())
- {
- assert(time.seconds() == last_update.seconds() + 1);
- update_sampindex += m_sample_rate;
- }
-
- // if we're behind the last update, then adjust downwards
- if (time.seconds() < last_update.seconds())
- {
- assert(time.seconds() == last_update.seconds() - 1);
- update_sampindex -= m_sample_rate;
- }
- if (update_sampindex <= m_output_sampindex)
- return;
+//**************************************************************************
+// SOUND STREAM INPUT
+//**************************************************************************
- // generate samples to get us up to the appropriate time
- g_profiler.start(PROFILER_SOUND);
- assert(m_output_sampindex - m_output_base_sampindex >= 0);
- assert(update_sampindex - m_output_base_sampindex <= m_output_bufalloc);
- generate_samples(update_sampindex - m_output_sampindex);
- g_profiler.stop();
+//-------------------------------------------------
+// sound_stream_input - constructor
+//-------------------------------------------------
- // remember this info for next time
- m_output_sampindex = update_sampindex;
+sound_stream_input::sound_stream_input() :
+ m_owner(nullptr),
+ m_native_source(nullptr),
+ m_resampler_source(nullptr),
+ m_index(0),
+ m_gain(1.0),
+ m_user_gain(1.0)
+{
}
-void sound_stream::sync_update(void *, s32)
+//-------------------------------------------------
+// init - initialization
+//-------------------------------------------------
+
+void sound_stream_input::init(sound_stream &stream, u32 index, char const *tag, sound_stream_output *resampler)
{
- update();
- attotime time = m_device.machine().time();
- attoseconds_t next_edge = m_attoseconds_per_sample - (time.attoseconds() % m_attoseconds_per_sample);
- m_sync_timer->adjust(attotime(0, next_edge));
+ // set the passed-in values
+ m_owner = &stream;
+ m_index = index;
+ m_resampler_source = resampler;
+
+ // save our state
+ auto &save = stream.device().machine().save();
+ save.save_item(&stream.device(), "stream.input", tag, index, NAME(m_gain));
+ save.save_item(&stream.device(), "stream.input", tag, index, NAME(m_user_gain));
}
//-------------------------------------------------
-// output_since_last_update - return a pointer to
-// the output buffer and the number of samples
-// since the last global update
+// name - return the friendly name of this input
//-------------------------------------------------
-const stream_sample_t *sound_stream::output_since_last_update(int outputnum, int &numsamples)
+std::string sound_stream_input::name() const
{
- // force an update on the stream
- update();
+ // start with our owning stream's name
+ std::ostringstream str;
+ util::stream_format(str, "%s", m_owner->name());
- // compute the number of samples and a pointer to the output buffer
- numsamples = m_output_sampindex - m_output_update_sampindex;
- return &m_output[outputnum].m_buffer[m_output_update_sampindex - m_output_base_sampindex];
+ // if we have a source, indicate where the sound comes from by device name and tag
+ if (valid())
+ util::stream_format(str, " <- %s", m_native_source->name());
+ return str.str();
}
//-------------------------------------------------
-// set_sample_rate - set the sample rate on a
-// given stream
+// set_source - wire up the output source for
+// our consumption
//-------------------------------------------------
-void sound_stream::set_sample_rate(int new_rate)
+void sound_stream_input::set_source(sound_stream_output *source)
{
- // we will update this on the next global update
- if (new_rate != sample_rate())
- m_new_sample_rate = new_rate;
+ m_native_source = source;
+ if (m_resampler_source != nullptr)
+ m_resampler_source->stream().set_input(0, &source->stream(), source->index());
}
//-------------------------------------------------
-// set_user_gain - set the user-controllable gain
-// on a given stream's input
+// update - update our source's stream to the
+// current end time and return a view to its
+// contents
//-------------------------------------------------
-void sound_stream::set_user_gain(int inputnum, float gain)
+read_stream_view sound_stream_input::update(attotime start, attotime end)
{
- update();
- assert(inputnum >= 0 && inputnum < m_input.size());
- m_input[inputnum].m_user_gain = int(0x100 * gain);
+ // shouldn't get here unless valid
+ sound_assert(valid());
+
+ // pick an optimized resampler
+ sound_stream_output &source = m_native_source->optimize_resampler(m_resampler_source);
+
+ // if not using our own resampler, keep it up to date in case we need to invoke it later
+ if (m_resampler_source != nullptr && &source != m_resampler_source)
+ m_resampler_source->set_end_time(end);
+
+ // update the source, returning a view of the needed output over the start and end times
+ return source.stream().update_view(start, end, source.index()).apply_gain(m_gain * m_user_gain * m_native_source->gain());
}
//-------------------------------------------------
-// set_input_gain - set the input gain on a
-// given stream's input
+// apply_sample_rate_changes - tell our sources
+// to apply any sample rate changes, informing
+// them of our current rate
//-------------------------------------------------
-void sound_stream::set_input_gain(int inputnum, float gain)
+void sound_stream_input::apply_sample_rate_changes(u32 updatenum, u32 downstream_rate)
{
- update();
- assert(inputnum >= 0 && inputnum < m_input.size());
- m_input[inputnum].m_gain = int(0x100 * gain);
+ // shouldn't get here unless valid
+ sound_assert(valid());
+
+ // if we have a resampler, tell it (and it will tell the native source)
+ if (m_resampler_source != nullptr)
+ m_resampler_source->stream().apply_sample_rate_changes(updatenum, downstream_rate);
+
+ // otherwise, just tell the native source directly
+ else
+ m_native_source->stream().apply_sample_rate_changes(updatenum, downstream_rate);
}
+
+//**************************************************************************
+// SOUND STREAM
+//**************************************************************************
+
//-------------------------------------------------
-// set_output_gain - set the output gain on a
-// given stream's output
+// sound_stream - private common constructor
+//-------------------------------------------------
+
+sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, sound_stream_flags flags) :
+ m_device(device),
+ m_next(nullptr),
+ m_sample_rate((sample_rate < SAMPLE_RATE_MINIMUM) ? (SAMPLE_RATE_MINIMUM - 1) : (sample_rate < SAMPLE_RATE_OUTPUT_ADAPTIVE) ? sample_rate : 48000),
+ m_pending_sample_rate(SAMPLE_RATE_INVALID),
+ m_last_sample_rate_update(0),
+ m_input_adaptive(sample_rate == SAMPLE_RATE_INPUT_ADAPTIVE),
+ m_output_adaptive(sample_rate == SAMPLE_RATE_OUTPUT_ADAPTIVE),
+ m_synchronous((flags & STREAM_SYNCHRONOUS) != 0),
+ m_resampling_disabled((flags & STREAM_DISABLE_INPUT_RESAMPLING) != 0),
+ m_sync_timer(nullptr),
+ m_input(inputs),
+ m_input_array(inputs),
+ m_input_view(inputs),
+ m_empty_buffer(100),
+ m_output_base(output_base),
+ m_output(outputs),
+ m_output_array(outputs),
+ m_output_view(outputs)
+{
+ sound_assert(outputs > 0);
+
+ // create a name
+ m_name = m_device.name();
+ m_name += " '";
+ m_name += m_device.tag();
+ m_name += "'";
+
+ // create a unique tag for saving
+ std::string state_tag = string_format("%d", m_device.machine().sound().unique_id());
+ auto &save = m_device.machine().save();
+ save.register_postload(save_prepost_delegate(FUNC(sound_stream::postload), this));
+
+ // initialize all inputs
+ for (unsigned int inputnum = 0; inputnum < m_input.size(); inputnum++)
+ {
+ // allocate a resampler stream if needed, and get a pointer to its output
+ sound_stream_output *resampler = nullptr;
+ if (!m_resampling_disabled)
+ {
+ m_resampler_list.push_back(std::make_unique<default_resampler_stream>(m_device));
+ resampler = &m_resampler_list.back()->m_output[0];
+ }
+
+ // add the new input
+ m_input[inputnum].init(*this, inputnum, state_tag.c_str(), resampler);
+ }
+
+ // initialize all outputs
+ for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++)
+ m_output[outputnum].init(*this, outputnum, state_tag.c_str());
+
+ // create an update timer for synchronous streams
+ if (synchronous())
+ m_sync_timer = m_device.machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sound_stream::sync_update), this));
+
+ // force an update to the sample rates
+ sample_rate_changed();
+}
+
+
+//-------------------------------------------------
+// sound_stream - constructor with old-style
+// callback
//-------------------------------------------------
-void sound_stream::set_output_gain(int outputnum, float gain)
+sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_legacy_delegate callback, sound_stream_flags flags) :
+ sound_stream(device, inputs, outputs, output_base, sample_rate, flags)
{
- update();
- assert(outputnum >= 0 && outputnum < m_output.size());
- m_output[outputnum].m_gain = int(0x100 * gain);
+ m_callback = std::move(callback);
+ m_callback_ex = stream_update_delegate(&sound_stream::stream_update_legacy, this);
}
//-------------------------------------------------
-// update_with_accounting - do a regular update,
-// but also do periodic accounting
+// sound_stream - constructor with new-style
+// callback
//-------------------------------------------------
-void sound_stream::update_with_accounting(bool second_tick)
+sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags) :
+ sound_stream(device, inputs, outputs, output_base, sample_rate, flags)
{
- // do the normal update
- update();
+ m_callback_ex = std::move(callback);
+}
- // if we've ticked over another second, adjust all the counters that are relative to
- // the current second
- s32 output_bufindex = m_output_sampindex - m_output_base_sampindex;
- if (second_tick)
- {
- m_output_sampindex -= m_sample_rate;
- m_output_base_sampindex -= m_sample_rate;
- }
- // note our current output sample
- m_output_update_sampindex = m_output_sampindex;
+//-------------------------------------------------
+// ~sound_stream - destructor
+//-------------------------------------------------
+
+sound_stream::~sound_stream()
+{
+}
- // if we don't have enough output buffer space to hold two updates' worth of samples,
- // we need to shuffle things down
- if (m_output_bufalloc - output_bufindex < 2 * m_max_samples_per_update)
- {
- s32 samples_to_lose = output_bufindex - m_max_samples_per_update;
- if (samples_to_lose > 0)
- {
- // if we have samples to move, do so for each output
- if (output_bufindex > 0)
- for (auto &output : m_output)
- {
- memmove(&output.m_buffer[0], &output.m_buffer[samples_to_lose], sizeof(output.m_buffer[0]) * (output_bufindex - samples_to_lose));
- }
- // update the base position
- m_output_base_sampindex += samples_to_lose;
- }
- }
+//-------------------------------------------------
+// set_sample_rate - set the sample rate on a
+// given stream
+//-------------------------------------------------
+
+void sound_stream::set_sample_rate(u32 new_rate)
+{
+ // we will update this on the next global update
+ if (new_rate != sample_rate())
+ m_pending_sample_rate = new_rate;
}
//-------------------------------------------------
-// apply_sample_rate_changes - if there is a
-// pending sample rate change, apply it now
+// set_input - configure a stream's input
//-------------------------------------------------
-void sound_stream::apply_sample_rate_changes()
+void sound_stream::set_input(int index, sound_stream *input_stream, int output_index, float gain)
{
- // skip if nothing to do
- if (m_new_sample_rate == 0xffffffff)
- return;
+ VPRINTF(("stream_set_input(%p, '%s', %d, %p, %d, %f)\n", (void *)this, m_device.tag(),
+ index, (void *)input_stream, output_index, (double) gain));
- // update to the new rate and remember the old rate
- u32 old_rate = m_sample_rate;
- m_sample_rate = m_new_sample_rate;
- m_new_sample_rate = 0xffffffff;
+ // make sure it's a valid input
+ if (index >= m_input.size())
+ fatalerror("stream_set_input attempted to configure nonexistent input %d (%d max)\n", index, int(m_input.size()));
- // recompute all the data
- recompute_sample_rate_data();
+ // make sure it's a valid output
+ if (input_stream != nullptr && output_index >= input_stream->m_output.size())
+ fatalerror("stream_set_input attempted to use a nonexistent output %d (%d max)\n", output_index, int(m_output.size()));
- // reset our sample indexes to the current time
- if (old_rate)
- {
- m_output_sampindex = s64(m_output_sampindex) * s64(m_sample_rate) / old_rate;
- m_output_update_sampindex = s64(m_output_update_sampindex) * s64(m_sample_rate) / old_rate;
- }
- else
- {
- m_output_sampindex = m_attoseconds_per_sample ? m_device.machine().sound().last_update().attoseconds() / m_attoseconds_per_sample : 0;
- m_output_update_sampindex = m_output_sampindex;
- }
+ // wire it up
+ m_input[index].set_source((input_stream != nullptr) ? &input_stream->m_output[output_index] : nullptr);
+ m_input[index].set_gain(gain);
+
+ // update sample rates now that we know the input
+ sample_rate_changed();
+}
- m_output_base_sampindex = m_output_sampindex - m_max_samples_per_update;
- // clear out the buffer
- if (m_max_samples_per_update)
- for (auto &elem : m_output)
- std::fill_n(&elem.m_buffer[0], m_max_samples_per_update, 0);
+//-------------------------------------------------
+// update - force a stream to update to
+// the current emulated time
+//-------------------------------------------------
+
+void sound_stream::update()
+{
+ // ignore any update requests if we're already up to date
+ attotime start = m_output[0].end_time();
+ attotime end = m_device.machine().time();
+ if (start >= end)
+ return;
+
+ // regular update then
+ update_view(start, end);
}
//-------------------------------------------------
-// recompute_sample_rate_data - recompute sample
-// rate data, and all streams that are affected
-// by this stream
+// update_view - force a stream to update to
+// the current emulated time and return a view
+// to the generated samples from the given
+// output number
//-------------------------------------------------
-void sound_stream::recompute_sample_rate_data()
+read_stream_view sound_stream::update_view(attotime start, attotime end, u32 outputnum)
{
- if (m_synchronous)
+ sound_assert(start <= end);
+ sound_assert(outputnum < m_output.size());
+
+ // clean up parameters for when the asserts go away
+ if (outputnum >= m_output.size())
+ outputnum = 0;
+ if (start > end)
+ start = end;
+
+ g_profiler.start(PROFILER_SOUND);
+
+ // reposition our start to coincide with the current buffer end
+ attotime update_start = m_output[outputnum].end_time();
+ if (update_start <= end)
{
- m_sample_rate = 0;
- // When synchronous, pick the sample rate for the inputs, if any
- for (auto &input : m_input)
+ // create views for all the outputs
+ for (unsigned int outindex = 0; outindex < m_output.size(); outindex++)
+ m_output_view[outindex] = m_output[outindex].view(update_start, end);
+
+ // skip if nothing to do
+ u32 samples = m_output_view[0].samples();
+ sound_assert(samples >= 0);
+ if (samples != 0 && m_sample_rate >= SAMPLE_RATE_MINIMUM)
{
- if (input.m_source != nullptr)
+ sound_assert(!synchronous() || samples == 1);
+
+ // ensure all input streams are up to date, and create views for them as well
+ for (unsigned int inputnum = 0; inputnum < m_input.size(); inputnum++)
{
- if (!m_sample_rate)
- m_sample_rate = input.m_source->m_stream->m_sample_rate;
- else if (m_sample_rate != input.m_source->m_stream->m_sample_rate)
- throw emu_fatalerror("Incompatible sample rates as input of a synchronous stream: %d and %d\n", m_sample_rate, input.m_source->m_stream->m_sample_rate);
+ if (m_input[inputnum].valid())
+ m_input_view[inputnum] = m_input[inputnum].update(update_start, end);
+ else
+ m_input_view[inputnum] = empty_view(update_start, end);
+ sound_assert(m_resampling_disabled || m_input_view[inputnum].sample_rate() == m_sample_rate);
}
+
+#if (SOUND_DEBUG)
+ // clear each output view to NANs before we call the callback
+ for (unsigned int outindex = 0; outindex < m_output.size(); outindex++)
+ m_output_view[outindex].fill(NAN);
+#endif
+
+ // if we have an extended callback, that's all we need
+ m_callback_ex(*this, m_input_view, m_output_view);
+
+#if (SOUND_DEBUG)
+ // make sure everything was overwritten
+ for (unsigned int outindex = 0; outindex < m_output.size(); outindex++)
+ for (int sampindex = 0; sampindex < m_output_view[outindex].samples(); sampindex++)
+ m_output_view[outindex].get(sampindex);
+
+ for (unsigned int outindex = 0; outindex < m_output.size(); outindex++)
+ m_output[outindex].m_buffer.flush_wav();
+#endif
}
}
+ g_profiler.stop();
+
+ // return the requested view
+ return read_stream_view(m_output_view[outputnum], start);
+}
- // recompute the timing parameters
- attoseconds_t update_attoseconds = m_device.machine().sound().update_attoseconds();
+//-------------------------------------------------
+// apply_sample_rate_changes - if there is a
+// pending sample rate change, apply it now
+//-------------------------------------------------
- if (m_sample_rate)
+void sound_stream::apply_sample_rate_changes(u32 updatenum, u32 downstream_rate)
+{
+ // grab the new rate and invalidate
+ u32 new_rate = (m_pending_sample_rate != SAMPLE_RATE_INVALID) ? m_pending_sample_rate : m_sample_rate;
+ m_pending_sample_rate = SAMPLE_RATE_INVALID;
+
+ // clamp to the minimum - 1 (anything below minimum means "off" and
+ // will not call the sound callback at all)
+ if (new_rate < SAMPLE_RATE_MINIMUM)
+ new_rate = SAMPLE_RATE_MINIMUM - 1;
+
+ // if we're input adaptive, override with the rate of our input
+ if (input_adaptive() && m_input.size() > 0 && m_input[0].valid())
+ new_rate = m_input[0].source().stream().sample_rate();
+
+ // if we're output adaptive, override with the rate of our output
+ if (output_adaptive())
{
- m_attoseconds_per_sample = ATTOSECONDS_PER_SECOND / m_sample_rate;
- m_max_samples_per_update = (update_attoseconds + m_attoseconds_per_sample - 1) / m_attoseconds_per_sample;
+ if (m_last_sample_rate_update == updatenum)
+ sound_assert(new_rate == m_sample_rate);
+ else
+ m_last_sample_rate_update = updatenum;
+ new_rate = downstream_rate;
}
- else
+
+ // if something is different, process the change
+ if (new_rate != SAMPLE_RATE_INVALID && new_rate != m_sample_rate)
{
- m_attoseconds_per_sample = 0;
- m_max_samples_per_update = 0;
+ // update to the new rate and notify everyone
+#if (SOUND_DEBUG)
+ printf("stream %s changing rates %d -> %d\n", name().c_str(), m_sample_rate, new_rate);
+#endif
+ m_sample_rate = new_rate;
+ sample_rate_changed();
}
- // update resample and output buffer sizes
- allocate_resample_buffers();
- allocate_output_buffers();
-
- // iterate over each input
+ // now call through our inputs and apply the rate change there
for (auto &input : m_input)
- {
- // if we have a source, see if its sample rate changed
+ if (input.valid())
+ input.apply_sample_rate_changes(updatenum, m_sample_rate);
+}
- if (input.m_source != nullptr && input.m_source->m_stream->m_sample_rate)
- {
- // okay, we have a new sample rate; recompute the latency to be the maximum
- // sample period between us and our input
- attoseconds_t new_attosecs_per_sample = ATTOSECONDS_PER_SECOND / input.m_source->m_stream->m_sample_rate;
- attoseconds_t latency = std::max(new_attosecs_per_sample, m_attoseconds_per_sample);
-
- // if the input stream's sample rate is lower, we will use linear interpolation
- // this requires an extra sample from the source
- if (input.m_source->m_stream->m_sample_rate < m_sample_rate)
- latency += new_attosecs_per_sample;
-
- // if our sample rates match exactly, we don't need any latency
- else if (input.m_source->m_stream->m_sample_rate == m_sample_rate)
- latency = 0;
-
- // we generally don't want to tweak the latency, so we just keep the greatest
- // one we've computed thus far
- input.m_latency_attoseconds = std::max(input.m_latency_attoseconds, latency);
- assert(input.m_latency_attoseconds < update_attoseconds);
- }
- else
- {
- input.m_latency_attoseconds = 0;
- }
- }
- // If synchronous, prime the timer
- if (m_synchronous)
- {
- attotime time = m_device.machine().time();
- if (m_attoseconds_per_sample)
+//-------------------------------------------------
+// print_graph_recursive - helper for debugging;
+// prints info on this stream and then recursively
+// prints info on all inputs
+//-------------------------------------------------
+
+#if (SOUND_DEBUG)
+void sound_stream::print_graph_recursive(int indent, int index)
+{
+ osd_printf_info("%c %*s%s Ch.%d @ %d\n", m_callback.isnull() ? ' ' : '!', indent, "", name().c_str(), index + m_output_base, sample_rate());
+ for (int index = 0; index < m_input.size(); index++)
+ if (m_input[index].valid())
{
- attoseconds_t next_edge = m_attoseconds_per_sample - (time.attoseconds() % m_attoseconds_per_sample);
- m_sync_timer->adjust(attotime(0, next_edge));
+ if (m_input[index].m_resampler_source != nullptr)
+ m_input[index].m_resampler_source->stream().print_graph_recursive(indent + 2, m_input[index].m_resampler_source->index());
+ else
+ m_input[index].m_native_source->stream().print_graph_recursive(indent + 2, m_input[index].m_native_source->index());
}
- else
- m_sync_timer->adjust(attotime::never);
- }
}
+#endif
//-------------------------------------------------
-// allocate_resample_buffers - recompute the
-// resample buffer sizes and expand if necessary
+// sample_rate_changed - recompute sample
+// rate data, and all streams that are affected
+// by this stream
//-------------------------------------------------
-void sound_stream::allocate_resample_buffers()
+void sound_stream::sample_rate_changed()
{
- // compute the target number of samples
- s32 bufsize = 2 * m_max_samples_per_update;
+ // if invalid, just punt
+ if (m_sample_rate == SAMPLE_RATE_INVALID)
+ return;
- // if we don't have enough room, allocate more
- if (m_resample_bufalloc < bufsize)
- {
- // this becomes the new allocation size
- m_resample_bufalloc = bufsize;
+ // update all output buffers
+ for (auto &output : m_output)
+ output.sample_rate_changed(m_sample_rate);
- // iterate over outputs and realloc their buffers
- for (auto &elem : m_input)
- elem.m_resample.resize(m_resample_bufalloc, 0);
- }
+ // if synchronous, prime the timer
+ if (synchronous())
+ reprime_sync_timer();
}
//-------------------------------------------------
-// allocate_output_buffers - recompute the
-// output buffer sizes and expand if necessary
+// postload - save/restore callback
//-------------------------------------------------
-void sound_stream::allocate_output_buffers()
+void sound_stream::postload()
{
- // if we don't have enough room, allocate more
- s32 bufsize = OUTPUT_BUFFER_UPDATES * m_max_samples_per_update;
- if (m_output_bufalloc < bufsize)
- {
- // this becomes the new allocation size
- m_output_bufalloc = bufsize;
+ // set the end time of all of our streams to now
+ for (auto &output : m_output)
+ output.set_end_time(m_device.machine().time());
- // iterate over outputs and realloc their buffers
- for (auto &elem : m_output)
- elem.m_buffer.resize(m_output_bufalloc, 0);
- }
+ // recompute the sample rate information
+ sample_rate_changed();
}
//-------------------------------------------------
-// postload - save/restore callback
+// reprime_sync_timer - set up the next sync
+// timer to go off just a hair after the end of
+// the current sample period
//-------------------------------------------------
-void sound_stream::postload()
+void sound_stream::reprime_sync_timer()
{
- // recompute the same rate information
- recompute_sample_rate_data();
+ attotime curtime = m_device.machine().time();
+ attotime target = m_output[0].end_time() + attotime(0, 1);
+ m_sync_timer->adjust(target - curtime);
+}
- // make sure our output buffers are fully cleared
- for (auto &elem : m_output)
- std::fill_n(&elem.m_buffer[0], m_output_bufalloc, 0);
- // recompute the sample indexes to make sense
- m_output_sampindex = m_attoseconds_per_sample ? m_device.machine().sound().last_update().attoseconds() / m_attoseconds_per_sample : 0;
- m_output_update_sampindex = m_output_sampindex;
- m_output_base_sampindex = m_output_sampindex - m_max_samples_per_update;
+//-------------------------------------------------
+// sync_update - timer callback to handle a
+// synchronous stream
+//-------------------------------------------------
+
+void sound_stream::sync_update(void *, s32)
+{
+ update();
+ reprime_sync_timer();
}
//-------------------------------------------------
-// generate_samples - generate the requested
-// number of samples for a stream, making sure
-// all inputs have the appropriate number of
-// samples generated
+// stream_update_legacy - new-style callback which
+// forwards on to the old-style traditional
+// callback, converting to/from floats
//-------------------------------------------------
-void sound_stream::generate_samples(int samples)
+void sound_stream::stream_update_legacy(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t **inputs = nullptr;
- stream_sample_t **outputs = nullptr;
-
- VPRINTF(("generate_samples(%p, %d)\n", (void *) this, samples));
- assert(samples > 0);
+ // temporary buffer to hold stream_sample_t inputs and outputs
+ stream_sample_t temp_buffer[1024];
+ int chunksize = ARRAY_LENGTH(temp_buffer) / (inputs.size() + outputs.size());
+ int chunknum = 0;
+
+ // create the arrays to pass to the callback
+ stream_sample_t **inputptr = m_input.empty() ? nullptr : &m_input_array[0];
+ stream_sample_t **outputptr = &m_output_array[0];
+ for (unsigned int inputnum = 0; inputnum < inputs.size(); inputnum++)
+ inputptr[inputnum] = &temp_buffer[chunksize * chunknum++];
+ for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++)
+ outputptr[outputnum] = &temp_buffer[chunksize * chunknum++];
- // ensure all inputs are up to date and generate resampled data
- for (unsigned int inputnum = 0; inputnum < m_input.size(); inputnum++)
+ // loop until all chunks done
+ for (int baseindex = 0; baseindex < outputs[0].samples(); baseindex += chunksize)
{
- // update the stream to the current time
- stream_input &input = m_input[inputnum];
- if (input.m_source != nullptr)
- input.m_source->m_stream->update();
+ // determine the number of samples to process this time
+ int cursamples = outputs[0].samples() - baseindex;
+ if (cursamples > chunksize)
+ cursamples = chunksize;
- // generate the resampled data
- m_input_array[inputnum] = generate_resampled_data(input, samples);
- }
+ // copy in the input data
+ for (unsigned int inputnum = 0; inputnum < inputs.size(); inputnum++)
+ {
+ stream_sample_t *dest = inputptr[inputnum];
+ for (int index = 0; index < cursamples; index++)
+ dest[index] = stream_sample_t(inputs[inputnum].get(baseindex + index) * stream_buffer::sample_t(32768.0));
+ }
- if (!m_input.empty())
- {
- inputs = &m_input_array[0];
- }
+ // run the callback
+ m_callback(*this, inputptr, outputptr, cursamples);
- // loop over all outputs and compute the output pointer
- for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++)
- {
- stream_output &output = m_output[outputnum];
- m_output_array[outputnum] = &output.m_buffer[m_output_sampindex - m_output_base_sampindex];
+ // copy out the output data
+ for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++)
+ {
+ stream_sample_t *src = outputptr[outputnum];
+ for (int index = 0; index < cursamples; index++)
+ outputs[outputnum].put(baseindex + index, stream_buffer::sample_t(src[index]) * stream_buffer::sample_t(1.0 / 32768.0));
+ }
}
+}
- if (!m_output.empty())
- {
- outputs = &m_output_array[0];
- }
- // run the callback
- VPRINTF((" callback(%p, %d)\n", (void *)this, samples));
- m_callback(*this, inputs, outputs, samples);
- VPRINTF((" callback done\n"));
+//-------------------------------------------------
+// empty_view - return an empty view covering the
+// given time period as a substitute for invalid
+// inputs
+//-------------------------------------------------
+
+read_stream_view sound_stream::empty_view(attotime start, attotime end)
+{
+ // if our dummy buffer doesn't match our sample rate, update and clear it
+ if (m_empty_buffer.sample_rate() != m_sample_rate)
+ m_empty_buffer.set_sample_rate(m_sample_rate, false);
+
+ // allocate a write view so that it can expand, and convert back to a read view
+ // on the return
+ return write_stream_view(m_empty_buffer, start, end);
}
+
+//**************************************************************************
+// RESAMPLER STREAM
+//**************************************************************************
+
//-------------------------------------------------
-// generate_resampled_data - generate the
-// resample buffer for a given input
+// default_resampler_stream - derived sound_stream
+// class that handles resampling
//-------------------------------------------------
-stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, u32 numsamples)
+default_resampler_stream::default_resampler_stream(device_t &device) :
+ sound_stream(device, 1, 1, 0, SAMPLE_RATE_OUTPUT_ADAPTIVE, stream_update_delegate(&default_resampler_stream::resampler_sound_update, this), STREAM_DISABLE_INPUT_RESAMPLING),
+ m_max_latency(0)
{
- // if we don't have an output to pull data from, generate silence
- stream_sample_t *dest = &input.m_resample[0];
- if (input.m_source == nullptr || input.m_source->m_stream->m_attoseconds_per_sample == 0)
- {
- std::fill_n(dest, numsamples, 0);
- return &input.m_resample[0];
- }
+ // create a name
+ m_name = "Default Resampler '";
+ m_name += device.tag();
+ m_name += "'";
+}
- // grab data from the output
- stream_output &output = *input.m_source;
- sound_stream &input_stream = *output.m_stream;
- s64 gain = (input.m_gain * input.m_user_gain * output.m_gain) >> 16;
- // determine the time at which the current sample begins, accounting for the
- // latency we calculated between the input and output streams
- attoseconds_t basetime = m_output_sampindex * m_attoseconds_per_sample - input.m_latency_attoseconds;
+//-------------------------------------------------
+// resampler_sound_update - stream callback
+// handler for resampling an input stream to the
+// target sample rate of the output
+//-------------------------------------------------
- // now convert that time into a sample in the input stream
- s32 basesample;
- if (basetime >= 0)
- basesample = basetime / input_stream.m_attoseconds_per_sample;
- else
- basesample = -(-basetime / input_stream.m_attoseconds_per_sample) - 1;
+void default_resampler_stream::resampler_sound_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+{
+ sound_assert(inputs.size() == 1);
+ sound_assert(outputs.size() == 1);
+
+ auto &input = inputs[0];
+ auto &output = outputs[0];
- // compute a source pointer to the first sample
- assert(basesample >= input_stream.m_output_base_sampindex);
- stream_sample_t *source = &output.m_buffer[basesample - input_stream.m_output_base_sampindex];
+ // if the input has an invalid rate, just fill with zeros
+ if (input.sample_rate() <= 1)
+ {
+ output.fill(0);
+ return;
+ }
- // determine the current fraction of a sample, expressed as a fraction of FRAC_ONE
- // (Note: this formula is valid as long as input_stream.m_attoseconds_per_sample significantly exceeds FRAC_ONE > attoseconds = 4.2E-12 s)
- u32 basefrac = (basetime - basesample * input_stream.m_attoseconds_per_sample) / ((input_stream.m_attoseconds_per_sample + FRAC_ONE - 1) >> FRAC_BITS);
- assert(basefrac < FRAC_ONE);
+ // optimize_resampler ensures we should not have equal sample rates
+ sound_assert(input.sample_rate() != output.sample_rate());
- // compute the stepping fraction
- u32 step = (u64(input_stream.m_sample_rate) << FRAC_BITS) / m_sample_rate;
+ // compute the stepping value and the inverse
+ stream_buffer::sample_t step = stream_buffer::sample_t(input.sample_rate()) / stream_buffer::sample_t(output.sample_rate());
+ stream_buffer::sample_t stepinv = 1.0 / step;
- // if we have equal sample rates, we just need to copy
- if (step == FRAC_ONE)
+ // determine the latency we need to introduce, in input samples:
+ // 1 input sample for undersampled inputs
+ // 1 + step input samples for oversampled inputs
+ s64 latency_samples = 1 + ((step < 1.0) ? 0 : s32(step));
+ if (latency_samples <= m_max_latency)
+ latency_samples = m_max_latency;
+ else
+ m_max_latency = latency_samples;
+ attotime latency = latency_samples * input.sample_period();
+
+ // clamp the latency to the start (only relevant at the beginning)
+ s32 dstindex = 0;
+ attotime output_start = output.start_time();
+ auto numsamples = output.samples();
+ while (latency > output_start && dstindex < numsamples)
{
- while (numsamples--)
- {
- // compute the sample
- s64 sample = *source++;
- *dest++ = (sample * gain) >> 8;
- }
+ output.put(dstindex++, 0);
+ output_start += output.sample_period();
}
+ if (dstindex >= numsamples)
+ return;
+
+ // create a rebased input buffer around the adjusted start time
+ read_stream_view rebased(input, output_start - latency);
+ sound_assert(rebased.start_time() + latency <= output_start);
+
+ // compute the fractional input start position
+ attotime delta = output_start - (rebased.start_time() + latency);
+ sound_assert(delta.seconds() == 0);
+ stream_buffer::sample_t srcpos = stream_buffer::sample_t(double(delta.attoseconds()) / double(rebased.sample_period_attoseconds()));
+ sound_assert(srcpos <= 1.0f);
// input is undersampled: point sample except where our sample period covers a boundary
- else if (step < FRAC_ONE)
+ s32 srcindex = 0;
+ if (step < 1.0)
{
- while (numsamples != 0)
+ stream_buffer::sample_t cursample = rebased.get(srcindex++);
+ for ( ; dstindex < numsamples; dstindex++)
{
- // fill in with point samples until we hit a boundary
- int nextfrac;
- while ((nextfrac = basefrac + step) < FRAC_ONE && numsamples--)
+ // if still within the current sample, just replicate
+ if (srcpos <= 1.0)
+ output.put(dstindex, cursample);
+
+ // if crossing a sample boundary, blend with the neighbor
+ else
{
- *dest++ = (source[0] * gain) >> 8;
- basefrac = nextfrac;
+ srcpos -= 1.0;
+ sound_assert(srcpos <= step + 1e-5);
+ stream_buffer::sample_t prevsample = cursample;
+ cursample = rebased.get(srcindex++);
+ output.put(dstindex, stepinv * (prevsample * (step - srcpos) + srcpos * cursample));
}
-
- // if we're done, we're done
- if (s32(numsamples--) < 0)
- break;
-
- // compute starting and ending fractional positions
- int startfrac = basefrac >> (FRAC_BITS - 12);
- int endfrac = nextfrac >> (FRAC_BITS - 12);
-
- // blend between the two samples accordingly
- s64 sample = (s64(source[0]) * (0x1000 - startfrac) + s64(source[1]) * (endfrac - 0x1000)) / (endfrac - startfrac);
- *dest++ = (sample * gain) >> 8;
-
- // advance
- basefrac = nextfrac & FRAC_MASK;
- source++;
+ srcpos += step;
}
+ sound_assert(srcindex <= rebased.samples());
}
// input is oversampled: sum the energy
else
{
- // use 8 bits to allow some extra headroom
- int smallstep = step >> (FRAC_BITS - 8);
- while (numsamples--)
+ float cursample = rebased.get(srcindex++);
+ for ( ; dstindex < numsamples; dstindex++)
{
- s64 remainder = smallstep;
- int tpos = 0;
-
- // compute the sample
- s64 scale = (FRAC_ONE - basefrac) >> (FRAC_BITS - 8);
- s64 sample = s64(source[tpos++]) * scale;
- remainder -= scale;
- while (remainder > 0x100)
+ // compute the partial first sample and advance
+ stream_buffer::sample_t scale = 1.0 - srcpos;
+ stream_buffer::sample_t sample = cursample * scale;
+
+ // add in complete samples until we only have a fraction left
+ stream_buffer::sample_t remaining = step - scale;
+ while (remaining >= 1.0)
{
- sample += s64(source[tpos++]) * s64(0x100);
- remainder -= 0x100;
+ sample += rebased.get(srcindex++);
+ remaining -= 1.0;
}
- sample += s64(source[tpos]) * remainder;
- sample /= smallstep;
- *dest++ = (sample * gain) >> 8;
+ // add in the final partial sample
+ cursample = rebased.get(srcindex++);
+ sample += cursample * remaining;
+ output.put(dstindex, sample * stepinv);
- // advance
- basefrac += step;
- source += basefrac >> FRAC_BITS;
- basefrac &= FRAC_MASK;
+ // our position is now the remainder
+ srcpos = remaining;
+ sound_assert(srcindex <= rebased.samples());
}
}
-
- return &input.m_resample[0];
-}
-
-
-
-//**************************************************************************
-// STREAM INPUT
-//**************************************************************************
-
-//-------------------------------------------------
-// stream_input - constructor
-//-------------------------------------------------
-
-sound_stream::stream_input::stream_input()
- : m_source(nullptr),
- m_latency_attoseconds(0),
- m_gain(0x100),
- m_user_gain(0x100)
-{
-}
-
-
-
-//**************************************************************************
-// STREAM OUTPUT
-//**************************************************************************
-
-//-------------------------------------------------
-// stream_output - constructor
-//-------------------------------------------------
-
-sound_stream::stream_output::stream_output()
- : m_stream(nullptr),
- m_dependents(0),
- m_gain(0x100)
-{
}
@@ -831,20 +1131,24 @@ sound_stream::stream_output::stream_output()
// sound_manager - constructor
//-------------------------------------------------
-sound_manager::sound_manager(running_machine &machine)
- : m_machine(machine),
- m_update_timer(nullptr),
- m_finalmix_leftover(0),
- m_finalmix(machine.sample_rate()),
- m_leftmix(machine.sample_rate()),
- m_rightmix(machine.sample_rate()),
- m_samples_this_update(0),
- m_muted(0),
- m_attenuation(0),
- m_nosound_mode(machine.osd().no_sound()),
- m_wavfile(nullptr),
- m_update_attoseconds(STREAMS_UPDATE_ATTOTIME.attoseconds()),
- m_last_update(attotime::zero)
+sound_manager::sound_manager(running_machine &machine) :
+ m_machine(machine),
+ m_update_timer(nullptr),
+ m_update_number(0),
+ m_last_update(attotime::zero),
+ m_finalmix_leftover(0),
+ m_samples_this_update(0),
+ m_finalmix(machine.sample_rate()),
+ m_leftmix(machine.sample_rate()),
+ m_rightmix(machine.sample_rate()),
+ m_compressor_scale(1.0),
+ m_compressor_counter(0),
+ m_muted(0),
+ m_nosound_mode(machine.osd().no_sound()),
+ m_attenuation(0),
+ m_unique_id(0),
+ m_wavfile(nullptr),
+ m_first_reset(true)
{
// get filename for WAV file or AVI file if specified
const char *wavfile = machine.options().wav_write();
@@ -889,6 +1193,41 @@ sound_manager::~sound_manager()
//-------------------------------------------------
+// stream_alloc_legacy - allocate a new stream
+//-------------------------------------------------
+
+sound_stream *sound_manager::stream_alloc_legacy(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_legacy_delegate callback)
+{
+ // determine output base
+ u32 output_base = 0;
+ for (auto &stream : m_stream_list)
+ if (&stream->device() == &device)
+ output_base += stream->output_count();
+
+ m_stream_list.push_back(std::make_unique<sound_stream>(device, inputs, outputs, output_base, sample_rate, callback));
+ return m_stream_list.back().get();
+}
+
+
+//-------------------------------------------------
+// stream_alloc - allocate a new stream with the
+// new-style callback and flags
+//-------------------------------------------------
+
+sound_stream *sound_manager::stream_alloc(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags)
+{
+ // determine output base
+ u32 output_base = 0;
+ for (auto &stream : m_stream_list)
+ if (&stream->device() == &device)
+ output_base += stream->output_count();
+
+ m_stream_list.push_back(std::make_unique<sound_stream>(device, inputs, outputs, output_base, sample_rate, callback, flags));
+ return m_stream_list.back().get();
+}
+
+
+//-------------------------------------------------
// start_recording - begin audio recording
//-------------------------------------------------
@@ -915,23 +1254,13 @@ void sound_manager::stop_recording()
//-------------------------------------------------
-// stream_alloc - allocate a new stream
-//-------------------------------------------------
-
-sound_stream *sound_manager::stream_alloc(device_t &device, int inputs, int outputs, int sample_rate, stream_update_delegate callback)
-{
- m_stream_list.push_back(std::make_unique<sound_stream>(device, inputs, outputs, sample_rate, callback));
- return m_stream_list.back().get();
-}
-
-
-//-------------------------------------------------
// set_attenuation - set the global volume
//-------------------------------------------------
-void sound_manager::set_attenuation(int attenuation)
+void sound_manager::set_attenuation(float attenuation)
{
- m_attenuation = attenuation;
+ // currently OSD only supports integral attenuation
+ m_attenuation = int(attenuation);
machine().osd().set_mastervolume(m_muted ? -32 : m_attenuation);
}
@@ -951,7 +1280,7 @@ bool sound_manager::indexed_mixer_input(int index, mixer_input &info) const
{
info.mixer = &mixer;
info.stream = mixer.input_to_stream_input(index, info.inputnum);
- assert(info.stream != nullptr);
+ sound_assert(info.stream != nullptr);
return true;
}
index -= mixer.inputs();
@@ -964,6 +1293,19 @@ bool sound_manager::indexed_mixer_input(int index, mixer_input &info) const
//-------------------------------------------------
+// samples - fills the specified buffer with
+// 16-bit stereo audio samples generated during
+// the current frame
+//-------------------------------------------------
+
+void sound_manager::samples(s16 *buffer)
+{
+ for (int sample = 0; sample < m_samples_this_update * 2; sample++)
+ *buffer++ = m_finalmix[sample];
+}
+
+
+//-------------------------------------------------
// mute - mute sound output
//-------------------------------------------------
@@ -978,6 +1320,47 @@ void sound_manager::mute(bool mute, u8 reason)
//-------------------------------------------------
+// recursive_remove_stream_from_orphan_list -
+// remove the given stream from the orphan list
+// and recursively remove all our inputs
+//-------------------------------------------------
+
+void sound_manager::recursive_remove_stream_from_orphan_list(sound_stream *which)
+{
+ m_orphan_stream_list.erase(which);
+ for (int inputnum = 0; inputnum < which->input_count(); inputnum++)
+ {
+ auto &input = which->input(inputnum);
+ if (input.valid())
+ recursive_remove_stream_from_orphan_list(&input.source().stream());
+ }
+}
+
+
+//-------------------------------------------------
+// apply_sample_rate_changes - recursively
+// update sample rates throughout the system
+//-------------------------------------------------
+
+void sound_manager::apply_sample_rate_changes()
+{
+ // update sample rates if they have changed
+ for (speaker_device &speaker : speaker_device_iterator(machine().root_device()))
+ {
+ int stream_out;
+ sound_stream *stream = speaker.output_to_stream_output(0, stream_out);
+
+ // due to device removal, some speakers may end up with no outputs; just skip those
+ if (stream != nullptr)
+ {
+ sound_assert(speaker.outputs() == 1);
+ stream->apply_sample_rate_changes(m_update_number, machine().sample_rate());
+ }
+ }
+}
+
+
+//-------------------------------------------------
// reset - reset all sound chips
//-------------------------------------------------
@@ -986,6 +1369,47 @@ void sound_manager::reset()
// reset all the sound chips
for (device_sound_interface &sound : sound_interface_iterator(machine().root_device()))
sound.device().reset();
+
+ // apply any sample rate changes now
+ apply_sample_rate_changes();
+
+ // on first reset, identify any orphaned streams
+ if (m_first_reset)
+ {
+ m_first_reset = false;
+
+ // put all the streams on the orphan list to start
+ for (auto &stream : m_stream_list)
+ m_orphan_stream_list[stream.get()] = 0;
+
+ // then walk the graph like we do on update and remove any we touch
+ for (speaker_device &speaker : speaker_device_iterator(machine().root_device()))
+ {
+ int dummy;
+ sound_stream *output = speaker.output_to_stream_output(0, dummy);
+ if (output != nullptr)
+ recursive_remove_stream_from_orphan_list(output);
+ }
+
+#if (SOUND_DEBUG)
+ // dump the sound graph when we start up
+ for (speaker_device &speaker : speaker_device_iterator(machine().root_device()))
+ {
+ int index;
+ sound_stream *output = speaker.output_to_stream_output(0, index);
+ if (output != nullptr)
+ output->print_graph_recursive(0, index);
+ }
+
+ // dump the orphan list as well
+ if (m_orphan_stream_list.size() != 0)
+ {
+ osd_printf_info("\nOrphaned streams:\n");
+ for (auto &stream : m_orphan_stream_list)
+ osd_printf_info(" %s\n", stream.first->name());
+ }
+#endif
+ }
}
@@ -1033,7 +1457,7 @@ void sound_manager::config_load(config_type cfg_type, util::xml::data_node const
float defvol = channelnode->get_attribute_float("defvol", 1.0f);
float newvol = channelnode->get_attribute_float("newvol", -1000.0f);
if (newvol != -1000.0f)
- info.stream->set_user_gain(info.inputnum, newvol / defvol);
+ info.stream->input(info.inputnum).set_user_gain(newvol / defvol);
}
}
}
@@ -1057,7 +1481,7 @@ void sound_manager::config_save(config_type cfg_type, util::xml::data_node *pare
mixer_input info;
if (!indexed_mixer_input(mixernum, info))
break;
- float newvol = info.stream->user_gain(info.inputnum);
+ float newvol = info.stream->input(info.inputnum).user_gain();
if (newvol != 1.0f)
{
@@ -1073,6 +1497,45 @@ void sound_manager::config_save(config_type cfg_type, util::xml::data_node *pare
//-------------------------------------------------
+// adjust_toward_compressor_scale - adjust the
+// current scale factor toward the current goal,
+// in small increments
+//-------------------------------------------------
+
+stream_buffer::sample_t sound_manager::adjust_toward_compressor_scale(stream_buffer::sample_t curscale, stream_buffer::sample_t prevsample, stream_buffer::sample_t rawsample)
+{
+ stream_buffer::sample_t proposed_scale = curscale;
+
+ // if we want to get larger, increment by 0.01
+ if (curscale < m_compressor_scale)
+ {
+ proposed_scale += 0.01f;
+ if (proposed_scale > m_compressor_scale)
+ proposed_scale = m_compressor_scale;
+ }
+
+ // otherwise, decrement by 0.01
+ else
+ {
+ proposed_scale -= 0.01f;
+ if (proposed_scale < m_compressor_scale)
+ proposed_scale = m_compressor_scale;
+ }
+
+ // compute the sample at the current scale and at the proposed scale
+ stream_buffer::sample_t cursample = rawsample * curscale;
+ stream_buffer::sample_t proposed_sample = rawsample * proposed_scale;
+
+ // if they trend in the same direction, it's ok to take the step
+ if ((cursample < prevsample && proposed_sample < prevsample) || (cursample > prevsample && proposed_sample > prevsample))
+ curscale = proposed_scale;
+
+ // return the current scale
+ return curscale;
+}
+
+
+//-------------------------------------------------
// update - mix everything down to its final form
// and send it to the OSD layer
//-------------------------------------------------
@@ -1083,10 +1546,72 @@ void sound_manager::update(void *ptr, int param)
g_profiler.start(PROFILER_SOUND);
+ // determine the duration of this update
+ attotime update_period = machine().time() - m_last_update;
+ sound_assert(update_period.seconds() == 0);
+
+ // use that to compute the number of samples we need from the speakers
+ attoseconds_t sample_rate_attos = HZ_TO_ATTOSECONDS(machine().sample_rate());
+ m_samples_this_update = update_period.attoseconds() / sample_rate_attos;
+
+ // recompute the end time to an even sample boundary
+ attotime endtime = m_last_update + attotime(0, m_samples_this_update * sample_rate_attos);
+
+ // clear out the mix bufers
+ std::fill_n(&m_leftmix[0], m_samples_this_update, 0);
+ std::fill_n(&m_rightmix[0], m_samples_this_update, 0);
+
// force all the speaker streams to generate the proper number of samples
- m_samples_this_update = 0;
for (speaker_device &speaker : speaker_device_iterator(machine().root_device()))
- speaker.mix(&m_leftmix[0], &m_rightmix[0], m_samples_this_update, (m_muted & MUTE_REASON_SYSTEM));
+ speaker.mix(&m_leftmix[0], &m_rightmix[0], m_last_update, endtime, m_samples_this_update, (m_muted & MUTE_REASON_SYSTEM));
+
+ // determine the maximum in this section
+ stream_buffer::sample_t curmax = 0;
+ for (int sampindex = 0; sampindex < m_samples_this_update; sampindex++)
+ {
+ auto sample = m_leftmix[sampindex];
+ if (sample < 0)
+ sample = -sample;
+ if (sample > curmax)
+ curmax = sample;
+
+ sample = m_rightmix[sampindex];
+ if (sample < 0)
+ sample = -sample;
+ if (sample > curmax)
+ curmax = sample;
+ }
+
+ // pull in current compressor scale factor before modifying
+ stream_buffer::sample_t lscale = m_compressor_scale;
+ stream_buffer::sample_t rscale = m_compressor_scale;
+
+ // if we're above what the compressor will handle, adjust the compression
+ if (curmax * m_compressor_scale > 1.0)
+ {
+ m_compressor_scale = 1.0 / curmax;
+ m_compressor_counter = STREAMS_UPDATE_FREQUENCY / 5;
+ }
+
+ // if we're currently scaled, wait a bit to see if we can trend back toward 1.0
+ else if (m_compressor_counter != 0)
+ m_compressor_counter--;
+
+ // try to migrate toward 0 unless we're going to introduce clipping
+ else if (m_compressor_scale < 1.0 && curmax * 1.01 * m_compressor_scale < 1.0)
+ {
+ m_compressor_scale *= 1.01f;
+ if (m_compressor_scale > 1.0)
+ m_compressor_scale = 1.0;
+ }
+
+#if (SOUND_DEBUG)
+ if (lscale != m_compressor_scale)
+ printf("scale=%.5f\n", m_compressor_scale);
+#endif
+
+ // track whether there are pending scale changes in left/right
+ stream_buffer::sample_t lprev = 0, rprev = 0;
// now downmix the final result
u32 finalmix_step = machine().video().speed_factor();
@@ -1097,21 +1622,31 @@ void sound_manager::update(void *ptr, int param)
{
int sampindex = sample / 1000;
+ // ensure that changing the compression won't reverse direction to reduce "pops"
+ stream_buffer::sample_t lsamp = m_leftmix[sampindex];
+ if (lscale != m_compressor_scale && sample != m_finalmix_leftover)
+ lscale = adjust_toward_compressor_scale(lscale, lprev, lsamp);
+
// clamp the left side
- s32 samp = m_leftmix[sampindex];
- if (samp < -32768)
- samp = -32768;
- else if (samp > 32767)
- samp = 32767;
- finalmix[finalmix_offset++] = samp;
-
- // clamp the right side
- samp = m_rightmix[sampindex];
- if (samp < -32768)
- samp = -32768;
- else if (samp > 32767)
- samp = 32767;
- finalmix[finalmix_offset++] = samp;
+ lprev = lsamp *= lscale;
+ if (lsamp > 1.0)
+ lsamp = 1.0;
+ else if (lsamp < -1.0)
+ lsamp = -1.0;
+ finalmix[finalmix_offset++] = s16(lsamp * 32767.0);
+
+ // ensure that changing the compression won't reverse direction to reduce "pops"
+ stream_buffer::sample_t rsamp = m_rightmix[sampindex];
+ if (rscale != m_compressor_scale && sample != m_finalmix_leftover)
+ rscale = adjust_toward_compressor_scale(rscale, rprev, rsamp);
+
+ // clamp the left side
+ rprev = rsamp *= rscale;
+ if (rsamp > 1.0)
+ rsamp = 1.0;
+ else if (rsamp < -1.0)
+ rsamp = -1.0;
+ finalmix[finalmix_offset++] = s16(rsamp * 32767.0);
}
m_finalmix_leftover = sample - m_samples_this_update * 1000;
@@ -1126,43 +1661,19 @@ void sound_manager::update(void *ptr, int param)
wav_add_data_16(m_wavfile, finalmix, finalmix_offset);
}
- // see if we ticked over to the next second
- attotime curtime = machine().time();
- bool second_tick = false;
- if (curtime.seconds() != m_last_update.seconds())
- {
- assert(curtime.seconds() == m_last_update.seconds() + 1);
- second_tick = true;
- }
-
- // iterate over all the streams and update them
- for (auto &stream : m_stream_list)
- stream->update_with_accounting(second_tick);
+ // update any orphaned streams so they don't get too far behind
+ for (auto &stream : m_orphan_stream_list)
+ stream.first->update();
// remember the update time
- m_last_update = curtime;
+ m_last_update = endtime;
+ m_update_number++;
- // update sample rates if they have changed
- for (auto &stream : m_stream_list)
- stream->apply_sample_rate_changes();
+ // apply sample rate changes
+ apply_sample_rate_changes();
// notify that new samples have been generated
emulator_info::sound_hook();
g_profiler.stop();
}
-
-
-//-------------------------------------------------
-// samples - fills the specified buffer with
-// 16-bit stereo audio samples generated during
-// the current frame
-//-------------------------------------------------
-
-void sound_manager::samples(s16 *buffer)
-{
- for (int sample = 0; sample < m_samples_this_update * 2; sample++)
- {
- *buffer++ = m_finalmix[sample];
- }
-}
diff --git a/src/emu/sound.h b/src/emu/sound.h
index 7301a4d69ba..c3027b28ba6 100644
--- a/src/emu/sound.h
+++ b/src/emu/sound.h
@@ -6,6 +6,50 @@
Core sound interface functions and definitions.
+****************************************************************************
+
+ In MAME, sound is represented as a graph of sound "streams". Each
+ stream has a fixed number of inputs and outputs, and is responsible
+ for producing sound on demand.
+
+ The graph is driven from the outputs, which are speaker devices.
+ These devices are updated on a regular basis (~50 times per second),
+ and when an update occurs, the graph is walked from the speaker
+ through each input, until all connected streams are up to date.
+
+ Individual streams can also be updated manually. This is important
+ for sound chips and CPU-driven devices, who should force any
+ affected streams to update prior to making changes.
+
+ Sound streams are *not* part of the device execution model. This is
+ very important to understand. If the process of producing the ouput
+ stream affects state that might be consumed by an executing device
+ (e.g., a CPU), then care must be taken to ensure that the stream is
+ updated frequently enough
+
+ The model for timing sound samples is very important and explained
+ here. Each stream source has a clock (aka sample rate). Each clock
+ edge represents a sample that is held for the duration of one clock
+ period. This model has interesting effects:
+
+ For example, if you have a 10Hz clock, and call stream.update() at
+ t=0.91, it will compute 10 samples (for clock edges 0.0, 0.1, 0.2,
+ ..., 0.7, 0.8, and 0.9). And then if you ask the stream what its
+ current end time is (via stream.sample_time()), it will say t=1.0,
+ which is in the future, because it knows it will hold that last
+ sample until 1.0s.
+
+ Sound generation callbacks are presented with a std::vector of inputs
+ and outputs. The vectors contain objects of read_stream_view and
+ write_stream_view respectively, which wrap access to a circular buffer
+ of samples. Sound generation callbacks are expected to fill all the
+ samples described by the outputs' write_stream_view objects. At the
+ moment, all outputs have the same sample rate, so the number of samples
+ that need to be generated will be consistent across all outputs.
+
+ By default, the inputs will have been resampled to match the output
+ sample rate, unless otherwise specified.
+
***************************************************************************/
#pragma once
@@ -22,26 +66,503 @@
// CONSTANTS
//**************************************************************************
-constexpr int STREAM_SYNC = -1; // special rate value indicating a one-sample-at-a-time stream
- // with actual rate defined by its input
+// special sample-rate values
+constexpr u32 SAMPLE_RATE_INVALID = 0xffffffff;
+constexpr u32 SAMPLE_RATE_INPUT_ADAPTIVE = 0xfffffffe;
+constexpr u32 SAMPLE_RATE_OUTPUT_ADAPTIVE = 0xfffffffd;
+
+// anything below this sample rate is effectively treated as "off"
+constexpr u32 SAMPLE_RATE_MINIMUM = 50;
+
+
//**************************************************************************
-// MACROS
+// DEBUGGING
//**************************************************************************
-typedef delegate<void (sound_stream &, stream_sample_t **inputs, stream_sample_t **outputs, int samples)> stream_update_delegate;
+// turn this on to enable aggressive assertions and other checks
+#define SOUND_DEBUG (1)
+
+// if SOUND_DEBUG is on, make assertions fire regardless of MAME_DEBUG
+#if (SOUND_DEBUG)
+#define sound_assert(x) do { if (!(x)) { osd_printf_error("sound_assert: " #x "\n"); osd_break_into_debugger("sound_assert: " #x "\n"); } } while (0)
+#else
+#define sound_assert assert
+#endif
+
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
+// ======================> stream_buffer
-// structure describing an indexed mixer
-struct mixer_input
+class stream_buffer
{
- device_mixer_interface *mixer; // owning device interface
- sound_stream * stream; // stream within the device
- int inputnum; // input on the stream
+ // stream_buffer is an internal class, not directly accessed
+ // outside of the classes below
+ friend class read_stream_view;
+ friend class write_stream_view;
+ friend class sound_stream;
+ friend class sound_stream_output;
+
+public:
+ // the one public bit is the sample type
+ using sample_t = float;
+
+private:
+ // constructor/destructor
+ stream_buffer(u32 sample_rate = 48000);
+ ~stream_buffer();
+
+ // disable copying of stream_buffers directly
+ stream_buffer(stream_buffer const &src) = delete;
+ stream_buffer &operator=(stream_buffer const &rhs) = delete;
+
+ // return the current sample rate
+ u32 sample_rate() const { return m_sample_rate; }
+
+ // set a new sample rate
+ void set_sample_rate(u32 rate, bool resample);
+
+ // return the current sample period in attoseconds
+ attoseconds_t sample_period_attoseconds() const { return m_sample_attos; }
+ attotime sample_period() const { return attotime(0, m_sample_attos); }
+
+ // return the attotime of the current end of buffer
+ attotime end_time() const { return index_time(m_end_sample); }
+
+ // set the ending time (for forced resyncs; generally not used)
+ void set_end_time(attotime time)
+ {
+ m_end_second = time.seconds();
+ m_end_sample = u32(time.attoseconds() / m_sample_attos);
+ }
+
+ // return the effective buffer size; currently it is a full second of audio
+ // at the current sample rate, but this maybe change in the future
+ u32 size() const { return m_sample_rate; }
+
+ // read the sample at the given index (clamped); should be valid in all cases
+ sample_t get(s32 index) const
+ {
+ sound_assert(u32(index) < size());
+ sample_t value = m_buffer[index];
+#if (SOUND_DEBUG)
+ sound_assert(!std::isnan(value));
+#endif
+ return value;
+ }
+
+ // write the sample at the given index (clamped)
+ void put(s32 index, sample_t data)
+ {
+ sound_assert(u32(index) < size());
+ m_buffer[index] = data;
+ }
+
+ // simple helpers to step indexes
+ u32 next_index(u32 index) { index++; return (index == size()) ? 0 : index; }
+ u32 prev_index(u32 index) { return (index == 0) ? (size() - 1) : (index - 1); }
+
+ // clamp an index to the size of the buffer; allows for indexing +/- one
+ // buffers' worth of range
+ u32 clamp_index(s32 index) const
+ {
+ if (index < 0)
+ index += size();
+ else if (index >= size())
+ index -= size();
+ sound_assert(index >= 0 && index < size());
+ return index;
+ }
+
+ // fill the buffer with the given value
+ void fill(sample_t value) { std::fill_n(&m_buffer[0], m_buffer.size(), value); }
+
+ // return the attotime of a given index within the buffer
+ attotime index_time(s32 index) const;
+
+ // given an attotime, return the buffer index corresponding to it
+ u32 time_to_buffer_index(attotime time, bool round_up, bool allow_expansion = false);
+
+ // downsample from our buffer into a temporary buffer
+ void backfill_downsample(sample_t *dest, int samples, attotime newend, attotime newperiod);
+
+ // upsample from a temporary buffer into our buffer
+ void backfill_upsample(sample_t const *src, int samples, attotime prevend, attotime prevperiod);
+
+ // internal state
+ u32 m_end_second; // current full second of the buffer end
+ u32 m_end_sample; // current sample number within the final second
+ u32 m_sample_rate; // sample rate of the data in the buffer
+ attoseconds_t m_sample_attos; // pre-computed attoseconds per sample
+ std::vector<sample_t> m_buffer; // vector of actual buffer data
+
+#if (SOUND_DEBUG)
+public:
+ // for debugging, provide an interface to write a WAV stream
+ void open_wav(char const *filename);
+ void flush_wav();
+ void close_wav();
+
+private:
+ // internal debugging state
+ wav_file *m_wav_file = nullptr; // pointer to the current WAV file
+ u32 m_last_written = 0; // last written sample index
+#endif
+};
+
+
+// ======================> read_stream_view
+
+class read_stream_view
+{
+public:
+ using sample_t = stream_buffer::sample_t;
+
+protected:
+ // private constructor used by write_stream_view that allows for expansion
+ read_stream_view(stream_buffer &buffer, attotime start, attotime end) :
+ read_stream_view(&buffer, 0, buffer.time_to_buffer_index(end, true, true), 1.0)
+ {
+ // start has to be set after end, since end can expand the buffer and
+ // potentially invalidate start
+ m_start = buffer.time_to_buffer_index(start, false);
+ normalize_start_end();
+ }
+
+public:
+ // base constructor to simplify some of the code
+ read_stream_view(stream_buffer *buffer, s32 start, s32 end, sample_t gain) :
+ m_buffer(buffer),
+ m_end(end),
+ m_start(start),
+ m_gain(gain)
+ {
+ normalize_start_end();
+ }
+
+ // empty constructor so we can live in an array or vector
+ read_stream_view() :
+ read_stream_view(nullptr, 0, 0, 1.0)
+ {
+ }
+
+ // constructor that covers the given time period
+ read_stream_view(stream_buffer &buffer, attotime start, attotime end, sample_t gain) :
+ read_stream_view(&buffer, buffer.time_to_buffer_index(start, false), buffer.time_to_buffer_index(end, true), gain)
+ {
+ }
+
+ // copy constructor
+ read_stream_view(read_stream_view const &src) :
+ read_stream_view(src.m_buffer, src.m_start, src.m_end, src.m_gain)
+ {
+ }
+
+ // copy constructor that sets a different start time
+ read_stream_view(read_stream_view const &src, attotime start) :
+ read_stream_view(src.m_buffer, src.m_buffer->time_to_buffer_index(start, false), src.m_end, src.m_gain)
+ {
+ }
+
+ // copy assignment
+ read_stream_view &operator=(read_stream_view const &rhs)
+ {
+ m_buffer = rhs.m_buffer;
+ m_start = rhs.m_start;
+ m_end = rhs.m_end;
+ m_gain = rhs.m_gain;
+ normalize_start_end();
+ return *this;
+ }
+
+ // return the local gain
+ sample_t gain() const { return m_gain; }
+
+ // return the sample rate of the data
+ u32 sample_rate() const { return m_buffer->sample_rate(); }
+
+ // return the sample period (in attoseconds) of the data
+ attoseconds_t sample_period_attoseconds() const { return m_buffer->sample_period_attoseconds(); }
+ attotime sample_period() const { return m_buffer->sample_period(); }
+
+ // return the number of samples represented by the buffer
+ u32 samples() const { return m_end - m_start; }
+
+ // return the starting or ending time of the buffer
+ attotime start_time() const { return m_buffer->index_time(m_start); }
+ attotime end_time() const { return m_buffer->index_time(m_end); }
+
+ // set the gain
+ read_stream_view &set_gain(float gain) { m_gain = gain; return *this; }
+
+ // apply an additional gain factor
+ read_stream_view &apply_gain(float gain) { m_gain *= gain; return *this; }
+
+ // safely fetch a gain-scaled sample from the buffer
+ sample_t get(s32 index) const
+ {
+ sound_assert(u32(index) < samples());
+ index += m_start;
+ if (index >= m_buffer->size())
+ index -= m_buffer->size();
+ return m_buffer->get(index) * m_gain;
+ }
+
+ // safely fetch a raw sample from the buffer; if you use this, you need to
+ // apply the gain yourself for correctness
+ sample_t getraw(s32 index) const
+ {
+ sound_assert(u32(index) < samples());
+ index += m_start;
+ if (index >= m_buffer->size())
+ index -= m_buffer->size();
+ return m_buffer->get(index);
+ }
+
+protected:
+ // normalize start/end
+ void normalize_start_end()
+ {
+ // ensure that end is always greater than start; we'll
+ // wrap to the buffer length as needed
+ if (m_end < m_start && m_buffer != nullptr)
+ m_end += m_buffer->size();
+ sound_assert(m_end >= m_start);
+ }
+
+ // internal state
+ stream_buffer *m_buffer; // pointer to the stream buffer we're viewing
+ s32 m_end; // ending sample index (always >= start)
+ s32 m_start; // starting sample index
+ sample_t m_gain; // overall gain factor
+};
+
+
+// ======================> write_stream_view
+
+class write_stream_view : public read_stream_view
+{
+public:
+ // empty constructor so we can live in an array or vector
+ write_stream_view()
+ {
+ }
+
+ // constructor that covers the given time period
+ write_stream_view(stream_buffer &buffer, attotime start, attotime end) :
+ read_stream_view(buffer, start, end)
+ {
+ }
+
+ // constructor that converts from a read_stream_view
+ write_stream_view(read_stream_view const &src) :
+ read_stream_view(src)
+ {
+ }
+
+ // safely write a gain-applied sample to the buffer
+ void put(s32 index, sample_t sample)
+ {
+ sound_assert(u32(index) < samples());
+ index += m_start;
+ if (index >= m_buffer->size())
+ index -= m_buffer->size();
+ m_buffer->put(index, sample);
+ }
+
+ // safely add a gain-applied sample to the buffer
+ void add(s32 index, sample_t sample)
+ {
+ sound_assert(u32(index) < samples());
+ index += m_start;
+ if (index >= m_buffer->size())
+ index -= m_buffer->size();
+ m_buffer->put(index, m_buffer->get(index) + sample);
+ }
+
+ // fill part of the view with the given value
+ void fill(sample_t value, s32 start, s32 count)
+ {
+ if (start + count > samples())
+ count = samples() - start;
+ u32 index = start + m_start;
+ for (s32 sampindex = 0; sampindex < count; sampindex++)
+ {
+ m_buffer->put(index, value);
+ index = m_buffer->next_index(index);
+ }
+ }
+ void fill(sample_t value, s32 start) { fill(value, start, samples() - start); }
+ void fill(sample_t value) { fill(value, 0, samples()); }
+
+ // copy data from another view
+ void copy(read_stream_view const &src, s32 start, s32 count)
+ {
+ if (start + count > samples())
+ count = samples() - start;
+ u32 index = start + m_start;
+ for (s32 sampindex = 0; sampindex < count; sampindex++)
+ {
+ m_buffer->put(index, src.get(start + sampindex));
+ index = m_buffer->next_index(index);
+ }
+ }
+ void copy(read_stream_view const &src, s32 start) { copy(src, start, samples() - start); }
+ void copy(read_stream_view const &src) { copy(src, 0, samples()); }
+
+ // add data from another view to our current values
+ void add(read_stream_view const &src, s32 start, s32 count)
+ {
+ if (start + count > samples())
+ count = samples() - start;
+ u32 index = start + m_start;
+ for (s32 sampindex = 0; sampindex < count; sampindex++)
+ {
+ m_buffer->put(index, m_buffer->get(index) + src.get(start + sampindex));
+ index = m_buffer->next_index(index);
+ }
+ }
+ void add(read_stream_view const &src, s32 start) { add(src, start, samples() - start); }
+ void add(read_stream_view const &src) { add(src, 0, samples()); }
+};
+
+
+// ======================> sound_stream_output
+
+class sound_stream_output
+{
+#if (SOUND_DEBUG)
+ friend class sound_stream;
+#endif
+
+public:
+ // construction/destruction
+ sound_stream_output();
+
+ // initialization
+ void init(sound_stream &stream, u32 index, char const *tag_base);
+
+ // no copying allowed
+ sound_stream_output(sound_stream_output const &src) = delete;
+ sound_stream_output &operator=(sound_stream_output const &rhs) = delete;
+
+ // simple getters
+ sound_stream &stream() const { sound_assert(m_stream != nullptr); return *m_stream; }
+ attotime end_time() const { return m_buffer.end_time(); }
+ u32 index() const { return m_index; }
+ stream_buffer::sample_t gain() const { return m_gain; }
+ u32 buffer_sample_rate() const { return m_buffer.sample_rate(); }
+
+ // simple setters
+ void set_gain(float gain) { m_gain = gain; }
+
+ // return a friendly name
+ std::string name() const;
+
+ // handle a changing sample rate
+ void sample_rate_changed(u32 rate) { m_buffer.set_sample_rate(rate, true); }
+
+ // return an output view covering a time period
+ write_stream_view view(attotime start, attotime end) { return write_stream_view(m_buffer, start, end); }
+
+ // resync the buffer to the given end time
+ void set_end_time(attotime end) { m_buffer.set_end_time(end); }
+
+ // attempt to optimize resamplers by reusing them where possible
+ sound_stream_output &optimize_resampler(sound_stream_output *input_resampler);
+
+private:
+ // internal state
+ sound_stream *m_stream; // owning stream
+ stream_buffer m_buffer; // output buffer
+ u32 m_index; // output index within the stream
+ stream_buffer::sample_t m_gain; // gain to apply to the output
+ std::vector<sound_stream_output *> m_resampler_list; // list of resamplers we're connected to
+};
+
+
+// ======================> sound_stream_input
+
+class sound_stream_input
+{
+#if (SOUND_DEBUG)
+ friend class sound_stream;
+#endif
+
+public:
+ // construction/destruction
+ sound_stream_input();
+
+ // initialization
+ void init(sound_stream &stream, u32 index, char const *tag_base, sound_stream_output *resampler);
+
+ // no copying allowed
+ sound_stream_input(sound_stream_input const &src) = delete;
+ sound_stream_input &operator=(sound_stream_input const &rhs) = delete;
+
+ // simple getters
+ bool valid() const { return (m_native_source != nullptr); }
+ sound_stream &owner() const { sound_assert(valid()); return *m_owner; }
+ sound_stream_output &source() const { sound_assert(valid()); return *m_native_source; }
+ u32 index() const { return m_index; }
+ stream_buffer::sample_t gain() const { return m_gain; }
+ stream_buffer::sample_t user_gain() const { return m_user_gain; }
+
+ // simple setters
+ void set_gain(float gain) { m_gain = gain; }
+ void set_user_gain(float gain) { m_user_gain = gain; }
+
+ // return a friendly name
+ std::string name() const;
+
+ // connect the source
+ void set_source(sound_stream_output *source);
+
+ // update and return an reading view
+ read_stream_view update(attotime start, attotime end);
+
+ // tell inputs to apply sample rate changes
+ void apply_sample_rate_changes(u32 updatenum, u32 downstream_rate);
+
+private:
+ // internal state
+ sound_stream *m_owner; // pointer to the owning stream
+ sound_stream_output *m_native_source; // pointer to the native sound_stream_output
+ sound_stream_output *m_resampler_source; // pointer to the resampler output
+ u32 m_index; // input index within the stream
+ stream_buffer::sample_t m_gain; // gain to apply to this input
+ stream_buffer::sample_t m_user_gain; // user-controlled gain to apply to this input
+};
+
+
+// ======================> stream_update_legacy_delegate/stream_update_delegate
+
+// old-style callback; eventually should be deprecated
+using stream_update_legacy_delegate = delegate<void (sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)>;
+
+// new-style callback
+using stream_update_delegate = delegate<void (sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)>;
+
+
+// ======================> sound_stream_flags
+
+enum sound_stream_flags : u32
+{
+ // default is no special flags
+ STREAM_DEFAULT_FLAGS = 0x00,
+
+ // specify that updates should be forced to one sample at a time, in real time
+ // this implicitly creates a timer that runs at the stream's output frequency
+ // so only use when strictly necessary
+ STREAM_SYNCHRONOUS = 0x01,
+
+ // specify that input streams should not be resampled; stream update handler
+ // must be able to accommodate multiple strams of differing input rates
+ STREAM_DISABLE_INPUT_RESAMPLING = 0x02
};
@@ -51,127 +572,143 @@ class sound_stream
{
friend class sound_manager;
- typedef void (*stream_update_func)(device_t *device, sound_stream *stream, void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
-
- // stream output class
- class stream_output
- {
- public:
- // construction/destruction
- stream_output();
- stream_output &operator=(const stream_output &rhs) { assert(false); return *this; }
-
- // internal state
- sound_stream * m_stream; // owning stream
- std::vector<stream_sample_t> m_buffer; // output buffer
- int m_dependents; // number of dependents
- s16 m_gain; // gain to apply to the output
- };
-
- // stream input class
- class stream_input
- {
- public:
- // construction/destruction
- stream_input();
- stream_input &operator=(const stream_input &rhs) { assert(false); return *this; }
-
- // internal state
- stream_output * m_source; // pointer to the sound_output for this source
- std::vector<stream_sample_t> m_resample; // buffer for resampling to the stream's sample rate
- attoseconds_t m_latency_attoseconds; // latency between this stream and the input stream
- s16 m_gain; // gain to apply to this input
- s16 m_user_gain; // user-controlled gain to apply to this input
- };
-
- // constants
- static constexpr int OUTPUT_BUFFER_UPDATES = 5;
- static constexpr u32 FRAC_BITS = 22;
- static constexpr u32 FRAC_ONE = 1 << FRAC_BITS;
- static constexpr u32 FRAC_MASK = FRAC_ONE - 1;
+ // private common constructopr
+ sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, sound_stream_flags flags);
public:
// construction/destruction
- sound_stream(device_t &device, int inputs, int outputs, int sample_rate, stream_update_delegate callback);
+ sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_legacy_delegate callback, sound_stream_flags flags = STREAM_DEFAULT_FLAGS);
+ sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags = STREAM_DEFAULT_FLAGS);
+ virtual ~sound_stream();
- // getters
+ // simple getters
sound_stream *next() const { return m_next; }
device_t &device() const { return m_device; }
- int sample_rate() const { return (m_new_sample_rate != 0xffffffff) ? m_new_sample_rate : m_sample_rate; }
- attotime sample_time() const;
- attotime sample_period() const { return attotime(0, m_attoseconds_per_sample); }
- int input_count() const { return m_input.size(); }
- int output_count() const { return m_output.size(); }
- std::string input_name(int inputnum) const;
- device_t *input_source_device(int inputnum) const;
- int input_source_outputnum(int inputnum) const;
- float user_gain(int inputnum) const;
- float input_gain(int inputnum) const;
- float output_gain(int outputnum) const;
-
- // operations
+ std::string name() const { return m_name; }
+ bool input_adaptive() const { return m_input_adaptive || m_synchronous; }
+ bool output_adaptive() const { return m_output_adaptive; }
+ bool synchronous() const { return m_synchronous; }
+ bool resampling_disabled() const { return m_resampling_disabled; }
+
+ // input and output getters
+ u32 input_count() const { return m_input.size(); }
+ u32 output_count() const { return m_output.size(); }
+ u32 output_base() const { return m_output_base; }
+ sound_stream_input &input(int index) { sound_assert(index >= 0 && index < m_input.size()); return m_input[index]; }
+ sound_stream_output &output(int index) { sound_assert(index >= 0 && index < m_output.size()); return m_output[index]; }
+
+ // sample rate and timing getters
+ u32 sample_rate() const { return (m_pending_sample_rate != SAMPLE_RATE_INVALID) ? m_pending_sample_rate : m_sample_rate; }
+ attotime sample_time() const { return m_output[0].end_time(); }
+ attotime sample_period() const { return attotime(0, sample_period_attoseconds()); }
+ attoseconds_t sample_period_attoseconds() const { return (m_sample_rate != SAMPLE_RATE_INVALID) ? HZ_TO_ATTOSECONDS(m_sample_rate) : ATTOSECONDS_PER_SECOND; }
+
+ // set the sample rate of the stream; will kick in at the next global update
+ void set_sample_rate(u32 sample_rate);
+
+ // connect the output 'outputnum' of given input_stream to this stream's input 'inputnum'
void set_input(int inputnum, sound_stream *input_stream, int outputnum = 0, float gain = 1.0f);
+
+ // force an update to the current time
void update();
- const stream_sample_t *output_since_last_update(int outputnum, int &numsamples);
- // timing
- void set_sample_rate(int sample_rate);
- void set_user_gain(int inputnum, float gain);
- void set_input_gain(int inputnum, float gain);
- void set_output_gain(int outputnum, float gain);
+ // force an update to the current time, returning a view covering the given time period
+ read_stream_view update_view(attotime start, attotime end, u32 outputnum = 0);
+
+ // apply any pending sample rate changes; should only be called by the sound manager
+ void apply_sample_rate_changes(u32 updatenum, u32 downstream_rate);
+
+#if (SOUND_DEBUG)
+ // print one level of the sound graph and recursively tell our inputs to do the same
+ void print_graph_recursive(int indent, int index);
+#endif
+
+protected:
+ // protected state
+ std::string m_name; // name of this stream
private:
- // helpers called by our friends only
- void update_with_accounting(bool second_tick);
- void apply_sample_rate_changes();
+ // perform most of the initialization here
+ void init_common(u32 inputs, u32 outputs, u32 sample_rate, sound_stream_flags flags);
+
+ // if the sample rate has changed, this gets called to update internals
+ void sample_rate_changed();
- // internal helpers
- void recompute_sample_rate_data();
- void allocate_resample_buffers();
- void allocate_output_buffers();
+ // handle updates after a save state load
void postload();
- void generate_samples(int samples);
- stream_sample_t *generate_resampled_data(stream_input &input, u32 numsamples);
+
+ // re-print the synchronization timer
+ void reprime_sync_timer();
+
+ // timer callback for synchronous streams
void sync_update(void *, s32);
+ // new callback which wrapps calls through to the old-style callbacks
+ void stream_update_legacy(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs);
+
+ // return a view of 0 data covering the given time period
+ read_stream_view empty_view(attotime start, attotime end);
+
// linking information
- device_t & m_device; // owning device
- sound_stream * m_next; // next stream in the chain
+ device_t &m_device; // owning device
+ sound_stream *m_next; // next stream in the chain
// general information
- u32 m_sample_rate; // sample rate of this stream
- u32 m_new_sample_rate; // newly-set sample rate for the stream
- bool m_synchronous; // synchronous stream that runs at the rate of its input
-
- // timing information
- attoseconds_t m_attoseconds_per_sample; // number of attoseconds per sample
- s32 m_max_samples_per_update; // maximum samples per update
- emu_timer * m_sync_timer; // update timer for synchronous streams
+ u32 m_sample_rate; // current live sample rate
+ u32 m_pending_sample_rate; // pending sample rate for dynamic changes
+ u32 m_last_sample_rate_update; // update number of last sample rate change
+ bool m_input_adaptive; // adaptive stream that runs at the sample rate of its input
+ bool m_output_adaptive; // adaptive stream that runs at the sample rate of its output
+ bool m_synchronous; // synchronous stream that runs at the rate of its input
+ bool m_resampling_disabled; // is resampling of input streams disabled?
+ emu_timer *m_sync_timer; // update timer for synchronous streams
// input information
- std::vector<stream_input> m_input; // list of streams we directly depend upon
- std::vector<stream_sample_t *> m_input_array; // array of inputs for passing to the callback
-
- // resample buffer information
- u32 m_resample_bufalloc; // allocated size of each resample buffer
+ std::vector<sound_stream_input> m_input; // list of streams we directly depend upon
+ std::vector<stream_sample_t *> m_input_array; // array of inputs for passing to the callback
+ std::vector<read_stream_view> m_input_view; // array of output views for passing to the callback
+ std::vector<std::unique_ptr<sound_stream>> m_resampler_list; // internal list of resamplers
+ stream_buffer m_empty_buffer; // empty buffer for invalid inputs
// output information
- std::vector<stream_output> m_output; // list of streams which directly depend upon us
- std::vector<stream_sample_t *> m_output_array; // array of outputs for passing to the callback
-
- // output buffer information
- u32 m_output_bufalloc; // allocated size of each output buffer
- s32 m_output_sampindex; // current position within each output buffer
- s32 m_output_update_sampindex; // position at time of last global update
- s32 m_output_base_sampindex; // sample at base of buffer, relative to the current emulated second
+ u32 m_output_base; // base index of our outputs, relative to our device
+ std::vector<sound_stream_output> m_output; // list of streams which directly depend upon us
+ std::vector<stream_sample_t *> m_output_array; // array of outputs for passing to the callback
+ std::vector<write_stream_view> m_output_view; // array of output views for passing to the callback
// callback information
- stream_update_delegate m_callback; // callback function
+ stream_update_legacy_delegate m_callback; // callback function
+ stream_update_delegate m_callback_ex; // extended callback function
+};
+
+
+// ======================> default_resampler_stream
+
+class default_resampler_stream : public sound_stream
+{
+public:
+ // construction/destruction
+ default_resampler_stream(device_t &device);
+
+ // update handler
+ void resampler_sound_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs);
+
+private:
+ // internal state
+ u32 m_max_latency;
};
// ======================> sound_manager
+// structure describing an indexed mixer
+struct mixer_input
+{
+ device_mixer_interface *mixer; // owning device interface
+ sound_stream * stream; // stream within the device
+ int inputnum; // input on the stream
+};
+
class sound_manager
{
friend class sound_stream;
@@ -197,56 +734,88 @@ public:
int attenuation() const { return m_attenuation; }
const std::vector<std::unique_ptr<sound_stream>> &streams() const { return m_stream_list; }
attotime last_update() const { return m_last_update; }
- attoseconds_t update_attoseconds() const { return m_update_attoseconds; }
int sample_count() const { return m_samples_this_update; }
- void samples(s16 *buffer);
+ int unique_id() { return m_unique_id++; }
+
+ // allocate a new stream with the old-style callback
+ sound_stream *stream_alloc_legacy(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_legacy_delegate callback);
- // stream creation
- sound_stream *stream_alloc(device_t &device, int inputs, int outputs, int sample_rate, stream_update_delegate callback = stream_update_delegate());
+ // allocate a new stream with a new-style callback
+ sound_stream *stream_alloc(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags);
- // global controls
+ // begin recording a WAV file if options has requested it
void start_recording();
+
+ // stop recording the WAV file
void stop_recording();
- void set_attenuation(int attenuation);
+
+ // set the global OSD attenuation level
+ void set_attenuation(float attenuation);
+
+ // mute sound for one of various independent reasons
void ui_mute(bool turn_off = true) { mute(turn_off, MUTE_REASON_UI); }
void debugger_mute(bool turn_off = true) { mute(turn_off, MUTE_REASON_DEBUGGER); }
void system_mute(bool turn_off = true) { mute(turn_off, MUTE_REASON_SYSTEM); }
void system_enable(bool turn_on = true) { mute(!turn_on, MUTE_REASON_SYSTEM); }
- // user gain controls
+ // return information about the given mixer input, by index
bool indexed_mixer_input(int index, mixer_input &info) const;
+ // fill the given buffer with 16-bit stereo audio samples
+ void samples(s16 *buffer);
+
private:
- // internal helpers
+ // set/reset the mute state for the given reason
void mute(bool mute, u8 reason);
+
+ // helper to remove items from the orphan list
+ void recursive_remove_stream_from_orphan_list(sound_stream *stream);
+
+ // apply pending sample rate changes
+ void apply_sample_rate_changes();
+
+ // reset all sound chips
void reset();
+
+ // pause/resume sound output
void pause();
void resume();
+
+ // handle configuration load/save
void config_load(config_type cfg_type, util::xml::data_node const *parentnode);
void config_save(config_type cfg_type, util::xml::data_node *parentnode);
+ // helper to adjust scale factor toward a goal
+ stream_buffer::sample_t adjust_toward_compressor_scale(stream_buffer::sample_t curscale, stream_buffer::sample_t prevsample, stream_buffer::sample_t rawsample);
+
+ // periodic sound update, called STREAMS_UPDATE_FREQUENCY per second
void update(void *ptr = nullptr, s32 param = 0);
// internal state
- running_machine & m_machine; // reference to our machine
- emu_timer * m_update_timer; // timer to drive periodic updates
-
- u32 m_finalmix_leftover;
- std::vector<s16> m_finalmix;
- std::vector<s32> m_leftmix;
- std::vector<s32> m_rightmix;
- int m_samples_this_update;
-
- u8 m_muted;
- int m_attenuation;
- int m_nosound_mode;
-
- wav_file * m_wavfile;
+ running_machine &m_machine; // reference to the running machine
+ emu_timer *m_update_timer; // timer that runs the update function
+
+ u32 m_update_number; // current update index; used for sample rate updates
+ attotime m_last_update; // time of the last update
+ u32 m_finalmix_leftover; // leftover samples in the final mix
+ u32 m_samples_this_update; // number of samples this update
+ std::vector<s16> m_finalmix; // final mix, in 16-bit signed format
+ std::vector<stream_buffer::sample_t> m_leftmix; // left speaker mix, in native format
+ std::vector<stream_buffer::sample_t> m_rightmix; // right speaker mix, in native format
+
+ stream_buffer::sample_t m_compressor_scale; // current compressor scale factor
+ int m_compressor_counter; // compressor update counter for backoff
+
+ u8 m_muted; // bitmask of muting reasons
+ bool m_nosound_mode; // true if we're in "nosound" mode
+ int m_attenuation; // current attentuation level (at the OSD)
+ int m_unique_id; // unique ID used for stream identification
+ wav_file *m_wavfile; // WAV file for streaming
// streams data
- std::vector<std::unique_ptr<sound_stream>> m_stream_list; // list of streams
- attoseconds_t m_update_attoseconds; // attoseconds between global updates
- attotime m_last_update; // last update time
+ std::vector<std::unique_ptr<sound_stream>> m_stream_list; // list of streams
+ std::map<sound_stream *, u8> m_orphan_stream_list; // list of orphaned streams
+ bool m_first_reset; // is this our first reset?
};
diff --git a/src/emu/speaker.cpp b/src/emu/speaker.cpp
index f5f507d242b..3cbb14355a4 100644
--- a/src/emu/speaker.cpp
+++ b/src/emu/speaker.cpp
@@ -56,38 +56,31 @@ speaker_device::~speaker_device()
// mix - mix in samples from the speaker's stream
//-------------------------------------------------
-void speaker_device::mix(s32 *leftmix, s32 *rightmix, int &samples_this_update, bool suppress)
+void speaker_device::mix(stream_buffer::sample_t *leftmix, stream_buffer::sample_t *rightmix, attotime start, attotime end, int expected_samples, bool suppress)
{
// skip if no stream
if (m_mixer_stream == nullptr)
return;
- // update the stream, getting the start/end pointers around the operation
- int numsamples;
- const stream_sample_t *stream_buf = m_mixer_stream->output_since_last_update(0, numsamples);
-
- // set or assert that all streams have the same count
- if (samples_this_update == 0)
- {
- samples_this_update = numsamples;
+ // skip if invalid range
+ if (start > end)
+ return;
- // reset the mixing streams
- std::fill_n(leftmix, samples_this_update, 0);
- std::fill_n(rightmix, samples_this_update, 0);
- }
- assert(samples_this_update == numsamples);
+ // get a view on the desired range
+ read_stream_view view = m_mixer_stream->update_view(start, end);
+ sound_assert(view.samples() >= expected_samples);
// track maximum sample value for each 0.1s bucket
if (machine().options().speaker_report() != 0)
{
u32 samples_per_bucket = m_mixer_stream->sample_rate() / BUCKETS_PER_SECOND;
- for (int sample = 0; sample < samples_this_update; sample++)
+ for (int sample = 0; sample < expected_samples; sample++)
{
- m_current_max = std::max(m_current_max, abs(stream_buf[sample]));
+ m_current_max = std::max(m_current_max, fabsf(view.get(sample)));
if (++m_samples_this_bucket >= samples_per_bucket)
{
m_max_sample.push_back(m_current_max);
- m_current_max = 0;
+ m_current_max = 0.0f;
m_samples_this_bucket = 0;
}
}
@@ -98,21 +91,22 @@ void speaker_device::mix(s32 *leftmix, s32 *rightmix, int &samples_this_update,
{
// if the speaker is centered, send to both left and right
if (m_x == 0)
- for (int sample = 0; sample < samples_this_update; sample++)
+ for (int sample = 0; sample < expected_samples; sample++)
{
- leftmix[sample] += stream_buf[sample];
- rightmix[sample] += stream_buf[sample];
+ stream_buffer::sample_t cursample = view.get(sample);
+ leftmix[sample] += cursample;
+ rightmix[sample] += cursample;
}
// if the speaker is to the left, send only to the left
else if (m_x < 0)
- for (int sample = 0; sample < samples_this_update; sample++)
- leftmix[sample] += stream_buf[sample];
+ for (int sample = 0; sample < expected_samples; sample++)
+ leftmix[sample] += view.get(sample);
// if the speaker is to the right, send only to the right
else
- for (int sample = 0; sample < samples_this_update; sample++)
- rightmix[sample] += stream_buf[sample];
+ for (int sample = 0; sample < expected_samples; sample++)
+ rightmix[sample] += view.get(sample);
}
}
@@ -143,27 +137,51 @@ void speaker_device::device_stop()
m_max_sample.push_back(m_current_max);
// determine overall maximum and number of clipped buckets
- s32 overallmax = 0;
+ stream_buffer::sample_t overallmax = 0;
u32 clipped = 0;
for (auto &curmax : m_max_sample)
{
overallmax = std::max(overallmax, curmax);
- if (curmax > 32767)
+ if (curmax > stream_buffer::sample_t(1.0))
clipped++;
}
// levels 1 and 2 just get a summary
if (clipped != 0 || report == 2 || report == 4)
- osd_printf_info("Speaker \"%s\" - max = %d (gain *= %.3f) - clipped in %d/%d (%d%%) buckets\n", tag(), overallmax, 32767.0 / (overallmax ? overallmax : 1), clipped, m_max_sample.size(), clipped * 100 / m_max_sample.size());
+ osd_printf_info("Speaker \"%s\" - max = %.5f (gain *= %.3f) - clipped in %d/%d (%d%%) buckets\n", tag(), overallmax, 1 / (overallmax ? overallmax : 1), clipped, m_max_sample.size(), clipped * 100 / m_max_sample.size());
// levels 3 and 4 get a full dump
if (report >= 3)
{
+ static char const * const s_stars = "************************************************************";
+ static char const * const s_spaces = " ";
+ int totalstars = strlen(s_stars);
double t = 0;
+ if (overallmax < 1.0)
+ overallmax = 1.0;
+ int leftstars = totalstars / overallmax;
for (auto &curmax : m_max_sample)
{
- if (curmax > 32767 || report == 4)
- osd_printf_info(" t=%5.1f max=%6d\n", t, curmax);
+ if (curmax > stream_buffer::sample_t(1.0) || report == 4)
+ {
+ osd_printf_info("%6.1f: %9.5f |", t, curmax);
+ if (curmax == 0)
+ osd_printf_info("%.*s|\n", leftstars, s_spaces);
+ else if (curmax <= 1.0)
+ {
+ int stars = std::max(1, std::min(leftstars, int(curmax * totalstars / overallmax)));
+ osd_printf_info("%.*s", stars, s_stars);
+ int spaces = leftstars - stars;
+ if (spaces != 0)
+ osd_printf_info("%.*s", spaces, s_spaces);
+ osd_printf_info("|\n");
+ }
+ else
+ {
+ int rightstars = std::max(1, std::min(totalstars, int(curmax * totalstars / overallmax)) - leftstars);
+ osd_printf_info("%.*s|%.*s\n", leftstars, s_stars, rightstars, s_stars);
+ }
+ }
t += 1.0 / double(BUCKETS_PER_SECOND);
}
}
diff --git a/src/emu/speaker.h b/src/emu/speaker.h
index 7cf27d12471..fd20c4b94b8 100644
--- a/src/emu/speaker.h
+++ b/src/emu/speaker.h
@@ -69,7 +69,7 @@ public:
speaker_device &backrest() { set_position( 0.0, -0.2, 0.1); return *this; }
// internally for use by the sound system
- void mix(s32 *leftmix, s32 *rightmix, int &samples_this_update, bool suppress);
+ void mix(stream_buffer::sample_t *leftmix, stream_buffer::sample_t *rightmix, attotime start, attotime end, int expected_samples, bool suppress);
protected:
// device-level overrides
@@ -77,20 +77,20 @@ protected:
virtual void device_stop() override ATTR_COLD;
// inline configuration state
- double m_x;
- double m_y;
- double m_z;
+ double m_x;
+ double m_y;
+ double m_z;
// internal state
static constexpr int BUCKETS_PER_SECOND = 10;
- std::vector<s32> m_max_sample;
- s32 m_current_max;
- u32 m_samples_this_bucket;
+ std::vector<stream_buffer::sample_t> m_max_sample;
+ stream_buffer::sample_t m_current_max;
+ u32 m_samples_this_bucket;
};
// speaker device iterator
-typedef device_type_iterator<speaker_device> speaker_device_iterator;
+using speaker_device_iterator = device_type_iterator<speaker_device>;
#endif // MAME_EMU_SPEAKER_H
diff --git a/src/emu/xtal.cpp b/src/emu/xtal.cpp
index 5b8b763ab2f..ca69a8c54f9 100644
--- a/src/emu/xtal.cpp
+++ b/src/emu/xtal.cpp
@@ -336,6 +336,7 @@ const double XTAL::known_xtals[] = {
25'771'500, /* 25.7715_MHz_XTAL HP-2622A */
25'920'000, /* 25.92_MHz_XTAL ADDS Viewpoint 60 */
26'000'000, /* 26_MHz_XTAL Gaelco PCBs */
+ 26'195'000, /* 26.195_MHz_XTAL Roland JD-800 */
26'366'000, /* 26.366_MHz_XTAL DEC VT320 */
26'580'000, /* 26.58_MHz_XTAL Wyse WY-60 80-column display clock */
26'590'906, /* 26.590906_MHz_XTAL Atari Jaguar NTSC */
@@ -353,6 +354,7 @@ const double XTAL::known_xtals[] = {
27'720'000, /* 27.72_MHz_XTAL AT&T 610 132-column display clock */
27'956'000, /* 27.956_MHz_XTAL CIT-101e 132-column display clock */
28'000'000, /* 28_MHz_XTAL - */
+ 28'224'000, /* 28.224_MHz_XTAL Roland JD-800 */
28'322'000, /* 28.322_MHz_XTAL Saitek RISC 2500, Mephisto Montreux */
28'375'160, /* 28.37516_MHz_XTAL Amiga PAL systems */
28'475'000, /* 28.475_MHz_XTAL CoCo 3 PAL */
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index 8e7ad2665be..4f44c3ad9d4 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -1171,7 +1171,7 @@ void lua_engine::initialize()
item_type.set("read", [this](save_item &item, int offset) -> sol::object {
if(!item.base || (offset >= item.count))
return sol::make_object(sol(), sol::nil);
- const void *const data = reinterpret_cast<const uint8_t *>(item.base) + (item.size * item.stride * (offset / item.valcount));
+ const void *const data = reinterpret_cast<const uint8_t *>(item.base) + (item.stride * (offset / item.valcount));
uint64_t ret = 0;
switch(item.size)
{
@@ -1199,7 +1199,6 @@ void lua_engine::initialize()
else
{
const uint32_t blocksize = item.size * item.valcount;
- const uint32_t bytestride = item.size * item.stride;
uint32_t remaining = buff->get_len();
uint8_t *dest = reinterpret_cast<uint8_t *>(buff->get_ptr());
while(remaining)
@@ -1207,7 +1206,7 @@ void lua_engine::initialize()
const uint32_t blockno = offset / blocksize;
const uint32_t available = blocksize - (offset % blocksize);
const uint32_t chunk = (available < remaining) ? available : remaining;
- const void *const source = reinterpret_cast<const uint8_t *>(item.base) + (blockno * bytestride) + (offset % blocksize);
+ const void *const source = reinterpret_cast<const uint8_t *>(item.base) + (blockno * item.stride) + (offset % blocksize);
std::memcpy(dest, source, chunk);
offset += chunk;
remaining -= chunk;
@@ -1219,7 +1218,7 @@ void lua_engine::initialize()
item_type.set("write", [](save_item &item, int offset, uint64_t value) {
if(!item.base || (offset >= item.count))
return;
- void *const data = reinterpret_cast<uint8_t *>(item.base) + (item.size * item.stride * (offset / item.valcount));
+ void *const data = reinterpret_cast<uint8_t *>(item.base) + (item.stride * (offset / item.valcount));
switch(item.size)
{
case 1:
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index 40a5651430d..ff16d117117 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -1524,7 +1524,7 @@ std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine
int32_t maxval = 2000;
int32_t defval = 1000;
- std::string str = string_format(_("%1$s Volume"), info.stream->input_name(info.inputnum));
+ std::string str = string_format(_("%1$s Volume"), info.stream->input(info.inputnum).name());
m_sliders.push_back(slider_alloc(SLIDER_ID_MIXERVOL + item, str.c_str(), 0, defval, maxval, 20, (void *)(uintptr_t)item));
}
@@ -1762,13 +1762,13 @@ int32_t mame_ui_manager::slider_mixervol(running_machine &machine, void *arg, in
return 0;
if (newval != SLIDER_NOCHANGE)
{
- int32_t curval = floor(info.stream->user_gain(info.inputnum) * 1000.0f + 0.5f);
+ int32_t curval = floor(info.stream->input(info.inputnum).user_gain() * 1000.0f + 0.5f);
if (newval > curval && (newval - curval) <= 4) newval += 4; // round up on increment
- info.stream->set_user_gain(info.inputnum, (float)newval * 0.001f);
+ info.stream->input(info.inputnum).set_user_gain((float)newval * 0.001f);
}
if (str)
- *str = string_format("%4.2f", info.stream->user_gain(info.inputnum));
- return floorf(info.stream->user_gain(info.inputnum) * 1000.0f + 0.5f);
+ *str = string_format("%4.2f", info.stream->input(info.inputnum).user_gain());
+ return floorf(info.stream->input(info.inputnum).user_gain() * 1000.0f + 0.5f);
}
diff --git a/src/lib/formats/p2000t_cas.cpp b/src/lib/formats/p2000t_cas.cpp
new file mode 100644
index 00000000000..e3351dc99dc
--- /dev/null
+++ b/src/lib/formats/p2000t_cas.cpp
@@ -0,0 +1,321 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+
+#include <cassert>
+
+#include "cassimg.h"
+#include "p2000t_cas.h"
+#include <ostream>
+
+// This code will reproduce the timing of a P2000 mini cassette tape.
+constexpr double P2000_CLOCK_PERIOD = 0.000084;
+constexpr double P2000_BOT_GAP = 1;
+constexpr double P2000_BOB_GAP = 0.515;
+constexpr double P2000_MARK_GAP = 0.085;
+constexpr double P2000_END_GAP = 0.155;
+constexpr double P2000_EOT_GAP = 1.8;
+constexpr int P2000_HIGH = 0x7FFFFFFF;
+constexpr int P2000_LOW = -1 * 0x7FFFFFFF;
+
+
+#define CHR(x) \
+ err = (x); \
+ if (err != cassette_image::error::SUCCESS) \
+ return err;
+
+/*
+Here's a description on how the P2000t stores data on tape.
+
+## Tape Format
+
+Each track (or side) of a cassette is divided into 40 block of information. A
+file may comprise between 1 and 40 blocks, depending on its length.
+
+## Blocks, Gaps, Marks and Records
+
+At the start of the tape is an area of clear (erased) tape, the BOT (beginning
+of tape) gap; to read pas this gap takes approximately 1 second. After this, the
+first block starts, followed directly by the second, third and so on. After the
+last block on the track comes the EOT (end of tape) gap; if all 40 blocks on the
+tracks are used, this area of erased tape has a length equivalent to 1.8 seconds
+of reading time.
+
+ | BOT | BLOCK 1 | BLOCK 2 | BLOCK ... | EOT |
+
+### BLOCK
+
+Each tape block is made up of five sections of tape:
+
+| START GAP | MARK | MARK GAP | DATA RECORD | END GAP |
+
+- Start gap: A section of erased tape separating the start of one block from the
+ end of the previous block. This takes approx. 515ms to read over.
+- Mark: Four bytes of recorded information (described below)
+- Mark Gap: A section of erased tape separating the mark from the data record;
+ length about 85ms.
+- Data Record: 1056 bytes of recorded data (described below)
+- End Gap: A section of erased tape of around 155 ms.
+
+### MARK
+
+The mark is made up of four bytes with the following bit patterns:
+
+ - preamble syncronization pattern (0xAA)
+ - 0000 0000 (0x00)
+ - 0000 0000 (0x00)
+ - postamble syncronization pattern (0xAA)
+
+The function of the synchronisation byte is to make sure the RDC clock is set
+properly.
+
+### DATA RECORD
+
+The data record contains the information which has been written onto the tape.
+It compromises five sections:
+
+| sync byte | header | data | check sum | post sync |
+
+- sync byte: Preamble synchronisation pattern 0xAA
+- header: 32 bytes which specify the contents and type of the data section. (See below)
+- data section: 1024 bytes of information.
+- checksum: 2 bytes that contain checksum
+- post sync: 0xAA
+
+### HEADER
+
+See the struct declaration below for details on what is contained.
+
+### DATA
+
+The data section consists of 1024 bytes written in serial form, least
+significant byte first.
+
+### Checksum
+
+The checksum is only calculated for the header and data section. The algorithm
+is not documented, an implementation can be found below.
+*/
+
+// Specifies the type of data stored in the tape block
+enum P2000_File_Type : uint8_t
+{
+ Basic = 'B',
+ Program = 'P',
+ Viewdata = 'V',
+ WordProcessing = 'W',
+ Other = 'O',
+};
+
+// Represents the internal code for data, differrent codes are used in different countries
+// only relevant when P2000_File_Type is Program.
+enum P2000_Data_Type : uint8_t
+{
+ German = 'D',
+ Swedish = 'S',
+ Dutch_English = 'U',
+};
+
+
+// This is the 32 byte header definition used by the P2000, it is mainly
+// here for documentation.
+struct P2000T_Header
+{
+ // Starting address in ram where data should go. This address is supplied by
+ // the application program when calling the monitor cassette routine to write
+ // the data on cassette in the first place.
+ uint16_t data_transfer_address;
+ // Total # of bytes which make up the file (can be spread over many blocks).
+ // The monitor uses this to determine how many blocks to read.
+ uint16_t file_length;
+ // # bytes in this record that are actually used. For example if this is 256
+ // only 256 bytes will be loaded in ram
+ uint16_t data_section_length;
+ // The eight character file name identifies the file to which the record
+ // belongs; it will be the same in all records making up the file. Each record
+ // except the first is considered an extension.
+ char file_name[8];
+ // Addition file extension.
+ char ext[3];
+ // This file type specifies the type of data stored.
+ P2000_File_Type file_type;
+ // Code and region information.
+ P2000_Data_Type data_code;
+ // Start address where program should start. (if type = Program)
+ uint16_t start_addr;
+ // Address in ram where the program should load (if type = Program)
+ uint16_t load_addr;
+ // Unused.
+ char reserved[8];
+ // Record number (i.e. which block)
+ uint8_t rec_nr;
+};
+
+std::ostream &operator<<(std::ostream &os, P2000T_Header const &hdr)
+{
+ return os << "File: " << std::string(hdr.file_name, 8) << '.'
+ << std::string(hdr.ext, 3) << " " << hdr.file_length;
+}
+
+static cassette_image::error p2000t_cas_identify(cassette_image *cass, struct CassetteOptions *opts)
+{
+ opts->bits_per_sample = 32;
+ opts->channels = 1;
+ opts->sample_frequency = 44100;
+ return cassette_image::error::SUCCESS;
+}
+
+uint16_t rotr16a(uint16_t x, uint16_t n)
+{
+ return (x >> n) | (x << (16 - n));
+}
+
+void update_chksum(uint16_t *de, bool bit)
+{
+ // Reverse engineered from monitor.rom
+ // code is at: [0x07ac, 0x07c5]
+ uint8_t e = *de & 0xff;
+ uint8_t d = (*de >> 8) & 0xff;
+ e = e ^ (bit ? 1 : 0);
+ if (e & 0x01)
+ {
+ e = e ^ 2;
+ d = d ^ 0x40;
+ }
+ else
+ {
+ d = d ^ 0x00;
+ }
+ *de = rotr16a((d << 8) | e, 1);
+}
+
+/*
+ A transition on a clock boundary from low to high is a 1.
+ A transition on a clock boundary from high to low is a 0
+ An intermediate transition halfway between the clock boundary
+ can occur when there are consecutive 0s or 1s. See the example
+ below where the clock is marked by a |
+
+
+ 1 0 1 1 0 0
+ RDA: _|----|____|--__|----|__--|__--
+ RDC: _|-___|-___|-___|-___|-___|-___
+ ^ ^
+ |-- clock signal |-- intermediate transition.
+
+ This signal can be written by a simple algorithm where the first bit
+ is always false (transition to low, half clock). Now only one bit is needed
+ to determine what the next partial clock should look like.
+
+ This works because we are always guaranteed that a block starts with 0xAA,
+ and hence will ALWAYS find a signal like this on tape: _-- (low, high, high)
+ after a gap. This is guaranteed when the tape is moving forward as well as
+ backwards.
+*/
+cassette_image::error p2000t_put_bit(cassette_image *cass, double *time_index, bool bit)
+{
+ const int channel = 0;
+ cassette_image::error err = cassette_image::error::SUCCESS;
+ CHR(cassette_put_sample(cass, channel, *time_index, P2000_CLOCK_PERIOD, bit ? P2000_HIGH : P2000_LOW));
+ *time_index += P2000_CLOCK_PERIOD;
+
+ CHR(cassette_put_sample(cass, channel, *time_index, P2000_CLOCK_PERIOD, bit ? P2000_LOW : P2000_HIGH));
+ *time_index += P2000_CLOCK_PERIOD;
+ return err;
+}
+
+// Store byte of data, updating the checksum
+cassette_image::error p2000t_put_byte(cassette_image *cass, double *time_index, uint16_t *chksum, uint8_t byte)
+{
+ cassette_image::error err = cassette_image::error::SUCCESS;
+ for (int i = 0; i < 8 && err == cassette_image::error::SUCCESS; i++)
+ {
+ update_chksum(chksum, util::BIT(byte, i));
+ CHR(p2000t_put_bit(cass, time_index, util::BIT(byte, i)));
+ }
+ return err;
+}
+
+// Store a sequence of bytes, updating the checksum
+cassette_image::error p2000t_put_bytes(cassette_image *cass, double *time_index, uint16_t *chksum, const uint8_t *bytes, const uint16_t cByte)
+{
+ cassette_image::error err = cassette_image::error::SUCCESS;
+ for (int i = 0; i < cByte && err == cassette_image::error::SUCCESS; i++)
+ {
+ CHR(p2000t_put_byte(cass, time_index, chksum, bytes[i]));
+ }
+ return err;
+}
+
+// Insert time seconds of silence.
+cassette_image::error p2000t_silence(cassette_image *cassette,
+double *time_index,
+double time)
+{
+ auto err = cassette_put_sample(cassette, 0, *time_index, time, 0);
+ *time_index += time;
+ return err;
+}
+
+static cassette_image::error p2000t_cas_load(cassette_image *cassette)
+{
+ cassette_image::error err = cassette_image::error::SUCCESS;
+ uint64_t image_size = cassette_image_size(cassette);
+ constexpr int CAS_BLOCK = 1280;
+
+ /*
+ The cas format is pretty simple. it consists of a sequence of blocks,
+ where a block consists of the following:
+
+ [0-256] P2000 memory address 0x6000 - 0x6100
+ .... Nonsense (keyboard status etc.)
+ 0x30 P200T_Header
+ 0x50
+ ... Nonsense..
+ [0-1024] Data block
+
+ This means that one block gets stored in 1280 bytes.
+ */
+ if (image_size % CAS_BLOCK != 0)
+ {
+ return cassette_image::error::INVALID_IMAGE;
+ }
+
+ uint8_t block[CAS_BLOCK];
+ constexpr uint8_t BLOCK_MARK[4] = { 0xAA, 0x00, 0x00, 0xAA };
+ auto blocks = image_size / CAS_BLOCK;
+ double time_idx = 0;
+
+ // Beginning of tape marker
+ CHR(p2000t_silence(cassette, &time_idx, P2000_BOT_GAP));
+ for (int i = 0; i < blocks; i++)
+ {
+ uint16_t crc = 0, unused = 0;
+ cassette_image_read(cassette, &block, CAS_BLOCK * i, CAS_BLOCK);
+
+ // Insert sync header.. 0xAA, 0x00, 0x00, 0xAA
+ CHR(p2000t_silence(cassette, &time_idx, P2000_BOB_GAP));
+ CHR(p2000t_put_bytes(cassette, &time_idx, &unused, BLOCK_MARK, ARRAY_LENGTH(BLOCK_MARK)));
+ CHR(p2000t_silence(cassette, &time_idx, P2000_MARK_GAP));
+
+ // Insert data block
+ CHR(p2000t_put_byte(cassette, &time_idx, &unused, 0xAA));
+ CHR(p2000t_put_bytes(cassette, &time_idx, &crc, block + 0x30, 32));
+ CHR(p2000t_put_bytes(cassette, &time_idx, &crc, block + 256, 1024));
+ CHR(p2000t_put_bytes(cassette, &time_idx, &unused, ( uint8_t * )&crc, 2));
+ CHR(p2000t_put_byte(cassette, &time_idx, &unused, 0xAA));
+
+ // Block finished.
+ CHR(p2000t_silence(cassette, &time_idx, P2000_END_GAP));
+ }
+
+ // End of tape marker
+ return p2000t_silence(cassette, &time_idx, P2000_EOT_GAP);
+}
+
+static const struct CassetteFormat p2000t_cas = {
+ "cas", p2000t_cas_identify, p2000t_cas_load, nullptr /* no save */
+};
+
+CASSETTE_FORMATLIST_START(p2000t_cassette_formats)
+CASSETTE_FORMAT(p2000t_cas)
+CASSETTE_FORMATLIST_END
diff --git a/src/lib/formats/p2000t_cas.h b/src/lib/formats/p2000t_cas.h
new file mode 100644
index 00000000000..6d63e314a33
--- /dev/null
+++ b/src/lib/formats/p2000t_cas.h
@@ -0,0 +1,19 @@
+// license:BSD-3-Clause
+// copyright-holders:Erwin Jansen
+/*********************************************************************
+
+ p2000t_cas.h
+
+ Format code for P2000t .cas cassette files.
+
+*********************************************************************/
+#ifndef MAME_FORMATS_P2000T_CAS_H
+#define MAME_FORMATS_P2000T_CAS_H
+
+#pragma once
+
+#include "cassimg.h"
+
+CASSETTE_FORMATLIST_EXTERN(p2000t_cassette_formats);
+
+#endif // MAME_FORMATS_P2000T_CAS_H
diff --git a/src/lib/netlist/analog/nld_generic_models.h b/src/lib/netlist/analog/nld_generic_models.h
index 781dc2a16bb..bb8adc466eb 100644
--- a/src/lib/netlist/analog/nld_generic_models.h
+++ b/src/lib/netlist/analog/nld_generic_models.h
@@ -9,7 +9,6 @@
///
#include "nl_base.h"
-//#include "../nl_setup.h"
//
// Set to 0 to use a linearized diode model in the range exceeding
diff --git a/src/lib/netlist/core/setup.h b/src/lib/netlist/core/setup.h
index 61ab79de545..8b8a49dbc34 100644
--- a/src/lib/netlist/core/setup.h
+++ b/src/lib/netlist/core/setup.h
@@ -340,25 +340,6 @@ namespace netlist
pstring m_setup_func_name;
};
- class source_token_t : public source_netlist_t
- {
- public:
- source_token_t(const pstring &name, const parser_t::token_store &store)
- : m_store(store)
- , m_name(name)
- {
- }
-
- bool parse(nlparse_t &setup, const pstring &name) override;
-
- protected:
- plib::istream_uptr stream(const pstring &name) override;
-
- private:
- parser_t::token_store m_store;
- pstring m_name;
- };
-
} // namespace netlist
diff --git a/src/lib/netlist/devices/net_lib.h b/src/lib/netlist/devices/net_lib.h
index db3f9c1519d..1a8b72fcd5a 100644
--- a/src/lib/netlist/devices/net_lib.h
+++ b/src/lib/netlist/devices/net_lib.h
@@ -28,8 +28,6 @@
#define IND_P(ind) ((ind) * 1e-12)
#endif
-NETLIST_EXTERNAL(base_lib)
-
#include "../generated/nld_devinc.h"
diff --git a/src/lib/netlist/generated/nlm_modules_lib.cpp b/src/lib/netlist/generated/nlm_modules_lib.cpp
index d9fe63979d9..7f91075ac40 100755
--- a/src/lib/netlist/generated/nlm_modules_lib.cpp
+++ b/src/lib/netlist/generated/nlm_modules_lib.cpp
@@ -1,12 +1,14 @@
// license:CC0
// copyright-holders:Couriersud
-// File programmatically created Sat Sep 12 14:42:49 2020
+// File programmatically created Sun Sep 13 20:49:39 2020
#include "devices/net_lib.h"
NETLIST_START(modules_lib)
+ EXTERNAL_LIB_ENTRY(ICL8038_DIP)
+ EXTERNAL_LIB_ENTRY(NE556_DIP)
EXTERNAL_LIB_ENTRY(RTEST)
NETLIST_END()
diff --git a/src/lib/netlist/generated/static_solvers.cpp b/src/lib/netlist/generated/static_solvers.cpp
index 8c3173b98d2..367af35bbb9 100644
--- a/src/lib/netlist/generated/static_solvers.cpp
+++ b/src/lib/netlist/generated/static_solvers.cpp
@@ -1,5 +1,7 @@
#include "plib/pdynlib.h"
+#if !defined(__EMSCRIPTEN__)
+
// elim
static void nl_gcr_11c2ae166b240b6e_10_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV)
@@ -72411,8 +72413,12 @@ static void nl_gcr_feae15b80dd73620_7_double_double(double * __restrict V, const
V[0] = (RHS0 - tmp0) / m_A0;
}
+#endif
+
extern const plib::dynlib_static_sym nl_static_solver_syms[];
const plib::dynlib_static_sym nl_static_solver_syms[] = {
+#if !defined(__EMSCRIPTEN__)
+
// elim
{"nl_gcr_11c2ae166b240b6e_10_double_double", reinterpret_cast<void *>(&nl_gcr_11c2ae166b240b6e_10_double_double)},
// tankbatt
@@ -72809,5 +72815,7 @@ const plib::dynlib_static_sym nl_static_solver_syms[] = {
{"nl_gcr_fd2796828f1ebd00_36_double_double", reinterpret_cast<void *>(&nl_gcr_fd2796828f1ebd00_36_double_double)},
// starfire
{"nl_gcr_feae15b80dd73620_7_double_double", reinterpret_cast<void *>(&nl_gcr_feae15b80dd73620_7_double_double)},
+#endif
+
{"", nullptr}
};
diff --git a/src/lib/netlist/macro/modules/nlmod_ICL8038_DIP.cpp b/src/lib/netlist/macro/modules/nlmod_ICL8038_DIP.cpp
new file mode 100644
index 00000000000..05a4d300099
--- /dev/null
+++ b/src/lib/netlist/macro/modules/nlmod_ICL8038_DIP.cpp
@@ -0,0 +1,61 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+
+#include "devices/net_lib.h"
+
+//
+// ICL8038 is broadly similar to a 566 VCO, and can be simulated partially as such.
+//
+
+NETLIST_START(ICL8038_DIP)
+ VCVS(VI, 1)
+ CCCS(CI1, -1)
+ CCCS(CI2, 2)
+ SYS_COMPD(COMP)
+ SYS_DSW2(SW)
+ VCVS(VO, 1)
+ RES(R_SHUNT, RES_R(50))
+
+ PARAM(VO.RO, 50)
+ PARAM(COMP.MODEL, "FAMILY(TYPE=CUSTOM IVL=0.16 IVH=0.4 OVL=0.01 OVH=0.01 ORL=50 ORH=50)")
+ PARAM(SW.GOFF, 0) // This has to be zero to block current sources
+
+ NET_C(VI.OP, CI1.IN, CI2.IN)
+ NET_C(CI1.OP, VO.IP)
+ NET_C(COMP.Q, SW.I)
+ NET_C(CI2.OP, SW.2)
+ NET_C(COMP.VCC, R_SHUNT.1)
+ NET_C(SW.1, R_SHUNT.2)
+ NET_C(SW.3, VO.IP)
+ NET_C(VO.OP, COMP.IN)
+
+ // Avoid singular Matrix due to G=0 switch
+ RES(RX1, 1e10)
+ RES(RX2, 1e10)
+ NET_C(RX1.1, SW.1)
+ NET_C(RX2.1, SW.3)
+
+ NET_C(COMP.GND, RX1.2, RX2.2)
+
+ RES(R1, 5000)
+ RES(R2, 5000)
+ RES(R3, 5000)
+
+ // Square output wave
+ VCVS(V_SQR, 1)
+ NET_C(COMP.Q, V_SQR.IP)
+
+ NET_C(COMP.GND, SW.GND, VI.ON, VI.IN, CI1.ON, CI2.ON, VO.IN, VO.ON, R2.2, V_SQR.IN, V_SQR.ON)
+ NET_C(COMP.VCC, SW.VCC, R1.2)
+ NET_C(COMP.IP, R1.1, R2.1, R3.1)
+ NET_C(COMP.Q, R3.2)
+
+ ALIAS(11, VI.ON) // GND
+ ALIAS(9, V_SQR.OP) // Square out
+ ALIAS(3, VO.OP) // Triag out
+ ALIAS(8, VI.IP) // VC
+ ALIAS(4, CI1.IP) // R1
+ ALIAS(5, CI2.IP) // R2
+ ALIAS(10, VO.IP) // C1
+ ALIAS(6, COMP.VCC) // V+
+NETLIST_END()
diff --git a/src/lib/netlist/macro/modules/nlmod_NE556_DIP.cpp b/src/lib/netlist/macro/modules/nlmod_NE556_DIP.cpp
new file mode 100644
index 00000000000..7f278a18b6d
--- /dev/null
+++ b/src/lib/netlist/macro/modules/nlmod_NE556_DIP.cpp
@@ -0,0 +1,24 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+//
+
+#include "devices/net_lib.h"
+
+NETLIST_START(NE556_DIP)
+ NE555(A)
+ NE555(B)
+
+ NET_C(A.GND, B.GND)
+ NET_C(A.VCC, B.VCC)
+
+ DIPPINS( /* +--------------+ */
+ A.DISCH, /* 1DISCH |1 ++ 14| VCC */ A.VCC,
+ A.THRESH, /* 1THRES |2 13| 2DISCH */ B.DISCH,
+ A.CONT, /* 1CONT |3 12| 2THRES */ B.THRESH,
+ A.RESET, /* 1RESET |4 NE556 11| 2CONT */ B.CONT,
+ A.OUT, /* 1OUT |5 10| 2RESET */ B.RESET,
+ A.TRIG, /* 1TRIG |6 9| 2OUT */ B.OUT,
+ A.GND, /* GND |7 8| 2TRIG */ B.TRIG
+ /* +--------------+ */
+ )
+NETLIST_END()
diff --git a/src/lib/netlist/macro/nlm_base_lib.cpp b/src/lib/netlist/macro/nlm_base_lib.cpp
index c5f4c7c695b..b9c4165a46b 100644
--- a/src/lib/netlist/macro/nlm_base_lib.cpp
+++ b/src/lib/netlist/macro/nlm_base_lib.cpp
@@ -13,6 +13,7 @@ static NETLIST_START(diode_models)
// FIXME: 1N916 currently only a copy of 1N914!
NET_MODEL("1N916 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)")
NET_MODEL("1N4001 D(Is=14.11n N=1.984 Rs=33.89m Ikf=94.81 Xti=3 Eg=1.11 Cjo=25.89p M=.44 Vj=.3245 Fc=.5 Bv=75 Ibv=10u Tt=5.7u Iave=1 Vpk=50 mfg=GI type=silicon)")
+ NET_MODEL("1N4002 D(IS=65.4p RS=42.2m BV=100 IBV=5.00u CJO=14.8p M=0.333 N=1.36 TT=2.88u)")
NET_MODEL("1N4148 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)")
NET_MODEL("1N4154 D(Is=0.1n Rs=4 N=1.67 Cjo=2p M=.333 tt=3n Iave=150m Vpk=35 Bv=60 Ibv=0.1p mfg=Vishay type=silicon)")
NET_MODEL("1N4454 D(Is=168.1e-21 Rs=.1 N=1 Cjo=2p M=.333 tt=5.771n Iave=400m Vpk=35 Bv=75 Ibv=100u mfg=OnSemi type=silicon)")
@@ -25,6 +26,15 @@ static NETLIST_START(diode_models)
NET_MODEL("LedBlue D(IS=93.2p RS=42M N=7.47 BV=5 IBV=10U CJO=2.97P VJ=.75 M=.333 TT=4.32U Iave=40m Vpk=5 type=LED)")
NET_MODEL("LedWhite D(Is=0.27n Rs=5.65 N=6.79 Cjo=42p Iave=30m Vpk=5 type=LED)")
+ // Zdiodes ...
+
+ // not really found anywhere, just took the 5239 and changed the
+ // breakdown voltage to 5.1 according to the datasheet
+ NET_MODEL("1N5231 D(BV=5.1 IBV=0.020 NBV=1)")
+ NET_MODEL("1N5236B D(BV=7.5 IS=27.5p RS=33.8 N=1.10 CJO=58.2p VJ=0.750 M=0.330 TT=50.1n)")
+ NET_MODEL("1N5240 D(BV=10 IS=14.4p RS=32.0 N=1.10 CJO=24.1p VJ=0.750 M=0.330 TT=50.1n)")
+ NET_MODEL("1N5240B D(BV=10 IS=14.4p RS=32.0 N=1.10 CJO=24.1p VJ=0.750 M=0.330 TT=50.1n)")
+
NETLIST_END()
/* ----------------------------------------------------------------------------
@@ -58,13 +68,24 @@ static NETLIST_START(bjt_models)
NET_MODEL("2N3644 PNP(IS=650.6E-18 ISE=54.81E-15 ISC=0 XTI=3 BF=231.7 BR=3.563 IKF=1.079 IKR=0 XTB=1.5 VAF=115.7 VAR=35 VJE=0.65 VJC=0.65 RE=0.15 RC=0.715 RB=10 CJE=19.82E-12 CJC=14.76E-12 XCJC=0.75 FC=0.5 NF=1 NR=1 NE=1.829 NC=2 MJE=0.3357 MJC=0.5383 TF=603.7E-12 TR=111.3E-9 ITF=0.65 VTF=5 XTF=1.7 EG=1.11 KF=0 AF=1 VCEO=60 ICRATING=500m MFG=NSC)")
NET_MODEL("2N3702 PNP(Is=650.6E-18 Xti=3 Eg=1.11 Vaf=115.7 Bf=133.8 Ne=1.832 Ise=97.16f Ikf=1.081 Xtb=1.5 Br=3.73 Nc=2 Isc=0 Ikr=0 Rc=.715 Cjc=14.76p Mjc=.5383 Vjc=.75 Fc=.5 Cje=19.82p Mje=.3357 Vje=.75 Tr=114.1n Tf=761.3p Itf=.65 Vtf=5 Xtf=1.7 Rb=10 mfg=National)")
NET_MODEL("2N3704 NPN(IS=26.03f VAF=90.7 Bf=736.1K IKF=.1983 XTB=1.5 BR=1.024 CJC=11.01p CJE=24.07p RB=10 RC=.5 RE=.5 TR=233.8n TF=1.03n ITF=0 VTF=0 XTF=0 mfg=Motorola)")
+ // SPICE model parameters taken from Fairchild Semiconductor datasheet
NET_MODEL("2N3904 NPN(IS=1E-14 VAF=100 Bf=300 IKF=0.4 XTB=1.5 BR=4 CJC=4E-12 CJE=8E-12 RB=20 RC=0.1 RE=0.1 TR=250E-9 TF=350E-12 ITF=1 VTF=2 XTF=3 Vceo=40 Icrating=200m mfg=Philips)")
+ // SPICE model parameters taken from Fairchild Semiconductor datasheet
+ NET_MODEL("2N3906 PNP(Is=1.41f Xti=3 Eg=1.11 Vaf=18.7 Bf=180.7 Ne=1.5 Ise=0 Ikf=80m Xtb=1.5 Br=4.977 Nc=2 Isc=0 Ikr=0 Rc=2.5 Cjc=9.728p Mjc=.5776 Vjc=.75 Fc=.5 Cje=8.063p Mje=.3677 Vje=.75 Tr=33.42n Tf=179.3p Itf=.4 Vtf=4 Xtf=6 Rb=10)")
// 2N5190 = BC817-25
NET_MODEL("2N5190 NPN(IS=9.198E-14 NF=1.003 ISE=4.468E-16 NE=1.65 BF=338.8 IKF=0.4913 VAF=107.9 NR=1.002 ISC=5.109E-15 NC=1.071 BR=29.48 IKR=0.193 VAR=25 RB=1 IRB=1000 RBM=1 RE=0.2126 RC=0.143 XTB=0 EG=1.11 XTI=3 CJE=3.825E-11 VJE=0.7004 MJE=0.364 TF=5.229E-10 XTF=219.7 VTF=3.502 ITF=7.257 PTF=0 CJC=1.27E-11 VJC=0.4431 MJC=0.3983 XCJC=0.4555 TR=7E-11 CJS=0 VJS=0.75 MJS=0.333 FC=0.905 Vceo=45 Icrating=500m mfg=Philips)")
NET_MODEL("2N4401 NPN(IS=26.03f XTI=3 EG=1.11 VAF=90.7 BF=4.292K NE=1.244 ISE=26.03f IKF=0.2061 XTB=1.5 BR=1.01 NC=2 ISC=0 IKR=0 RC=0.5 CJC=11.01p MJC=0.3763 VJC=0.75 FC=0.5 CJE=24.07p MJE=0.3641 VJE=0.75 TR=233.7n TF=466.5p ITF=0 VTF=0 XTF=0 RB=10 VCEO=40)")
+ NET_MODEL("2N4403 PNP(Is=650.6E-18 Xti=3 Eg=1.11 Vaf=115.7 Bf=216.2 Ne=1.829 Ise=58.72f Ikf=1.079 Xtb=1.5 Br=3.578 Nc=2 Isc=0 Ikr=0 Rc=.715 Cjc=14.76p Mjc=.5383 Vjc=.75 Fc=.5 Cje=19.82p Mje=.3357 Vje=.75 Tr=111.6n Tf=603.7p Itf=.65 Vtf=5 Xtf=1.7 Rb=10)")
NET_MODEL("2N4124 NPN(IS=6.734f XTI=3 EG=1.11 VAF=74.03 BF=495 NE=1.28 ISE=6.734f IKF=69.35m XTB=1.5 BR=0.7214 NC=2 ISC=0 IKR=0 RC=1 CJC=3.638p MJC=0.3085 VJC=0.75 FC=0.5 CJE=4.493p MJE=0.2593 VJE=0.75 TR=238.3n TF=301.3p ITF=.4 VTF=4 XTF=2 RB=10 VCEO=25)")
NET_MODEL("2N4126 PNP(IS=1.41f XTI=3 EG=1.11 VAF=18.7 BF=203.7 NE=1.5 ISE=0 IKF=80m XTB=1.5 BR=4.924 NC=2 ISC=0 IKR=0 RC=2.5 CJC=9.728p MJC=0.5776 VJC=0.75 FC=0.5 CJE=8.063p MJE=0.3677 VJE=0.75 TR=33.23n TF=179.3p ITF=.4 VTF=4 XTF=6 RB=10 VCEO=25)")
+ // SPICE model parameters taken from http://ltwiki.org/files/LTspiceIV/Vendor%20List/Fairchild/2N/index.html
+ NET_MODEL("2N5210 NPN(Is=5.911f Xti=3 Eg=1.11 Vaf=62.37 Bf=809.9 Ne=1.358 Ise=5.911f Ikf=14.26m Xtb=1.5 Br=1.287 Nc=2 Isc=0 Ikr=0 Rc=1.61 Cjc=4.017p Mjc=.3174 Vjc=.75 Fc=.5 Cje=4.973p Mje=.4146 Vje=.75 Tr=4.68n Tf=820.9p Itf=.35 Vtf=4 Xtf=7 Rb=10)")
+ // SPICE model parameters taken from https://www.onsemi.com/support/design-resources/models?rpn=2N6107
+ NET_MODEL("2N6107 PNP(IS=7.62308e-14 BF=6692.56 NF=0.85 VAF=10 IKF=0.032192 ISE=2.07832e-13 NE=2.41828 BR=15.6629 NR=1.5 VAR=1.44572 IKR=0.32192 ISC=4.75e-16 NC=3.9375 RB=7.19824 IRB=0.1 RBM=0.1 RE=0.0001 RC=0.355458 XTB=0.1 XTI=2.97595 EG=1.206 CJE=1.84157e-10 VJE=0.99 MJE=0.347177 TF=6.63757e-09 XTF=1.50003 VTF=1.0001 ITF=1 CJC=1.06717e-10 VJC=0.942679 MJC=0.245405 XCJC=0.8 FC=0.533334 CJS=0 VJS=0.75 MJS=0.5 TR=1.32755e-07 PTF=0 KF=0 AF=1)")
+ // SPICE model parameters taken from https://www.onsemi.com/support/design-resources/models?rpn=2N6292
+ NET_MODEL("2N6292 NPN(IS=9.3092e-13 BF=2021.8 NF=0.85 VAF=63.2399 IKF=1 ISE=1.92869e-13 NE=1.97024 BR=40.0703 NR=1.5 VAR=0.89955 IKR=10 ISC=4.92338e-16 NC=3.9992 RB=6.98677 IRB=0.1 RBM=0.1 RE=0.0001 RC=0.326141 XTB=0.1 XTI=2.86739 EG=1.206 CJE=1.84157e-10 VJE=0.99 MJE=0.347174 TF=6.73756e-09 XTF=1.49917 VTF=0.997395 ITF=0.998426 CJC=1.06717e-10 VJC=0.942694 MJC=0.245406 XCJC=0.8 FC=0.533405 CJS=0 VJS=0.75 MJS=0.5 TR=6.0671e-08 PTF=0 KF=0 AF=1)")
+
NET_MODEL("2SC945 NPN(IS=3.577E-14 BF=2.382E+02 NF=1.01 VAF=1.206E+02 IKF=3.332E-01 ISE=3.038E-16 NE=1.205 BR=1.289E+01 NR=1.015 VAR=1.533E+01 IKR=2.037E-01 ISC=3.972E-14 NC=1.115 RB=3.680E+01 IRB=1.004E-04 RBM=1 RE=8.338E-01 RC=1.557E+00 CJE=1.877E-11 VJE=7.211E-01 MJE=3.486E-01 TF=4.149E-10 XTF=1.000E+02 VTF=9.956 ITF=5.118E-01 PTF=0 CJC=6.876p VJC=3.645E-01 MJC=3.074E-01 TR=5.145E-08 XTB=1.5 EG=1.11 XTI=3 FC=0.5 Vceo=50 Icrating=100m MFG=NEC)")
NET_MODEL("BC237B NPN(IS=1.8E-14 ISE=5.0E-14 ISC=1.72E-13 XTI=3 BF=400 BR=35.5 IKF=0.14 IKR=0.03 XTB=1.5 VAF=80 VAR=12.5 VJE=0.58 VJC=0.54 RE=0.6 RC=0.25 RB=0.56 CJE=13E-12 CJC=4E-12 XCJC=0.75 FC=0.5 NF=0.9955 NR=1.005 NE=1.46 NC=1.27 MJE=0.33 MJC=0.33 TF=0.64E-9 TR=50.72E-9 EG=1.11 KF=0 AF=1 VCEO=45 ICRATING=100M MFG=ZETEX)")
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp
index a4510fe5765..d0a0e707aaf 100644
--- a/src/lib/netlist/nl_base.cpp
+++ b/src/lib/netlist/nl_base.cpp
@@ -16,10 +16,10 @@
#include "nl_errstr.h"
-#include "devices/net_lib.h"
-
#include <limits>
+NETLIST_EXTERNAL(base_lib)
+
namespace netlist
{
diff --git a/src/lib/netlist/nl_parser.cpp b/src/lib/netlist/nl_parser.cpp
index 32a5c542a16..3e7ff32e804 100644
--- a/src/lib/netlist/nl_parser.cpp
+++ b/src/lib/netlist/nl_parser.cpp
@@ -561,4 +561,26 @@ pstring parser_t::stringify_expression(token_t &tok)
return ret;
}
+// ----------------------------------------------------------------------------------------
+// source_token_t
+// ----------------------------------------------------------------------------------------
+
+bool source_token_t::parse(nlparse_t &setup, const pstring &name)
+{
+ if (name == m_name)
+ {
+ auto ret = setup.parse_tokens(m_store, name);
+ return ret;
+ }
+
+ return false;
+}
+
+plib::istream_uptr source_token_t::stream(const pstring &name)
+{
+ plib::unused_var(name);
+ return plib::istream_uptr();
+}
+
+
} // namespace netlist
diff --git a/src/lib/netlist/nl_parser.h b/src/lib/netlist/nl_parser.h
index 077f1b10792..cbc757307d5 100644
--- a/src/lib/netlist/nl_parser.h
+++ b/src/lib/netlist/nl_parser.h
@@ -9,6 +9,7 @@
#define NL_PARSER_H_
#include "nltypes.h" // for setup_t
+#include "core/setup.h"
#include "plib/ptokenizer.h"
#include <unordered_map>
@@ -89,7 +90,27 @@ namespace netlist
std::unordered_map<pstring, token_store> m_local;
token_store *m_cur_local;
-};
+ };
+
+ class source_token_t : public source_netlist_t
+ {
+ public:
+ source_token_t(const pstring &name, const parser_t::token_store &store)
+ : m_store(store)
+ , m_name(name)
+ {
+ }
+
+ bool parse(nlparse_t &setup, const pstring &name) override;
+
+ protected:
+ plib::istream_uptr stream(const pstring &name) override;
+
+ private:
+ parser_t::token_store m_store;
+ pstring m_name;
+ };
+
} // namespace netlist
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index b2ade9d48ce..9af1ec92d51 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -352,7 +352,7 @@ namespace netlist
return false;
}
- bool nlparse_t::parse_tokens(const parser_t::token_store &tokens, const pstring &name)
+ bool nlparse_t::parse_tokens(const plib::detail::token_store &tokens, const pstring &name)
{
parser_t parser(*this);
return parser.parse(tokens, name);
@@ -1282,7 +1282,10 @@ void models_t::model_parse(const pstring &model_in, map_t &map)
key = plib::ucase(model);
auto i = m_models.find(key);
if (i == m_models.end())
- throw nl_exception(MF_MODEL_NOT_FOUND("xx" + model));
+ {
+ throw nl_exception(MF_MODEL_NOT_FOUND(pstring("xx") + model));
+ }
+
model = i->second;
}
pstring xmodel = plib::left(model, pos);
@@ -1759,22 +1762,5 @@ plib::istream_uptr source_proc_t::stream(const pstring &name)
return plib::istream_uptr();
}
-bool source_token_t::parse(nlparse_t &setup, const pstring &name)
-{
- if (name == m_name)
- {
- auto ret = setup.parse_tokens(m_store, name);
- return ret;
- }
-
- return false;
-}
-
-plib::istream_uptr source_token_t::stream(const pstring &name)
-{
- plib::unused_var(name);
- return plib::istream_uptr();
-}
-
} // namespace netlist
diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h
index 7f6988f2951..fd9cb11afab 100644
--- a/src/lib/netlist/nl_setup.h
+++ b/src/lib/netlist/nl_setup.h
@@ -14,7 +14,6 @@
#include "plib/pstring.h"
#include "nl_config.h"
-#include "nl_parser.h"
#include "nltypes.h"
#include <initializer_list>
@@ -229,7 +228,7 @@ namespace netlist
// FIXME: used by source_t - need a different approach at some time
bool parse_stream(plib::istream_uptr &&istrm, const pstring &name);
- bool parse_tokens(const parser_t::token_store &tokens, const pstring &name);
+ bool parse_tokens(const plib::detail::token_store &tokens, const pstring &name);
template <typename S, typename... Args>
void add_include(Args&&... args)
diff --git a/src/lib/netlist/nltypes.h b/src/lib/netlist/nltypes.h
index 422a9ddfac4..5781619af1a 100644
--- a/src/lib/netlist/nltypes.h
+++ b/src/lib/netlist/nltypes.h
@@ -22,22 +22,6 @@
#include <memory>
-// FIXME: Move to ptypes
-namespace plib
-{
- // FORWARD declarations
- template <typename BASEARENA, std::size_t MINALIGN>
- class mempool_arena;
-
- struct aligned_arena;
- class dynlib_base;
-
- template<bool debug_enabled>
- class plog_base;
-
- struct plog_level;
-} // namespace plib
-
namespace netlist
{
// -----------------------------------------------------------------------------
diff --git a/src/lib/netlist/plib/pexception.h b/src/lib/netlist/plib/pexception.h
index 2023fb91c38..709f8810b83 100644
--- a/src/lib/netlist/plib/pexception.h
+++ b/src/lib/netlist/plib/pexception.h
@@ -40,10 +40,10 @@ namespace plib {
explicit pexception(const pstring &text);
const pstring &text() const noexcept { return m_text; }
- const char* what() const noexcept override { return putf8string(m_text).c_str(); }
+ const char* what() const noexcept override { return m_text.c_str(); }
private:
- pstring m_text;
+ putf8string m_text;
};
class file_e : public plib::pexception
diff --git a/src/lib/netlist/plib/ptokenizer.h b/src/lib/netlist/plib/ptokenizer.h
index 717d3fcd550..9a194a542d5 100644
--- a/src/lib/netlist/plib/ptokenizer.h
+++ b/src/lib/netlist/plib/ptokenizer.h
@@ -19,22 +19,7 @@
namespace plib {
- class ptokenizer
- {
- public:
- explicit ptokenizer() // NOLINT(misc-forwarding-reference-overload, bugprone-forwarding-reference-overload)
- : m_strm(nullptr)
- , m_unget(0)
- , m_string('"')
- , m_support_line_markers(true) // FIXME
- , m_token_queue(nullptr)
- {
- clear();
- }
-
- PCOPYASSIGNMOVE(ptokenizer, delete)
-
- virtual ~ptokenizer() = default;
+ namespace detail {
PENUM(token_type,
IDENTIFIER,
@@ -109,7 +94,34 @@ namespace plib {
pstring m_token;
};
- using token_store = std::vector<token_t>;
+ class token_store : public std::vector<token_t>
+ {
+ using std::vector<token_t>::vector;
+ };
+
+ } // namespace detail
+
+ class ptokenizer
+ {
+ public:
+ explicit ptokenizer() // NOLINT(misc-forwarding-reference-overload, bugprone-forwarding-reference-overload)
+ : m_strm(nullptr)
+ , m_unget(0)
+ , m_string('"')
+ , m_support_line_markers(true) // FIXME
+ , m_token_queue(nullptr)
+ {
+ clear();
+ }
+
+ PCOPYASSIGNMOVE(ptokenizer, delete)
+
+ virtual ~ptokenizer() = default;
+
+ using token_type = detail::token_type;
+ using token_id_t = detail::token_id_t;
+ using token_t = detail::token_t;
+ using token_store = detail::token_store;
// tokenizer stuff follows ...
diff --git a/src/lib/netlist/plib/ptypes.h b/src/lib/netlist/plib/ptypes.h
index 5c5cb37695a..544b8ab0eff 100644
--- a/src/lib/netlist/plib/ptypes.h
+++ b/src/lib/netlist/plib/ptypes.h
@@ -39,6 +39,30 @@
#undef EMSCRIPTEN
#endif
+// -----------------------------------------------------------------------------
+// forward definitions
+// -----------------------------------------------------------------------------
+
+namespace plib
+{
+ template <typename BASEARENA, std::size_t MINALIGN>
+ class mempool_arena;
+
+ struct aligned_arena;
+ class dynlib_base;
+
+ template<bool debug_enabled>
+ class plog_base;
+
+ struct plog_level;
+
+ namespace detail
+ {
+ class token_store;
+ } // namespace detail
+
+} // namespace plib
+
namespace plib
{
//============================================================
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index 27aa5b293c3..44b96bf0d6d 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -694,18 +694,22 @@ void tool_app_t::static_compile()
throw netlist::nl_exception(netlist::MF_FILE_OPEN_ERROR(opt_out()));
sout << "#include \"plib/pdynlib.h\"\n\n";
+ sout << "#if !defined(__EMSCRIPTEN__)\n\n";
for (auto &e : map)
{
sout << "// " << putf8string(e.second.m_module) << "\n";
sout << putf8string(e.second.m_code);
}
+ sout << "#endif\n\n";
sout << "extern const plib::dynlib_static_sym nl_static_solver_syms[];\n";
sout << "const plib::dynlib_static_sym nl_static_solver_syms[] = {\n";
+ sout << "#if !defined(__EMSCRIPTEN__)\n\n";
for (auto &e : map)
{
sout << "// " << putf8string(e.second.m_module) << "\n";
sout << "\t{\"" << putf8string(e.first) << "\", reinterpret_cast<void *>(&" << putf8string(e.first) << ")},\n";
}
+ sout << "#endif\n\n";
sout << "{\"\", nullptr}\n";
sout << "};\n";
diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp
index 92a4af61399..9ea31925b98 100644
--- a/src/lib/netlist/solver/nld_solver.cpp
+++ b/src/lib/netlist/solver/nld_solver.cpp
@@ -227,6 +227,7 @@ namespace devices
std::size_t net_count = nets.size();
switch (net_count)
{
+#if !defined(__EMSCRIPTEN__)
case 1:
return plib::make_unique<solver::matrix_solver_direct1_t<FT>, device_arena>(*this, sname, nets, params);
case 2:
@@ -243,6 +244,7 @@ namespace devices
return create_solver<FT, 7>(7, sname, params, nets);
case 8:
return create_solver<FT, 8>(8, sname, params, nets);
+#endif
default:
log().info(MI_NO_SPECIFIC_SOLVER(net_count));
if (net_count <= 16)
diff --git a/src/mame/audio/arcadia.cpp b/src/mame/audio/arcadia.cpp
index aa0bc4b8616..19adb9fac4e 100644
--- a/src/mame/audio/arcadia.cpp
+++ b/src/mame/audio/arcadia.cpp
@@ -59,7 +59,7 @@ arcadia_sound_device::arcadia_sound_device(const machine_config &mconfig, const
//-------------------------------------------------
void arcadia_sound_device::device_start()
{
- m_channel = machine().sound().stream_alloc(*this, 0, 1, UVI_PAL*OSAMP);
+ m_channel = stream_alloc_legacy(0, 1, UVI_PAL*OSAMP);
m_lfsr = LFSR_INIT;
m_tval = 1;
logerror("arcadia_sound start\n");
@@ -76,11 +76,11 @@ void arcadia_sound_device::device_reset()
}
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void arcadia_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void arcadia_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int i;
stream_sample_t *buffer = outputs[0];
diff --git a/src/mame/audio/arcadia.h b/src/mame/audio/arcadia.h
index 3452b755d5d..de67b71705d 100644
--- a/src/mame/audio/arcadia.h
+++ b/src/mame/audio/arcadia.h
@@ -21,7 +21,7 @@ protected:
// device-level overrides
virtual void device_start() override;
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 sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
sound_stream *m_channel;
uint8_t m_reg[3];
diff --git a/src/mame/audio/atarisac.cpp b/src/mame/audio/atarisac.cpp
index 3dd58e2602c..a0fef91cb29 100644
--- a/src/mame/audio/atarisac.cpp
+++ b/src/mame/audio/atarisac.cpp
@@ -254,7 +254,7 @@ void atari_sac_device::device_add_mconfig(machine_config &config)
// TODO: determine exact frequency (controlled by a PAL16R4)
GENERIC_LATCH_8(config, m_datin);
- m_datin->data_pending_callback().set_inputline(m_daccpu, M68K_IRQ_4);
+ m_datin->data_pending_callback().set_inputline(m_daccpu, M68K_IRQ_2);
m_datin->set_separate_acknowledge(true);
GENERIC_LATCH_8(config, m_datout);
diff --git a/src/mame/audio/channelf.cpp b/src/mame/audio/channelf.cpp
index 8823294c75e..5003f28ae3a 100644
--- a/src/mame/audio/channelf.cpp
+++ b/src/mame/audio/channelf.cpp
@@ -30,7 +30,7 @@ void channelf_sound_device::device_start()
{
int rate;
- m_channel = stream_alloc(0, 1, machine().sample_rate());
+ m_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
rate = machine().sample_rate();
/*
@@ -67,10 +67,10 @@ void channelf_sound_device::device_start()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void channelf_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void channelf_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
uint32_t mask = 0, target = 0;
stream_sample_t *buffer = outputs[0];
diff --git a/src/mame/audio/channelf.h b/src/mame/audio/channelf.h
index 26e3b85b52d..36c98aa47ed 100644
--- a/src/mame/audio/channelf.h
+++ b/src/mame/audio/channelf.h
@@ -20,7 +20,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
// internal state
sound_stream *m_channel;
diff --git a/src/mame/audio/cheekyms.cpp b/src/mame/audio/cheekyms.cpp
index e0c777a3e30..1ff076de3c0 100644
--- a/src/mame/audio/cheekyms.cpp
+++ b/src/mame/audio/cheekyms.cpp
@@ -55,7 +55,7 @@ void cheekyms_audio_device::device_add_mconfig(machine_config &config)
NETLIST_LOGIC_INPUT(config, "sound_nl:pest_dies", "I_PEST_DIES.IN", 0);
NETLIST_LOGIC_INPUT(config, "sound_nl:coin_extra", "I_COIN_EXTRA.IN", 0);
- NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "VR1.2").set_mult_offset(30000.0 * 10.0, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "VR1.2").set_mult_offset(30000.0 * 10.0 / 32768.0, 0.0);
}
diff --git a/src/mame/audio/cinemat.cpp b/src/mame/audio/cinemat.cpp
index c7b75f31311..4b9168aa949 100644
--- a/src/mame/audio/cinemat.cpp
+++ b/src/mame/audio/cinemat.cpp
@@ -145,7 +145,7 @@ void cinemat_audio_device_base::input_set(int bit, int state)
DEFINE_DEVICE_TYPE(SPACE_WARS_AUDIO, spacewar_audio_device, "spacewar_audio", "Space Wars Sound Board")
spacewar_audio_device::spacewar_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : cinemat_audio_device_base(mconfig, SPACE_WARS_AUDIO, tag, owner, clock, 0x1f, NETLIST_NAME(spacewar), 150000.0)
+ : cinemat_audio_device_base(mconfig, SPACE_WARS_AUDIO, tag, owner, clock, 0x1f, NETLIST_NAME(spacewar), 4.5)
{
}
@@ -160,7 +160,7 @@ spacewar_audio_device::spacewar_audio_device(const machine_config &mconfig, cons
DEFINE_DEVICE_TYPE(BARRIER_AUDIO, barrier_audio_device, "barrier_audio", "Barrier Sound Board")
barrier_audio_device::barrier_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : cinemat_audio_device_base(mconfig, BARRIER_AUDIO, tag, owner, clock, 0x07, NETLIST_NAME(barrier), 200000.0)
+ : cinemat_audio_device_base(mconfig, BARRIER_AUDIO, tag, owner, clock, 0x07, NETLIST_NAME(barrier), 6.1)
{
}
@@ -175,7 +175,7 @@ barrier_audio_device::barrier_audio_device(const machine_config &mconfig, const
DEFINE_DEVICE_TYPE(SPEED_FREAK_AUDIO, speedfrk_audio_device, "speedfrk_audio", "Speed Freak Sound Board")
speedfrk_audio_device::speedfrk_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : cinemat_audio_device_base(mconfig, SPEED_FREAK_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(speedfrk), 12000.0)
+ : cinemat_audio_device_base(mconfig, SPEED_FREAK_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(speedfrk), 0.35)
{
}
@@ -190,7 +190,7 @@ speedfrk_audio_device::speedfrk_audio_device(const machine_config &mconfig, cons
DEFINE_DEVICE_TYPE(STAR_HAWK_AUDIO, starhawk_audio_device, "starhawk_audio", "Star Hawk Sound Board")
starhawk_audio_device::starhawk_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : cinemat_audio_device_base(mconfig, STAR_HAWK_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(starhawk), 50000.0)
+ : cinemat_audio_device_base(mconfig, STAR_HAWK_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(starhawk), 1.5)
{
}
@@ -205,7 +205,7 @@ starhawk_audio_device::starhawk_audio_device(const machine_config &mconfig, cons
DEFINE_DEVICE_TYPE(SUNDANCE_AUDIO, sundance_audio_device, "sundance_audio", "Sundance Sound Board")
sundance_audio_device::sundance_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : cinemat_audio_device_base(mconfig, SUNDANCE_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(sundance), 45000.0)
+ : cinemat_audio_device_base(mconfig, SUNDANCE_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(sundance), 1.0)
{
}
@@ -220,7 +220,7 @@ sundance_audio_device::sundance_audio_device(const machine_config &mconfig, cons
DEFINE_DEVICE_TYPE(TAIL_GUNNER_AUDIO, tailg_audio_device, "tailg_audio", "Tail Gunner Sound Board")
tailg_audio_device::tailg_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : cinemat_audio_device_base(mconfig, TAIL_GUNNER_AUDIO, tag, owner, clock, 0x1f, NETLIST_NAME(tailg), 75000.0)
+ : cinemat_audio_device_base(mconfig, TAIL_GUNNER_AUDIO, tag, owner, clock, 0x1f, NETLIST_NAME(tailg), 2.2)
{
}
@@ -235,7 +235,7 @@ tailg_audio_device::tailg_audio_device(const machine_config &mconfig, const char
DEFINE_DEVICE_TYPE(WARRIOR_AUDIO, warrior_audio_device, "warrior_audio", "Warrior Sound Board")
warrior_audio_device::warrior_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : cinemat_audio_device_base(mconfig, WARRIOR_AUDIO, tag, owner, clock, 0x1f, NETLIST_NAME(warrior), 50000.0)
+ : cinemat_audio_device_base(mconfig, WARRIOR_AUDIO, tag, owner, clock, 0x1f, NETLIST_NAME(warrior), 1.5)
{
}
@@ -250,7 +250,7 @@ warrior_audio_device::warrior_audio_device(const machine_config &mconfig, const
DEFINE_DEVICE_TYPE(ARMOR_ATTACK_AUDIO, armora_audio_device, "armora_audio", "Armor Atrack Sound Board")
armora_audio_device::armora_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : cinemat_audio_device_base(mconfig, ARMOR_ATTACK_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(armora), 5000.0)
+ : cinemat_audio_device_base(mconfig, ARMOR_ATTACK_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(armora), 0.15)
{
}
@@ -265,7 +265,7 @@ armora_audio_device::armora_audio_device(const machine_config &mconfig, const ch
DEFINE_DEVICE_TYPE(RIPOFF_AUDIO, ripoff_audio_device, "ripoff_audio", "Rip Off Sound Board")
ripoff_audio_device::ripoff_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : cinemat_audio_device_base(mconfig, RIPOFF_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(ripoff), 20000.0)
+ : cinemat_audio_device_base(mconfig, RIPOFF_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(ripoff), 0.61)
{
}
@@ -280,7 +280,7 @@ ripoff_audio_device::ripoff_audio_device(const machine_config &mconfig, const ch
DEFINE_DEVICE_TYPE(STAR_CASTLE_AUDIO, starcas_audio_device, "starcas_audio", "Star Castle Sound Board")
starcas_audio_device::starcas_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : cinemat_audio_device_base(mconfig, STAR_CASTLE_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(starcas), 5000.0)
+ : cinemat_audio_device_base(mconfig, STAR_CASTLE_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(starcas), 0.15)
{
}
@@ -295,7 +295,7 @@ starcas_audio_device::starcas_audio_device(const machine_config &mconfig, const
DEFINE_DEVICE_TYPE(SOLAR_QUEST_AUDIO, solarq_audio_device, "solarq_audio", "Solar Quest Sound Board")
solarq_audio_device::solarq_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : cinemat_audio_device_base(mconfig, SOLAR_QUEST_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(solarq), 5000.0)
+ : cinemat_audio_device_base(mconfig, SOLAR_QUEST_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(solarq), 0.15)
{
}
@@ -310,7 +310,7 @@ solarq_audio_device::solarq_audio_device(const machine_config &mconfig, const ch
DEFINE_DEVICE_TYPE(BOXING_BUGS_AUDIO, boxingb_audio_device, "boxingb_audio", "Boxing Bugs Sound Board")
boxingb_audio_device::boxingb_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : cinemat_audio_device_base(mconfig, BOXING_BUGS_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(boxingb), 5000.0)
+ : cinemat_audio_device_base(mconfig, BOXING_BUGS_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(boxingb), 0.15)
{
}
@@ -325,7 +325,7 @@ boxingb_audio_device::boxingb_audio_device(const machine_config &mconfig, const
DEFINE_DEVICE_TYPE(WAR_OF_THE_WORLDS_AUDIO, wotw_audio_device, "wotw_audio", "War of the Worlds Sound Board")
wotw_audio_device::wotw_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : cinemat_audio_device_base(mconfig, WAR_OF_THE_WORLDS_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(wotw), 5000.0)
+ : cinemat_audio_device_base(mconfig, WAR_OF_THE_WORLDS_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(wotw), 0.15)
{
}
diff --git a/src/mame/audio/cmi01a.cpp b/src/mame/audio/cmi01a.cpp
index 8a45582d2fd..dbb180c2247 100644
--- a/src/mame/audio/cmi01a.cpp
+++ b/src/mame/audio/cmi01a.cpp
@@ -132,7 +132,7 @@ void cmi01a_device::device_add_mconfig(machine_config &config)
}
-void cmi01a_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void cmi01a_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
if (m_run)
{
@@ -175,7 +175,7 @@ void cmi01a_device::device_start()
m_zx_timer->adjust(attotime::never);
m_eosi_timer->adjust(attotime::never);
- m_stream = stream_alloc(0, 1, 44100);
+ m_stream = stream_alloc_legacy(0, 1, 44100);
m_ptm->set_external_clocks(clock() / 8, clock() / 4, clock() / 4);
diff --git a/src/mame/audio/cmi01a.h b/src/mame/audio/cmi01a.h
index 61e294111db..7e5da0b56a8 100644
--- a/src/mame/audio/cmi01a.h
+++ b/src/mame/audio/cmi01a.h
@@ -34,7 +34,7 @@ public:
void write(offs_t offset, uint8_t data);
uint8_t read(offs_t offset);
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
protected:
virtual void device_resolve_objects() override;
diff --git a/src/mame/audio/cps3.cpp b/src/mame/audio/cps3.cpp
index f800aa0e598..aa7eb8340f0 100644
--- a/src/mame/audio/cps3.cpp
+++ b/src/mame/audio/cps3.cpp
@@ -39,7 +39,7 @@ cps3_sound_device::cps3_sound_device(const machine_config &mconfig, const char *
void cps3_sound_device::device_start()
{
/* Allocate the stream */
- m_stream = stream_alloc(0, 2, clock() / 384);
+ m_stream = stream_alloc_legacy(0, 2, clock() / 384);
save_item(NAME(m_key));
for (int i = 0; i < 16; i++)
@@ -52,10 +52,10 @@ void cps3_sound_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void cps3_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void cps3_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
/* Clear the buffers */
memset(outputs[0], 0, samples*sizeof(*outputs[0]));
diff --git a/src/mame/audio/cps3.h b/src/mame/audio/cps3.h
index 482b156a755..4e3fe471c8d 100644
--- a/src/mame/audio/cps3.h
+++ b/src/mame/audio/cps3.h
@@ -46,7 +46,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
sound_stream *m_stream;
diff --git a/src/mame/audio/dai_snd.cpp b/src/mame/audio/dai_snd.cpp
index 72dd3f75b41..37004da5644 100644
--- a/src/mame/audio/dai_snd.cpp
+++ b/src/mame/audio/dai_snd.cpp
@@ -33,7 +33,7 @@ dai_sound_device::dai_sound_device(const machine_config &mconfig, const char *ta
void dai_sound_device::device_start()
{
- m_mixer_channel = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate());
+ m_mixer_channel = stream_alloc_legacy(0, 2, machine().sample_rate());
}
//-------------------------------------------------
@@ -115,11 +115,11 @@ WRITE_LINE_MEMBER(dai_sound_device::set_input_ch2)
}
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void dai_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void dai_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *sample_left = outputs[0];
stream_sample_t *sample_right = outputs[1];
diff --git a/src/mame/audio/dai_snd.h b/src/mame/audio/dai_snd.h
index d82bc000d8a..cea0e1c6c71 100644
--- a/src/mame/audio/dai_snd.h
+++ b/src/mame/audio/dai_snd.h
@@ -27,7 +27,7 @@ protected:
// device-level overrides
virtual void device_start() override;
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 sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
sound_stream * m_mixer_channel;
diff --git a/src/mame/audio/dsbz80.cpp b/src/mame/audio/dsbz80.cpp
index ae0e4b216a4..7643face54b 100644
--- a/src/mame/audio/dsbz80.cpp
+++ b/src/mame/audio/dsbz80.cpp
@@ -85,7 +85,7 @@ void dsbz80_device::device_start()
m_rxd_handler.resolve_safe();
uint8_t *rom_base = machine().root_device().memregion("mpeg")->base();
decoder = new mpeg_audio(rom_base, mpeg_audio::L2, false, 0);
- machine().sound().stream_alloc(*this, 0, 2, 32000);
+ stream_alloc_legacy(0, 2, 32000);
}
//-------------------------------------------------
@@ -232,7 +232,7 @@ void dsbz80_device::mpeg_stereo_w(uint8_t data)
mp_pan = data & 3; // 0 = stereo, 1 = left on both channels, 2 = right on both channels
}
-void dsbz80_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void dsbz80_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *out_l = outputs[0];
stream_sample_t *out_r = outputs[1];
diff --git a/src/mame/audio/dsbz80.h b/src/mame/audio/dsbz80.h
index 0c62482100b..92e0c4f3f2f 100644
--- a/src/mame/audio/dsbz80.h
+++ b/src/mame/audio/dsbz80.h
@@ -37,7 +37,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
mpeg_audio *decoder;
diff --git a/src/mame/audio/elan_eu3a05.cpp b/src/mame/audio/elan_eu3a05.cpp
index d11039df082..39ab90a08fb 100644
--- a/src/mame/audio/elan_eu3a05.cpp
+++ b/src/mame/audio/elan_eu3a05.cpp
@@ -54,7 +54,7 @@ void elan_eu3a05_sound_device::map(address_map &map)
void elan_eu3a05_sound_device::device_start()
{
m_space_read_cb.resolve_safe(0);
- m_stream = stream_alloc(0, 1, 8000);
+ m_stream = stream_alloc_legacy(0, 1, 8000);
m_sound_end_cb.resolve_all_safe();
@@ -92,10 +92,10 @@ void elan_eu3a05_sound_device::device_reset()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void elan_eu3a05_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void elan_eu3a05_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// reset the output stream
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
diff --git a/src/mame/audio/elan_eu3a05.h b/src/mame/audio/elan_eu3a05.h
index ddd6c370033..c9ef2e83ab3 100644
--- a/src/mame/audio/elan_eu3a05.h
+++ b/src/mame/audio/elan_eu3a05.h
@@ -30,7 +30,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
virtual space_config_vector memory_space_config() const override;
const address_space_config m_space_config;
diff --git a/src/mame/audio/exidy.cpp b/src/mame/audio/exidy.cpp
index 55dda4ea22b..8220c3e1af7 100644
--- a/src/mame/audio/exidy.cpp
+++ b/src/mame/audio/exidy.cpp
@@ -180,7 +180,7 @@ void exidy_sound_device::common_sh_start()
m_sh6840_clocks_per_sample = (int)(SH6840_CLOCK.dvalue() / (double)sample_rate * (double)(1 << 24));
/* allocate the stream */
- m_stream = machine().sound().stream_alloc(*this, 0, 1, sample_rate);
+ m_stream = stream_alloc_legacy(0, 1, sample_rate);
sh6840_register_state_globals();
}
@@ -239,10 +239,10 @@ void exidy_sound_device::device_reset()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void exidy_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void exidy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
sh6840_timer_channel *sh6840_timer = m_sh6840_timer;
diff --git a/src/mame/audio/exidy.h b/src/mame/audio/exidy.h
index d3e049f7f2b..86ed7b145cd 100644
--- a/src/mame/audio/exidy.h
+++ b/src/mame/audio/exidy.h
@@ -54,7 +54,7 @@ protected:
void sh6840_register_state_globals();
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
virtual stream_sample_t generate_music_sample();
static inline void sh6840_apply_clock(sh6840_timer_channel *t, int clocks);
diff --git a/src/mame/audio/exidy440.cpp b/src/mame/audio/exidy440.cpp
index fb221df1e4b..a4ca2d10339 100644
--- a/src/mame/audio/exidy440.cpp
+++ b/src/mame/audio/exidy440.cpp
@@ -146,7 +146,7 @@ void exidy440_sound_device::device_start()
m_channel_frequency[3] = clock()/2;
/* get stream channels */
- m_stream = machine().sound().stream_alloc(*this, 0, 2, clock());
+ m_stream = stream_alloc_legacy(0, 2, clock());
/* allocate the sample cache */
length = m_samples.bytes() * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry);
@@ -836,10 +836,10 @@ void exidy440_sound_device::sound_banks_w(offs_t offset, uint8_t data)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void exidy440_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void exidy440_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int ch;
diff --git a/src/mame/audio/exidy440.h b/src/mame/audio/exidy440.h
index 826ed3467ea..9f8861bdfe3 100644
--- a/src/mame/audio/exidy440.h
+++ b/src/mame/audio/exidy440.h
@@ -29,7 +29,7 @@ protected:
virtual void device_stop() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
void exidy440_audio_map(address_map &map);
diff --git a/src/mame/audio/flower.cpp b/src/mame/audio/flower.cpp
index d708bc1fd35..4ade0d864a9 100644
--- a/src/mame/audio/flower.cpp
+++ b/src/mame/audio/flower.cpp
@@ -63,7 +63,7 @@ flower_sound_device::flower_sound_device(const machine_config &mconfig, const ch
void flower_sound_device::device_start()
{
m_iospace = &space(AS_IO);
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock()/2);
+ m_stream = stream_alloc_legacy(0, 1, clock()/2);
m_mixer_buffer = make_unique_clear<short[]>(clock()/2);
make_mixer_table(MAX_VOICES, defgain);
@@ -127,7 +127,7 @@ void flower_sound_device::device_reset()
}
}
-void flower_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void flower_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
short *mix;
diff --git a/src/mame/audio/flower.h b/src/mame/audio/flower.h
index d595a2dfa6c..8fad33679c6 100644
--- a/src/mame/audio/flower.h
+++ b/src/mame/audio/flower.h
@@ -39,7 +39,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual space_config_vector memory_space_config() const override;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
address_space *m_iospace;
private:
diff --git a/src/mame/audio/geebee.cpp b/src/mame/audio/geebee.cpp
index 037a398dc3b..63859916d7c 100644
--- a/src/mame/audio/geebee.cpp
+++ b/src/mame/audio/geebee.cpp
@@ -42,7 +42,7 @@ void geebee_sound_device::device_start()
m_decay[0x7fff - i] = (int16_t) (0x7fff/exp(1.0*i/4096));
/* 1V = HSYNC = 18.432MHz / 3 / 2 / 384 = 8000Hz */
- m_channel = machine().sound().stream_alloc(*this, 0, 1, clock() / 3 / 2 / 384);
+ m_channel = stream_alloc_legacy(0, 1, clock() / 3 / 2 / 384);
m_vcount = 0;
m_volume_timer = timer_alloc(TIMER_VOLUME_DECAY);
@@ -103,10 +103,10 @@ void geebee_sound_device::sound_w(u8 data)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void geebee_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void geebee_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
diff --git a/src/mame/audio/geebee.h b/src/mame/audio/geebee.h
index 56fde3cacf2..1cca0fc6dd0 100644
--- a/src/mame/audio/geebee.h
+++ b/src/mame/audio/geebee.h
@@ -22,7 +22,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
diff --git a/src/mame/audio/gomoku.cpp b/src/mame/audio/gomoku.cpp
index 197b2d77827..6aeb288f6db 100644
--- a/src/mame/audio/gomoku.cpp
+++ b/src/mame/audio/gomoku.cpp
@@ -52,7 +52,7 @@ void gomoku_sound_device::device_start()
int ch;
// get stream channels
- m_stream = stream_alloc(0, 1, clock());
+ m_stream = stream_alloc_legacy(0, 1, clock());
// allocate a pair of buffers to mix into - 1 second's worth should be more than enough
m_mixer_buffer = std::make_unique<short[]>(2 * clock());
@@ -87,10 +87,10 @@ void gomoku_sound_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update in mono
+// sound_stream_update_legacy - handle a stream update in mono
//-------------------------------------------------
-void gomoku_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void gomoku_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
sound_channel *voice;
diff --git a/src/mame/audio/gomoku.h b/src/mame/audio/gomoku.h
index 5947bfc40b8..75de8a2c09c 100644
--- a/src/mame/audio/gomoku.h
+++ b/src/mame/audio/gomoku.h
@@ -23,7 +23,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
void make_mixer_table(int voices, int gain);
diff --git a/src/mame/audio/gottlieb.cpp b/src/mame/audio/gottlieb.cpp
index 86405adeda9..db7d34b0ccc 100644
--- a/src/mame/audio/gottlieb.cpp
+++ b/src/mame/audio/gottlieb.cpp
@@ -347,7 +347,7 @@ void gottlieb_sound_r1_with_votrax_device::device_post_load()
gottlieb_sound_r1_device::device_post_load();
// totally random guesswork; would like to get real measurements on a board
- m_votrax->set_unscaled_clock(600000 + (m_last_speech_clock - 0xa0) * 10000);
+ m_votrax->set_unscaled_clock(900000 + (m_last_speech_clock - 0xa0) * 9000);
}
@@ -371,7 +371,7 @@ void gottlieb_sound_r1_with_votrax_device::votrax_data_w(uint8_t data)
void gottlieb_sound_r1_with_votrax_device::speech_clock_dac_w(uint8_t data)
{
// prevent negative clock values (and possible crash)
- if (data < 0x65) data = 0x65;
+ if (data < 0x60) data = 0x60;
// nominal clock is 0xa0
if (data != m_last_speech_clock)
@@ -379,7 +379,7 @@ void gottlieb_sound_r1_with_votrax_device::speech_clock_dac_w(uint8_t data)
logerror("clock = %02X\n", data);
// totally random guesswork; would like to get real measurements on a board
- m_votrax->set_unscaled_clock(600000 + (data - 0xa0) * 10000);
+ m_votrax->set_unscaled_clock(900000 + (data - 0xa0) * 9000);
m_last_speech_clock = data;
}
}
diff --git a/src/mame/audio/gridlee.cpp b/src/mame/audio/gridlee.cpp
index ad002ddf731..429518b39d0 100644
--- a/src/mame/audio/gridlee.cpp
+++ b/src/mame/audio/gridlee.cpp
@@ -43,17 +43,17 @@ gridlee_sound_device::gridlee_sound_device(const machine_config &mconfig, const
void gridlee_sound_device::device_start()
{
/* allocate the stream */
- m_stream = stream_alloc(0, 1, machine().sample_rate());
+ m_stream = stream_alloc_legacy(0, 1, machine().sample_rate());
m_freq_to_step = (double)(1 << 24) / (double)machine().sample_rate();
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void gridlee_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void gridlee_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
diff --git a/src/mame/audio/hyprolyb.cpp b/src/mame/audio/hyprolyb.cpp
index d2bd798286e..77ff8034ae5 100644
--- a/src/mame/audio/hyprolyb.cpp
+++ b/src/mame/audio/hyprolyb.cpp
@@ -82,11 +82,11 @@ void hyprolyb_adpcm_device::vck_callback( int st )
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void hyprolyb_adpcm_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void hyprolyb_adpcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// should never get here
- fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
+ fatalerror("sound_stream_update_legacy called; not applicable to legacy sound devices\n");
}
diff --git a/src/mame/audio/hyprolyb.h b/src/mame/audio/hyprolyb.h
index b3123c3cd52..ac2687b40e4 100644
--- a/src/mame/audio/hyprolyb.h
+++ b/src/mame/audio/hyprolyb.h
@@ -28,7 +28,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
// internal state
diff --git a/src/mame/audio/irem.cpp b/src/mame/audio/irem.cpp
index 24f3fbefa32..b10a97a2200 100644
--- a/src/mame/audio/irem.cpp
+++ b/src/mame/audio/irem.cpp
@@ -457,10 +457,10 @@ void m62_audio_device::device_add_mconfig(machine_config &config)
NETLIST_STREAM_INPUT(config, "snd_nl:cin4", 4, "R_AY45L_B.R");
NETLIST_STREAM_INPUT(config, "snd_nl:cin5", 5, "R_AY45L_C.R");
- NETLIST_STREAM_INPUT(config, "snd_nl:cin6", 6, "I_MSM2K0.IN").set_mult_offset(5.0/65535.0, 2.5);
- NETLIST_STREAM_INPUT(config, "snd_nl:cin7", 7, "I_MSM3K0.IN").set_mult_offset(5.0/65535.0, 2.5);
+ NETLIST_STREAM_INPUT(config, "snd_nl:cin6", 6, "I_MSM2K0.IN").set_mult_offset(10.0, 2.5);
+ NETLIST_STREAM_INPUT(config, "snd_nl:cin7", 7, "I_MSM3K0.IN").set_mult_offset(10.0, 2.5);
- NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "R26.1").set_mult_offset(30000.0 * 10.0, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "R26.1").set_mult_offset(30000.0 * 10.0 / 32768.0, 0.0);
}
void m52_soundc_audio_device::device_add_mconfig(machine_config &config)
diff --git a/src/mame/audio/lynx.cpp b/src/mame/audio/lynx.cpp
index 2c36c831157..40369d86d1d 100644
--- a/src/mame/audio/lynx.cpp
+++ b/src/mame/audio/lynx.cpp
@@ -172,7 +172,7 @@ void lynx_sound_device::init()
void lynx_sound_device::device_start()
{
- m_mixer_channel = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_mixer_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
m_usec_per_sample = 1000000 / machine().sample_rate();
m_timer_delegate.resolve();
init();
@@ -182,7 +182,7 @@ void lynx_sound_device::device_start()
void lynx2_sound_device::device_start()
{
- m_mixer_channel = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate());
+ m_mixer_channel = stream_alloc_legacy(0, 2, machine().sample_rate());
m_usec_per_sample = 1000000 / machine().sample_rate();
m_timer_delegate.resolve();
init();
@@ -467,10 +467,10 @@ void lynx_sound_device::write(offs_t offset, uint8_t data)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void lynx_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void lynx_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int v;
stream_sample_t *buffer = outputs[0];
@@ -488,10 +488,10 @@ void lynx_sound_device::sound_stream_update(sound_stream &stream, stream_sample_
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void lynx2_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void lynx2_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *left=outputs[0], *right=outputs[1];
int v;
diff --git a/src/mame/audio/lynx.h b/src/mame/audio/lynx.h
index bce0d520ce4..11b983089a7 100644
--- a/src/mame/audio/lynx.h
+++ b/src/mame/audio/lynx.h
@@ -45,7 +45,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
void reset_channel(LYNX_AUDIO *channel);
void shift(int chan_nr);
@@ -75,7 +75,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
};
diff --git a/src/mame/audio/mario.cpp b/src/mame/audio/mario.cpp
index da4e4f1699a..1bdf1822bcd 100644
--- a/src/mame/audio/mario.cpp
+++ b/src/mame/audio/mario.cpp
@@ -670,7 +670,7 @@ void mario_state::mario_audio(machine_config &config)
NETLIST_LOGIC_INPUT(config, m_audio_snd7, "SOUND7.IN", 0);
NETLIST_INT_INPUT(config, m_audio_dac, "DAC.VAL", 0, 255);
- NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "ROUT.1").set_mult_offset(150000.0, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "ROUT.1").set_mult_offset(150000.0 / 32768.0, 0.0);
#endif
}
diff --git a/src/mame/audio/micro3d.cpp b/src/mame/audio/micro3d.cpp
index 6e0a4d87db5..52f723ef55f 100644
--- a/src/mame/audio/micro3d.cpp
+++ b/src/mame/audio/micro3d.cpp
@@ -182,7 +182,7 @@ micro3d_sound_device::micro3d_sound_device(const machine_config &mconfig, const
void micro3d_sound_device::device_start()
{
/* Allocate the stream */
- m_stream = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate());
+ m_stream = stream_alloc_legacy(0, 2, machine().sample_rate());
m_filter.init(machine().sample_rate());
m_noise_filters[0].configure(2.7e3 + 2.7e3, 1.0e-6);
@@ -206,10 +206,10 @@ void micro3d_sound_device::device_reset()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void micro3d_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void micro3d_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
lp_filter *iir = &m_filter;
float pan_l, pan_r;
diff --git a/src/mame/audio/micro3d.h b/src/mame/audio/micro3d.h
index e27c57e5bac..937d1fbed74 100644
--- a/src/mame/audio/micro3d.h
+++ b/src/mame/audio/micro3d.h
@@ -24,7 +24,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
enum dac_registers {
diff --git a/src/mame/audio/mw8080bw.cpp b/src/mame/audio/mw8080bw.cpp
index 55f8faedddf..28c7320a7a4 100644
--- a/src/mame/audio/mw8080bw.cpp
+++ b/src/mame/audio/mw8080bw.cpp
@@ -798,8 +798,8 @@ void gunfight_audio_device::device_add_mconfig(machine_config &config)
// the outputs before the power amps so that the highest output spikes
// of +/- 3 volts just reach the clipping limits for signed 16-bit
// samples.
- NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUT_L").set_mult_offset(32767.0 / 3.0, 0.0);
- NETLIST_STREAM_OUTPUT(config, "sound_nl:cout1", 1, "OUT_R").set_mult_offset(32767.0 / 3.0, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUT_L").set_mult_offset(1.0 / 3.0, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "sound_nl:cout1", 1, "OUT_R").set_mult_offset(1.0 / 3.0, 0.0);
// Netlist volume-potentiometer interfaces
NETLIST_ANALOG_INPUT(config, "sound_nl:pot_left_master_vol", "R103.DIAL");
@@ -3768,7 +3768,7 @@ void zzzap_common_audio_device::device_add_mconfig(machine_config &config)
// just reach the clipping limits for signed 16-bit samples.
// So turning the volume up much higher than the default will
// give clipped output.
- NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUTPUT").set_mult_offset(32767.0 / 1.25, -(32767.0 / 1.25) * 2.50);
+ NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUTPUT").set_mult_offset(1.0 / 1.25, -(1.0 / 1.25) * 2.50);
// Netlist volume-potentiometer interface
NETLIST_ANALOG_INPUT(config, "sound_nl:pot_master_vol", "R70.DIAL");
diff --git a/src/mame/audio/nl_astrob.cpp b/src/mame/audio/nl_astrob.cpp
index ba966702284..ee158301c29 100644
--- a/src/mame/audio/nl_astrob.cpp
+++ b/src/mame/audio/nl_astrob.cpp
@@ -44,13 +44,10 @@
-// not really found anywhere, just took the 5239 and changed the
-// breakdown voltage to 5.1 according to the datasheet
-#define D_1N5231(name) ZDIODE(name, "D(BV=5.1 IBV=0.020 NBV=1)")
+#define D_1N5231(name) ZDIODE(name, "1N5231")
#define D_1N914(name) DIODE(name, "1N914")
-// SPICE model taken from https://www.onsemi.com/support/design-resources/models?rpn=2N4403
-#define Q_2N4403(name) QBJT_EB(name, "PNP(Is=650.6E-18 Xti=3 Eg=1.11 Vaf=115.7 Bf=216.2 Ne=1.829 Ise=58.72f Ikf=1.079 Xtb=1.5 Br=3.578 Nc=2 Isc=0 Ikr=0 Rc=.715 Cjc=14.76p Mjc=.5383 Vjc=.75 Fc=.5 Cje=19.82p Mje=.3357 Vje=.75 Tr=111.6n Tf=603.7p Itf=.65 Vtf=5 Xtf=1.7 Rb=10)")
+#define Q_2N4403(name) QBJT_EB(name, "2N4403")
// JFET transistors not supported, but this should do the trick
#define Q_2N4093(name) MOSFET(name, "NMOS(VTO=-1 CAPMOD=0)")
diff --git a/src/mame/audio/nl_cinemat_common.h b/src/mame/audio/nl_cinemat_common.h
index 7533acd56da..cfdd16820aa 100644
--- a/src/mame/audio/nl_cinemat_common.h
+++ b/src/mame/audio/nl_cinemat_common.h
@@ -68,33 +68,27 @@
// Diode models
//
-// models copied from https://www.diodes.com/assets/Spice-Models/Discrete-Prodcut-Groups/Zener-Diodes.txt
#define D_1N914(name) DIODE(name, "1N914")
#define D_1N914B(name) DIODE(name, "1N914")
-#define D_1N5236B(name) ZDIODE(name, "D(BV=7.5 IS=27.5p RS=33.8 N=1.10 CJO=58.2p VJ=0.750 M=0.330 TT=50.1n)")
-#define D_1N5240(name) ZDIODE(name, "D(BV=10 IS=14.4p RS=32.0 N=1.10 CJO=24.1p VJ=0.750 M=0.330 TT=50.1n)")
-#define D_1N5240B(name) ZDIODE(name, "D(BV=10 IS=14.4p RS=32.0 N=1.10 CJO=24.1p VJ=0.750 M=0.330 TT=50.1n)")
+#define D_1N5236B(name) ZDIODE(name, "1N5236B")
+#define D_1N5240(name) ZDIODE(name, "1N5240")
+#define D_1N5240B(name) ZDIODE(name, "1N5240B")
//
-// Op-amp models
+// Transistor models
//
-// SPICE model taken directly from Fairchild Semiconductor datasheet
-#define Q_2N3904(name) QBJT_EB(name, "NPN(Is=6.734f Xti=3 Eg=1.11 Vaf=74.03 Bf=416.4 Ne=1.259 Ise=6.734 Ikf=66.78m Xtb=1.5 Br=.7371 Nc=2 Isc=0 Ikr=0 Rc=1 Cjc=3.638p Mjc=.3085 Vjc=.75 Fc=.5 Cje=4.493p Mje=.2593 Vje=.75 Tr=239.5n f=301.2p Itf=.4 Vtf=4 Xtf=2 Rb=10)")
+#define Q_2N3904(name) QBJT_EB(name, "2N3904")
-// SPICE model taken directly from Fairchild Semiconductor datasheet
-#define Q_2N3906(name) QBJT_EB(name, "PNP(Is=1.41f Xti=3 Eg=1.11 Vaf=18.7 Bf=180.7 Ne=1.5 Ise=0 Ikf=80m Xtb=1.5 Br=4.977 Nc=2 Isc=0 Ikr=0 Rc=2.5 Cjc=9.728p Mjc=.5776 Vjc=.75 Fc=.5 Cje=8.063p Mje=.3677 Vje=.75 Tr=33.42n Tf=179.3p Itf=.4 Vtf=4 Xtf=6 Rb=10)")
+#define Q_2N3906(name) QBJT_EB(name, "2N3906")
-// SPICE model taken from https://www.onsemi.com/support/design-resources/models?rpn=2N6107
-#define Q_2N6107(name) QBJT_EB(name, "PNP(IS=7.62308e-14 BF=6692.56 NF=0.85 VAF=10 IKF=0.032192 ISE=2.07832e-13 NE=2.41828 BR=15.6629 NR=1.5 VAR=1.44572 IKR=0.32192 ISC=4.75e-16 NC=3.9375 RB=7.19824 IRB=0.1 RBM=0.1 RE=0.0001 RC=0.355458 XTB=0.1 XTI=2.97595 EG=1.206 CJE=1.84157e-10 VJE=0.99 MJE=0.347177 TF=6.63757e-09 XTF=1.50003 VTF=1.0001 ITF=1 CJC=1.06717e-10 VJC=0.942679 MJC=0.245405 XCJC=0.8 FC=0.533334 CJS=0 VJS=0.75 MJS=0.5 TR=1.32755e-07 PTF=0 KF=0 AF=1)")
+#define Q_2N6107(name) QBJT_EB(name, "2N6107")
-// SPICE model taken from https://www.onsemi.com/support/design-resources/models?rpn=2N6292
-#define Q_2N6292(name) QBJT_EB(name, "NPN(IS=9.3092e-13 BF=2021.8 NF=0.85 VAF=63.2399 IKF=1 ISE=1.92869e-13 NE=1.97024 BR=40.0703 NR=1.5 VAR=0.89955 IKR=10 ISC=4.92338e-16 NC=3.9992 RB=6.98677 IRB=0.1 RBM=0.1 RE=0.0001 RC=0.326141 XTB=0.1 XTI=2.86739 EG=1.206 CJE=1.84157e-10 VJE=0.99 MJE=0.347174 TF=6.73756e-09 XTF=1.49917 VTF=0.997395 ITF=0.998426 CJC=1.06717e-10 VJC=0.942694 MJC=0.245406 XCJC=0.8 FC=0.533405 CJS=0 VJS=0.75 MJS=0.5 TR=6.0671e-08 PTF=0 KF=0 AF=1)")
+#define Q_2N6292(name) QBJT_EB(name, "2N6292")
-// SPICE model taken from http://ltwiki.org/files/LTspiceIV/Vendor%20List/Fairchild/2N/index.html
-#define Q_2N5210(name) QBJT_EB(name, "NPN(Is=5.911f Xti=3 Eg=1.11 Vaf=62.37 Bf=809.9 Ne=1.358 Ise=5.911f Ikf=14.26m Xtb=1.5 Br=1.287 Nc=2 Isc=0 Ikr=0 Rc=1.61 Cjc=4.017p Mjc=.3174 Vjc=.75 Fc=.5 Cje=4.973p Mje=.4146 Vje=.75 Tr=4.68n Tf=820.9p Itf=.35 Vtf=4 Xtf=7 Rb=10)")
+#define Q_2N5210(name) QBJT_EB(name, "2N5210")
diff --git a/src/mame/audio/nl_destroyr.cpp b/src/mame/audio/nl_destroyr.cpp
index 2f3e8f7f81b..0ed9c7dc701 100644
--- a/src/mame/audio/nl_destroyr.cpp
+++ b/src/mame/audio/nl_destroyr.cpp
@@ -32,25 +32,6 @@ static NETLIST_START(LM324_VM5V12_DIP)
NET_C(A.VCC, B.VCC, C.VCC, D.VCC)
NETLIST_END()
-static NETLIST_START(NE556_DIP)
- NE555(A)
- NE555(B)
-
- NET_C(A.GND, B.GND)
- NET_C(A.VCC, B.VCC)
-
- DIPPINS( /* +--------------+ */
- A.DISCH, /* 1DISCH |1 ++ 14| VCC */ A.VCC,
- A.THRESH, /* 1THRES |2 13| 2DISCH */ B.DISCH,
- A.CONT, /* 1CONT |3 12| 2THRES */ B.THRESH,
- A.RESET, /* 1RESET |4 NE556 11| 2CONT */ B.CONT,
- A.OUT, /* 1OUT |5 10| 2RESET */ B.RESET,
- A.TRIG, /* 1TRIG |6 9| 2OUT */ B.OUT,
- A.GND, /* GND |7 8| 2TRIG */ B.TRIG
- /* +--------------+ */
- )
-NETLIST_END()
-
NETLIST_START(destroyr)
SOLVER(Solver, 48000)
@@ -65,7 +46,7 @@ NETLIST_START(destroyr)
NET_MODEL("LM324_M5V12V OPAMP(TYPE=3 VLH=1.1 VLL=0.11 FPF=5 UGF=50k SLEW=0.3M RI=1000k RO=50 DAB=0.00075)")
- LOCAL_SOURCE(NE556_DIP)
+ //LOCAL_SOURCE(NE556_DIP)
LOCAL_SOURCE(LM324_VM5V12_DIP)
TTL_INPUT(MOTOR_SPEED, 0)
diff --git a/src/mame/audio/nl_elim.cpp b/src/mame/audio/nl_elim.cpp
index d027cd1a244..834f84ffce1 100644
--- a/src/mame/audio/nl_elim.cpp
+++ b/src/mame/audio/nl_elim.cpp
@@ -53,10 +53,9 @@
#define D_1N914(name) DIODE(name, "1N914")
-#define D_1N4002(name) DIODE(name, "D(IS=65.4p RS=42.2m BV=100 IBV=5.00u CJO=14.8p M=0.333 N=1.36 TT=2.88u)")
+#define D_1N4002(name) DIODE(name, "1N4002")
-// SPICE model taken from https://www.onsemi.com/support/design-resources/models?rpn=2N4403
-#define Q_2N4403(name) QBJT_EB(name, "PNP(Is=650.6E-18 Xti=3 Eg=1.11 Vaf=115.7 Bf=216.2 Ne=1.829 Ise=58.72f Ikf=1.079 Xtb=1.5 Br=3.578 Nc=2 Isc=0 Ikr=0 Rc=.715 Cjc=14.76p Mjc=.5383 Vjc=.75 Fc=.5 Cje=19.82p Mje=.3357 Vje=.75 Tr=111.6n Tf=603.7p Itf=.65 Vtf=5 Xtf=1.7 Rb=10)")
+#define Q_2N4403(name) QBJT_EB(name, "2N4403")
#define LM555_DIP NE555_DIP
#define LM566_DIP NE566_DIP
diff --git a/src/mame/audio/nl_fireone.cpp b/src/mame/audio/nl_fireone.cpp
index 5bca887402e..fced0ac6994 100644
--- a/src/mame/audio/nl_fireone.cpp
+++ b/src/mame/audio/nl_fireone.cpp
@@ -13,87 +13,6 @@
#include "netlist/devices/net_lib.h"
//
-// 556 is just two 555s in one package
-//
-
-static NETLIST_START(NE556_DIP)
- NE555(A)
- NE555(B)
-
- NET_C(A.GND, B.GND)
- NET_C(A.VCC, B.VCC)
-
- DIPPINS( /* +--------------+ */
- A.DISCH, /* 1DISCH |1 ++ 14| VCC */ A.VCC,
- A.THRESH, /* 1THRES |2 13| 2DISCH */ B.DISCH,
- A.CONT, /* 1CONT |3 12| 2THRES */ B.THRESH,
- A.RESET, /* 1RESET |4 NE556 11| 2CONT */ B.CONT,
- A.OUT, /* 1OUT |5 10| 2RESET */ B.RESET,
- A.TRIG, /* 1TRIG |6 9| 2OUT */ B.OUT,
- A.GND, /* GND |7 8| 2TRIG */ B.TRIG
- /* +--------------+ */
- )
-NETLIST_END()
-
-
-//
-// ICL8038 is broadly similar to a 566 VCO, and can be simulated partially as such.
-//
-
-static NETLIST_START(ICL8038_DIP)
- VCVS(VI, 1)
- CCCS(CI1, -1)
- CCCS(CI2, 2)
- SYS_COMPD(COMP)
- SYS_DSW2(SW)
- VCVS(VO, 1)
- RES(R_SHUNT, RES_R(50))
-
- PARAM(VO.RO, 50)
- PARAM(COMP.MODEL, "FAMILY(TYPE=CUSTOM IVL=0.16 IVH=0.4 OVL=0.01 OVH=0.01 ORL=50 ORH=50)")
- PARAM(SW.GOFF, 0) // This has to be zero to block current sources
-
- NET_C(VI.OP, CI1.IN, CI2.IN)
- NET_C(CI1.OP, VO.IP)
- NET_C(COMP.Q, SW.I)
- NET_C(CI2.OP, SW.2)
- NET_C(COMP.VCC, R_SHUNT.1)
- NET_C(SW.1, R_SHUNT.2)
- NET_C(SW.3, VO.IP)
- NET_C(VO.OP, COMP.IN)
-
- // Avoid singular Matrix due to G=0 switch
- RES(RX1, 1e10)
- RES(RX2, 1e10)
- NET_C(RX1.1, SW.1)
- NET_C(RX2.1, SW.3)
-
- NET_C(COMP.GND, RX1.2, RX2.2)
-
- RES(R1, 5000)
- RES(R2, 5000)
- RES(R3, 5000)
-
- // Square output wave
- VCVS(V_SQR, 1)
- NET_C(COMP.Q, V_SQR.IP)
-
- NET_C(COMP.GND, SW.GND, VI.ON, VI.IN, CI1.ON, CI2.ON, VO.IN, VO.ON, R2.2, V_SQR.IN, V_SQR.ON)
- NET_C(COMP.VCC, SW.VCC, R1.2)
- NET_C(COMP.IP, R1.1, R2.1, R3.1)
- NET_C(COMP.Q, R3.2)
-
- ALIAS(11, VI.ON) // GND
- ALIAS(9, V_SQR.OP) // Square out
- ALIAS(3, VO.OP) // Triag out
- ALIAS(8, VI.IP) // VC
- ALIAS(4, CI1.IP) // R1
- ALIAS(5, CI2.IP) // R2
- ALIAS(10, VO.IP) // C1
- ALIAS(6, COMP.VCC) // V+
-NETLIST_END()
-
-//
// Main netlist
//
@@ -130,9 +49,6 @@ NETLIST_START(fireone)
NET_C(VCC, MUSIC_A.VCC, MUSIC_B.VCC, MUSIC_C.VCC)
NET_C(GND, MUSIC_A.GND, MUSIC_B.GND, MUSIC_C.GND)
- LOCAL_SOURCE(NE556_DIP)
- LOCAL_SOURCE(ICL8038_DIP)
-
TTL_7406_GATE(IC27_A)
TTL_7406_GATE(IC27_B)
TTL_7406_GATE(IC27_C)
diff --git a/src/mame/audio/nl_flyball.cpp b/src/mame/audio/nl_flyball.cpp
index 6e6a1d94fa1..45a4ab4cb19 100644
--- a/src/mame/audio/nl_flyball.cpp
+++ b/src/mame/audio/nl_flyball.cpp
@@ -11,25 +11,6 @@
#include "netlist/devices/net_lib.h"
-static NETLIST_START(NE556_DIP)
- NE555(A)
- NE555(B)
-
- NET_C(A.GND, B.GND)
- NET_C(A.VCC, B.VCC)
-
- DIPPINS( /* +--------------+ */
- A.DISCH, /* 1DISCH |1 ++ 14| VCC */ A.VCC,
- A.THRESH, /* 1THRES |2 13| 2DISCH */ B.DISCH,
- A.CONT, /* 1CONT |3 12| 2THRES */ B.THRESH,
- A.RESET, /* 1RESET |4 NE556 11| 2CONT */ B.CONT,
- A.OUT, /* 1OUT |5 10| 2RESET */ B.RESET,
- A.TRIG, /* 1TRIG |6 9| 2OUT */ B.OUT,
- A.GND, /* GND |7 8| 2TRIG */ B.TRIG
- /* +--------------+ */
- )
-NETLIST_END()
-
NETLIST_START(flyball)
SOLVER(Solver, 48000)
@@ -41,8 +22,6 @@ NETLIST_START(flyball)
NET_C(VCC, H256.VCC, V128.VCC)
NET_C(GND, H256.GND, V128.GND)
- LOCAL_SOURCE(NE556_DIP)
-
TTL_INPUT(BAT_SOUND, 1)
TTL_INPUT(FOOTSTEP, 1)
TTL_INPUT(CROWD_SL, 1)
diff --git a/src/mame/audio/nl_spacfury.cpp b/src/mame/audio/nl_spacfury.cpp
index 5114b1a4c9c..b66b842915c 100644
--- a/src/mame/audio/nl_spacfury.cpp
+++ b/src/mame/audio/nl_spacfury.cpp
@@ -47,13 +47,11 @@
//
#define D_1N914(name) DIODE(name, "1N914")
-#define D_1N4002(name) DIODE(name, "D(IS=65.4p RS=42.2m BV=100 IBV=5.00u CJO=14.8p M=0.333 N=1.36 TT=2.88u)")
+#define D_1N4002(name) DIODE(name, "1N4002")
-// SPICE model taken from https://www.onsemi.com/support/design-resources/models?rpn=2N4401
-#define Q_2N4401(name) QBJT_EB(name, "NPN(Is=26.03f Xti=3 Eg=1.11 Vaf=90.7 Bf=4.292K Ne=1.244 Ise=26.03f Ikf=.2061 Xtb=1.5 Br=1.01 Nc=2 Isc=0 Ikr=0 Rc=.5 Cjc=11.01p Mjc=.3763 Vjc=.75 Fc=.5 Cje=24.07p Mje=.3641 Vje=.75 Tr=233.7n Tf=466.5p Itf=0 Vtf=0 Xtf=0 Rb=10)")
+#define Q_2N4401(name) QBJT_EB(name, "2N4401")
-// SPICE model taken from https://www.onsemi.com/support/design-resources/models?rpn=2N4403
-#define Q_2N4403(name) QBJT_EB(name, "PNP(Is=650.6E-18 Xti=3 Eg=1.11 Vaf=115.7 Bf=216.2 Ne=1.829 Ise=58.72f Ikf=1.079 Xtb=1.5 Br=3.578 Nc=2 Isc=0 Ikr=0 Rc=.715 Cjc=14.76p Mjc=.5383 Vjc=.75 Fc=.5 Cje=19.82p Mje=.3357 Vje=.75 Tr=111.6n Tf=603.7p Itf=.65 Vtf=5 Xtf=1.7 Rb=10)")
+#define Q_2N4403(name) QBJT_EB(name, "2N4403")
// JFET transistors not supported, but this should do the trick
//#define Q_2N4093(name) MOSFET(name, "NMOS(VTO=-1.0)")
diff --git a/src/mame/audio/nl_starfire.cpp b/src/mame/audio/nl_starfire.cpp
index bae260e7ad1..668d85966cb 100644
--- a/src/mame/audio/nl_starfire.cpp
+++ b/src/mame/audio/nl_starfire.cpp
@@ -14,82 +14,6 @@
#include "netlist/devices/net_lib.h"
//
-// 556 is just two 555s in one package
-//
-
-static NETLIST_START(NE556_DIP)
- NE555(A)
- NE555(B)
-
- NET_C(A.GND, B.GND)
- NET_C(A.VCC, B.VCC)
-
- DIPPINS( /* +--------------+ */
- A.DISCH, /* 1DISCH |1 ++ 14| VCC */ A.VCC,
- A.THRESH, /* 1THRES |2 13| 2DISCH */ B.DISCH,
- A.CONT, /* 1CONT |3 12| 2THRES */ B.THRESH,
- A.RESET, /* 1RESET |4 NE556 11| 2CONT */ B.CONT,
- A.OUT, /* 1OUT |5 10| 2RESET */ B.RESET,
- A.TRIG, /* 1TRIG |6 9| 2OUT */ B.OUT,
- A.GND, /* GND |7 8| 2TRIG */ B.TRIG
- /* +--------------+ */
- )
-NETLIST_END()
-
-static NETLIST_START(ICL8038_DIP)
- VCVS(VI, 1)
- CCCS(CI1, -1)
- CCCS(CI2, 2)
- SYS_COMPD(COMP)
- SYS_DSW2(SW)
- VCVS(VO, 1)
- RES(R_SHUNT, RES_R(50))
-
- PARAM(VO.RO, 50)
- PARAM(COMP.MODEL, "FAMILY(TYPE=CUSTOM IVL=0.16 IVH=0.4 OVL=0.01 OVH=0.01 ORL=50 ORH=50)")
- PARAM(SW.GOFF, 0) // This has to be zero to block current sources
-
- NET_C(VI.OP, CI1.IN, CI2.IN)
- NET_C(CI1.OP, VO.IP)
- NET_C(COMP.Q, SW.I)
- NET_C(CI2.OP, SW.2)
- NET_C(COMP.VCC, R_SHUNT.1)
- NET_C(SW.1, R_SHUNT.2)
- NET_C(SW.3, VO.IP)
- NET_C(VO.OP, COMP.IN)
-
- // Avoid singular Matrix due to G=0 switch
- RES(RX1, 1e10)
- RES(RX2, 1e10)
- NET_C(RX1.1, SW.1)
- NET_C(RX2.1, SW.3)
-
- NET_C(COMP.GND, RX1.2, RX2.2)
-
- RES(R1, 5000)
- RES(R2, 5000)
- RES(R3, 5000)
-
- // Square output wave
- VCVS(V_SQR, 1)
- NET_C(COMP.Q, V_SQR.IP)
-
- NET_C(COMP.GND, SW.GND, VI.ON, VI.IN, CI1.ON, CI2.ON, VO.IN, VO.ON, R2.2, V_SQR.IN, V_SQR.ON)
- NET_C(COMP.VCC, SW.VCC, R1.2)
- NET_C(COMP.IP, R1.1, R2.1, R3.1)
- NET_C(COMP.Q, R3.2)
-
- ALIAS(11, VI.ON) // GND
- ALIAS(9, V_SQR.OP) // Square out
- ALIAS(3, VO.OP) // Triag out
- ALIAS(8, VI.IP) // VC
- ALIAS(4, CI1.IP) // R1
- ALIAS(5, CI2.IP) // R2
- ALIAS(10, VO.IP) // C1
- ALIAS(6, COMP.VCC) // V+
-NETLIST_END()
-
-//
// Main netlist
//
@@ -117,9 +41,6 @@ NETLIST_START(starfire)
NET_C(VCC, SIZE.VCC, SEXPLO.VCC, STIE.VCC, SLASER.VCC, TRACK.VCC, LOCK.VCC, SCANNER.VCC, OHEAT.VCC)
NET_C(GND, SIZE.GND, SEXPLO.GND, STIE.GND, SLASER.GND, TRACK.GND, LOCK.GND, SCANNER.GND, OHEAT.GND)
- LOCAL_SOURCE(NE556_DIP)
- LOCAL_SOURCE(ICL8038_DIP)
-
RES(R12, RES_K(10))
RES(R13, RES_K(470))
RES(R14, RES_K(470))
diff --git a/src/mame/audio/phoenix.cpp b/src/mame/audio/phoenix.cpp
index 566c9796525..7c43519c186 100644
--- a/src/mame/audio/phoenix.cpp
+++ b/src/mame/audio/phoenix.cpp
@@ -89,7 +89,7 @@ void phoenix_sound_device::device_start()
m_poly18[i] = bits;
}
- m_channel = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
save_item(NAME(m_sound_latch_a));
save_item(NAME(m_c24_state.counter));
@@ -520,10 +520,10 @@ void phoenix_sound_device::control_b_w(uint8_t data)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void phoenix_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void phoenix_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int samplerate = machine().sample_rate();
stream_sample_t *buffer = outputs[0];
diff --git a/src/mame/audio/phoenix.h b/src/mame/audio/phoenix.h
index 43c360871c1..6a02220c30e 100644
--- a/src/mame/audio/phoenix.h
+++ b/src/mame/audio/phoenix.h
@@ -22,7 +22,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
struct c_state
diff --git a/src/mame/audio/pleiads.cpp b/src/mame/audio/pleiads.cpp
index cb0d3c89c4f..ee69320e7d6 100644
--- a/src/mame/audio/pleiads.cpp
+++ b/src/mame/audio/pleiads.cpp
@@ -642,7 +642,7 @@ void pleiads_sound_device::common_start()
m_poly18[i] = bits;
}
- m_channel = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
save_item(NAME(m_sound_latch_a));
save_item(NAME(m_sound_latch_b));
@@ -691,10 +691,10 @@ void pleiads_sound_device::common_start()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void pleiads_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void pleiads_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int rate = machine().sample_rate();
stream_sample_t *buffer = outputs[0];
@@ -706,12 +706,12 @@ void pleiads_sound_device::sound_stream_update(sound_stream &stream, stream_samp
}
}
-void naughtyb_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void naughtyb_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
- pleiads_sound_device::sound_stream_update(stream, inputs, outputs, samples);
+ pleiads_sound_device::sound_stream_update_legacy(stream, inputs, outputs, samples);
}
-void popflame_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void popflame_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
- pleiads_sound_device::sound_stream_update(stream, inputs, outputs, samples);
+ pleiads_sound_device::sound_stream_update_legacy(stream, inputs, outputs, samples);
}
diff --git a/src/mame/audio/pleiads.h b/src/mame/audio/pleiads.h
index 103c1d5121e..0c4ef99b4a9 100644
--- a/src/mame/audio/pleiads.h
+++ b/src/mame/audio/pleiads.h
@@ -51,7 +51,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
void common_start();
inline int tone1(int samplerate);
@@ -105,7 +105,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
};
@@ -119,7 +119,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
};
diff --git a/src/mame/audio/polepos.cpp b/src/mame/audio/polepos.cpp
index b8e08fc588d..48865d300e0 100644
--- a/src/mame/audio/polepos.cpp
+++ b/src/mame/audio/polepos.cpp
@@ -225,7 +225,7 @@ polepos_sound_device::polepos_sound_device(const machine_config &mconfig, const
void polepos_sound_device::device_start()
{
- m_stream = stream_alloc(0, 1, OUTPUT_RATE);
+ m_stream = stream_alloc_legacy(0, 1, OUTPUT_RATE);
m_sample_msb = m_sample_lsb = 0;
m_sample_enable = 0;
@@ -251,10 +251,10 @@ void polepos_sound_device::device_reset()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void polepos_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void polepos_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
uint32_t step, clock, slot;
uint8_t *base;
diff --git a/src/mame/audio/polepos.h b/src/mame/audio/polepos.h
index 69c8852ac75..430078088b2 100644
--- a/src/mame/audio/polepos.h
+++ b/src/mame/audio/polepos.h
@@ -19,7 +19,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
public:
DECLARE_WRITE_LINE_MEMBER(clson_w);
diff --git a/src/mame/audio/redbaron.cpp b/src/mame/audio/redbaron.cpp
index 486dffb4cea..c08036c7d3b 100644
--- a/src/mame/audio/redbaron.cpp
+++ b/src/mame/audio/redbaron.cpp
@@ -102,16 +102,16 @@ void redbaron_sound_device::device_start()
m_vol_crash[i] = 32767 * r0 / (r0 + r1);
}
- m_channel = stream_alloc(0, 1, OUTPUT_RATE);
+ m_channel = stream_alloc_legacy(0, 1, OUTPUT_RATE);
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void redbaron_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void redbaron_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
while( samples-- )
diff --git a/src/mame/audio/redbaron.h b/src/mame/audio/redbaron.h
index c5c81cb3264..a66b74dff21 100644
--- a/src/mame/audio/redbaron.h
+++ b/src/mame/audio/redbaron.h
@@ -21,7 +21,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
std::unique_ptr<int16_t[]> m_vol_lookup;
diff --git a/src/mame/audio/segag80.cpp b/src/mame/audio/segag80.cpp
index 6d266f3ba24..aa377894643 100644
--- a/src/mame/audio/segag80.cpp
+++ b/src/mame/audio/segag80.cpp
@@ -127,7 +127,7 @@ void segag80_audio_device_base::write_ay(offs_t addr, uint8_t data)
DEFINE_DEVICE_TYPE(ELIMINATOR_AUDIO, elim_audio_device, "elim_audio", "Eliminator Sound Board")
elim_audio_device::elim_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- segag80_audio_device_base(mconfig, ELIMINATOR_AUDIO, tag, owner, clock, 0xfe, 0xff, false, NETLIST_NAME(elim), 5000.0)
+ segag80_audio_device_base(mconfig, ELIMINATOR_AUDIO, tag, owner, clock, 0xfe, 0xff, false, NETLIST_NAME(elim), 0.15)
{
}
@@ -142,7 +142,7 @@ elim_audio_device::elim_audio_device(const machine_config &mconfig, const char *
DEFINE_DEVICE_TYPE(ZEKTOR_AUDIO, zektor_audio_device, "zektor_audio", "Zektor Sound Board")
zektor_audio_device::zektor_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- segag80_audio_device_base(mconfig, ZEKTOR_AUDIO, tag, owner, clock, 0xfe, 0xff, true, NETLIST_NAME(zektor), 5000.0)
+ segag80_audio_device_base(mconfig, ZEKTOR_AUDIO, tag, owner, clock, 0xfe, 0xff, true, NETLIST_NAME(zektor), 0.15)
{
}
@@ -157,7 +157,7 @@ zektor_audio_device::zektor_audio_device(const machine_config &mconfig, const ch
DEFINE_DEVICE_TYPE(SPACE_FURY_AUDIO, spacfury_audio_device, "spcfury_audio", "Space Fury Sound Board")
spacfury_audio_device::spacfury_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- segag80_audio_device_base(mconfig, SPACE_FURY_AUDIO, tag, owner, clock, 0xc7, 0x3f, false, NETLIST_NAME(spacfury), 60000.0)
+ segag80_audio_device_base(mconfig, SPACE_FURY_AUDIO, tag, owner, clock, 0xc7, 0x3f, false, NETLIST_NAME(spacfury), 2.0)
{
}
@@ -172,6 +172,6 @@ spacfury_audio_device::spacfury_audio_device(const machine_config &mconfig, cons
DEFINE_DEVICE_TYPE(ASTRO_BLASTER_AUDIO, astrob_audio_device, "astrob_audio", "Astro Blaster Sound Board")
astrob_audio_device::astrob_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
- segag80_audio_device_base(mconfig, ASTRO_BLASTER_AUDIO, tag, owner, clock, 0xff, 0xff, false, NETLIST_NAME(astrob), 25000.0)
+ segag80_audio_device_base(mconfig, ASTRO_BLASTER_AUDIO, tag, owner, clock, 0xff, 0xff, false, NETLIST_NAME(astrob), 1.0)
{
}
diff --git a/src/mame/audio/segag80r.cpp b/src/mame/audio/segag80r.cpp
index 1662c2f2258..90a8463cbad 100644
--- a/src/mame/audio/segag80r.cpp
+++ b/src/mame/audio/segag80r.cpp
@@ -46,7 +46,7 @@ void sega005_sound_device::device_start()
segag80r_state *state = machine().driver_data<segag80r_state>();
/* create the stream */
- m_sega005_stream = machine().sound().stream_alloc(*this, 0, 1, SEGA005_COUNTER_FREQ);
+ m_sega005_stream = stream_alloc_legacy(0, 1, SEGA005_COUNTER_FREQ);
/* create a timer for the 555 */
m_sega005_sound_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sega005_sound_device::sega005_auto_timer), this));
@@ -57,10 +57,10 @@ void sega005_sound_device::device_start()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void sega005_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void sega005_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
segag80r_state *state = machine().driver_data<segag80r_state>();
const uint8_t *sound_prom = state->memregion("proms")->base();
diff --git a/src/mame/audio/segausb.cpp b/src/mame/audio/segausb.cpp
index 16293500ed0..ef6343e945d 100644
--- a/src/mame/audio/segausb.cpp
+++ b/src/mame/audio/segausb.cpp
@@ -100,7 +100,7 @@ void usb_sound_device::device_start()
#else
- m_stream = stream_alloc(0, 1, USB_2MHZ_CLOCK);
+ m_stream = stream_alloc_legacy(0, 1, USB_2MHZ_CLOCK);
m_noise_shift = 0x15555;
@@ -451,10 +451,10 @@ void usb_sound_device::env_w(int which, u8 offset, u8 data)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void usb_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void usb_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *dest = outputs[0];
diff --git a/src/mame/audio/segausb.h b/src/mame/audio/segausb.h
index afed3b688af..e34d892142d 100644
--- a/src/mame/audio/segausb.h
+++ b/src/mame/audio/segausb.h
@@ -62,7 +62,7 @@ protected:
#if (!ENABLE_SEGAUSB_NETLIST)
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
#endif
private:
diff --git a/src/mame/audio/seibu.cpp b/src/mame/audio/seibu.cpp
index 798338a29a6..17075367960 100644
--- a/src/mame/audio/seibu.cpp
+++ b/src/mame/audio/seibu.cpp
@@ -385,7 +385,7 @@ seibu_adpcm_device::seibu_adpcm_device(const machine_config &mconfig, const char
void seibu_adpcm_device::device_start()
{
m_playing = 0;
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock());
+ m_stream = stream_alloc_legacy(0, 1, clock());
m_adpcm.reset();
save_item(NAME(m_current));
@@ -443,10 +443,10 @@ void seibu_adpcm_device::ctl_w(u8 data)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void seibu_adpcm_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void seibu_adpcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *dest = outputs[0];
diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h
index 396f4612d0b..9954b462205 100644
--- a/src/mame/audio/seibu.h
+++ b/src/mame/audio/seibu.h
@@ -145,7 +145,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
// internal state
diff --git a/src/mame/audio/sente6vb.cpp b/src/mame/audio/sente6vb.cpp
index f4232038c9b..22c9721a18a 100644
--- a/src/mame/audio/sente6vb.cpp
+++ b/src/mame/audio/sente6vb.cpp
@@ -65,6 +65,55 @@
DEFINE_DEVICE_TYPE(SENTE6VB, sente6vb_device, "sente6vb", "Bally Sente 6VB Audio Board")
+
+/*************************************
+*
+* Trivial sound device to spew
+* a MM5837 noise stream to CEM3394
+* inputs
+*
+*************************************/
+
+DECLARE_DEVICE_TYPE(MM5837_NOISE_SOURCE, mm5837_noise_source)
+
+class mm5837_noise_source : public device_t, public device_sound_interface
+{
+public:
+ mm5837_noise_source(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, MM5837_NOISE_SOURCE, tag, owner, clock),
+ device_sound_interface(mconfig, *this),
+ m_stream(nullptr),
+ m_noise_state(0x1ffff)
+ {
+ }
+
+protected:
+ // device-level overrides
+ virtual void device_start() override
+ {
+ m_stream = stream_alloc(0, 1, clock());
+ save_item(NAME(m_noise_state));
+ }
+
+ // sound stream update overrides
+ virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override
+ {
+ for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++)
+ {
+ outputs[0].put(sampindex, BIT(m_noise_state, 0) ? 1.0 : 0.0);
+ m_noise_state = (m_noise_state >> 1) | ((BIT(m_noise_state, 0) ^ BIT(m_noise_state, 3)) << 16);
+ }
+ }
+
+private:
+ sound_stream *m_stream; // sound stream
+ u32 m_noise_state; // noise state
+};
+
+DEFINE_DEVICE_TYPE(MM5837_NOISE_SOURCE, mm5837_noise_source, "mm5837noise", "MM5837")
+
+
+
/*************************************
*
* Sound CPU memory handlers
@@ -123,20 +172,16 @@ void sente6vb_device::device_add_mconfig(machine_config &config)
SPEAKER(config, "mono").front_center();
+ mm5837_noise_source &noise(MM5837_NOISE_SOURCE(config, "noise", 100000));
+
for (auto &cem_device : m_cem_device)
{
CEM3394(config, cem_device, 0);
cem_device->set_vco_zero_freq(431.894);
cem_device->set_filter_zero_freq(1300.0);
cem_device->add_route(ALL_OUTPUTS, "mono", 0.90);
+ noise.add_route(0, *cem_device, 1.0);
}
-
- m_cem_device[0]->set_ext_input_callback(FUNC(sente6vb_device::noise_gen_0));
- m_cem_device[1]->set_ext_input_callback(FUNC(sente6vb_device::noise_gen_1));
- m_cem_device[2]->set_ext_input_callback(FUNC(sente6vb_device::noise_gen_2));
- m_cem_device[3]->set_ext_input_callback(FUNC(sente6vb_device::noise_gen_3));
- m_cem_device[4]->set_ext_input_callback(FUNC(sente6vb_device::noise_gen_4));
- m_cem_device[5]->set_ext_input_callback(FUNC(sente6vb_device::noise_gen_5));
}
@@ -164,24 +209,21 @@ const tiny_rom_entry *sente6vb_device::device_rom_region() const
*
*************************************/
-sente6vb_device::sente6vb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, SENTE6VB, tag, owner, clock)
- , m_pit(*this, "pit")
- , m_counter_0_timer(*this, "8253_0_timer")
- , m_cem_device(*this, "cem%u", 1U)
- , m_audiocpu(*this, "audiocpu")
- , m_uart(*this, "uart")
- , m_send_cb(*this)
- , m_clock_out_cb(*this)
+sente6vb_device::sente6vb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, SENTE6VB, tag, owner, clock),
+ m_pit(*this, "pit"),
+ m_counter_0_timer(*this, "8253_0_timer"),
+ m_cem_device(*this, "cem%u", 1U),
+ m_audiocpu(*this, "audiocpu"),
+ m_uart(*this, "uart"),
+ m_send_cb(*this),
+ m_clock_out_cb(*this)
{
}
void sente6vb_device::device_start()
{
- // create the polynomial tables
- poly17_init();
-
m_send_cb.resolve_safe();
m_clock_out_cb.resolve_safe();
m_uart->write_cts(0);
@@ -197,8 +239,6 @@ void sente6vb_device::device_start()
save_item(NAME(m_chip_select));
save_item(NAME(m_uint));
-
- save_item(NAME(m_noise_position));
}
@@ -215,64 +255,8 @@ void sente6vb_device::device_reset()
m_dac_value = 0;
m_dac_register = 0;
m_chip_select = 0x3f;
-
- // reset the noise generator
- memset(m_noise_position, 0, sizeof(m_noise_position));
-}
-
-
-
-/*************************************
- *
- * MM5837 noise generator
- *
- * NOTE: this is stolen straight from
- * POKEY.c
- *
- *************************************/
-
-void sente6vb_device::poly17_init()
-{
- uint32_t i, x = 0;
- uint8_t *p;
-
- // allocate memory
- p = m_poly17;
-
- // generate the polynomial
- for (i = 0; i < POLY17_SIZE; i++)
- {
- // store new values
- *p++ = x & 1;
-
- // calculate next bit
- x = ((x << POLY17_SHL) + (x >> POLY17_SHR) + POLY17_ADD) & POLY17_SIZE;
- }
-}
-
-
-inline void sente6vb_device::noise_gen_chip(int chip, int count, short *buffer)
-{
- // noise generator runs at 100kHz
- uint32_t step = (100000 << 14) / cem3394_device::SAMPLE_RATE;
- uint32_t noise_counter = m_noise_position[chip];
-
- while (count--)
- {
- *buffer++ = m_poly17[(noise_counter >> 14) & POLY17_SIZE] << 12;
- noise_counter += step;
- }
-
- // remember the noise position
- m_noise_position[chip] = noise_counter;
}
-CEM3394_EXT_INPUT(sente6vb_device::noise_gen_0) { noise_gen_chip(0, count, buffer); }
-CEM3394_EXT_INPUT(sente6vb_device::noise_gen_1) { noise_gen_chip(1, count, buffer); }
-CEM3394_EXT_INPUT(sente6vb_device::noise_gen_2) { noise_gen_chip(2, count, buffer); }
-CEM3394_EXT_INPUT(sente6vb_device::noise_gen_3) { noise_gen_chip(3, count, buffer); }
-CEM3394_EXT_INPUT(sente6vb_device::noise_gen_4) { noise_gen_chip(4, count, buffer); }
-CEM3394_EXT_INPUT(sente6vb_device::noise_gen_5) { noise_gen_chip(5, count, buffer); }
/*************************************
diff --git a/src/mame/audio/sente6vb.h b/src/mame/audio/sente6vb.h
index 9780703a1fd..ee199817360 100644
--- a/src/mame/audio/sente6vb.h
+++ b/src/mame/audio/sente6vb.h
@@ -50,15 +50,7 @@ private:
void update_counter_0_timer();
TIMER_DEVICE_CALLBACK_MEMBER(clock_counter_0_ff);
- void poly17_init();
DECLARE_WRITE_LINE_MEMBER(set_counter_0_ff);
- inline void noise_gen_chip(int chip, int count, short *buffer);
- CEM3394_EXT_INPUT(noise_gen_0);
- CEM3394_EXT_INPUT(noise_gen_1);
- CEM3394_EXT_INPUT(noise_gen_2);
- CEM3394_EXT_INPUT(noise_gen_3);
- CEM3394_EXT_INPUT(noise_gen_4);
- CEM3394_EXT_INPUT(noise_gen_5);
void mem_map(address_map &map);
void io_map(address_map &map);
@@ -78,9 +70,6 @@ private:
bool m_counter_0_out;
bool m_counter_0_timer_active;
- // random number generator states
- uint8_t m_poly17[POLY17_SIZE + 1];
-
// CEM3394 DAC control states
uint16_t m_dac_value;
uint8_t m_dac_register;
@@ -88,9 +77,6 @@ private:
// sound CPU 6850 states
bool m_uint;
-
- // noise generator states
- uint32_t m_noise_position[6];
};
DECLARE_DEVICE_TYPE(SENTE6VB, sente6vb_device)
diff --git a/src/mame/audio/snk6502.cpp b/src/mame/audio/snk6502.cpp
index 70247ff9c5e..4d5550e08c3 100644
--- a/src/mame/audio/snk6502.cpp
+++ b/src/mame/audio/snk6502.cpp
@@ -165,7 +165,7 @@ void snk6502_sound_device::device_start()
// 38.99 Hz update (according to schematic)
set_music_clock(M_LN2 * (RES_K(18) * 2 + RES_K(1)) * CAP_U(1));
- m_tone_stream = machine().sound().stream_alloc(*this, 0, 1, SAMPLE_RATE);
+ m_tone_stream = stream_alloc_legacy(0, 1, SAMPLE_RATE);
for (int i = 0; i < NUM_CHANNELS; i++)
{
@@ -509,10 +509,10 @@ void snk6502_sound_device::speech_w(uint8_t data, const uint16_t *table, int sta
*/
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void snk6502_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void snk6502_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
diff --git a/src/mame/audio/snk6502.h b/src/mame/audio/snk6502.h
index dab65476835..99c0178120c 100644
--- a/src/mame/audio/snk6502.h
+++ b/src/mame/audio/snk6502.h
@@ -40,7 +40,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
static constexpr unsigned NUM_CHANNELS = 3;
diff --git a/src/mame/audio/socrates.cpp b/src/mame/audio/socrates.cpp
index 0b86830d412..4b49ec0b5bd 100644
--- a/src/mame/audio/socrates.cpp
+++ b/src/mame/audio/socrates.cpp
@@ -43,15 +43,15 @@ void socrates_snd_device::device_start()
m_DAC_output = 0x00; /* output */
m_state[0] = m_state[1] = m_state[2] = 0;
m_accum[0] = m_accum[1] = m_accum[2] = 0xFF;
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() ? clock() : machine().sample_rate());
+ m_stream = stream_alloc_legacy(0, 1, clock() ? clock() : machine().sample_rate());
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void socrates_snd_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void socrates_snd_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
for (int i = 0; i < samples; i++)
{
diff --git a/src/mame/audio/socrates.h b/src/mame/audio/socrates.h
index 4f840bca384..cd2d240079c 100644
--- a/src/mame/audio/socrates.h
+++ b/src/mame/audio/socrates.h
@@ -22,7 +22,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
void snd_clock();
static const uint8_t s_volumeLUT[];
diff --git a/src/mame/audio/special.cpp b/src/mame/audio/special.cpp
index e48d8a37c4a..9a1383bfec0 100644
--- a/src/mame/audio/special.cpp
+++ b/src/mame/audio/special.cpp
@@ -41,15 +41,15 @@ specimx_sound_device::specimx_sound_device(const machine_config &mconfig, const
void specimx_sound_device::device_start()
{
m_specimx_input[0] = m_specimx_input[1] = m_specimx_input[2] = 0;
- m_mixer_channel = stream_alloc(0, 1, machine().sample_rate());
+ m_mixer_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void specimx_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void specimx_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int16_t channel_0_signal;
int16_t channel_1_signal;
diff --git a/src/mame/audio/special.h b/src/mame/audio/special.h
index 8fbcfe176cc..daaa983a2d7 100644
--- a/src/mame/audio/special.h
+++ b/src/mame/audio/special.h
@@ -26,7 +26,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
sound_stream *m_mixer_channel;
diff --git a/src/mame/audio/svis_snd.cpp b/src/mame/audio/svis_snd.cpp
index a51dbb15d35..91fdd2dcce1 100644
--- a/src/mame/audio/svis_snd.cpp
+++ b/src/mame/audio/svis_snd.cpp
@@ -45,15 +45,15 @@ void svision_sound_device::device_start()
memset(&m_noise, 0, sizeof(m_noise));
memset(m_channel, 0, sizeof(m_channel));
- m_mixer_channel = stream_alloc(0, 2, machine().sample_rate());
+ m_mixer_channel = stream_alloc_legacy(0, 2, machine().sample_rate());
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void svision_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *left=outputs[0], *right=outputs[1];
diff --git a/src/mame/audio/svis_snd.h b/src/mame/audio/svis_snd.h
index fc761ba73ba..9b7efad6353 100644
--- a/src/mame/audio/svis_snd.h
+++ b/src/mame/audio/svis_snd.h
@@ -41,7 +41,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
struct NOISE
diff --git a/src/mame/audio/taito_en.cpp b/src/mame/audio/taito_en.cpp
index daccefe8ae2..f4f15533fbf 100644
--- a/src/mame/audio/taito_en.cpp
+++ b/src/mame/audio/taito_en.cpp
@@ -237,20 +237,20 @@ void taito_en_device::device_add_mconfig(machine_config &config)
/* sound hardware */
ESQ_5505_5510_PUMP(config, m_pump, XTAL(30'476'180) / (2 * 16 * 32));
m_pump->set_esp(m_esp);
- m_pump->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_pump->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
+ m_pump->add_route(0, *this, 0.5, AUTO_ALLOC_INPUT, 0);
+ m_pump->add_route(1, *this, 0.5, AUTO_ALLOC_INPUT, 1);
ES5505(config, m_ensoniq, XTAL(30'476'180) / 2);
m_ensoniq->sample_rate_changed().set(FUNC(taito_en_device::es5505_clock_changed));
m_ensoniq->set_addrmap(0, &taito_en_device::en_otis_map);
m_ensoniq->set_addrmap(1, &taito_en_device::en_otis_map);
m_ensoniq->set_channels(4);
- m_ensoniq->add_route(0, "pump", 1.0, 0);
- m_ensoniq->add_route(1, "pump", 1.0, 1);
- m_ensoniq->add_route(2, "pump", 1.0, 2);
- m_ensoniq->add_route(3, "pump", 1.0, 3);
- m_ensoniq->add_route(4, "pump", 1.0, 4);
- m_ensoniq->add_route(5, "pump", 1.0, 5);
- m_ensoniq->add_route(6, "pump", 1.0, 6);
- m_ensoniq->add_route(7, "pump", 1.0, 7);
+ m_ensoniq->add_route(0, "pump", 0.18, 0);
+ m_ensoniq->add_route(1, "pump", 0.18, 1);
+ m_ensoniq->add_route(2, "pump", 0.18, 2);
+ m_ensoniq->add_route(3, "pump", 0.18, 3);
+ m_ensoniq->add_route(4, "pump", 0.18, 4);
+ m_ensoniq->add_route(5, "pump", 0.18, 5);
+ m_ensoniq->add_route(6, "pump", 0.18, 6);
+ m_ensoniq->add_route(7, "pump", 0.18, 7);
}
diff --git a/src/mame/audio/tiamc1.cpp b/src/mame/audio/tiamc1.cpp
index 0bfc371802a..d99de897c22 100644
--- a/src/mame/audio/tiamc1.cpp
+++ b/src/mame/audio/tiamc1.cpp
@@ -77,7 +77,7 @@ void tiamc1_sound_device::device_start()
timer8253_reset(&m_timer0);
timer8253_reset(&m_timer1);
- m_channel = stream_alloc(0, 1, clock() / CLOCK_DIVIDER);
+ m_channel = stream_alloc_legacy(0, 1, clock() / CLOCK_DIVIDER);
m_timer1_divider = 0;
@@ -104,10 +104,10 @@ void tiamc1_sound_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void tiamc1_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void tiamc1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int count, o0, o1, o2, len, orval = 0;
diff --git a/src/mame/audio/tiamc1.h b/src/mame/audio/tiamc1.h
index 83ae793d08a..d8834816899 100644
--- a/src/mame/audio/tiamc1.h
+++ b/src/mame/audio/tiamc1.h
@@ -25,7 +25,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
struct timer8253chan
diff --git a/src/mame/audio/timeplt.cpp b/src/mame/audio/timeplt.cpp
index f0302ec0be2..7fe94dd46c7 100644
--- a/src/mame/audio/timeplt.cpp
+++ b/src/mame/audio/timeplt.cpp
@@ -228,11 +228,11 @@ void locomotn_audio_device::device_add_mconfig(machine_config &config)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void timeplt_audio_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void timeplt_audio_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// should never get here
- fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
+ fatalerror("sound_stream_update_legacy called; not applicable to legacy sound devices\n");
}
diff --git a/src/mame/audio/timeplt.h b/src/mame/audio/timeplt.h
index 195c6c79830..8e69d20caa1 100644
--- a/src/mame/audio/timeplt.h
+++ b/src/mame/audio/timeplt.h
@@ -27,7 +27,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
void filter_w(offs_t offset, uint8_t data);
uint8_t portB_r();
diff --git a/src/mame/audio/trackfld.cpp b/src/mame/audio/trackfld.cpp
index 77c474809c5..bf139f858e9 100644
--- a/src/mame/audio/trackfld.cpp
+++ b/src/mame/audio/trackfld.cpp
@@ -132,11 +132,11 @@ WRITE_LINE_MEMBER(trackfld_audio_device::sh_irqtrigger_w)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void trackfld_audio_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void trackfld_audio_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// should never get here
- fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
+ fatalerror("sound_stream_update_legacy called; not applicable to legacy sound devices\n");
}
diff --git a/src/mame/audio/trackfld.h b/src/mame/audio/trackfld.h
index fbcff2817b1..f1502443562 100644
--- a/src/mame/audio/trackfld.h
+++ b/src/mame/audio/trackfld.h
@@ -34,7 +34,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
optional_device<cpu_device> m_audiocpu;
diff --git a/src/mame/audio/turrett.cpp b/src/mame/audio/turrett.cpp
index 397c27c55e1..4d8414b0118 100644
--- a/src/mame/audio/turrett.cpp
+++ b/src/mame/audio/turrett.cpp
@@ -47,7 +47,7 @@ void turrett_device::device_start()
space().cache(m_cache);
// Create the sound stream
- m_stream = machine().sound().stream_alloc(*this, 0, 2, 44100);
+ m_stream = stream_alloc_legacy(0, 2, 44100);
// Create the volume table
for (int i = 0; i < 0x4f; ++i)
@@ -78,10 +78,10 @@ void turrett_device::device_reset()
//-------------------------------------------------
-// sound_stream_update - update sound stream
+// sound_stream_update_legacy - update sound stream
//-------------------------------------------------
-void turrett_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void turrett_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// Silence the buffers
memset(outputs[0], 0x00, sizeof(stream_sample_t) * samples);
diff --git a/src/mame/audio/tvc.cpp b/src/mame/audio/tvc.cpp
index 0d05b871361..e30c79ef959 100644
--- a/src/mame/audio/tvc.cpp
+++ b/src/mame/audio/tvc.cpp
@@ -31,7 +31,7 @@ void tvc_sound_device::device_start()
// resolve callbacks
m_write_sndint.resolve_safe();
- m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
+ m_stream = stream_alloc_legacy(0, 1, machine().sample_rate());
m_sndint_timer = timer_alloc(TIMER_SNDINT);
}
@@ -58,19 +58,19 @@ void tvc_sound_device::device_timer(emu_timer &timer, device_timer_id id, int pa
}
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void tvc_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void tvc_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int rate = machine().sample_rate() / 2;
-
+ stream_sample_t *output = outputs[0];
if (m_enabled && m_freq)
{
while( samples-- > 0 )
{
- *outputs[0]++ = m_signal * (m_volume * 0x0800);
+ *output++ = m_signal * (m_volume * 0x0800);
m_incr -= m_freq;
while(m_incr < 0)
{
@@ -82,7 +82,7 @@ void tvc_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t
else
{
// fill output with 0 if the sound is disabled
- memset(outputs[0], 0, samples * sizeof(stream_sample_t));
+ memset(output, 0, samples * sizeof(stream_sample_t));
}
}
diff --git a/src/mame/audio/tvc.h b/src/mame/audio/tvc.h
index 04358375304..669184a0a2b 100644
--- a/src/mame/audio/tvc.h
+++ b/src/mame/audio/tvc.h
@@ -34,7 +34,7 @@ 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 void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
static const device_timer_id TIMER_SNDINT = 0;
diff --git a/src/mame/audio/tx1.cpp b/src/mame/audio/tx1.cpp
index e415fb54669..a6dd9d2aeb6 100644
--- a/src/mame/audio/tx1.cpp
+++ b/src/mame/audio/tx1.cpp
@@ -111,7 +111,7 @@ void tx1_sound_device::device_start()
/* Allocate the stream */
- m_stream = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate());
+ m_stream = stream_alloc_legacy(0, 2, machine().sample_rate());
m_freq_to_step = (double)(1 << TX1_FRAC) / (double)machine().sample_rate();
/* Compute the engine resistor weights */
@@ -356,10 +356,10 @@ static inline void update_engine(int eng[4])
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void tx1_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void tx1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
uint32_t step_0, step_1, step_2;
double /*gain_0, gain_1,*/ gain_2, gain_3;
@@ -662,7 +662,7 @@ void buggyboy_sound_device::device_start()
m_eng_voltages[i] = combine_weights(aweights, BIT(tmp[i], 0), BIT(tmp[i], 1), BIT(tmp[i], 2), BIT(tmp[i], 3));
/* Allocate the stream */
- m_stream = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate());
+ m_stream = stream_alloc_legacy(0, 2, machine().sample_rate());
m_freq_to_step = (double)(1 << 24) / (double)machine().sample_rate();
}
@@ -763,10 +763,10 @@ void buggyboy_sound_device::ym2_b_w(uint8_t data)
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void buggyboy_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void buggyboy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
/* This is admittedly a bit of a hack job... */
diff --git a/src/mame/audio/tx1.h b/src/mame/audio/tx1.h
index b27ddd0fa73..71e228e324c 100644
--- a/src/mame/audio/tx1.h
+++ b/src/mame/audio/tx1.h
@@ -73,7 +73,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
void tx1_sound_io(address_map &map);
void tx1_sound_prg(address_map &map);
@@ -155,7 +155,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
void ym1_a_w(uint8_t data);
diff --git a/src/mame/audio/vboy.cpp b/src/mame/audio/vboy.cpp
index 05d9c3a3779..37eec2ee80b 100644
--- a/src/mame/audio/vboy.cpp
+++ b/src/mame/audio/vboy.cpp
@@ -209,7 +209,7 @@ void vboysnd_device::device_start()
{
uint32_t rate = clock() / 120;
// create the stream
- m_stream = machine().sound().stream_alloc(*this, 0, 2, rate);
+ m_stream = stream_alloc_legacy(0, 2, rate);
m_timer = timer_alloc(0, nullptr);
m_timer->adjust(attotime::zero, 0, rate ? attotime::from_hz(rate / 4) : attotime::never);
@@ -265,11 +265,11 @@ void vboysnd_device::device_timer(emu_timer &timer, device_timer_id tid, int par
}
//-------------------------------------------------
-// sound_stream_update - handle update requests for
+// sound_stream_update_legacy - handle update requests for
// our sound stream
//-------------------------------------------------
-void vboysnd_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void vboysnd_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *outL, *outR;
int len, i, j, channel;
diff --git a/src/mame/audio/vboy.h b/src/mame/audio/vboy.h
index 6ee190b83b2..f8d3a050272 100644
--- a/src/mame/audio/vboy.h
+++ b/src/mame/audio/vboy.h
@@ -72,7 +72,7 @@ protected:
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
s_snd_channel snd_channel[5];
diff --git a/src/mame/audio/vc4000.cpp b/src/mame/audio/vc4000.cpp
index df4a308f619..84c19a2d942 100644
--- a/src/mame/audio/vc4000.cpp
+++ b/src/mame/audio/vc4000.cpp
@@ -31,15 +31,15 @@ vc4000_sound_device::vc4000_sound_device(const machine_config &mconfig, const ch
void vc4000_sound_device::device_start()
{
- m_channel = stream_alloc(0, 1, machine().sample_rate());
+ m_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void vc4000_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void vc4000_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int i;
stream_sample_t *buffer = outputs[0];
diff --git a/src/mame/audio/vc4000.h b/src/mame/audio/vc4000.h
index e906dc601c4..3917ffa2776 100644
--- a/src/mame/audio/vc4000.h
+++ b/src/mame/audio/vc4000.h
@@ -28,7 +28,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
public:
void soundport_w(int mode, int data);
diff --git a/src/mame/audio/warpwarp.cpp b/src/mame/audio/warpwarp.cpp
index 2e4075771ea..9e00ff069fd 100644
--- a/src/mame/audio/warpwarp.cpp
+++ b/src/mame/audio/warpwarp.cpp
@@ -52,7 +52,7 @@ void warpwarp_sound_device::device_start()
m_clock_16h = clock() / 3 / 2 / 16;
m_clock_1v = clock() / 3 / 2 / 384;
- m_channel = machine().sound().stream_alloc(*this, 0, 1, m_clock_16h);
+ m_channel = stream_alloc_legacy(0, 1, m_clock_16h);
m_sound_volume_timer = timer_alloc(TIMER_SOUND_VOLUME_DECAY);
m_music_volume_timer = timer_alloc(TIMER_MUSIC_VOLUME_DECAY);
@@ -169,10 +169,10 @@ void warpwarp_sound_device::music2_w(u8 data)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void warpwarp_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void warpwarp_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
diff --git a/src/mame/audio/warpwarp.h b/src/mame/audio/warpwarp.h
index c8ca872d239..7bf06a4dc25 100644
--- a/src/mame/audio/warpwarp.h
+++ b/src/mame/audio/warpwarp.h
@@ -27,7 +27,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
diff --git a/src/mame/audio/wiping.cpp b/src/mame/audio/wiping.cpp
index 56a0c56ee96..0b83b88f8ac 100644
--- a/src/mame/audio/wiping.cpp
+++ b/src/mame/audio/wiping.cpp
@@ -42,7 +42,7 @@ void wiping_sound_device::device_start()
wp_sound_channel *voice;
/* get stream channels */
- m_stream = machine().sound().stream_alloc(*this, 0, 1, clock()/2);
+ m_stream = stream_alloc_legacy(0, 1, clock()/2);
/* allocate a buffer to mix into - 1 second's worth should be more than enough */
m_mixer_buffer = make_unique_clear<short[]>(clock()/2);
@@ -150,10 +150,10 @@ void wiping_sound_device::sound_w(offs_t offset, uint8_t data)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void wiping_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void wiping_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
wp_sound_channel *voice;
diff --git a/src/mame/audio/wiping.h b/src/mame/audio/wiping.h
index 43ae2caf98a..d10a26d2848 100644
--- a/src/mame/audio/wiping.h
+++ b/src/mame/audio/wiping.h
@@ -17,7 +17,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
/* 8 voices max */
diff --git a/src/mame/audio/wswan.cpp b/src/mame/audio/wswan.cpp
index 8089d01a6d1..0e6442cea6d 100644
--- a/src/mame/audio/wswan.cpp
+++ b/src/mame/audio/wswan.cpp
@@ -62,7 +62,7 @@ constexpr int clk_div = 64;
void wswan_sound_device::device_start()
{
- m_channel = stream_alloc(0, 2, clock() / clk_div);
+ m_channel = stream_alloc_legacy(0, 2, clock() / clk_div);
save_item(NAME(m_sweep_step));
save_item(NAME(m_sweep_time));
@@ -164,13 +164,15 @@ int wswan_sound_device::fetch_sample(int channel, int offset)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void wswan_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void wswan_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t sample, left, right;
+ stream_sample_t *outputl = outputs[0];
+ stream_sample_t *outputr = outputs[1];
while( samples-- > 0 )
{
left = right = 0;
@@ -269,8 +271,8 @@ void wswan_sound_device::sound_stream_update(sound_stream &stream, stream_sample
left <<= 5;
right <<= 5;
- *(outputs[0]++) = left;
- *(outputs[1]++) = right;
+ *outputl++ = left;
+ *outputr++ = right;
}
}
diff --git a/src/mame/audio/wswan.h b/src/mame/audio/wswan.h
index a23655e0b0b..e3c4974bf54 100644
--- a/src/mame/audio/wswan.h
+++ b/src/mame/audio/wswan.h
@@ -59,7 +59,7 @@ protected:
virtual void rom_bank_updated() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
void wswan_ch_set_freq( CHAN *ch, uint16_t freq );
diff --git a/src/mame/audio/xavix.cpp b/src/mame/audio/xavix.cpp
index 3d01d8812fd..a4b2d12dccb 100644
--- a/src/mame/audio/xavix.cpp
+++ b/src/mame/audio/xavix.cpp
@@ -27,7 +27,7 @@ void xavix_sound_device::device_start()
m_readregs_cb.resolve_safe(0xff);
m_readsamples_cb.resolve_safe(0x80);
- m_stream = stream_alloc(0, 2, 163840);
+ m_stream = stream_alloc_legacy(0, 2, 163840);
}
void xavix_sound_device::device_reset()
@@ -43,7 +43,7 @@ void xavix_sound_device::device_reset()
}
-void xavix_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void xavix_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
// reset the output stream
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
diff --git a/src/mame/audio/zaccaria.cpp b/src/mame/audio/zaccaria.cpp
index e597c48eeab..f7b31e245e5 100644
--- a/src/mame/audio/zaccaria.cpp
+++ b/src/mame/audio/zaccaria.cpp
@@ -472,14 +472,14 @@ void zac1b11142_audio_device::device_add_mconfig(machine_config &config)
* The 5200 output is a current source providing between 0 and 1.5mA.
* This is explained in detail in the datasheet.
*/
- NETLIST_STREAM_INPUT(config, "sound_nl:cin6", 6, "I_SP.I").set_mult_offset(750e-6 / 16384.0, 750e-6);
+ NETLIST_STREAM_INPUT(config, "sound_nl:cin6", 6, "I_SP.I").set_mult_offset(2.0 * 750e-6, 750e-6);
/* DAC
* The 1408 output is a current sink providing between 0 and 2.0mA.
* This is explained in detail in the datasheet.
*/
- NETLIST_STREAM_INPUT(config, "sound_nl:cin7", 7, "I_DAC.I").set_mult_offset(1e-3 / 32768.0, 1e-3);
+ NETLIST_STREAM_INPUT(config, "sound_nl:cin7", 7, "I_DAC.I").set_mult_offset(1e-3, 1e-3);
- NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "C7.2").set_mult_offset(3000.0 * 10.0, 0.0); // FIXME: no clue what numbers to use here
+ NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "C7.2").set_mult_offset(3000.0 * 10.0 / 32768.0, 0.0); // FIXME: no clue what numbers to use here
// Potentiometers
NETLIST_ANALOG_INPUT(config, "sound_nl:pot1", "P1.DIAL");
diff --git a/src/mame/drivers/1942.cpp b/src/mame/drivers/1942.cpp
index 974a67710da..ee44a0caaf0 100644
--- a/src/mame/drivers/1942.cpp
+++ b/src/mame/drivers/1942.cpp
@@ -552,7 +552,7 @@ void _1942_state::_1942(machine_config &config)
NETLIST_STREAM_INPUT(config, "snd_nl:cin4", 4, "R_AY2_2.R");
NETLIST_STREAM_INPUT(config, "snd_nl:cin5", 5, "R_AY2_3.R");
- NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "R1.1").set_mult_offset(70000.0, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "R1.1").set_mult_offset(70000.0 / 32768.0, 0.0);
//NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "VR.2");
}
diff --git a/src/mame/drivers/5clown.cpp b/src/mame/drivers/5clown.cpp
index 1b4cfbb8f70..1d8ca3d4af0 100644
--- a/src/mame/drivers/5clown.cpp
+++ b/src/mame/drivers/5clown.cpp
@@ -846,7 +846,7 @@ void _5clown_state::fcaudio_map(address_map &map)
static INPUT_PORTS_START( fclown )
/* Multiplexed - 4x5bits */
PORT_START("IN0-0")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_BET )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_BET )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Record")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Start")
diff --git a/src/mame/drivers/abc1600.cpp b/src/mame/drivers/abc1600.cpp
index 6c74c328f54..d0a9e05dd02 100644
--- a/src/mame/drivers/abc1600.cpp
+++ b/src/mame/drivers/abc1600.cpp
@@ -34,33 +34,20 @@
TODO:
- - segment/page RAM addresses are not correctly decoded, "sas/format/format" after abcenix is booted can't find the SASI interface because of this
- [:mac] ':3f' (08A98) MAC 7e4a2:0004a2 (SEGA 02f SEGD 09 PGA 09c PGD 8000 NONX 1 WP 0)
- should be
- [:mac] ':3f' (089A8) MAC 7e4a2:1fe4a2 (SEGA 00f SEGD 0f PGA 0fc PGD 43fc NONX 0 WP 1)
-
- [:mac] ':3f' (100082) SEGMENT 80eeb:27 (SEGA 000 SEGD 27)
- [:mac] ':3f' (100084) PAGE 80ee8:02 (SEGA 000 SEGD 27 PGA 271 PGD 0283)
- [:mac] ':3f' (100084) PAGE 80ee9:83 (SEGA 000 SEGD 27 PGA 271 PGD 0283)
- [:mac] ':3f' (100082) SEGMENT 806eb:27 (SEGA 000 SEGD 27)
- [:mac] ':3f' (100084) PAGE 806e8:02 (SEGA 000 SEGD 27 PGA 270 PGD 0282)
- [:mac] ':3f' (100084) PAGE 806e9:82 (SEGA 000 SEGD 27 PGA 270 PGD 0282)
- [:mac] ':3f' (100082) MAC 7feea:1b8eea (SEGA 00f SEGD 36 PGA 36f PGD 0371 NONX 0 WP 0)
- [:mac] ':3f' (100082): unmapped program memory write to 1B8EEA = 00 & FF
- [:mac] ':3f' (100082) MAC 7feeb:1b8eeb (SEGA 00f SEGD 36 PGA 36f PGD 0371 NONX 0 WP 0)
- [:mac] ':3f' (100082): unmapped program memory write to 1B8EEB = 27 & FF
- [:mac] ':3f' (100084) MAC 7fee8:1b8ee8 (SEGA 00f SEGD 36 PGA 36f PGD 0371 NONX 0 WP 0)
- [:mac] ':3f' (100084): unmapped program memory write to 1B8EE8 = 02 & FF
- [:mac] ':3f' (100084) MAC 7fee9:1b8ee9 (SEGA 00f SEGD 36 PGA 36f PGD 0371 NONX 0 WP 0)
- [:mac] ':3f' (100084): unmapped program memory write to 1B8EE9 = 81 & FF
- [:mac] ':3f' (100082) MAC 7f6ea:1b86ea (SEGA 00f SEGD 36 PGA 36e PGD 0370 NONX 0 WP 0)
- [:mac] ':3f' (100082): unmapped program memory write to 1B86EA = 00 & FF
- [:mac] ':3f' (100082) MAC 7f6eb:1b86eb (SEGA 00f SEGD 36 PGA 36e PGD 0370 NONX 0 WP 0)
- [:mac] ':3f' (100082): unmapped program memory write to 1B86EB = 27 & FF
- [:mac] ':3f' (100084) MAC 7f6e8:1b86e8 (SEGA 00f SEGD 36 PGA 36e PGD 0370 NONX 0 WP 0)
- [:mac] ':3f' (100084): unmapped program memory write to 1B86E8 = 02 & FF
- [:mac] ':3f' (100084) MAC 7f6e9:1b86e9 (SEGA 00f SEGD 36 PGA 36e PGD 0370 NONX 0 WP 0)
- [:mac] ':3f' (100084): unmapped program memory write to 1B86E9 = 80 & FF
+ - sas/format/format in abcenix tries to access the SASI card using a memory location mapped for task 0, when the process is run as task 1
+
+ [:mac] ':3f' (0009E) ff800:4f TASK 0 SEGMENT 15 PAGE 15 MEM 7f800-7ffff 1ff800
+ [:mac] ':3f' (0009E) ff801:ff TASK 0 SEGMENT 15 PAGE 15 MEM 7f800-7ffff 1ff800
+ [:mac] ':3f' (0009E) ff000:4f TASK 0 SEGMENT 15 PAGE 14 MEM 7f000-7f7ff 1ff000
+ [:mac] ':3f' (0009E) ff001:fe TASK 0 SEGMENT 15 PAGE 14 MEM 7f000-7f7ff 1ff000
+ [:mac] ':3f' (0009E) fe800:4f TASK 0 SEGMENT 15 PAGE 13 MEM 7e800-7efff 1fe800
+ [:mac] ':3f' (0009E) fe801:fd TASK 0 SEGMENT 15 PAGE 13 MEM 7e800-7efff 1fe800
+ [:mac] ':3f' (0009E) fe000:4f TASK 0 SEGMENT 15 PAGE 12 MEM 7e000-7e7ff 1fe000
+ [:mac] ':3f' (0009E) fe001:fc TASK 0 SEGMENT 15 PAGE 12 MEM 7e000-7e7ff 1fe000
+
+ [:mac] ':3f' (08A98) MAC 7e4a2:0004a2 (SEGA 02f SEGD 09 PGA 09c PGD 8000 NONX 1 WP 0 TASK 1 FC 1)
+ should be
+ [:mac] ':3f' (089A8) MAC 7e4a2:1fe4a2 (SEGA 00f SEGD 0f PGA 0fc PGD 43fc NONX 0 WP 1 TASK 0 FC 5)
- short/long reset (RSTBUT)
- CIO
diff --git a/src/mame/drivers/apple3.cpp b/src/mame/drivers/apple3.cpp
index c5a694a0cbd..c38c1939b74 100644
--- a/src/mame/drivers/apple3.cpp
+++ b/src/mame/drivers/apple3.cpp
@@ -42,7 +42,7 @@ void apple3_state::apple3_map(address_map &map)
static void apple3_cards(device_slot_interface &device)
{
- device.option_add("cffa2", A2BUS_CFFA2_6502); // CFFA2000 Compact Flash for Apple II (www.dreher.net), 6502 firmware
+ device.option_add("cffa2", A2BUS_CFFA2_6502); // CFFA2.0 Compact Flash for Apple II (www.dreher.net), 6502 firmware
device.option_add("applicard", A2BUS_APPLICARD); // PCPI Applicard
device.option_add("thclock", A2BUS_THUNDERCLOCK); // ThunderWare ThunderClock Plus - driver assumes slot 2 by default
device.option_add("mouse", A2BUS_MOUSE); // Apple II Mouse Card
@@ -356,11 +356,11 @@ INPUT_PORTS_END
ROM_START(apple3)
ROM_REGION(0x1000,"maincpu",0)
- ROM_SYSTEM_BIOS(0, "soshd", "Rob Justice SOSHDBOOT")
- ROMX_LOAD( "soshdboot.bin", 0x000000, 0x001000, CRC(fd5ac9e2) SHA1(ba466a54ddb7f618c4f18f344754343c5945b417), ROM_BIOS(0))
-
- ROM_SYSTEM_BIOS(1, "original", "Apple /// boot ROM")
+ ROM_SYSTEM_BIOS(0, "original", "Apple /// boot ROM")
ROMX_LOAD( "apple3.rom", 0x0000, 0x1000, CRC(55e8eec9) SHA1(579ee4cd2b208d62915a0aa482ddc2744ff5e967), ROM_BIOS(1))
+
+ ROM_SYSTEM_BIOS(1, "soshd", "Rob Justice SOSHDBOOT")
+ ROMX_LOAD( "soshdboot.bin", 0x000000, 0x001000, CRC(fd5ac9e2) SHA1(ba466a54ddb7f618c4f18f344754343c5945b417), ROM_BIOS(0))
ROM_END
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */
diff --git a/src/mame/drivers/aristmk4.cpp b/src/mame/drivers/aristmk4.cpp
index f852ec51479..8264d8cf124 100644
--- a/src/mame/drivers/aristmk4.cpp
+++ b/src/mame/drivers/aristmk4.cpp
@@ -1642,7 +1642,7 @@ static INPUT_PORTS_START(gldnpkr)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_CODE(KEYCODE_F)
PORT_MODIFY("500e")
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_CODE(KEYCODE_W)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_CODE(KEYCODE_W)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Change") PORT_CODE(KEYCODE_A)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Hold 1 / Red") PORT_CODE(KEYCODE_S)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Hold 5 / Black") PORT_CODE(KEYCODE_H)
diff --git a/src/mame/drivers/bmcpokr.cpp b/src/mame/drivers/bmcpokr.cpp
index e1fd3bceb62..05700c64b71 100644
--- a/src/mame/drivers/bmcpokr.cpp
+++ b/src/mame/drivers/bmcpokr.cpp
@@ -488,7 +488,7 @@ static INPUT_PORTS_START( bmcpokr )
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_CONDITION("DSW4",0x80,EQUALS,0x80) // HOLD 3
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_CONDITION("DSW4",0x80,EQUALS,0x80) // n.a. [START, ESC in service mode]
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE ) PORT_CONDITION("DSW4",0x80,EQUALS,0x80) // SCORE
- PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_CONDITION("DSW4",0x80,EQUALS,0x80) // BET [BET, credit -1]
+ PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_CONDITION("DSW4",0x80,EQUALS,0x80) // BET [BET, credit -1]
PORT_BIT( 0x0200, IP_ACTIVE_HIGH,IPT_CUSTOM ) PORT_READ_LINE_MEMBER(bmcpokr_state, hopper_r) // HP [HOPPER, credit -100]
PORT_SERVICE_NO_TOGGLE( 0x0400, IP_ACTIVE_LOW ) PORT_CONDITION("DSW4",0x80,EQUALS,0x80) // ACCOUNT [SERVICE MODE]
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) PORT_CONDITION("DSW4",0x80,EQUALS,0x80) // KEY-OUT [KEY-OUT, no hopper]
@@ -506,7 +506,7 @@ static INPUT_PORTS_START( bmcpokr )
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("DSW4",0x80,EQUALS,0x00) // A1
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_CONDITION("DSW4",0x80,EQUALS,0x00) // n.a. [START, ESC in service mode]
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("DSW4",0x80,EQUALS,0x00) // <Left>2 (3rd)
- PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_CONDITION("DSW4",0x80,EQUALS,0x00) // <Down>1 (2nd) [BET, credit -1]
+ PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_CONDITION("DSW4",0x80,EQUALS,0x00) // <Down>1 (2nd) [BET, credit -1]
// PORT_BIT( 0x0200, IP_ACTIVE_HIGH,IPT_CUSTOM ) PORT_READ_LINE_MEMBER(bmcpokr_state, hopper_r) // HP [HOPPER, credit -100]
PORT_SERVICE_NO_TOGGLE( 0x0400, IP_ACTIVE_LOW ) PORT_CONDITION("DSW4",0x80,EQUALS,0x00) // A2 [SERVICE MODE]
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) PORT_CONDITION("DSW4",0x80,EQUALS,0x00) // C2 [KEY-OUT, no hopper]
diff --git a/src/mame/drivers/bublbobl.cpp b/src/mame/drivers/bublbobl.cpp
index 77e839790b8..57b5c77c633 100644
--- a/src/mame/drivers/bublbobl.cpp
+++ b/src/mame/drivers/bublbobl.cpp
@@ -265,11 +265,6 @@ TODO:
accesses done by the sound CPU to the YM2203 I/O ports. At the very least, there
could be some filters.
- There are also Bubble Bobble bootlegs with a P8749H MCU, however the MCU
- is protected against reading and the main code only differs by 1 byte from
- Bubble Bobble. If the MCU were to be dumped that would also make for
- interesting comparisons.
-
***************************************************************************/
#include "emu.h"
@@ -1864,7 +1859,7 @@ ROM_START( bub68705 )
ROM_LOAD( "a71-25.41", 0x0000, 0x0100, CRC(2d0f8545) SHA1(089c31e2f614145ef2743164f7b52ae35bc06808) ) /* video timing */
ROM_END
-ROM_START( bub8749 ) // all ROMs match bublbobl1 but for the MCU, which is different. 2-PCB set probably comes from Italy
+ROM_START( bub8749 ) // All ROMs match bublbobl1 but for the MCU, which is different. 2-PCB set probably comes from Italy
ROM_REGION( 0x30000, "maincpu", 0 )
ROM_LOAD( "6-27256.bin", 0x00000, 0x08000, CRC(32c8305b) SHA1(6bf69b3edfbefd33cd670a762b4bf0b39629a220) )
// ROMs banked at 8000-bfff
@@ -1897,7 +1892,7 @@ ROM_START( bub8749 ) // all ROMs match bublbobl1 but for the MCU, which is diffe
// 0x70000-0x7ffff empty
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "6301-in", 0x0000, 0x0100, BAD_DUMP CRC(2d0f8545) SHA1(089c31e2f614145ef2743164f7b52ae35bc06808) ) // video timing, not dumped for this set
+ ROM_LOAD( "6301-in", 0x00000, 0x0100, CRC(2d0f8545) SHA1(089c31e2f614145ef2743164f7b52ae35bc06808) ) // Video timing
// Located on CPU/Sound Board
ROM_REGION( 0x0003, "plds", 0 )
diff --git a/src/mame/drivers/carpolo.cpp b/src/mame/drivers/carpolo.cpp
index 7af10d7fb75..3d878d9abc6 100644
--- a/src/mame/drivers/carpolo.cpp
+++ b/src/mame/drivers/carpolo.cpp
@@ -304,7 +304,7 @@ void carpolo_state::carpolo(machine_config &config)
NETLIST_LOGIC_INPUT(config, "sound_nl:player_crash4", "PL4_CRASH.IN", 0);
// Temporarily just tied to an arbitrary value to preserve lack of audio.
- NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "PL1_CRASH.GND").set_mult_offset(10000.0, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "PL1_CRASH.GND").set_mult_offset(10000.0 / 32768.0, 0.0);
}
diff --git a/src/mame/drivers/chance32.cpp b/src/mame/drivers/chance32.cpp
index 36e68425ba9..5fe64bce238 100644
--- a/src/mame/drivers/chance32.cpp
+++ b/src/mame/drivers/chance32.cpp
@@ -395,7 +395,7 @@ static INPUT_PORTS_START( chance32 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_DEAL )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_GAMBLE_D_UP )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_GAMBLE_BOOK )
- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_POKER_BET )
+ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_GAMBLE_BET )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
@@ -424,7 +424,7 @@ static INPUT_PORTS_START( chance32 )
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(3) PORT_NAME("Coin A")
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset")
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MEMORY_RESET ) PORT_NAME("Reset")
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(3) PORT_NAME("Coin B")
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_CODE(KEYCODE_8) PORT_NAME("Flip Screen 1") /* unknown purpose */
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_CODE(KEYCODE_9) PORT_NAME("Flip Screen 2") /* unknown purpose */
diff --git a/src/mame/drivers/cocoloco.cpp b/src/mame/drivers/cocoloco.cpp
index 525a33b46be..37e9ac204ba 100644
--- a/src/mame/drivers/cocoloco.cpp
+++ b/src/mame/drivers/cocoloco.cpp
@@ -503,7 +503,7 @@ void cocoloco_state::cocoloco(machine_config &config)
NETLIST_STREAM_INPUT(config, "snd_nl:cin1", 1, "R_AY1_2.R");
NETLIST_STREAM_INPUT(config, "snd_nl:cin2", 2, "R_AY1_3.R");
- NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "RAMP.1").set_mult_offset(30000.0 * 1.5, 0);
+ NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "RAMP.1").set_mult_offset(30000.0 * 1.5 / 32768.0, 0);
}
diff --git a/src/mame/drivers/compis.cpp b/src/mame/drivers/compis.cpp
index 10c7ac225c7..e1402cf5e43 100644
--- a/src/mame/drivers/compis.cpp
+++ b/src/mame/drivers/compis.cpp
@@ -46,7 +46,6 @@
*/
#include "emu.h"
-#include "softlist.h"
#include "bus/centronics/ctronics.h"
#include "bus/compis/graphics.h"
#include "bus/isbx/isbx.h"
@@ -64,6 +63,7 @@
#include "machine/ram.h"
#include "machine/timer.h"
#include "machine/z80sio.h"
+#include "speaker.h"
#define I80186_TAG "ic1"
#define I80130_TAG "ic15"
@@ -785,8 +785,10 @@ void compis_state::compis(machine_config &config)
MM58174(config, m_rtc, 32.768_kHz_XTAL);
+ SPEAKER(config, "cass_snd").front_center();
CASSETTE(config, m_cassette);
m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED);
+ m_cassette->add_route(ALL_OUTPUTS, "cass_snd", 0.05);
TIMER(config, "tape").configure_periodic(FUNC(compis_state::tape_tick), attotime::from_hz(44100));
diff --git a/src/mame/drivers/dblcrown.cpp b/src/mame/drivers/dblcrown.cpp
index df32ff8ea25..f49f80958df 100644
--- a/src/mame/drivers/dblcrown.cpp
+++ b/src/mame/drivers/dblcrown.cpp
@@ -391,7 +391,7 @@ static INPUT_PORTS_START( dblcrown )
PORT_START("IN3")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_CANCEL ) PORT_NAME("Cancel / Repeat Bet")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Deal / Draw")
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_BET )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_BET )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_NAME("Analyzer")
PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
diff --git a/src/mame/drivers/destroyr.cpp b/src/mame/drivers/destroyr.cpp
index dc2c362a920..8d328ae2003 100644
--- a/src/mame/drivers/destroyr.cpp
+++ b/src/mame/drivers/destroyr.cpp
@@ -532,7 +532,7 @@ void destroyr_state::destroyr(machine_config &config)
NETLIST_LOGIC_INPUT(config, "sound_nl:hexplo", "HE.IN", 0);
NETLIST_LOGIC_INPUT(config, "sound_nl:lexplo", "LE.IN", 0);
- NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUTPUT").set_mult_offset(32767.0, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUTPUT").set_mult_offset(1.0, 0.0);
}
diff --git a/src/mame/drivers/emu3.cpp b/src/mame/drivers/emu3.cpp
index 9e63cfc5a97..4bd40415e09 100644
--- a/src/mame/drivers/emu3.cpp
+++ b/src/mame/drivers/emu3.cpp
@@ -209,7 +209,7 @@ void emu3_state::emu3(machine_config &config)
WD1772(config, m_fdc, 16_MHz_XTAL / 2);
m_fdc->intrq_wr_callback().set(*this, FUNC(emu3_state::irq_w<FDCINT>));
m_fdc->set_disable_motor_control(true);
- m_fdc->sso_wr_callback().set([this](int state) {});
+ //m_fdc->sso_wr_callback().set([this](int state) {});
m_fdc->dden_w(0);
FLOPPY_CONNECTOR(config, "fdc:0", emu3_floppies, "35dd", floppy_image_device::default_floppy_formats);
diff --git a/src/mame/drivers/esq1.cpp b/src/mame/drivers/esq1.cpp
index 55eca4c0d23..b0a9e97a293 100644
--- a/src/mame/drivers/esq1.cpp
+++ b/src/mame/drivers/esq1.cpp
@@ -210,7 +210,7 @@ protected:
virtual void device_start() override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
struct filter {
@@ -334,13 +334,13 @@ void esq1_filters::recalc_filter(filter &f)
void esq1_filters::device_start()
{
- stream = stream_alloc(8, 2, 44100);
+ stream = stream_alloc_legacy(8, 2, 44100);
memset(filters, 0, sizeof(filters));
for(auto & elem : filters)
recalc_filter(elem);
}
-void esq1_filters::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void esq1_filters::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
/* if(0) {
for(int i=0; i<8; i++)
diff --git a/src/mame/drivers/flyball.cpp b/src/mame/drivers/flyball.cpp
index ad9cccec8e1..a45064ae13f 100644
--- a/src/mame/drivers/flyball.cpp
+++ b/src/mame/drivers/flyball.cpp
@@ -515,7 +515,7 @@ void flyball_state::flyball(machine_config &config)
NETLIST_ANALOG_INPUT(config, "sound_nl:bat_volume", "R75.DIAL");
NETLIST_ANALOG_INPUT(config, "sound_nl:main_volume", "R95.DIAL");
- NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUTPUT").set_mult_offset(32767.0 / 0.13, -(32767.0 / 0.13) * 0.78);
+ NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUTPUT").set_mult_offset(1.0 / 0.13, -(1.0 / 0.13) * 0.78);
}
diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp
index b5c515b2342..9a3b5b9f375 100644
--- a/src/mame/drivers/galaxian.cpp
+++ b/src/mame/drivers/galaxian.cpp
@@ -6129,7 +6129,7 @@ void galaxian_state::konami_sound_1x_ay8910(machine_config &config)
NETLIST_STREAM_INPUT(config, "konami:cin1", 1, "R_AY3D_B.R");
NETLIST_STREAM_INPUT(config, "konami:cin2", 2, "R_AY3D_C.R");
- NETLIST_STREAM_OUTPUT(config, "konami:cout0", 0, "OUT").set_mult_offset(30000.0 / 0.05, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "konami:cout0", 0, "OUT").set_mult_offset(1.0 / 0.05, 0.0);
}
@@ -6186,7 +6186,7 @@ void galaxian_state::konami_sound_2x_ay8910(machine_config &config)
NETLIST_STREAM_INPUT(config, "konami:cin3", 3, "R_AY3C_A.R");
NETLIST_STREAM_INPUT(config, "konami:cin4", 4, "R_AY3C_B.R");
NETLIST_STREAM_INPUT(config, "konami:cin5", 5, "R_AY3C_C.R");
- NETLIST_STREAM_OUTPUT(config, "konami:cout0", 0, "OUT").set_mult_offset(30000.0 / 0.05, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "konami:cout0", 0, "OUT").set_mult_offset(1.0 / 0.05, 0.0);
}
diff --git a/src/mame/drivers/gamemachine.cpp b/src/mame/drivers/gamemachine.cpp
index e0c8e355916..c0e28fd8661 100644
--- a/src/mame/drivers/gamemachine.cpp
+++ b/src/mame/drivers/gamemachine.cpp
@@ -278,7 +278,7 @@ void tgm_state::tgm(machine_config &config)
.set_source(NETLIST_NAME(gamemachine))
.add_route(ALL_OUTPUTS, "speaker", 1.0);
- NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "SPK1.2").set_mult_offset(-10000.0, 10000.0 * 3.75);
+ NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "SPK1.2").set_mult_offset(-10000.0 / 32768.0, 10000.0 * 3.75 / 32768.0);
NETLIST_LOGIC_INPUT(config, "snd_nl:p08", "P08.IN", 0);
NETLIST_LOGIC_INPUT(config, "snd_nl:p09", "P09.IN", 0);
diff --git a/src/mame/drivers/generalplus_gpl16250_nand.cpp b/src/mame/drivers/generalplus_gpl16250_nand.cpp
index f539ba42b62..4ea55f3a56a 100644
--- a/src/mame/drivers/generalplus_gpl16250_nand.cpp
+++ b/src/mame/drivers/generalplus_gpl16250_nand.cpp
@@ -554,6 +554,14 @@ ROM_START( jak_hmhsm )
ROM_LOAD( "hmhsm.bin", 0x0000, 0x10800000, CRC(e63ad24c) SHA1(a7844b14af701914150aa7c06743a410f478ff7b) )
ROM_END
+ROM_START( jak_camp )
+ ROM_REGION16_BE( 0x40000, "maincpu:internal", ROMREGION_ERASE00 )
+ ROM_LOAD16_WORD_SWAP( "internal.rom", 0x00000, 0x40000, NO_DUMP ) // used as bootstrap only
+
+ ROM_REGION( 0x10800000, "nandrom", ROMREGION_ERASE00 )
+ ROM_LOAD( "camprockguitar1_sandisk11352-256b_45da.bin", 0x0000, 0x10800000, CRC(f52a4289) SHA1(d027ae274cd4ac97924d2344df1a96456e8e7c55) )
+ROM_END
+
ROM_START( jak_hsmg2 )
ROM_REGION16_BE( 0x40000, "maincpu:internal", ROMREGION_ERASE00 )
@@ -908,6 +916,7 @@ CONS(2008, jak_hsmg2, 0, 0, generalplus_gpac800, jak_hsm, generalplus_gp
CONS(2008, jak_hmhsm, 0, 0, generalplus_gpac800, jak_hsm, generalplus_gpac800_game_state, nand_init210_32mb, "JAKKS Pacific Inc / HotGen Ltd", "Hannah Montana G2 Deluxe / High School Musical G2 Deluxe - Two in One (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING) // Sep 12 2008 18:48:14 (Menu/HM) / Sep 12 2008 18:50:45 (HSM)
CONS(2008, jak_umdf, 0, 0, generalplus_gpac800, jak_hsm, generalplus_gpac800_game_state, nand_init210_32mb, "JAKKS Pacific Inc / Handheld Games", "Ultimotion - Disney Fairies Sleeping Beauty & TinkerBell (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
// Ultimotion Swing Zone is SPG29xx instead
+CONS(2008, jak_camp, 0, 0, generalplus_gpac800, jak_hsm, generalplus_gpac800_game_state, nand_init210_32mb, "JAKKS Pacific Inc / HotGen Ltd", "Camp Rock Guitar Video Game (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
// There were 1 player and 2 player versions for several of the JAKKS guns. The 2nd gun appears to be simply a controller (no AV connectors) but as they were separate products with the 2 player versions being released up to a year after the original, the code could differ.
// If they differ, it is currently uncertain which versions these ROMs are from
diff --git a/src/mame/drivers/ginganin.cpp b/src/mame/drivers/ginganin.cpp
index f1cfdc963f1..5b6263f22de 100644
--- a/src/mame/drivers/ginganin.cpp
+++ b/src/mame/drivers/ginganin.cpp
@@ -46,9 +46,13 @@ f5d6 print 7 digit BCD number: d0.l to (a1)+ color $3000
To Do
-----
-- game doesn't init paletteram / tilemaps properly, ending up with MAME
+- Game doesn't init paletteram / tilemaps properly, ending up with MAME
palette defaults at start-up and missing text layer if you coin it up
too soon.
+- In later levels a couple sprites lingers on top of screen;
+- Sometimes a credit sample also gets overwritten with additional spurious
+ playback of all samples;
+^ all these might be just BTANBs ...
***************************************************************************/
@@ -78,8 +82,9 @@ f5d6 print 7 digit BCD number: d0.l to (a1)+ color $3000
void ginganin_state::main_map(address_map &map)
{
-/* The ROM area: 10000-13fff is written with: 0000 0000 0000 0001, at startup only. Why? */
- map(0x000000, 0x01ffff).rom();
+ // PC=0x408 ROM area 10000-13fff is written at POST with: 0000 0000 0000 0001,
+ // looks a debugging left-over for GFX patching (causes state garbage if hooked as RAM write mirror)
+ map(0x000000, 0x01ffff).rom().nopw();
map(0x020000, 0x023fff).ram();
map(0x030000, 0x0307ff).ram().w(FUNC(ginganin_state::txtram_w)).share("txtram");
map(0x040000, 0x0407ff).ram().share("spriteram");
@@ -353,11 +358,12 @@ ROM_END
void ginganin_state::init_ginganin()
{
+ // pending full removal of this patch ...
/* main cpu patches */
- u16 *rom = (u16 *)memregion("maincpu")->base();
+// u16 *rom = (u16 *)memregion("maincpu")->base();
/* avoid writes to rom getting to the log */
- rom[0x408 / 2] = 0x6000;
- rom[0x40a / 2] = 0x001c;
+// rom[0x408 / 2] = 0x6000;
+// rom[0x40a / 2] = 0x001c;
}
diff --git a/src/mame/drivers/goldnpkr.cpp b/src/mame/drivers/goldnpkr.cpp
index 353bd220102..a1f1522eddb 100644
--- a/src/mame/drivers/goldnpkr.cpp
+++ b/src/mame/drivers/goldnpkr.cpp
@@ -5074,7 +5074,7 @@ void blitz_state::megadpkr_banked_map(address_map &map)
static INPUT_PORTS_START( megadpkr )
// Multiplexed - 4x5bits
PORT_START("IN0-0")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_BET )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_BET )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL )
diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp
index 67196046fad..872d4e19568 100644
--- a/src/mame/drivers/hh_tms1k.cpp
+++ b/src/mame/drivers/hh_tms1k.cpp
@@ -5887,7 +5887,7 @@ INPUT_PORTS_END
void starwbc_state::starwbc(machine_config &config)
{
/* basic machine hardware */
- TMS1100(config, m_maincpu, 325000); // approximation - RC osc. R=51K, C=47pF
+ TMS1100(config, m_maincpu, 350000); // approximation - RC osc. R=51K, C=47pF
m_maincpu->k().set(FUNC(starwbc_state::read_k));
m_maincpu->r().set(FUNC(starwbc_state::write_r));
m_maincpu->o().set(FUNC(starwbc_state::write_o));
diff --git a/src/mame/drivers/informer_207_376.cpp b/src/mame/drivers/informer_207_376.cpp
index 8214a387fab..f4ed3c68f21 100644
--- a/src/mame/drivers/informer_207_376.cpp
+++ b/src/mame/drivers/informer_207_376.cpp
@@ -8,16 +8,16 @@
Hardware:
- M6809
+ - 8253 PIT
- Z80SCC 8530
- - 6850 ACIA (up to 4)
- - X2212P NVRAM
+ - 2x 6850 ACIA (up to 4)
+ - 2x X2212P NOVRAM
TODO:
- Dump keyboard controller and emulate it (currently HLE'd)
- Problably needs improvements to at least the Z80SCC to
properly support synchrous modes
- - Figure out unknown reads/writes to the memory
- - Verify NMI hookup
+ - Figure out the unknown bits at 0x8400
- Verify clock speeds
Notes:
@@ -30,9 +30,9 @@
#include "cpu/m6809/m6809.h"
#include "machine/6850acia.h"
#include "machine/pit8253.h"
-#include "machine/clock.h"
#include "machine/input_merger.h"
-#include "machine/nvram.h"
+#include "machine/ripple_counter.h"
+#include "machine/x2212.h"
#include "machine/z80scc.h"
#include "video/mc6845.h"
#include "sound/beep.h"
@@ -54,6 +54,7 @@ public:
informer_207_376_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
+ m_novram(*this, "novram%u", 0U),
m_crtc(*this, "crtc"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
@@ -62,8 +63,7 @@ public:
m_acia(*this, "acia%u", 0U),
m_beep(*this, "beep"),
m_ram(*this, "ram"),
- m_chargen(*this, "chargen"),
- m_nmi_enabled(false)
+ m_chargen(*this, "chargen")
{ }
void informer_207_376(machine_config &config);
@@ -74,6 +74,7 @@ protected:
private:
required_device<cpu_device> m_maincpu;
+ required_device_array<x2212_device, 2> m_novram;
required_device<mc6845_device> m_crtc;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
@@ -86,15 +87,13 @@ private:
void mem_map(address_map &map);
- MC6845_UPDATE_ROW(crtc_update_row);
- uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
-
- void vsync_w(int state);
- void nmi_control_w(uint8_t data);
void unk_8400_w(uint8_t data);
+ void crt_brightness_w(uint8_t data);
+ uint8_t novram_r(address_space &space, offs_t offset);
+ void novram_w(offs_t offset, uint8_t data);
+ uint8_t novram_recall_r();
- bool m_display_enabled;
- bool m_nmi_enabled;
+ MC6845_UPDATE_ROW(crtc_update_row);
};
@@ -110,10 +109,11 @@ void informer_207_376_state::mem_map(address_map &map)
map(0x8400, 0x8400).lr8(NAME([] () { return 0xff; })).w(FUNC(informer_207_376_state::unk_8400_w)); // ?
map(0x8802, 0x8803).rw(m_acia[0], FUNC(acia6850_device::read), FUNC(acia6850_device::write));
map(0x8804, 0x8805).rw(m_acia[1], FUNC(acia6850_device::read), FUNC(acia6850_device::write));
- map(0x8c00, 0x8c00).w(FUNC(informer_207_376_state::nmi_control_w));
+ map(0x8c00, 0x8c00).w(FUNC(informer_207_376_state::crt_brightness_w));
map(0x9000, 0x9003).rw(m_pit, FUNC(pit8253_device::read), FUNC(pit8253_device::write));
map(0x9400, 0x9403).rw(m_scc, FUNC(scc85c30_device::ab_dc_r), FUNC(scc85c30_device::ab_dc_w));
- map(0x9c00, 0x9cff).ram().share("nvram");
+ map(0x9800, 0x9800).r(FUNC(informer_207_376_state::novram_recall_r));
+ map(0x9c00, 0x9cff).rw(FUNC(informer_207_376_state::novram_r), FUNC(informer_207_376_state::novram_w));
map(0xa000, 0xffff).rom().region("maincpu", 0);
}
@@ -130,13 +130,11 @@ INPUT_PORTS_END
// VIDEO EMULATION
//**************************************************************************
-void informer_207_376_state::vsync_w(int state)
+void informer_207_376_state::crt_brightness_w(uint8_t data)
{
- if (m_nmi_enabled && state == 1)
- {
- m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
- m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
- }
+ // unknown algorithm for the brightness
+ // default value is 6, range is 0 (off) to 15 (brightest)
+ m_screen->set_brightness(256 - (256 / ((data & 0x0f) + 1)));
}
MC6845_UPDATE_ROW( informer_207_376_state::crtc_update_row )
@@ -152,7 +150,7 @@ MC6845_UPDATE_ROW( informer_207_376_state::crtc_update_row )
data = 0xff;
// the line above the status bar seems to be hardcoded
- if (y == 273)
+ if (y == 274)
data = 0xff;
// draw 8 pixels of the character
@@ -167,16 +165,6 @@ MC6845_UPDATE_ROW( informer_207_376_state::crtc_update_row )
}
}
-uint32_t informer_207_376_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
-{
- if (m_display_enabled)
- m_crtc->screen_update(screen, bitmap, cliprect);
- else
- bitmap.fill(rgb_t::black(), cliprect);
-
- return 0;
-}
-
static const gfx_layout char_layout =
{
8,11,
@@ -197,39 +185,45 @@ GFXDECODE_END
// MACHINE EMULATION
//**************************************************************************
-void informer_207_376_state::nmi_control_w(uint8_t data)
-{
- // 76543--- unused?
- // -----21- nmi enable?
- // -------0 unused?
-
- m_nmi_enabled = bool(data & 0x06);
-}
-
void informer_207_376_state::unk_8400_w(uint8_t data)
{
// 7------- beeper
// -6------ unknown
// --5----- 1=internal modem, 0=host rs232
// ---43--- unknown
- // -----2-- display enabled?
+ // -----2-- unknown
// ------10 unknown
m_beep->set_state(BIT(data, 7));
- m_display_enabled = bool(BIT(data, 2));
+}
+
+uint8_t informer_207_376_state::novram_r(address_space &space, offs_t offset)
+{
+ return (m_novram[0]->read(space, offset) << 4) | (m_novram[1]->read(space, offset) & 0x0f);
+}
+
+void informer_207_376_state::novram_w(offs_t offset, uint8_t data)
+{
+ m_novram[0]->write(offset, data >> 4);
+ m_novram[1]->write(offset, data & 0x0f);
+}
+
+uint8_t informer_207_376_state::novram_recall_r()
+{
+ m_novram[0]->recall(1);
+ m_novram[1]->recall(1);
+ m_novram[0]->recall(0);
+ m_novram[1]->recall(0);
+
+ return 0xff;
}
void informer_207_376_state::machine_start()
{
- // register for save states
- save_item(NAME(m_display_enabled));
- save_item(NAME(m_nmi_enabled));
}
void informer_207_376_state::machine_reset()
{
- m_display_enabled = false;
- m_nmi_enabled = false;
}
@@ -250,7 +244,8 @@ void informer_207_376_state::informer_207_376(machine_config &config)
input_merger_device &cpu_irq(INPUT_MERGER_ANY_HIGH(config, "cpu_irq"));
cpu_irq.output_handler().set_inputline(m_maincpu, M6809_IRQ_LINE);
- NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // 2x X2212P
+ X2212(config, m_novram[0]);
+ X2212(config, m_novram[1]);
PIT8253(config, m_pit);
m_pit->set_clk<0>(2.457600_MHz_XTAL);
@@ -259,6 +254,11 @@ void informer_207_376_state::informer_207_376(machine_config &config)
m_pit->set_clk<1>(2.457600_MHz_XTAL);
m_pit->out_handler<1>().set(m_acia[0], FUNC(acia6850_device::write_txc));
m_pit->out_handler<1>().append(m_acia[0], FUNC(acia6850_device::write_rxc));
+ m_pit->out_handler<1>().append("nmi_clk", FUNC(ripple_counter_device::clock_w));
+
+ ripple_counter_device &nmi_clk(RIPPLE_COUNTER(config, "nmi_clk")); // CD4020BE
+ nmi_clk.set_stages(14);
+ nmi_clk.count_out_cb().set_inputline(m_maincpu, INPUT_LINE_NMI).bit(13); // Q14
SCC85C30(config, m_scc, 0); // externally clocked?
m_scc->out_txda_callback().set("com1", FUNC(rs232_port_device::write_txd));
@@ -272,6 +272,8 @@ void informer_207_376_state::informer_207_376(machine_config &config)
ACIA6850(config, m_acia[0]);
m_acia[0]->txd_handler().set("kbd", FUNC(informer_207_376_kbd_hle_device::rx_w));
m_acia[0]->irq_handler().set("cpu_irq", FUNC(input_merger_device::in_w<1>));
+ m_acia[0]->rts_handler().set(m_novram[0], FUNC(x2212_device::store)).invert();
+ m_acia[0]->rts_handler().append(m_novram[1], FUNC(x2212_device::store)).invert();
ACIA6850(config, m_acia[1]);
m_acia[1]->txd_handler().set("printer", FUNC(rs232_port_device::write_txd));
@@ -294,19 +296,18 @@ void informer_207_376_state::informer_207_376(machine_config &config)
// video
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_color(rgb_t::green());
- m_screen->set_raw(14400000, 800, 0, 640, 300, 0, 286); // unknown clock
- m_screen->set_screen_update(FUNC(informer_207_376_state::screen_update));
+ m_screen->set_raw(36_MHz_XTAL / 2.5, 800, 0, 640, 300, 0, 286);
+ m_screen->set_screen_update(m_crtc, FUNC(mc6845_device::screen_update));
PALETTE(config, m_palette, palette_device::MONOCHROME);
GFXDECODE(config, "gfxdecode", m_palette, chars);
- MC6845(config, m_crtc, 1800000); // unknown clock
+ MC6845(config, m_crtc, 36_MHz_XTAL / 20);
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(informer_207_376_state::crtc_update_row));
- m_crtc->out_vsync_callback().set(FUNC(informer_207_376_state::vsync_w));
// sound
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/informer_213ae.cpp b/src/mame/drivers/informer_213.cpp
index 80faaaa2a63..4c2551bfabf 100644
--- a/src/mame/drivers/informer_213ae.cpp
+++ b/src/mame/drivers/informer_213.cpp
@@ -2,22 +2,22 @@
// copyright-holders: Dirk Best
/***************************************************************************
- Informer 213 AE
-
- VT-100 compatible terminal
+ Informer 213 (IBM 374/SNA V.22)
+ Informer 213 AE (VT-100)
Hardware:
- EF68B09EP
- - 2x TC5564PL-15 + 1x TC5565APL
+ - 2x TC5564PL-15 [8k] (next to CG ROM)
+ - 1x TC5565APL-15 [8k] + 2x TMS4464-15NL [32k] (next to CPU)
- Z0853006PSC SCC
- - ASIC
+ - ASIC (INFORMER 44223)
- 18.432 MHz XTAL
TODO:
- Figure out the ASIC and how it's connected
Notes:
- - Debug tricks: "b@42=ff" after startup to show setup screen 1
+ - Debug tricks (AE): "b@42=ff" after startup to show setup screen 1
"bp 81a1" then "b@42=ff" and "a=02" after the break to show screen 2
***************************************************************************/
@@ -33,10 +33,10 @@
// TYPE DEFINITIONS
//**************************************************************************
-class informer_213ae_state : public driver_device
+class informer_213_state : public driver_device
{
public:
- informer_213ae_state(const machine_config &mconfig, device_type type, const char *tag) :
+ informer_213_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_screen(*this, "screen"),
@@ -47,7 +47,7 @@ public:
m_chargen(*this, "chargen")
{ }
- void informer_213ae(machine_config &config);
+ void informer_213(machine_config &config);
protected:
void machine_start() override;
@@ -72,10 +72,11 @@ private:
// ADDRESS MAPS
//**************************************************************************
-void informer_213ae_state::mem_map(address_map &map)
+void informer_213_state::mem_map(address_map &map)
{
map(0x0000, 0x1fff).ram();
map(0x2000, 0x3fff).ram();
+ map(0x4000, 0x5fff).ram();
map(0x6000, 0x6fff).ram().share("vram");
map(0x7000, 0x7fff).ram().share("aram");
map(0x8000, 0xffff).rom().region("maincpu", 0);
@@ -86,7 +87,7 @@ void informer_213ae_state::mem_map(address_map &map)
// INPUT PORT DEFINITIONS
//**************************************************************************
-static INPUT_PORTS_START( informer_213ae )
+static INPUT_PORTS_START( informer_213 )
INPUT_PORTS_END
@@ -94,8 +95,10 @@ INPUT_PORTS_END
// VIDEO EMULATION
//**************************************************************************
-uint32_t informer_213ae_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+uint32_t informer_213_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
+ offs_t chargen_base = (m_chargen.bytes() == 0x4000) ? 0x2000 : 0;
+
for (int y = 0; y < 26; y++)
{
for (int x = 0; x < 80; x++)
@@ -114,7 +117,7 @@ uint32_t informer_213ae_state::screen_update(screen_device &screen, bitmap_rgb32
// draw 9 lines
for (int i = 0; i < 9; i++)
{
- uint8_t data = m_chargen[0x2000 | ((code << 4) + i)];
+ uint8_t data = m_chargen[chargen_base | ((code << 4) + i)];
// 6 pixels of the character
bitmap.pix32(y * 9 + i, x * 6 + 0) = BIT(data, 7) ? rgb_t::white() : rgb_t::black();
@@ -150,11 +153,11 @@ GFXDECODE_END
// MACHINE EMULATION
//**************************************************************************
-void informer_213ae_state::machine_start()
+void informer_213_state::machine_start()
{
}
-void informer_213ae_state::machine_reset()
+void informer_213_state::machine_reset()
{
}
@@ -163,10 +166,10 @@ void informer_213ae_state::machine_reset()
// MACHINE DEFINTIONS
//**************************************************************************
-void informer_213ae_state::informer_213ae(machine_config &config)
+void informer_213_state::informer_213(machine_config &config)
{
MC6809(config, m_maincpu, 18.432_MHz_XTAL / 4); // unknown clock
- m_maincpu->set_addrmap(AS_PROGRAM, &informer_213ae_state::mem_map);
+ m_maincpu->set_addrmap(AS_PROGRAM, &informer_213_state::mem_map);
SCC8530N(config, m_scc, 0); // unknown clock
@@ -177,7 +180,7 @@ void informer_213ae_state::informer_213ae(machine_config &config)
m_screen->set_visarea_full();
m_screen->set_refresh_hz(60);
// m_screen->set_raw(18.432_MHz_XTAL, 0, 0, 0, 0, 0, 0);
- m_screen->set_screen_update(FUNC(informer_213ae_state::screen_update));
+ m_screen->set_screen_update(FUNC(informer_213_state::screen_update));
PALETTE(config, m_palette, palette_device::MONOCHROME);
@@ -189,6 +192,16 @@ void informer_213ae_state::informer_213ae(machine_config &config)
// ROM DEFINITIONS
//**************************************************************************
+ROM_START( in213 )
+ ROM_REGION(0x8000, "maincpu", 0)
+ // 79687-305 PTF02 SNA V2.6 CK=24EE (checksum matches)
+ ROM_LOAD("79687-305.bin", 0x0000, 0x8000, CRC(0638c6d6) SHA1(1906f835f255d595c5743b453614ba21acb5acae))
+
+ ROM_REGION(0x2000, "chargen", 0)
+ // 79688-003 ICT 213/CG. CK=C4E0 (checksum matches)
+ ROM_LOAD("79688-003.bin", 0x0000, 0x2000, CRC(75e0da94) SHA1(c10c71fcf980a5f868a85bc264661183fa69fa72))
+ROM_END
+
ROM_START( in213ae )
ROM_REGION(0x8000, "maincpu", 0)
// 79750-304-213AE_V1.6_CK-B1B8
@@ -204,5 +217,6 @@ ROM_END
// SYSTEM DRIVERS
//**************************************************************************
-// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
-COMP( 1992, in213ae, 0, 0, informer_213ae, informer_213ae, informer_213ae_state, empty_init, "Informer", "Informer 213 AE", MACHINE_IS_SKELETON | MACHINE_SUPPORTS_SAVE )
+// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
+COMP( 1990, in213 , 0, 0, informer_213, informer_213, informer_213_state, empty_init, "Informer", "Informer 213", MACHINE_IS_SKELETON | MACHINE_SUPPORTS_SAVE )
+COMP( 1992, in213ae, 0, 0, informer_213, informer_213, informer_213_state, empty_init, "Informer", "Informer 213 AE", MACHINE_IS_SKELETON | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/istrebiteli.cpp b/src/mame/drivers/istrebiteli.cpp
index fe591d8b347..a1ba11ca972 100644
--- a/src/mame/drivers/istrebiteli.cpp
+++ b/src/mame/drivers/istrebiteli.cpp
@@ -45,7 +45,7 @@ protected:
virtual void device_start() override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
// internal state
@@ -81,11 +81,11 @@ istrebiteli_sound_device::istrebiteli_sound_device(const machine_config &mconfig
void istrebiteli_sound_device::device_start()
{
- m_channel = stream_alloc(0, 1, clock() / 2);
+ m_channel = stream_alloc_legacy(0, 1, clock() / 2);
m_rom = machine().root_device().memregion("soundrom")->base();
}
-void istrebiteli_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void istrebiteli_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *sample = outputs[0];
diff --git a/src/mame/drivers/jaguar.cpp b/src/mame/drivers/jaguar.cpp
index 7cf28b0fa99..f8a01d11e76 100644
--- a/src/mame/drivers/jaguar.cpp
+++ b/src/mame/drivers/jaguar.cpp
@@ -2126,10 +2126,11 @@ ROM_START( area51 ) /* R3000 based, Area51 Atari Games License - MAIN: Oct 24 19
DISK_IMAGE( "area51", 0, SHA1(3b303bc37e206a6d7339352c869f050d04186f11) )
ROM_END
-ROM_START( maxforce ) /* R3000 based, labeled as "Maximum Force 5-23-97 v1.05" */
+
+ROM_START( maxforce ) /* R3000 based, labeled as "Maximum Force 5-23-97 v1.05" - Usually found with "light grey" labels */
ROM_REGION( 0x200000, "maincpu", 0 ) /* 2MB for IDT 79R3041 code */
- ROM_LOAD32_BYTE( "1.05_maximum_force_hh_5-23-97.hh", 0x00000, 0x80000, CRC(ec7f8167) SHA1(0cf057bfb1f30c2c9621d3ed25021e7ba7bdd46e) ) /* Usually found with "light grey" labels */
- ROM_LOAD32_BYTE( "1.05_maximum_force_hl_5-23-97.hl", 0x00001, 0x80000, CRC(3172611c) SHA1(00f14f871b737c66c20f95743740d964d0be3f24) ) /* Also found labeled as "MAXIMUM FORCE EE FIX PROG" */
+ ROM_LOAD32_BYTE( "1.05_maximum_force_hh_5-23-97.hh", 0x00000, 0x80000, CRC(ec7f8167) SHA1(0cf057bfb1f30c2c9621d3ed25021e7ba7bdd46e) ) /* Also found labeled as "MAXIMUM FORCE EE FIX PROG" */
+ ROM_LOAD32_BYTE( "1.05_maximum_force_hl_5-23-97.hl", 0x00001, 0x80000, CRC(3172611c) SHA1(00f14f871b737c66c20f95743740d964d0be3f24) )
ROM_LOAD32_BYTE( "1.05_maximum_force_lh_5-23-97.lh", 0x00002, 0x80000, CRC(84d49423) SHA1(88d9a6724f1118f2bbef5dfa27accc2b65c5ba1d) )
ROM_LOAD32_BYTE( "1.05_maximum_force_ll_5-23-97.ll", 0x00003, 0x80000, CRC(16d0768d) SHA1(665a6d7602a7f2f5b1f332b0220b1533143d56b1) )
@@ -2140,13 +2141,12 @@ ROM_START( maxforce ) /* R3000 based, labeled as "Maximum Force 5-23-97 v1.05" *
DISK_IMAGE( "maxforce", 0, SHA1(d54e7a8f3866bb2a1d28ae637e7c92ffa4dbe558) )
ROM_END
-
-ROM_START( maxf_102 ) /* R3000 based, labeled as "Maximum Force 2-27-97 v1.02" */
+ROM_START( maxf_102 ) /* R3000 based, labeled as "Maximum Force 2-27-97 v1.02" - Usually found with "yellow" labels */
ROM_REGION( 0x200000, "maincpu", 0 ) /* 2MB for IDT 79R3041 code */
- ROM_LOAD32_BYTE( "1.02_maximum_force_hh_2-27-97.hh", 0x00000, 0x80000, CRC(8ff7009d) SHA1(da22eae298a6e0e36f503fa091ac3913423dcd0f) ) /* Usually found with "yellow" labels */
- ROM_LOAD32_BYTE( "1.02_maximum_force_hl_2-27-97.hl", 0x00001, 0x80000, CRC(96c2cc1d) SHA1(b332b8c042b92c736131c478cefac1c3c2d2673b) )
- ROM_LOAD32_BYTE( "1.02_maximum_force_lh_2-27-97.lh", 0x00002, 0x80000, CRC(459ffba5) SHA1(adb40db6904e84c17f32ac6518fd2e994da7883f) )
- ROM_LOAD32_BYTE( "1.02_maximum_force_ll_2-27-97.ll", 0x00003, 0x80000, CRC(e491be7f) SHA1(cbe281c099a4aa87067752d68cf2bb0ab3900531) )
+ ROM_LOAD32_BYTE( "1.02_maximum_force_hh_2-27-97.hh", 0x00000, 0x80000, CRC(8ff7009d) SHA1(da22eae298a6e0e36f503fa091ac3913423dcd0f) ) /* Also found labeled as MAX, FORCE, V. 1.02, PROG, HH, 46FF, 2/27/97 (each item on a seperate line) */
+ ROM_LOAD32_BYTE( "1.02_maximum_force_hl_2-27-97.hl", 0x00001, 0x80000, CRC(96c2cc1d) SHA1(b332b8c042b92c736131c478cefac1c3c2d2673b) ) /* Also found labeled as MAX, FORCE, V. 1.02, PROG, HL, 14FE, 2/27/97 (each item on a seperate line) */
+ ROM_LOAD32_BYTE( "1.02_maximum_force_lh_2-27-97.lh", 0x00002, 0x80000, CRC(459ffba5) SHA1(adb40db6904e84c17f32ac6518fd2e994da7883f) ) /* Also found labeled as MAX, FORCE, V. 1.02, PROG, LH, 15FD, 2/27/97 (each item on a seperate line) */
+ ROM_LOAD32_BYTE( "1.02_maximum_force_ll_2-27-97.ll", 0x00003, 0x80000, CRC(e491be7f) SHA1(cbe281c099a4aa87067752d68cf2bb0ab3900531) ) /* Also found labeled as MAX, FORCE, V. 1.02, PROG, LL, 15FC, 2/27/97 (each item on a seperate line) */
ROM_REGION16_BE( 0x1000, "waverom", 0 )
ROM_LOAD16_WORD("jagwave.rom", 0x0000, 0x1000, CRC(7a25ee5b) SHA1(58117e11fd6478c521fbd3fdbe157f39567552f0) )
@@ -2155,7 +2155,6 @@ ROM_START( maxf_102 ) /* R3000 based, labeled as "Maximum Force 2-27-97 v1.02" *
DISK_IMAGE( "maxforce", 0, SHA1(d54e7a8f3866bb2a1d28ae637e7c92ffa4dbe558) )
ROM_END
-
ROM_START( maxf_ng ) /* R3000 based - MAIN: Apr 18 1997 11:08:45 */
ROM_REGION( 0x200000, "maincpu", 0 ) /* 2MB for IDT 79R3041 code */
ROM_LOAD32_BYTE( "maximum_force_no_gore_hh.hh", 0x00000, 0x80000, CRC(08791c02) SHA1(9befbff3201c7d345109b26c296fd8548dbfc95b) )
@@ -2188,7 +2187,6 @@ ROM_START( area51mx ) /* 68020 based - MAIN: Apr 22 1998 17:53:57 / GUTS: 2.04
DISK_IMAGE( "area51mx", 0, SHA1(5ff10f4e87094d4449eabf3de7549564ca568c7e) )
ROM_END
-
ROM_START( a51mxr3k ) /* R3000 based - MAIN: Feb 10 1998 11:52:51 / GUTS: 2.07CJ Feb 5 1998 18:52:26 */
ROM_REGION( 0x200000, "maincpu", 0 ) /* 2MB for IDT 79R3041 code */
ROM_LOAD32_BYTE( "1.0_r3k_max-a51_kit_hh.hh", 0x00000, 0x80000, CRC(a984dab2) SHA1(debb3bc11ff49e87a52e89a69533a1bab7db700e) ) /* Labeled as 1.0 R3K MAX/A51 KIT HH */
@@ -2203,7 +2201,6 @@ ROM_START( a51mxr3k ) /* R3000 based - MAIN: Feb 10 1998 11:52:51 / GUTS: 2.07CJ
DISK_IMAGE( "area51mx", 0, SHA1(5ff10f4e87094d4449eabf3de7549564ca568c7e) )
ROM_END
-
ROM_START( a51mxr3ka ) /* R3000 based - MAIN: Feb 2 1998 14:10:29 / GUTS: 2.07CJ Jan 9 1998 21:11:55 */
ROM_REGION( 0x200000, "maincpu", 0 ) /* 2MB for IDT 79R3041 code */
ROM_LOAD32_BYTE( "maxa51_combo_r3k_hh_prog_2-02-98_67ff.hh", 0x00000, 0x80000, CRC(6af8950a) SHA1(33ae123065b14ed8d83635f3351ac5b5c136d206) ) /* Labeled as MAXA51 COMBO R3K HH PROG 2/02/98 67FF (each item on a seperate line) */
diff --git a/src/mame/drivers/konmedal68k.cpp b/src/mame/drivers/konmedal68k.cpp
index dce2553a8f6..02ce8da8538 100644
--- a/src/mame/drivers/konmedal68k.cpp
+++ b/src/mame/drivers/konmedal68k.cpp
@@ -49,6 +49,7 @@ public:
void kzaurus(machine_config &config);
void koropens(machine_config &config);
+ void slot(machine_config &config);
protected:
virtual void machine_start() override;
@@ -98,8 +99,10 @@ private:
return m_k056832->rom_word_r(offset);
}
+ void common_main(address_map &map);
void kzaurus_main(address_map &map);
void koropens_main(address_map &map);
+ void slot_main(address_map &map);
static constexpr int NUM_LAYERS = 4;
@@ -204,7 +207,7 @@ uint32_t konmedal68k_state::screen_update_konmedal68k(screen_device &screen, bit
return 0;
}
-void konmedal68k_state::kzaurus_main(address_map &map)
+void konmedal68k_state::common_main(address_map &map)
{
map(0x000000, 0x07ffff).rom().region("maincpu", 0);
map(0x400000, 0x403fff).ram().share("nvram");
@@ -221,31 +224,32 @@ void konmedal68k_state::kzaurus_main(address_map &map)
map(0x880000, 0x880003).rw(m_ymz, FUNC(ymz280b_device::read), FUNC(ymz280b_device::write)).umask16(0xff00);
map(0xa00000, 0xa01fff).rw(m_k056832, FUNC(k056832_device::ram_word_r), FUNC(k056832_device::ram_word_w));
map(0xa02000, 0xa03fff).rw(m_k056832, FUNC(k056832_device::ram_word_r), FUNC(k056832_device::ram_word_w));
+}
+
+void konmedal68k_state::kzaurus_main(address_map &map)
+{
+ common_main(map);
map(0xb00000, 0xb03fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0xc00000, 0xc01fff).r(FUNC(konmedal68k_state::vrom_r));
}
void konmedal68k_state::koropens_main(address_map &map)
{
- map(0x000000, 0x07ffff).rom().region("maincpu", 0);
- map(0x400000, 0x403fff).ram().share("nvram");
- map(0x800000, 0x800001).w(FUNC(konmedal68k_state::control_w));
- map(0x800004, 0x800005).portr("DSW");
- map(0x800006, 0x800007).portr("IN1");
- map(0x800008, 0x800009).portr("IN0");
- map(0x810000, 0x810001).w(FUNC(konmedal68k_state::control2_w));
- map(0x820000, 0x820001).portw("OUT");
- map(0x830000, 0x83003f).rw(m_k056832, FUNC(k056832_device::word_r), FUNC(k056832_device::word_w));
- map(0x840000, 0x84000f).w(m_k056832, FUNC(k056832_device::b_word_w));
- map(0x85001c, 0x85001f).nopw();
- map(0x870000, 0x87005f).w(m_k055555, FUNC(k055555_device::K055555_word_w));
- map(0x880000, 0x880003).rw(m_ymz, FUNC(ymz280b_device::read), FUNC(ymz280b_device::write)).umask16(0xff00);
- map(0xa00000, 0xa01fff).rw(m_k056832, FUNC(k056832_device::ram_word_r), FUNC(k056832_device::ram_word_w));
- map(0xa02000, 0xa03fff).rw(m_k056832, FUNC(k056832_device::ram_word_r), FUNC(k056832_device::ram_word_w));
+ common_main(map);
map(0xb00000, 0xb03fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0xc00000, 0xc01fff).r(FUNC(konmedal68k_state::vrom_koropens_r));
}
+void konmedal68k_state::slot_main(address_map &map)
+{
+ common_main(map);
+ map(0xb00000, 0xb03fff).ram().lrw16(
+ NAME([this](offs_t offset) -> u16 { return (offset & 1) ? m_palette->read16(offset / 2) : 0; }),
+ NAME([this](offs_t offset, u16 data) { if (offset & 1) m_palette->write16(offset / 2, data); })
+ ).share("palette");
+ map(0xc00000, 0xc01fff).r(FUNC(konmedal68k_state::vrom_r));
+}
+
static INPUT_PORTS_START( kzaurus )
PORT_START("IN0")
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 )
@@ -379,6 +383,16 @@ void konmedal68k_state::koropens(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &konmedal68k_state::koropens_main);
}
+void konmedal68k_state::slot(machine_config &config)
+{
+ kzaurus(config);
+
+ M68000(config.replace(), m_maincpu, XTAL(33'868'800) / 4); // 33.8688 MHz crystal verified on PCB
+ m_maincpu->set_addrmap(AS_PROGRAM, &konmedal68k_state::slot_main);
+
+ PALETTE(config.replace(), "palette").set_format(palette_device::xBGR_444, 4096).enable_shadows();
+}
+
ROM_START( kzaurus )
ROM_REGION( 0x80000, "maincpu", 0 ) /* main program */
ROM_LOAD16_WORD_SWAP( "540-b05-2n.bin", 0x000000, 0x080000, CRC(110d4ecb) SHA1(8903783f62ad5a983242a0fe8d835857964abc43) )
@@ -471,10 +485,23 @@ ROM_START( konslot )
ROM_LOAD( "669-a01-2d.bin", 0x000000, 0x080000, CRC(08438dad) SHA1(b4ef8fc37deca5b6537cc581fc99968c86e6ec2c) )
ROM_END
+ROM_START( konslot2 )
+ ROM_REGION( 0x80000, "maincpu", 0 )
+ ROM_LOAD16_WORD_SWAP( "660-a05.2n", 0x000000, 0x080000, CRC(d7460250) SHA1(490588181b3b558e03752f4c6cbdadb807b990b3) )
+
+ ROM_REGION( 0x80000, "k056832", 0 )
+ ROM_LOAD( "660-a06.14n", 0x000000, 0x080000, CRC(17d2dbb7) SHA1(b32b4123c6006ad7ee0b2d12542bad6b9ccb4cf2) )
+
+ ROM_REGION( 0x100000, "ymz", 0 )
+ ROM_LOAD( "660-a01.2f", 0x000000, 0x080000, CRC(b350de2f) SHA1(56d6054b5b9fbabc12cfa3979c8b563c66f687c9) )
+ ROM_LOAD( "660-a02.1f", 0x080000, 0x080000, CRC(e3199b0d) SHA1(8805be14388c73c5a8e0b2eb98fb8efb5def1714) )
+ROM_END
+
GAME( 1995, kzaurus, 0, kzaurus, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Pittanko Zaurus", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1996, dobouchn, 0, kzaurus, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Dobou-Chan (ver JAA)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS )
-GAME( 199?, konslot, 0, kzaurus, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Unknown Konami slot medal game", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS )
+GAME( 199?, konslot, 0, slot, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Unknown Konami slot medal game (set 1)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS )
+GAME( 199?, konslot2, 0, slot, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Unknown Konami slot medal game (set 2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS )
GAME( 1997, koropens, 0, koropens, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Korokoro Pensuke", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1998, kattobas, 0, koropens, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Kattobase Power Pro Kun", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1999, pwrchanc, 0, koropens, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Powerful Chance", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS )
diff --git a/src/mame/drivers/mac.cpp b/src/mame/drivers/mac.cpp
index f97b71647d0..2db4d331526 100644
--- a/src/mame/drivers/mac.cpp
+++ b/src/mame/drivers/mac.cpp
@@ -88,9 +88,6 @@
#include "bus/nubus/pds30_30hr.h"
#include "bus/nubus/pds30_mc30.h"
-// 68000 PDS cards
-#include "bus/macpds/pds_tpdfpd.h"
-
#include "machine/macadb.h"
#include "softlist.h"
#include "speaker.h"
@@ -582,35 +579,6 @@ void mac_state::mac_5396_w(offs_t offset, uint8_t data)
ADDRESS MAPS
***************************************************************************/
-void mac_state::mac512ke_map(address_map &map)
-{
- map(0x800000, 0x9fffff).r(FUNC(mac_state::mac_scc_r));
- map(0xa00000, 0xbfffff).w(FUNC(mac_state::mac_scc_w));
- map(0xc00000, 0xdfffff).rw(FUNC(mac_state::mac_iwm_r), FUNC(mac_state::mac_iwm_w));
- map(0xe80000, 0xefffff).rw(FUNC(mac_state::mac_via_r), FUNC(mac_state::mac_via_w));
- map(0xfffff0, 0xffffff).rw(FUNC(mac_state::mac_autovector_r), FUNC(mac_state::mac_autovector_w));
-}
-
-void mac_state::macplus_map(address_map &map)
-{
- map(0x580000, 0x5fffff).rw(FUNC(mac_state::macplus_scsi_r), FUNC(mac_state::macplus_scsi_w));
- map(0x800000, 0x9fffff).r(FUNC(mac_state::mac_scc_r));
- map(0xa00000, 0xbfffff).w(FUNC(mac_state::mac_scc_w));
- map(0xc00000, 0xdfffff).rw(FUNC(mac_state::mac_iwm_r), FUNC(mac_state::mac_iwm_w));
- map(0xe80000, 0xefffff).rw(FUNC(mac_state::mac_via_r), FUNC(mac_state::mac_via_w));
- map(0xfffff0, 0xffffff).rw(FUNC(mac_state::mac_autovector_r), FUNC(mac_state::mac_autovector_w));
-}
-
-void mac_state::macse_map(address_map &map)
-{
- map(0x580000, 0x5fffff).rw(FUNC(mac_state::macplus_scsi_r), FUNC(mac_state::macplus_scsi_w));
- map(0x900000, 0x9fffff).r(FUNC(mac_state::mac_scc_r));
- map(0xb00000, 0xbfffff).w(FUNC(mac_state::mac_scc_w));
- map(0xd00000, 0xdfffff).rw(FUNC(mac_state::mac_iwm_r), FUNC(mac_state::mac_iwm_w));
- map(0xe80000, 0xefffff).rw(FUNC(mac_state::mac_via_r), FUNC(mac_state::mac_via_w));
- map(0xfffff0, 0xffffff).rw(FUNC(mac_state::mac_autovector_r), FUNC(mac_state::mac_autovector_w));
-}
-
void mac_state::macprtb_map(address_map &map)
{
map(0x900000, 0x93ffff).rom().region("bootrom", 0).mirror(0x0c0000);
@@ -902,11 +870,6 @@ static void mac_pds030_cards(device_slot_interface &device)
device.option_add("mc30", PDS030_XCEEDMC30); // Micron/XCEED Technology MacroColor 30
}
-static void mac_sepds_cards(device_slot_interface &device)
-{
- device.option_add("radiusfpd", PDS_SEDISPLAY); // Radius Full Page Display card for SE
-}
-
static void mac_lcpds_cards(device_slot_interface &device)
{
}
@@ -980,9 +943,11 @@ void mac_state::add_egret(machine_config &config, int type)
{
EGRET(config, m_egret, type);
m_egret->reset_callback().set(FUNC(mac_state::cuda_reset_w));
- m_egret->linechange_callback().set(FUNC(mac_state::adb_linechange_w));
+ m_egret->linechange_callback().set(m_macadb, FUNC(macadb_device::adb_linechange_w));
m_egret->via_clock_callback().set(m_via1, FUNC(via6522_device::write_cb1));
m_egret->via_data_callback().set(m_via1, FUNC(via6522_device::write_cb2));
+ m_macadb->set_mcu_mode(true);
+ m_macadb->adb_data_callback().set(m_egret, FUNC(egret_device::set_adb_line));
config.set_perfect_quantum(m_maincpu);
}
@@ -990,9 +955,12 @@ void mac_state::add_cuda(machine_config &config, int type)
{
CUDA(config, m_cuda, type);
m_cuda->reset_callback().set(FUNC(mac_state::cuda_reset_w));
- m_cuda->linechange_callback().set(FUNC(mac_state::adb_linechange_w));
+ m_cuda->linechange_callback().set(m_macadb, FUNC(macadb_device::adb_linechange_w));
m_cuda->via_clock_callback().set(m_via1, FUNC(via6522_device::write_cb1));
m_cuda->via_data_callback().set(m_via1, FUNC(via6522_device::write_cb2));
+ m_macadb->set_mcu_mode(true);
+ m_macadb->adb_data_callback().set(m_cuda, FUNC(cuda_device::set_adb_line));
+ config.set_perfect_quantum(m_maincpu);
}
void mac_state::add_asc(machine_config &config, asc_device::asc_type type)
@@ -1034,61 +1002,6 @@ void mac_state::add_pb1xx_vias(machine_config &config)
m_via2->irq_handler().set(FUNC(mac_state::mac_via2_irq));
}
-void mac_state::mac512ke_base(machine_config &config)
-{
- M68000(config, m_maincpu, C7M); /* 7.8336 MHz */
- m_maincpu->set_addrmap(AS_PROGRAM, &mac_state::mac512ke_map);
- m_maincpu->set_dasm_override(FUNC(mac_state::mac_dasm_override));
- config.set_maximum_quantum(attotime::from_hz(60));
-
- SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
- m_screen->set_raw(C7M*2, MAC_H_TOTAL, 0, MAC_H_VIS, MAC_V_TOTAL, 0, MAC_V_VIS);
- m_screen->set_screen_update(FUNC(mac_state::screen_update_mac));
- m_screen->set_palette(m_palette);
-
- PALETTE(config, m_palette, palette_device::MONOCHROME_INVERTED);
-
- MCFG_VIDEO_START_OVERRIDE(mac_state,mac)
-
- SPEAKER(config, "speaker").front_center();
- DAC_8BIT_PWM(config, m_dac, 0);
- m_dac->add_route(ALL_OUTPUTS, "speaker", 0.25); // 2 x ls161
- voltage_regulator_device &vreg(VOLTAGE_REGULATOR(config, "vref", 0));
- vreg.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
- vreg.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
-
- add_base_devices(config, true, false);
-
- VIA6522(config, m_via1, 1000000);
- m_via1->readpa_handler().set(FUNC(mac_state::mac_via_in_a));
- m_via1->readpb_handler().set(FUNC(mac_state::mac_via_in_b));
- m_via1->writepa_handler().set(FUNC(mac_state::mac_via_out_a));
- m_via1->writepb_handler().set(FUNC(mac_state::mac_via_out_b));
- m_via1->irq_handler().set(FUNC(mac_state::mac_via_irq));
-
- RAM(config, m_ram);
- m_ram->set_default_size("512K");
-}
-
-void mac_state::mac512ke(machine_config &config)
-{
- mac512ke_base(config);
-}
-
-void mac_state::add_macplus_additions(machine_config &config)
-{
- m_maincpu->set_addrmap(AS_PROGRAM, &mac_state::macplus_map);
-
- add_scsi(config);
-
- /* internal ram */
- m_ram->set_default_size("4M");
- m_ram->set_extra_options("1M,2M,2560K,4M");
-
- // software list
- SOFTWARE_LIST(config, "flop35_list").set_original("mac_flop");
-}
-
void mac_state::add_nubus(machine_config &config, bool bank1, bool bank2)
{
nubus_device &nubus(NUBUS(config, "nubus", 0));
@@ -1126,43 +1039,6 @@ template <typename T> void mac_state::add_nubus_pds(machine_config &config, cons
NUBUS_SLOT(config, slot_tag, "pds", std::forward<T>(opts), nullptr);
}
-void mac_state::macplus(machine_config &config)
-{
- mac512ke_base(config);
- add_macplus_additions(config);
-}
-
-void mac_state::macse(machine_config &config)
-{
- mac512ke_base(config);
- add_macplus_additions(config);
- m_maincpu->set_addrmap(AS_PROGRAM, &mac_state::macse_map);
-
- m_via1->writepb_handler().set(FUNC(mac_state::mac_via_out_b_bbadb));
- m_via1->cb2_handler().set(FUNC(mac_state::mac_adb_via_out_cb2));
-
- /* internal ram */
- m_ram->set_default_size("4M");
- m_ram->set_extra_options("2M,2560K,4M");
-
- MACPDS(config, "sepds", "maincpu");
- MACPDS_SLOT(config, "pds", "sepds", mac_sepds_cards, nullptr);
-}
-
-void mac_state::macclasc(machine_config &config)
-{
- mac512ke_base(config);
- add_macplus_additions(config);
- m_maincpu->set_addrmap(AS_PROGRAM, &mac_state::macse_map);
-
- m_via1->writepb_handler().set(FUNC(mac_state::mac_via_out_b_bbadb));
- m_via1->cb2_handler().set(FUNC(mac_state::mac_adb_via_out_cb2));
-
- /* internal ram */
- m_ram->set_default_size("4M");
- m_ram->set_extra_options("2M,2560K,4M");
-}
-
void mac_state::macprtb(machine_config &config)
{
/* basic machine hardware */
@@ -1184,6 +1060,10 @@ void mac_state::macprtb(machine_config &config)
add_scsi(config);
add_asc(config, asc_device::asc_type::ASC);
+ MACADB(config, m_macadb, C15M);
+ m_macadb->set_pmu_mode(true);
+ m_macadb->set_pmu_is_via1(true);
+
VIA6522(config, m_via1, 783360);
m_via1->readpa_handler().set(FUNC(mac_state::mac_via_in_a_pmu));
m_via1->readpb_handler().set(FUNC(mac_state::mac_via_in_b_pmu));
@@ -1216,6 +1096,11 @@ void mac_state::macii(machine_config &config, bool cpu, asc_device::asc_type asc
add_via1_adb(config, true);
add_via2(config);
+ MACADB(config, m_macadb, C15M);
+ m_macadb->via_clock_callback().set(m_via1, FUNC(via6522_device::write_cb1));
+ m_macadb->via_data_callback().set(m_via1, FUNC(via6522_device::write_cb2));
+ m_macadb->adb_irq_callback().set(FUNC(mac_state::adb_irq_w));
+
RAM(config, m_ram);
m_ram->set_default_size("2M");
m_ram->set_extra_options("8M,32M,64M,96M,128M");
@@ -1290,7 +1175,9 @@ void mac_state::maclc(machine_config &config, bool cpu, bool egret, asc_device::
add_nubus_pds(config, "lcpds", mac_lcpds_cards);
if (egret)
+ {
add_egret(config, EGRET_341S0850);
+ }
}
void mac_state::maclc2(machine_config &config, bool egret)
@@ -1337,7 +1224,9 @@ void mac_state::maclc3(machine_config &config, bool egret)
m_ram->set_extra_options("8M,16M,32M,48M,64M,80M");
if (egret)
+ {
add_egret(config, EGRET_341S0851);
+ }
}
void mac_state::maclc520(machine_config &config)
@@ -1420,6 +1309,11 @@ void mac_state::macse30(machine_config &config)
add_via1_adb(config, false);
add_via2(config);
+ MACADB(config, m_macadb, C15M);
+ m_macadb->via_clock_callback().set(m_via1, FUNC(via6522_device::write_cb1));
+ m_macadb->via_data_callback().set(m_via1, FUNC(via6522_device::write_cb2));
+ m_macadb->adb_irq_callback().set(FUNC(mac_state::adb_irq_w));
+
RAM(config, m_ram);
m_ram->set_default_size("2M");
m_ram->set_extra_options("8M,16M,32M,48M,64M,96M,128M");
@@ -1445,6 +1339,9 @@ void mac_state::macpb140(machine_config &config)
add_base_devices(config, false, true);
add_pb1xx_vias(config);
+ MACADB(config, m_macadb, C15M);
+ m_macadb->set_pmu_mode(true);
+
RAM(config, m_ram);
m_ram->set_default_size("2M");
m_ram->set_extra_options("4M,6M,8M");
@@ -1490,6 +1387,9 @@ void mac_state::macpb160(machine_config &config)
add_base_devices(config, false, true);
add_pb1xx_vias(config);
+ MACADB(config, m_macadb, C15M);
+ m_macadb->set_pmu_mode(true);
+
RAM(config, m_ram);
m_ram->set_default_size("4M");
m_ram->set_extra_options("8M,12M,16M");
@@ -1633,6 +1533,7 @@ void mac_state::pwrmac(machine_config &config)
m_ram->set_default_size("8M");
m_ram->set_extra_options("16M,32M,64M,128M");
+ MACADB(config, m_macadb, C15M);
add_cuda(config, CUDA_341S0060);
}
@@ -1685,127 +1586,9 @@ void mac_state::macqd700(machine_config &config)
}
static INPUT_PORTS_START( macadb )
- PORT_START("MOUSE0") /* Mouse - button */
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1)
-
- PORT_START("MOUSE1") /* Mouse - X AXIS */
- PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
-
- PORT_START("MOUSE2") /* Mouse - Y AXIS */
- PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
-
- /* This handles the standard (not Extended) Apple ADB keyboard, which is similar to the IIgs's */
- /* main keyboard */
-
- PORT_START("KEY0")
- PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
- PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
- PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
- PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
- PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
- PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
- PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
- PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
- PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
- PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
- PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_UNUSED) /* extra key on ISO : */
- PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
- PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
- PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
- PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
- PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
-
- PORT_START("KEY1")
- PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
- PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
- PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
- PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@')
- PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
- PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
- PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^')
- PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
- PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
- PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
- PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&')
- PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
- PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
- PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
- PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
- PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
-
- PORT_START("KEY2")
- PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
- PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
- PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
- PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
- PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r')
- PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
- PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
- PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
- PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
- PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
- PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
- PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
- PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
- PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
- PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
- PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
-
- PORT_START("KEY3")
- PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t')
- PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
- PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~')
- PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
- PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNUSED) /* keyboard Enter : */
- PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27)
- PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL)
- PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Command / Open Apple") PORT_CODE(KEYCODE_RALT)
- PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
- PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE
- PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Option / Solid Apple") PORT_CODE(KEYCODE_LALT)
- PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Arrow") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
- PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Arrow") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
- PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down Arrow") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
- PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up Arrow") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
- PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED) /* ??? */
-
- /* keypad */
- PORT_START("KEY4")
- PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x40
- PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) // 0x41
- PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x42
- PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) // 0x43
- PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x44
- PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) // 0x45
- PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x46
- PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad Clear") PORT_CODE(/*KEYCODE_NUMLOCK*/KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) // 0x47
- PORT_BIT(0x0700, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x48, 49, 4a
- PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) // 0x4b
- PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) // 0x4c
- PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x4d
- PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) // 0x4e
- PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x4f
-
- PORT_START("KEY5")
- PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x50
- PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(/*CODE_OTHER*/KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(EQUALS_PAD)) // 0x51
- PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) // 0x52
- PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) // 0x53
- PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) // 0x54
- PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) // 0x55
- PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) // 0x56
- PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) // 0x57
- PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) // 0x58
- PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) // 0x59
- PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x5a
- PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) // 0x5b
- PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) // 0x5c
- PORT_BIT(0xE000, IP_ACTIVE_HIGH, IPT_UNUSED)
INPUT_PORTS_END
INPUT_PORTS_START( maciici )
- PORT_INCLUDE(macadb)
-
PORT_START("MONTYPE")
PORT_CONFNAME(0x0f, 0x06, "Connected monitor")
PORT_CONFSETTING( 0x01, "15\" Portrait Display (640x870)")
@@ -1821,22 +1604,6 @@ INPUT_PORTS_END
***************************************************************************/
-ROM_START( macse )
- ROM_REGION16_BE(0x40000, "bootrom", 0)
- ROM_LOAD16_WORD( "macse.rom", 0x00000, 0x40000, CRC(0f7ff80c) SHA1(58532b7d0d49659fd5228ac334a1b094f0241968))
-ROM_END
-
-ROM_START( macsefd )
- ROM_REGION16_BE(0x40000, "bootrom", 0)
- ROM_LOAD( "be06e171.rom", 0x000000, 0x040000, CRC(f530cb10) SHA1(d3670a90273d12e53d86d1228c068cb660b8c9d1) )
-ROM_END
-
-ROM_START( macclasc )
- ROM_REGION16_BE(0x80000, "bootrom", 0) // a49f9914, second half of chip dump is the 6.0.3 XO rom disk
- // this dump is big endian
- ROM_LOAD( "341-0813__=c=1983-90_apple__japan__910d_d.27c4096_be.ue1", 0x000000, 0x080000, CRC(510d7d38) SHA1(ccd10904ddc0fb6a1d216b2e9effd5ec6cf5a83d) )
-ROM_END
-
ROM_START( maclc )
ROM_REGION32_BE(0x100000, "bootrom", 0)
ROM_LOAD("350eacf0.rom", 0x000000, 0x080000, CRC(71681726) SHA1(6bef5853ae736f3f06c2b4e79772f65910c3b7d4))
@@ -2035,8 +1802,6 @@ ROM_START( maclc520 )
ROM_END
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */
-COMP( 1987, macse, 0, 0, macse, macadb, mac_state, init_macse, "Apple Computer", "Macintosh SE", MACHINE_NOT_WORKING )
-COMP( 1987, macsefd, 0, 0, macse, macadb, mac_state, init_macse, "Apple Computer", "Macintosh SE (FDHD)", MACHINE_NOT_WORKING )
COMP( 1987, macii, 0, 0, macii, macadb, mac_state, init_macii, "Apple Computer", "Macintosh II", MACHINE_NOT_WORKING )
COMP( 1987, maciihmu, macii, 0, maciihmu, macadb, mac_state, init_macii, "Apple Computer", "Macintosh II (w/o 68851 MMU)", MACHINE_NOT_WORKING )
COMP( 1988, mac2fdhd, 0, 0, macii, macadb, mac_state, init_maciifdhd, "Apple Computer", "Macintosh II (FDHD)", MACHINE_NOT_WORKING )
@@ -2046,7 +1811,6 @@ COMP( 1989, macse30, mac2fdhd, 0, macse30, macadb, mac_state, init_macs
COMP( 1989, maciicx, mac2fdhd, 0, maciicx, macadb, mac_state, init_maciicx, "Apple Computer", "Macintosh IIcx", MACHINE_NOT_WORKING )
COMP( 1989, maciici, 0, 0, maciici, maciici, mac_state, init_maciici, "Apple Computer", "Macintosh IIci", MACHINE_NOT_WORKING )
COMP( 1990, maciifx, 0, 0, maciifx, macadb, mac_state, init_maciifx, "Apple Computer", "Macintosh IIfx", MACHINE_NOT_WORKING )
-COMP( 1990, macclasc, 0, 0, macclasc, macadb, mac_state, init_macclassic, "Apple Computer", "Macintosh Classic", MACHINE_NOT_WORKING )
COMP( 1990, maclc, 0, 0, maclc, maciici, mac_state, init_maclc, "Apple Computer", "Macintosh LC", MACHINE_IMPERFECT_SOUND )
COMP( 1990, maciisi, 0, 0, maciisi, maciici, mac_state, init_maciisi, "Apple Computer", "Macintosh IIsi", MACHINE_NOT_WORKING )
COMP( 1991, macpb100, 0, 0, macprtb, macadb, mac_state, init_macprtb, "Apple Computer", "Macintosh PowerBook 100", MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/mac128.cpp b/src/mame/drivers/mac128.cpp
index a7b31810805..de3e93a68d8 100644
--- a/src/mame/drivers/mac128.cpp
+++ b/src/mame/drivers/mac128.cpp
@@ -5,7 +5,9 @@
drivers/mac128.cpp
Original-style Macintosh family emulation
- The cutoff here is Macs with 128k-style video and audio and no ADB
+ The cutoff here is Macs with 128k-style video and audio.
+ We also include the SE and Classic, which are basically cost-reduced Mac Pluses with ADB
+ instead of the original keyboard/mouse hardware.
Nate Woods, Raphael Nabet, R. Belmont
@@ -99,8 +101,10 @@ c0 8 data bits, Rx disabled
#include "machine/swim.h"
#include "machine/timer.h"
#include "machine/z80scc.h"
+#include "machine/macadb.h"
#include "sound/dac.h"
#include "sound/volt_reg.h"
+#include "bus/macpds/pds_tpdfpd.h"
#include "formats/ap_dsk35.h"
@@ -122,9 +126,11 @@ c0 8 data bits, Rx disabled
/* tells which model is being emulated (set by macxxx_init) */
enum mac128model_t
{
- MODEL_MAC_128K512K, // 68000 machines
+ MODEL_MAC_128K512K,
MODEL_MAC_512KE,
- MODEL_MAC_PLUS
+ MODEL_MAC_PLUS,
+ MODEL_MAC_SE,
+ MODEL_MAC_CLASSIC
};
// video parameters
@@ -150,6 +156,7 @@ public:
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_via(*this, "via6522_0"),
+ m_macadb(*this, "macadb"),
m_ram(*this, RAM_TAG),
m_ncr5380(*this, "ncr5380"),
m_iwm(*this, "fdc"),
@@ -167,43 +174,30 @@ public:
void mac512ke(machine_config &config);
void mac128k(machine_config &config);
void macplus(machine_config &config);
+ void macse(machine_config &config);
+ void macclasc(machine_config &config);
void init_mac128k512k();
void init_mac512ke();
void init_macplus();
+ void init_macse();
+ void init_macclassic();
private:
required_device<m68000_device> m_maincpu;
required_device<via6522_device> m_via;
+ optional_device<macadb_device> m_macadb;
required_device<ram_device> m_ram;
optional_device<ncr5380_device> m_ncr5380;
required_device<applefdc_base_device> m_iwm;
- required_device<mac_keyboard_port_device> m_mackbd;
+ optional_device<mac_keyboard_port_device> m_mackbd;
optional_device<rtc3430042_device> m_rtc;
- required_ioport m_mouse0, m_mouse1, m_mouse2;
+ optional_ioport m_mouse0, m_mouse1, m_mouse2;
virtual void machine_start() override;
virtual void machine_reset() override;
- mac128model_t m_model;
-
- uint32_t m_overlay;
-
- int m_irq_count, m_ca1_data, m_ca2_data;
-
- int m_mouse_bit_x;
- int m_mouse_bit_y;
- int last_mx, last_my;
- int count_x, count_y;
- int m_last_was_x;
- int m_screen_buffer;
- emu_timer *m_scan_timer;
- emu_timer *m_hblank_timer;
-
- // interrupts
- int m_scc_interrupt, m_via_interrupt, m_scsi_interrupt, m_last_taken_interrupt;
-
void scc_mouse_irq( int x, int y );
void set_via_interrupt(int value);
void field_interrupts();
@@ -212,6 +206,7 @@ private:
uint16_t ram_r(offs_t offset);
void ram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
+ void ram_w_se(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
uint16_t ram_600000_r(offs_t offset);
void ram_600000_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~ 0);
uint16_t mac_via_r(offs_t offset);
@@ -225,26 +220,52 @@ private:
DECLARE_WRITE_LINE_MEMBER(mac_scsi_irq);
DECLARE_WRITE_LINE_MEMBER(set_scc_interrupt);
+ WRITE_LINE_MEMBER(adb_irq_w) { m_adb_irq_pending = state; }
+
TIMER_CALLBACK_MEMBER(mac_scanline);
TIMER_CALLBACK_MEMBER(mac_hblank);
uint32_t screen_update_mac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint8_t mac_via_in_a();
uint8_t mac_via_in_b();
+ uint8_t mac_via_in_b_se();
void mac_via_out_a(uint8_t data);
void mac_via_out_b(uint8_t data);
+ void mac_via_out_a_se(uint8_t data);
+ void mac_via_out_b_se(uint8_t data);
DECLARE_WRITE_LINE_MEMBER(mac_via_irq);
void mac_driver_init(mac128model_t model);
void update_volume();
void mac512ke_map(address_map &map);
void macplus_map(address_map &map);
-private:
+ void macse_map(address_map &map);
+
+ mac128model_t m_model;
+
+ uint32_t m_overlay;
+
+ int m_irq_count, m_ca1_data, m_ca2_data;
+ int m_mouse_bit_x;
+ int m_mouse_bit_y;
+ int last_mx, last_my;
+ int count_x, count_y;
+ int m_last_was_x;
+ int m_screen_buffer;
+ emu_timer *m_scan_timer;
+ emu_timer *m_hblank_timer;
+
+ // interrupts
+ int m_scc_interrupt, m_via_interrupt, m_scsi_interrupt, m_last_taken_interrupt;
+
// wait states for accessing the VIA
int m_via_cycles;
bool m_snd_enable;
bool m_main_buffer;
int m_snd_vol;
+ int m_adb_irq_pending;
+ int m_drive_select;
+ int m_scsiirq_enable;
u16 *m_ram_ptr, *m_rom_ptr;
u32 m_ram_mask, m_ram_size;
@@ -262,6 +283,29 @@ void mac128_state::machine_start()
m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac128_state::mac_scanline), this));
m_hblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac128_state::mac_hblank), this));
+
+ save_item(NAME(m_overlay));
+ save_item(NAME(m_irq_count));
+ save_item(NAME(m_ca1_data));
+ save_item(NAME(m_ca2_data));
+ save_item(NAME(m_mouse_bit_x));
+ save_item(NAME(m_mouse_bit_y));
+ save_item(NAME(last_mx));
+ save_item(NAME(last_my));
+ save_item(NAME(count_x));
+ save_item(NAME(count_y));
+ save_item(NAME(m_last_was_x));
+ save_item(NAME(m_screen_buffer));
+ save_item(NAME(m_scc_interrupt));
+ save_item(NAME(m_via_interrupt));
+ save_item(NAME(m_scsi_interrupt));
+ save_item(NAME(m_last_taken_interrupt));
+ save_item(NAME(m_snd_enable));
+ save_item(NAME(m_main_buffer));
+ save_item(NAME(m_snd_vol));
+ save_item(NAME(m_adb_irq_pending));
+ save_item(NAME(m_drive_select));
+ save_item(NAME(m_scsiirq_enable));
}
void mac128_state::machine_reset()
@@ -278,6 +322,9 @@ void mac128_state::machine_reset()
m_irq_count = 0;
m_ca1_data = 0;
m_ca2_data = 0;
+ m_adb_irq_pending = 0;
+ m_drive_select = 0;
+ m_scsiirq_enable = 0;
const int next_vpos = m_screen->vpos() + 1;
m_scan_timer->adjust(m_screen->time_until_pos(next_vpos), next_vpos);
@@ -303,6 +350,12 @@ void mac128_state::ram_w(offs_t offset, uint16_t data, uint16_t mem_mask)
}
}
+void mac128_state::ram_w_se(offs_t offset, uint16_t data, uint16_t mem_mask)
+{
+ m_overlay = 0;
+ COMBINE_DATA(&m_ram_ptr[offset & m_ram_mask]);
+}
+
uint16_t mac128_state::ram_600000_r(offs_t offset)
{
return m_ram_ptr[offset & m_ram_mask];
@@ -326,7 +379,7 @@ void mac128_state::field_interrupts()
take_interrupt = 1;
}
-// printf("field_interrupts: take %d\n", take_interrupt);
+// printf("field_interrupts: take %d\n", take_interrupt);
if (m_last_taken_interrupt > -1)
{
@@ -351,7 +404,7 @@ WRITE_LINE_MEMBER(mac128_state::set_scc_interrupt)
void mac128_state::set_via_interrupt(int value)
{
m_via_interrupt = value;
- this->field_interrupts();
+ field_interrupts();
}
void mac128_state::vblank_irq()
@@ -359,6 +412,11 @@ void mac128_state::vblank_irq()
m_ca1_data ^= 1;
m_via->write_ca1(m_ca1_data);
+ if (m_macadb)
+ {
+ m_macadb->adb_vblank();
+ }
+
if (++m_irq_count == 60)
{
m_irq_count = 0;
@@ -403,7 +461,7 @@ TIMER_CALLBACK_MEMBER(mac128_state::mac_scanline)
m_hblank_timer->adjust(m_screen->time_until_pos(scanline, MAC_H_VIS));
}
- if (!(scanline % 10))
+ if ((!(scanline % 10)) && (m_model < MODEL_MAC_SE))
{
mouse_callback();
}
@@ -683,7 +741,7 @@ uint16_t mac128_state::mac_autovector_r(offs_t offset)
uint8_t mac128_state::mac_via_in_a()
{
- return 0x80;
+ return 0x81;
}
uint8_t mac128_state::mac_via_in_b()
@@ -699,6 +757,22 @@ uint8_t mac128_state::mac_via_in_b()
val |= m_rtc->data_r();
+// printf("%s VIA1 IN_B = %02x\n", machine().describe_context().c_str(), val);
+
+ return val;
+}
+
+uint8_t mac128_state::mac_via_in_b_se()
+{
+ int val = m_macadb->get_adb_state()<<4;
+
+ if (!m_adb_irq_pending)
+ {
+ val |= 0x08;
+ }
+
+ val |= m_rtc->data_r();
+
// printf("%s VIA1 IN_B = %02x\n", machine().describe_context().c_str(), val);
return val;
@@ -716,16 +790,32 @@ void mac128_state::mac_via_out_a(uint8_t data)
m_snd_vol = data & 0x07;
update_volume();
- /* Early Mac models had VIA A4 control overlaying. In the Mac SE (and
- * possibly later models), overlay was set on reset, but cleared on the
- * first access to the ROM. */
-
+ /* Early Mac models had VIA A4 control overlaying. In the Mac SE and
+ * later models, overlay was set on reset, but cleared on the first
+ * access to the ROM's normal address space. */
if (((data & 0x10) >> 4) != m_overlay)
{
m_overlay = (data & 0x10) >> 4;
}
}
+void mac128_state::mac_via_out_a_se(uint8_t data)
+{
+// printf("%s VIA OUT A: %02x (PC %x)\n", machine().describe_context().c_str(), data);
+
+ //set_scc_waitrequest((data & 0x80) >> 7);
+ m_screen_buffer = (data & 0x40) >> 6;
+ sony_set_sel_line(m_iwm, (data & 0x20) >> 5);
+
+ m_snd_vol = data & 0x07;
+ update_volume();
+
+ if (m_model == MODEL_MAC_SE) // on SE only this selects which floppy drive (0 = upper, 1 = lower)
+ {
+ m_drive_select = ((data & 0x10) >> 4);
+ }
+}
+
void mac128_state::mac_via_out_b(uint8_t data)
{
// printf("%s VIA1 OUT B: %02x\n", machine().describe_context().c_str(), data);
@@ -737,6 +827,22 @@ void mac128_state::mac_via_out_b(uint8_t data)
m_rtc->clk_w((data >> 1) & 0x01);
}
+void mac128_state::mac_via_out_b_se(uint8_t data)
+{
+// printf("%s VIA OUT B: %02x\n", machine().describe_context().c_str(), data);
+
+ m_snd_enable = ((data & 0x80) == 0) ? true : false;
+ update_volume();
+
+ m_scsiirq_enable = (data & 0x40) ? 0 : 1;
+
+ m_macadb->mac_adb_newaction((data & 0x30) >> 4);
+
+ m_rtc->ce_w((data & 0x04)>>2);
+ m_rtc->data_w(data & 0x01);
+ m_rtc->clk_w((data >> 1) & 0x01);
+}
+
/* *************************************************************************
* Mouse
* *************************************************************************/
@@ -823,14 +929,6 @@ void mac128_state::mac_driver_init(mac128model_t model)
{
m_scsi_interrupt = 0;
m_model = model;
-#if 0
- /* set up RAM mirror at 0x600000-0x6fffff (0x7fffff ???) */
- mac_install_memory(0x600000, 0x6fffff, m_ram->size(), m_ram->pointer(), FALSE, "bank2");
-
- /* set up ROM at 0x400000-0x4fffff (-0x5fffff for mac 128k/512k/512ke) */
- mac_install_memory(0x400000, (model >= MODEL_MAC_PLUS) ? 0x4fffff : 0x5fffff,
- memregion("bootrom")->bytes(), memregion("bootrom")->base(), TRUE, "bank3");
-#endif
memset(m_ram->pointer(), 0, m_ram->size());
}
@@ -874,6 +972,8 @@ void mac128_state::init_##label() \
MAC_DRIVER_INIT(mac128k512k, MODEL_MAC_128K512K)
MAC_DRIVER_INIT(mac512ke, MODEL_MAC_512KE)
MAC_DRIVER_INIT(macplus, MODEL_MAC_PLUS)
+MAC_DRIVER_INIT(macse, MODEL_MAC_SE)
+MAC_DRIVER_INIT(macclassic, MODEL_MAC_CLASSIC)
/***************************************************************************
ADDRESS MAPS
@@ -903,6 +1003,18 @@ void mac128_state::macplus_map(address_map &map)
map(0xfffff0, 0xffffff).rw(FUNC(mac128_state::mac_autovector_r), FUNC(mac128_state::mac_autovector_w));
}
+void mac128_state::macse_map(address_map &map)
+{
+ map(0x000000, 0x3fffff).rw(FUNC(mac128_state::ram_r), FUNC(mac128_state::ram_w_se));
+ map(0x400000, 0x4fffff).rom().region("bootrom", 0);
+ map(0x580000, 0x5fffff).rw(FUNC(mac128_state::macplus_scsi_r), FUNC(mac128_state::macplus_scsi_w));
+ map(0x900000, 0x9fffff).r(m_scc, FUNC(z80scc_device::dc_ab_r)).umask16(0xff00);
+ map(0xb00000, 0xbfffff).w(m_scc, FUNC(z80scc_device::dc_ab_w)).umask16(0x00ff);
+ map(0xd00000, 0xdfffff).rw(FUNC(mac128_state::mac_iwm_r), FUNC(mac128_state::mac_iwm_w));
+ map(0xe80000, 0xefffff).rw(FUNC(mac128_state::mac_via_r), FUNC(mac128_state::mac_via_w));
+ map(0xfffff0, 0xffffff).rw(FUNC(mac128_state::mac_autovector_r), FUNC(mac128_state::mac_autovector_w));
+}
+
/***************************************************************************
DEVICE CONFIG
***************************************************************************/
@@ -994,7 +1106,6 @@ void mac128_state::mac128k(machine_config &config)
m_ram->set_default_size("128K");
}
-
void mac128_state::macplus(machine_config &config)
{
mac512ke(config);
@@ -1015,6 +1126,45 @@ void mac128_state::macplus(machine_config &config)
m_ram->set_extra_options("1M,2M,2560K,4M");
}
+static void mac_sepds_cards(device_slot_interface &device)
+{
+ device.option_add("radiusfpd", PDS_SEDISPLAY); // Radius Full Page Display card for SE
+}
+
+void mac128_state::macse(machine_config &config)
+{
+ macplus(config);
+ m_maincpu->set_addrmap(AS_PROGRAM, &mac128_state::macse_map);
+
+ config.device_remove("kbd");
+ config.device_remove("pds");
+
+ MACADB(config, m_macadb, C7M);
+ m_macadb->via_clock_callback().set(m_via, FUNC(via6522_device::write_cb1));
+ m_macadb->via_data_callback().set(m_via, FUNC(via6522_device::write_cb2));
+ m_macadb->adb_irq_callback().set(FUNC(mac128_state::adb_irq_w));
+
+ m_via->readpb_handler().set(FUNC(mac128_state::mac_via_in_b_se));
+ m_via->writepa_handler().set(FUNC(mac128_state::mac_via_out_a_se));
+ m_via->writepb_handler().set(FUNC(mac128_state::mac_via_out_b_se));
+ m_via->cb2_handler().set(m_macadb, FUNC(macadb_device::adb_data_w));
+
+ /* internal ram */
+ m_ram->set_default_size("4M");
+ m_ram->set_extra_options("2M,2560K,4M");
+
+ MACPDS(config, "sepds", "maincpu");
+ MACPDS_SLOT(config, "pds", "sepds", mac_sepds_cards, nullptr);
+}
+
+void mac128_state::macclasc(machine_config &config)
+{
+ macse(config);
+
+ config.device_remove("pds");
+ config.device_remove("sepds");
+}
+
static INPUT_PORTS_START( macplus )
PORT_START("MOUSE0") /* Mouse - button */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1)
@@ -1026,6 +1176,9 @@ static INPUT_PORTS_START( macplus )
PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
INPUT_PORTS_END
+static INPUT_PORTS_START( macadb )
+INPUT_PORTS_END
+
/***************************************************************************
Machine driver(s)
@@ -1192,6 +1345,22 @@ ROM_START( macplus ) // same notes as above apply here as well
ROMX_LOAD( "rominator-20150225-hi.bin", 0x000000, 0x080000, CRC(a28ba8ec) SHA1(9ddcf500727955c60db0ff24b5ca2458f53fd89a), ROM_SKIP(1) | ROM_BIOS(4) )
ROM_END
+ROM_START( macse )
+ ROM_REGION16_BE(0x100000, "bootrom", 0)
+ ROM_LOAD16_WORD( "macse.rom", 0x00000, 0x40000, CRC(0f7ff80c) SHA1(58532b7d0d49659fd5228ac334a1b094f0241968))
+ROM_END
+
+ROM_START( macsefd )
+ ROM_REGION16_BE(0x100000, "bootrom", 0)
+ ROM_LOAD( "be06e171.rom", 0x000000, 0x040000, CRC(f530cb10) SHA1(d3670a90273d12e53d86d1228c068cb660b8c9d1) )
+ROM_END
+
+ROM_START( macclasc )
+ ROM_REGION16_BE(0x100000, "bootrom", 0) // a49f9914, second half of chip dump is the 6.0.3 XO rom disk
+ // this dump is big endian
+ ROM_LOAD( "341-0813__=c=1983-90_apple__japan__910d_d.27c4096_be.ue1", 0x000000, 0x080000, CRC(510d7d38) SHA1(ccd10904ddc0fb6a1d216b2e9effd5ec6cf5a83d) )
+ROM_END
+
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */
//COMP( 1983, mactw, 0, 0, mac128k, macplus, mac128_state, init_mac128k512k, "Apple Computer", "Macintosh (4.3T Prototype)", MACHINE_NOT_WORKING )
COMP( 1984, mac128k, 0, 0, mac128k, macplus, mac128_state, init_mac128k512k, "Apple Computer", "Macintosh 128k", MACHINE_NOT_WORKING )
@@ -1200,3 +1369,6 @@ COMP( 1986, mac512ke, macplus, 0, mac512ke, macplus, mac128_state, init_mac
COMP( 1985, unitron, macplus, 0, mac512ke, macplus, mac128_state, init_mac512ke, "bootleg (Unitron)", "Mac 512", MACHINE_NOT_WORKING )
COMP( 1986, macplus, 0, 0, macplus, macplus, mac128_state, init_macplus, "Apple Computer", "Macintosh Plus", MACHINE_NOT_WORKING )
COMP( 1985, utrn1024, macplus, 0, macplus, macplus, mac128_state, init_macplus, "bootleg (Unitron)", "Unitron 1024", MACHINE_NOT_WORKING )
+COMP( 1987, macse, 0, 0, macse, macadb, mac128_state, init_macse, "Apple Computer", "Macintosh SE", MACHINE_NOT_WORKING )
+COMP( 1987, macsefd, 0, 0, macse, macadb, mac128_state, init_macse, "Apple Computer", "Macintosh SE (FDHD)", MACHINE_NOT_WORKING )
+COMP( 1990, macclasc, 0, 0, macclasc, macadb, mac128_state, init_macclassic, "Apple Computer", "Macintosh Classic", MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/majorpkr.cpp b/src/mame/drivers/majorpkr.cpp
index ebdab3e6aba..6eb75578519 100644
--- a/src/mame/drivers/majorpkr.cpp
+++ b/src/mame/drivers/majorpkr.cpp
@@ -841,7 +841,7 @@ static INPUT_PORTS_START( majorpkr )
PORT_BIT( 0xfd, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START("IN1")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_POKER_BET )
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_GAMBLE_BET )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_DEAL )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_GAMBLE_D_UP )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_GAMBLE_TAKE )
diff --git a/src/mame/drivers/megaplay.cpp b/src/mame/drivers/megaplay.cpp
index 6b2f775f50c..8b0f4011e38 100644
--- a/src/mame/drivers/megaplay.cpp
+++ b/src/mame/drivers/megaplay.cpp
@@ -241,7 +241,6 @@ static INPUT_PORTS_START ( mp_gaxe2 )
// PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_NAME("0x6201 bit 7") PORT_CODE(KEYCODE_K)
INPUT_PORTS_END
-#ifdef UNUSED_DEFINITION
static INPUT_PORTS_START ( mp_col3 )
PORT_INCLUDE( megaplay )
@@ -263,7 +262,6 @@ static INPUT_PORTS_START ( mp_col3 )
// PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_NAME("0x6201 bit 6") PORT_CODE(KEYCODE_J)
// PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_NAME("0x6201 bit 7") PORT_CODE(KEYCODE_K)
INPUT_PORTS_END
-#endif
static INPUT_PORTS_START ( mp_twc )
PORT_INCLUDE( megaplay )
@@ -1030,4 +1028,4 @@ didn't have original Sega part numbers it's probably a converted TWC cart
/* 10 */ GAME( 1993, mp_gunhe, megaplay, megaplay, mp_gunhe, mplay_state, init_megaplay, ROT0, "Sega", "Gunstar Heroes (Mega Play)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS )
/* 11 */ GAME( 1993, mp_mazin, megaplay, megaplay, mp_mazin, mplay_state, init_megaplay, ROT0, "Sega", "Mazin Wars / Mazin Saga (Mega Play)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS )
-/* ?? */ GAME( 1993, mp_col3, megaplay, megaplay, megaplay, mplay_state, init_megaplay, ROT0, "Sega", "Columns III (Mega Play)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS )
+/* ?? */ GAME( 1993, mp_col3, megaplay, megaplay, mp_col3, mplay_state, init_megaplay, ROT0, "Sega", "Columns III (Mega Play)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS )
diff --git a/src/mame/drivers/microdar.cpp b/src/mame/drivers/microdar.cpp
index 0ecd8944118..9cdd5c8f2fa 100644
--- a/src/mame/drivers/microdar.cpp
+++ b/src/mame/drivers/microdar.cpp
@@ -70,6 +70,7 @@ ________________________________________________________________________________
| YES | Far West | Compumatic | Standard Microdar SPD with Philips REF34VA | Electromechanical shooting |
| YES | Unknown | Compumatic | Compumatic ProSPDP-V3 PCB (Philips REF34VA + REF0096 + REF8032) | Darts |
| YES | Diana Olakoa| Compumatic/Olaoka| Compumatic Microdard-V5 PCB (REF0034 + REF0032 + REF0096) | Darts |
+| NO | Champion | Unknown | ProSPDP PCB. https://www.recreativas.org/champion-6137-compumatic | Darts |
|_______|_____________|__________________|_____________________________________________________________________|____________________________|
There's a later revision of the Compumatic Microdar, smaller, with a standard Atmel AT89S51 instead of the REF34 CPU.
diff --git a/src/mame/drivers/milton6805.cpp b/src/mame/drivers/milton6805.cpp
index 3142c3c6493..efda2a0886d 100644
--- a/src/mame/drivers/milton6805.cpp
+++ b/src/mame/drivers/milton6805.cpp
@@ -90,7 +90,7 @@ public:
protected:
virtual void device_start() override;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
sound_stream *m_stream;
@@ -108,11 +108,11 @@ milton_filter_device::milton_filter_device(const machine_config &mconfig, const
void milton_filter_device::device_start()
{
- m_stream = stream_alloc(1, 1, machine().sample_rate());
+ m_stream = stream_alloc_legacy(1, 1, machine().sample_rate());
m_led_out.resolve();
}
-void milton_filter_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void milton_filter_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
int level = 0;
diff --git a/src/mame/drivers/mpu4vid.cpp b/src/mame/drivers/mpu4vid.cpp
index 6e9a4ddbb33..84cac95b732 100644
--- a/src/mame/drivers/mpu4vid.cpp
+++ b/src/mame/drivers/mpu4vid.cpp
@@ -1161,8 +1161,8 @@ static INPUT_PORTS_START( v4vgpok )
PORT_INCLUDE( bwbvid )
PORT_MODIFY("BLACK1")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start / Deal / Draw")
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_POKER_BET ) // Stake
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_GAMBLE_DEAL ) PORT_NAME("Start / Deal / Draw")
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_BET ) // Stake
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT ) // Collect
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_GAMBLE_LOW )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_GAMBLE_HIGH )
diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp
index 1bcf3979586..d434971fdf6 100644
--- a/src/mame/drivers/naomi.cpp
+++ b/src/mame/drivers/naomi.cpp
@@ -637,6 +637,9 @@ Samba de Amigo Ver. 2000 840-0047C 23600 11 (128Mb) 3
Star Horse (main screens) 840-0054C 23625 4 (128Mb) 315-6319 315-6213 not present present requires 837-13785 ARCNET&IO BD
Star Horse (satellite) 840-0056C 23627 6 (128Mb)* 315-6319 315-6213 not present present * +1 (64Mb), requires 837-13785 ARCNET&IO BD
Star Horse 2001 (satellite, Rev B) 840-0078B 23739B 7 (128Mb) 315-6319A 315-6213 not present present requires 837-13785 ARCNET&IO BD
+Star Horse 2002 (main screens) 840-0102B 23851 6 (128Mb) 315-6319A 315-6213 not present present requires 837-13785 ARCNET&IO BD
+Star Horse 2002 (sound and backup, Rev A) 840-0103B 23866A 5 (128Mb) 315-6319A 315-6213 not present present requires 837-13785 ARCNET&IO BD
+Star Horse 2002 (live) 840-0104B 23867 9 (128Mb) 315-6319A 315-6213 not present present requires 837-13785 ARCNET&IO BD
Star Horse Progress (main screen, Rev B) 840-0120B 24087B 6 (128Mb) 315-6319A 315-6213 not present not present requires 837-13785 ARCNET&IO BD
Star Horse Progress (sound & backup, Rev A) 840-0121B 24097A 6 (128Mb) 315-6319A 315-6213 not present not present requires 837-13785 ARCNET&IO BD
Star Horse Progress (live, Rev A) 840-0122B 24107A 11 (128Mb) 315-6319A 315-6213 not present not present requires 837-13785 ARCNET&IO BD
@@ -701,6 +704,7 @@ Melty Blood Actress Again Version A (Rev A) 841-0061C 24455 6
/Mushiking The King Of Beetles
\Mushiking II / III / III+ (Ver. 2.001) (World) 840-0164C 24357 2 (512Mb) present 317-0437-COM present IC4# is marked "18"
/Mushiking The King Of Beetles
+Mushiking The King Of Beetles 2006 First (Japan) 840-0167C not present 2 (512Mb) present 317-0444-JPN present requires 610-0669 barcode reader
\Mushiking IV / V / VI (World) 840-0180C not present 2 (512Mb) present 317-0437-COM present IC2# is labeled "VER.1", IC4# is marked "8A", requires 610-0669 barcode reader, 838-14245-92 "MAPLE/232C CONVERT BD" (MIE-based), 838-14243 "RFID CHIP R/W BD" and RFID chip
Pokasuka Ghost! 840-0170C not present 5 (512Mb) present 317-0461-COM present requires 837-14672 sensor board (SH4 based)
Radirgy Noa 841-0062C not present 4 (512Mb) present 317-5138-JPN present IC2# is labeled "VER.2" - IC4# is marked "8A"
@@ -7996,7 +8000,77 @@ ROM_START( shors2k1 )
ROM_END
-/***** Star Horse 2002 *****/
+/***** Star Horse 2002 Japan *****/
+// currently we have dumped Main Screens, Sound & Backup and Live units ROM boards, others missing.
+
+// Main Screens
+// ROM board ID# 840-0102
+ROM_START( shors2k2m )
+ NAOMI_BIOS
+ NAOMI_DEFAULT_EEPROM
+
+ ROM_REGION( 0x6800000, "rom_board", ROMREGION_ERASEFF)
+ ROM_LOAD("epr-23851.ic22", 0x00000000, 0x00400000, CRC(23dbad62) SHA1(4d7763ba3bd362bb2d52358ea10a851a74d337d5) )
+ ROM_LOAD("mpr-23852.ic1", 0x00800000, 0x01000000, CRC(b289b968) SHA1(bddd7fadeeae02998d425a77fba52837d782f207) )
+ ROM_LOAD("mpr-23853.ic2", 0x01800000, 0x01000000, CRC(ef43b551) SHA1(0f34d89eae3162321c4e74742ca53ef1a046135c) )
+ ROM_LOAD("mpr-23854.ic3", 0x02800000, 0x01000000, CRC(1bb65979) SHA1(0247e1d9e00967801dcbbb5ddc343cebbe731e02) )
+ ROM_LOAD("mpr-23855.ic4", 0x03800000, 0x01000000, CRC(04b725d8) SHA1(e0db7a1e165b57198edd7af3eaeb07cfe808ed16) )
+ ROM_LOAD("mpr-23856.ic5", 0x04800000, 0x01000000, CRC(8ef1691e) SHA1(99c1778799bf52d00b7864794c19b90f348e46d3) )
+ ROM_LOAD("mpr-23857.ic6", 0x05800000, 0x01000000, CRC(b2900844) SHA1(47ba8f9823fa3872963358c06dd7ff84cfba437e) )
+
+ ROM_REGION(0x84, "some_eeprom", 0)
+ ROM_LOAD( "sflash.ic46", 0x000000, 0x000084, CRC(405120b8) SHA1(dd85c5a849b6537c0b8b5f1d546070aa072001fe) )
+
+ ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated
+ROM_END
+
+// Sound & Backup
+// ROM board ID# 840-0103 REV.A
+// apparently this unit also had one more ROM board, flash ROM based 840-0034 or similar.
+ROM_START( shors2k2s )
+ NAOMI_BIOS
+ NAOMI_DEFAULT_EEPROM
+
+ ROM_REGION( 0x5800000, "rom_board", ROMREGION_ERASEFF)
+ ROM_LOAD("epr-23866a.ic22", 0x00000000, 0x00400000, CRC(abf21b86) SHA1(bc7cc48dcd8bd964d8ad90cc4a88e9ca518a128d) )
+ ROM_LOAD("mpr-23888.ic1", 0x00800000, 0x01000000, CRC(c55b45be) SHA1(3dd42a8e21323026742ae764f0a22d96475b55e0) )
+ ROM_LOAD("mpr-23889.ic2", 0x01800000, 0x01000000, CRC(e3f0f02e) SHA1(66bcbc251b43688bdc0000a1a9fd463d01ee4e04) )
+ ROM_LOAD("mpr-23890.ic3", 0x02800000, 0x01000000, CRC(187eca4e) SHA1(0e0f9fe7a8a3b0ec4c36e3c42fe3c2c7b6c98dc0) )
+ ROM_LOAD("mpr-23891.ic4", 0x03800000, 0x01000000, CRC(24783524) SHA1(9338acd2194ee546d25cb553458eefe7f9d8f806) )
+ ROM_LOAD("mpr-23892.ic5", 0x04800000, 0x01000000, CRC(c8785077) SHA1(874abec35bfcb4f2b7cded85aea717d1ff21dabf) )
+
+ ROM_REGION(0x84, "some_eeprom", 0)
+ ROM_LOAD( "sflash.ic46", 0x000000, 0x000084, CRC(7acf38e5) SHA1(6abed02500be2e2405ffe7ae39db29c9c030a344) )
+
+ ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated
+ROM_END
+
+// Live
+// ROM board ID# 840-0104
+ROM_START( shors2k2l )
+ NAOMI_BIOS
+ NAOMI_DEFAULT_EEPROM
+
+ ROM_REGION( 0x9800000, "rom_board", ROMREGION_ERASEFF)
+ ROM_LOAD("epr-23867.ic22", 0x00000000, 0x00400000, CRC(25fbbf6e) SHA1(bac0681206ac5b2b192e6015905768d30d97692f) )
+ ROM_LOAD("mpr-23894.ic1", 0x00800000, 0x01000000, CRC(fb87d357) SHA1(8e0f08d5836033d5242e0b2fbc69b893c1ede1d3) )
+ ROM_LOAD("mpr-23895.ic2", 0x01800000, 0x01000000, CRC(519743f5) SHA1(949456136345c73a6ec11dd870c79d3fd3c93c24) )
+ ROM_LOAD("mpr-23896.ic3", 0x02800000, 0x01000000, CRC(b0c597f5) SHA1(91a0c3cd2ebb7e63a734f2dfefa055278f6159dc) )
+ ROM_LOAD("mpr-23897.ic4", 0x03800000, 0x01000000, CRC(8e7a4d58) SHA1(ebf2e578243fbe5782a86f2ec921ab68796547d8) )
+ ROM_LOAD("mpr-23898.ic5", 0x04800000, 0x01000000, CRC(c9bb098b) SHA1(40819ac411debd10c36422bd873b693e0e9fe460) )
+ ROM_LOAD("mpr-23899.ic6", 0x05800000, 0x01000000, CRC(99a3f8c4) SHA1(d31bdc446384765370d4d5196f4aa2d6a4b9e913) )
+ ROM_LOAD("mpr-23900.ic7", 0x06800000, 0x01000000, CRC(e4b3a767) SHA1(cea912e33a6bb6235498cbe0b2a78e537cf6145e) )
+ ROM_LOAD("mpr-23901.ic8", 0x07800000, 0x01000000, CRC(d05001ce) SHA1(b1fbfeb9039ffe5adb74e73385919bac5be64fc3) )
+ ROM_LOAD("mpr-23902.ic9", 0x08800000, 0x01000000, CRC(48eb5457) SHA1(ab28d63c53dbf8f0c091fb7af97308b2c5bd30ae) )
+
+ ROM_REGION(0x84, "some_eeprom", 0)
+ ROM_LOAD( "sflash.ic46", 0x000000, 0x000084, CRC(77ef2b0b) SHA1(f41248af2e27b63074619879fc460dd0143e6215) )
+
+ ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated
+ROM_END
+
+
+/***** Star Horse 2002 Taiwan *****/
// currently we have only Sound unit ROM board dumped, the rest is missing.
// ID# 837-14351
// ROM board ID# 840-0112B
@@ -11465,6 +11539,9 @@ ROM_END
/* 0088 */ GAME( 2001, drbyocwc, derbyocw, naomim2, naomi, naomi_state, init_naomi, ROT0, "Sega", "Derby Owners Club World Edition (Rev C)", GAME_FLAGS )
/* 0088 */ GAME( 2005, derbyocw, naomi, naomim2, naomi, naomi_state, init_naomi, ROT0, "Sega", "Derby Owners Club World Edition EX (Rev D)", GAME_FLAGS )
/* 0098 */ GAME( 2002, shootopl, naomi, naomim1, naomi, naomi_state, init_naomi, ROT0, "Sega", "Shootout Pool", GAME_FLAGS )
+/* 0102 */ GAME( 2002, shors2k2m, naomi, naomim2, naomi, naomi_state, init_naomi, ROT0, "Sega", "Star Horse 2002 (main screens)", GAME_FLAGS )
+/* 0103 */ GAME( 2002, shors2k2s, naomi, naomim2, naomi, naomi_state, init_naomi, ROT0, "Sega", "Star Horse 2002 (sound and backup, Rev A)", GAME_FLAGS )
+/* 0104 */ GAME( 2002, shors2k2l, naomi, naomim2, naomi, naomi_state, init_naomi, ROT0, "Sega", "Star Horse 2002 (live)", GAME_FLAGS )
/* 0112 */ GAME( 2002, shors2k2, naomi, naomim1, naomi, naomi_state, init_naomi, ROT0, "Sega", "Star Horse 2002 (sound, Export/Taiwan)", GAME_FLAGS )
/* 0120 */ GAME( 2003, shorsepm, shorsep, naomim2, naomi, naomi_state, init_naomi, ROT0, "Sega", "Star Horse Progress (main screens, Rev B)", GAME_FLAGS )
/* 0121 */ GAME( 2003, shorseps, shorsep, naomim2, naomi, naomi_state, init_naomi, ROT0, "Sega", "Star Horse Progress (sound & backup, Rev A)", GAME_FLAGS )
diff --git a/src/mame/drivers/news_38xx.cpp b/src/mame/drivers/news_38xx.cpp
index 6afc4e5adc9..cf4868a30dc 100644
--- a/src/mame/drivers/news_38xx.cpp
+++ b/src/mame/drivers/news_38xx.cpp
@@ -395,7 +395,8 @@ void news_38xx_state::common(machine_config &config)
cxd1180_device &adapter = downcast<cxd1180_device &>(*device);
adapter.irq_handler().set(*this, FUNC(news_38xx_state::irq_w<SCSI0>));
- adapter.drq_handler().set(m_dma[0], FUNC(dmac_0266_device::drq_w));
+ adapter.irq_handler().append(m_dma[0], FUNC(dmac_0266_device::eop_w));
+ adapter.drq_handler().set(m_dma[0], FUNC(dmac_0266_device::req_w));
//subdevice<dmac_0266_device>(":dma0")->out_eop_cb().set(adapter, FUNC(cxd1180_device::eop_w));
subdevice<dmac_0266_device>(":dma0")->dma_r_cb().set(adapter, FUNC(cxd1180_device::dma_r));
@@ -419,7 +420,8 @@ void news_38xx_state::common(machine_config &config)
cxd1180_device &adapter = downcast<cxd1180_device &>(*device);
adapter.irq_handler().set(*this, FUNC(news_38xx_state::irq_w<SCSI1>));
- adapter.drq_handler().set(m_dma[1], FUNC(dmac_0266_device::drq_w));
+ adapter.irq_handler().append(m_dma[1], FUNC(dmac_0266_device::eop_w));
+ adapter.drq_handler().set(m_dma[1], FUNC(dmac_0266_device::req_w));
//subdevice<dmac_0266_device>(":dma1")->out_eop_cb().set(adapter, FUNC(cxd1180_device::eop_w));
subdevice<dmac_0266_device>(":dma1")->dma_r_cb().set(adapter, FUNC(cxd1180_device::dma_r));
diff --git a/src/mame/drivers/news_68k.cpp b/src/mame/drivers/news_68k.cpp
index 8c6900ada66..961f9f2beea 100644
--- a/src/mame/drivers/news_68k.cpp
+++ b/src/mame/drivers/news_68k.cpp
@@ -336,7 +336,6 @@ void news_68k_state::common(machine_config &config)
DMAC_0266(config, m_dma, 0);
m_dma->set_bus(m_cpu, 0);
- m_dma->out_int_cb().set(*this, FUNC(news_68k_state::irq_w<SCSI>));
INPUT_MERGER_ANY_HIGH(config, m_irq5);
m_irq5->output_handler().set_inputline(m_cpu, INPUT_LINE_IRQ5);
@@ -402,8 +401,9 @@ void news_68k_state::common(machine_config &config)
{
cxd1180_device &adapter = downcast<cxd1180_device &>(*device);
- adapter.irq_handler().set(m_dma, FUNC(dmac_0266_device::irq_w));
- adapter.drq_handler().set(m_dma, FUNC(dmac_0266_device::drq_w));
+ adapter.irq_handler().set(*this, FUNC(news_68k_state::irq_w<SCSI>));
+ adapter.irq_handler().append(m_dma, FUNC(dmac_0266_device::eop_w));
+ adapter.drq_handler().set(m_dma, FUNC(dmac_0266_device::req_w));
subdevice<dmac_0266_device>(":dma")->dma_r_cb().set(adapter, FUNC(cxd1180_device::dma_r));
subdevice<dmac_0266_device>(":dma")->dma_w_cb().set(adapter, FUNC(cxd1180_device::dma_w));
diff --git a/src/mame/drivers/ninjaw.cpp b/src/mame/drivers/ninjaw.cpp
index 6045f8daf5e..3cff502baf7 100644
--- a/src/mame/drivers/ninjaw.cpp
+++ b/src/mame/drivers/ninjaw.cpp
@@ -618,7 +618,7 @@ protected:
virtual void device_start();
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples);
private:
// internal state
@@ -654,10 +654,10 @@ void subwoofer_device::device_start()
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void subwoofer_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void subwoofer_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
}
diff --git a/src/mame/drivers/norautp.cpp b/src/mame/drivers/norautp.cpp
index 740e867a6a7..53efbe3ead5 100644
--- a/src/mame/drivers/norautp.cpp
+++ b/src/mame/drivers/norautp.cpp
@@ -994,7 +994,7 @@ static INPUT_PORTS_START( norautp )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Deal / Draw")
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_NAME("Bet / Collect")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Bet / Collect")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) /* Coin A */
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) /* Coin B */
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_K) PORT_NAME("IN0-5")
@@ -1049,7 +1049,7 @@ static INPUT_PORTS_START( norautrh )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Deal / Draw")
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_NAME("Bet / Change Card")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Bet / Change Card")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) /* Coin A */
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) /* Coin B */
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Readout")
@@ -1103,7 +1103,7 @@ static INPUT_PORTS_START( norautpn )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Deal / Start")
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_NAME("Bet / Change Card")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Bet / Change Card")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) /* Coin A */
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) /* Coin B */
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Readout")
@@ -1212,7 +1212,7 @@ static INPUT_PORTS_START( cdrawpkr )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_NAME("Bet / Half Gamble")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Bet / Half Gamble")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN )
diff --git a/src/mame/drivers/p2000t.cpp b/src/mame/drivers/p2000t.cpp
index 6eebef3acd0..a473f49faba 100644
--- a/src/mame/drivers/p2000t.cpp
+++ b/src/mame/drivers/p2000t.cpp
@@ -139,7 +139,7 @@ static INPUT_PORTS_START (p2000t)
PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
PORT_START("KEY.3")
- PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
+ PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('<') PORT_CHAR('>')
PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
@@ -159,7 +159,7 @@ static INPUT_PORTS_START (p2000t)
PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
PORT_START("KEY.5")
- PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clrln") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F2))
+ PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clrln") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F2))
PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK))
PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD))
@@ -176,7 +176,7 @@ static INPUT_PORTS_START (p2000t)
PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
- PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \xE2\x86\x91") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('^')
+ PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \xE2\x86\x91") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('^')
PORT_START("KEY.7")
PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
@@ -245,6 +245,9 @@ void p2000t_state::p2000t(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
+
+ /* the mini cassette driver */
+ MDCR(config, m_mdcr, 0);
}
diff --git a/src/mame/drivers/pdp1.cpp b/src/mame/drivers/pdp1.cpp
index 72861de561b..a659ee9ed8f 100644
--- a/src/mame/drivers/pdp1.cpp
+++ b/src/mame/drivers/pdp1.cpp
@@ -382,29 +382,6 @@ or both IOT incompletely, or screw up completely. I insist that such an error c
by a pdp-1 programming error, even if there is no emulator error. */
#define LOG_IOT_OVERLAP 0
-static void pdp1_tape_read_binary(device_t *device);
-static void pdp1_io_sc_callback(device_t *device);
-
-static void iot_rpa(device_t *device, int op2, int nac, int mb, int *io, int ac);
-static void iot_rpb(device_t *device, int op2, int nac, int mb, int *io, int ac);
-static void iot_rrb(device_t *device, int op2, int nac, int mb, int *io, int ac);
-static void iot_ppa(device_t *device, int op2, int nac, int mb, int *io, int ac);
-static void iot_ppb(device_t *device, int op2, int nac, int mb, int *io, int ac);
-
-static void iot_tyo(device_t *device, int op2, int nac, int mb, int *io, int ac);
-static void iot_tyi(device_t *device, int op2, int nac, int mb, int *io, int ac);
-
-static void iot_dpy(device_t *device, int op2, int nac, int mb, int *io, int ac);
-
-static void iot_dia(device_t *device, int op2, int nac, int mb, int *io, int ac);
-static void iot_dba(device_t *device, int op2, int nac, int mb, int *io, int ac);
-static void iot_dcc(device_t *device, int op2, int nac, int mb, int *io, int ac);
-static void iot_dra(device_t *device, int op2, int nac, int mb, int *io, int ac);
-
-static void iot_011(device_t *device, int op2, int nac, int mb, int *io, int ac);
-
-static void iot_cks(device_t *device, int op2, int nac, int mb, int *io, int ac);
-
/*
devices which are known to generate a completion pulse (source: maintenance manual 9-??,
@@ -451,33 +428,6 @@ enum
static pdp1_reset_param_t pdp1_reset_param =
{
- { /* external iot handlers. NULL means that the iot is unimplemented, unless there are
- parentheses around the iot name, in which case the iot is internal to the cpu core. */
- /* I put a ? when the source is the handbook, since a) I have used the maintenance manual
- as the primary source (as it goes more into details) b) the handbook and the maintenance
- manual occasionnally contradict each other. */
- /* dia, dba, dcc, dra are documented in MIT PDP-1 COMPUTER MODIFICATION
- BULLETIN no. 2 (drumInstrWriteup.bin/drumInstrWriteup.txt), and are
- similar to IOT documented in Parallel Drum Type 23 Instruction Manual. */
- /* (iot) rpa rpb tyo tyi ppa ppb dpy */
- nullptr, iot_rpa, iot_rpb, iot_tyo, iot_tyi, iot_ppa, iot_ppb, iot_dpy,
- /* spacewar */
- nullptr, iot_011, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- /* lag glf?/jsp? gpl?/gpr?/gcf? */
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- /* rrb rcb? rcc? cks mcs mes mel */
- iot_rrb, nullptr, nullptr, iot_cks, nullptr, nullptr, nullptr, nullptr,
- /* cad? rac? rbc? pac lpr/lfb/lsp swc/sci/sdf?/shr? scv? */
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- /* (dsc) (asc) (isb) (cac) (lsm) (esm) (cbs) */
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- /* icv? dia dba dcc dra mri|rlc? mrf/inr?/ccr? */
- nullptr, iot_dia, iot_dba, iot_dcc, iot_dra, nullptr, nullptr, nullptr,
- /* mcb|dur? mwc|mtf? mrc|sfc?... msm|cgo? (eem/lem) mic muf */
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- },
- pdp1_tape_read_binary,
- pdp1_io_sc_callback,
0, /* extend mode support defined in input ports and pdp1_init_machine */
0, /* hardware multiply/divide support defined in input ports and pdp1_init_machine */
0 /* type 20 sequence break system support defined in input ports and pdp1_init_machine */
@@ -492,7 +442,7 @@ void pdp1_state::machine_reset()
pdp1_reset_param.type_20_sbs = (cfg >> pdp1_config_type_20_sbs_bit) & pdp1_config_type_20_sbs_mask;
/* reset device state */
- m_tape_reader.rcl = m_tape_reader.rc = 0;
+ m_tape_reader->m_rcl = m_tape_reader->m_rc = 0;
m_io_status = io_st_tyo | io_st_ptp;
m_lightpen.active = m_lightpen.down = 0;
m_lightpen.x = m_lightpen.y = 0;
@@ -505,7 +455,7 @@ void pdp1_state::pdp1_machine_stop()
{
/* the core will take care of freeing the timers, BUT we must set the variables
to NULL if we don't want to risk confusing the tape image init function */
- m_tape_reader.timer = m_tape_puncher.timer = m_typewriter.tyo_timer = m_dpy_timer = nullptr;
+ m_tape_reader->m_timer = m_tape_puncher->m_timer = m_typewriter->m_tyo_timer = m_dpy_timer = nullptr;
}
@@ -649,12 +599,7 @@ void pdp1_state::machine_start()
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&pdp1_state::pdp1_machine_stop,this));
- m_tape_reader.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::reader_callback),this));
- m_tape_puncher.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::puncher_callback),this));
- m_typewriter.tyo_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::tyo_callback),this));
m_dpy_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::dpy_callback),this));
- m_tape_reader.timer->adjust(attotime::zero, 0, attotime::from_hz(2500));
- m_tape_reader.timer->enable(0);
}
@@ -662,136 +607,85 @@ void pdp1_state::machine_start()
perforated tape handling
*/
-class pdp1_readtape_image_device : public device_t,
- public device_image_interface
-{
-public:
- // construction/destruction
- pdp1_readtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- // image-level overrides
- virtual iodevice_t image_type() const noexcept override { return IO_PUNCHTAPE; }
-
- virtual bool is_readable() const noexcept override { return true; }
- virtual bool is_writeable() const noexcept override { return false; }
- virtual bool is_creatable() const noexcept override { return false; }
- virtual bool must_be_loaded() const noexcept override { return false; }
- virtual bool is_reset_on_load() const noexcept override { return false; }
- virtual const char *file_extensions() const noexcept override { return "tap,rim"; }
-
- virtual image_init_result call_load() override;
- virtual void call_unload() override;
-
-protected:
- // device-level overrides
- virtual void device_start() override { }
-};
-
-DEFINE_DEVICE_TYPE(PDP1_READTAPE, pdp1_readtape_image_device, "pdp1_readtape_image", "PDP1 Tape Reader")
+DEFINE_DEVICE_TYPE(PDP1_READTAPE, pdp1_readtape_image_device, "pdp1_readtape_image", "PDP-1 Tape Reader")
pdp1_readtape_image_device::pdp1_readtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, PDP1_READTAPE, tag, owner, clock)
, device_image_interface(mconfig, *this)
+ , m_maincpu(*this, "^maincpu")
+ , m_st_ptr(*this)
{
}
-class pdp1_punchtape_image_device : public device_t,
- public device_image_interface
+void pdp1_readtape_image_device::device_resolve_objects()
{
-public:
- // construction/destruction
- pdp1_punchtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- // image-level overrides
- virtual iodevice_t image_type() const noexcept override { return IO_PUNCHTAPE; }
-
- virtual bool is_readable() const noexcept override { return false; }
- virtual bool is_writeable() const noexcept override { return true; }
- virtual bool is_creatable() const noexcept override { return true; }
- virtual bool must_be_loaded() const noexcept override { return false; }
- virtual bool is_reset_on_load() const noexcept override { return false; }
- virtual const char *file_extensions() const noexcept override { return "tap,rim"; }
-
- virtual image_init_result call_load() override;
- virtual void call_unload() override;
-
-protected:
- // device-level overrides
- virtual void device_start() override { }
-};
+ m_st_ptr.resolve_safe();
+}
+
+void pdp1_readtape_image_device::device_start()
+{
+ m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_readtape_image_device::reader_callback),this));
+ m_timer->adjust(attotime::zero, 0, attotime::from_hz(2500));
+ m_timer->enable(0);
+}
-DEFINE_DEVICE_TYPE(PDP1_PUNCHTAPE, pdp1_punchtape_image_device, "pdp1_punchtape_image_device", "PDP1 Tape Puncher")
+
+DEFINE_DEVICE_TYPE(PDP1_PUNCHTAPE, pdp1_punchtape_image_device, "pdp1_punchtape_image_device", "PDP-1 Tape Puncher")
pdp1_punchtape_image_device::pdp1_punchtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, PDP1_PUNCHTAPE, tag, owner, clock)
, device_image_interface(mconfig, *this)
+ , m_maincpu(*this, "^maincpu")
+ , m_st_ptp(*this)
{
}
+void pdp1_punchtape_image_device::device_resolve_objects()
+{
+ m_st_ptp.resolve_safe();
+}
-class pdp1_printer_image_device : public device_t,
- public device_image_interface
+void pdp1_punchtape_image_device::device_start()
{
-public:
- // construction/destruction
- pdp1_printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- // image-level overrides
- virtual iodevice_t image_type() const noexcept override { return IO_PRINTER; }
-
- virtual bool is_readable() const noexcept override { return false; }
- virtual bool is_writeable() const noexcept override { return true; }
- virtual bool is_creatable() const noexcept override { return true; }
- virtual bool must_be_loaded() const noexcept override { return false; }
- virtual bool is_reset_on_load() const noexcept override { return false; }
- virtual const char *file_extensions() const noexcept override { return "typ"; }
-
- virtual image_init_result call_load() override;
- virtual void call_unload() override;
-
-protected:
- // device-level overrides
- virtual void device_start() override { }
-};
+ m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_punchtape_image_device::puncher_callback),this));
+}
-DEFINE_DEVICE_TYPE(PDP1_PRINTER, pdp1_printer_image_device, "pdp1_printer_image", "PDP1 Typewriter")
-pdp1_printer_image_device::pdp1_printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, PDP1_PRINTER, tag, owner, clock)
+DEFINE_DEVICE_TYPE(PDP1_TYPEWRITER, pdp1_typewriter_device, "pdp1_typewriter_image", "PDP-1 Typewriter")
+
+pdp1_typewriter_device::pdp1_typewriter_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, PDP1_TYPEWRITER, tag, owner, clock)
, device_image_interface(mconfig, *this)
+ , m_maincpu(*this, "^maincpu")
+ , m_driver_state(*this, DEVICE_SELF_OWNER)
+ , m_twr(*this, "^TWR.%u", 0)
+ , m_st_tyo(*this)
+ , m_st_tyi(*this)
{
}
-class pdp1_cylinder_image_device : public device_t,
- public device_image_interface
+void pdp1_typewriter_device::device_resolve_objects()
{
-public:
- // construction/destruction
- pdp1_cylinder_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- // image-level overrides
- virtual iodevice_t image_type() const noexcept override { return IO_CYLINDER; }
-
- virtual bool is_readable() const noexcept override { return true; }
- virtual bool is_writeable() const noexcept override { return true; }
- virtual bool is_creatable() const noexcept override { return true; }
- virtual bool must_be_loaded() const noexcept override { return false; }
- virtual bool is_reset_on_load() const noexcept override { return false; }
- virtual const char *file_extensions() const noexcept override { return "drm"; }
-
- virtual image_init_result call_load() override;
- virtual void call_unload() override;
-
-protected:
- // device-level overrides
- virtual void device_start() override { }
-};
+ m_st_tyo.resolve_safe();
+ m_st_tyi.resolve_safe();
+}
+
+void pdp1_typewriter_device::device_start()
+{
+ m_tyo_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_typewriter_device::tyo_callback),this));
+}
+
-DEFINE_DEVICE_TYPE(PDP1_CYLINDER, pdp1_cylinder_image_device, "pdp1_cylinder_image", "PDP1 Cylinder")
+DEFINE_DEVICE_TYPE(PDP1_CYLINDER, pdp1_cylinder_image_device, "pdp1_cylinder_image", "PDP-1 Cylinder")
pdp1_cylinder_image_device::pdp1_cylinder_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, PDP1_CYLINDER, tag, owner, clock)
, device_image_interface(mconfig, *this)
+ , m_maincpu(*this, "^maincpu")
+{
+}
+
+void pdp1_cylinder_image_device::device_start()
{
}
@@ -800,28 +694,23 @@ pdp1_cylinder_image_device::pdp1_cylinder_image_device(const machine_config &mco
*/
image_init_result pdp1_readtape_image_device::call_load()
{
- pdp1_state *state = machine().driver_data<pdp1_state>();
-
- /* reader unit */
- state->m_tape_reader.fd = this;
-
- /* start motor */
- state->m_tape_reader.motor_on = 1;
+ // start motor
+ m_motor_on = 1;
/* restart reader IO when necessary */
/* note that this function may be called before pdp1_init_machine, therefore
- before state->m_tape_reader.timer is allocated. It does not matter, as the clutch is never
+ before m_timer is allocated. It does not matter, as the clutch is never
down at power-up, but we must not call timer_enable with a nullptr parameter! */
- if (state->m_tape_reader.timer)
+ if (m_timer)
{
- if (state->m_tape_reader.motor_on && state->m_tape_reader.rcl)
+ if (m_motor_on && m_rcl)
{
- state->m_tape_reader.timer->enable(1);
+ m_timer->enable(1);
}
else
{
- state->m_tape_reader.timer->enable(0);
+ m_timer->enable(0);
}
}
@@ -830,24 +719,19 @@ image_init_result pdp1_readtape_image_device::call_load()
void pdp1_readtape_image_device::call_unload()
{
- pdp1_state *state = machine().driver_data<pdp1_state>();
+ // stop motor
+ m_motor_on = 0;
- /* reader unit */
- state->m_tape_reader.fd = nullptr;
-
- /* stop motor */
- state->m_tape_reader.motor_on = 0;
-
- if (state->m_tape_reader.timer)
- state->m_tape_reader.timer->enable(0);
+ if (m_timer)
+ m_timer->enable(0);
}
/*
Read a byte from perforated tape
*/
-int pdp1_state::tape_read(uint8_t *reply)
+int pdp1_readtape_image_device::tape_read(uint8_t *reply)
{
- if (m_tape_reader.fd && (m_tape_reader.fd->fread(reply, 1) == 1))
+ if (is_loaded() && (fread(reply, 1) == 1))
return 0; /* unit OK */
else
return 1; /* unit not ready */
@@ -857,94 +741,83 @@ int pdp1_state::tape_read(uint8_t *reply)
/*
common code for tape read commands (RPA, RPB, and read-in mode)
*/
-void pdp1_state::begin_tape_read( int binary, int nac)
+void pdp1_readtape_image_device::begin_tape_read(int binary, int nac)
{
- m_tape_reader.rb = 0;
- m_tape_reader.rcl = 1;
- m_tape_reader.rc = (binary) ? 1 : 3;
- m_tape_reader.rby = (binary) ? 1 : 0;
- m_tape_reader.rcp = nac;
+ m_rb = 0;
+ m_rcl = 1;
+ m_rc = (binary) ? 1 : 3;
+ m_rby = (binary) ? 1 : 0;
+ m_rcp = nac;
if (LOG_IOT_OVERLAP)
{
- if (m_tape_reader.timer->enable(0))
+ if (m_timer->enable(0))
logerror("Error: overlapped perforated tape reads (Read-in mode, RPA/RPB instruction)\n");
}
/* set up delay if tape is advancing */
- if (m_tape_reader.motor_on && m_tape_reader.rcl)
+ if (m_motor_on && m_rcl)
{
/* delay is approximately 1/400s */
- m_tape_reader.timer->enable(1);
+ m_timer->enable(1);
}
else
{
- m_tape_reader.timer->enable(0);
+ m_timer->enable(0);
}
}
/*
timer callback to simulate reader IO
*/
-TIMER_CALLBACK_MEMBER(pdp1_state::reader_callback)
+TIMER_CALLBACK_MEMBER(pdp1_readtape_image_device::reader_callback)
{
- int not_ready;
- uint8_t data;
-
- if (m_tape_reader.rc)
+ if (m_rc)
{
- not_ready = tape_read(& data);
+ uint8_t data;
+ int not_ready = tape_read(&data);
if (not_ready)
{
- m_tape_reader.motor_on = 0; /* let us stop the motor */
+ m_motor_on = 0; // let us stop the motor
}
else
{
- if ((! m_tape_reader.rby) || (data & 0200))
+ if ((!m_rby) || (data & 0200))
{
- m_tape_reader.rb |= (m_tape_reader.rby) ? (data & 077) : data;
+ m_rb |= (m_rby) ? (data & 077) : data;
- if (m_tape_reader.rc != 3)
+ if (m_rc != 3)
{
- m_tape_reader.rb <<= 6;
+ m_rb <<= 6;
}
- m_tape_reader.rc = (m_tape_reader.rc+1) & 3;
+ m_rc = (m_rc+1) & 3;
- if (m_tape_reader.rc == 0)
- { /* IO complete */
- m_tape_reader.rcl = 0;
- if (m_tape_reader.rcp)
+ if (m_rc == 0)
+ { // IO complete
+ m_rcl = 0;
+ if (m_rcp)
{
- m_maincpu->set_state_int(PDP1_IO, m_tape_reader.rb); /* transfer reader buffer to IO */
+ m_maincpu->set_state_int(PDP1_IO, m_rb); // transfer reader buffer to IO
m_maincpu->set_state_int(PDP1_IOS,1);
}
else
- m_io_status |= io_st_ptr;
+ m_st_ptr(1);
}
}
}
}
- if (m_tape_reader.motor_on && m_tape_reader.rcl)
+ if (m_motor_on && m_rcl)
{
- m_tape_reader.timer->enable(1);
+ m_timer->enable(1);
}
else
{
- m_tape_reader.timer->enable(0);
+ m_timer->enable(0);
}
}
/*
- Initiate read of a 18-bit word in binary format from tape (used in read-in mode)
-*/
-void pdp1_tape_read_binary(device_t *device)
-{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
- state->begin_tape_read(1, 1);
-}
-
-/*
perforated tape reader iot callbacks
*/
@@ -971,13 +844,12 @@ void pdp1_tape_read_binary(device_t *device)
* IO Bits 10 11 12 13 14 15 16 17
* TAPE CHANNELS 8 7 6 5 4 3 2 1
*/
-static void iot_rpa(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_readtape_image_device::iot_rpa(int op2, int nac, int mb, int &io, int ac)
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
if (LOG_IOT_EXTRA)
- device->logerror("Warning, RPA instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context());
+ logerror("Warning, RPA instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, machine().describe_context());
- state->begin_tape_read(0, nac);
+ begin_tape_read(0, nac);
}
/*
@@ -1008,64 +880,55 @@ static void iot_rpa(device_t *device, int op2, int nac, int mb, int *io, int ac)
* to the IO Register, Status Register Bit 1 is set to one. If bits 5 and 6 are
* different (730002 or 724002) the 18-bit word read from tape is automatically
* transferred to the IO Register via the Reader Buffer.
+ *
+ * The rpb command pulse is also asserted for each word transfer in read-in mode.
*/
-static void iot_rpb(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_readtape_image_device::iot_rpb(int op2, int nac, int mb, int &io, int ac)
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
if (LOG_IOT_EXTRA)
- device->logerror("Warning, RPB instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context());
+ logerror("Warning, RPB instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, machine().describe_context());
- state->begin_tape_read(1, nac);
+ begin_tape_read(1, nac);
}
/*
rrb iot callback
*/
-static void iot_rrb(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_readtape_image_device::iot_rrb(int op2, int nac, int mb, int &io, int ac)
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
if (LOG_IOT_EXTRA)
- device->logerror("RRB instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context());
+ logerror("RRB instruction: mb=0%06o, (%s)\n", (unsigned) mb, machine().describe_context());
- *io = state->m_tape_reader.rb;
- state->m_io_status &= ~io_st_ptr;
+ io = m_rb;
+ m_st_ptr(0);
}
image_init_result pdp1_punchtape_image_device::call_load()
{
- pdp1_state *state = machine().driver_data<pdp1_state>();
-
- /* punch unit */
- state->m_tape_puncher.fd = this;
-
return image_init_result::PASS;
}
void pdp1_punchtape_image_device::call_unload()
{
- pdp1_state *state = machine().driver_data<pdp1_state>();
-
- /* punch unit */
- state->m_tape_puncher.fd = nullptr;
}
/*
Write a byte to perforated tape
*/
-void pdp1_state::tape_write(uint8_t data)
+void pdp1_punchtape_image_device::tape_write(uint8_t data)
{
- if (m_tape_puncher.fd)
- m_tape_puncher.fd->fwrite(& data, 1);
+ if (is_loaded())
+ fwrite(&data, 1);
}
/*
timer callback to generate punch completion pulse
*/
-TIMER_CALLBACK_MEMBER(pdp1_state::puncher_callback)
+TIMER_CALLBACK_MEMBER(pdp1_punchtape_image_device::puncher_callback)
{
int nac = param;
- m_io_status |= io_st_ptp;
+ m_st_ptp(1);
if (nac)
{
m_maincpu->set_state_int(PDP1_IOS,1);
@@ -1086,22 +949,21 @@ TIMER_CALLBACK_MEMBER(pdp1_state::puncher_callback)
* For each In-Out Transfer instruction one line of tape is punched. In-Out Register
* Bit 17 conditions Hole 1. Bit 16 conditions Hole 2, etc. Bit 10 conditions Hole 8
*/
-static void iot_ppa(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_punchtape_image_device::iot_ppa(int op2, int nac, int mb, int &io, int ac)
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
if (LOG_IOT_EXTRA)
- device->logerror("PPA instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context());
+ logerror("PPA instruction: mb=0%06o, (%s)\n", (unsigned) mb, machine().describe_context());
- state->tape_write(*io & 0377);
- state->m_io_status &= ~io_st_ptp;
- /* delay is approximately 1/63.3 second */
+ tape_write(io & 0377);
+ m_st_ptp(0);
+ // delay is approximately 1/63.3 second
if (LOG_IOT_OVERLAP)
{
- if (state->m_tape_puncher.timer->enable(0))
- device->logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context());
+ if (m_timer->enable(0))
+ logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, (%s)\n", (unsigned) mb, machine().describe_context());
}
- state->m_tape_puncher.timer->adjust(attotime::from_usec(15800), nac);
+ m_timer->adjust(attotime::from_usec(15800), nac);
}
/*
@@ -1115,21 +977,20 @@ static void iot_ppa(device_t *device, int op2, int nac, int mb, int *io, int ac)
* Bit 5 conditions Hole 1. Bit 4 conditions Hole 2, etc. Bit 0 conditions Hole 6.
* Hole 7 is left blank. Hole 8 is always punched in this mode.
*/
-static void iot_ppb(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_punchtape_image_device::iot_ppb(int op2, int nac, int mb, int &io, int ac)
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
if (LOG_IOT_EXTRA)
- device->logerror("PPB instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context());
+ logerror("PPB instruction: mb=0%06o, (%s)\n", (unsigned) mb, machine().describe_context());
- state->tape_write((*io >> 12) | 0200);
- state->m_io_status &= ~io_st_ptp;
+ tape_write((io >> 12) | 0200);
+ m_st_ptp(0);
/* delay is approximately 1/63.3 second */
if (LOG_IOT_OVERLAP)
{
- if (state->m_tape_puncher.timer->enable(0))
- device->logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context());
+ if (m_timer->enable(0))
+ logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, (%s)\n", (unsigned) mb, machine().describe_context());
}
- state->m_tape_puncher.timer->adjust(attotime::from_usec(15800), nac);
+ m_timer->adjust(attotime::from_usec(15800), nac);
}
@@ -1143,35 +1004,29 @@ static void iot_ppb(device_t *device, int op2, int nac, int mb, int *io, int ac)
/*
Open a file for typewriter output
*/
-image_init_result pdp1_printer_image_device::call_load()
+image_init_result pdp1_typewriter_device::call_load()
{
- pdp1_state *state = machine().driver_data<pdp1_state>();
- /* open file */
- state->m_typewriter.fd = this;
-
- state->m_io_status |= io_st_tyo;
+ m_st_tyo(1);
return image_init_result::PASS;
}
-void pdp1_printer_image_device::call_unload()
+void pdp1_typewriter_device::call_unload()
{
- pdp1_state *state = machine().driver_data<pdp1_state>();
- state->m_typewriter.fd = nullptr;
}
/*
Write a character to typewriter
*/
-void pdp1_state::typewriter_out(uint8_t data)
+void pdp1_typewriter_device::typewriter_out(uint8_t data)
{
if (LOG_IOT_EXTRA)
logerror("typewriter output %o\n", data);
- pdp1_typewriter_drawchar(data);
- if (m_typewriter.fd)
+ drawchar(data);
+ if (is_loaded())
#if 1
- m_typewriter.fd->fwrite(& data, 1);
+ fwrite(& data, 1);
#else
{
static const char ascii_table[2][64] =
@@ -1219,47 +1074,47 @@ void pdp1_state::typewriter_out(uint8_t data)
switch (data)
{
case 034:
- /* Black: ignore */
+ // Black: ignore
//color = color_typewriter_black;
{
static const char black[5] = { '\033', '[', '3', '0', 'm' };
- image_fwrite(m_typewriter.fd, black, sizeof(black));
+ fwrite(black, sizeof(black));
}
break;
case 035:
- /* Red: ignore */
+ // Red: ignore
//color = color_typewriter_red;
{
static const char red[5] = { '\033', '[', '3', '1', 'm' };
- image_fwrite(m_typewriter.fd, red, sizeof(red));
+ fwrite(red, sizeof(red));
}
break;
case 072:
- /* Lower case */
+ // Lower case
m_case_shift = 0;
break;
case 074:
- /* Upper case */
+ // Upper case
m_case_shift = 1;
break;
case 077:
- /* Carriage Return */
+ // Carriage Return
{
static const char line_end[2] = { '\r', '\n' };
- image_fwrite(m_typewriter.fd, line_end, sizeof(line_end));
+ fwrite(line_end, sizeof(line_end));
}
break;
default:
- /* Any printable character... */
+ // Any printable character...
- if ((data != 040) && (data != 056)) /* 040 and 056 are non-spacing characters: don't try to print right now */
+ if ((data != 040) && (data != 056)) // 040 and 056 are non-spacing characters: don't try to print right now
/* print character (lookup ASCII equivalent in table) */
- image_fwrite(m_typewriter.fd, & ascii_table[m_case_shift][data], 1);
+ fwrite(&ascii_table[m_case_shift][data], 1);
break;
}
@@ -1270,10 +1125,10 @@ void pdp1_state::typewriter_out(uint8_t data)
/*
timer callback to generate typewriter completion pulse
*/
-TIMER_CALLBACK_MEMBER(pdp1_state::tyo_callback)
+TIMER_CALLBACK_MEMBER(pdp1_typewriter_device::tyo_callback)
{
int nac = param;
- m_io_status |= io_st_tyo;
+ m_st_tyo(1);
if (nac)
{
m_maincpu->set_state_int(PDP1_IOS,1);
@@ -1283,20 +1138,18 @@ TIMER_CALLBACK_MEMBER(pdp1_state::tyo_callback)
/*
tyo iot callback
*/
-static void iot_tyo(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_typewriter_device::iot_tyo(int op2, int nac, int mb, int &io, int ac)
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
- int ch, delay;
-
if (LOG_IOT_EXTRA)
- device->logerror("Warning, TYO instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context());
+ logerror("Warning, TYO instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, machine().describe_context());
- ch = (*io) & 077;
+ int ch = io & 077;
- state->typewriter_out(ch);
- state->m_io_status &= ~io_st_tyo;
+ typewriter_out(ch);
+ m_st_tyo(0);
/* compute completion delay (source: maintenance manual 9-12, 9-13 and 9-14) */
+ int delay;
switch (ch)
{
case 072: /* lower-case */
@@ -1316,11 +1169,11 @@ static void iot_tyo(device_t *device, int op2, int nac, int mb, int *io, int ac)
}
if (LOG_IOT_OVERLAP)
{
- if (state->m_typewriter.tyo_timer->enable(0))
- device->logerror("Error: overlapped TYO instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context());
+ if (m_tyo_timer->enable(0))
+ logerror("Error: overlapped TYO instruction: mb=0%06o, (%s)\n", (unsigned) mb, machine().describe_context());
}
- state->m_typewriter.tyo_timer->adjust(attotime::from_msec(delay), nac);
+ m_tyo_timer->adjust(attotime::from_msec(delay), nac);
}
/*
@@ -1337,21 +1190,16 @@ static void iot_tyo(device_t *device, int op2, int nac, int mb, int *io, int ac)
* clears the In-Out Register before transferring the information and also clears
* the type-in status bit.
*/
-static void iot_tyi(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_typewriter_device::iot_tyi(int op2, int nac, int mb, int &io, int ac)
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
if (LOG_IOT_EXTRA)
- device->logerror("Warning, TYI instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context());
+ logerror("Warning, TYI instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, machine().describe_context());
- *io = state->m_typewriter.tb;
- if (! (state->m_io_status & io_st_tyi))
- *io |= 0100;
+ io = m_tb;
+ if (! (m_driver_state->m_io_status & io_st_tyi))
+ io |= 0100;
else
- {
- state->m_io_status &= ~io_st_tyi;
- if (USE_SBS)
- state->m_maincpu->set_input_line(0, CLEAR_LINE); /* PDP1 - interrupt it, baby */
- }
+ m_st_tyi(0);
}
@@ -1403,25 +1251,20 @@ TIMER_CALLBACK_MEMBER(pdp1_state::dpy_callback)
Light on one pixel on CRT
*/
-static void iot_dpy(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_state::iot_dpy(int op2, int nac, int mb, int &io, int ac)
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
- int x;
- int y;
-
-
- x = ((ac+0400000) & 0777777) >> 8;
- y = (((*io)+0400000) & 0777777) >> 8;
- state->pdp1_plot(x, y);
+ int x = ((ac+0400000) & 0777777) >> 8;
+ int y = ((io+0400000) & 0777777) >> 8;
+ pdp1_plot(x, y);
/* light pen 32 support */
- state->m_io_status &= ~io_st_pen;
+ m_io_status &= ~io_st_pen;
- if (state->m_lightpen.down && ((x-state->m_lightpen.x)*(x-state->m_lightpen.x)+(y-state->m_lightpen.y)*(y-state->m_lightpen.y) < state->m_lightpen.radius*state->m_lightpen.radius))
+ if (m_lightpen.down && ((x-m_lightpen.x)*(x-m_lightpen.x)+(y-m_lightpen.y)*(y-m_lightpen.y) < m_lightpen.radius*m_lightpen.radius))
{
- state->m_io_status |= io_st_pen;
+ m_io_status |= io_st_pen;
- state->m_maincpu->set_state_int(PDP1_PF3, 1);
+ m_maincpu->set_state_int(PDP1_PF3, 1);
}
if (nac)
@@ -1431,10 +1274,10 @@ static void iot_dpy(device_t *device, int op2, int nac, int mb, int *io, int ac)
{
/* note that overlap detection is incomplete: it will only work if both DPY
instructions require a completion pulse */
- if (state->m_dpy_timer->enable(0))
- device->logerror("Error: overlapped DPY instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context());
+ if (m_dpy_timer->enable(0))
+ logerror("Error: overlapped DPY instruction: mb=0%06o, (%s)\n", (unsigned) mb, machine().describe_context());
}
- state->m_dpy_timer->adjust(attotime::from_usec(50));
+ m_dpy_timer->adjust(attotime::from_usec(50));
}
}
@@ -1444,35 +1287,33 @@ static void iot_dpy(device_t *device, int op2, int nac, int mb, int *io, int ac)
MIT parallel drum (variant of type 23)
*/
-void pdp1_state::parallel_drum_set_il(int il)
+void pdp1_cylinder_image_device::set_il(int il)
{
- attotime il_phase;
-
- m_parallel_drum.il = il;
+ m_il = il;
- il_phase = ((PARALLEL_DRUM_WORD_TIME * il) - m_parallel_drum.rotation_timer->elapsed());
+ attotime il_phase = ((PARALLEL_DRUM_WORD_TIME * il) - m_rotation_timer->elapsed());
if (il_phase < attotime::zero)
il_phase = il_phase + PARALLEL_DRUM_ROTATION_TIME;
- m_parallel_drum.il_timer->adjust(il_phase, 0, PARALLEL_DRUM_ROTATION_TIME);
+ m_il_timer->adjust(il_phase, 0, PARALLEL_DRUM_ROTATION_TIME);
}
#ifdef UNUSED_FUNCTION
-TIMER_CALLBACK_MEMBER(pdp1_state::il_timer_callback)
+TIMER_CALLBACK_MEMBER(pdp1_cylinder_image_device::il_timer_callback)
{
- if (m_parallel_drum.dba)
+ if (m_dba)
{
/* set break request and status bit 5 */
/* ... */
}
}
-void pdp1_state::parallel_drum_init(pdp1_state *state)
+void pdp1_cylinder_image_device::parallel_drum_init(pdp1_state *state)
{
- m_parallel_drum.rotation_timer = machine().scheduler().timer_alloc();
- m_parallel_drum.rotation_timer->adjust(PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME);
+ m_rotation_timer = machine().scheduler().timer_alloc();
+ m_rotation_timer->adjust(PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME);
- m_parallel_drum.il_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::il_timer_callback),this));
- parallel_drum_set_il(0);
+ m_il_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_cylinder_image_device::il_timer_callback),this));
+ set_il(0);
}
#endif
@@ -1481,46 +1322,38 @@ void pdp1_state::parallel_drum_init(pdp1_state *state)
*/
image_init_result pdp1_cylinder_image_device::call_load()
{
- pdp1_state *state = machine().driver_data<pdp1_state>();
- /* open file */
- state->m_parallel_drum.fd = this;
-
return image_init_result::PASS;
}
void pdp1_cylinder_image_device::call_unload()
{
- pdp1_state *state = machine().driver_data<pdp1_state>();
- state->m_parallel_drum.fd = nullptr;
}
-static void iot_dia(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_cylinder_image_device::iot_dia(int op2, int nac, int mb, int &io, int ac)
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
- state->m_parallel_drum.wfb = ((*io) & 0370000) >> 12;
- state->parallel_drum_set_il((*io) & 0007777);
+ m_wfb = (io & 0370000) >> 12;
+ set_il(io & 0007777);
- state->m_parallel_drum.dba = 0; /* right? */
+ m_dba = 0; /* right? */
}
-static void iot_dba(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_cylinder_image_device::iot_dba(int op2, int nac, int mb, int &io, int ac)
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
- state->m_parallel_drum.wfb = ((*io) & 0370000) >> 12;
- state->parallel_drum_set_il((*io) & 0007777);
+ m_wfb = (io & 0370000) >> 12;
+ set_il(io & 0007777);
- state->m_parallel_drum.dba = 1;
+ m_dba = 1;
}
/*
Read a word from drum
*/
-uint32_t pdp1_state::drum_read(int field, int position)
+uint32_t pdp1_cylinder_image_device::drum_read(int field, int position)
{
int offset = (field*4096+position)*3;
uint8_t buf[3];
- if (m_parallel_drum.fd && (!m_parallel_drum.fd->fseek(offset, SEEK_SET)) && (m_parallel_drum.fd->fread( buf, 3) == 3))
+ if (is_loaded() && (!fseek(offset, SEEK_SET)) && (fread(buf, 3) == 3))
return ((buf[0] << 16) | (buf[1] << 8) | buf[2]) & 0777777;
return 0;
@@ -1529,67 +1362,62 @@ uint32_t pdp1_state::drum_read(int field, int position)
/*
Write a word to drum
*/
-void pdp1_state::drum_write(int field, int position, uint32_t data)
+void pdp1_cylinder_image_device::drum_write(int field, int position, uint32_t data)
{
int offset = (field*4096+position)*3;
uint8_t buf[3];
- if (m_parallel_drum.fd)
+ if (is_loaded())
{
buf[0] = data >> 16;
buf[1] = data >> 8;
buf[2] = data;
- m_parallel_drum.fd->fseek(offset, SEEK_SET);
- m_parallel_drum.fd->fwrite( buf, 3);
+ fseek(offset, SEEK_SET);
+ fwrite(buf, 3);
}
}
-static void iot_dcc(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_cylinder_image_device::iot_dcc(int op2, int nac, int mb, int &io, int ac)
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
- attotime delay;
- int dc;
-
- state->m_parallel_drum.rfb = ((*io) & 0370000) >> 12;
- state->m_parallel_drum.wc = - ((*io) & 0007777);
+ m_rfb = (io & 0370000) >> 12;
+ m_wc = - (io & 0007777);
- state->m_parallel_drum.wcl = ac & 0177777/*0007777???*/;
+ m_wcl = ac & 0177777/*0007777???*/;
- state->m_parallel_drum.dba = 0; /* right? */
+ m_dba = 0; /* right? */
/* clear status bit 5... */
/* do transfer */
- delay = state->m_parallel_drum.il_timer->remaining();
- dc = state->m_parallel_drum.il;
+ attotime delay = m_il_timer->remaining();
+ int dc = m_il;
do
{
- if ((state->m_parallel_drum.wfb >= 1) && (state->m_parallel_drum.wfb <= 22))
+ if ((m_wfb >= 1) && (m_wfb <= 22))
{
- state->drum_write(state->m_parallel_drum.wfb-1, dc, (signed)state->m_maincpu->space(AS_PROGRAM).read_dword(state->m_parallel_drum.wcl<<2));
+ drum_write(m_wfb-1, dc, (signed)m_maincpu->space(AS_PROGRAM).read_dword(m_wcl));
}
- if ((state->m_parallel_drum.rfb >= 1) && (state->m_parallel_drum.rfb <= 22))
+ if ((m_rfb >= 1) && (m_rfb <= 22))
{
- state->m_maincpu->space(AS_PROGRAM).write_dword(state->m_parallel_drum.wcl<<2, state->drum_read(state->m_parallel_drum.rfb-1, dc));
+ m_maincpu->space(AS_PROGRAM).write_dword(m_wcl, drum_read(m_rfb-1, dc));
}
- state->m_parallel_drum.wc = (state->m_parallel_drum.wc+1) & 07777;
- state->m_parallel_drum.wcl = (state->m_parallel_drum.wcl+1) & 0177777/*0007777???*/;
+ m_wc = (m_wc+1) & 07777;
+ m_wcl = (m_wcl+1) & 0177777/*0007777???*/;
dc = (dc+1) & 07777;
- if (state->m_parallel_drum.wc)
+ if (m_wc)
delay = delay + PARALLEL_DRUM_WORD_TIME;
- } while (state->m_parallel_drum.wc);
- state->m_maincpu->adjust_icount(-state->m_maincpu->attotime_to_cycles(delay));
+ } while (m_wc);
+ m_maincpu->adjust_icount(-m_maincpu->attotime_to_cycles(delay));
/* if no error, skip */
- state->m_maincpu->set_state_int(PDP1_PC, state->m_maincpu->state_int(PDP1_PC)+1);
+ m_maincpu->set_state_int(PDP1_PC, m_maincpu->state_int(PDP1_PC)+1);
}
-static void iot_dra(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_cylinder_image_device::iot_dra(int op2, int nac, int mb, int &io, int ac)
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
- (*io) = (state->m_parallel_drum.rotation_timer->elapsed() *
- (ATTOSECONDS_PER_SECOND / (PARALLEL_DRUM_WORD_TIME.as_attoseconds()))).seconds() & 0007777;
+ io = (m_rotation_timer->elapsed() *
+ (ATTOSECONDS_PER_SECOND / (PARALLEL_DRUM_WORD_TIME.as_attoseconds()))).seconds() & 0007777;
/* set parity error and timing error... */
}
@@ -1607,9 +1435,9 @@ static void iot_dra(device_t *device, int op2, int nac, int mb, int *io, int ac)
fire rocket, and fire torpedo. low order 4 bits, same for
other ship. routine is entered by jsp cwg.
*/
-static void iot_011(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_state::iot_011(int op2, int nac, int mb, int &io, int ac)
{
- int key_state = device->machine().driver_data<pdp1_state>()->read_spacewar();
+ int key_state = m_spacewar->read();
int reply;
@@ -1637,7 +1465,7 @@ static void iot_011(device_t *device, int op2, int nac, int mb, int *io, int ac)
if (key_state & HSPACE_PLAYER1)
reply |= 014;
- *io = reply;
+ io = reply;
}
@@ -1646,13 +1474,24 @@ static void iot_011(device_t *device, int op2, int nac, int mb, int *io, int ac)
check IO status
*/
-static void iot_cks(device_t *device, int op2, int nac, int mb, int *io, int ac)
+void pdp1_state::iot_cks(int op2, int nac, int mb, int &io, int ac)
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
if (LOG_IOT_EXTRA)
- device->logerror("CKS instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context());
+ logerror("CKS instruction: mb=0%06o, (%s)\n", (unsigned) mb, machine().describe_context());
+
+ io = m_io_status;
+}
+
+template <int Mask>
+WRITE_LINE_MEMBER(pdp1_state::io_status_w)
+{
+ if (state)
+ m_io_status |= Mask;
+ else
+ m_io_status &= ~Mask;
- *io = state->m_io_status;
+ if (USE_SBS && Mask == io_st_tyi)
+ m_maincpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE); /* PDP1 - interrupt it, baby */
}
@@ -1661,30 +1500,29 @@ static void iot_cks(device_t *device, int op2, int nac, int mb, int *io, int ac)
IO devices should reset
*/
-void pdp1_io_sc_callback(device_t *device)
+void pdp1_state::io_start_clear()
{
- pdp1_state *state = device->machine().driver_data<pdp1_state>();
- state->m_tape_reader.rcl = state->m_tape_reader.rc = 0;
- if (state->m_tape_reader.timer)
- state->m_tape_reader.timer->enable(0);
+ m_tape_reader->m_rcl = m_tape_reader->m_rc = 0;
+ if (m_tape_reader->m_timer)
+ m_tape_reader->m_timer->enable(0);
- if (state->m_tape_puncher.timer)
- state->m_tape_puncher.timer->enable(0);
+ if (m_tape_puncher->m_timer)
+ m_tape_puncher->m_timer->enable(0);
- if (state->m_typewriter.tyo_timer)
- state->m_typewriter.tyo_timer->enable(0);
+ if (m_typewriter->m_tyo_timer)
+ m_typewriter->m_tyo_timer->enable(0);
- if (state->m_dpy_timer)
- state->m_dpy_timer->enable(0);
+ if (m_dpy_timer)
+ m_dpy_timer->enable(0);
- state->m_io_status = io_st_tyo | io_st_ptp;
+ m_io_status = io_st_tyo | io_st_ptp;
}
/*
typewriter keyboard handler
*/
-void pdp1_state::pdp1_keyboard()
+void pdp1_typewriter_device::pdp1_keyboard()
{
int i;
int j;
@@ -1706,13 +1544,10 @@ void pdp1_state::pdp1_keyboard()
{
for (j=0; (((typewriter_transitions >> j) & 1) == 0) /*&& (j<16)*/; j++)
;
- m_typewriter.tb = (i << 4) + j;
- m_io_status |= io_st_tyi;
- #if USE_SBS
- m_maincpu->set_input_line(0, ASSERT_LINE); /* PDP1 - interrupt it, baby */
- #endif
+ m_tb = (i << 4) + j;
+ m_st_tyi(1);
m_maincpu->set_state_int(PDP1_PF1, 1);
- pdp1_typewriter_drawchar(m_typewriter.tb); /* we want to echo input */
+ drawchar(m_tb); /* we want to echo input */
break;
}
}
@@ -1835,7 +1670,7 @@ INTERRUPT_GEN_MEMBER(pdp1_state::pdp1_interrupt)
m_maincpu->set_state_int(PDP1_MA, m_maincpu->state_int(PDP1_PC));
m_maincpu->set_state_int(PDP1_IR, pdp1_device::LAC); /* this instruction is actually executed */
- m_maincpu->set_state_int(PDP1_MB, (signed)m_maincpu->space(AS_PROGRAM).read_dword(PDP1_MA<<2));
+ m_maincpu->set_state_int(PDP1_MB, (signed)m_maincpu->space(AS_PROGRAM).read_dword(PDP1_MA));
m_maincpu->set_state_int(PDP1_AC, m_maincpu->state_int(PDP1_MB));
}
if (control_transitions & pdp1_deposit)
@@ -1847,7 +1682,7 @@ INTERRUPT_GEN_MEMBER(pdp1_state::pdp1_interrupt)
m_maincpu->set_state_int(PDP1_IR, pdp1_device::DAC); /* this instruction is actually executed */
m_maincpu->set_state_int(PDP1_MB, m_maincpu->state_int(PDP1_AC));
- m_maincpu->space(AS_PROGRAM).write_dword(m_maincpu->state_int(PDP1_MA)<<2, m_maincpu->state_int(PDP1_MB));
+ m_maincpu->space(AS_PROGRAM).write_dword(m_maincpu->state_int(PDP1_MA), m_maincpu->state_int(PDP1_MB));
}
if (control_transitions & pdp1_read_in)
{ /* set cpu to read instructions from perforated tape */
@@ -1911,7 +1746,7 @@ INTERRUPT_GEN_MEMBER(pdp1_state::pdp1_interrupt)
m_old_tw_keys = 0;
m_old_ta_keys = 0;
- pdp1_keyboard();
+ m_typewriter->pdp1_keyboard();
}
pdp1_lightpen();
@@ -1926,6 +1761,36 @@ void pdp1_state::pdp1(machine_config &config)
m_maincpu->set_reset_param(&pdp1_reset_param);
m_maincpu->set_addrmap(AS_PROGRAM, &pdp1_state::pdp1_map);
m_maincpu->set_vblank_int("screen", FUNC(pdp1_state::pdp1_interrupt)); /* dummy interrupt: handles input */
+ /* external iot handlers. 00, 50 to 56 and 74 are internal to the cpu core. */
+ /* I put a ? when the source is the handbook, since a) I have used the maintenance manual
+ as the primary source (as it goes more into details) b) the handbook and the maintenance
+ manual occasionnally contradict each other. */
+ /* (iot) rpa rpb tyo tyi ppa ppb dpy */
+ /* spacewar */
+ /* lag glf?/jsp? gpl?/gpr?/gcf? */
+ /* rrb rcb? rcc? cks mcs mes mel */
+ /* cad? rac? rbc? pac lpr/lfb/lsp swc/sci/sdf?/shr? scv? */
+ /* (dsc) (asc) (isb) (cac) (lsm) (esm) (cbs) */
+ /* icv? dia dba dcc dra mri|rlc? mrf/inr?/ccr? */
+ /* mcb|dur? mwc|mtf? mrc|sfc?... msm|cgo? (eem/lem) mic muf */
+ m_maincpu->set_iot_callback<001>(m_tape_reader, FUNC(pdp1_readtape_image_device::iot_rpa));
+ m_maincpu->set_iot_callback<002>(m_tape_reader, FUNC(pdp1_readtape_image_device::iot_rpb));
+ m_maincpu->set_iot_callback<003>(m_typewriter, FUNC(pdp1_typewriter_device::iot_tyo));
+ m_maincpu->set_iot_callback<004>(m_typewriter, FUNC(pdp1_typewriter_device::iot_tyi));
+ m_maincpu->set_iot_callback<005>(m_tape_puncher, FUNC(pdp1_punchtape_image_device::iot_ppa));
+ m_maincpu->set_iot_callback<006>(m_tape_puncher, FUNC(pdp1_punchtape_image_device::iot_ppb));
+ m_maincpu->set_iot_callback<007>(FUNC(pdp1_state::iot_dpy));
+ m_maincpu->set_iot_callback<011>(FUNC(pdp1_state::iot_011));
+ m_maincpu->set_iot_callback<030>(m_tape_reader, FUNC(pdp1_readtape_image_device::iot_rrb));
+ m_maincpu->set_iot_callback<033>(FUNC(pdp1_state::iot_cks));
+ /* dia, dba, dcc, dra are documented in MIT PDP-1 COMPUTER MODIFICATION
+ BULLETIN no. 2 (drumInstrWriteup.bin/drumInstrWriteup.txt), and are
+ similar to IOT documented in Parallel Drum Type 23 Instruction Manual. */
+ m_maincpu->set_iot_callback<061>(m_parallel_drum, FUNC(pdp1_cylinder_image_device::iot_dia));
+ m_maincpu->set_iot_callback<062>(m_parallel_drum, FUNC(pdp1_cylinder_image_device::iot_dba));
+ m_maincpu->set_iot_callback<063>(m_parallel_drum, FUNC(pdp1_cylinder_image_device::iot_dcc));
+ m_maincpu->set_iot_callback<064>(m_parallel_drum, FUNC(pdp1_cylinder_image_device::iot_dra));
+ m_maincpu->set_io_sc_callback(FUNC(pdp1_state::io_start_clear));
/* video hardware (includes the control panel and typewriter output) */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@@ -1942,10 +1807,17 @@ void pdp1_state::pdp1(machine_config &config)
m_crt->set_offsets(crt_window_offset_x, crt_window_offset_y);
m_crt->set_size(crt_window_width, crt_window_height);
- PDP1_READTAPE(config, "readt", 0);
- PDP1_PUNCHTAPE(config, "punch", 0);
- PDP1_PRINTER(config, "typewriter", 0);
- PDP1_CYLINDER(config, "drum", 0);
+ PDP1_READTAPE(config, m_tape_reader);
+ m_tape_reader->st_ptr().set(FUNC(pdp1_state::io_status_w<io_st_ptr>));
+
+ PDP1_PUNCHTAPE(config, m_tape_puncher);
+ m_tape_puncher->st_ptp().set(FUNC(pdp1_state::io_status_w<io_st_ptp>));
+
+ PDP1_TYPEWRITER(config, m_typewriter);
+ m_typewriter->st_tyo().set(FUNC(pdp1_state::io_status_w<io_st_tyo>));
+ m_typewriter->st_tyi().set(FUNC(pdp1_state::io_status_w<io_st_tyi>));
+
+ PDP1_CYLINDER(config, m_parallel_drum);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pdp1);
PALETTE(config, m_palette, FUNC(pdp1_state::pdp1_palette), total_colors_needed + ARRAY_LENGTH(pdp1_pens), total_colors_needed);
diff --git a/src/mame/drivers/popeye.cpp b/src/mame/drivers/popeye.cpp
index 19429df5a63..3d240a079c7 100644
--- a/src/mame/drivers/popeye.cpp
+++ b/src/mame/drivers/popeye.cpp
@@ -576,7 +576,7 @@ void tpp2_state::config(machine_config &config)
NETLIST_STREAM_INPUT(config, "snd_nl:cin1", 1, "R_AY1_2.R");
NETLIST_STREAM_INPUT(config, "snd_nl:cin2", 2, "R_AY1_3.R");
- NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "ROUT.1").set_mult_offset(30000.0, -65000.0);
+ NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "ROUT.1").set_mult_offset(1.0, -2.0);
}
void popeyebl_state::config(machine_config& config)
diff --git a/src/mame/drivers/prehisle.cpp b/src/mame/drivers/prehisle.cpp
index 9f1b2bb5570..d28e5b87521 100644
--- a/src/mame/drivers/prehisle.cpp
+++ b/src/mame/drivers/prehisle.cpp
@@ -4,7 +4,8 @@
Prehistoric Isle in 1930 (World) (c) 1989 SNK
Prehistoric Isle in 1930 (USA) (c) 1989 SNK
- Genshi-Tou 1930's (Japan) (c) 1989 SNK
+ 原始島(Wonsido) 1930's (Korea) (c) 1989 SNK / Victor
+ 原始島(Genshitō) 1930's (Japan) (c) 1989 SNK
Emulation by Bryan McPhail, mish@tendril.co.uk
@@ -396,9 +397,9 @@ ROM_END
/******************************************************************************/
-
+//原始島(Shared Title GFX for Japan and Korea set, JP: げんしとう-Genshitō; KR: 원시도-Wonsido)/Prehistoric Isle in 1930(English)
GAME( 1989, prehisle, 0, prehisle, prehisle, prehisle_state, empty_init, ROT0, "SNK", "Prehistoric Isle in 1930 (World)", MACHINE_SUPPORTS_SAVE )
GAME( 1989, prehisleu, prehisle, prehisle, prehisle, prehisle_state, empty_init, ROT0, "SNK", "Prehistoric Isle in 1930 (US)", MACHINE_SUPPORTS_SAVE )
-GAME( 1989, prehislek, prehisle, prehisle, prehisle, prehisle_state, empty_init, ROT0, "SNK (Victor license)", "Prehistoric Isle in 1930 (Korea)", MACHINE_SUPPORTS_SAVE )
-GAME( 1989, gensitou, prehisle, prehisle, prehisle, prehisle_state, empty_init, ROT0, "SNK", "Genshi-Tou 1930's", MACHINE_SUPPORTS_SAVE )
+GAME( 1989, prehislek, prehisle, prehisle, prehisle, prehisle_state, empty_init, ROT0, "SNK (Victor license)", "Wonsido 1930's (Korea)", MACHINE_SUPPORTS_SAVE )
+GAME( 1989, gensitou, prehisle, prehisle, prehisle, prehisle_state, empty_init, ROT0, "SNK", "Genshitou 1930's", MACHINE_SUPPORTS_SAVE )
GAME( 1989, prehisleb, prehisle, prehisle, prehisle, prehisle_state, empty_init, ROT0, "bootleg", "Prehistoric Isle in 1930 (World, bootleg)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/pv1000.cpp b/src/mame/drivers/pv1000.cpp
index 682fb7632b4..a78004c2ad4 100644
--- a/src/mame/drivers/pv1000.cpp
+++ b/src/mame/drivers/pv1000.cpp
@@ -31,7 +31,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
@@ -60,7 +60,7 @@ pv1000_sound_device::pv1000_sound_device(const machine_config &mconfig, const ch
void pv1000_sound_device::device_start()
{
- m_sh_channel = machine().sound().stream_alloc(*this, 0, 1, clock() / 1024);
+ m_sh_channel = stream_alloc_legacy(0, 1, clock() / 1024);
save_item(NAME(m_voice[0].count));
save_item(NAME(m_voice[0].period));
@@ -84,7 +84,7 @@ void pv1000_sound_device::voice_w(offs_t offset, uint8_t data)
}
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
@@ -98,7 +98,7 @@ void pv1000_sound_device::voice_w(offs_t offset, uint8_t data)
Note: the register periods are inverted.
*/
-void pv1000_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void pv1000_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
diff --git a/src/mame/drivers/roland_jd800.cpp b/src/mame/drivers/roland_jd800.cpp
new file mode 100644
index 00000000000..1a1c29c3dbb
--- /dev/null
+++ b/src/mame/drivers/roland_jd800.cpp
@@ -0,0 +1,74 @@
+// license:BSD-3-Clause
+// copyright-holders:AJR
+/****************************************************************************
+
+ Skeleton driver for Roland JD-800 synthesizer.
+
+****************************************************************************/
+
+#include "emu.h"
+//#include "bus/midi/midi.h"
+//#include "cpu/h8/h8330.h"
+#include "cpu/h8500/h8532.h"
+//#include "machine/nvram.h"
+//#include "machine/ssc1000.h"
+
+class roland_jd800_state : public driver_device
+{
+public:
+ roland_jd800_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ {
+ }
+
+ void jd800(machine_config &config);
+
+private:
+ void mem_map(address_map &map);
+
+ required_device<h8532_device> m_maincpu;
+};
+
+
+void roland_jd800_state::mem_map(address_map &map)
+{
+ map(0xc0000, 0xfffff).rom().region("progrom", 0);
+}
+
+
+static INPUT_PORTS_START(jd800)
+INPUT_PORTS_END
+
+void roland_jd800_state::jd800(machine_config &config)
+{
+ HD6435328(config, m_maincpu, 20_MHz_XTAL); // MD2 = VCC, MD1 = MD0 = GND
+ m_maincpu->set_addrmap(AS_PROGRAM, &roland_jd800_state::mem_map);
+
+ //SSC1000(config, "keybc", 20_MHz_XTAL / 2);
+
+ //NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // HM62256LFP-12SLT (@ IC29) + CR2032 battery
+
+ //H8330(config, "iomcu", 20_MHz_XTAL / 2).set_disable(); // MD0 = MD1 = +5V (single-chip mode)
+
+ //MB83371A(config, "pcm", 26.195_MHz_XTAL);
+ //TC24SC220AF_001(config, "mixer", 28.224_MHz_XTAL);
+}
+
+ROM_START(jd800)
+ ROM_REGION(0x8000, "maincpu", ROMREGION_ERASE00)
+ ROM_LOAD("r15199765.ic36", 0x0000, 0x8000, NO_DUMP)
+
+ ROM_REGION(0x40000, "progrom", 0)
+ ROM_LOAD("roland_r15209315_9119-d.ic31", 0x00000, 0x40000, CRC(04565c05) SHA1(08c0fdc79e6d8d1b5cd3261c977da0244428057c)) // version 1.01
+
+ ROM_REGION(0x4000, "iomcu", ROMREGION_ERASE00) // H8/330
+ ROM_LOAD("r15199742.ic5", 0x0000, 0x4000, NO_DUMP)
+
+ ROM_REGION(0x300000, "pcm", 0)
+ ROM_LOAD("roland_r15209290_mb838000-20_2a6-aa_9114-r11.ic25", 0x000000, 0x100000, CRC(d743cec8) SHA1(7ac9943f1769913d7bbf95c5cca76ca711179641))
+ ROM_LOAD("roland_r15209291_mb838000-20_2a7-aa_9119-r15.ic26", 0x100000, 0x100000, CRC(06098658) SHA1(5c364e3b9c1b206fe94fbaa190caa17b01189937))
+ ROM_LOAD("roland_r15209305_mb838000-20_2a8-aa_9102-r01.ic1", 0x200000, 0x100000, CRC(5c83e539) SHA1(2861baa9a6f42a1257c241927815ed366becd7dc)) // on card board
+ROM_END
+
+SYST(1991, jd800, 0, 0, jd800, jd800, roland_jd800_state, empty_init, "Roland", "JD-800 Programmable Synthesizer", MACHINE_IS_SKELETON)
diff --git a/src/mame/drivers/rx78.cpp b/src/mame/drivers/rx78.cpp
index 708b108a555..dcc51357c52 100644
--- a/src/mame/drivers/rx78.cpp
+++ b/src/mame/drivers/rx78.cpp
@@ -356,22 +356,22 @@ static INPUT_PORTS_START( rx78 )
PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
- PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up Down Arrow") PORT_CODE(KEYCODE_PGUP)
+ PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up Down Arrow") PORT_CODE(KEYCODE_PGUP) PORT_CHAR('^')
PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right Left Arrow") PORT_CODE(KEYCODE_PGDN)
PORT_START("KEY6")
PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
- PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN)
- PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP)
- PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT)
- PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT)
+ PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
+ PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
+ PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
+ PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CLR / HOME") PORT_CODE(KEYCODE_HOME)
PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_UNUSED )
- PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INST / DEL") PORT_CODE(KEYCODE_BACKSPACE)
+ PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INST / DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
PORT_START("KEY7")
PORT_BIT(0x07,IP_ACTIVE_HIGH,IPT_UNUSED )
- PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_END)
+ PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_END) PORT_CHAR(0xff) PORT_CHAR(3)
PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_UNUSED )
PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_UNUSED )
diff --git a/src/mame/drivers/segas16b.cpp b/src/mame/drivers/segas16b.cpp
index 280d33a625d..4dfaac8ae8c 100644
--- a/src/mame/drivers/segas16b.cpp
+++ b/src/mame/drivers/segas16b.cpp
@@ -3991,13 +3991,13 @@ void segas16b_state::system16b(machine_config &config)
// please refer to the netlist code for details about
// the multipliers and offsets.
NETLIST_STREAM_INPUT(config, "netlist:cin0", 0, "CH1.IN")
- .set_mult_offset(0.5/32768.0, 2.5);
+ .set_mult_offset(0.5, 2.5);
NETLIST_STREAM_INPUT(config, "netlist:cin1", 1, "CH2.IN")
- .set_mult_offset(0.5/32768.0, 2.5);
+ .set_mult_offset(0.5, 2.5);
NETLIST_STREAM_INPUT(config, "netlist:cin2", 2, "SPEECH.I")
- .set_mult_offset(0.001020/32768.0/2.0, 0.001020/2.0);
+ .set_mult_offset(0.001020/2.0, 0.001020/2.0);
- NETLIST_STREAM_OUTPUT(config, "netlist:cout0", 0, "OUT").set_mult_offset(30000.0 / 0.2, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "netlist:cout0", 0, "OUT").set_mult_offset(1.0 / 0.2, 0.0);
#else
YM2151(config, m_ym2151, MASTER_CLOCK_8MHz/2).add_route(ALL_OUTPUTS, "mono", 0.43);
diff --git a/src/mame/drivers/seta2.cpp b/src/mame/drivers/seta2.cpp
index 11e5bc66236..7fbcb65509f 100644
--- a/src/mame/drivers/seta2.cpp
+++ b/src/mame/drivers/seta2.cpp
@@ -1758,9 +1758,9 @@ static INPUT_PORTS_START( reelquak )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE ) // collect
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP ) // double up
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH ) PORT_NAME("Big") // big
- PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_POKER_BET ) // bet
+ PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) // bet
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_GAMBLE_LOW ) PORT_NAME("Small") // small
- PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) // start
+ PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_START1 ) // start
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("TICKET") // $400003.b
diff --git a/src/mame/drivers/sigmab52.cpp b/src/mame/drivers/sigmab52.cpp
index bc82e36e271..f6019846879 100644
--- a/src/mame/drivers/sigmab52.cpp
+++ b/src/mame/drivers/sigmab52.cpp
@@ -394,34 +394,34 @@ static INPUT_PORTS_START( jwildb52 )
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_POKER_HOLD2 )
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_POKER_HOLD1 )
- PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x00) PORT_NAME("Double")
- PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x00) PORT_NAME("Deal / Draw")
- PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x00) PORT_NAME("Max Bet")
- PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x00) PORT_NAME("One Bet")
+ PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x00) PORT_NAME("Double")
+ PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x00) PORT_NAME("Deal / Draw")
+ PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x00) PORT_NAME("Max Bet")
+ PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x00) PORT_NAME("One Bet")
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x00) PORT_NAME("Collect / Payout")
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_POKER_CANCEL ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x10)
- PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x10) PORT_NAME("Deal / Draw")
- PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x10) PORT_NAME("Max Bet")
- PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x10) PORT_NAME("One Bet")
+ PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x10) PORT_NAME("Deal / Draw")
+ PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x10) PORT_NAME("Max Bet")
+ PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x10) PORT_NAME("One Bet")
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x10)
- PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x40) PORT_NAME("Double")
- PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x40) PORT_NAME("Deal")
- PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x40) PORT_NAME("Draw")
+ PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x40) PORT_NAME("Double")
+ PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x40) PORT_NAME("Deal")
+ PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x40) PORT_NAME("Draw")
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_POKER_CANCEL ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x40)
- PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x40) PORT_NAME("Collect")
+ PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x40) PORT_NAME("Collect")
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x50)
- PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x50) PORT_NAME("Deal")
- PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x50) PORT_NAME("Draw")
- PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_POKER_CANCEL ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x50)
+ PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x50) PORT_NAME("Deal")
+ PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x50) PORT_NAME("Draw")
+ PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_POKER_CANCEL ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x50)
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("DSW1", 0x50, EQUALS, 0x50)
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CODE(KEYCODE_1_PAD)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Meter")
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_T) PORT_NAME("Last")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_DOOR ) PORT_NAME("Machine Door")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE )
@@ -542,9 +542,9 @@ static INPUT_PORTS_START( s8waysfc )
PORT_MODIFY("IN0")
PORT_BIT( 0x07ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON3 )
- PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Start")
- PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Max Bet")
+ PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON2 )
+ PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start")
+ PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Max Bet")
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("One Bet")
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) PORT_NAME("Collect / Payout")
INPUT_PORTS_END
diff --git a/src/mame/drivers/sigmab98.cpp b/src/mame/drivers/sigmab98.cpp
index 39bc6c29f93..99fdfb37bbd 100644
--- a/src/mame/drivers/sigmab98.cpp
+++ b/src/mame/drivers/sigmab98.cpp
@@ -102,7 +102,7 @@ To Do:
to "coin" (it probably changes the number of reads from port $C0).
I guess the reset_delay mechanism should be implemented with a timer in eeprom.c.
- pyenaget intro: when the theater scrolls out to the left, the train should scroll in from the right,
- with no visible gaps. It currently leaves the screen empty instead, for several seconds.
+ with no visible gaps. It currently leaves a small gap.
- tdoboon: no smoke from hit planes as shown in the video? Tiles are present (f60-125f) and used in demo mode.
- dashhero does not acknowledge the button bashing correctly, it's very hard to win (a slower pace works better!)
- dodghero and sushimar often write zeroes to 81XX1 and 00XX1 for some reason (maybe just sloppy coding?)
@@ -283,6 +283,7 @@ public:
sammymdl_state(const machine_config &mconfig, device_type type, const char *tag)
: sigmab98_base_state(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
+ , m_kp69(*this, "maincpu:kp69")
, m_eeprom(*this, "eeprom")
, m_hopper(*this, "hopper")
, m_hopper_small(*this, "hopper_small")
@@ -301,13 +302,13 @@ public:
void init_itazuram();
void init_animalc();
void init_haekaka();
- void init_gocowboy();
protected:
virtual void machine_start() override { m_leds.resolve(); }
private:
- TIMER_DEVICE_CALLBACK_MEMBER(sammymdl_irq);
+ TIMER_DEVICE_CALLBACK_MEMBER(gocowboy_int);
+ TIMER_DEVICE_CALLBACK_MEMBER(timer_1khz);
uint8_t coin_counter_r();
void coin_counter_w(uint8_t data);
@@ -339,6 +340,7 @@ private:
// Required devices
required_device<kl5c80a12_device> m_maincpu;
+ required_device<kp69_device> m_kp69;
required_device<eeprom_serial_93cxx_device> m_eeprom;
// Optional devices
@@ -348,10 +350,6 @@ private:
output_finder<8> m_leds;
- uint8_t m_vblank_vector;
- uint8_t m_timer0_vector;
- uint8_t m_timer1_vector;
-
uint8_t m_out[3];
};
@@ -946,7 +944,7 @@ uint8_t sigmab98_base_state::vblank_r()
{
// mask 0x04 must be set before writing sprite list
// mask 0x10 must be set or irq/00 hangs?
- return m_vblank | 0x14;
+ return (m_vblank & ~0x01) | 0x14;
}
void sigmab98_base_state::vblank_w(uint8_t data)
@@ -1632,23 +1630,29 @@ void lufykzku_state::lufykzku(machine_config &config)
Sammy Medal Games
***************************************************************************/
-TIMER_DEVICE_CALLBACK_MEMBER(sammymdl_state::sammymdl_irq)
+TIMER_DEVICE_CALLBACK_MEMBER(sammymdl_state::gocowboy_int)
{
int scanline = param;
- uint16_t irqs = 0;
+ // TODO: what really triggers these?
if (scanline == 240)
- irqs |= 1 << ((m_vblank_vector & 0x1e) >> 1);
+ {
+ m_kp69->ir_w<0>(1);
+ m_kp69->ir_w<0>(0);
+ }
if (scanline == 128)
- irqs |= 1 << ((m_timer0_vector & 0x1e) >> 1);
-
- if (scanline == 32)
- irqs |= 1 << ((m_timer1_vector & 0x1e) >> 1);
+ {
+ m_kp69->ir_w<1>(1);
+ m_kp69->ir_w<1>(0);
+ }
+}
- // FIXME: this is not much less of a hack than HOLD_LINE
- if (irqs != 0)
- m_maincpu->set_state_int(kl5c80a12_device::KP69_IRR, m_maincpu->state_int(kl5c80a12_device::KP69_IRR) | irqs);
+TIMER_DEVICE_CALLBACK_MEMBER(sammymdl_state::timer_1khz)
+{
+ // FIXME: this is an internally generated timer interrupt
+ m_kp69->ir_w<11>(1);
+ m_kp69->ir_w<11>(0);
}
void sammymdl_state::sammymdl(machine_config &config)
@@ -1657,8 +1661,6 @@ void sammymdl_state::sammymdl(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &sammymdl_state::animalc_map);
m_maincpu->set_addrmap(AS_IO, &sammymdl_state::animalc_io);
- TIMER(config, "scantimer").configure_scanline(FUNC(sammymdl_state::sammymdl_irq), "screen", 0, 1);
-
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // battery backed RAM
EEPROM_93C46_8BIT(config, "eeprom");
@@ -1673,7 +1675,7 @@ void sammymdl_state::sammymdl(machine_config &config)
m_screen->set_size(0x140, 0x100);
m_screen->set_visarea(0, 0x140-1, 0, 0xf0-1);
m_screen->set_screen_update(FUNC(sammymdl_state::screen_update));
- m_screen->screen_vblank().set(FUNC(sammymdl_state::screen_vblank_sammymdl));
+ m_screen->screen_vblank().set(m_kp69, FUNC(kp69_device::ir_w<0>));
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_sigmab98);
@@ -1706,9 +1708,14 @@ void sammymdl_state::gocowboy(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &sammymdl_state::gocowboy_map);
m_maincpu->set_addrmap(AS_IO, &sammymdl_state::gocowboy_io);
+ TIMER(config, "scantimer").configure_scanline(FUNC(sammymdl_state::gocowboy_int), "screen", 0, 1);
+ TIMER(config, "1khztimer").configure_periodic(FUNC(sammymdl_state::timer_1khz), attotime::from_msec(1));
+
config.device_remove("hopper");
- TICKET_DISPENSER(config, m_hopper_small, attotime::from_msec(1000), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW );
- TICKET_DISPENSER(config, m_hopper_large, attotime::from_msec(1000), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW );
+ TICKET_DISPENSER(config, m_hopper_small, attotime::from_msec(200), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW );
+ TICKET_DISPENSER(config, m_hopper_large, attotime::from_msec(200), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW );
+
+ m_screen->screen_vblank().set_nop();
}
void sammymdl_state::haekaka(machine_config &config)
@@ -1717,14 +1724,21 @@ void sammymdl_state::haekaka(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &sammymdl_state::haekaka_map);
m_maincpu->set_addrmap(AS_IO, &sammymdl_state::haekaka_io);
+
+ m_screen->screen_vblank().set(m_kp69, FUNC(kp69_device::ir_w<2>));
}
void sammymdl_state::itazuram(machine_config &config)
{
sammymdl(config);
+ TIMER(config, "scantimer").configure_scanline(FUNC(sammymdl_state::gocowboy_int), "screen", 0, 1);
+ TIMER(config, "1khztimer").configure_periodic(FUNC(sammymdl_state::timer_1khz), attotime::from_msec(1));
+
m_maincpu->set_addrmap(AS_PROGRAM, &sammymdl_state::itazuram_map);
m_maincpu->set_addrmap(AS_IO, &sammymdl_state::itazuram_io);
+
+ m_screen->screen_vblank().set_nop();
}
void sammymdl_state::pyenaget(machine_config &config)
@@ -1733,6 +1747,8 @@ void sammymdl_state::pyenaget(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &sammymdl_state::haekaka_map);
m_maincpu->set_addrmap(AS_IO, &sammymdl_state::pyenaget_io);
+
+ m_screen->screen_vblank().set(m_kp69, FUNC(kp69_device::ir_w<2>));
}
void sammymdl_state::tdoboon(machine_config &config)
@@ -1742,6 +1758,7 @@ void sammymdl_state::tdoboon(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &sammymdl_state::tdoboon_map);
m_maincpu->set_addrmap(AS_IO, &sammymdl_state::tdoboon_io);
+ m_screen->screen_vblank().set(m_kp69, FUNC(kp69_device::ir_w<2>));
m_screen->set_visarea(0,0x140-1, 0+4,0xf0+4-1);
}
@@ -2184,10 +2201,6 @@ void sammymdl_state::init_animalc()
// force jump out of BIOS loop
rom[0x005ac] = 0xc3;
-
- m_vblank_vector = 0x00; // increment counter
- m_timer0_vector = 0x1c; // read hopper state
- m_timer1_vector = 0x1e; // drive hopper motor
}
/***************************************************************************
@@ -2225,13 +2238,6 @@ ROM_START( gocowboy )
ROM_LOAD( "vm1212f01.u5.jed", 0x0000, 0x5cde, CRC(b86a1825) SHA1(cc2e633fb8a24cfc93291a778b0964089f6b8ac7) )
ROM_END
-void sammymdl_state::init_gocowboy()
-{
- m_vblank_vector = 0x00;
- m_timer0_vector = 0x02;
- m_timer1_vector = 0x16;
-}
-
/***************************************************************************
Itazura Monkey ( VX1902L02 ITZRMONKY 200011211639 SAMMY CORP. AM )
@@ -2260,10 +2266,6 @@ void sammymdl_state::init_itazuram()
// force jump out of BIOS loop
rom[0x005ac] = 0xc3;
-
- m_vblank_vector = 0x00;
- m_timer0_vector = 0x02;
- m_timer1_vector = 0x16;
}
/***************************************************************************
@@ -2366,10 +2368,6 @@ void sammymdl_state::init_haekaka()
// force jump out of BIOS loop
rom[0x005ac] = 0xc3;
-
- m_vblank_vector = 0x04;
- m_timer0_vector = 0x1a;
- m_timer1_vector = 0x1c;
}
/***************************************************************************
@@ -2396,4 +2394,4 @@ GAME( 2000, itazuram, sammymdl, itazuram, sammymdl, sammymdl_state, init_itazura
GAME( 2000, pyenaget, sammymdl, pyenaget, sammymdl, sammymdl_state, init_haekaka, ROT0, "Sammy", "Pye-nage Taikai", 0 )
GAME( 2000, tdoboon, sammymdl, tdoboon, haekaka, sammymdl_state, init_haekaka, ROT0, "Sammy", "Taihou de Doboon", 0 )
GAME( 2001, haekaka, sammymdl, haekaka, haekaka, sammymdl_state, init_haekaka, ROT0, "Sammy", "Hae Hae Ka Ka Ka", 0 )
-GAME( 2003, gocowboy, 0, gocowboy, gocowboy, sammymdl_state, init_gocowboy, ROT0, "Sammy", "Go Go Cowboy (English, prize)", 0 )
+GAME( 2003, gocowboy, 0, gocowboy, gocowboy, sammymdl_state, empty_init, ROT0, "Sammy", "Go Go Cowboy (English, prize)", 0 )
diff --git a/src/mame/drivers/starcrus.cpp b/src/mame/drivers/starcrus.cpp
index 4e1cc1c9e25..d76011e7c24 100644
--- a/src/mame/drivers/starcrus.cpp
+++ b/src/mame/drivers/starcrus.cpp
@@ -172,7 +172,7 @@ void starcrus_state::starcrus(machine_config &config)
NETLIST_ANALOG_INPUT(config, "sound_nl:noise_volume", "R23.DIAL");
NETLIST_ANALOG_INPUT(config, "sound_nl:volume", "R75.DIAL");
- NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "R77.2").set_mult_offset(100000.0, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "R77.2").set_mult_offset(100000.0 / 32768.0, 0.0);
}
/***************************************************************************
diff --git a/src/mame/drivers/starfire.cpp b/src/mame/drivers/starfire.cpp
index 54b2b7c3453..f8d3ba57a7f 100644
--- a/src/mame/drivers/starfire.cpp
+++ b/src/mame/drivers/starfire.cpp
@@ -457,8 +457,8 @@ void fireone_state::fireone(machine_config &config)
NETLIST_ANALOG_INPUT(config, "sound_nl:volume_l", "R64.DIAL");
NETLIST_ANALOG_INPUT(config, "sound_nl:volume_r", "R65.DIAL");
- NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUT_L").set_mult_offset(100000.0, 0.0);
- NETLIST_STREAM_OUTPUT(config, "sound_nl:cout1", 1, "OUT_R").set_mult_offset(100000.0, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUT_L").set_mult_offset(100000.0 / 32768.0, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "sound_nl:cout1", 1, "OUT_R").set_mult_offset(100000.0 / 32768.0, 0.0);
}
void starfire_state::starfire(machine_config &config)
diff --git a/src/mame/drivers/statriv2.cpp b/src/mame/drivers/statriv2.cpp
index 30616b98abb..2f0723f76a4 100644
--- a/src/mame/drivers/statriv2.cpp
+++ b/src/mame/drivers/statriv2.cpp
@@ -375,9 +375,9 @@ INPUT_PORTS_END
static INPUT_PORTS_START( funcsino )
PORT_START("IN0")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_BET )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Draw") PORT_CODE(KEYCODE_3)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_BET )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Deal")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Draw")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Discard 1 / Horse 1 / Point")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Discard 2 / Horse 2")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_NAME("Discard 3 / Horse 3")
@@ -385,7 +385,7 @@ static INPUT_PORTS_START( funcsino )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Discard 5 / Horse 5 / No Point")
PORT_START("IN1")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Stand") PORT_CODE(KEYCODE_4)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_STAND ) PORT_CODE(KEYCODE_4)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Select Game") PORT_CODE(KEYCODE_S)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(statriv2_state, latched_coin_r)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
@@ -411,9 +411,9 @@ INPUT_PORTS_END
static INPUT_PORTS_START( tripdraw )
PORT_START("IN0")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_BET )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Draw") PORT_CODE(KEYCODE_3)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_BET )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Deal")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Draw") PORT_CODE(KEYCODE_3)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Discard 1 / Lo")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Discard 2")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_NAME("Discard 3 / Double")
@@ -421,7 +421,7 @@ static INPUT_PORTS_START( tripdraw )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Discard 5 / Hi")
PORT_START("IN1")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Stand") PORT_CODE(KEYCODE_4)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_STAND ) PORT_CODE(KEYCODE_4)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(statriv2_state, latched_coin_r)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
@@ -447,14 +447,14 @@ INPUT_PORTS_END
static INPUT_PORTS_START( bigcsino ) // flyer shows 8 buttons on the cabinet
PORT_START("IN0")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_NAME("Play")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Play")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Stand") PORT_CODE(KEYCODE_3)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Select Joker Poker / Discard 1 / Horse 1 / Point")
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Select Blackjack / Discard 2 / Horse 2")
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_NAME("Select Baccarat / Discard 3 / Horse 3")
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Select Craps / Discard 4 / Horse 4")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Select Race Time / Discard 5 / Horse 5 / No Point")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_STAND ) PORT_CODE(KEYCODE_3)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Select Joker Poker / Discard 1 / Horse 1 / Point")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Select Blackjack / Discard 2 / Horse 2")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_NAME("Select Baccarat / Discard 3 / Horse 3")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Select Craps / Discard 4 / Horse 4")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Select Race Time / Discard 5 / Horse 5 / No Point")
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
@@ -1748,7 +1748,7 @@ GAME( 1985, cs5_ssp, 0, statusbj, funcsino, statriv2_state, init_lase
GAME( 1988, cs6_sps, 0, statusbj, funcsino, statriv2_state, init_laserdisc, ROT0, "Status Games", "Casino Strip VI (Poker version, for Sony LD)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
GAME( 1985, cs6_ssp, 0, statusbj, funcsino, statriv2_state, init_laserdisc, ROT0, "Status Games", "Casino Strip VI (Shooting Game version, for Pioneer LD)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
GAME( 1986, cs8_ssp, 0, statusbj, funcsino, statriv2_state, init_laserdisc, ROT0, "Status Games", "Casino Strip VIII (Shooting Game version, for Pioneer LD)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
-GAME( 1985, cs8_spp, 0, statusbj, funcsino, statriv2_state, init_laserdisc, ROT0, "Status Games", "Casino Strip VIII (Poker version, for Pioneer LD)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
+GAME( 1985, cs8_spp, 0, statusbj, funcsino, statriv2_state, init_laserdisc, ROT0, "Status Games", "Casino Strip VIII (Poker version, for Pioneer LD)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
GAME( 1988, cs8_sps, 0, statusbj, funcsino, statriv2_state, init_laserdisc, ROT0, "Status Games", "Casino Strip VIII (Poker version, for Sony LD)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
GAME( 1992, cs9_qps, 0, statusbj, funcsino, statriv2_state, init_laserdisc, ROT0, "Quantum Industries", "Casino Strip IX (Poker version, for Sony LD)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
GAME( 1985, cs9_spp, 0, statusbj, funcsino, statriv2_state, init_laserdisc, ROT0, "Status Games", "Casino Strip IX (Poker version, for Pioneer LD)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/subsino.cpp b/src/mame/drivers/subsino.cpp
index 3c0ebb0fe22..c8360b02604 100644
--- a/src/mame/drivers/subsino.cpp
+++ b/src/mame/drivers/subsino.cpp
@@ -1213,7 +1213,7 @@ static INPUT_PORTS_START( victor21 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_V) PORT_NAME("Split")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_CODE(KEYCODE_Z) PORT_NAME("Deal / Hit")
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_IMPULSE(3)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_IMPULSE(3)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_STAND ) PORT_CODE(KEYCODE_X)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_A) PORT_NAME("Bet x10") // multibet
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP ) PORT_CODE(KEYCODE_C)
@@ -1223,15 +1223,15 @@ static INPUT_PORTS_START( victor21 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) // key in
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(3) // coin 2
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_IMPULSE(3) // coin 3
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Stats") // Bookkeeping.
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Settings") // Game Rate.
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats") // Bookkeeping.
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") // Game Rate.
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) // no payout?
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) // key out
PORT_START( "INC" )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") // hard reset
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset") // hard reset
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -1323,7 +1323,7 @@ static INPUT_PORTS_START( victor5 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Hold 4 / Big")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Hold 5 / Small")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Deal / Take")
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_IMPULSE(3)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_IMPULSE(3)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START( "INB" )
@@ -1331,15 +1331,15 @@ static INPUT_PORTS_START( victor5 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) // key in
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Stats") // Bookkeeping.
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Settings") // Game Rate & others.
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats") // Bookkeeping.
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") // Game Rate & others.
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) // payout
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) // key out
PORT_START( "INC" )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") // hard reset
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset") // hard reset
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -1454,12 +1454,12 @@ static INPUT_PORTS_START( tisub )
PORT_START( "INA" )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP ) PORT_NAME("Double / Info")
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Hold 1")
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Hold 2 / Big")
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_NAME("Hold 3 / Small")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SLOT_STOP1 ) PORT_NAME("Stop 1")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SLOT_STOP2 ) PORT_NAME("Stop 2 / Big")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SLOT_STOP3 ) PORT_NAME("Stop 3 / Small")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Start / Take")
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_IMPULSE(3)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start / Take")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_IMPULSE(3)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START( "INB" )
@@ -1467,15 +1467,15 @@ static INPUT_PORTS_START( tisub )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) // key in
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Stats / Test") // Bookkeeping.
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Settings") // Current settings.
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats / Test") // Bookkeeping.
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") // Current settings.
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) // payout
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) // key out
PORT_START( "INC" )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") // hard reset
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset") // hard reset
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -1589,8 +1589,8 @@ static INPUT_PORTS_START( stbsub )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_CODE(KEYCODE_N) PORT_NAME("Start / Stop All")
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_CODE(KEYCODE_C) PORT_NAME("Bet / Stop 2")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start / Stop All")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SLOT_STOP2 ) PORT_NAME("Bet / Stop 2")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP ) PORT_CODE(KEYCODE_Z) PORT_NAME("Double / Info")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -1600,19 +1600,19 @@ static INPUT_PORTS_START( stbsub )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) // key in
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Stats / Test") // Bookkeeping.
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Settings") // Current settings.
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats / Test") // Bookkeeping.
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") // Current settings.
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) // payout
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) // key out
PORT_START("INC")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_LOW ) PORT_CODE(KEYCODE_V) PORT_NAME("Small / Black / Stop 3")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLOT_STOP3 ) PORT_NAME("Small / Black / Stop 3")
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r) // hopper sensor
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") // hard reset
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset") // hard reset
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH ) PORT_CODE(KEYCODE_B) PORT_NAME("Big / Red")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE ) PORT_CODE(KEYCODE_X) PORT_NAME("Take / Stop 1")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SLOT_STOP1 ) PORT_NAME("Take / Stop 1")
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
@@ -1725,8 +1725,8 @@ static INPUT_PORTS_START( tesorone )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_CODE(KEYCODE_N) PORT_NAME("Start / Stop All")
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_CODE(KEYCODE_C) PORT_NAME("Bet / Stop 2")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start / Stop All")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SLOT_STOP2 ) PORT_NAME("Bet / Stop 2")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP ) PORT_CODE(KEYCODE_Z) PORT_NAME("Double / Info")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -1736,19 +1736,19 @@ static INPUT_PORTS_START( tesorone )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) // key in
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Stats / Test") // Bookkeeping.
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Settings") // Current settings.
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats / Test") // Bookkeeping.
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") // Current settings.
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) // payout
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) // key out
PORT_START("INC")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_LOW ) PORT_CODE(KEYCODE_V) PORT_NAME("Small / Black / Stop 3")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLOT_STOP3 ) PORT_NAME("Small / Black / Stop 3")
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r) // hopper sensor
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") // hard reset
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset") // hard reset
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH ) PORT_CODE(KEYCODE_B) PORT_NAME("Big / Red")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE ) PORT_CODE(KEYCODE_X) PORT_NAME("Take / Stop 1")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SLOT_STOP1 ) PORT_NAME("Take / Stop 1")
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
@@ -1863,7 +1863,7 @@ static INPUT_PORTS_START( crsbingo )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Hold 4 / Big")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Hold 5 / Small")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Deal / Take")
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_IMPULSE(3)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_IMPULSE(3)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START( "INB" )
@@ -1871,15 +1871,15 @@ static INPUT_PORTS_START( crsbingo )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) // key in
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Stats") // Bookkeeping.
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Settings") // Game Rate & others.
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats") // Bookkeeping.
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") // Game Rate & others.
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) // payout
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) // key out
PORT_START( "INC" )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") // hard reset
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset") // hard reset
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -1955,7 +1955,7 @@ static INPUT_PORTS_START( sharkpy )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Hold 4 / Big")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Hold 5 / Small")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Deal / Take")
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_NAME("Bet") PORT_IMPULSE(3)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Bet") PORT_IMPULSE(3)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START( "INB" )
@@ -1963,15 +1963,15 @@ static INPUT_PORTS_START( sharkpy )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Stats / Test") // Bookkeeping.
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Settings") // Game Rate & others.
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats / Test") // Bookkeeping.
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") // Game Rate & others.
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) // payout?
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) // key out?
PORT_START( "INC" )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") // hard reset
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset") // hard reset
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -2071,15 +2071,15 @@ static INPUT_PORTS_START( sharkpye )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Stats / Test") // Bookkeeping.
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Settings") // Game Rate & others.
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats / Test") // Bookkeeping.
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") // Game Rate & others.
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT )
PORT_START( "INC" )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Hold 4 / Small")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset Switch") // hard reset
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset Switch") // hard reset
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Hold 5 / Big")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -2159,7 +2159,7 @@ static INPUT_PORTS_START( smoto16 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Hold 4 / Select")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Deal / Take")
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_NAME("Bet / Speed") PORT_IMPULSE(3)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Bet / Speed") PORT_IMPULSE(3)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START( "INB" ) // d006
@@ -2167,15 +2167,15 @@ static INPUT_PORTS_START( smoto16 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r) // hopper sensor
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Stats / Test") // Bookkeeping.
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Settings") // Game Rate & others.
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats / Test") // Bookkeeping.
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") // Game Rate & others.
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) // payout
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) // key out?
PORT_START( "INC" ) // d00c
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r) // hopper sensor
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") // hard reset
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset") // hard reset
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -2255,7 +2255,7 @@ static INPUT_PORTS_START( smoto20 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Hold 4 / Select")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Deal / Take")
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_NAME("Bet / Speed") PORT_IMPULSE(3)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Bet / Speed") PORT_IMPULSE(3)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START( "INB" ) // d006
@@ -2263,15 +2263,15 @@ static INPUT_PORTS_START( smoto20 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r) // hopper sensor
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Stats / Test") // Bookkeeping.
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Settings") // Game Rate & others.
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats / Test") // Bookkeeping.
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") // Game Rate & others.
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) // payout
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) // key out?
PORT_START( "INC" ) // d00c
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r) // hopper sensor
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") // hard reset
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset") // hard reset
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -2371,15 +2371,15 @@ static INPUT_PORTS_START( victor6 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Stats / Test") // Bookkeeping.
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Settings") // Game Rate & others.
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats / Test") // Bookkeeping.
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") // Game Rate & others.
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT )
PORT_START( "INC" )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Hold 4 / Small")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset Switch") // hard reset
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset Switch") // hard reset
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Hold 5 / Big")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -2479,15 +2479,15 @@ static INPUT_PORTS_START( victor6a )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Stats / Test") // Bookkeeping.
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Settings") // Game Rate & others.
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats / Test") // Bookkeeping.
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") // Game Rate & others.
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT )
PORT_START( "INC" )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Hold 4 / Small")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset Switch") // hard reset
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset Switch") // hard reset
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Hold 5 / Big")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -2587,15 +2587,15 @@ static INPUT_PORTS_START( victor6b )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Stats / Test") // Bookkeeping.
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Settings") // Game Rate & others.
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats / Test") // Bookkeeping.
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") // Game Rate & others.
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT )
PORT_START( "INC" )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Hold 4 / Small")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset Switch") // hard reset
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Reset Switch") // hard reset
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Hold 5 / Big")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
diff --git a/src/mame/drivers/summit.cpp b/src/mame/drivers/summit.cpp
index 32aeee755c6..cae989060f8 100644
--- a/src/mame/drivers/summit.cpp
+++ b/src/mame/drivers/summit.cpp
@@ -170,7 +170,7 @@ static INPUT_PORTS_START( summit )
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_START("IN3")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_NAME("Start")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start")
PORT_DIPNAME( 0x02, 0x02, "IN3-02" )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
diff --git a/src/mame/drivers/tankbatt.cpp b/src/mame/drivers/tankbatt.cpp
index 8dab5811de0..85880fbee91 100644
--- a/src/mame/drivers/tankbatt.cpp
+++ b/src/mame/drivers/tankbatt.cpp
@@ -266,7 +266,7 @@ void tankbatt_state::tankbatt(machine_config &config)
NETLIST_LOGIC_INPUT(config, "sound_nl:shoot", "SHOOT.IN", 0);
NETLIST_LOGIC_INPUT(config, "sound_nl:hit", "HIT.IN", 0);
- NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "R35.2").set_mult_offset(10000.0, 0.0);
+ NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "R35.2").set_mult_offset(10000.0 / 32768.0, 0.0);
}
diff --git a/src/mame/drivers/thedealr.cpp b/src/mame/drivers/thedealr.cpp
index f84827ab4de..2c25046b753 100644
--- a/src/mame/drivers/thedealr.cpp
+++ b/src/mame/drivers/thedealr.cpp
@@ -352,7 +352,7 @@ static INPUT_PORTS_START( thedealr )
PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset") // RST (reset)
PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_GAMBLE_KEYOUT ) // PAY
PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SERVICE2 ) // (unused?)
- PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_POKER_BET ) // BET (bet)
+ PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_GAMBLE_BET ) // BET (bet)
PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_POKER_CANCEL ) // MET (cancel? keep pressed to show stats)
PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_GAMBLE_HIGH ) PORT_NAME("Big") // BIG (big)
PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_GAMBLE_D_UP ) // D.U (double up?)
diff --git a/src/mame/drivers/unkpoker.cpp b/src/mame/drivers/unkpoker.cpp
index 331caac43aa..1445d167f1d 100644
--- a/src/mame/drivers/unkpoker.cpp
+++ b/src/mame/drivers/unkpoker.cpp
@@ -114,7 +114,7 @@ static INPUT_PORTS_START( unkpoker )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // does something
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_BET ) PORT_NAME("Ante")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Ante")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
diff --git a/src/mame/drivers/vpoker.cpp b/src/mame/drivers/vpoker.cpp
index 6c7f004641a..3726652a37a 100644
--- a/src/mame/drivers/vpoker.cpp
+++ b/src/mame/drivers/vpoker.cpp
@@ -199,7 +199,7 @@ void vpoker_state::main_map(address_map &map)
static INPUT_PORTS_START( vpoker )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(3) PORT_NAME("Coin In")
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_BET )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BET )
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
diff --git a/src/mame/drivers/zeebo_qualcomm_adreno130.cpp b/src/mame/drivers/zeebo_qualcomm_adreno130.cpp
index 3978046dfaf..0676971370d 100644
--- a/src/mame/drivers/zeebo_qualcomm_adreno130.cpp
+++ b/src/mame/drivers/zeebo_qualcomm_adreno130.cpp
@@ -22,7 +22,7 @@ System was launched in 2009, but discontinued shortly after.
Games were downloaded to NAND, but once the online store was closed the games could
no longer be downloaded, leaving no way to get them back onto the system after
-after a factory restore or similar.
+doing a factory restore or similar.
----
diff --git a/src/mame/drivers/zn.cpp b/src/mame/drivers/zn.cpp
index 36c5a225c4e..be74c58e3f8 100644
--- a/src/mame/drivers/zn.cpp
+++ b/src/mame/drivers/zn.cpp
@@ -2563,9 +2563,28 @@ static INPUT_PORTS_START( nbajamex )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4)
INPUT_PORTS_END
-static INPUT_PORTS_START( zn4w )
+static INPUT_PORTS_START( zn6b )
PORT_INCLUDE( zn )
+ PORT_MODIFY("SYSTEM")
+ PORT_BIT( 0xcc, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_MODIFY("P3")
+ PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 )
+
+ PORT_MODIFY("P4")
+ PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
+INPUT_PORTS_END
+
+static INPUT_PORTS_START( tgm )
+ PORT_INCLUDE( zn6b )
+
PORT_MODIFY("P1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1)
@@ -2578,36 +2597,23 @@ static INPUT_PORTS_START( zn4w )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2)
- PORT_MODIFY("P3")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(3)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(3)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(3)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(3)
-
- PORT_MODIFY("P4")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(4)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(4)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(4)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(4)
-INPUT_PORTS_END
-
-static INPUT_PORTS_START( zn6b )
- PORT_INCLUDE( zn )
-
- PORT_MODIFY("SYSTEM")
- PORT_BIT( 0xcc, IP_ACTIVE_LOW, IPT_UNUSED )
+ /* Tetris: The Grand Master uses 6-button kick harness for debug inputs */
+ PORT_START("DEBUG")
+ PORT_CONFNAME( 0x01, 0x00, "Enable Debug Inputs" )
+ PORT_CONFSETTING( 0x00, DEF_STR( No ) )
+ PORT_CONFSETTING( 0x01, DEF_STR( Yes ) )
PORT_MODIFY("P3")
- PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 )
+ PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("DEBUG", 0x01, EQUALS, 0x00)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CONDITION("DEBUG", 0x01, EQUALS, 0x01)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CONDITION("DEBUG", 0x01, EQUALS, 0x01)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CONDITION("DEBUG", 0x01, EQUALS, 0x01)
PORT_MODIFY("P4")
- PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
+ PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("DEBUG", 0x01, EQUALS, 0x00)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_CONDITION("DEBUG", 0x01, EQUALS, 0x01)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_CONDITION("DEBUG", 0x01, EQUALS, 0x01)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_CONDITION("DEBUG", 0x01, EQUALS, 0x01)
INPUT_PORTS_END
static INPUT_PORTS_START( jdredd )
@@ -5244,7 +5250,7 @@ GAME( 1998, sfex2j, sfex2, coh3002c, zn6b, zn2_state, empty_init, R
GAME( 1998, plsmaswd, coh3002c, coh3002c, zn6b, zn2_state, empty_init, ROT0, "Capcom", "Plasma Sword: Nightmare of Bilstein (USA 980316)", MACHINE_IMPERFECT_SOUND )
GAME( 1998, plsmaswda, plsmaswd, coh3002c, zn6b, zn2_state, empty_init, ROT0, "Capcom", "Plasma Sword: Nightmare of Bilstein (Asia 980316)", MACHINE_IMPERFECT_SOUND )
GAME( 1998, stargld2, plsmaswd, coh3002c, zn6b, zn2_state, empty_init, ROT0, "Capcom", "Star Gladiator 2: Nightmare of Bilstein (Japan 980316)", MACHINE_IMPERFECT_SOUND )
-GAME( 1998, tgmj, coh3002c, coh3002c, zn4w, zn2_state, empty_init, ROT0, "Arika / Capcom", "Tetris: The Grand Master (Japan 980710)", MACHINE_IMPERFECT_SOUND )
+GAME( 1998, tgmj, coh3002c, coh3002c, tgm, zn2_state, empty_init, ROT0, "Arika / Capcom", "Tetris: The Grand Master (Japan 980710)", MACHINE_IMPERFECT_SOUND )
GAME( 1998, techromn, coh3002c, coh3002c, zn6b, zn2_state, empty_init, ROT0, "Capcom", "Tech Romancer (Euro 980914)", MACHINE_IMPERFECT_SOUND )
GAME( 1998, techromnu, techromn, coh3002c, zn6b, zn2_state, empty_init, ROT0, "Capcom", "Tech Romancer (USA 980914)", MACHINE_IMPERFECT_SOUND )
GAME( 1998, kikaioh, techromn, coh3002c, zn6b, zn2_state, empty_init, ROT0, "Capcom", "Choukou Senki Kikaioh (Japan 980914)", MACHINE_IMPERFECT_SOUND )
diff --git a/src/mame/includes/gridlee.h b/src/mame/includes/gridlee.h
index 2e420f74846..59314a1e903 100644
--- a/src/mame/includes/gridlee.h
+++ b/src/mame/includes/gridlee.h
@@ -101,7 +101,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
public:
void gridlee_sound_w(offs_t offset, uint8_t data);
diff --git a/src/mame/includes/mac.h b/src/mame/includes/mac.h
index bbca13d3c52..5164532102a 100644
--- a/src/mame/includes/mac.h
+++ b/src/mame/includes/mac.h
@@ -18,6 +18,7 @@
#include "machine/timer.h"
#include "machine/egret.h"
#include "machine/cuda.h"
+#include "machine/macadb.h"
#include "bus/nubus/nubus.h"
#include "bus/macpds/macpds.h"
#include "machine/applefdc.h"
@@ -36,14 +37,9 @@
#define MAC_539X_2_TAG "539x_2"
// model helpers
-#define ADB_IS_BITBANG ((mac->m_model == MODEL_MAC_SE || mac->m_model == MODEL_MAC_CLASSIC) || (mac->m_model >= MODEL_MAC_II && mac->m_model <= MODEL_MAC_IICI) || (mac->m_model == MODEL_MAC_SE30) || (mac->m_model == MODEL_MAC_QUADRA_700))
#define ADB_IS_BITBANG_CLASS ((m_model == MODEL_MAC_SE || m_model == MODEL_MAC_CLASSIC) || (m_model >= MODEL_MAC_II && m_model <= MODEL_MAC_IICI) || (m_model == MODEL_MAC_SE30) || (m_model == MODEL_MAC_QUADRA_700))
#define ADB_IS_EGRET (m_model >= MODEL_MAC_LC && m_model <= MODEL_MAC_CLASSIC_II) || ((m_model >= MODEL_MAC_IISI) && (m_model <= MODEL_MAC_IIVI))
-#define ADB_IS_EGRET_NONCLASS (mac->m_model >= MODEL_MAC_LC && mac->m_model <= MODEL_MAC_CLASSIC_II) || ((mac->m_model >= MODEL_MAC_IISI) && (mac->m_model <= MODEL_MAC_IIVI))
#define ADB_IS_CUDA ((m_model >= MODEL_MAC_COLOR_CLASSIC && m_model <= MODEL_MAC_LC_580) || ((m_model >= MODEL_MAC_QUADRA_660AV) && (m_model <= MODEL_MAC_QUADRA_630)) || (m_model >= MODEL_MAC_POWERMAC_6100))
-#define ADB_IS_CUDA_NONCLASS ((mac->m_model >= MODEL_MAC_COLOR_CLASSIC && mac->m_model <= MODEL_MAC_LC_580) || ((mac->m_model >= MODEL_MAC_QUADRA_660AV) && (mac->m_model <= MODEL_MAC_QUADRA_630)) || (mac->m_model >= MODEL_MAC_POWERMAC_6100))
-#define ADB_IS_PM_VIA1_CLASS (m_model >= MODEL_MAC_PORTABLE && m_model <= MODEL_MAC_PB100)
-#define ADB_IS_PM_VIA2_CLASS (m_model >= MODEL_MAC_PB140 && m_model <= MODEL_MAC_PBDUO_270c)
#define ADB_IS_PM_CLASS ((m_model >= MODEL_MAC_PORTABLE && m_model <= MODEL_MAC_PB100) || (m_model >= MODEL_MAC_PB140 && m_model <= MODEL_MAC_PBDUO_270c))
// video parameters for classic Macs
@@ -70,6 +66,7 @@ public:
m_awacs(*this, "awacs"),
m_egret(*this, EGRET_TAG),
m_cuda(*this, CUDA_TAG),
+ m_macadb(*this, "macadb"),
m_ram(*this, RAM_TAG),
m_scc(*this, "scc"),
m_539x_1(*this, MAC_539X_1_TAG),
@@ -77,20 +74,13 @@ public:
m_ncr5380(*this, "ncr5380"),
m_fdc(*this, "fdc"),
m_rtc(*this, "rtc"),
- m_mouse0(*this, "MOUSE0"),
- m_mouse1(*this, "MOUSE1"),
- m_mouse2(*this, "MOUSE2"),
- m_keys(*this, "KEY%u", 0),
m_montype(*this, "MONTYPE"),
- m_snd_enable(false),
m_main_buffer(true),
- m_snd_vol(7),
m_vram(*this,"vram"),
m_vram16(*this,"vram16"),
m_via2_ca1_hack(0),
m_screen(*this, "screen"),
- m_palette(*this, "palette"),
- m_dac(*this, "dac")
+ m_palette(*this, "palette")
{
m_rom_size = 0;
m_rom_ptr = nullptr;
@@ -99,7 +89,6 @@ public:
void add_scsi(machine_config &config, bool cdrom = false);
void add_base_devices(machine_config &config, bool rtc = true, bool super_woz = false);
void add_asc(machine_config &config, asc_device::asc_type type = asc_device::asc_type::ASC);
- void add_macplus_additions(machine_config &config);
void add_nubus(machine_config &config, bool bank1 = true, bool bank2 = true);
template <typename T> void add_nubus_pds(machine_config &config, const char *slot_tag, T &&opts);
void add_via1_adb(machine_config &config, bool macii);
@@ -109,15 +98,10 @@ public:
void add_egret(machine_config &config, int type);
void add_cuda(machine_config &config, int type);
- void mac512ke_base(machine_config &config);
- void mac512ke(machine_config &config);
- void macplus(machine_config &config);
void maclc(machine_config &config, bool cpu = true, bool egret = true, asc_device::asc_type asc_type = asc_device::asc_type::V8);
void macpb170(machine_config &config);
- void macclasc(machine_config &config);
void maciisi(machine_config &config);
void maclc2(machine_config &config, bool egret = true);
- void macse(machine_config &config);
void maclc3(machine_config &config, bool egret = true);
void macpd210(machine_config &config);
void maciici(machine_config &config);
@@ -244,7 +228,6 @@ public:
};
model_t m_model;
- int m_drive_select;
private:
required_device<cpu_device> m_maincpu;
@@ -254,6 +237,7 @@ private:
optional_device<awacs_device> m_awacs;
optional_device<egret_device> m_egret;
optional_device<cuda_device> m_cuda;
+ optional_device<macadb_device> m_macadb;
required_device<ram_device> m_ram;
required_device<scc8530_legacy_device> m_scc;
optional_device<ncr539x_device> m_539x_1;
@@ -262,8 +246,8 @@ private:
required_device<applefdc_base_device> m_fdc;
optional_device<rtc3430042_device> m_rtc;
- required_ioport m_mouse0, m_mouse1, m_mouse2;
- optional_ioport_array<7> m_keys;
+ //required_ioport m_mouse0, m_mouse1, m_mouse2;
+ //optional_ioport_array<7> m_keys;
optional_ioport m_montype;
virtual void machine_start() override;
@@ -279,7 +263,6 @@ private:
uint32_t m_overlay;
- int m_scsiirq_enable;
uint32_t m_via2_vbl;
uint32_t m_se30_vbl_enable;
@@ -289,45 +272,19 @@ private:
TIMER_CALLBACK_MEMBER(overlay_timeout_func);
uint32_t rom_switch_r(offs_t offset);
- bool m_snd_enable;
bool m_main_buffer;
- int m_snd_vol;
-
- /* keyboard matrix to detect transition - macadb needs to stop relying on this */
- int m_key_matrix[7];
-
- int m_mouse_bit_x;
- int m_mouse_bit_y;
- int last_mx, last_my;
- int count_x, count_y;
- int m_last_was_x;
+ int m_adb_irq_pending;
int m_screen_buffer;
-
int irq_count, ca1_data, ca2_data;
- // Mac ADB state
- int32_t m_adb_irq_pending, m_adb_waiting_cmd, m_adb_datasize, m_adb_buffer[257];
- int32_t m_adb_state, m_adb_command, m_adb_send, m_adb_timer_ticks, m_adb_extclock, m_adb_direction;
- int32_t m_adb_listenreg, m_adb_listenaddr, m_adb_last_talk, m_adb_srq_switch;
- int32_t m_adb_stream_ptr;
- int32_t m_adb_linestate;
- bool m_adb_srqflag;
-#define kADBKeyBufSize 32
- uint8_t m_adb_keybuf[kADBKeyBufSize];
- uint8_t m_adb_keybuf_start;
- uint8_t m_adb_keybuf_end;
-
- // Portable/PB100 Power Manager IC comms (chapter 4, "Guide to the Macintosh Family Hardware", second edition)
- uint8_t m_pm_data_send, m_pm_data_recv, m_pm_ack, m_pm_req, m_pm_cmd[32], m_pm_out[32], m_pm_dptr, m_pm_sptr, m_pm_slen, m_pm_state;
- uint8_t m_pmu_int_status, m_pmu_last_adb_command, m_pmu_poll;
- emu_timer *m_pmu_send_timer;
-
// 60.15 Hz timer for RBV/V8/Sonora/Eagle/VASP/etc.
emu_timer *m_6015_timer;
// ADB refresh timer, independent of anything else going on
emu_timer *m_adbupdate_timer;
+ WRITE_LINE_MEMBER(adb_irq_w) { m_adb_irq_pending = state; }
+
// RBV and friends (V8, etc)
uint8_t m_rbv_regs[256], m_rbv_ier, m_rbv_ifr, m_rbv_type, m_rbv_montype, m_rbv_vbltime;
uint32_t m_rbv_colors[3], m_rbv_count, m_rbv_clutoffs, m_rbv_immed10wr;
@@ -357,12 +314,7 @@ private:
void set_via2_interrupt(int value);
void field_interrupts();
void vblank_irq();
- void adb_talk();
- void mouse_callback();
void rbv_recalc_irqs();
- void pmu_exec();
- void mac_adb_newaction(int state);
- void set_adb_line(int linestate);
void update_volume();
uint16_t mac_via_r(offs_t offset);
@@ -435,12 +387,10 @@ private:
DECLARE_WRITE_LINE_MEMBER(drq_539x_1_w);
DECLARE_WRITE_LINE_MEMBER(cuda_reset_w);
- DECLARE_WRITE_LINE_MEMBER(adb_linechange_w);
DECLARE_WRITE_LINE_MEMBER(mac_scsi_irq);
DECLARE_WRITE_LINE_MEMBER(mac_asc_irq);
-
void mac512ke_map(address_map &map);
void macii_map(address_map &map);
void maciici_map(address_map &map);
@@ -458,29 +408,11 @@ private:
void pwrmac_map(address_map &map);
void quadra700_map(address_map &map);
- int has_adb();
- void adb_reset();
- void adb_vblank();
- int adb_pollkbd(int update);
- int adb_pollmouse();
- void adb_accummouse( uint8_t *MouseX, uint8_t *MouseY );
- void pmu_one_byte_reply(uint8_t result);
- void pmu_three_byte_reply(uint8_t result1, uint8_t result2, uint8_t result3);
+ inline bool has_adb() { return m_model >= MODEL_MAC_SE; }
// wait states for accessing the VIA
int m_via_cycles;
- // ADB mouse state
- int m_adb_mouseaddr;
- int m_adb_lastmousex, m_adb_lastmousey, m_adb_lastbutton, m_adb_mouse_initialized;
-
- // ADB keyboard state
- int m_adb_keybaddr;
- int m_adb_keybinitialized, m_adb_currentkeys[2], m_adb_modifiers;
-
- // PRAM for ADB MCU HLEs (mostly unused now)
- uint8_t m_adb_pram[256];
-
uint8_t m_oss_regs[0x400];
// AMIC for x100 PowerMacs
@@ -492,13 +424,13 @@ private:
int m_via2_ca1_hack;
optional_device<screen_device> m_screen;
optional_device<palette_device> m_palette;
- optional_device<dac_8bit_pwm_device> m_dac;
uint32_t m_rom_size;
uint32_t *m_rom_ptr;
emu_timer *m_scanline_timer;
- emu_timer *m_adb_timer;
+
+ uint8_t m_pm_req, m_pm_state, m_pm_dptr, m_pm_cmd;
void macgsc_palette(palette_device &palette) const;
@@ -529,8 +461,6 @@ private:
TIMER_CALLBACK_MEMBER(mac_scanline_tick);
TIMER_CALLBACK_MEMBER(dafb_vbl_tick);
TIMER_CALLBACK_MEMBER(dafb_cursor_tick);
- TIMER_CALLBACK_MEMBER(mac_adb_tick); // macadb.c
- TIMER_CALLBACK_MEMBER(mac_pmu_tick); // macadb.c
DECLARE_WRITE_LINE_MEMBER(mac_adb_via_out_cb2);
uint8_t mac_via_in_a();
uint8_t mac_via_in_b();
diff --git a/src/mame/includes/p2000t.h b/src/mame/includes/p2000t.h
index 3999d02c345..d0f2654f6f2 100644
--- a/src/mame/includes/p2000t.h
+++ b/src/mame/includes/p2000t.h
@@ -14,6 +14,7 @@
#include "cpu/z80/z80.h"
#include "sound/spkrdev.h"
#include "video/saa5050.h"
+#include "machine/p2000t_mdcr.h"
#include "emupal.h"
@@ -25,6 +26,7 @@ public:
, m_videoram(*this, "videoram")
, m_maincpu(*this, "maincpu")
, m_speaker(*this, "speaker")
+ , m_mdcr(*this, "mdcr")
, m_keyboard(*this, "KEY.%u", 0)
{
}
@@ -52,6 +54,8 @@ protected:
required_device<cpu_device> m_maincpu;
required_device<speaker_sound_device> m_speaker;
+ // Only the P2000t has this device.
+ optional_device<mdcr_device> m_mdcr;
private:
required_ioport_array<10> m_keyboard;
diff --git a/src/mame/includes/pdp1.h b/src/mame/includes/pdp1.h
index 102554eb438..cf7338f18ac 100644
--- a/src/mame/includes/pdp1.h
+++ b/src/mame/includes/pdp1.h
@@ -168,59 +168,214 @@ enum
pen_lightpen_pressed = pen_green
};
-/* tape reader registers */
-struct tape_reader_t
+class pdp1_state;
+
+// tape reader device
+class pdp1_readtape_image_device : public device_t,
+ public device_image_interface
{
- device_image_interface *fd; /* file descriptor of tape image */
+public:
+ // construction/destruction
+ pdp1_readtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0U);
+
+ auto st_ptr() { return m_st_ptr.bind(); }
+
+ void iot_rpa(int op2, int nac, int mb, int &io, int ac);
+ void iot_rpb(int op2, int nac, int mb, int &io, int ac);
+ void iot_rrb(int op2, int nac, int mb, int &io, int ac);
+
+protected:
+ // device-level overrides
+ virtual void device_resolve_objects() override;
+ virtual void device_start() override;
+
+ // image-level overrides
+ virtual iodevice_t image_type() const noexcept override { return IO_PUNCHTAPE; }
- int motor_on; /* 1-bit reader motor on */
+ virtual bool is_readable() const noexcept override { return true; }
+ virtual bool is_writeable() const noexcept override { return false; }
+ virtual bool is_creatable() const noexcept override { return false; }
+ virtual bool must_be_loaded() const noexcept override { return false; }
+ virtual bool is_reset_on_load() const noexcept override { return false; }
+ virtual const char *file_extensions() const noexcept override { return "tap,rim"; }
- int rb; /* 18-bit reader buffer */
- int rcl; /* 1-bit reader clutch */
- int rc; /* 2-bit reader counter */
- int rby; /* 1-bit reader binary mode flip-flop */
- int rcp; /* 1-bit reader "need a completion pulse" flip-flop */
+ virtual image_init_result call_load() override;
+ virtual void call_unload() override;
+
+public:
+ TIMER_CALLBACK_MEMBER(reader_callback);
+
+ int tape_read(uint8_t *reply);
+ void begin_tape_read(int binary, int nac);
- emu_timer *timer; /* timer to simulate reader timing */
+ required_device<pdp1_device> m_maincpu;
+
+ devcb_write_line m_st_ptr;
+
+ int m_motor_on; // 1-bit reader motor on
+
+ int m_rb; // 18-bit reader buffer
+ int m_rcl; // 1-bit reader clutch
+ int m_rc; // 2-bit reader counter
+ int m_rby; // 1-bit reader binary mode flip-flop
+ int m_rcp; // 1-bit reader "need a completion pulse" flip-flop
+
+ emu_timer *m_timer; // timer to simulate reader timing
};
-/* tape puncher registers */
-struct tape_puncher_t
+// tape puncher device
+class pdp1_punchtape_image_device : public device_t,
+ public device_image_interface
{
- device_image_interface *fd; /* file descriptor of tape image */
+public:
+ // construction/destruction
+ pdp1_punchtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0U);
+
+ auto st_ptp() { return m_st_ptp.bind(); }
+
+ void iot_ppa(int op2, int nac, int mb, int &io, int ac);
+ void iot_ppb(int op2, int nac, int mb, int &io, int ac);
+
+protected:
+ // device-level overrides
+ virtual void device_resolve_objects() override;
+ virtual void device_start() override;
+
+ // image-level overrides
+ virtual iodevice_t image_type() const noexcept override { return IO_PUNCHTAPE; }
+
+ virtual bool is_readable() const noexcept override { return false; }
+ virtual bool is_writeable() const noexcept override { return true; }
+ virtual bool is_creatable() const noexcept override { return true; }
+ virtual bool must_be_loaded() const noexcept override { return false; }
+ virtual bool is_reset_on_load() const noexcept override { return false; }
+ virtual const char *file_extensions() const noexcept override { return "tap,rim"; }
- emu_timer *timer; /* timer to generate completion pulses */
+ virtual image_init_result call_load() override;
+ virtual void call_unload() override;
+
+public:
+ TIMER_CALLBACK_MEMBER(puncher_callback);
+
+ void tape_write(uint8_t data);
+
+ required_device<pdp1_device> m_maincpu;
+
+ devcb_write_line m_st_ptp;
+
+ emu_timer *m_timer; // timer to generate completion pulses
};
-/* typewriter registers */
-struct typewriter_t
+// typewriter device
+class pdp1_typewriter_device : public device_t,
+ public device_image_interface
{
- device_image_interface *fd; /* file descriptor of output image */
+public:
+ // construction/destruction
+ pdp1_typewriter_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0U);
+
+ auto st_tyo() { return m_st_tyo.bind(); }
+ auto st_tyi() { return m_st_tyi.bind(); }
- int tb; /* typewriter buffer */
+ void iot_tyo(int op2, int nac, int mb, int &io, int ac);
+ void iot_tyi(int op2, int nac, int mb, int &io, int ac);
+
+protected:
+ // device-level overrides
+ virtual void device_resolve_objects() override;
+ virtual void device_start() override;
+
+ // image-level overrides
+ virtual iodevice_t image_type() const noexcept override { return IO_PRINTER; }
+
+ virtual bool is_readable() const noexcept override { return false; }
+ virtual bool is_writeable() const noexcept override { return true; }
+ virtual bool is_creatable() const noexcept override { return true; }
+ virtual bool must_be_loaded() const noexcept override { return false; }
+ virtual bool is_reset_on_load() const noexcept override { return false; }
+ virtual const char *file_extensions() const noexcept override { return "typ"; }
+
+ virtual image_init_result call_load() override;
+ virtual void call_unload() override;
+
+public:
+ TIMER_CALLBACK_MEMBER(tyo_callback);
+
+ void linefeed();
+ void drawchar(int character);
+ void typewriter_out(uint8_t data);
+
+ void pdp1_keyboard();
- emu_timer *tyo_timer;/* timer to generate completion pulses */
+ required_device<pdp1_device> m_maincpu;
+ required_device<pdp1_state> m_driver_state;
+ required_ioport_array<4> m_twr;
+
+ devcb_write_line m_st_tyo;
+ devcb_write_line m_st_tyi;
+
+ int m_tb; // typewriter buffer
+
+ emu_timer *m_tyo_timer; // timer to generate completion pulses
+
+ int m_old_typewriter_keys[4];
+ int m_color;
+ bitmap_ind16 m_bitmap;
+ int m_pos;
+ int m_case_shift;
};
-/* MIT parallel drum (mostly similar to type 23) */
-struct parallel_drum_t
+// MIT parallel drum (mostly similar to type 23)
+class pdp1_cylinder_image_device : public device_t,
+ public device_image_interface
{
- device_image_interface *fd; /* file descriptor of drum image */
+public:
+ // construction/destruction
+ pdp1_cylinder_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0U);
+
+ void iot_dia(int op2, int nac, int mb, int &io, int ac);
+ void iot_dba(int op2, int nac, int mb, int &io, int ac);
+ void iot_dcc(int op2, int nac, int mb, int &io, int ac);
+ void iot_dra(int op2, int nac, int mb, int &io, int ac);
- int il; /* initial location (12-bit) */
- int wc; /* word counter (12-bit) */
- int wcl; /* word core location counter (16-bit) */
- int rfb; /* read field buffer (5-bit) */
- int wfb; /* write field buffer (5-bit) */
+protected:
+ // device-level overrides
+ virtual void device_start() override;
- int dba;
+ // image-level overrides
+ virtual iodevice_t image_type() const noexcept override { return IO_CYLINDER; }
- emu_timer *rotation_timer; /* timer called each time dc is 0 */
- emu_timer *il_timer; /* timer called each time dc is il */
+ virtual bool is_readable() const noexcept override { return true; }
+ virtual bool is_writeable() const noexcept override { return true; }
+ virtual bool is_creatable() const noexcept override { return true; }
+ virtual bool must_be_loaded() const noexcept override { return false; }
+ virtual bool is_reset_on_load() const noexcept override { return false; }
+ virtual const char *file_extensions() const noexcept override { return "drm"; }
+
+ virtual image_init_result call_load() override;
+ virtual void call_unload() override;
+
+public:
+ void set_il(int il);
+ uint32_t drum_read(int field, int position);
+ void drum_write(int field, int position, uint32_t data);
+
+ required_device<pdp1_device> m_maincpu;
+
+ int m_il; // initial location (12-bit)
+ int m_wc; // word counter (12-bit)
+ int m_wcl; // word core location counter (16-bit)
+ int m_rfb; // read field buffer (5-bit)
+ int m_wfb; // write field buffer (5-bit)
+
+ int m_dba;
+
+ emu_timer *m_rotation_timer;// timer called each time dc is 0
+ emu_timer *m_il_timer; // timer called each time dc is il
};
@@ -239,6 +394,10 @@ public:
pdp1_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
+ m_tape_reader(*this, "readt"),
+ m_tape_puncher(*this, "punch"),
+ m_typewriter(*this, "typewriter"),
+ m_parallel_drum(*this, "drum"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_crt(*this, "crt"),
@@ -248,21 +407,20 @@ public:
m_tstadd(*this, "TSTADD"),
m_twdmsb(*this, "TWDMSB"),
m_twdlsb(*this, "TWDLSB"),
- m_twr(*this, "TWR.%u", 0),
m_cfg(*this, "CFG"),
m_io_lightpen(*this, "LIGHTPEN"),
m_lightx(*this, "LIGHTX"),
m_lighty(*this, "LIGHTY")
{ }
+ required_device<pdp1_device> m_maincpu;
+ required_device<pdp1_readtape_image_device> m_tape_reader;
+ required_device<pdp1_punchtape_image_device> m_tape_puncher;
+ required_device<pdp1_typewriter_device> m_typewriter;
+ required_device<pdp1_cylinder_image_device> m_parallel_drum;
int m_io_status;
- tape_reader_t m_tape_reader;
- tape_puncher_t m_tape_puncher;
- typewriter_t m_typewriter;
emu_timer *m_dpy_timer;
lightpen_t m_lightpen;
- parallel_drum_t m_parallel_drum;
- required_device<pdp1_device> m_maincpu;
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -271,9 +429,6 @@ public:
uint32_t screen_update_pdp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_pdp1);
INTERRUPT_GEN_MEMBER(pdp1_interrupt);
- TIMER_CALLBACK_MEMBER(reader_callback);
- TIMER_CALLBACK_MEMBER(puncher_callback);
- TIMER_CALLBACK_MEMBER(tyo_callback);
TIMER_CALLBACK_MEMBER(dpy_callback);
void pdp1_machine_stop();
inline void pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color);
@@ -286,39 +441,35 @@ public:
void pdp1_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color);
void pdp1_draw_panel_backdrop(bitmap_ind16 &bitmap);
void pdp1_draw_panel(bitmap_ind16 &bitmap);
- void pdp1_typewriter_linefeed();
- void pdp1_typewriter_drawchar(int character);
void pdp1_update_lightpen_state(const lightpen_t *new_state);
void pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color_);
void pdp1_erase_lightpen(bitmap_ind16 &bitmap);
void pdp1_draw_lightpen(bitmap_ind16 &bitmap);
- int tape_read(uint8_t *reply);
- void begin_tape_read(int binary, int nac);
- void tape_write(uint8_t data);
- void typewriter_out(uint8_t data);
- void parallel_drum_set_il(int il);
- uint32_t drum_read(int field, int position);
- void drum_write(int field, int position, uint32_t data);
- void pdp1_keyboard();
void pdp1_lightpen();
- int read_spacewar() { return m_spacewar->read(); }
+
+ template <int Mask> DECLARE_WRITE_LINE_MEMBER(io_status_w);
void pdp1(machine_config &config);
void pdp1_map(address_map &map);
private:
+ void iot_dpy(int op2, int nac, int mb, int &io, int ac);
+
+ void iot_011(int op2, int nac, int mb, int &io, int ac);
+
+ void iot_cks(int op2, int nac, int mb, int &io, int ac);
+
+ void io_start_clear();
+
pdp1_reset_param_t m_reset_param;
- int m_old_typewriter_keys[4];
int m_old_lightpen;
int m_old_control_keys;
int m_old_tw_keys;
int m_old_ta_keys;
- int m_typewriter_color;
bitmap_ind16 m_panel_bitmap;
- bitmap_ind16 m_typewriter_bitmap;
lightpen_t m_lightpen_state;
lightpen_t m_previous_lightpen_state;
- int m_pos;
- int m_case_shift;
+
+public:
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<crt_device> m_crt;
@@ -328,7 +479,6 @@ private:
required_ioport m_tstadd;
required_ioport m_twdmsb;
required_ioport m_twdlsb;
- required_ioport_array<4> m_twr;
required_ioport m_cfg;
required_ioport m_io_lightpen;
required_ioport m_lightx;
diff --git a/src/mame/includes/segag80r.h b/src/mame/includes/segag80r.h
index 7846fab93b3..14bb5af7651 100644
--- a/src/mame/includes/segag80r.h
+++ b/src/mame/includes/segag80r.h
@@ -211,7 +211,7 @@ protected:
virtual void device_start() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
// internal state
diff --git a/src/mame/includes/turrett.h b/src/mame/includes/turrett.h
index c77c26f70c7..cce1f821f56 100644
--- a/src/mame/includes/turrett.h
+++ b/src/mame/includes/turrett.h
@@ -121,7 +121,7 @@ protected:
virtual void device_reset() override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
diff --git a/src/mame/includes/xavix.h b/src/mame/includes/xavix.h
index f6ddc11e8e3..22d4b584d3a 100644
--- a/src/mame/includes/xavix.h
+++ b/src/mame/includes/xavix.h
@@ -48,7 +48,7 @@ protected:
virtual void device_reset() override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
private:
sound_stream *m_stream;
diff --git a/src/mame/layout/aci_ggm.lay b/src/mame/layout/aci_ggm.lay
index 42c92f0db4d..45c32e621cb 100644
--- a/src/mame/layout/aci_ggm.lay
+++ b/src/mame/layout/aci_ggm.lay
@@ -242,104 +242,104 @@ license:CC0
<element ref="brown" blend="add"><bounds x="9.25" y="8.35" width="1" height="1.3" /></element>
<element ref="brown" blend="add"><bounds x="13.25" y="8.35" width="1" height="1.3" /></element>
- <element ref="brown_nb" inputtag="IN.6" inputmask="0x0f" inputraw="1"><bounds x="5.25" y="4.85" width="1" height="1.3" /></element>
- <element ref="brown_nb" inputtag="IN.6" inputmask="0x0f" inputraw="1"><bounds x="9.25" y="4.85" width="1" height="1.3" /></element>
- <element ref="brown_nb" inputtag="IN.6" inputmask="0x0f" inputraw="1"><bounds x="13.25" y="4.85" width="1" height="1.3" /></element>
- <element ref="brown_nb" inputtag="IN.6" inputmask="0x0f" inputraw="1"><bounds x="5.25" y="8.35" width="1" height="1.3" /></element>
- <element ref="brown_nb" inputtag="IN.6" inputmask="0x0f" inputraw="1"><bounds x="9.25" y="8.35" width="1" height="1.3" /></element>
- <element ref="brown_nb" inputtag="IN.6" inputmask="0x0f" inputraw="1"><bounds x="13.25" y="8.35" width="1" height="1.3" /></element>
+ <element ref="brown_nb" inputtag="IN.6" inputmask="0x0f" inputraw="yes"><bounds x="5.25" y="4.85" width="1" height="1.3" /></element>
+ <element ref="brown_nb" inputtag="IN.6" inputmask="0x0f" inputraw="yes"><bounds x="9.25" y="4.85" width="1" height="1.3" /></element>
+ <element ref="brown_nb" inputtag="IN.6" inputmask="0x0f" inputraw="yes"><bounds x="13.25" y="4.85" width="1" height="1.3" /></element>
+ <element ref="brown_nb" inputtag="IN.6" inputmask="0x0f" inputraw="yes"><bounds x="5.25" y="8.35" width="1" height="1.3" /></element>
+ <element ref="brown_nb" inputtag="IN.6" inputmask="0x0f" inputraw="yes"><bounds x="9.25" y="8.35" width="1" height="1.3" /></element>
+ <element ref="brown_nb" inputtag="IN.6" inputmask="0x0f" inputraw="yes"><bounds x="13.25" y="8.35" width="1" height="1.3" /></element>
<!-- boris overlay -->
- <element ref="text_boris01" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.1" y="1.0" width="3.3" height="0.8" /></element>
- <element ref="text_boris02" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="4.1" y="0.1" width="3.3" height="1.3" /></element>
- <element ref="text_boris03" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="0.1" width="3.3" height="1.3" /></element>
- <element ref="text_boris04" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="12.1" y="0.5" width="3.3" height="1.7" /></element>
- <element ref="text_boris05" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="16.1" y="0.7" width="3.3" height="1.3" /></element>
-
- <element ref="text_boris06a" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.9" y="4.25" width="2.8" height="0.8" /></element>
- <element ref="text_boris06b" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.9" y="4.95" width="2.8" height="0.8" /></element>
- <element ref="text_boris07" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="4.1" y="3.6" width="3.3" height="1.3" /></element>
- <element ref="text_boris08" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="3.6" width="3.3" height="1.3" /></element>
- <element ref="text_boris09" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="12.1" y="3.6" width="3.3" height="1.3" /></element>
- <element ref="text_boris10" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="16.1" y="4.5" width="3.3" height="0.8" /></element>
-
- <element ref="text_boris11" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.1" y="8.0" width="3.3" height="0.8" /></element>
- <element ref="text_boris12" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="4.1" y="7.1" width="3.3" height="1.3" /></element>
- <element ref="text_boris13" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="7.1" width="3.3" height="1.3" /></element>
- <element ref="text_boris14" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="12.1" y="7.1" width="3.3" height="1.3" /></element>
- <element ref="text_boris15" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="16.1" y="8.0" width="3.3" height="0.8" /></element>
-
- <element ref="text_boris16" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.1" y="11.5" width="3.3" height="0.8" /></element>
- <element ref="text_boris17" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="4.1" y="11.0" width="3.3" height="1.7" /></element>
- <element ref="text_boris18" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="11.0" width="3.3" height="1.7" /></element>
- <element ref="text_boris19" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="12.1" y="11.2" width="3.3" height="1.3" /></element>
- <element ref="text_boris20" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="16.1" y="11.5" width="3.3" height="0.8" /></element>
+ <element ref="text_boris01" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.1" y="1.0" width="3.3" height="0.8" /></element>
+ <element ref="text_boris02" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="4.1" y="0.1" width="3.3" height="1.3" /></element>
+ <element ref="text_boris03" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="0.1" width="3.3" height="1.3" /></element>
+ <element ref="text_boris04" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="12.1" y="0.5" width="3.3" height="1.7" /></element>
+ <element ref="text_boris05" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="16.1" y="0.7" width="3.3" height="1.3" /></element>
+
+ <element ref="text_boris06a" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.9" y="4.25" width="2.8" height="0.8" /></element>
+ <element ref="text_boris06b" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.9" y="4.95" width="2.8" height="0.8" /></element>
+ <element ref="text_boris07" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="4.1" y="3.6" width="3.3" height="1.3" /></element>
+ <element ref="text_boris08" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="3.6" width="3.3" height="1.3" /></element>
+ <element ref="text_boris09" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="12.1" y="3.6" width="3.3" height="1.3" /></element>
+ <element ref="text_boris10" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="16.1" y="4.5" width="3.3" height="0.8" /></element>
+
+ <element ref="text_boris11" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.1" y="8.0" width="3.3" height="0.8" /></element>
+ <element ref="text_boris12" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="4.1" y="7.1" width="3.3" height="1.3" /></element>
+ <element ref="text_boris13" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="7.1" width="3.3" height="1.3" /></element>
+ <element ref="text_boris14" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="12.1" y="7.1" width="3.3" height="1.3" /></element>
+ <element ref="text_boris15" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="16.1" y="8.0" width="3.3" height="0.8" /></element>
+
+ <element ref="text_boris16" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.1" y="11.5" width="3.3" height="0.8" /></element>
+ <element ref="text_boris17" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="4.1" y="11.0" width="3.3" height="1.7" /></element>
+ <element ref="text_boris18" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="11.0" width="3.3" height="1.7" /></element>
+ <element ref="text_boris19" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="12.1" y="11.2" width="3.3" height="1.3" /></element>
+ <element ref="text_boris20" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="16.1" y="11.5" width="3.3" height="0.8" /></element>
<!-- morphy overlay -->
- <element ref="text_morphy01" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.1" y="1.0" width="3.3" height="0.8" /></element>
- <element ref="text_morphy02" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="4.1" y="0.1" width="3.3" height="1.3" /></element>
- <element ref="text_morphy03" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="0.1" width="3.3" height="1.3" /></element>
- <element ref="text_morphy04" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="12.1" y="1.0" width="3.3" height="0.8" /></element>
- <element ref="text_morphy05" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="16.1" y="0.7" width="3.3" height="1.3" /></element>
-
- <element ref="text_morphy06a" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.9" y="4.25" width="2.8" height="0.8" /></element>
- <element ref="text_morphy06b" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.9" y="4.95" width="2.8" height="0.8" /></element>
- <element ref="text_morphy07" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="4.1" y="3.6" width="3.3" height="1.3" /></element>
- <element ref="text_morphy08" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="3.6" width="3.3" height="1.3" /></element>
- <element ref="text_morphy09" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="12.1" y="3.6" width="3.3" height="1.3" /></element>
- <element ref="text_morphy10" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="16.1" y="4.5" width="3.3" height="0.8" /></element>
-
- <element ref="text_morphy11" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.1" y="8.0" width="3.3" height="0.8" /></element>
- <element ref="text_morphy12" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="4.1" y="7.1" width="3.3" height="1.3" /></element>
- <element ref="text_morphy13" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="7.1" width="3.3" height="1.3" /></element>
- <element ref="text_morphy14" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="12.1" y="7.1" width="3.3" height="1.3" /></element>
- <element ref="text_morphy15" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="16.1" y="8.0" width="3.3" height="0.8" /></element>
-
- <element ref="text_morphy16" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.1" y="11.5" width="3.3" height="0.8" /></element>
- <element ref="text_morphy17" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="4.1" y="11.0" width="3.3" height="1.7" /></element>
- <element ref="text_morphy18" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="11.0" width="3.3" height="1.7" /></element>
- <element ref="text_morphy19" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="12.1" y="11.2" width="3.3" height="1.3" /></element>
- <element ref="text_morphy20" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="16.1" y="11.5" width="3.3" height="0.8" /></element>
+ <element ref="text_morphy01" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.1" y="1.0" width="3.3" height="0.8" /></element>
+ <element ref="text_morphy02" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="4.1" y="0.1" width="3.3" height="1.3" /></element>
+ <element ref="text_morphy03" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="0.1" width="3.3" height="1.3" /></element>
+ <element ref="text_morphy04" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="12.1" y="1.0" width="3.3" height="0.8" /></element>
+ <element ref="text_morphy05" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="16.1" y="0.7" width="3.3" height="1.3" /></element>
+
+ <element ref="text_morphy06a" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.9" y="4.25" width="2.8" height="0.8" /></element>
+ <element ref="text_morphy06b" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.9" y="4.95" width="2.8" height="0.8" /></element>
+ <element ref="text_morphy07" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="4.1" y="3.6" width="3.3" height="1.3" /></element>
+ <element ref="text_morphy08" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="3.6" width="3.3" height="1.3" /></element>
+ <element ref="text_morphy09" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="12.1" y="3.6" width="3.3" height="1.3" /></element>
+ <element ref="text_morphy10" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="16.1" y="4.5" width="3.3" height="0.8" /></element>
+
+ <element ref="text_morphy11" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.1" y="8.0" width="3.3" height="0.8" /></element>
+ <element ref="text_morphy12" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="4.1" y="7.1" width="3.3" height="1.3" /></element>
+ <element ref="text_morphy13" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="7.1" width="3.3" height="1.3" /></element>
+ <element ref="text_morphy14" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="12.1" y="7.1" width="3.3" height="1.3" /></element>
+ <element ref="text_morphy15" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="16.1" y="8.0" width="3.3" height="0.8" /></element>
+
+ <element ref="text_morphy16" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.1" y="11.5" width="3.3" height="0.8" /></element>
+ <element ref="text_morphy17" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="4.1" y="11.0" width="3.3" height="1.7" /></element>
+ <element ref="text_morphy18" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="11.0" width="3.3" height="1.7" /></element>
+ <element ref="text_morphy19" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="12.1" y="11.2" width="3.3" height="1.3" /></element>
+ <element ref="text_morphy20" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="16.1" y="11.5" width="3.3" height="0.8" /></element>
<!-- steinitz overlay -->
- <element ref="red_s3" inputtag="IN.6" inputmask="0x0f" inputraw="1"><bounds x="16.15" y="7.15" width="3.2" height="2.7" /></element>
- <element ref="brown_s3" inputtag="IN.6" inputmask="0x0f" inputraw="1"><bounds x="16.3" y="7.3" width="2.9" height="2.4" /></element>
-
- <element ref="green_s3" inputtag="IN.6" inputmask="0x0f" inputraw="1"><bounds x="0.15" y="10.65" width="3.2" height="2.7" /></element>
- <element ref="brown_s3" inputtag="IN.6" inputmask="0x0f" inputraw="1"><bounds x="0.3" y="10.8" width="2.9" height="2.4" /></element>
-
- <element ref="text_steinitz01a" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.1" y="0.5" width="3.3" height="0.8" /></element>
- <element ref="text_steinitz01b" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.1" y="1.5" width="3.3" height="0.8" /></element>
- <element ref="text_steinitz02" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="4.1" y="0.1" width="3.3" height="1.3" /></element>
- <element ref="text_steinitz03" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="0.1" width="3.3" height="1.3" /></element>
- <element ref="text_steinitz04a" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="12.1" y="0.5" width="3.3" height="0.8" /></element>
- <element ref="text_steinitz04b" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="12.1" y="1.5" width="3.3" height="1.1" /></element>
- <element ref="text_steinitz05" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="16.1" y="0.7" width="3.3" height="1.3" /></element>
-
- <element ref="text_steinitz06a" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.9" y="3.75" width="2.8" height="0.8" /></element>
- <element ref="text_steinitz06b" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.9" y="4.45" width="2.8" height="0.8" /></element>
- <element ref="text_steinitz06c" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.1" y="5.4" width="3.3" height="0.8" /></element>
- <element ref="text_steinitz07" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="4.1" y="3.6" width="3.3" height="1.3" /></element>
- <element ref="text_steinitz08" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="3.6" width="3.3" height="1.3" /></element>
- <element ref="text_steinitz09" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="12.1" y="3.6" width="3.3" height="1.3" /></element>
- <element ref="text_steinitz10a" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="16.1" y="4.0" width="3.3" height="0.8" /></element>
- <element ref="text_steinitz10b" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="16.1" y="5.0" width="3.3" height="0.8" /></element>
-
- <element ref="text_steinitz11a" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.1" y="7.5" width="3.3" height="0.8" /></element>
- <element ref="text_steinitz11b" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.1" y="8.5" width="3.3" height="0.8" /></element>
- <element ref="text_steinitz12" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="4.1" y="7.1" width="3.3" height="1.3" /></element>
- <element ref="text_steinitz13" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="7.1" width="3.3" height="1.3" /></element>
- <element ref="text_steinitz14" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="12.1" y="7.1" width="3.3" height="1.3" /></element>
- <element ref="text_steinitz15" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="16.1" y="8.0" width="3.3" height="0.8" /></element>
-
- <element ref="text_steinitz16" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="0.1" y="11.0" width="3.3" height="0.8" /></element>
- <element ref="text_steinitz17a" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="4.1" y="11.0" width="3.3" height="0.8" /></element>
- <element ref="text_steinitz17b" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="4.1" y="12.0" width="3.3" height="1.1" /></element>
- <element ref="text_steinitz18a" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="10.25" width="3.3" height="1.5" /></element>
- <element ref="text_steinitz18b" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="10.8" width="3.3" height="1.5" /></element>
- <element ref="text_steinitz18c" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="8.1" y="12.2" width="3.3" height="0.8" /></element>
- <element ref="text_steinitz19" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="12.1" y="11.2" width="3.3" height="1.3" /></element>
- <element ref="text_steinitz20" inputtag="IN.6" inputmask="0x0f" inputraw="1" blend="add"><bounds x="16.1" y="11.5" width="3.3" height="0.8" /></element>
+ <element ref="red_s3" inputtag="IN.6" inputmask="0x0f" inputraw="yes"><bounds x="16.15" y="7.15" width="3.2" height="2.7" /></element>
+ <element ref="brown_s3" inputtag="IN.6" inputmask="0x0f" inputraw="yes"><bounds x="16.3" y="7.3" width="2.9" height="2.4" /></element>
+
+ <element ref="green_s3" inputtag="IN.6" inputmask="0x0f" inputraw="yes"><bounds x="0.15" y="10.65" width="3.2" height="2.7" /></element>
+ <element ref="brown_s3" inputtag="IN.6" inputmask="0x0f" inputraw="yes"><bounds x="0.3" y="10.8" width="2.9" height="2.4" /></element>
+
+ <element ref="text_steinitz01a" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.1" y="0.5" width="3.3" height="0.8" /></element>
+ <element ref="text_steinitz01b" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.1" y="1.5" width="3.3" height="0.8" /></element>
+ <element ref="text_steinitz02" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="4.1" y="0.1" width="3.3" height="1.3" /></element>
+ <element ref="text_steinitz03" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="0.1" width="3.3" height="1.3" /></element>
+ <element ref="text_steinitz04a" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="12.1" y="0.5" width="3.3" height="0.8" /></element>
+ <element ref="text_steinitz04b" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="12.1" y="1.5" width="3.3" height="1.1" /></element>
+ <element ref="text_steinitz05" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="16.1" y="0.7" width="3.3" height="1.3" /></element>
+
+ <element ref="text_steinitz06a" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.9" y="3.75" width="2.8" height="0.8" /></element>
+ <element ref="text_steinitz06b" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.9" y="4.45" width="2.8" height="0.8" /></element>
+ <element ref="text_steinitz06c" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.1" y="5.4" width="3.3" height="0.8" /></element>
+ <element ref="text_steinitz07" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="4.1" y="3.6" width="3.3" height="1.3" /></element>
+ <element ref="text_steinitz08" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="3.6" width="3.3" height="1.3" /></element>
+ <element ref="text_steinitz09" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="12.1" y="3.6" width="3.3" height="1.3" /></element>
+ <element ref="text_steinitz10a" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="16.1" y="4.0" width="3.3" height="0.8" /></element>
+ <element ref="text_steinitz10b" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="16.1" y="5.0" width="3.3" height="0.8" /></element>
+
+ <element ref="text_steinitz11a" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.1" y="7.5" width="3.3" height="0.8" /></element>
+ <element ref="text_steinitz11b" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.1" y="8.5" width="3.3" height="0.8" /></element>
+ <element ref="text_steinitz12" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="4.1" y="7.1" width="3.3" height="1.3" /></element>
+ <element ref="text_steinitz13" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="7.1" width="3.3" height="1.3" /></element>
+ <element ref="text_steinitz14" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="12.1" y="7.1" width="3.3" height="1.3" /></element>
+ <element ref="text_steinitz15" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="16.1" y="8.0" width="3.3" height="0.8" /></element>
+
+ <element ref="text_steinitz16" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="0.1" y="11.0" width="3.3" height="0.8" /></element>
+ <element ref="text_steinitz17a" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="4.1" y="11.0" width="3.3" height="0.8" /></element>
+ <element ref="text_steinitz17b" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="4.1" y="12.0" width="3.3" height="1.1" /></element>
+ <element ref="text_steinitz18a" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="10.25" width="3.3" height="1.5" /></element>
+ <element ref="text_steinitz18b" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="10.8" width="3.3" height="1.5" /></element>
+ <element ref="text_steinitz18c" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="8.1" y="12.2" width="3.3" height="0.8" /></element>
+ <element ref="text_steinitz19" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="12.1" y="11.2" width="3.3" height="1.3" /></element>
+ <element ref="text_steinitz20" inputtag="IN.6" inputmask="0x0f" inputraw="yes" blend="add"><bounds x="16.1" y="11.5" width="3.3" height="0.8" /></element>
<!-- input highlights -->
<element ref="hl" inputtag="IN.3" inputmask="0x08"><bounds x="0" y="0" width="3.5" height="3" /><color alpha="0.22" /></element>
diff --git a/src/mame/layout/alphie.lay b/src/mame/layout/alphie.lay
index de54036991c..a9abb89f1ee 100644
--- a/src/mame/layout/alphie.lay
+++ b/src/mame/layout/alphie.lay
@@ -65,10 +65,10 @@ license:CC0
<element ref="text_q"><bounds x="8" y="0" width="10" height="2" /></element>
<element ref="text_ans"><bounds x="8" y="3" width="10" height="2" /></element>
<element ref="text_act"><bounds x="8" y="6" width="10" height="2" /></element>
- <element ref="nothing" inputtag="IN.1" inputmask="0x00" inputraw="1"><bounds x="14" y="-1" width="4" height="10" /></element>
- <element ref="switch_qa" inputtag="IN.1" inputmask="0x1f" inputraw="1"><bounds x="15" y="0" width="2" height="2" /></element>
- <element ref="switch_qa" inputtag="IN.2" inputmask="0x1f" inputraw="1"><bounds x="15" y="3" width="2" height="2" /></element>
- <element ref="switch_act" inputtag="IN.3" inputmask="0x0f" inputraw="1"><bounds x="15" y="6" width="2" height="2" /></element>
+ <element ref="nothing" inputtag="IN.1" inputmask="0x00" inputraw="yes"><bounds x="14" y="-1" width="4" height="10" /></element>
+ <element ref="switch_qa" inputtag="IN.1" inputmask="0x1f" inputraw="yes"><bounds x="15" y="0" width="2" height="2" /></element>
+ <element ref="switch_qa" inputtag="IN.2" inputmask="0x1f" inputraw="yes"><bounds x="15" y="3" width="2" height="2" /></element>
+ <element ref="switch_act" inputtag="IN.3" inputmask="0x0f" inputraw="yes"><bounds x="15" y="6" width="2" height="2" /></element>
</view>
</mamelayout>
diff --git a/src/mame/layout/apollo.lay b/src/mame/layout/apollo.lay
index 6aa352bd05f..4af2a34dcec 100644
--- a/src/mame/layout/apollo.lay
+++ b/src/mame/layout/apollo.lay
@@ -7,9 +7,9 @@ license:CC0
<mamelayout version="2">
- <element name="internal_led"> <disk> <color red="1.0" green="1.0" blue="1.0" /> </disk> </element>
- <element name="external_led"> <disk> <color red="0.666" green="0.555" blue="0.0" /> </disk> </element>
- <element name="power_led"> <disk> <color red="0.0" green="1.0" blue="0.0" /> </disk> </element>
+ <element name="internal_led"> <disk state="0"> <color red="1.0" green="1.0" blue="1.0" /> </disk> </element>
+ <element name="external_led"> <disk state="0"> <color red="0.666" green="0.555" blue="0.0" /> </disk> </element>
+ <element name="power_led"> <disk state="0"> <color red="0.0" green="1.0" blue="0.0" /> </disk> </element>
<element name="label_a"> <text string="A"> <color red="1.0" green="1.0" blue="1.0" /> </text> </element>
<element name="label_b"> <text string="B"> <color red="1.0" green="1.0" blue="1.0" /> </text> </element>
diff --git a/src/mame/layout/apollo_15i.lay b/src/mame/layout/apollo_15i.lay
index 8e01d548d81..f984555aae8 100644
--- a/src/mame/layout/apollo_15i.lay
+++ b/src/mame/layout/apollo_15i.lay
@@ -7,9 +7,9 @@ license:CC0
<mamelayout version="2">
- <element name="internal_led"> <disk> <color red="1.0" green="1.0" blue="1.0" /> </disk> </element>
- <element name="external_led"> <disk> <color red="0.666" green="0.555" blue="0.0" /> </disk> </element>
- <element name="power_led"> <disk> <color red="0.0" green="1.0" blue="0.0" /> </disk> </element>
+ <element name="internal_led"> <disk state="0"> <color red="1.0" green="1.0" blue="1.0" /> </disk> </element>
+ <element name="external_led"> <disk state="0"> <color red="0.666" green="0.555" blue="0.0" /> </disk> </element>
+ <element name="power_led"> <disk state="0"> <color red="0.0" green="1.0" blue="0.0" /> </disk> </element>
<element name="label_a"> <text string="A"> <color red="1.0" green="1.0" blue="1.0" /> </text> </element>
<element name="label_b"> <text string="B"> <color red="1.0" green="1.0" blue="1.0" /> </text> </element>
diff --git a/src/mame/layout/apollo_dsp.lay b/src/mame/layout/apollo_dsp.lay
index 97f6559b2bb..28be2b30f32 100644
--- a/src/mame/layout/apollo_dsp.lay
+++ b/src/mame/layout/apollo_dsp.lay
@@ -7,9 +7,9 @@ terminal display for the Apollo DSP3x00
<mamelayout version="2">
- <element name="internal_led"> <disk> <color red="1.0" green="1.0" blue="1.0" /> </disk> </element>
- <element name="external_led"> <disk> <color red="0.666" green="0.555" blue="0.0" /> </disk> </element>
- <element name="power_led"> <disk> <color red="0.0" green="1.0" blue="0.0" /> </disk> </element>
+ <element name="internal_led"> <disk state="0"> <color red="1.0" green="1.0" blue="1.0" /> </disk> </element>
+ <element name="external_led"> <disk state="0"> <color red="0.666" green="0.555" blue="0.0" /> </disk> </element>
+ <element name="power_led"> <disk state="0"> <color red="0.0" green="1.0" blue="0.0" /> </disk> </element>
<element name="label_a"> <text string="A"> <color red="1.0" green="1.0" blue="1.0" /> </text> </element>
<element name="label_b"> <text string="B"> <color red="1.0" green="1.0" blue="1.0" /> </text> </element>
<element name="label_c"> <text string="C"> <color red="1.0" green="1.0" blue="1.0" /> </text> </element>
diff --git a/src/mame/layout/conic_cchess2.lay b/src/mame/layout/conic_cchess2.lay
index 3c2310448f2..ff0e87c2a0c 100644
--- a/src/mame/layout/conic_cchess2.lay
+++ b/src/mame/layout/conic_cchess2.lay
@@ -467,8 +467,8 @@ license:CC0
<element ref="brown" blend="add"><bounds x="0" y="-1.2" width="88" height="18.5" /></element>
<element ref="bmask" blend="multiply"><bounds x="0" y="-1.2" width="88" height="18.5" /></element>
- <element ref="switch" inputtag="IN.0" inputmask="0x0c" inputraw="1"><bounds x="22.5" y="2.3" width="3.5" height="11.4" /></element>
- <element ref="switch" inputtag="IN.1" inputmask="0x03" inputraw="1"><bounds x="30.5" y="2.3" width="3.5" height="11.4" /></element>
+ <element ref="switch" inputtag="IN.0" inputmask="0x0c" inputraw="yes"><bounds x="22.5" y="2.3" width="3.5" height="11.4" /></element>
+ <element ref="switch" inputtag="IN.1" inputmask="0x03" inputraw="yes"><bounds x="30.5" y="2.3" width="3.5" height="11.4" /></element>
<element ref="but_dw" inputtag="RESET" inputmask="0x01"><bounds x="15.5" y="10.3" width="2.7" height="2.7" /></element>
<element ref="but_dw" inputtag="IN.4" inputmask="0x02"><bounds x="40.5" y="3" width="2.7" height="2.7" /></element>
diff --git a/src/mame/layout/copycat.lay b/src/mame/layout/copycat.lay
index a49dd9f7472..ded15900bd3 100644
--- a/src/mame/layout/copycat.lay
+++ b/src/mame/layout/copycat.lay
@@ -119,17 +119,17 @@ license:CC0
<element ref="text_b2"><bounds x="5.125" y="6.7" width="1.75" height="0.25" /></element>
<element ref="text_b3"><bounds x="6.2375" y="6.7" width="1.9" height="0.25" /></element>
- <element ref="nothing" inputtag="IN.2" inputmask="0x00" inputraw="1"><bounds x="6.25" y="4.9" width="1.2" height="0.5" /></element>
- <element ref="switch" inputtag="IN.1" inputmask="0x0f" inputraw="1"><bounds x="6.3" y="4.925" width="1" height="0.25" /></element>
+ <element ref="nothing" inputtag="IN.2" inputmask="0x00" inputraw="yes"><bounds x="6.25" y="4.9" width="1.2" height="0.5" /></element>
+ <element ref="switch" inputtag="IN.1" inputmask="0x0f" inputraw="yes"><bounds x="6.3" y="4.925" width="1" height="0.25" /></element>
<element ref="text_s1"><bounds x="5.15" y="4.925" width="1.5" height="0.25" /></element>
<element ref="text_ro"><bounds x="5.825" y="4.875" width="0.35" height="0.35" /></element>
- <element ref="nothing" inputtag="IN.1" inputmask="0x0f" inputraw="1"><bounds x="5.8" y="4.85" width="0.4" height="0.4" /></element>
+ <element ref="nothing" inputtag="IN.1" inputmask="0x0f" inputraw="yes"><bounds x="5.8" y="4.85" width="0.4" height="0.4" /></element>
- <element ref="nothing" inputtag="IN.2" inputmask="0x00" inputraw="1"><bounds x="6.25" y="7.2" width="1.2" height="0.5" /></element>
- <element ref="switch" inputtag="IN.2" inputmask="0x07" inputraw="1"><bounds x="6.3" y="7.275" width="1" height="0.25" /></element>
+ <element ref="nothing" inputtag="IN.2" inputmask="0x00" inputraw="yes"><bounds x="6.25" y="7.2" width="1.2" height="0.5" /></element>
+ <element ref="switch" inputtag="IN.2" inputmask="0x07" inputraw="yes"><bounds x="6.3" y="7.275" width="1" height="0.25" /></element>
<element ref="text_s2"><bounds x="5.15" y="7.275" width="1.5" height="0.25" /></element>
<element ref="text_rg"><bounds x="5.825" y="7.225" width="0.35" height="0.35" /></element>
- <element ref="nothing" inputtag="IN.2" inputmask="0x07" inputraw="1"><bounds x="5.8" y="7.2" width="0.4" height="0.4" /></element>
+ <element ref="nothing" inputtag="IN.2" inputmask="0x07" inputraw="yes"><bounds x="5.8" y="7.2" width="0.4" height="0.4" /></element>
<!-- main buttons and leds -->
diff --git a/src/mame/layout/ctstein.lay b/src/mame/layout/ctstein.lay
index ffbe26ef17a..5ae84b7d3b0 100644
--- a/src/mame/layout/ctstein.lay
+++ b/src/mame/layout/ctstein.lay
@@ -138,10 +138,10 @@ license:CC0
<element ref="text_dif"><bounds x="21.2" y="6.6" width="7.6" height="0.75" /></element>
<element ref="static_black"><bounds x="23.5" y="7.5" width="3.0" height="0.7" /></element>
- <element ref="switch1" inputtag="IN.0" inputmask="0x0f" inputraw="1"><bounds x="23.4" y="7.4" width="0.9" height="0.9" /></element>
- <element ref="switch2" inputtag="IN.0" inputmask="0x0f" inputraw="1"><bounds x="24.166" y="7.4" width="0.9" height="0.9" /></element>
- <element ref="switch3" inputtag="IN.0" inputmask="0x0f" inputraw="1"><bounds x="24.933" y="7.4" width="0.9" height="0.9" /></element>
- <element ref="switch4" inputtag="IN.0" inputmask="0x0f" inputraw="1"><bounds x="25.7" y="7.4" width="0.9" height="0.9" /></element>
+ <element ref="switch1" inputtag="IN.0" inputmask="0x0f" inputraw="yes"><bounds x="23.4" y="7.4" width="0.9" height="0.9" /></element>
+ <element ref="switch2" inputtag="IN.0" inputmask="0x0f" inputraw="yes"><bounds x="24.166" y="7.4" width="0.9" height="0.9" /></element>
+ <element ref="switch3" inputtag="IN.0" inputmask="0x0f" inputraw="yes"><bounds x="24.933" y="7.4" width="0.9" height="0.9" /></element>
+ <element ref="switch4" inputtag="IN.0" inputmask="0x0f" inputraw="yes"><bounds x="25.7" y="7.4" width="0.9" height="0.9" /></element>
<element ref="text_1"><bounds x="23.4" y="8.3" width="0.9" height="0.75" /></element>
<element ref="text_2"><bounds x="24.166" y="8.3" width="0.9" height="0.75" /></element>
<element ref="text_3"><bounds x="24.933" y="8.3" width="0.9" height="0.75" /></element>
diff --git a/src/mame/layout/esq1by22.lay b/src/mame/layout/esq1by22.lay
index 0595ab1536d..a0c8f7448d5 100644
--- a/src/mame/layout/esq1by22.lay
+++ b/src/mame/layout/esq1by22.lay
@@ -18,7 +18,7 @@ license:CC0
<repeat count="22">
<param name="n" start="0" increment="1" />
<param name="x" start="0" increment="19" />
- <element name="vfd0" ref="vfd0">
+ <element name="vfd~n~" ref="vfd0">
<bounds x="~x~" y="0" width="18" height="23" />
</element>
</repeat>
diff --git a/src/mame/layout/gp_1.lay b/src/mame/layout/gp_1.lay
index fc38651352d..307a2f3866e 100644
--- a/src/mame/layout/gp_1.lay
+++ b/src/mame/layout/gp_1.lay
@@ -11,7 +11,7 @@ copyright-holders:Robbbert
</led7seg>
</element>
<element name="red_led">
- <disk><color red="1.0" green="0.0" blue="0.0" /></disk>
+ <disk state="0"><color red="1.0" green="0.0" blue="0.0" /></disk>
</element>
<element name="P0"><text string="Ball / Match"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element>
@@ -21,91 +21,44 @@ copyright-holders:Robbbert
<element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element>
+ <group name="score">
+ <repeat count="6">
+ <param name="n" start="~s~" increment="-1" />
+ <param name="x" start="0" increment="44" />
+ <element name="digit~n~" ref="digit">
+ <bounds x="~x~" y="0" width="34" height="39" />
+ </element>
+ </repeat>
+ </group>
+
<view name="Default Layout">
<bounds left="0" top="20" right="274" bottom="394" />
<!-- LEDs -->
<!-- Player 1 Score -->
-
- <element name="digit5" ref="digit">
- <bounds left="10" top="45" right="44" bottom="84" />
- </element>
- <element name="digit4" ref="digit">
- <bounds left="54" top="45" right="88" bottom="84" />
- </element>
- <element name="digit3" ref="digit">
- <bounds left="98" top="45" right="132" bottom="84" />
- </element>
- <element name="digit2" ref="digit">
- <bounds left="142" top="45" right="176" bottom="84" />
- </element>
- <element name="digit1" ref="digit">
- <bounds left="186" top="45" right="220" bottom="84" />
- </element>
- <element name="digit0" ref="digit">
- <bounds left="230" top="45" right="264" bottom="84" />
- </element>
+ <param name="s" value="5" />
+ <group ref="score">
+ <bounds left="10" top="45" right="264" bottom="84" />
+ </group>
<!-- Player 2 Score -->
- <element name="digit13" ref="digit">
- <bounds left="10" top="105" right="44" bottom="144" />
- </element>
- <element name="digit12" ref="digit">
- <bounds left="54" top="105" right="88" bottom="144" />
- </element>
- <element name="digit11" ref="digit">
- <bounds left="98" top="105" right="132" bottom="144" />
- </element>
- <element name="digit10" ref="digit">
- <bounds left="142" top="105" right="176" bottom="144" />
- </element>
- <element name="digit9" ref="digit">
- <bounds left="186" top="105" right="220" bottom="144" />
- </element>
- <element name="digit8" ref="digit">
- <bounds left="230" top="105" right="264" bottom="144" />
- </element>
+ <param name="s" value="13" />
+ <group ref="score">
+ <bounds left="10" top="105" right="264" bottom="144" />
+ </group>
<!-- Player 3 Score -->
- <element name="digit21" ref="digit">
- <bounds left="10" top="165" right="44" bottom="204" />
- </element>
- <element name="digit20" ref="digit">
- <bounds left="54" top="165" right="88" bottom="204" />
- </element>
- <element name="digit19" ref="digit">
- <bounds left="98" top="165" right="132" bottom="204" />
- </element>
- <element name="digit18" ref="digit">
- <bounds left="142" top="165" right="176" bottom="204" />
- </element>
- <element name="digit17" ref="digit">
- <bounds left="186" top="165" right="220" bottom="204" />
- </element>
- <element name="digit16" ref="digit">
- <bounds left="230" top="165" right="264" bottom="204" />
- </element>
+ <param name="s" value="21" />
+ <group ref="score">
+ <bounds left="10" top="165" right="264" bottom="204" />
+ </group>
<!-- Player 4 Score -->
- <element name="digit29" ref="digit">
- <bounds left="10" top="225" right="44" bottom="264" />
- </element>
- <element name="digit28" ref="digit">
- <bounds left="54" top="225" right="88" bottom="264" />
- </element>
- <element name="digit27" ref="digit">
- <bounds left="98" top="225" right="132" bottom="264" />
- </element>
- <element name="digit26" ref="digit">
- <bounds left="142" top="225" right="176" bottom="264" />
- </element>
- <element name="digit25" ref="digit">
- <bounds left="186" top="225" right="220" bottom="264" />
- </element>
- <element name="digit24" ref="digit">
- <bounds left="230" top="225" right="264" bottom="264" />
- </element>
+ <param name="s" value="29" />
+ <group ref="score">
+ <bounds left="10" top="225" right="264" bottom="264" />
+ </group>
<!-- Credits and Balls -->
<element name="digit14" ref="digit">
diff --git a/src/mame/layout/gp_2.lay b/src/mame/layout/gp_2.lay
index ab508a9b6e1..6ea287e5e4e 100644
--- a/src/mame/layout/gp_2.lay
+++ b/src/mame/layout/gp_2.lay
@@ -11,7 +11,7 @@ copyright-holders:Robbbert
</led7seg>
</element>
<element name="red_led">
- <disk><color red="1.0" green="0.0" blue="0.0" /></disk>
+ <disk state="0"><color red="1.0" green="0.0" blue="0.0" /></disk>
</element>
<element name="P0"><text string="Ball"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element>
@@ -21,91 +21,44 @@ copyright-holders:Robbbert
<element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element>
+ <group name="score">
+ <repeat count="6">
+ <param name="n" start="~s~" increment="-1" />
+ <param name="x" start="0" increment="44" />
+ <element name="digit~n~" ref="digit">
+ <bounds x="~x~" y="0" width="34" height="39" />
+ </element>
+ </repeat>
+ </group>
+
<view name="Default Layout">
<bounds left="0" top="20" right="274" bottom="394" />
<!-- LEDs -->
<!-- Player 1 Score -->
-
- <element name="digit5" ref="digit">
- <bounds left="10" top="45" right="44" bottom="84" />
- </element>
- <element name="digit4" ref="digit">
- <bounds left="54" top="45" right="88" bottom="84" />
- </element>
- <element name="digit3" ref="digit">
- <bounds left="98" top="45" right="132" bottom="84" />
- </element>
- <element name="digit2" ref="digit">
- <bounds left="142" top="45" right="176" bottom="84" />
- </element>
- <element name="digit1" ref="digit">
- <bounds left="186" top="45" right="220" bottom="84" />
- </element>
- <element name="digit0" ref="digit">
- <bounds left="230" top="45" right="264" bottom="84" />
- </element>
+ <param name="s" value="5" />
+ <group ref="score">
+ <bounds left="10" top="45" right="264" bottom="84" />
+ </group>
<!-- Player 2 Score -->
- <element name="digit13" ref="digit">
- <bounds left="10" top="105" right="44" bottom="144" />
- </element>
- <element name="digit12" ref="digit">
- <bounds left="54" top="105" right="88" bottom="144" />
- </element>
- <element name="digit11" ref="digit">
- <bounds left="98" top="105" right="132" bottom="144" />
- </element>
- <element name="digit10" ref="digit">
- <bounds left="142" top="105" right="176" bottom="144" />
- </element>
- <element name="digit9" ref="digit">
- <bounds left="186" top="105" right="220" bottom="144" />
- </element>
- <element name="digit8" ref="digit">
- <bounds left="230" top="105" right="264" bottom="144" />
- </element>
+ <param name="s" value="13" />
+ <group ref="score">
+ <bounds left="10" top="105" right="264" bottom="144" />
+ </group>
<!-- Player 3 Score -->
- <element name="digit21" ref="digit">
- <bounds left="10" top="165" right="44" bottom="204" />
- </element>
- <element name="digit20" ref="digit">
- <bounds left="54" top="165" right="88" bottom="204" />
- </element>
- <element name="digit19" ref="digit">
- <bounds left="98" top="165" right="132" bottom="204" />
- </element>
- <element name="digit18" ref="digit">
- <bounds left="142" top="165" right="176" bottom="204" />
- </element>
- <element name="digit17" ref="digit">
- <bounds left="186" top="165" right="220" bottom="204" />
- </element>
- <element name="digit16" ref="digit">
- <bounds left="230" top="165" right="264" bottom="204" />
- </element>
+ <param name="s" value="21" />
+ <group ref="score">
+ <bounds left="10" top="165" right="264" bottom="204" />
+ </group>
<!-- Player 4 Score -->
- <element name="digit29" ref="digit">
- <bounds left="10" top="225" right="44" bottom="264" />
- </element>
- <element name="digit28" ref="digit">
- <bounds left="54" top="225" right="88" bottom="264" />
- </element>
- <element name="digit27" ref="digit">
- <bounds left="98" top="225" right="132" bottom="264" />
- </element>
- <element name="digit26" ref="digit">
- <bounds left="142" top="225" right="176" bottom="264" />
- </element>
- <element name="digit25" ref="digit">
- <bounds left="186" top="225" right="220" bottom="264" />
- </element>
- <element name="digit24" ref="digit">
- <bounds left="230" top="225" right="264" bottom="264" />
- </element>
+ <param name="s" value="29" />
+ <group ref="score">
+ <bounds left="10" top="225" right="264" bottom="264" />
+ </group>
<!-- Credits and Balls -->
<element name="digit36" ref="digit">
diff --git a/src/mame/layout/h8.lay b/src/mame/layout/h8.lay
index c36e95a9c9f..9499df6d20d 100644
--- a/src/mame/layout/h8.lay
+++ b/src/mame/layout/h8.lay
@@ -9,13 +9,12 @@ license:CC0
</led7seg>
</element>
<element name="red_led">
- <disk>
+ <disk state="0">
<color red="1.0" green="0.0" blue="0.0" />
</disk>
</element>
<element name="background">
<rect>
- <bounds left="0" top="0" right="1" bottom="1" />
<color red="0.0" green="0.0" blue="0.0" />
</rect>
</element>
diff --git a/src/mame/layout/matchme.lay b/src/mame/layout/matchme.lay
index 82f5aa722ad..8f873795e1b 100644
--- a/src/mame/layout/matchme.lay
+++ b/src/mame/layout/matchme.lay
@@ -159,16 +159,16 @@ license:CC0
<element ref="text_ry"><bounds x="9.825" y="9.17" width="0.35" height="0.35" /></element>
<element ref="text_ro"><bounds x="9.825" y="9.57" width="0.35" height="0.35" /></element>
<element ref="text_ro"><bounds x="9.825" y="9.97" width="0.35" height="0.35" /></element>
- <element ref="nothing" inputtag="FAKE" inputmask="0x02" inputraw="1"><bounds x="9.805" y="8.75" width="0.39" height="0.39" /></element>
- <element ref="nothing" inputtag="IN.4" inputmask="0x01" inputraw="1"><bounds x="9.805" y="9.15" width="0.39" height="0.39" /></element>
- <element ref="nothing" inputtag="IN.3" inputmask="0x08" inputraw="1"><bounds x="9.805" y="9.55" width="0.39" height="0.39" /></element>
- <element ref="nothing" inputtag="IN.3" inputmask="0x07" inputraw="1"><bounds x="9.805" y="9.95" width="0.39" height="0.39" /></element>
-
- <element ref="nothing" inputtag="FAKE" inputmask="0x00" inputraw="1"><bounds x="10.2" y="8.7" width="1.1" height="1.8" /></element>
- <element ref="switch_music" inputtag="FAKE" inputmask="0x02" inputraw="1"><bounds x="10.25" y="8.8" width="1" height="0.29" /></element>
- <element ref="switch_speed" inputtag="IN.4" inputmask="0x01" inputraw="1"><bounds x="10.25" y="9.2" width="1" height="0.29" /></element>
- <element ref="switch_skill" inputtag="IN.3" inputmask="0x08" inputraw="1"><bounds x="10.25" y="9.6" width="1" height="0.29" /></element>
- <element ref="switch_game" inputtag="IN.3" inputmask="0x07" inputraw="1"><bounds x="10.25" y="10.0" width="1" height="0.29" /></element>
+ <element ref="nothing" inputtag="FAKE" inputmask="0x02" inputraw="yes"><bounds x="9.805" y="8.75" width="0.39" height="0.39" /></element>
+ <element ref="nothing" inputtag="IN.4" inputmask="0x01" inputraw="yes"><bounds x="9.805" y="9.15" width="0.39" height="0.39" /></element>
+ <element ref="nothing" inputtag="IN.3" inputmask="0x08" inputraw="yes"><bounds x="9.805" y="9.55" width="0.39" height="0.39" /></element>
+ <element ref="nothing" inputtag="IN.3" inputmask="0x07" inputraw="yes"><bounds x="9.805" y="9.95" width="0.39" height="0.39" /></element>
+
+ <element ref="nothing" inputtag="FAKE" inputmask="0x00" inputraw="yes"><bounds x="10.2" y="8.7" width="1.1" height="1.8" /></element>
+ <element ref="switch_music" inputtag="FAKE" inputmask="0x02" inputraw="yes"><bounds x="10.25" y="8.8" width="1" height="0.29" /></element>
+ <element ref="switch_speed" inputtag="IN.4" inputmask="0x01" inputraw="yes"><bounds x="10.25" y="9.2" width="1" height="0.29" /></element>
+ <element ref="switch_skill" inputtag="IN.3" inputmask="0x08" inputraw="yes"><bounds x="10.25" y="9.6" width="1" height="0.29" /></element>
+ <element ref="switch_game" inputtag="IN.3" inputmask="0x07" inputraw="yes"><bounds x="10.25" y="10.0" width="1" height="0.29" /></element>
<element ref="button" inputtag="FAKE" inputmask="0x01"><bounds x="8.0" y="11" width="0.5" height="0.5" /></element>
<element ref="button" inputtag="IN.2" inputmask="0x01"><bounds x="9.75" y="11.9" width="0.5" height="0.5" /></element>
diff --git a/src/mame/layout/matchnum.lay b/src/mame/layout/matchnum.lay
index b4b22329f46..5deab68b61b 100644
--- a/src/mame/layout/matchnum.lay
+++ b/src/mame/layout/matchnum.lay
@@ -150,8 +150,8 @@ license:CC0
<element ref="text_2p"><bounds x="1" y="102.1" width="4" height="2" /></element>
<element ref="static_black2"><bounds x="1" y="95.6" width="4" height="6" /></element>
- <element ref="switch1" inputtag="IN.2" inputmask="0x08" inputraw="1"><bounds x="0.8" y="95.4" width="4.4" height="3.4" /></element>
- <element ref="switch2" inputtag="IN.2" inputmask="0x08" inputraw="1"><bounds x="0.8" y="98.4" width="4.4" height="3.4" /></element>
+ <element ref="switch1" inputtag="IN.2" inputmask="0x08" inputraw="yes"><bounds x="0.8" y="95.4" width="4.4" height="3.4" /></element>
+ <element ref="switch2" inputtag="IN.2" inputmask="0x08" inputraw="yes"><bounds x="0.8" y="98.4" width="4.4" height="3.4" /></element>
<repeat count="12">
<param name="y" start="95.75" increment="0.5" />
<element ref="static_black2"><bounds x="1.01" y="~y~" width="3.98" height="0.2" /></element>
diff --git a/src/mame/layout/megacd.lay b/src/mame/layout/megacd.lay
index 822efd2f6dc..5a4dd934450 100644
--- a/src/mame/layout/megacd.lay
+++ b/src/mame/layout/megacd.lay
@@ -8,12 +8,12 @@ Basic display of CD-ROM drive LEDs for the Sega MegaCD
<mamelayout version="2">
<element name="red_led">
- <rect>
+ <rect state="0">
<color red="1.0" green="0.0" blue="0.0" />
</rect>
</element>
<element name="green_led">
- <rect>
+ <rect state="0">
<color red="0.0" green="1.0" blue="0.0" />
</rect>
</element>
diff --git a/src/mame/layout/mephisto_1.lay b/src/mame/layout/mephisto_1.lay
index 76ffd55ce0d..52234d8d003 100644
--- a/src/mame/layout/mephisto_1.lay
+++ b/src/mame/layout/mephisto_1.lay
@@ -164,8 +164,8 @@ license:CC0
<!-- 2nd model has slightly different labels for SW/WS -->
<element ref="nothing" inputtag="IN.2" inputmask="0x04"><bounds x="10" y="20" width="3.7" height="3.7" /><color alpha="0.08" /></element>
<element ref="nothing" inputtag="IN.3" inputmask="0x01"><bounds x="15" y="20" width="3.7" height="3.7" /><color alpha="0.08" /></element>
- <element ref="bmask" inputtag="IN.4" inputmask="0x20" inputraw="1"><bounds x="10.6" y="22.15" width="1.2" height="1.2" /></element>
- <element ref="bmask" inputtag="IN.4" inputmask="0x20" inputraw="1"><bounds x="15.6" y="22.15" width="1.2" height="1.2" /></element>
+ <element ref="bmask" inputtag="IN.4" inputmask="0x20" inputraw="yes"><bounds x="10.6" y="22.15" width="1.2" height="1.2" /></element>
+ <element ref="bmask" inputtag="IN.4" inputmask="0x20" inputraw="yes"><bounds x="15.6" y="22.15" width="1.2" height="1.2" /></element>
<element ref="text_ba"><bounds x="0.5" y="10.1" width="1.3" height="1.8" /></element>
<element ref="text_bb"><bounds x="5.5" y="10.1" width="1.3" height="1.8" /></element>
diff --git a/src/mame/layout/mephisto_3.lay b/src/mame/layout/mephisto_3.lay
index dc1c7919b40..91fcc64682a 100644
--- a/src/mame/layout/mephisto_3.lay
+++ b/src/mame/layout/mephisto_3.lay
@@ -230,7 +230,7 @@ license:CC0
</repeat>
<!-- power led at A1 -->
- <element ref="ledg" inputtag="IN.5" inputmask="0x01" inputraw="1"><bounds x="0.2" y="78.3" width="1.5" height="1.5" /></element>
+ <element ref="ledg" inputtag="IN.5" inputmask="0x01" inputraw="yes"><bounds x="0.2" y="78.3" width="1.5" height="1.5" /></element>
<!-- pieces -->
<repeat count="8">
diff --git a/src/mame/layout/mephisto_alm16.lay b/src/mame/layout/mephisto_alm16.lay
index ec968e41698..608eee4ca39 100644
--- a/src/mame/layout/mephisto_alm16.lay
+++ b/src/mame/layout/mephisto_alm16.lay
@@ -293,12 +293,12 @@ license:CC0
<bounds x="0" y="0" width="10" height="81" />
<!-- can click here to change board type -->
- <element ref="hlub" inputtag="FAKE" inputmask="0x01" inputraw="1"><bounds x="0" y="1.5" width="10" height="5" /></element>
+ <element ref="hlub" inputtag="FAKE" inputmask="0x01" inputraw="yes"><bounds x="0" y="1.5" width="10" height="5" /></element>
<element ref="cblack"><bounds x="0" y="0" width="10" height="1" /></element>
<element ref="cblack"><bounds x="0" y="7" width="10" height="1" /></element>
<element ref="cblack"><bounds x="0" y="80" width="10" height="1" /></element>
- <element ref="text_uit1" inputtag="FAKE" inputmask="0x01" inputraw="1"><bounds x="0" y="2" width="10" height="2" /></element>
+ <element ref="text_uit1" inputtag="FAKE" inputmask="0x01" inputraw="yes"><bounds x="0" y="2" width="10" height="2" /></element>
<element ref="text_uit2"><bounds x="0" y="4" width="10" height="2" /></element>
<!-- board -->
@@ -348,8 +348,8 @@ license:CC0
<element name="piece_ui14" ref="piece"><bounds x="5" y="48" width="4" height="4" /></element>
<element ref="hlub" inputtag="board:board:SPAWN" inputmask="0x1000"><bounds x="1" y="48" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:board:SPAWN" inputmask="0x2000"><bounds x="5" y="48" width="4" height="4" /><color alpha="0.25" /></element>
- <element ref="wmask1" inputtag="FAKE" inputmask="1" inputraw="1"><bounds x="1" y="48" width="4" height="4" /></element>
- <element ref="wmask1" inputtag="FAKE" inputmask="1" inputraw="1"><bounds x="5" y="48" width="4" height="4" /></element>
+ <element ref="wmask1" inputtag="FAKE" inputmask="1" inputraw="yes"><bounds x="1" y="48" width="4" height="4" /></element>
+ <element ref="wmask1" inputtag="FAKE" inputmask="1" inputraw="yes"><bounds x="5" y="48" width="4" height="4" /></element>
<element ref="wmask2" blend="multiply"><bounds x="1" y="48" width="8" height="4" /></element>
<!-- hand -->
diff --git a/src/mame/layout/mephisto_alm32.lay b/src/mame/layout/mephisto_alm32.lay
index 6fecadda389..8f102e04a91 100644
--- a/src/mame/layout/mephisto_alm32.lay
+++ b/src/mame/layout/mephisto_alm32.lay
@@ -293,12 +293,12 @@ license:CC0
<bounds x="0" y="0" width="10" height="81" />
<!-- can click here to change board type -->
- <element ref="hlub" inputtag="FAKE" inputmask="0x01" inputraw="1"><bounds x="0" y="1.5" width="10" height="5" /></element>
+ <element ref="hlub" inputtag="FAKE" inputmask="0x01" inputraw="yes"><bounds x="0" y="1.5" width="10" height="5" /></element>
<element ref="cblack"><bounds x="0" y="0" width="10" height="1" /></element>
<element ref="cblack"><bounds x="0" y="7" width="10" height="1" /></element>
<element ref="cblack"><bounds x="0" y="80" width="10" height="1" /></element>
- <element ref="text_uit1" inputtag="FAKE" inputmask="0x01" inputraw="1"><bounds x="0" y="2" width="10" height="2" /></element>
+ <element ref="text_uit1" inputtag="FAKE" inputmask="0x01" inputraw="yes"><bounds x="0" y="2" width="10" height="2" /></element>
<element ref="text_uit2"><bounds x="0" y="4" width="10" height="2" /></element>
<!-- board -->
@@ -357,8 +357,8 @@ license:CC0
<element name="piece_ui14" ref="piece"><bounds x="5" y="48" width="4" height="4" /></element>
<element ref="hlub" inputtag="board:board:SPAWN" inputmask="0x1000"><bounds x="1" y="48" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:board:SPAWN" inputmask="0x2000"><bounds x="5" y="48" width="4" height="4" /><color alpha="0.25" /></element>
- <element ref="wmask1" inputtag="FAKE" inputmask="1" inputraw="1"><bounds x="1" y="48" width="4" height="4" /></element>
- <element ref="wmask1" inputtag="FAKE" inputmask="1" inputraw="1"><bounds x="5" y="48" width="4" height="4" /></element>
+ <element ref="wmask1" inputtag="FAKE" inputmask="1" inputraw="yes"><bounds x="1" y="48" width="4" height="4" /></element>
+ <element ref="wmask1" inputtag="FAKE" inputmask="1" inputraw="yes"><bounds x="5" y="48" width="4" height="4" /></element>
<element ref="wmask2" blend="multiply"><bounds x="1" y="48" width="8" height="4" /></element>
<!-- undo -->
diff --git a/src/mame/layout/mephisto_esb2.lay b/src/mame/layout/mephisto_esb2.lay
index ab11ab3617b..72aca3d1360 100644
--- a/src/mame/layout/mephisto_esb2.lay
+++ b/src/mame/layout/mephisto_esb2.lay
@@ -230,7 +230,7 @@ license:CC0
</repeat>
<!-- power led at A1 -->
- <element ref="ledg" inputtag="IN.5" inputmask="0x01" inputraw="1"><bounds x="0.2" y="78.3" width="1.5" height="1.5" /></element>
+ <element ref="ledg" inputtag="IN.5" inputmask="0x01" inputraw="yes"><bounds x="0.2" y="78.3" width="1.5" height="1.5" /></element>
<!-- pieces -->
<repeat count="8">
@@ -540,8 +540,8 @@ license:CC0
<!-- 2nd model has slightly different labels for SW/WS -->
<element ref="nothing" inputtag="IN.2" inputmask="0x04"><bounds x="10" y="20" width="3.7" height="3.7" /><color alpha="0.08" /></element>
<element ref="nothing" inputtag="IN.3" inputmask="0x01"><bounds x="15" y="20" width="3.7" height="3.7" /><color alpha="0.08" /></element>
- <element ref="bmask" inputtag="IN.4" inputmask="0x20" inputraw="1"><bounds x="10.6" y="22.15" width="1.2" height="1.2" /></element>
- <element ref="bmask" inputtag="IN.4" inputmask="0x20" inputraw="1"><bounds x="15.6" y="22.15" width="1.2" height="1.2" /></element>
+ <element ref="bmask" inputtag="IN.4" inputmask="0x20" inputraw="yes"><bounds x="10.6" y="22.15" width="1.2" height="1.2" /></element>
+ <element ref="bmask" inputtag="IN.4" inputmask="0x20" inputraw="yes"><bounds x="15.6" y="22.15" width="1.2" height="1.2" /></element>
<element ref="text_ba"><bounds x="0.5" y="10.1" width="1.3" height="1.8" /></element>
<element ref="text_bb"><bounds x="5.5" y="10.1" width="1.3" height="1.8" /></element>
diff --git a/src/mame/layout/mephisto_gen32.lay b/src/mame/layout/mephisto_gen32.lay
index 59f748e9858..4d841a1e0ee 100644
--- a/src/mame/layout/mephisto_gen32.lay
+++ b/src/mame/layout/mephisto_gen32.lay
@@ -293,12 +293,12 @@ license:CC0
<bounds x="0" y="0" width="10" height="81" />
<!-- can click here to change board type -->
- <element ref="hlub" inputtag="FAKE" inputmask="0x01" inputraw="1"><bounds x="0" y="1.5" width="10" height="5" /></element>
+ <element ref="hlub" inputtag="FAKE" inputmask="0x01" inputraw="yes"><bounds x="0" y="1.5" width="10" height="5" /></element>
<element ref="cblack"><bounds x="0" y="0" width="10" height="1" /></element>
<element ref="cblack"><bounds x="0" y="7" width="10" height="1" /></element>
<element ref="cblack"><bounds x="0" y="80" width="10" height="1" /></element>
- <element ref="text_uit1" inputtag="FAKE" inputmask="0x01" inputraw="1"><bounds x="0" y="2" width="10" height="2" /></element>
+ <element ref="text_uit1" inputtag="FAKE" inputmask="0x01" inputraw="yes"><bounds x="0" y="2" width="10" height="2" /></element>
<element ref="text_uit2"><bounds x="0" y="4" width="10" height="2" /></element>
<!-- board -->
@@ -348,8 +348,8 @@ license:CC0
<element name="piece_ui14" ref="piece"><bounds x="5" y="48" width="4" height="4" /></element>
<element ref="hlub" inputtag="board:board:SPAWN" inputmask="0x1000"><bounds x="1" y="48" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:board:SPAWN" inputmask="0x2000"><bounds x="5" y="48" width="4" height="4" /><color alpha="0.25" /></element>
- <element ref="wmask1" inputtag="FAKE" inputmask="1" inputraw="1"><bounds x="1" y="48" width="4" height="4" /></element>
- <element ref="wmask1" inputtag="FAKE" inputmask="1" inputraw="1"><bounds x="5" y="48" width="4" height="4" /></element>
+ <element ref="wmask1" inputtag="FAKE" inputmask="1" inputraw="yes"><bounds x="1" y="48" width="4" height="4" /></element>
+ <element ref="wmask1" inputtag="FAKE" inputmask="1" inputraw="yes"><bounds x="5" y="48" width="4" height="4" /></element>
<element ref="wmask2" blend="multiply"><bounds x="1" y="48" width="8" height="4" /></element>
<!-- hand -->
diff --git a/src/mame/layout/mephisto_mirage.lay b/src/mame/layout/mephisto_mirage.lay
index 3229a7c4cea..b85f78e58aa 100644
--- a/src/mame/layout/mephisto_mirage.lay
+++ b/src/mame/layout/mephisto_mirage.lay
@@ -190,10 +190,10 @@ license:CC0
<repeat count="4">
<param name="x1" start="8.3" increment="20" />
<param name="x2" start="18.3" increment="20" />
- <element ref="hidew" inputtag="FAKE" inputmask="0x01" inputraw="1"><bounds x="~x1~" y="~y1~" width="1.5" height="1.5" /></element>
- <element ref="hidew" inputtag="FAKE" inputmask="0x01" inputraw="1"><bounds x="~x2~" y="~y2~" width="1.5" height="1.5" /></element>
- <element ref="hideb" inputtag="FAKE" inputmask="0x01" inputraw="1"><bounds x="~x1~" y="~y2~" width="1.5" height="1.5" /></element>
- <element ref="hideb" inputtag="FAKE" inputmask="0x01" inputraw="1"><bounds x="~x2~" y="~y1~" width="1.5" height="1.5" /></element>
+ <element ref="hidew" inputtag="FAKE" inputmask="0x01" inputraw="yes"><bounds x="~x1~" y="~y1~" width="1.5" height="1.5" /></element>
+ <element ref="hidew" inputtag="FAKE" inputmask="0x01" inputraw="yes"><bounds x="~x2~" y="~y2~" width="1.5" height="1.5" /></element>
+ <element ref="hideb" inputtag="FAKE" inputmask="0x01" inputraw="yes"><bounds x="~x1~" y="~y2~" width="1.5" height="1.5" /></element>
+ <element ref="hideb" inputtag="FAKE" inputmask="0x01" inputraw="yes"><bounds x="~x2~" y="~y1~" width="1.5" height="1.5" /></element>
</repeat>
</repeat>
@@ -273,12 +273,12 @@ license:CC0
<bounds x="0" y="0" width="10" height="80" />
<!-- can click here to change board type -->
- <element ref="hlub" inputtag="FAKE" inputmask="0x01" inputraw="1"><bounds x="0" y="1.5" width="10" height="5" /></element>
+ <element ref="hlub" inputtag="FAKE" inputmask="0x01" inputraw="yes"><bounds x="0" y="1.5" width="10" height="5" /></element>
<element ref="cblack"><bounds x="0" y="0" width="10" height="1" /></element>
<element ref="cblack"><bounds x="0" y="7" width="10" height="1" /></element>
<element ref="cblack"><bounds x="0" y="79" width="10" height="1" /></element>
- <element ref="text_uit1" inputtag="FAKE" inputmask="0x01" inputraw="1"><bounds x="0" y="2" width="10" height="2" /></element>
+ <element ref="text_uit1" inputtag="FAKE" inputmask="0x01" inputraw="yes"><bounds x="0" y="2" width="10" height="2" /></element>
<element ref="text_uit2"><bounds x="0" y="4" width="10" height="2" /></element>
<!-- board -->
diff --git a/src/mame/layout/mgavegas.lay b/src/mame/layout/mgavegas.lay
index 3e8b21ab026..aa7f7377346 100644
--- a/src/mame/layout/mgavegas.lay
+++ b/src/mame/layout/mgavegas.lay
@@ -6,7 +6,7 @@ license:CC0
<mamelayout version="2">
<element name="red_led">
- <rect>
+ <rect state="0">
<color red="1.0" green="0.0" blue="0.0" />
</rect>
</element>
diff --git a/src/mame/layout/micropin.lay b/src/mame/layout/micropin.lay
index 6d9918dbc5b..c710de1ea62 100644
--- a/src/mame/layout/micropin.lay
+++ b/src/mame/layout/micropin.lay
@@ -13,7 +13,7 @@ copyright-holders:Robbbert
</element>
<element name="red_led">
- <disk><color red="1.0" green="0.0" blue="0.0" /></disk>
+ <disk state="0"><color red="1.0" green="0.0" blue="0.0" /></disk>
</element>
<element name="P0"><text string="BALL"><color red="1.0" green="1.0" blue="1.0" /></text></element>
diff --git a/src/mame/layout/microvision.lay b/src/mame/layout/microvision.lay
index 34c266c700d..571b5a8afb7 100644
--- a/src/mame/layout/microvision.lay
+++ b/src/mame/layout/microvision.lay
@@ -40,8 +40,8 @@ license:CC0
<collection name="Paddle State">
<!-- show live paddle position -->
<element ref="text_p1" blend="add"><bounds x="10.75" y="0.1" width="5" height="0.75" /></element>
- <element ref="nothing" blend="add" inputtag="PADDLE" inputmask="0x00" inputraw="1"><bounds x="15.95" y="0.1" width="2" height="0.75" /></element> <!-- block clickable input -->
- <element ref="text_p2" blend="add" inputtag="PADDLE" inputmask="0xff" inputraw="1"><bounds x="15.95" y="0.1" width="2" height="0.75" /></element>
+ <element ref="nothing" blend="add" inputtag="PADDLE" inputmask="0x00" inputraw="yes"><bounds x="15.95" y="0.1" width="2" height="0.75" /></element> <!-- block clickable input -->
+ <element ref="text_p2" blend="add" inputtag="PADDLE" inputmask="0xff" inputraw="yes"><bounds x="15.95" y="0.1" width="2" height="0.75" /></element>
</collection>
</view>
diff --git a/src/mame/layout/novag_savant.lay b/src/mame/layout/novag_savant.lay
index f38bdf2d9c2..14be66c7015 100644
--- a/src/mame/layout/novag_savant.lay
+++ b/src/mame/layout/novag_savant.lay
@@ -235,8 +235,8 @@ license:CC0
</repeat>
<!-- backlight -->
- <element ref="nothing" blend="add" inputtag="LIGHT" inputmask="0x00" inputraw="1"><bounds x="0" y="0" width="101" height="114" /></element>
- <element ref="cb_light" blend="multiply" inputtag="LIGHT" inputmask="0x01" inputraw="1"><bounds x="0" y="0" width="101" height="114" /></element>
+ <element ref="nothing" blend="add" inputtag="LIGHT" inputmask="0x00" inputraw="yes"><bounds x="0" y="0" width="101" height="114" /></element>
+ <element ref="cb_light" blend="multiply" inputtag="LIGHT" inputmask="0x01" inputraw="yes"><bounds x="0" y="0" width="101" height="114" /></element>
<!-- mask edges -->
<element ref="blackb"><bounds x="0" y="0" width="101" height="2" /></element>
diff --git a/src/mame/layout/novag_supercon.lay b/src/mame/layout/novag_supercon.lay
index 3d45f8e75c4..672dbc513d5 100644
--- a/src/mame/layout/novag_supercon.lay
+++ b/src/mame/layout/novag_supercon.lay
@@ -88,12 +88,12 @@ license:CC0
<element name="text_p5"><image file="chess/wr.png"><color alpha="0.9" /></image></element>
<element name="text_p6"><image file="chess/wp.png"><color alpha="0.9" /></image></element>
- <element name="text_p7"><image file="chess/bk.png"><color alpha="0.85" /></image></element>
- <element name="text_p8"><image file="chess/bq.png"><color alpha="0.85" /></image></element>
- <element name="text_p9"><image file="chess/bb.png"><color alpha="0.85" /></image></element>
- <element name="text_p10"><image file="chess/bn.png"><color alpha="0.85" /></image></element>
- <element name="text_p11"><image file="chess/br.png"><color alpha="0.85" /></image></element>
- <element name="text_p12"><image file="chess/bp.png"><color alpha="0.85" /></image></element>
+ <element name="text_p7"><rect><color red="1" green="1" blue="1" /></rect><image file="chess/bk.png" /><rect><color red="1" green="1" blue="1" alpha="0.1" /></rect></element>
+ <element name="text_p8"><rect><color red="1" green="1" blue="1" /></rect><image file="chess/bq.png" /><rect><color red="1" green="1" blue="1" alpha="0.1" /></rect></element>
+ <element name="text_p9"><rect><color red="1" green="1" blue="1" /></rect><image file="chess/bb.png" /><rect><color red="1" green="1" blue="1" alpha="0.1" /></rect></element>
+ <element name="text_p10"><rect><color red="1" green="1" blue="1" /></rect><image file="chess/bn.png" /><rect><color red="1" green="1" blue="1" alpha="0.1" /></rect></element>
+ <element name="text_p11"><rect><color red="1" green="1" blue="1" /></rect><image file="chess/br.png" /><rect><color red="1" green="1" blue="1" alpha="0.1" /></rect></element>
+ <element name="text_p12"><rect><color red="1" green="1" blue="1" /></rect><image file="chess/bp.png" /><rect><color red="1" green="1" blue="1" alpha="0.1" /></rect></element>
<element name="text_rb00"><text string="Multi Move"><color red="0.51" green="0.5" blue="0.49" /></text></element>
<element name="text_rb01"><text string="Player/Player"><color red="0.51" green="0.5" blue="0.49" /></text></element>
@@ -527,12 +527,12 @@ license:CC0
<element ref="white"><bounds x="88" y="66" width="6" height="4" /></element>
<element ref="white"><bounds x="88" y="76" width="6" height="4" /></element>
- <element ref="text_p7"> <bounds x="89.55" y="6.45" width="2.9" height="2.9" /></element>
- <element ref="text_p8"> <bounds x="89.55" y="16.45" width="2.9" height="2.9" /></element>
- <element ref="text_p9"> <bounds x="89.55" y="26.45" width="2.9" height="2.9" /></element>
- <element ref="text_p10"><bounds x="89.55" y="36.45" width="2.9" height="2.9" /></element>
- <element ref="text_p11"><bounds x="89.55" y="46.45" width="2.9" height="2.9" /></element>
- <element ref="text_p12"><bounds x="89.55" y="56.45" width="2.9" height="2.9" /></element>
+ <element ref="text_p7" blend="multiply"> <bounds x="89.55" y="6.45" width="2.9" height="2.9" /></element>
+ <element ref="text_p8" blend="multiply"> <bounds x="89.55" y="16.45" width="2.9" height="2.9" /></element>
+ <element ref="text_p9" blend="multiply"> <bounds x="89.55" y="26.45" width="2.9" height="2.9" /></element>
+ <element ref="text_p10" blend="multiply"><bounds x="89.55" y="36.45" width="2.9" height="2.9" /></element>
+ <element ref="text_p11" blend="multiply"><bounds x="89.55" y="46.45" width="2.9" height="2.9" /></element>
+ <element ref="text_p12" blend="multiply"><bounds x="89.55" y="56.45" width="2.9" height="2.9" /></element>
<element ref="hlb" inputtag="IN.0" inputmask="0x02"><bounds x="88" y="6" width="6" height="4" /><color alpha="0.4" /></element>
<element ref="hlb" inputtag="IN.1" inputmask="0x02"><bounds x="88" y="16" width="6" height="4" /><color alpha="0.4" /></element>
@@ -599,15 +599,15 @@ license:CC0
<bounds left="-19" right="116" top="-0.5" bottom="88.5" />
<!-- block buttons -->
- <element ref="hlb" inputtag="IN.1" inputmask="0x00" inputraw="1"><bounds x="88" y="16" width="6" height="4" /></element>
- <element ref="hlb" inputtag="IN.2" inputmask="0x00" inputraw="1"><bounds x="88" y="26" width="6" height="4" /></element>
- <element ref="hlb" inputtag="IN.5" inputmask="0x00" inputraw="1"><bounds x="88" y="56" width="6" height="4" /></element>
-
- <element ref="hlb" inputtag="IN.1" inputmask="0x00" inputraw="1"><bounds x="97" y="16" width="6" height="4" /></element>
- <element ref="hlb" inputtag="IN.2" inputmask="0x00" inputraw="1"><bounds x="97" y="26" width="6" height="4" /></element>
- <element ref="hlb" inputtag="IN.4" inputmask="0x00" inputraw="1"><bounds x="97" y="46" width="6" height="4" /></element>
- <element ref="hlb" inputtag="IN.5" inputmask="0x00" inputraw="1"><bounds x="97" y="56" width="6" height="4" /></element>
- <element ref="hlb" inputtag="IN.6" inputmask="0x00" inputraw="1"><bounds x="97" y="66" width="6" height="4" /></element>
+ <element ref="hlb" inputtag="IN.1" inputmask="0x00" inputraw="yes"><bounds x="88" y="16" width="6" height="4" /></element>
+ <element ref="hlb" inputtag="IN.2" inputmask="0x00" inputraw="yes"><bounds x="88" y="26" width="6" height="4" /></element>
+ <element ref="hlb" inputtag="IN.5" inputmask="0x00" inputraw="yes"><bounds x="88" y="56" width="6" height="4" /></element>
+
+ <element ref="hlb" inputtag="IN.1" inputmask="0x00" inputraw="yes"><bounds x="97" y="16" width="6" height="4" /></element>
+ <element ref="hlb" inputtag="IN.2" inputmask="0x00" inputraw="yes"><bounds x="97" y="26" width="6" height="4" /></element>
+ <element ref="hlb" inputtag="IN.4" inputmask="0x00" inputraw="yes"><bounds x="97" y="46" width="6" height="4" /></element>
+ <element ref="hlb" inputtag="IN.5" inputmask="0x00" inputraw="yes"><bounds x="97" y="56" width="6" height="4" /></element>
+ <element ref="hlb" inputtag="IN.6" inputmask="0x00" inputraw="yes"><bounds x="97" y="66" width="6" height="4" /></element>
<group ref="default"><bounds left="-19" right="116" top="-0.5" bottom="88.5" /></group>
diff --git a/src/mame/layout/qfire.lay b/src/mame/layout/qfire.lay
index 055f3d89c64..035703242e5 100644
--- a/src/mame/layout/qfire.lay
+++ b/src/mame/layout/qfire.lay
@@ -102,10 +102,10 @@ license:CC0
<element ref="text_game"><bounds x="85" y="115" width="8" height="2.5" /></element>
<element ref="text_sw"><bounds x="93" y="115" width="2.5" height="2.5" /></element>
- <element ref="switch_game" inputtag="IN.0" inputmask="0x0f" inputraw="1"><bounds x="93" y="115" width="4" height="2.5" /></element>
+ <element ref="switch_game" inputtag="IN.0" inputmask="0x0f" inputraw="yes"><bounds x="93" y="115" width="4" height="2.5" /></element>
<element ref="text_skill"><bounds x="110" y="115" width="8" height="2.5" /></element>
<element ref="text_sw"><bounds x="118" y="115" width="2.5" height="2.5" /></element>
- <element ref="switch_skill" inputtag="IN.1" inputmask="0x07" inputraw="1"><bounds x="118" y="115" width="4" height="2.5" /></element>
+ <element ref="switch_skill" inputtag="IN.1" inputmask="0x07" inputraw="yes"><bounds x="118" y="115" width="4" height="2.5" /></element>
</view>
</mamelayout>
diff --git a/src/mame/layout/saitek_mark5.lay b/src/mame/layout/saitek_mark5.lay
index d16efecf8fd..8bfa228b11c 100644
--- a/src/mame/layout/saitek_mark5.lay
+++ b/src/mame/layout/saitek_mark5.lay
@@ -218,67 +218,67 @@ license:CC0
<element ref="hlc" blend="add" inputtag="IN.8" inputmask="0x80"><bounds x="18.333" y="12.333" width="4.666" height="4.666" /></element>
<element ref="black"><bounds x="9" y="22.5" width="14" height="45" /></element>
- <element ref="nothing" blend="add" inputtag="IN.0" inputmask="0x00" inputraw="1"><bounds x="-1" y="-1" width="34" height="69" /></element>
+ <element ref="nothing" blend="add" inputtag="IN.0" inputmask="0x00" inputraw="yes"><bounds x="-1" y="-1" width="34" height="69" /></element>
<!-- button labels (upper) -->
- <element ref="text_b01e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="1" width="6" height="1.4" /></element>
- <element ref="text_b02e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="5" width="6" height="1.4" /></element>
- <element ref="text_b03e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="8.4" width="6" height="1.4" /></element>
- <element ref="text_b0ce" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="9.7" width="6" height="1.4" /></element>
- <element ref="text_b04e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="12.4" width="6" height="1.4" /></element>
- <element ref="text_b0ce" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="13.7" width="6" height="1.4" /></element>
- <element ref="text_b0ce" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="17" width="6" height="1.4" /></element>
- <element ref="text_b11e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="1" width="6" height="1.4" /></element>
- <element ref="text_b12e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="5" width="6" height="1.4" /></element>
- <element ref="text_b13e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="9" width="6" height="1.4" /></element>
- <element ref="text_b14e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="12.1" width="6" height="2.6" /></element>
- <element ref="text_b15e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="16.1" width="6" height="2.6" /></element>
-
- <element ref="text_b01d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="1" width="6" height="1.4" /></element>
- <element ref="text_b02d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="5" width="6" height="1.4" /></element>
- <element ref="text_b03d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="8.4" width="6" height="1.4" /></element>
- <element ref="text_b0cd" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="9.7" width="6" height="1.4" /></element>
- <element ref="text_b04d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="12.4" width="6" height="1.4" /></element>
- <element ref="text_b0cd" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="13.7" width="6" height="1.4" /></element>
- <element ref="text_b0cd" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="17" width="6" height="1.4" /></element>
- <element ref="text_b11d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="1" width="6" height="1.4" /></element>
- <element ref="text_b12d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="4.4" width="6" height="1.4" /></element>
- <element ref="text_b12d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="5.7" width="6" height="1.4" /></element>
- <element ref="text_b13d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="8.4" width="6" height="1.4" /></element>
- <element ref="text_b13d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="9.7" width="6" height="1.4" /></element>
- <element ref="text_b14d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="13" width="6" height="1.4" /></element>
- <element ref="text_b15d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="17" width="6" height="1.4" /></element>
+ <element ref="text_b01e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="1" width="6" height="1.4" /></element>
+ <element ref="text_b02e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="5" width="6" height="1.4" /></element>
+ <element ref="text_b03e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="8.4" width="6" height="1.4" /></element>
+ <element ref="text_b0ce" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="9.7" width="6" height="1.4" /></element>
+ <element ref="text_b04e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="12.4" width="6" height="1.4" /></element>
+ <element ref="text_b0ce" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="13.7" width="6" height="1.4" /></element>
+ <element ref="text_b0ce" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="17" width="6" height="1.4" /></element>
+ <element ref="text_b11e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="1" width="6" height="1.4" /></element>
+ <element ref="text_b12e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="5" width="6" height="1.4" /></element>
+ <element ref="text_b13e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="9" width="6" height="1.4" /></element>
+ <element ref="text_b14e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="12.1" width="6" height="2.6" /></element>
+ <element ref="text_b15e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="16.1" width="6" height="2.6" /></element>
+
+ <element ref="text_b01d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="1" width="6" height="1.4" /></element>
+ <element ref="text_b02d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="5" width="6" height="1.4" /></element>
+ <element ref="text_b03d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="8.4" width="6" height="1.4" /></element>
+ <element ref="text_b0cd" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="9.7" width="6" height="1.4" /></element>
+ <element ref="text_b04d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="12.4" width="6" height="1.4" /></element>
+ <element ref="text_b0cd" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="13.7" width="6" height="1.4" /></element>
+ <element ref="text_b0cd" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="17" width="6" height="1.4" /></element>
+ <element ref="text_b11d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="1" width="6" height="1.4" /></element>
+ <element ref="text_b12d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="4.4" width="6" height="1.4" /></element>
+ <element ref="text_b12d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="5.7" width="6" height="1.4" /></element>
+ <element ref="text_b13d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="8.4" width="6" height="1.4" /></element>
+ <element ref="text_b13d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="9.7" width="6" height="1.4" /></element>
+ <element ref="text_b14d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="13" width="6" height="1.4" /></element>
+ <element ref="text_b15d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="17" width="6" height="1.4" /></element>
<!-- button labels (lower) -->
- <element ref="text_b21e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="26" width="10" height="1.4" /></element>
- <element ref="text_b22e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="30" width="10" height="1.4" /></element>
- <element ref="text_b23e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="34" width="10" height="1.4" /></element>
- <element ref="text_b24e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="37.4" width="10" height="1.4" /></element>
- <element ref="text_b24e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="38.7" width="10" height="1.4" /></element>
- <element ref="text_b25e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="42" width="10" height="1.4" /></element>
- <element ref="text_b26e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="45.4" width="10" height="1.4" /></element>
- <element ref="text_b26e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="46.7" width="10" height="1.4" /></element>
- <element ref="text_b27e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="50" width="10" height="1.4" /></element>
- <element ref="text_b28e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="54" width="10" height="1.4" /></element>
- <element ref="text_b29e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="57.4" width="10" height="1.4" /></element>
- <element ref="text_b29e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="58.7" width="10" height="1.4" /></element>
- <element ref="text_b2ae1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="61.4" width="10" height="1.4" /></element>
- <element ref="text_b2ae2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="62.7" width="10" height="1.4" /></element>
-
- <element ref="text_b21d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="26" width="10" height="1.4" /></element>
- <element ref="text_b22d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="30" width="10" height="1.4" /></element>
- <element ref="text_b23d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="34" width="10" height="1.4" /></element>
- <element ref="text_b24d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="37.4" width="10" height="1.4" /></element>
- <element ref="text_b24d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="38.7" width="10" height="1.4" /></element>
- <element ref="text_b25d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="41.4" width="10" height="1.4" /></element>
- <element ref="text_b25d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="42.7" width="10" height="1.4" /></element>
- <element ref="text_b26d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="46" width="10" height="1.4" /></element>
- <element ref="text_b27d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="50" width="10" height="1.4" /></element>
- <element ref="text_b28d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="54" width="10" height="1.4" /></element>
- <element ref="text_b29d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="57.4" width="10" height="1.4" /></element>
- <element ref="text_b29d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="58.7" width="10" height="1.4" /></element>
- <element ref="text_b2ad1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="61.4" width="10" height="1.4" /></element>
- <element ref="text_b2ad2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="62.7" width="10" height="1.4" /></element>
+ <element ref="text_b21e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="26" width="10" height="1.4" /></element>
+ <element ref="text_b22e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="30" width="10" height="1.4" /></element>
+ <element ref="text_b23e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="34" width="10" height="1.4" /></element>
+ <element ref="text_b24e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="37.4" width="10" height="1.4" /></element>
+ <element ref="text_b24e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="38.7" width="10" height="1.4" /></element>
+ <element ref="text_b25e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="42" width="10" height="1.4" /></element>
+ <element ref="text_b26e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="45.4" width="10" height="1.4" /></element>
+ <element ref="text_b26e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="46.7" width="10" height="1.4" /></element>
+ <element ref="text_b27e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="50" width="10" height="1.4" /></element>
+ <element ref="text_b28e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="54" width="10" height="1.4" /></element>
+ <element ref="text_b29e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="57.4" width="10" height="1.4" /></element>
+ <element ref="text_b29e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="58.7" width="10" height="1.4" /></element>
+ <element ref="text_b2ae1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="61.4" width="10" height="1.4" /></element>
+ <element ref="text_b2ae2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="62.7" width="10" height="1.4" /></element>
+
+ <element ref="text_b21d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="26" width="10" height="1.4" /></element>
+ <element ref="text_b22d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="30" width="10" height="1.4" /></element>
+ <element ref="text_b23d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="34" width="10" height="1.4" /></element>
+ <element ref="text_b24d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="37.4" width="10" height="1.4" /></element>
+ <element ref="text_b24d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="38.7" width="10" height="1.4" /></element>
+ <element ref="text_b25d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="41.4" width="10" height="1.4" /></element>
+ <element ref="text_b25d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="42.7" width="10" height="1.4" /></element>
+ <element ref="text_b26d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="46" width="10" height="1.4" /></element>
+ <element ref="text_b27d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="50" width="10" height="1.4" /></element>
+ <element ref="text_b28d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="54" width="10" height="1.4" /></element>
+ <element ref="text_b29d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="57.4" width="10" height="1.4" /></element>
+ <element ref="text_b29d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="58.7" width="10" height="1.4" /></element>
+ <element ref="text_b2ad1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="61.4" width="10" height="1.4" /></element>
+ <element ref="text_b2ad2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="62.7" width="10" height="1.4" /></element>
<element ref="text_r9" blend="add"><bounds x="16.5" y="26" width="6" height="1.4" /></element>
<element ref="text_r8" blend="add"><bounds x="16.5" y="30" width="6" height="1.4" /></element>
@@ -309,31 +309,31 @@ license:CC0
<element ref="blackd"><bounds x="18.15" y="33.85" width="1.8" height="1.8" /></element>
<element ref="white"><bounds x="18.7" y="34.4" width="0.7" height="0.7" /></element>
- <element ref="text_b31e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="24.7" width="2" height="1.4" /></element>
- <element ref="text_b31e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="26.0" width="2" height="1.4" /></element>
- <element ref="text_b31e3" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="27.3" width="2" height="1.4" /></element>
- <element ref="text_b32e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="61.4" width="2" height="1.4" /></element>
- <element ref="text_b32e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="62.7" width="2" height="1.4" /></element>
- <element ref="text_b33e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="17.6" y="26" width="3" height="1.4" /></element>
- <element ref="text_b34e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="17.6" y="62" width="3" height="1.4" /></element>
-
- <element ref="text_b31d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="25.4" width="2" height="1.4" /></element>
- <element ref="text_b31d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="26.7" width="2" height="1.4" /></element>
- <element ref="text_b32d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="60.7" width="2" height="1.4" /></element>
- <element ref="text_b32d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="62.0" width="2" height="1.4" /></element>
- <element ref="text_b32d3" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="63.3" width="2" height="1.4" /></element>
- <element ref="text_b32d4" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="64.6" width="2" height="1.4" /></element>
- <element ref="text_b33d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="17.6" y="26" width="3" height="1.4" /></element>
- <element ref="text_b34d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="17.6" y="62" width="3" height="1.4" /></element>
+ <element ref="text_b31e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="24.7" width="2" height="1.4" /></element>
+ <element ref="text_b31e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="26.0" width="2" height="1.4" /></element>
+ <element ref="text_b31e3" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="27.3" width="2" height="1.4" /></element>
+ <element ref="text_b32e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="61.4" width="2" height="1.4" /></element>
+ <element ref="text_b32e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="62.7" width="2" height="1.4" /></element>
+ <element ref="text_b33e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="17.6" y="26" width="3" height="1.4" /></element>
+ <element ref="text_b34e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="17.6" y="62" width="3" height="1.4" /></element>
+
+ <element ref="text_b31d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="25.4" width="2" height="1.4" /></element>
+ <element ref="text_b31d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="26.7" width="2" height="1.4" /></element>
+ <element ref="text_b32d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="60.7" width="2" height="1.4" /></element>
+ <element ref="text_b32d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="62.0" width="2" height="1.4" /></element>
+ <element ref="text_b32d3" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="63.3" width="2" height="1.4" /></element>
+ <element ref="text_b32d4" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="64.6" width="2" height="1.4" /></element>
+ <element ref="text_b33d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="17.6" y="26" width="3" height="1.4" /></element>
+ <element ref="text_b34d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="17.6" y="62" width="3" height="1.4" /></element>
<!-- switches -->
<element ref="text_lcd1"><bounds x="46" y="57" width="5" height="1.4" /></element>
<element ref="text_lcd2"><bounds x="46" y="65.5" width="5" height="1.4" /></element>
- <element ref="switch" inputtag="IN.7" inputmask="0x02" inputraw="1"><bounds x="46" y="57" width="5" height="10" /></element>
+ <element ref="switch" inputtag="IN.7" inputmask="0x02" inputraw="yes"><bounds x="46" y="57" width="5" height="10" /></element>
<element ref="text_sound1"><bounds x="52" y="57" width="5" height="1.4" /></element>
<element ref="text_sound2"><bounds x="52" y="65.5" width="5" height="1.4" /></element>
- <element ref="switch" inputtag="IN.7" inputmask="0x01" inputraw="1"><bounds x="52" y="57" width="5" height="10" /></element>
+ <element ref="switch" inputtag="IN.7" inputmask="0x01" inputraw="yes"><bounds x="52" y="57" width="5" height="10" /></element>
</group>
@@ -404,8 +404,8 @@ license:CC0
<group name="display">
<screen index="0" blend="alpha"><bounds x="0" y="0" width="100" height="114.65" /></screen>
- <element ref="nothing" blend="add" inputtag="IN.7" inputmask="0x00" inputraw="1"><bounds x="0" y="0" width="100" height="114.65" /></element>
- <element ref="lcd_bg" blend="multiply" inputtag="IN.7" inputmask="0x02" inputraw="1"><bounds x="0" y="0" width="100" height="114.65" /></element>
+ <element ref="nothing" blend="add" inputtag="IN.7" inputmask="0x00" inputraw="yes"><bounds x="0" y="0" width="100" height="114.65" /></element>
+ <element ref="lcd_bg" blend="multiply" inputtag="IN.7" inputmask="0x02" inputraw="yes"><bounds x="0" y="0" width="100" height="114.65" /></element>
<element ref="lcd_cb" blend="multiply"><bounds x="0" y="0" width="100" height="95.9" /></element>
</group>
diff --git a/src/mame/layout/saitek_mark6.lay b/src/mame/layout/saitek_mark6.lay
index 47741a91cf0..728653b9676 100644
--- a/src/mame/layout/saitek_mark6.lay
+++ b/src/mame/layout/saitek_mark6.lay
@@ -532,67 +532,67 @@ license:CC0
<element ref="hlc" blend="add" inputtag="IN.8" inputmask="0x80"><bounds x="18.333" y="12.333" width="4.666" height="4.666" /></element>
<element ref="black"><bounds x="9" y="22.5" width="14" height="45" /></element>
- <element ref="nothing" blend="add" inputtag="IN.0" inputmask="0x00" inputraw="1"><bounds x="-1" y="-1" width="34" height="69" /></element>
+ <element ref="nothing" blend="add" inputtag="IN.0" inputmask="0x00" inputraw="yes"><bounds x="-1" y="-1" width="34" height="69" /></element>
<!-- button labels (upper) -->
- <element ref="text_b01e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="1" width="6" height="1.4" /></element>
- <element ref="text_b02e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="5" width="6" height="1.4" /></element>
- <element ref="text_b03e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="8.4" width="6" height="1.4" /></element>
- <element ref="text_b0ce" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="9.7" width="6" height="1.4" /></element>
- <element ref="text_b04e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="12.4" width="6" height="1.4" /></element>
- <element ref="text_b0ce" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="13.7" width="6" height="1.4" /></element>
- <element ref="text_b0ce" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="17" width="6" height="1.4" /></element>
- <element ref="text_b11e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="1" width="6" height="1.4" /></element>
- <element ref="text_b12e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="5" width="6" height="1.4" /></element>
- <element ref="text_b13e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="9" width="6" height="1.4" /></element>
- <element ref="text_b14e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="12.1" width="6" height="2.6" /></element>
- <element ref="text_b15e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="16.1" width="6" height="2.6" /></element>
-
- <element ref="text_b01d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="1" width="6" height="1.4" /></element>
- <element ref="text_b02d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="5" width="6" height="1.4" /></element>
- <element ref="text_b03d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="8.4" width="6" height="1.4" /></element>
- <element ref="text_b0cd" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="9.7" width="6" height="1.4" /></element>
- <element ref="text_b04d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="12.4" width="6" height="1.4" /></element>
- <element ref="text_b0cd" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="13.7" width="6" height="1.4" /></element>
- <element ref="text_b0cd" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="0" y="17" width="6" height="1.4" /></element>
- <element ref="text_b11d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="1" width="6" height="1.4" /></element>
- <element ref="text_b12d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="4.4" width="6" height="1.4" /></element>
- <element ref="text_b12d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="5.7" width="6" height="1.4" /></element>
- <element ref="text_b13d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="8.4" width="6" height="1.4" /></element>
- <element ref="text_b13d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="9.7" width="6" height="1.4" /></element>
- <element ref="text_b14d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="13" width="6" height="1.4" /></element>
- <element ref="text_b15d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="26" y="17" width="6" height="1.4" /></element>
+ <element ref="text_b01e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="1" width="6" height="1.4" /></element>
+ <element ref="text_b02e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="5" width="6" height="1.4" /></element>
+ <element ref="text_b03e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="8.4" width="6" height="1.4" /></element>
+ <element ref="text_b0ce" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="9.7" width="6" height="1.4" /></element>
+ <element ref="text_b04e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="12.4" width="6" height="1.4" /></element>
+ <element ref="text_b0ce" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="13.7" width="6" height="1.4" /></element>
+ <element ref="text_b0ce" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="17" width="6" height="1.4" /></element>
+ <element ref="text_b11e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="1" width="6" height="1.4" /></element>
+ <element ref="text_b12e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="5" width="6" height="1.4" /></element>
+ <element ref="text_b13e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="9" width="6" height="1.4" /></element>
+ <element ref="text_b14e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="12.1" width="6" height="2.6" /></element>
+ <element ref="text_b15e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="16.1" width="6" height="2.6" /></element>
+
+ <element ref="text_b01d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="1" width="6" height="1.4" /></element>
+ <element ref="text_b02d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="5" width="6" height="1.4" /></element>
+ <element ref="text_b03d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="8.4" width="6" height="1.4" /></element>
+ <element ref="text_b0cd" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="9.7" width="6" height="1.4" /></element>
+ <element ref="text_b04d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="12.4" width="6" height="1.4" /></element>
+ <element ref="text_b0cd" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="13.7" width="6" height="1.4" /></element>
+ <element ref="text_b0cd" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="0" y="17" width="6" height="1.4" /></element>
+ <element ref="text_b11d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="1" width="6" height="1.4" /></element>
+ <element ref="text_b12d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="4.4" width="6" height="1.4" /></element>
+ <element ref="text_b12d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="5.7" width="6" height="1.4" /></element>
+ <element ref="text_b13d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="8.4" width="6" height="1.4" /></element>
+ <element ref="text_b13d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="9.7" width="6" height="1.4" /></element>
+ <element ref="text_b14d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="13" width="6" height="1.4" /></element>
+ <element ref="text_b15d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="26" y="17" width="6" height="1.4" /></element>
<!-- button labels (lower) -->
- <element ref="text_b21e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="26" width="10" height="1.4" /></element>
- <element ref="text_b22e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="30" width="10" height="1.4" /></element>
- <element ref="text_b23e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="34" width="10" height="1.4" /></element>
- <element ref="text_b24e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="37.4" width="10" height="1.4" /></element>
- <element ref="text_b24e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="38.7" width="10" height="1.4" /></element>
- <element ref="text_b25e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="42" width="10" height="1.4" /></element>
- <element ref="text_b26e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="45.4" width="10" height="1.4" /></element>
- <element ref="text_b26e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="46.7" width="10" height="1.4" /></element>
- <element ref="text_b27e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="50" width="10" height="1.4" /></element>
- <element ref="text_b28e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="54" width="10" height="1.4" /></element>
- <element ref="text_b29e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="57.4" width="10" height="1.4" /></element>
- <element ref="text_b29e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="58.7" width="10" height="1.4" /></element>
- <element ref="text_b2ae1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="61.4" width="10" height="1.4" /></element>
- <element ref="text_b2ae2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="62.7" width="10" height="1.4" /></element>
-
- <element ref="text_b21d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="26" width="10" height="1.4" /></element>
- <element ref="text_b22d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="30" width="10" height="1.4" /></element>
- <element ref="text_b23d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="34" width="10" height="1.4" /></element>
- <element ref="text_b24d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="37.4" width="10" height="1.4" /></element>
- <element ref="text_b24d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="38.7" width="10" height="1.4" /></element>
- <element ref="text_b25d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="41.4" width="10" height="1.4" /></element>
- <element ref="text_b25d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="42.7" width="10" height="1.4" /></element>
- <element ref="text_b26d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="46" width="10" height="1.4" /></element>
- <element ref="text_b27d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="50" width="10" height="1.4" /></element>
- <element ref="text_b28d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="54" width="10" height="1.4" /></element>
- <element ref="text_b29d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="57.4" width="10" height="1.4" /></element>
- <element ref="text_b29d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="58.7" width="10" height="1.4" /></element>
- <element ref="text_b2ad1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="61.4" width="10" height="1.4" /></element>
- <element ref="text_b2ad2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="9.8" y="62.7" width="10" height="1.4" /></element>
+ <element ref="text_b21e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="26" width="10" height="1.4" /></element>
+ <element ref="text_b22e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="30" width="10" height="1.4" /></element>
+ <element ref="text_b23e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="34" width="10" height="1.4" /></element>
+ <element ref="text_b24e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="37.4" width="10" height="1.4" /></element>
+ <element ref="text_b24e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="38.7" width="10" height="1.4" /></element>
+ <element ref="text_b25e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="42" width="10" height="1.4" /></element>
+ <element ref="text_b26e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="45.4" width="10" height="1.4" /></element>
+ <element ref="text_b26e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="46.7" width="10" height="1.4" /></element>
+ <element ref="text_b27e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="50" width="10" height="1.4" /></element>
+ <element ref="text_b28e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="54" width="10" height="1.4" /></element>
+ <element ref="text_b29e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="57.4" width="10" height="1.4" /></element>
+ <element ref="text_b29e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="58.7" width="10" height="1.4" /></element>
+ <element ref="text_b2ae1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="61.4" width="10" height="1.4" /></element>
+ <element ref="text_b2ae2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="62.7" width="10" height="1.4" /></element>
+
+ <element ref="text_b21d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="26" width="10" height="1.4" /></element>
+ <element ref="text_b22d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="30" width="10" height="1.4" /></element>
+ <element ref="text_b23d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="34" width="10" height="1.4" /></element>
+ <element ref="text_b24d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="37.4" width="10" height="1.4" /></element>
+ <element ref="text_b24d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="38.7" width="10" height="1.4" /></element>
+ <element ref="text_b25d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="41.4" width="10" height="1.4" /></element>
+ <element ref="text_b25d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="42.7" width="10" height="1.4" /></element>
+ <element ref="text_b26d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="46" width="10" height="1.4" /></element>
+ <element ref="text_b27d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="50" width="10" height="1.4" /></element>
+ <element ref="text_b28d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="54" width="10" height="1.4" /></element>
+ <element ref="text_b29d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="57.4" width="10" height="1.4" /></element>
+ <element ref="text_b29d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="58.7" width="10" height="1.4" /></element>
+ <element ref="text_b2ad1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="61.4" width="10" height="1.4" /></element>
+ <element ref="text_b2ad2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="9.8" y="62.7" width="10" height="1.4" /></element>
<element ref="text_r9" blend="add"><bounds x="16.5" y="26" width="6" height="1.4" /></element>
<element ref="text_r8" blend="add"><bounds x="16.5" y="30" width="6" height="1.4" /></element>
@@ -623,31 +623,31 @@ license:CC0
<element ref="blackd"><bounds x="18.15" y="33.85" width="1.8" height="1.8" /></element>
<element ref="white"><bounds x="18.7" y="34.4" width="0.7" height="0.7" /></element>
- <element ref="text_b31e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="24.7" width="2" height="1.4" /></element>
- <element ref="text_b31e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="26.0" width="2" height="1.4" /></element>
- <element ref="text_b31e3" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="27.3" width="2" height="1.4" /></element>
- <element ref="text_b32e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="61.4" width="2" height="1.4" /></element>
- <element ref="text_b32e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="62.7" width="2" height="1.4" /></element>
- <element ref="text_b33e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="17.6" y="26" width="3" height="1.4" /></element>
- <element ref="text_b34e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="17.6" y="62" width="3" height="1.4" /></element>
-
- <element ref="text_b31d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="25.4" width="2" height="1.4" /></element>
- <element ref="text_b31d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="26.7" width="2" height="1.4" /></element>
- <element ref="text_b32d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="60.7" width="2" height="1.4" /></element>
- <element ref="text_b32d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="62.0" width="2" height="1.4" /></element>
- <element ref="text_b32d3" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="63.3" width="2" height="1.4" /></element>
- <element ref="text_b32d4" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="20" y="64.6" width="2" height="1.4" /></element>
- <element ref="text_b33d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="17.6" y="26" width="3" height="1.4" /></element>
- <element ref="text_b34d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="1"><bounds x="17.6" y="62" width="3" height="1.4" /></element>
+ <element ref="text_b31e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="24.7" width="2" height="1.4" /></element>
+ <element ref="text_b31e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="26.0" width="2" height="1.4" /></element>
+ <element ref="text_b31e3" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="27.3" width="2" height="1.4" /></element>
+ <element ref="text_b32e1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="61.4" width="2" height="1.4" /></element>
+ <element ref="text_b32e2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="62.7" width="2" height="1.4" /></element>
+ <element ref="text_b33e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="17.6" y="26" width="3" height="1.4" /></element>
+ <element ref="text_b34e" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="17.6" y="62" width="3" height="1.4" /></element>
+
+ <element ref="text_b31d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="25.4" width="2" height="1.4" /></element>
+ <element ref="text_b31d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="26.7" width="2" height="1.4" /></element>
+ <element ref="text_b32d1" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="60.7" width="2" height="1.4" /></element>
+ <element ref="text_b32d2" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="62.0" width="2" height="1.4" /></element>
+ <element ref="text_b32d3" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="63.3" width="2" height="1.4" /></element>
+ <element ref="text_b32d4" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="20" y="64.6" width="2" height="1.4" /></element>
+ <element ref="text_b33d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="17.6" y="26" width="3" height="1.4" /></element>
+ <element ref="text_b34d" blend="add" inputtag="IN.6" inputmask="0x04" inputraw="yes"><bounds x="17.6" y="62" width="3" height="1.4" /></element>
<!-- switches -->
<element ref="text_lcd1"><bounds x="46" y="57" width="5" height="1.4" /></element>
<element ref="text_lcd2"><bounds x="46" y="65.5" width="5" height="1.4" /></element>
- <element ref="switch" inputtag="IN.7" inputmask="0x02" inputraw="1"><bounds x="46" y="57" width="5" height="10" /></element>
+ <element ref="switch" inputtag="IN.7" inputmask="0x02" inputraw="yes"><bounds x="46" y="57" width="5" height="10" /></element>
<element ref="text_sound1"><bounds x="52" y="57" width="5" height="1.4" /></element>
<element ref="text_sound2"><bounds x="52" y="65.5" width="5" height="1.4" /></element>
- <element ref="switch" inputtag="IN.7" inputmask="0x01" inputraw="1"><bounds x="52" y="57" width="5" height="10" /></element>
+ <element ref="switch" inputtag="IN.7" inputmask="0x01" inputraw="yes"><bounds x="52" y="57" width="5" height="10" /></element>
</group>
@@ -718,8 +718,8 @@ license:CC0
<group name="display">
<screen index="0" blend="alpha"><bounds x="0" y="0" width="100" height="114.65" /></screen>
- <element ref="nothing" blend="add" inputtag="IN.7" inputmask="0x00" inputraw="1"><bounds x="0" y="0" width="100" height="114.65" /></element>
- <element ref="lcd_bg" blend="multiply" inputtag="IN.7" inputmask="0x02" inputraw="1"><bounds x="0" y="0" width="100" height="114.65" /></element>
+ <element ref="nothing" blend="add" inputtag="IN.7" inputmask="0x00" inputraw="yes"><bounds x="0" y="0" width="100" height="114.65" /></element>
+ <element ref="lcd_bg" blend="multiply" inputtag="IN.7" inputmask="0x02" inputraw="yes"><bounds x="0" y="0" width="100" height="114.65" /></element>
<element ref="lcd_cb" blend="multiply"><bounds x="0" y="0" width="100" height="95.9" /></element>
</group>
diff --git a/src/mame/layout/saitek_ssystem3.lay b/src/mame/layout/saitek_ssystem3.lay
index 07dce2f931d..0ee2fa6e6c7 100644
--- a/src/mame/layout/saitek_ssystem3.lay
+++ b/src/mame/layout/saitek_ssystem3.lay
@@ -206,8 +206,8 @@ license:CC0
<group name="lcd1">
<bounds x="-1" y="3" width="18" height="8" />
<screen index="0" blend="alpha"><bounds x="0" y="4" width="15.8" height="6" /></screen>
- <element ref="nothing" blend="add" inputtag="IN.4" inputmask="0x00" inputraw="1"><bounds x="-1" y="3" width="18" height="8" /></element>
- <element ref="lcd_bg" blend="multiply" inputtag="IN.4" inputmask="0x02" inputraw="1"><bounds x="-1" y="3" width="18" height="8" /></element>
+ <element ref="nothing" blend="add" inputtag="IN.4" inputmask="0x00" inputraw="yes"><bounds x="-1" y="3" width="18" height="8" /></element>
+ <element ref="lcd_bg" blend="multiply" inputtag="IN.4" inputmask="0x02" inputraw="yes"><bounds x="-1" y="3" width="18" height="8" /></element>
</group>
@@ -262,8 +262,8 @@ license:CC0
<screen index="1" blend="alpha"><bounds x="9.8" y="10" width="106" height="108" /></screen>
<element ref="lcd_cb" blend="multiply"><bounds x="1.5" y="2.9" width="122.6" height="122.1" /></element>
- <element ref="nothing" blend="add" inputtag="IN.4" inputmask="0x00" inputraw="1"><bounds x="6.2" y="7.6" width="113.3" height="112.8" /></element>
- <element ref="lcd2m" blend="multiply" inputtag="IN.4" inputmask="0x04" inputraw="1"><bounds x="6.2" y="7.6" width="113.3" height="112.8" /></element>
+ <element ref="nothing" blend="add" inputtag="IN.4" inputmask="0x00" inputraw="yes"><bounds x="6.2" y="7.6" width="113.3" height="112.8" /></element>
+ <element ref="lcd2m" blend="multiply" inputtag="IN.4" inputmask="0x04" inputraw="yes"><bounds x="6.2" y="7.6" width="113.3" height="112.8" /></element>
</group>
@@ -275,8 +275,8 @@ license:CC0
<element ref="brown"><bounds x="-2" y="12" width="52" height="6" /></element>
- <element ref="switch" inputtag="IN.4" inputmask="0x02" inputraw="1"><bounds x="30.0" y="5.5" width="1.2" height="2.4" /></element>
- <element ref="switch" inputtag="IN.4" inputmask="0x01" inputraw="1"><bounds x="34.4" y="5.5" width="1.2" height="2.4" /></element>
+ <element ref="switch" inputtag="IN.4" inputmask="0x02" inputraw="yes"><bounds x="30.0" y="5.5" width="1.2" height="2.4" /></element>
+ <element ref="switch" inputtag="IN.4" inputmask="0x01" inputraw="yes"><bounds x="34.4" y="5.5" width="1.2" height="2.4" /></element>
<element ref="switch" inputtag="IN.3" inputmask="0x01"><bounds x="38.8" y="5.5" width="1.2" height="2.4" /><orientation rotate="180" /></element>
<element ref="text_u1"><bounds x="28.0" y="8.2" width="5.2" height="0.9" /></element>
<element ref="text_u2"><bounds x="32.4" y="8.2" width="5.2" height="0.9" /></element>
@@ -376,8 +376,8 @@ license:CC0
<element ref="text_a~i~"><bounds x="~x~" y="17.2" width="1.5" height="0.9" /></element>
</repeat>
- <element ref="switch2" inputtag="IN.6" inputmask="0x01" inputraw="1"><bounds x="36" y="24" width="4" height="5" /></element>
- <element ref="switch2" inputtag="IN.4" inputmask="0x04" inputraw="1"><bounds x="42" y="24" width="4" height="5" /></element>
+ <element ref="switch2" inputtag="IN.6" inputmask="0x01" inputraw="yes"><bounds x="36" y="24" width="4" height="5" /></element>
+ <element ref="switch2" inputtag="IN.4" inputmask="0x04" inputraw="yes"><bounds x="42" y="24" width="4" height="5" /></element>
<element ref="text_cu1"><bounds x="35" y="21.9" width="6" height="0.9" /></element>
<element ref="text_cu2"><bounds x="35" y="22.9" width="6" height="0.9" /></element>
diff --git a/src/mame/layout/saitek_ssystem4.lay b/src/mame/layout/saitek_ssystem4.lay
index f722be515bc..bbe201a234d 100644
--- a/src/mame/layout/saitek_ssystem4.lay
+++ b/src/mame/layout/saitek_ssystem4.lay
@@ -90,8 +90,8 @@ license:CC0
<bounds left="8" right="52" top="1" bottom="39" />
<screen index="0" blend="alpha"><bounds x="10" y="4" width="15.8" height="6" /></screen>
- <element ref="nothing" blend="add" inputtag="IN.4" inputmask="0x00" inputraw="1"><bounds x="9" y="3" width="18" height="8" /></element>
- <element ref="lcd_bg" blend="multiply" inputtag="IN.4" inputmask="0x02" inputraw="1"><bounds x="9" y="3" width="18" height="8" /></element>
+ <element ref="nothing" blend="add" inputtag="IN.4" inputmask="0x00" inputraw="yes"><bounds x="9" y="3" width="18" height="8" /></element>
+ <element ref="lcd_bg" blend="multiply" inputtag="IN.4" inputmask="0x02" inputraw="yes"><bounds x="9" y="3" width="18" height="8" /></element>
<element ref="button" inputtag="IN.0" inputmask="0x04"><bounds x="28" y="4" width="5" height="6" /></element>
<element ref="text_l1"><bounds x="28" y="2.2" width="5" height="1.8" /></element>
diff --git a/src/mame/layout/savia84.lay b/src/mame/layout/savia84.lay
index 10a18dbf5ea..f9f9a5a93a4 100644
--- a/src/mame/layout/savia84.lay
+++ b/src/mame/layout/savia84.lay
@@ -9,13 +9,12 @@ license:CC0
</led7seg>
</element>
<element name="red_led">
- <disk>
+ <disk state="0">
<color red="1.0" green="0.0" blue="0.0" />
</disk>
</element>
<element name="background">
<rect>
- <bounds left="0" top="0" right="1" bottom="1" />
<color red="0.0" green="0.0" blue="0.0" />
</rect>
</element>
diff --git a/src/mame/layout/simon.lay b/src/mame/layout/simon.lay
index a7af62af55f..ef2f491a5c6 100644
--- a/src/mame/layout/simon.lay
+++ b/src/mame/layout/simon.lay
@@ -198,10 +198,10 @@ license:CC0
<element ref="text_game">
<bounds x="68" y="93" width="20" height="4" />
</element>
- <element ref="nothing" inputtag="IN.0" inputmask="0x00" inputraw="1">
+ <element ref="nothing" inputtag="IN.0" inputmask="0x00" inputraw="yes">
<bounds x="73.9" y="97.9" width="3.2" height="4.2" />
</element>
- <element ref="switch_game" inputtag="IN.0" inputmask="0x07" inputraw="1">
+ <element ref="switch_game" inputtag="IN.0" inputmask="0x07" inputraw="yes">
<bounds x="74" y="98" width="3" height="4" />
</element>
<element ref="text_lg">
@@ -220,10 +220,10 @@ license:CC0
<element ref="text_skill">
<bounds x="112" y="93" width="30" height="4" />
</element>
- <element ref="nothing" inputtag="IN.3" inputmask="0x00" inputraw="1">
+ <element ref="nothing" inputtag="IN.3" inputmask="0x00" inputraw="yes">
<bounds x="122.9" y="97.9" width="3.2" height="4.2" />
</element>
- <element ref="switch_skill" inputtag="IN.3" inputmask="0x0f" inputraw="1">
+ <element ref="switch_skill" inputtag="IN.3" inputmask="0x0f" inputraw="yes">
<bounds x="123" y="98" width="3" height="4" />
</element>
<element ref="text_lb">
diff --git a/src/mame/layout/speedfrk.lay b/src/mame/layout/speedfrk.lay
index 44b9bf2f0f7..4b24da8ef64 100644
--- a/src/mame/layout/speedfrk.lay
+++ b/src/mame/layout/speedfrk.lay
@@ -94,7 +94,7 @@ license:CC0
<screen index="0">
<bounds x="0" y="0" width="640" height="480" />
</screen>
- <element ref="shifter" inputtag="GEAR" inputmask="0x0f" inputraw="1">
+ <element ref="shifter" inputtag="GEAR" inputmask="0x0f" inputraw="yes">
<bounds x="574" y="414" width="64" height="64" />
<color alpha="0.6" />
</element>
@@ -103,7 +103,7 @@ license:CC0
<screen index="0">
<bounds x="0" y="0" width="640" height="480" />
</screen>
- <element ref="shifter" inputtag="GEAR" inputmask="0x0f" inputraw="1">
+ <element ref="shifter" inputtag="GEAR" inputmask="0x0f" inputraw="yes">
<bounds x="2" y="414" width="64" height="64" />
<color alpha="0.6" />
</element>
@@ -112,7 +112,7 @@ license:CC0
<screen index="0">
<bounds x="0" y="0" width="640" height="480" />
</screen>
- <element ref="shifter" inputtag="GEAR" inputmask="0x0f" inputraw="1">
+ <element ref="shifter" inputtag="GEAR" inputmask="0x0f" inputraw="yes">
<bounds x="648" y="414" width="64" height="64" />
<color alpha="0.65" />
</element>
@@ -121,7 +121,7 @@ license:CC0
<screen index="0">
<bounds x="0" y="0" width="640" height="480" />
</screen>
- <element ref="shifter" inputtag="GEAR" inputmask="0x0f" inputraw="1">
+ <element ref="shifter" inputtag="GEAR" inputmask="0x0f" inputraw="yes">
<bounds x="-72" y="414" width="64" height="64" />
<color alpha="0.65" />
</element>
diff --git a/src/mame/layout/ssimon.lay b/src/mame/layout/ssimon.lay
index bbdd3616113..bc819d755a3 100644
--- a/src/mame/layout/ssimon.lay
+++ b/src/mame/layout/ssimon.lay
@@ -212,10 +212,10 @@ license:CC0
<element ref="text_s3"><bounds x="-3.9" y="32.15" width="3.5" height="0.9" /></element>
<element ref="static_black2"><bounds x="-6.5" y="29.125" width="0.5" height="4.5" /></element>
- <element ref="nothing" inputtag="IN.6" inputmask="0x00" inputraw="1"><bounds x="-7.25" y="29.125" width="2" height="4.5" /></element>
- <element ref="switch0" inputtag="IN.6" inputmask="0x03" inputraw="1"><bounds x="-7" y="29.625" width="1.5" height="1" /></element>
- <element ref="switch1" inputtag="IN.6" inputmask="0x03" inputraw="1"><bounds x="-7" y="30.875" width="1.5" height="1" /></element>
- <element ref="switch2" inputtag="IN.6" inputmask="0x03" inputraw="1"><bounds x="-7" y="32.125" width="1.5" height="1" /></element>
+ <element ref="nothing" inputtag="IN.6" inputmask="0x00" inputraw="yes"><bounds x="-7.25" y="29.125" width="2" height="4.5" /></element>
+ <element ref="switch0" inputtag="IN.6" inputmask="0x03" inputraw="yes"><bounds x="-7" y="29.625" width="1.5" height="1" /></element>
+ <element ref="switch1" inputtag="IN.6" inputmask="0x03" inputraw="yes"><bounds x="-7" y="30.875" width="1.5" height="1" /></element>
+ <element ref="switch2" inputtag="IN.6" inputmask="0x03" inputraw="yes"><bounds x="-7" y="32.125" width="1.5" height="1" /></element>
<element ref="static_black"><bounds x="-6.25" y="30.00" width="2" height="0.25" /></element>
<element ref="static_black"><bounds x="-6.25" y="31.25" width="2" height="0.25" /></element>
@@ -245,20 +245,20 @@ license:CC0
<element ref="text_4"><bounds x="50.25" y="34.65" width="1" height="0.9" /></element>
<element ref="static_black2"><bounds x="53" y="16.875" width="0.5" height="7" /></element>
- <element ref="nothing" inputtag="IN.0" inputmask="0x00" inputraw="1"><bounds x="52.25" y="16.875" width="2" height="7" /></element>
- <element ref="switch0" inputtag="IN.0" inputmask="0x0f" inputraw="1"><bounds x="52.5" y="17.375" width="1.5" height="1" /></element>
- <element ref="switch8" inputtag="IN.0" inputmask="0x0f" inputraw="1"><bounds x="52.5" y="18.625" width="1.5" height="1" /></element>
- <element ref="switch4" inputtag="IN.0" inputmask="0x0f" inputraw="1"><bounds x="52.5" y="19.875" width="1.5" height="1" /></element>
- <element ref="switch2" inputtag="IN.0" inputmask="0x0f" inputraw="1"><bounds x="52.5" y="21.125" width="1.5" height="1" /></element>
- <element ref="switch1" inputtag="IN.0" inputmask="0x0f" inputraw="1"><bounds x="52.5" y="22.375" width="1.5" height="1" /></element>
+ <element ref="nothing" inputtag="IN.0" inputmask="0x00" inputraw="yes"><bounds x="52.25" y="16.875" width="2" height="7" /></element>
+ <element ref="switch0" inputtag="IN.0" inputmask="0x0f" inputraw="yes"><bounds x="52.5" y="17.375" width="1.5" height="1" /></element>
+ <element ref="switch8" inputtag="IN.0" inputmask="0x0f" inputraw="yes"><bounds x="52.5" y="18.625" width="1.5" height="1" /></element>
+ <element ref="switch4" inputtag="IN.0" inputmask="0x0f" inputraw="yes"><bounds x="52.5" y="19.875" width="1.5" height="1" /></element>
+ <element ref="switch2" inputtag="IN.0" inputmask="0x0f" inputraw="yes"><bounds x="52.5" y="21.125" width="1.5" height="1" /></element>
+ <element ref="switch1" inputtag="IN.0" inputmask="0x0f" inputraw="yes"><bounds x="52.5" y="22.375" width="1.5" height="1" /></element>
<element ref="static_black2"><bounds x="53" y="29.125" width="0.5" height="7" /></element>
- <element ref="nothing" inputtag="IN.4" inputmask="0x00" inputraw="1"><bounds x="52.25" y="29.125" width="2" height="7" /></element>
- <element ref="switch0" inputtag="IN.4" inputmask="0x0f" inputraw="1"><bounds x="52.5" y="29.625" width="1.5" height="1" /></element>
- <element ref="switch2" inputtag="IN.4" inputmask="0x0f" inputraw="1"><bounds x="52.5" y="30.875" width="1.5" height="1" /></element>
- <element ref="switch4" inputtag="IN.4" inputmask="0x0f" inputraw="1"><bounds x="52.5" y="32.125" width="1.5" height="1" /></element>
- <element ref="switch8" inputtag="IN.4" inputmask="0x0f" inputraw="1"><bounds x="52.5" y="33.375" width="1.5" height="1" /></element>
- <element ref="switch1" inputtag="IN.4" inputmask="0x0f" inputraw="1"><bounds x="52.5" y="34.625" width="1.5" height="1" /></element>
+ <element ref="nothing" inputtag="IN.4" inputmask="0x00" inputraw="yes"><bounds x="52.25" y="29.125" width="2" height="7" /></element>
+ <element ref="switch0" inputtag="IN.4" inputmask="0x0f" inputraw="yes"><bounds x="52.5" y="29.625" width="1.5" height="1" /></element>
+ <element ref="switch2" inputtag="IN.4" inputmask="0x0f" inputraw="yes"><bounds x="52.5" y="30.875" width="1.5" height="1" /></element>
+ <element ref="switch4" inputtag="IN.4" inputmask="0x0f" inputraw="yes"><bounds x="52.5" y="32.125" width="1.5" height="1" /></element>
+ <element ref="switch8" inputtag="IN.4" inputmask="0x0f" inputraw="yes"><bounds x="52.5" y="33.375" width="1.5" height="1" /></element>
+ <element ref="switch1" inputtag="IN.4" inputmask="0x0f" inputraw="yes"><bounds x="52.5" y="34.625" width="1.5" height="1" /></element>
<element ref="static_black"><bounds x="51.25" y="17.75" width="2" height="0.25" /></element>
<element ref="static_black"><bounds x="51.25" y="19.00" width="2" height="0.25" /></element>
diff --git a/src/mame/layout/super80.lay b/src/mame/layout/super80.lay
index be74fbd16a6..25b07626448 100644
--- a/src/mame/layout/super80.lay
+++ b/src/mame/layout/super80.lay
@@ -4,10 +4,8 @@ license:CC0
-->
<mamelayout version="2">
- <element name="red_led">
- <disk>
- <color red="1.0" green="0.0" blue="0.0" />
- </disk>
+ <element name="red_led" defstate="0">
+ <disk state="0"><color red="1.0" green="0.0" blue="0.0" /></disk>
</element>
<element name="CASSETTE">
diff --git a/src/mame/layout/tisub.lay b/src/mame/layout/tisub.lay
index 8b8baa1c6c4..4a04406b81c 100644
--- a/src/mame/layout/tisub.lay
+++ b/src/mame/layout/tisub.lay
@@ -10,7 +10,7 @@ license:CC0
<rect state="0">
<color red="0.3" green="0.0" blue="0.0" />
</rect>
- <text string="HOLD 1">
+ <text string="STOP 1">
<color red="0.0" green="0.0" blue="0.0" />
<bounds x="0" y="0.2" width="1" height="0.6" />
</text>
@@ -23,7 +23,7 @@ license:CC0
<rect state="0">
<color red="0.3" green="0.0" blue="0.0" />
</rect>
- <text string="HOLD 2">
+ <text string="STOP 2">
<color red="0.0" green="0.0" blue="0.0" />
<bounds x="0" y="0.1" width="1" height="0.4" />
</text>
@@ -40,7 +40,7 @@ license:CC0
<rect state="0">
<color red="0.3" green="0.0" blue="0.0" />
</rect>
- <text string="HOLD 3">
+ <text string="STOP 3">
<color red="0.0" green="0.0" blue="0.0" />
<bounds x="0" y="0.1" width="1" height="0.4" />
</text>
diff --git a/src/mame/layout/touchme.lay b/src/mame/layout/touchme.lay
index a97fd470405..25df5f557fa 100644
--- a/src/mame/layout/touchme.lay
+++ b/src/mame/layout/touchme.lay
@@ -199,9 +199,9 @@ license:CC0
<element ref="disk_black"><bounds x="8.5" y="18.9" width="0.5" height="0.5" /></element>
<element ref="static_black"><bounds x="7.8" y="18.9" width="1.0" height="0.5" /></element>
- <element ref="switch1" inputtag="IN.2" inputmask="0x07" inputraw="1"><bounds x="7.55" y="18.85" width="0.6" height="0.6" /></element>
- <element ref="switch2" inputtag="IN.2" inputmask="0x07" inputraw="1"><bounds x="8.00" y="18.85" width="0.6" height="0.6" /></element>
- <element ref="switch3" inputtag="IN.2" inputmask="0x07" inputraw="1"><bounds x="8.45" y="18.85" width="0.6" height="0.6" /></element>
+ <element ref="switch1" inputtag="IN.2" inputmask="0x07" inputraw="yes"><bounds x="7.55" y="18.85" width="0.6" height="0.6" /></element>
+ <element ref="switch2" inputtag="IN.2" inputmask="0x07" inputraw="yes"><bounds x="8.00" y="18.85" width="0.6" height="0.6" /></element>
+ <element ref="switch3" inputtag="IN.2" inputmask="0x07" inputraw="yes"><bounds x="8.45" y="18.85" width="0.6" height="0.6" /></element>
</view>
</mamelayout>
diff --git a/src/mame/layout/vk100.lay b/src/mame/layout/vk100.lay
index 0561f203475..61bd520006f 100644
--- a/src/mame/layout/vk100.lay
+++ b/src/mame/layout/vk100.lay
@@ -8,7 +8,7 @@ Basic display of LEDs for the DEC VK100, based on VT100 layout
<mamelayout version="2">
<element name="red_led">
- <disk>
+ <disk state="0">
<color red="1.0" green="0.0" blue="0.0" />
</disk>
</element>
diff --git a/src/mame/layout/vt100.lay b/src/mame/layout/vt100.lay
index 7790bf7d7bf..e3b0241e7f8 100644
--- a/src/mame/layout/vt100.lay
+++ b/src/mame/layout/vt100.lay
@@ -8,7 +8,7 @@ Basic display of LEDs for the DEC VT100
<mamelayout version="2">
<element name="red_led">
- <disk>
+ <disk state="0">
<color red="1.0" green="0.0" blue="0.0" />
</disk>
</element>
diff --git a/src/mame/layout/x68000.lay b/src/mame/layout/x68000.lay
index cc5f5846cce..c716a716e22 100644
--- a/src/mame/layout/x68000.lay
+++ b/src/mame/layout/x68000.lay
@@ -8,17 +8,17 @@ Basic display of disk drive LEDs for the Sharp X680x0
<mamelayout version="2">
<element name="access_led">
- <disk>
+ <disk state="0">
<color red="1.0" green="0.0" blue="0.0" />
</disk>
</element>
<element name="ctrl_led">
- <disk>
+ <disk state="0">
<color red="0.0" green="1.0" blue="0.0" />
</disk>
</element>
<element name="eject_led">
- <disk>
+ <disk state="0">
<color red="0.5" green="0.0" blue="0.0" />
</disk>
</element>
diff --git a/src/mame/layout/zodiac.lay b/src/mame/layout/zodiac.lay
index 1213cb5d15c..1409315e37b 100644
--- a/src/mame/layout/zodiac.lay
+++ b/src/mame/layout/zodiac.lay
@@ -218,7 +218,7 @@ license:CC0
<element ref="hl" inputtag="IN.2" inputmask="0x01"><bounds x="93.5" y="106.25" width="7" height="7" /><color alpha="0.2" /></element>
<element ref="hl" inputtag="IN.3" inputmask="0x08"><bounds x="86.5" y="123" width="7" height="7" /><color alpha="0.2" /></element>
- <element ref="switch_mode" inputtag="IN.5" inputmask="0x03" inputraw="1"><bounds x="56.5" y="140" width="7" height="7" /></element>
+ <element ref="switch_mode" inputtag="IN.5" inputmask="0x03" inputraw="yes"><bounds x="56.5" y="140" width="7" height="7" /></element>
<element ref="text_mode"><bounds x="45" y="148" width="30" height="4" /></element>
</view>
diff --git a/src/mame/machine/abc1600mac.cpp b/src/mame/machine/abc1600mac.cpp
index 4b051edf785..1e46a1bcda0 100644
--- a/src/mame/machine/abc1600mac.cpp
+++ b/src/mame/machine/abc1600mac.cpp
@@ -233,7 +233,7 @@ offs_t abc1600_mac_device::translate_address(offs_t offset, int *nonx, int *wp)
*nonx = PAGE_NONX;
*wp = PAGE_WP;
- if (LOG_MAC && offset != virtual_offset) logerror("%s MAC %05x:%06x (SEGA %03x SEGD %02x PGA %03x PGD %04x NONX %u WP %u)\n", machine().describe_context(), offset, virtual_offset, sega, segd, pga, m_page_ram[pga], *nonx, *wp);
+ if (LOG_MAC && offset != virtual_offset) logerror("%s MAC %05x:%06x (SEGA %03x SEGD %02x PGA %03x PGD %04x NONX %u WP %u TASK %u FC %u)\n", machine().describe_context(), offset, virtual_offset, sega, segd, pga, m_page_ram[pga], *nonx, *wp, get_current_task(offset), get_fc());
return virtual_offset;
}
@@ -440,7 +440,8 @@ void abc1600_mac_device::task_w(offs_t offset, uint8_t data)
m_task = data ^ 0xff;
- if (LOG) logerror("%s TASK %05x:%02x (TASK %u BOOTE %u MAGIC %u)\n", machine().describe_context(), offset, data, get_current_task(offset), BOOTE, MAGIC);
+ if (LOG) logerror("%s TASK %05x:%02x (TASK %u BOOTE %u MAGIC %u)\n", machine().describe_context(), offset, data,
+ get_current_task(offset), BOOTE, MAGIC);
}
@@ -497,7 +498,8 @@ void abc1600_mac_device::segment_w(offs_t offset, uint8_t data)
m_segment_ram[sega] = data & 0x7f;
- if (LOG) logerror("%s SEGMENT %05x:%02x (SEGA %03x SEGD %02x)\n", machine().describe_context(), offset, data, sega, m_segment_ram[sega]);
+ if (LOG) logerror("%s %05x:%02x TASK %u SEGMENT %u MEM %05x-%05x\n", machine().describe_context(), offset, data,
+ get_current_task(offset), sega & 0x1f, (sega & 0x1f) * 0x8000, ((sega & 0x1f) * 0x8000) + 0x7fff);
}
@@ -602,7 +604,9 @@ void abc1600_mac_device::page_w(offs_t offset, uint8_t data)
m_page_ram[pga] = ((data & 0xc3) << 8) | (m_page_ram[pga] & 0xff);
}
- if (LOG) logerror("%s PAGE %05x:%02x (SEGA %03x SEGD %02x PGA %03x PGD %04x)\n", machine().describe_context(), offset, data, sega, segd, pga, m_page_ram[pga]);
+ if (LOG) logerror("%s %05x:%02x TASK %u SEGMENT %u PAGE %u MEM %05x-%05x %06x\n", machine().describe_context(), offset, data,
+ get_current_task(offset), sega & 0x1f, ((offset >> 11) & 0x0f), ((sega & 0x1f) * 0x8000) + ((offset >> 11) & 0x0f) * 0x800,
+ ((sega & 0x1f) * 0x8000) + (((offset >> 11) & 0x0f) * 0x800) + 0x7ff, (m_page_ram[pga] & 0x3ff) << 11);
}
diff --git a/src/mame/machine/compiskb.cpp b/src/mame/machine/compiskb.cpp
index 39bf5e411a2..0ecb0a99193 100644
--- a/src/mame/machine/compiskb.cpp
+++ b/src/mame/machine/compiskb.cpp
@@ -75,7 +75,7 @@ void compis_keyboard_device::device_add_mconfig(machine_config &config)
INPUT_PORTS_START( compis_keyboard )
PORT_START("Y1")
- PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(u_UMLAUT " " U_UMLAUT) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00FC) PORT_CHAR(0x00DC)
+ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(u_UMLAUT " " U_UMLAUT) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00FC,'~') PORT_CHAR(0x00DC,'^')
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TABR") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN))
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TABL") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP))
@@ -88,7 +88,7 @@ INPUT_PORTS_START( compis_keyboard )
PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("Y2")
- PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("'' *") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('*')
+ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("'' *") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(39) PORT_CHAR('*')
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMPIS !") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMPIS ?") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMPIS |") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
@@ -188,7 +188,7 @@ INPUT_PORTS_START( compis_keyboard )
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(a_UMLAUT " " A_UMLAUT) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4)
- PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC2\xB4 `") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('`')
+ PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC2\xB4 `") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00b4) PORT_CHAR('`')
PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("SPECIAL")
diff --git a/src/mame/machine/cuda.cpp b/src/mame/machine/cuda.cpp
index ce4c32ad487..9be2fbd3dbc 100644
--- a/src/mame/machine/cuda.cpp
+++ b/src/mame/machine/cuda.cpp
@@ -87,7 +87,7 @@ void cuda_device::cuda_map(address_map &map)
void cuda_device::device_add_mconfig(machine_config &config)
{
- M68HC05EG(config, m_maincpu, XTAL(32'768)*192); // 32.768 kHz input clock, can be PLL'ed to x128 = 4.1 MHz under s/w control
+ M68HC05EG(config, m_maincpu, XTAL(32'768)*128); // Intended to run 4.1 MHz, the ADB timings in uS are twice as long as spec at 2.1
m_maincpu->set_addrmap(AS_PROGRAM, &cuda_device::cuda_map);
}
diff --git a/src/mame/machine/dec_lk201.cpp b/src/mame/machine/dec_lk201.cpp
index 3294781901b..aca879a7775 100644
--- a/src/mame/machine/dec_lk201.cpp
+++ b/src/mame/machine/dec_lk201.cpp
@@ -334,7 +334,7 @@ N/C = switch present, but officially unused?
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) // E99, exists but no key above this position
PORT_START("KBD3") // Row P1-7
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("<") PORT_CODE(KEYCODE_BACKSLASH2) // B00
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("<") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') // B00
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') // B02
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') // C02
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') // D02
@@ -394,7 +394,7 @@ N/C = switch present, but officially unused?
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("KBD9") // Row P2-6
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') // B08
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') // B08
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') // C08
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') // D08
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') // E08
@@ -404,7 +404,7 @@ N/C = switch present, but officially unused?
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("KBD10") // Row P2-9
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') // B09
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') // B09
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') // C09
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') // D09
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') // E09
diff --git a/src/mame/machine/dmac_0266.cpp b/src/mame/machine/dmac_0266.cpp
index 97a7c1bb7e5..0e65a33af87 100644
--- a/src/mame/machine/dmac_0266.cpp
+++ b/src/mame/machine/dmac_0266.cpp
@@ -12,9 +12,7 @@
* - https://github.com/NetBSD/src/blob/trunk/sys/arch/news68k/dev/si.c
*
* TODO:
- * - tczero vs interrupt status
- * - verify if eop output exists
- * - verify map count/width
+ * - find the real solution to the short transfer issue
*/
#include "emu.h"
@@ -31,7 +29,6 @@ DEFINE_DEVICE_TYPE(DMAC_0266, dmac_0266_device, "dmac_0266", "Sony 0266 DMA Cont
dmac_0266_device::dmac_0266_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
: device_t(mconfig, DMAC_0266, tag, owner, clock)
, m_bus(*this, finder_base::DUMMY_TAG, -1, 32)
- , m_int(*this)
, m_dma_r(*this)
, m_dma_w(*this)
{
@@ -49,8 +46,6 @@ void dmac_0266_device::map(address_map &map)
void dmac_0266_device::device_start()
{
- m_int.resolve_safe();
-
m_dma_r.resolve_safe(0);
m_dma_w.resolve_safe();
@@ -61,13 +56,11 @@ void dmac_0266_device::device_start()
save_item(NAME(m_offset));
save_item(NAME(m_map));
- save_item(NAME(m_int_state));
- save_item(NAME(m_drq_state));
+ save_item(NAME(m_req_state));
m_dma_check = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dmac_0266_device::dma_check), this));
- m_int_state = false;
- m_drq_state = false;
+ m_req_state = false;
}
void dmac_0266_device::device_reset()
@@ -90,33 +83,22 @@ void dmac_0266_device::soft_reset()
m_dma_check->enable(false);
}
-void dmac_0266_device::irq_w(int state)
+void dmac_0266_device::eop_w(int state)
{
if (state)
m_status |= INTERRUPT;
else
m_status &= ~INTERRUPT;
-
- set_int(state);
}
-void dmac_0266_device::drq_w(int state)
+void dmac_0266_device::req_w(int state)
{
- m_drq_state = bool(state);
+ m_req_state = bool(state);
- if (m_drq_state)
+ if (m_req_state)
m_dma_check->adjust(attotime::zero);
}
-void dmac_0266_device::set_int(bool int_state)
-{
- if (int_state != m_int_state)
- {
- m_int_state = int_state;
- m_int(int_state);
- }
-}
-
void dmac_0266_device::control_w(u32 data)
{
LOG("control_w 0x%08x (%s)\n", data, machine().describe_context());
@@ -144,8 +126,8 @@ void dmac_0266_device::control_w(u32 data)
void dmac_0266_device::dma_check(void *ptr, s32 param)
{
- // check drq active
- if (!m_drq_state)
+ // check req active
+ if (!m_req_state)
return;
// check enabled
@@ -154,7 +136,22 @@ void dmac_0266_device::dma_check(void *ptr, s32 param)
// check transfer count
if (!m_tcount)
+ {
+ /*
+ * HACK: NEWS-OS tries to write a block to disk but sets the transfer
+ * count to less than the block length, causing a hang while the
+ * adapter waits for more data that the DMAC is not ready to supply.
+ * It's not clear how the real hardware works - for now this hack
+ * continues to read and discard data from the device, or write
+ * arbitrary zero bytes to it until it deasserts the request line.
+ */
+ if (m_control & DIRECTION)
+ m_dma_r();
+ else
+ m_dma_w(0);
+
return;
+ }
u32 const address = (m_map[m_tag & 0x7f] << 12) | (m_offset & 0xfff);
@@ -195,7 +192,8 @@ void dmac_0266_device::dma_check(void *ptr, s32 param)
if (!m_tcount)
{
LOG("transfer complete\n");
- m_control &= ~ENABLE;
+ // HACK: per hack above, don't disable when reaching terminal count
+ //m_control &= ~ENABLE;
m_status |= TCZERO;
}
else
diff --git a/src/mame/machine/dmac_0266.h b/src/mame/machine/dmac_0266.h
index bfadb405ca2..83150106d5d 100644
--- a/src/mame/machine/dmac_0266.h
+++ b/src/mame/machine/dmac_0266.h
@@ -14,14 +14,13 @@ public:
// configuration
template <typename T> void set_bus(T &&tag, int spacenum) { m_bus.set_tag(std::forward<T>(tag), spacenum); }
- auto out_int_cb() { return m_int.bind(); }
auto dma_r_cb() { return m_dma_r.bind(); }
auto dma_w_cb() { return m_dma_w.bind(); }
void map(address_map &map);
- void irq_w(int state);
- void drq_w(int state);
+ void eop_w(int state);
+ void req_w(int state);
protected:
// device_t overrides
@@ -34,20 +33,18 @@ protected:
u32 tcount_r() { return m_tcount; }
void control_w(u32 data);
- void tcount_w(offs_t offset, u32 data, u32 mem_mask) { COMBINE_DATA(&m_tcount); }
- void tag_w(offs_t offset, u32 data, u32 mem_mask) { COMBINE_DATA(&m_tag); }
- void offset_w(offs_t offset, u32 data, u32 mem_mask) { COMBINE_DATA(&m_offset); }
- void entry_w(offs_t offset, u32 data, u32 mem_mask) { COMBINE_DATA(&m_map[m_tag & 0x7f]); }
+ void tcount_w(u32 data) { m_tcount = data; }
+ void tag_w(u32 data) { m_tag = data; }
+ void offset_w(u32 data) { m_offset = data; }
+ void entry_w(u32 data) { m_map[m_tag & 0x7f] = data & 0x7fff; }
// dma logic
void soft_reset();
- void set_int(bool int_state);
void dma_check(void *ptr, s32 param);
private:
required_address_space m_bus;
- devcb_write_line m_int;
devcb_read8 m_dma_r;
devcb_write8 m_dma_w;
@@ -72,11 +69,10 @@ private:
u32 m_tcount;
u32 m_tag;
u32 m_offset;
- u32 m_map[128];
+ u32 m_map[129];
// internal state
- bool m_int_state;
- bool m_drq_state;
+ bool m_req_state;
};
DECLARE_DEVICE_TYPE(DMAC_0266, dmac_0266_device)
diff --git a/src/mame/machine/dmv_keyb.cpp b/src/mame/machine/dmv_keyb.cpp
index 8cebe8f75fc..0acd35b9b41 100644
--- a/src/mame/machine/dmv_keyb.cpp
+++ b/src/mame/machine/dmv_keyb.cpp
@@ -34,7 +34,7 @@ INPUT_PORTS_START( dmv_keyboard )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r')
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
@@ -89,12 +89,12 @@ INPUT_PORTS_START( dmv_keyboard )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
PORT_START("COL.6")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) PORT_NAME("Backspace")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE),8) PORT_NAME("Backspace")
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('0') PORT_CHAR(')')
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
@@ -150,7 +150,7 @@ INPUT_PORTS_START( dmv_keyboard )
PORT_START("COL.12")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('e') PORT_CHAR('E')
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F20")
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
diff --git a/src/mame/machine/egret.cpp b/src/mame/machine/egret.cpp
index 281047548ee..dacd0a3ec4e 100644
--- a/src/mame/machine/egret.cpp
+++ b/src/mame/machine/egret.cpp
@@ -86,7 +86,7 @@ void egret_device::egret_map(address_map &map)
void egret_device::device_add_mconfig(machine_config &config)
{
- M68HC05EG(config, m_maincpu, XTAL(32'768)*192); // 32.768 kHz input clock, can be PLL'ed to x128 = 4.1 MHz under s/w control
+ M68HC05EG(config, m_maincpu, XTAL(32'768)*128); // Intended to run 4.1 MHz, the ADB timings in uS are twice as long as spec at 2.1
m_maincpu->set_addrmap(AS_PROGRAM, &egret_device::egret_map);
}
@@ -111,19 +111,20 @@ void egret_device::send_port(uint8_t offset, uint8_t data)
if ((data & 0x80) != last_adb)
{
-/* if (data & 0x80)
+ m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time);
+ /*
+ if (data & 0x80)
{
- printf("EG ADB: 1->0 time %lld\n", machine().time().as_ticks(1000000) - last_adb_time);
+ printf("EG ADB: 1->0 time %d\n", m_adb_dtime);
}
else
{
- printf("EG ADB: 0->1 time %lld\n", machine().time().as_ticks(1000000) - last_adb_time);
- }*/
-
+ printf("EG ADB: 0->1 time %d\n", m_adb_dtime);
+ }
+ */
// allow the linechange handler to override us
adb_in = (data & 0x80) ? true : false;
- m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time);
write_linechange(((data & 0x80) >> 7) ^ 1);
last_adb = data & 0x80;
diff --git a/src/mame/machine/egret.h b/src/mame/machine/egret.h
index 831c0808a93..b1597dca367 100644
--- a/src/mame/machine/egret.h
+++ b/src/mame/machine/egret.h
@@ -67,7 +67,6 @@ public:
void set_via_data(uint8_t dat) { via_data = dat; }
uint8_t get_via_clock() { return via_clock; }
void set_adb_line(int linestate) { adb_in = (linestate == ASSERT_LINE) ? true : false; }
- int get_adb_dtime() { return m_adb_dtime; }
int rom_offset;
@@ -76,7 +75,8 @@ public:
auto via_clock_callback() { return write_via_clock.bind(); }
auto via_data_callback() { return write_via_data.bind(); }
- devcb_write_line write_reset, write_linechange, write_via_clock, write_via_data;
+ devcb_write_line write_reset, write_linechange;
+ devcb_write_line write_via_clock, write_via_data;
void egret_map(address_map &map);
protected:
diff --git a/src/mame/machine/k7659kb.cpp b/src/mame/machine/k7659kb.cpp
index daa67206d69..c8ce5f6725e 100644
--- a/src/mame/machine/k7659kb.cpp
+++ b/src/mame/machine/k7659kb.cpp
@@ -2,7 +2,12 @@
// copyright-holders:Sergey Svishchev
/**********************************************************************
- K7659 keyboard emulation
+K7659 keyboard emulation
+
+This keyboard is used by LLC2 and PCM. There's some minor differences
+between the two systems. PCM is uppercase only. LLC2 has some German
+characters in place of the [ ] \ and ~ keys. On PCM, pressing Shift+3
+does a delete, but on LLC2 it prints an inverse K.
*********************************************************************/
@@ -47,17 +52,6 @@ const tiny_rom_entry *k7659_keyboard_device::device_rom_region() const
//-------------------------------------------------
-// ADDRESS_MAP( kb_io )
-//-------------------------------------------------
-
-
-
-//-------------------------------------------------
-// DISCRETE_SOUND_START( k7659kb_discrete )
-//-------------------------------------------------
-
-
-//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
@@ -81,7 +75,7 @@ static INPUT_PORTS_START( k7659_keyboard )
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13)
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18)
PORT_START("A2")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0xff)
+ PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3')
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05)
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04)
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03)
@@ -102,9 +96,9 @@ static INPUT_PORTS_START( k7659_keyboard )
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 /") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/')
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15)
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a)
- PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0d)
+ PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
- PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09)
+ PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b)
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", ;") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';')
PORT_START("A5")
@@ -112,28 +106,28 @@ static INPUT_PORTS_START( k7659_keyboard )
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0f)
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0c)
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". :") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':')
- PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') PORT_CHAR('0')
+ PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=')
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10)
- PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("| \\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('|') PORT_CHAR('\\') PORT_CHAR(0x1c)
+ PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("| \\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c)
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
PORT_START("A6")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('~') PORT_CHAR('?') PORT_CHAR(0x1e)
- PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("} ]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('}') PORT_CHAR(']') PORT_CHAR(0x1d)
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("{ [") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('{') PORT_CHAR('[') PORT_CHAR(0x1b)
+ PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR(223) PORT_CHAR('?')
+ PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("} ]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d)
+ PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("{ [") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('<')
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ *") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('*')
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("# '") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('#') PORT_CHAR('\'') PORT_CHAR(0x1f)
- PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_COLON) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(0x1e)
+ PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_COLON) PORT_CHAR('^') PORT_CHAR(223) PORT_CHAR(0x1e)
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09)
PORT_START("A7")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(">") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('>')
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d)
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("04") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x04)
- PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("01") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x01)
- PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR(' ') PORT_CHAR('`')
- PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b) PORT_CHAR(0x1b) PORT_CHAR(0x1f)
- PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("13") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x13)
- PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("06") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x06)
+ PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("04") //(0x04)
+ PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("01") //(0x01)
+ PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR(' ') PORT_CHAR('@')
+ PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b)
+ PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("13") //(0x13)
+ PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("06") //(0x06)
PORT_START("A8")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
@@ -142,42 +136,42 @@ static INPUT_PORTS_START( k7659_keyboard )
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT)
- PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT)
+ PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
PORT_START("A9")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
- PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_END) PORT_CHAR(0x0c)
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x7f) PORT_CHAR(0x1e) PORT_CHAR(0x1f)
- PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F01") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x05)
- PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F02") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x18)
- PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F03") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x13)
- PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F04") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x04)
- PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F06") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x03)
+ PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_END) //(0x0c)
+ PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x7f)
+ PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F01") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
+ PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F02") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
+ PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F03") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
+ PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F04") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
+ PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F06") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
PORT_START("A10")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F07") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x1a)
- PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F08") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x17)
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F09") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x07)
- PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x14)
- PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x19)
- PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x02)
- PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F13") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x0b)
- PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F14") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x11)
+ PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F07") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
+ PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F08") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
+ PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F09") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
+ PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
+ PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11))
+ PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12))
+ PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F13") //PORT_CODE(KEYCODE_TILDE) PORT_CHAR(UCHAR_MAMEKEY(F13))
+ PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F14") //PORT_CODE(KEYCODE_TILDE) PORT_CHAR(UCHAR_MAMEKEY(F14))
PORT_START("A11")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F05") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x12)
+ PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F05") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(0x1a)
- PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(0x0a)
- PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(0x15)
- PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(0x08)
+ PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
+ PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
+ PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
+ PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
- PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E95") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0xff)
+ PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E95") //PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0xff)
PORT_START("A12")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_TILDE)
+ PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") //PORT_CODE(KEYCODE_TILDE)
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
- PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NMI") PORT_CODE(KEYCODE_TILDE)
+ PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NMI") //PORT_CODE(KEYCODE_TILDE)
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
- PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
+ PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2)
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
INPUT_PORTS_END
@@ -214,8 +208,8 @@ void k7659_keyboard_device::device_start()
{
m_timer = timer_alloc();
// state saving
- //save_item(NAME(m_y));
- //save_item(NAME(m_so));
+ save_item(NAME(m_lookup));
+ save_item(NAME(m_key));
}
diff --git a/src/mame/machine/kay_kbd.cpp b/src/mame/machine/kay_kbd.cpp
index e5bbe37c012..b147169115c 100644
--- a/src/mame/machine/kay_kbd.cpp
+++ b/src/mame/machine/kay_kbd.cpp
@@ -209,7 +209,7 @@ INPUT_PORTS_START(kaypro_keyboard_typewriter)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR(';')
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN) // 0xf0
PORT_START("ROW.9")
diff --git a/src/mame/machine/kb_poisk1.h b/src/mame/machine/kb_poisk1.h
index 87b9eb8f044..21e206059f0 100644
--- a/src/mame/machine/kb_poisk1.h
+++ b/src/mame/machine/kb_poisk1.h
@@ -18,8 +18,8 @@ INPUT_PORTS_START( poisk1_keyboard_v89 )
PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?56?") // 0x56
PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r')
- PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
- PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
+ PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP),UCHAR_MAMEKEY(8_PAD))
+ PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN),UCHAR_MAMEKEY(2_PAD))
/*-12*/ PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-12 - ?") /* PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') */
PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
/*-11*/ PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-11 - %") /* PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') */
@@ -27,7 +27,7 @@ INPUT_PORTS_START( poisk1_keyboard_v89 )
PORT_START("Y2")
/*-15*/ PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-15 - !") /* PORT_CODE(KEYCODE_1) PORT_CHAR('!') PORT_CHAR('1') */
- PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
+ PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT),UCHAR_MAMEKEY(4_PAD))
PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) /* ??? */
PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
/*-13*/ PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-13 - ;") /* PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') */
@@ -103,7 +103,7 @@ INPUT_PORTS_START( poisk1_keyboard_v89 )
PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))
- PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
+ PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT),UCHAR_MAMEKEY(6_PAD))
PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?5a?") // 0x5a
@@ -132,8 +132,8 @@ INPUT_PORTS_START( poisk1_keyboard_v91 )
PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad + \xd0\x81") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) // Cyrillic Yo
PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r')
- PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
- PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
+ PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP),UCHAR_MAMEKEY(8_PAD))
+ PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN),UCHAR_MAMEKEY(2_PAD))
PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
@@ -141,7 +141,7 @@ INPUT_PORTS_START( poisk1_keyboard_v91 )
PORT_START("Y2")
PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
- PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
+ PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT),UCHAR_MAMEKEY(4_PAD))
PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
@@ -217,7 +217,7 @@ INPUT_PORTS_START( poisk1_keyboard_v91 )
PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad - \xd0\x84") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) // Cyrillic Ukrainian Ie
PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK))
- PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
+ PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT),UCHAR_MAMEKEY(6_PAD))
PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
diff --git a/src/mame/machine/mac.cpp b/src/mame/machine/mac.cpp
index b6810f12e8f..e5b8727e1e0 100644
--- a/src/mame/machine/mac.cpp
+++ b/src/mame/machine/mac.cpp
@@ -118,32 +118,10 @@
#define LOG_MEMORY 0
#endif
-// returns non-zero if this Mac has ADB
-int mac_state::has_adb()
-{
- return m_model >= MODEL_MAC_SE;
-}
-
// handle disk enable lines
void mac_fdc_set_enable_lines(device_t *device, int enable_mask)
{
- mac_state *mac = device->machine().driver_data<mac_state>();
-
- if (mac->m_model != mac_state::MODEL_MAC_SE)
- {
- sony_set_enable_lines(device, enable_mask);
- }
- else
- {
- if (enable_mask)
- {
- sony_set_enable_lines(device, mac->m_drive_select ? 1 : 2);
- }
- else
- {
- sony_set_enable_lines(device, enable_mask);
- }
- }
+ sony_set_enable_lines(device, enable_mask);
}
void mac_state::mac_install_memory(offs_t memory_begin, offs_t memory_end,
@@ -508,87 +486,6 @@ uint32_t mac_state::rom_switch_r(offs_t offset)
return m_rom_ptr[offset & ((m_rom_size - 1)>>2)];
}
-
-/* *************************************************************************
- * Mouse
- * *************************************************************************/
-
-void mac_state::mouse_callback()
-{
- int new_mx, new_my;
- int x_needs_update = 0, y_needs_update = 0;
-
- new_mx = m_mouse1->read();
- new_my = m_mouse2->read();
-
- /* see if it moved in the x coord */
- if (new_mx != last_mx)
- {
- int diff = new_mx - last_mx;
-
- /* check for wrap */
- if (diff > 0x80)
- diff = 0x100-diff;
- if (diff < -0x80)
- diff = -0x100-diff;
-
- count_x += diff;
-
- last_mx = new_mx;
- }
- /* see if it moved in the y coord */
- if (new_my != last_my)
- {
- int diff = new_my - last_my;
-
- /* check for wrap */
- if (diff > 0x80)
- diff = 0x100-diff;
- if (diff < -0x80)
- diff = -0x100-diff;
-
- count_y += diff;
-
- last_my = new_my;
- }
-
- /* update any remaining count and then return */
- if (count_x)
- {
- if (count_x < 0)
- {
- count_x++;
- m_mouse_bit_x = 0;
- x_needs_update = 2;
- }
- else
- {
- count_x--;
- m_mouse_bit_x = 1;
- x_needs_update = 1;
- }
- }
- else if (count_y)
- {
- if (count_y < 0)
- {
- count_y++;
- m_mouse_bit_y = 1;
- y_needs_update = 1;
- }
- else
- {
- count_y--;
- m_mouse_bit_y = 0;
- y_needs_update = 2;
- }
- }
-
- if (x_needs_update || y_needs_update)
- /* assert Port B External Interrupt on the SCC */
- scc_mouse_irq(x_needs_update, y_needs_update );
-}
-
/* *************************************************************************
* SCSI
* *************************************************************************/
@@ -757,108 +654,6 @@ WRITE_LINE_MEMBER(mac_state::drq_539x_1_w)
*
* Serial Communications Controller
* *************************************************************************/
-
-void mac_state::scc_mouse_irq(int x, int y)
-{
- static int lasty = 0;
- static int lastx = 0;
-
- if (x && y)
- {
- if (m_last_was_x) {
- m_scc->set_status(0x0a);
- if(x == 2) {
- if(lastx) {
- m_scc->set_reg_a(0, 0x04);
- m_mouse_bit_x = 0;
- } else {
- m_scc->set_reg_a(0, 0x0C);
- m_mouse_bit_x = 1;
- }
- } else {
- if(lastx) {
- m_scc->set_reg_a(0, 0x04);
- m_mouse_bit_x = 1;
- } else {
- m_scc->set_reg_a(0, 0x0C);
- m_mouse_bit_x = 0;
- }
- }
- lastx = !lastx;
- } else {
- m_scc->set_status(0x02);
- if(y == 2) {
- if(lasty) {
- m_scc->set_reg_b(0, 0x04);
- m_mouse_bit_y = 0;
- } else {
- m_scc->set_reg_b(0, 0x0C);
- m_mouse_bit_y = 1;
- }
- } else {
- if(lasty) {
- m_scc->set_reg_b(0, 0x04);
- m_mouse_bit_y = 1;
- } else {
- m_scc->set_reg_b(0, 0x0C);
- m_mouse_bit_y = 0;
- }
- }
- lasty = !lasty;
- }
-
- m_last_was_x ^= 1;
- }
- else
- {
- if (x) {
- m_scc->set_status(0x0a);
- if(x == 2) {
- if(lastx) {
- m_scc->set_reg_a(0, 0x04);
- m_mouse_bit_x = 0;
- } else {
- m_scc->set_reg_a(0, 0x0C);
- m_mouse_bit_x = 1;
- }
- } else {
- if(lastx) {
- m_scc->set_reg_a(0, 0x04);
- m_mouse_bit_x = 1;
- } else {
- m_scc->set_reg_a(0, 0x0C);
- m_mouse_bit_x = 0;
- }
- }
- lastx = !lastx;
- } else {
- m_scc->set_status(0x02);
- if(y == 2) {
- if(lasty) {
- m_scc->set_reg_b(0, 0x04);
- m_mouse_bit_y = 0;
- } else {
- m_scc->set_reg_b(0, 0x0C);
- m_mouse_bit_y = 1;
- }
- } else {
- if(lasty) {
- m_scc->set_reg_b(0, 0x04);
- m_mouse_bit_y = 1;
- } else {
- m_scc->set_reg_b(0, 0x0C);
- m_mouse_bit_y = 0;
- }
- }
- lasty = !lasty;
- }
- }
-
- this->set_scc_interrupt(1);
-}
-
-
-
uint16_t mac_state::mac_scc_r(offs_t offset)
{
uint16_t result;
@@ -867,8 +662,6 @@ uint16_t mac_state::mac_scc_r(offs_t offset)
return (result << 8) | result;
}
-
-
void mac_state::mac_scc_w(offs_t offset, uint16_t data)
{
m_scc->reg_w(offset, data);
@@ -914,7 +707,7 @@ void mac_state::mac_iwm_w(offs_t offset, uint16_t data, uint16_t mem_mask)
WRITE_LINE_MEMBER(mac_state::mac_adb_via_out_cb2)
{
- //printf("VIA OUT CB2 = %x (ticks %d)\n", state, m_adb_timer_ticks);
+ //printf("VIA OUT CB2 = %x\n", state);
if (ADB_IS_EGRET)
{
m_egret->set_via_data(state & 1);
@@ -925,17 +718,9 @@ WRITE_LINE_MEMBER(mac_state::mac_adb_via_out_cb2)
}
else
{
- if (m_adb_timer_ticks > 0)
+ if (m_macadb)
{
- m_adb_command <<= 1;
- if (state)
- {
- m_adb_command |= 1;
- }
- else
- {
- m_adb_command &= ~1;
- }
+ m_macadb->adb_data_w(state);
}
}
}
@@ -1039,7 +824,7 @@ uint8_t mac_state::mac_via_in_a_pmu()
#if LOG_ADB
// printf("Read PM data %x\n", m_pm_data_recv);
#endif
- return m_pm_data_recv;
+ return m_macadb->get_pm_data_recv();
}
uint8_t mac_state::mac_via_in_b()
@@ -1051,7 +836,7 @@ uint8_t mac_state::mac_via_in_b()
if (ADB_IS_BITBANG_CLASS)
{
- val |= m_adb_state<<4;
+ val |= m_macadb->get_adb_state()<<4;
if (!m_adb_irq_pending)
{
@@ -1068,17 +853,6 @@ uint8_t mac_state::mac_via_in_b()
{
val |= m_cuda->get_treq()<<3;
}
- else
- {
- if (m_mouse_bit_y) /* Mouse Y2 */
- val |= 0x20;
- if (m_mouse_bit_x) /* Mouse X2 */
- val |= 0x10;
- if ((m_mouse0->read() & 0x01) == 0)
- val |= 0x08;
-
- val |= m_rtc->data_r();
- }
// printf("%s VIA1 IN_B = %02x\n", machine().describe_context().c_str(), val);
@@ -1091,7 +865,7 @@ uint8_t mac_state::mac_via_in_b_ii()
if (ADB_IS_BITBANG_CLASS)
{
- val |= m_adb_state<<4;
+ val |= m_macadb->get_adb_state()<<4;
if (!m_adb_irq_pending)
{
@@ -1133,7 +907,7 @@ uint8_t mac_state::mac_via_in_b_pmu()
{
int val = 0;
// printf("Read VIA B: PM_ACK %x\n", m_pm_ack);
- val = 0x80 | 0x04 | m_pm_ack; // SCC wait/request (bit 2 must be set at 900c1a or startup tests always fail)
+ val = 0x80 | 0x04 | m_macadb->get_pm_ack(); // SCC wait/request (bit 2 must be set at 900c1a or startup tests always fail)
// printf("%s VIA1 IN_B = %02x\n", machine().describe_context().c_str(), val);
@@ -1147,29 +921,6 @@ void mac_state::mac_via_out_a(uint8_t data)
set_scc_waitrequest((data & 0x80) >> 7);
m_screen_buffer = (data & 0x40) >> 6;
sony_set_sel_line(m_fdc.target(), (data & 0x20) >> 5);
- if (m_model == MODEL_MAC_SE) // on SE this selects which floppy drive (0 = upper, 1 = lower)
- {
- m_drive_select = ((data & 0x10) >> 4);
- }
-
- if (m_model < MODEL_MAC_SE) // SE no longer has dual buffers
- {
- m_main_buffer = ((data & 0x08) == 0x08) ? true : false;
- }
-
- if (m_model < MODEL_MAC_II)
- {
- m_snd_vol = data & 0x07;
- update_volume();
- }
-
- /* Early Mac models had VIA A4 control overlaying. In the Mac SE (and
- * possibly later models), overlay was set on reset, but cleared on the
- * first access to the ROM. */
- if (m_model < MODEL_MAC_SE)
- {
- set_memory_overlay((data & 0x10) >> 4);
- }
}
void mac_state::mac_via_out_a_pmu(uint8_t data)
@@ -1179,61 +930,21 @@ void mac_state::mac_via_out_a_pmu(uint8_t data)
#if LOG_ADB
// printf("%02x to PM\n", data);
#endif
- m_pm_data_send = data;
+ m_macadb->set_pm_data_send(data);
}
void mac_state::mac_via_out_b(uint8_t data)
{
// printf("%s VIA1 OUT B: %02x\n", machine().describe_context().c_str(), data);
-
- if (AUDIO_IS_CLASSIC)
- {
- m_snd_enable = (data & 0x80) == 0;
- update_volume();
- }
-
m_rtc->ce_w((data & 0x04)>>2);
m_rtc->data_w(data & 0x01);
m_rtc->clk_w((data >> 1) & 0x01);
}
-void mac_state::update_volume(void)
-{
- if (AUDIO_IS_CLASSIC)
- {
- if (!m_snd_enable)
- {
- // ls161 clear input
- m_dac->set_output_gain(ALL_OUTPUTS, 0);
- }
- else
- {
- // sound -> r13 (470k)
- // sound -> r12 (470k) -> 4016 (pa0 != 0)
- // sound -> r17 (150k) -> 4016 (pa1 != 0)
- // sound -> r16 (68k) -> 4016 (pa2 != 0)
- m_dac->set_output_gain(ALL_OUTPUTS, 8.0 / (m_snd_vol + 1));
- }
- }
-}
-
void mac_state::mac_via_out_b_bbadb(uint8_t data)
{
// printf("%s VIA1 OUT B: %02x\n", machine().describe_context().c_str(), data);
- if (AUDIO_IS_CLASSIC)
- {
- m_snd_enable = (data & 0x80) == 0;
- update_volume();
- }
-
- // SE and Classic have SCSI enable/disable here
- if ((m_model == MODEL_MAC_SE) || (m_model == MODEL_MAC_CLASSIC))
- {
- m_scsiirq_enable = (data & 0x40) ? 0 : 1;
-// printf("VIAB & 0x40 = %02x, IRQ enable %d\n", data & 0x40, m_scsiirq_enable);
- }
-
if (m_model == MODEL_MAC_SE30)
{
// 0x40 = 0 means enable vblank on SE/30
@@ -1246,7 +957,7 @@ void mac_state::mac_via_out_b_bbadb(uint8_t data)
}
}
- mac_adb_newaction((data & 0x30) >> 4);
+ m_macadb->mac_adb_newaction((data & 0x30) >> 4);
m_rtc->ce_w((data & 0x04)>>2);
m_rtc->data_w(data & 0x01);
@@ -1285,62 +996,7 @@ void mac_state::mac_via_out_b_pmu(uint8_t data)
// printf("%s VIA1 OUT B: %02x\n", machine().describe_context().c_str(), data);
sony_set_sel_line(m_fdc.target(), (data & 0x20) >> 5);
- m_drive_select = ((data & 0x10) >> 4);
-
- if ((data & 1) && !(m_pm_req & 1))
- {
- #if LOG_ADB
- printf("PM: 68k dropping /REQ\n");
- #endif
-
- if (m_pm_state == 0) // do this in receive state only
- {
- m_pm_data_recv = 0xff;
- m_pm_ack |= 2;
-
- // check if length byte matches
- if ((m_pm_dptr >= 2) && (m_pm_cmd[1] == (m_pm_dptr-2)))
- {
- pmu_exec();
- #if LOG_ADB
- printf("PMU exec: command %02x length %d\n", m_pm_cmd[0], m_pm_cmd[1]);
- #endif
- }
- }
- }
- else if (!(data & 1) && (m_pm_req & 1))
- {
- if (m_pm_state == 0)
- {
- #if LOG_ADB
- printf("PM: 68k asserting /REQ, clocking in byte [%d] = %02x\n", m_pm_dptr, m_pm_data_send);
- #endif
- m_pm_ack &= ~2; // clear, we're waiting for more bytes
- m_pm_cmd[m_pm_dptr++] = m_pm_data_send;
- }
- else // receiving, so this is different
- {
- m_pm_data_recv = m_pm_out[m_pm_sptr++];
- m_pm_slen--;
- m_pm_ack |= 2; // raise ACK to indicate available byte
- #if LOG_ADB
- printf("PM: 68k asserted /REQ, sending byte %02x\n", m_pm_data_recv);
- #endif
-
- // another byte to send?
- if (m_pm_slen)
- {
- m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
- }
- else
- {
- m_pm_state = 0; // back to receive state
- m_pmu_send_timer->adjust(attotime::never);
- }
- }
- }
-
- m_pm_req = data & 1;
+ m_macadb->pmu_req_w(data & 1);
}
WRITE_LINE_MEMBER(mac_state::mac_via_irq)
@@ -1438,7 +1094,7 @@ uint8_t mac_state::mac_via2_in_a()
uint8_t mac_state::mac_via2_in_a_pmu()
{
- return m_pm_data_recv;
+ return m_macadb->get_pm_data_recv();
}
uint8_t mac_state::mac_via2_in_b()
@@ -1462,7 +1118,7 @@ uint8_t mac_state::mac_via2_in_b_pmu()
{
// logerror("%s VIA2 IN B\n", machine().describe_context());
- if (m_pm_ack == 2)
+ if (m_macadb->get_pm_ack() == 2)
{
return 0xcf;
}
@@ -1480,7 +1136,7 @@ void mac_state::mac_via2_out_a(uint8_t data)
void mac_state::mac_via2_out_a_pmu(uint8_t data)
{
// logerror("%s VIA2 OUT A: %02x\n", machine().describe_context(), data);
- m_pm_data_send = data;
+ m_macadb->set_pm_data_send(data);
}
void mac_state::mac_via2_out_b(uint8_t data)
@@ -1500,61 +1156,7 @@ void mac_state::mac_via2_out_b(uint8_t data)
void mac_state::mac_via2_out_b_pmu(uint8_t data)
{
// logerror("%s VIA2 OUT B PMU: %02x\n", machine().describe_context(), data);
-
- if ((data & 4) && !(m_pm_req & 4))
- {
- #if LOG_ADB
- printf("PM: 68k dropping /REQ\n");
- #endif
-
- if (m_pm_state == 0) // do this in receive state only
- {
- m_pm_data_recv = 0xff;
- m_pm_ack |= 2;
-
- // check if length byte matches
- if ((m_pm_dptr >= 2) && (m_pm_cmd[1] == (m_pm_dptr-2)))
- {
- pmu_exec();
- #if LOG_ADB
- printf("PMU exec: command %02x length %d\n", m_pm_cmd[0], m_pm_cmd[1]);
- #endif
- }
- }
- }
- else if (!(data & 4) && (m_pm_req & 4))
- {
- if (m_pm_state == 0)
- {
- #if LOG_ADB
- printf("PM: 68k asserting /REQ, clocking in byte [%d] = %02x\n", m_pm_dptr, m_pm_data_send);
- #endif
- m_pm_ack &= ~2; // clear, we're waiting for more bytes
- m_pm_cmd[m_pm_dptr++] = m_pm_data_send;
- }
- else // receiving, so this is different
- {
- m_pm_data_recv = m_pm_out[m_pm_sptr++];
- m_pm_slen--;
- m_pm_ack |= 2; // raise ACK to indicate available byte
- #if LOG_ADB
- printf("PM: 68k asserted /REQ, sending byte %02x\n", m_pm_data_recv);
- #endif
-
- // another byte to send?
- if (m_pm_slen)
- {
- m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
- }
- else
- {
- m_pm_state = 0; // back to receive state
- m_pmu_send_timer->adjust(attotime::never);
- }
- }
- }
-
- m_pm_req = data & 4;
+ m_macadb->pmu_req_w((data>>2) & 1);
}
// This signal is generated internally on RBV, V8, Sonora, VASP, Eagle, etc.
@@ -1570,20 +1172,6 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_6015_tick)
void mac_state::machine_start()
{
- if (has_adb())
- {
- this->m_adb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::mac_adb_tick),this));
- this->m_adb_timer->adjust(attotime::never);
-
- // also allocate PMU timer
- if (ADB_IS_PM_CLASS)
- {
- m_pmu_send_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::mac_pmu_tick),this));
- this->m_adb_timer->adjust(attotime::never);
- m_pmu_int_status = 0;
- }
- }
-
if (m_screen)
{
this->m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::mac_scanline_tick),this));
@@ -1632,7 +1220,7 @@ void mac_state::machine_reset()
break;
case 7833600*2: // "16 MHz" Macs
- m_via_cycles = -30;
+ m_via_cycles = -32;
break;
case 20000000: // 20 MHz Macs
@@ -1644,7 +1232,7 @@ void mac_state::machine_reset()
break;
case 7833600*4: // 32 MHz Macs (these are C7M * 4 like IIvx)
- m_via_cycles = -60;
+ m_via_cycles = -62;
break;
case 33000000: // 33 MHz Macs ('040s)
@@ -1667,10 +1255,10 @@ void mac_state::machine_reset()
fatalerror("mac: unknown clock\n");
}
- // clear PMU response timer
- if (ADB_IS_PM_CLASS)
+ // Egret currently needs more dramatic VIA slowdowns. Need to determine what's realistic.
+ if (ADB_IS_EGRET)
{
- this->m_adb_timer->adjust(attotime::never);
+ m_via_cycles *= 35;
}
// default to 32-bit mode on LC
@@ -1719,27 +1307,11 @@ void mac_state::machine_reset()
m_via2->write_cb1(1);
}
- if (has_adb())
- {
- this->adb_reset();
- }
-
- if ((m_model == MODEL_MAC_SE) || (m_model == MODEL_MAC_CLASSIC))
- {
- // classic will fail RAM test and try to boot appletalk if RAM is not all zero
- memset(m_ram->pointer(), 0, m_ram->size());
- }
-
m_scsi_interrupt = 0;
- m_drive_select = 0;
- m_scsiirq_enable = 0;
m_via2_vbl = 0;
m_se30_vbl_enable = 0;
m_nubus_irq_state = 0xff;
- m_mouse_bit_x = m_mouse_bit_y = 0;
- m_pm_data_send = m_pm_data_recv = m_pm_ack = m_pm_req = m_pm_dptr = 0;
- m_pm_state = 0;
m_last_taken_interrupt = 0;
}
@@ -1878,13 +1450,6 @@ void mac_state::mac_driver_init(model_t model)
m_overlay_timeout = (emu_timer *)nullptr;
}
- /* setup keyboard */
- /* clear key matrix for macadb */
- for (int i=0; i<7; i++)
- {
- m_key_matrix[i] = 0;
- }
-
/* save state stuff */
machine().save().register_postload(save_prepost_delegate(FUNC(mac_state::mac_state_load), this));
}
@@ -1976,9 +1541,9 @@ void mac_state::nubus_slot_interrupt(uint8_t slot, uint32_t state)
void mac_state::vblank_irq()
{
/* handle ADB keyboard/mouse */
- if (has_adb())
+ if (has_adb() && m_macadb)
{
- this->adb_vblank();
+ m_macadb->adb_vblank();
}
/* signal VBlank on CA1 input on the VIA */
@@ -2036,28 +1601,6 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_scanline_tick)
if (scanline == MAC_V_VIS)
vblank_irq();
- /* check for mouse changes at 10 irqs per frame */
- if (m_model <= MODEL_MAC_PLUS)
- {
- if (!(scanline % 10))
- mouse_callback();
- }
-
- if (m_dac)
- {
- uint16_t *snd_buf_ptr;
- if (m_main_buffer)
- {
- snd_buf_ptr = (uint16_t *)(m_ram->pointer() + m_ram->size() - MAC_MAIN_SND_BUF_OFFSET);
- }
- else
- {
- snd_buf_ptr = (uint16_t *)(m_ram->pointer() + m_ram->size() - MAC_ALT_SND_BUF_OFFSET);
- }
-
- m_dac->write(snd_buf_ptr[scanline] >> 8);
- }
-
int next_scanline = (scanline+1) % MAC_V_TOTAL;
m_scanline_timer->adjust(m_screen->time_until_pos(next_scanline), next_scanline);
}
@@ -2221,7 +1764,7 @@ const char *lookup_trap(uint16_t opcode)
{ 0xA07F, "_InternalWait" },
{ 0xA080, "_GetVideoDefault" },
{ 0xA081, "_SetVideoDefault" },
- { 0xA082, "_DTInstall" },
+ { 0xA082, "_`nstall" },
{ 0xA083, "_SetOSDefault" },
{ 0xA084, "_GetOSDefault" },
{ 0xA085, "_PMgrOp" },
diff --git a/src/mame/machine/macadb.cpp b/src/mame/machine/macadb.cpp
index c77be4a2889..4d0ffb2ae27 100644
--- a/src/mame/machine/macadb.cpp
+++ b/src/mame/machine/macadb.cpp
@@ -2,12 +2,12 @@
// copyright-holders:R. Belmont
/***************************************************************************
- macadb.c - handles various aspects of ADB on the Mac.
+ macadb.cpp - handles various aspects of ADB on the Mac.
***************************************************************************/
#include "emu.h"
-#include "includes/mac.h"
+#include "macadb.h"
#define LOG_ADB 0
#define LOG_ADB_MCU_CMD 0
@@ -24,6 +24,13 @@
#define ADB_CMD_RESET (0)
#define ADB_CMD_FLUSH (1)
+// use 1 MHz base to get microseconds
+static constexpr int adb_timebase = 1000000;
+
+static constexpr int adb_short = 85;
+static constexpr int adb_long = 157;
+static constexpr int adb_srq = ((85+157)*3);
+
// ADB line states
enum
{
@@ -67,6 +74,226 @@ enum
LST_SENDSTOPa
};
+// device type definition
+DEFINE_DEVICE_TYPE(MACADB, macadb_device, "macadb", "Mac ADB HLE")
+
+static INPUT_PORTS_START( macadb )
+ PORT_START("MOUSE0") /* Mouse - button */
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1)
+
+ PORT_START("MOUSE1") /* Mouse - X AXIS */
+ PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
+
+ PORT_START("MOUSE2") /* Mouse - Y AXIS */
+ PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
+
+ /* This handles the standard (not Extended) Apple ADB keyboard, which is similar to the IIgs keyboard */
+ PORT_START("KEY0")
+ PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
+ PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
+ PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
+ PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
+ PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
+ PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
+ PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
+ PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
+ PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
+ PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
+ PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_UNUSED) /* extra key on ISO : */
+ PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
+ PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
+ PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
+ PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
+ PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
+
+ PORT_START("KEY1")
+ PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
+ PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
+ PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
+ PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@')
+ PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
+ PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
+ PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^')
+ PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
+ PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
+ PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
+ PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&')
+ PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
+ PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
+ PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
+ PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
+ PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
+
+ PORT_START("KEY2")
+ PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
+ PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
+ PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
+ PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
+ PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r')
+ PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
+ PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
+ PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
+ PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
+ PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
+ PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
+ PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
+ PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
+ PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
+ PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
+ PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
+
+ PORT_START("KEY3")
+ PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t')
+ PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
+ PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~')
+ PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
+ PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNUSED) /* keyboard Enter : */
+ PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27)
+ PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL)
+ PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Command / Open Apple") PORT_CODE(KEYCODE_RALT)
+ PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
+ PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE
+ PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Option / Solid Apple") PORT_CODE(KEYCODE_LALT)
+ PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Arrow") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
+ PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Arrow") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
+ PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down Arrow") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
+ PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up Arrow") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
+ PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED) /* ??? */
+
+ /* keypad */
+ PORT_START("KEY4")
+ PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x40
+ PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) // 0x41
+ PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x42
+ PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) // 0x43
+ PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x44
+ PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) // 0x45
+ PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x46
+ PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad Clear") PORT_CODE(/*KEYCODE_NUMLOCK*/KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) // 0x47
+ PORT_BIT(0x0700, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x48, 49, 4a
+ PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) // 0x4b
+ PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) // 0x4c
+ PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x4d
+ PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) // 0x4e
+ PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x4f
+
+ PORT_START("KEY5")
+ PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x50
+ PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(/*CODE_OTHER*/KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(EQUALS_PAD)) // 0x51
+ PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) // 0x52
+ PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) // 0x53
+ PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) // 0x54
+ PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) // 0x55
+ PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) // 0x56
+ PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) // 0x57
+ PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) // 0x58
+ PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) // 0x59
+ PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x5a
+ PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) // 0x5b
+ PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) // 0x5c
+ PORT_BIT(0xE000, IP_ACTIVE_HIGH, IPT_UNUSED)
+INPUT_PORTS_END
+
+macadb_device::macadb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, MACADB, tag, owner, clock),
+ m_mouse0(*this, "MOUSE0"),
+ m_mouse1(*this, "MOUSE1"),
+ m_mouse2(*this, "MOUSE2"),
+ m_keys(*this, "KEY%u", 0),
+ write_via_clock(*this),
+ write_via_data(*this),
+ write_adb_data(*this),
+ write_adb_irq(*this),
+ m_bIsMCUMode(false),
+ m_bIsPMU(false),
+ m_bIsPMUVIA1(false)
+{
+}
+
+ioport_constructor macadb_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME(macadb);
+}
+
+void macadb_device::device_start()
+{
+ write_via_clock.resolve_safe();
+ write_via_data.resolve_safe();
+ write_adb_data.resolve_safe();
+ write_adb_irq.resolve_safe();
+
+ this->m_adb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macadb_device::mac_adb_tick),this));
+ this->m_adb_timer->adjust(attotime::never);
+
+ // also allocate PMU timer
+ if (m_bIsPMU)
+ {
+ m_pmu_send_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macadb_device::mac_pmu_tick),this));
+ this->m_adb_timer->adjust(attotime::never);
+ m_pmu_int_status = 0;
+ }
+
+ save_item(NAME(m_last_adb_time));
+ save_item(NAME(m_key_matrix));
+ save_item(NAME(m_adb_waiting_cmd));
+ save_item(NAME(m_adb_datasize));
+ save_item(NAME(m_adb_buffer));
+ save_item(NAME(m_adb_command));
+ save_item(NAME(m_adb_send));
+ save_item(NAME(m_adb_timer_ticks));
+ save_item(NAME(m_adb_extclock));
+ save_item(NAME(m_adb_direction));
+ save_item(NAME(m_adb_listenreg));
+ save_item(NAME(m_adb_listenaddr));
+ save_item(NAME(m_adb_last_talk));
+ save_item(NAME(m_adb_srq_switch));
+ save_item(NAME(m_adb_stream_ptr));
+ save_item(NAME(m_adb_linestate));
+ save_item(NAME(m_adb_srqflag));
+ save_item(NAME(m_adb_keybuf));
+ save_item(NAME(m_adb_keybuf_start));
+ save_item(NAME(m_adb_keybuf_end));
+ save_item(NAME(m_adb_mouseaddr));
+ save_item(NAME(m_adb_lastmousex));
+ save_item(NAME(m_adb_lastmousey));
+ save_item(NAME(m_adb_lastbutton));
+ save_item(NAME(m_adb_mouse_initialized));
+ save_item(NAME(m_adb_keybaddr));
+ save_item(NAME(m_adb_keybinitialized));
+ save_item(NAME(m_adb_currentkeys));
+ save_item(NAME(m_adb_modifiers));
+ save_item(NAME(m_adb_pram));
+ save_item(NAME(m_pm_ack));
+ save_item(NAME(m_pm_cmd));
+ save_item(NAME(m_pm_out));
+ save_item(NAME(m_pm_dptr));
+ save_item(NAME(m_pm_sptr));
+ save_item(NAME(m_pm_slen));
+ save_item(NAME(m_pm_state));
+ save_item(NAME(m_pm_data_recv));
+ save_item(NAME(m_pmu_int_status));
+ save_item(NAME(m_pmu_last_adb_command));
+ save_item(NAME(m_pmu_poll));
+ save_item(NAME(m_pm_req));
+ save_item(NAME(m_pm_data_send));
+}
+
+WRITE_LINE_MEMBER(macadb_device::adb_data_w)
+{
+ if (m_adb_timer_ticks > 0)
+ {
+ m_adb_command <<= 1;
+ if (state)
+ {
+ m_adb_command |= 1;
+ }
+ else
+ {
+ m_adb_command &= ~1;
+ }
+ }
+}
+
/* *************************************************************************
* High-level ADB primitives used by all lower-level implementations
* *************************************************************************/
@@ -75,7 +302,7 @@ enum
static char const *const adb_statenames[4] = { "NEW", "EVEN", "ODD", "IDLE" };
#endif
-int mac_state::adb_pollkbd(int update)
+int macadb_device::adb_pollkbd(int update)
{
int i, j, keybuf, report, codes[2], result;
@@ -211,7 +438,7 @@ int mac_state::adb_pollkbd(int update)
return result;
}
-int mac_state::adb_pollmouse()
+int macadb_device::adb_pollmouse()
{
int NewX, NewY, NewButton;
@@ -232,7 +459,7 @@ int mac_state::adb_pollmouse()
return 0;
}
-void mac_state::adb_accummouse( uint8_t *MouseX, uint8_t *MouseY )
+void macadb_device::adb_accummouse( uint8_t *MouseX, uint8_t *MouseY )
{
int MouseCountX = 0, MouseCountY = 0;
int NewX, NewY;
@@ -276,7 +503,7 @@ void mac_state::adb_accummouse( uint8_t *MouseX, uint8_t *MouseY )
*MouseY = (uint8_t)MouseCountY;
}
-void mac_state::adb_talk()
+void macadb_device::adb_talk()
{
int addr, reg;
@@ -326,11 +553,8 @@ void mac_state::adb_talk()
m_adb_command = 0;
m_adb_listenreg = reg;
m_adb_listenaddr = addr;
- if ((ADB_IS_EGRET) || (ADB_IS_CUDA))
- {
- m_adb_stream_ptr = 0;
- memset(m_adb_buffer, 0, sizeof(m_adb_buffer));
- }
+ m_adb_stream_ptr = 0;
+ memset(m_adb_buffer, 0, sizeof(m_adb_buffer));
}
else
{
@@ -532,9 +756,9 @@ void mac_state::adb_talk()
}
}
-TIMER_CALLBACK_MEMBER(mac_state::mac_adb_tick)
+TIMER_CALLBACK_MEMBER(macadb_device::mac_adb_tick)
{
- if ((ADB_IS_EGRET) || (ADB_IS_CUDA))
+ if (m_bIsMCUMode)
{
switch (m_adb_linestate)
{
@@ -545,19 +769,19 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_adb_tick)
case LST_TSTOPSTART:
set_adb_line(ASSERT_LINE);
- m_adb_timer->adjust(attotime::from_ticks(57, 1000000));
+ m_adb_timer->adjust(attotime::from_ticks(adb_short, adb_timebase));
m_adb_linestate++;
break;
case LST_TSTOPSTARTa:
set_adb_line(CLEAR_LINE);
- m_adb_timer->adjust(attotime::from_ticks(57, 1000000));
+ m_adb_timer->adjust(attotime::from_ticks(adb_short, adb_timebase));
m_adb_linestate++;
break;
case LST_STARTBIT:
set_adb_line(ASSERT_LINE);
- m_adb_timer->adjust(attotime::from_ticks(105, 1000000));
+ m_adb_timer->adjust(attotime::from_ticks(adb_long, adb_timebase));
m_adb_linestate++;
break;
@@ -572,13 +796,13 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_adb_tick)
set_adb_line(CLEAR_LINE);
if (m_adb_buffer[m_adb_stream_ptr] & 0x80)
{
-// printf("1 ");
- m_adb_timer->adjust(attotime::from_ticks(57, 1000000));
+ //printf("1 ");
+ m_adb_timer->adjust(attotime::from_ticks(adb_short, adb_timebase));
}
else
{
-// printf("0 ");
- m_adb_timer->adjust(attotime::from_ticks(105, 1000000));
+ //printf("0 ");
+ m_adb_timer->adjust(attotime::from_ticks(adb_long, adb_timebase));
}
m_adb_linestate++;
break;
@@ -593,11 +817,11 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_adb_tick)
set_adb_line(ASSERT_LINE);
if (m_adb_buffer[m_adb_stream_ptr] & 0x80)
{
- m_adb_timer->adjust(attotime::from_ticks(105, 1000000));
+ m_adb_timer->adjust(attotime::from_ticks(adb_long, adb_timebase));
}
else
{
- m_adb_timer->adjust(attotime::from_ticks(57, 1000000));
+ m_adb_timer->adjust(attotime::from_ticks(adb_short, adb_timebase));
}
m_adb_buffer[m_adb_stream_ptr] <<= 1;
m_adb_linestate++;
@@ -608,12 +832,12 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_adb_tick)
if (m_adb_buffer[m_adb_stream_ptr] & 0x80)
{
// printf(" ");
- m_adb_timer->adjust(attotime::from_ticks(105, 1000000));
+ m_adb_timer->adjust(attotime::from_ticks(adb_long, adb_timebase));
}
else
{
// printf(" ");
- m_adb_timer->adjust(attotime::from_ticks(57, 1000000));
+ m_adb_timer->adjust(attotime::from_ticks(adb_short, adb_timebase));
}
m_adb_stream_ptr++;
@@ -629,7 +853,7 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_adb_tick)
case LST_SENDSTOP:
set_adb_line(CLEAR_LINE);
- m_adb_timer->adjust(attotime::from_ticks((57*2), 1000000));
+ m_adb_timer->adjust(attotime::from_ticks((adb_short*2), adb_timebase));
m_adb_linestate++;
break;
@@ -645,7 +869,7 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_adb_tick)
// for input to Mac, the VIA reads on the *other* clock edge, so update this here
if (!m_adb_direction)
{
- m_via1->write_cb2((m_adb_send & 0x80)>>7);
+ write_via_data((m_adb_send & 0x80)>>7);
m_adb_send <<= 1;
}
@@ -653,13 +877,13 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_adb_tick)
//printf("ADB transition (%d)\n", m_adb_timer_ticks);
if (m_adb_direction)
{
- m_via1->write_cb1(m_adb_extclock ^ 1);
- m_via1->write_cb1(m_adb_extclock);
+ write_via_clock(m_adb_extclock ^ 1);
+ write_via_clock(m_adb_extclock);
}
else
{
- m_via1->write_cb1(m_adb_extclock);
- m_via1->write_cb1(m_adb_extclock ^ 1);
+ write_via_clock(m_adb_extclock);
+ write_via_clock(m_adb_extclock ^ 1);
}
m_adb_timer_ticks--;
@@ -667,7 +891,7 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_adb_tick)
{
m_adb_timer->adjust(attotime::never);
- if ((m_adb_direction) && (ADB_IS_BITBANG_CLASS))
+ if ((m_adb_direction) && (!m_bIsMCUMode))
{
adb_talk();
if((m_adb_last_talk == 2) && m_adb_datasize) {
@@ -676,10 +900,10 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_adb_tick)
}
}
- if (!(m_adb_direction) && (ADB_IS_BITBANG_CLASS))
+ if (!(m_adb_direction) && !(m_bIsMCUMode))
{
- // m_via1->write_cb1(m_adb_extclock);
- m_via1->write_cb1(m_adb_extclock ^ 1);
+ // write_via_clock(m_adb_extclock);
+ write_via_clock(m_adb_extclock ^ 1);
}
}
else
@@ -689,7 +913,7 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_adb_tick)
}
}
-void mac_state::mac_adb_newaction(int state)
+void macadb_device::mac_adb_newaction(int state)
{
if (state != m_adb_state)
{
@@ -706,7 +930,7 @@ void mac_state::mac_adb_newaction(int state)
m_adb_command = m_adb_send = 0;
m_adb_direction = 1; // Mac is shifting us a command
m_adb_waiting_cmd = 1; // we're going to get a command
- m_adb_irq_pending = 0;
+ write_adb_irq(CLEAR_LINE);
m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
break;
@@ -736,20 +960,20 @@ void mac_state::mac_adb_newaction(int state)
else
{
m_adb_send = 0;
- m_adb_irq_pending = 1;
+ write_adb_irq(ASSERT_LINE);
}
m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
break;
case ADB_STATE_IDLE:
- m_adb_irq_pending = 0;
+ write_adb_irq(CLEAR_LINE);
break;
}
}
}
-TIMER_CALLBACK_MEMBER(mac_state::mac_pmu_tick)
+TIMER_CALLBACK_MEMBER(macadb_device::mac_pmu_tick)
{
// state 10 means this is in response to an ADB command
if (m_pm_state == 10)
@@ -761,9 +985,9 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_pmu_tick)
// tick CB1, which should cause a PMU interrupt on PMU machines
m_adb_extclock ^= 1;
- m_via1->write_cb1(m_adb_extclock);
+ write_via_clock(m_adb_extclock);
m_adb_extclock ^= 1;
- m_via1->write_cb1(m_adb_extclock);
+ write_via_clock(m_adb_extclock);
}
else
{
@@ -774,7 +998,7 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_pmu_tick)
}
}
-void mac_state::pmu_one_byte_reply(uint8_t result)
+void macadb_device::pmu_one_byte_reply(uint8_t result)
{
m_pm_out[0] = m_pm_out[1] = 1; // length
m_pm_out[2] = result;
@@ -782,7 +1006,7 @@ void mac_state::pmu_one_byte_reply(uint8_t result)
m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200)));
}
-void mac_state::pmu_three_byte_reply(uint8_t result1, uint8_t result2, uint8_t result3)
+void macadb_device::pmu_three_byte_reply(uint8_t result1, uint8_t result2, uint8_t result3)
{
m_pm_out[0] = m_pm_out[1] = 3; // length
m_pm_out[2] = result1;
@@ -792,13 +1016,71 @@ void mac_state::pmu_three_byte_reply(uint8_t result1, uint8_t result2, uint8_t r
m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200)));
}
-void mac_state::pmu_exec()
+WRITE_LINE_MEMBER(macadb_device::pmu_req_w)
+{
+ if ((state) && !(m_pm_req & 1))
+ {
+ #if LOG_ADB
+ printf("PM: 68k dropping /REQ\n");
+ #endif
+
+ if (m_pm_state == 0) // do this in receive state only
+ {
+ m_pm_data_recv = 0xff;
+ m_pm_ack |= 2;
+
+ // check if length byte matches
+ if ((m_pm_dptr >= 2) && (m_pm_cmd[1] == (m_pm_dptr-2)))
+ {
+ pmu_exec();
+ #if LOG_ADB
+ printf("PMU exec: command %02x length %d\n", m_pm_cmd[0], m_pm_cmd[1]);
+ #endif
+ }
+ }
+ }
+ else if (!(state) && (m_pm_req & 1))
+ {
+ if (m_pm_state == 0)
+ {
+ #if LOG_ADB
+ printf("PM: 68k asserting /REQ, clocking in byte [%d] = %02x\n", m_pm_dptr, m_pm_data_send);
+ #endif
+ m_pm_ack &= ~2; // clear, we're waiting for more bytes
+ m_pm_cmd[m_pm_dptr++] = m_pm_data_send;
+ }
+ else // receiving, so this is different
+ {
+ m_pm_data_recv = m_pm_out[m_pm_sptr++];
+ m_pm_slen--;
+ m_pm_ack |= 2; // raise ACK to indicate available byte
+ #if LOG_ADB
+ printf("PM: 68k asserted /REQ, sending byte %02x\n", m_pm_data_recv);
+ #endif
+
+ // another byte to send?
+ if (m_pm_slen)
+ {
+ m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
+ }
+ else
+ {
+ m_pm_state = 0; // back to receive state
+ m_pmu_send_timer->adjust(attotime::never);
+ }
+ }
+ }
+
+ m_pm_req = state ? 1 : 0;
+}
+
+void macadb_device::pmu_exec()
{
m_pm_sptr = 0; // clear send pointer
m_pm_slen = 0; // and send length
m_pm_dptr = 0; // and receive pointer
-// printf("PMU: Command %02x\n", mac->m_pm_cmd[0]);
+ printf("PMU: Command %02x\n", m_pm_cmd[0]);
switch (m_pm_cmd[0])
{
case 0x10: // subsystem power and clock ctrl
@@ -815,33 +1097,6 @@ void mac_state::pmu_exec()
m_pm_cmd[5]);
#endif
- #if 0
- m_pm_state = 10;
- m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200)));
- if (ADB_IS_PM_VIA1_CLASS)
- {
- m_pmu_int_status = 0x1;
- }
- else if (ADB_IS_PM_VIA2_CLASS)
- {
- m_pmu_int_status = 0x10;
- }
- else
- {
- fatalerror("mac: unknown ADB PMU type\n");
- }
- m_pmu_last_adb_command = m_pm_cmd[2];
- m_adb_command = m_pm_cmd[2];
- m_adb_waiting_cmd = 1;
- adb_talk();
-
- if ((m_pm_cmd[2] & 0xf) == 0xb) // LISTEN register 3 (remap)
- {
- m_adb_waiting_cmd = 0;
- m_adb_command = mac->m_pm_cmd[5];
- adb_talk();
- }
- #else
if (((m_pm_cmd[2] == 0xfc) || (m_pm_cmd[2] == 0x2c)) && (m_pm_cmd[3] == 4))
{
// printf("PMU: request to poll ADB, returning nothing\n");
@@ -852,25 +1107,21 @@ void mac_state::pmu_exec()
{
m_pm_state = 10;
m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200)));
- if (ADB_IS_PM_VIA1_CLASS)
+ if (m_bIsPMUVIA1)
{
m_pmu_int_status = 0x1;
}
- else if (ADB_IS_PM_VIA2_CLASS)
- {
- m_pmu_int_status = 0x10;
- }
else
{
- fatalerror("mac: unknown ADB PMU type\n");
+ m_pmu_int_status = 0x10;
}
+
m_pmu_last_adb_command = m_pm_cmd[2];
}
m_adb_command = m_pm_cmd[2];
m_adb_waiting_cmd = 1;
adb_talk();
- #endif
break;
case 0x21: // turn ADB auto-poll off (does this need a reply?)
@@ -1013,7 +1264,7 @@ void mac_state::pmu_exec()
break;
case 0x78: // read interrupt flag
- if (ADB_IS_PM_VIA2_CLASS) // PB 140/170 use a "leaner" PMU protocol where you get the data for a PMU interrupt here
+ if (!m_bIsPMUVIA1) // PB 140/170 use a "leaner" PMU protocol where you get the data for a PMU interrupt here
{
#if 0
if ((m_pmu_int_status&0xf0) == 0x10)
@@ -1050,7 +1301,7 @@ void mac_state::pmu_exec()
}
else
{
- pmu_one_byte_reply(mac, m_pmu_int_status);
+ pmu_one_byte_reply(m_pmu_int_status);
}
#else
if ((m_pmu_int_status&0xf0) == 0x10)
@@ -1123,15 +1374,15 @@ void mac_state::pmu_exec()
}
}
-void mac_state::adb_vblank()
+void macadb_device::adb_vblank()
{
- if ((m_adb_state == ADB_STATE_IDLE) || ((ADB_IS_PM_CLASS) && (m_pmu_poll)))
+ if ((m_adb_state == ADB_STATE_IDLE) || ((m_bIsPMU) && (m_pmu_poll)))
{
if (this->adb_pollmouse())
{
// if the mouse was the last TALK, we can just send the new data
// otherwise we need to pull SRQ
- if ((m_adb_last_talk == m_adb_mouseaddr) && !(ADB_IS_PM_CLASS))
+ if ((m_adb_last_talk == m_adb_mouseaddr) && !(m_bIsPMU))
{
// repeat last TALK to get updated data
m_adb_waiting_cmd = 1;
@@ -1140,26 +1391,9 @@ void mac_state::adb_vblank()
m_adb_timer_ticks = 8;
this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
}
- #if 0
- else if (ADB_IS_PM_CLASS)
- {
- m_adb_waiting_cmd = 1;
- this->adb_talk();
- m_pm_state = 10;
- m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200)));
- if (ADB_IS_PM_VIA1_CLASS)
- {
- m_pmu_int_status = 0x1;
- }
- else if (ADB_IS_PM_VIA2_CLASS)
- {
- m_pmu_int_status = 0x10;
- }
- }
- #endif
else
{
- m_adb_irq_pending = 1;
+ write_adb_irq(ASSERT_LINE);
m_adb_command = m_adb_send = 0;
m_adb_timer_ticks = 1; // one tick should be sufficient to make it see the IRQ
this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
@@ -1168,7 +1402,7 @@ void mac_state::adb_vblank()
}
else if (this->adb_pollkbd(0))
{
- if ((m_adb_last_talk == m_adb_keybaddr) && !(ADB_IS_PM_CLASS))
+ if ((m_adb_last_talk == m_adb_keybaddr) && !(m_bIsPMU))
{
// repeat last TALK to get updated data
m_adb_waiting_cmd = 1;
@@ -1178,7 +1412,7 @@ void mac_state::adb_vblank()
this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
}
#if 0
- else if (ADB_IS_PM_CLASS)
+ else if (m_bIsPMU)
{
m_adb_waiting_cmd = 1;
this->adb_talk();
@@ -1189,7 +1423,7 @@ void mac_state::adb_vblank()
#endif
else
{
- m_adb_irq_pending = 1;
+ write_adb_irq(ASSERT_LINE);
m_adb_command = m_adb_send = 0;
m_adb_timer_ticks = 1; // one tick should be sufficient to make it see the IRQ
this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
@@ -1199,12 +1433,14 @@ void mac_state::adb_vblank()
}
}
-void mac_state::adb_reset()
+void macadb_device::device_reset()
{
int i;
+ m_pm_data_send = m_pm_data_recv = m_pm_ack = m_pm_req = m_pm_dptr = 0;
+ m_pm_state = 0;
m_adb_srq_switch = 0;
- m_adb_irq_pending = 0; // no interrupt
+ write_adb_irq(CLEAR_LINE); // no interrupt
m_adb_timer_ticks = 0;
m_adb_command = 0;
m_adb_extclock = 0;
@@ -1213,10 +1449,7 @@ void mac_state::adb_reset()
m_adb_state = 0;
m_adb_srqflag = false;
m_pmu_poll = 0;
- if (ADB_IS_BITBANG_CLASS)
- {
- m_adb_state = ADB_STATE_NOTINIT;
- }
+ m_adb_state = ADB_STATE_NOTINIT;
m_adb_direction = 0;
m_adb_datasize = 0;
m_adb_last_talk = -1;
@@ -1239,12 +1472,13 @@ void mac_state::adb_reset()
}
m_adb_keybuf_start = 0;
m_adb_keybuf_end = 0;
+
+ m_last_adb_time = 0;
}
-WRITE_LINE_MEMBER(mac_state::adb_linechange_w)
+WRITE_LINE_MEMBER(macadb_device::adb_linechange_w)
{
- int dtime = 0;
-/* static char const *const states[] =
+ /* static char const *const states[] =
{
"idle",
"attention",
@@ -1262,16 +1496,10 @@ WRITE_LINE_MEMBER(mac_state::adb_linechange_w)
"srqnodata"
};*/
- if (ADB_IS_EGRET)
- {
- dtime = m_egret->get_adb_dtime();
- }
- else if (ADB_IS_CUDA)
- {
- dtime = m_cuda->get_adb_dtime();
- }
+ int dtime = (int)(machine().time().as_ticks(adb_timebase) - m_last_adb_time);
+ m_last_adb_time = machine().time().as_ticks(adb_timebase);
-/* if (m_adb_linestate <= 12)
+ /*if (m_adb_linestate <= 12)
{
printf("linechange: %d -> %d, time %d (state %d = %s)\n", state^1, state, dtime, m_adb_linestate, states[m_adb_linestate]);
}
@@ -1386,7 +1614,7 @@ WRITE_LINE_MEMBER(mac_state::adb_linechange_w)
printf("%02x ", m_adb_buffer[i]);
}*/
m_adb_linestate = LST_TSTOPSTART; // T1t
- m_adb_timer->adjust(attotime::from_ticks(324/4, 1000000));
+ m_adb_timer->adjust(attotime::from_ticks(324/4, adb_timebase));
m_adb_stream_ptr = 0;
}
else if (m_adb_direction) // if direction is set, we LISTENed to a valid device
@@ -1398,7 +1626,7 @@ WRITE_LINE_MEMBER(mac_state::adb_linechange_w)
if (m_adb_srqflag)
{
m_adb_linestate = LST_SRQNODATA;
- m_adb_timer->adjust(attotime::from_ticks(486, 1000000)); // SRQ time
+ m_adb_timer->adjust(attotime::from_ticks(adb_srq, adb_timebase)); // SRQ time
}
else
{
@@ -1426,15 +1654,3 @@ WRITE_LINE_MEMBER(mac_state::adb_linechange_w)
break;
}
}
-
-void mac_state::set_adb_line(int linestate)
-{
- if (ADB_IS_EGRET)
- {
- m_egret->set_adb_line(linestate);
- }
- else if (ADB_IS_CUDA)
- {
- m_cuda->set_adb_line(linestate);
- }
-}
diff --git a/src/mame/machine/macadb.h b/src/mame/machine/macadb.h
index 6a8d16a718e..6b2fff18880 100644
--- a/src/mame/machine/macadb.h
+++ b/src/mame/machine/macadb.h
@@ -1,2 +1,112 @@
// license:BSD-3-Clause
// copyright-holders:R. Belmont
+#ifndef MAME_MACHINE_MACADB_H
+#define MAME_MACHINE_MACADB_H
+
+#pragma once
+
+#include "emu.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> macadb_device
+
+class macadb_device : public device_t
+{
+public:
+ // construction/destruction
+ macadb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ void set_mcu_mode(bool bMCUMode) { m_bIsMCUMode = bMCUMode; }
+ void set_pmu_mode(bool bPMUMode) { m_bIsPMU = bPMUMode; }
+ void set_pmu_is_via1(bool bPMUVIA1) { m_bIsPMUVIA1 = bPMUVIA1; }
+
+ auto via_clock_callback() { return write_via_clock.bind(); }
+ auto via_data_callback() { return write_via_data.bind(); }
+ auto adb_data_callback() { return write_adb_data.bind(); }
+ auto adb_irq_callback() { return write_adb_irq.bind(); }
+
+ required_ioport m_mouse0, m_mouse1, m_mouse2;
+ required_ioport_array<6> m_keys;
+ devcb_write_line write_via_clock, write_via_data, write_adb_data, write_adb_irq;
+
+ DECLARE_WRITE_LINE_MEMBER(adb_data_w);
+ DECLARE_WRITE_LINE_MEMBER(adb_linechange_w);
+
+ void adb_vblank();
+ void mac_adb_newaction(int state);
+ int32_t get_adb_state(void) { return m_adb_state; }
+
+ void pmu_exec();
+ int get_pm_data_recv(void) { return m_pm_data_recv; }
+ int get_pm_ack(void) { return m_pm_ack; }
+ void set_pm_data_send(int data) { m_pm_data_send = data; }
+ DECLARE_WRITE_LINE_MEMBER(pmu_req_w);
+
+protected:
+ // device-level overrides
+ virtual ioport_constructor device_input_ports() const override;
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+private:
+ bool m_bIsMCUMode;
+ bool m_bIsPMU;
+ bool m_bIsPMUVIA1;
+
+ uint64_t m_last_adb_time;
+
+ emu_timer *m_adb_timer;
+
+ /* keyboard matrix to detect transition */
+ int m_key_matrix[7];
+
+ // ADB HLE state
+ int32_t m_adb_state, m_adb_waiting_cmd, m_adb_datasize, m_adb_buffer[257];
+ int32_t m_adb_command, m_adb_send, m_adb_timer_ticks, m_adb_extclock, m_adb_direction;
+ int32_t m_adb_listenreg, m_adb_listenaddr, m_adb_last_talk, m_adb_srq_switch;
+ int32_t m_adb_stream_ptr;
+ int32_t m_adb_linestate;
+ bool m_adb_srqflag;
+
+ #define kADBKeyBufSize 32
+ uint8_t m_adb_keybuf[kADBKeyBufSize];
+ uint8_t m_adb_keybuf_start;
+ uint8_t m_adb_keybuf_end;
+
+ // Portable/PB100 Power Manager IC comms (chapter 4, "Guide to the Macintosh Family Hardware", second edition)
+ uint8_t m_pm_ack, m_pm_cmd[32], m_pm_out[32], m_pm_dptr, m_pm_sptr, m_pm_slen, m_pm_state, m_pm_data_recv;
+ uint8_t m_pmu_int_status, m_pmu_last_adb_command, m_pmu_poll, m_pm_req, m_pm_data_send;
+ emu_timer *m_pmu_send_timer;
+
+ // ADB mouse state
+ int m_adb_mouseaddr;
+ int m_adb_lastmousex, m_adb_lastmousey, m_adb_lastbutton, m_adb_mouse_initialized;
+
+ // ADB keyboard state
+ int m_adb_keybaddr;
+ int m_adb_keybinitialized, m_adb_currentkeys[2], m_adb_modifiers;
+
+ // PRAM for ADB MCU HLEs (mostly unused now)
+ uint8_t m_adb_pram[256];
+
+ int adb_pollkbd(int update);
+ int adb_pollmouse();
+ void adb_accummouse( uint8_t *MouseX, uint8_t *MouseY );
+ void adb_talk();
+
+ void pmu_one_byte_reply(uint8_t result);
+ void pmu_three_byte_reply(uint8_t result1, uint8_t result2, uint8_t result3);
+
+ inline void set_adb_line(int linestate) { write_adb_data(linestate); }
+
+ TIMER_CALLBACK_MEMBER(mac_adb_tick); // macadb.c
+ TIMER_CALLBACK_MEMBER(mac_pmu_tick); // macadb.c
+};
+
+// device type definition
+DECLARE_DEVICE_TYPE(MACADB, macadb_device)
+
+#endif // MAME_MACHINE_MACADB_H
diff --git a/src/mame/machine/mbc55x_kbd.cpp b/src/mame/machine/mbc55x_kbd.cpp
index e4393486b86..fb8e51d5b5e 100644
--- a/src/mame/machine/mbc55x_kbd.cpp
+++ b/src/mame/machine/mbc55x_kbd.cpp
@@ -105,7 +105,7 @@ static INPUT_PORTS_START(mbc55x_kbd)
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad 6 " UTF8_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_CODE(KEYCODE_6_PAD)
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) PORT_CODE(KEYCODE_DEL_PAD)
- PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHAR('7') PORT_CHAR('$') PORT_CODE(KEYCODE_7)
+ PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHAR('7') PORT_CHAR('&') PORT_CODE(KEYCODE_7)
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHAR('u') PORT_CHAR('U') PORT_CODE(KEYCODE_U)
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHAR('j') PORT_CHAR('J') PORT_CODE(KEYCODE_J)
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHAR('n') PORT_CHAR('N') PORT_CODE(KEYCODE_N)
@@ -210,13 +210,13 @@ const u8 mbc55x_keyboard_device::s_code_table[2][12][8] =
{ 0x15, '>', 'A', 'Q', '!', 0x00, 0x1b, '|' },
{ 0x16, 'Z', 'S', 'W', '@', ' ', 0x05, 0x08 },
{ 0x17, 'X', 'D', 'E', '#', 0x00, 0x0d, 0x07 },
- { 0x18, 'C', 'F', 'R', '$', '0', '4', 0x00 },
- { 0x19, 'V', 'G', 'T', '%', 0x00, '5', 0x00 },
- { '=', 'B', 'H', 'Y', '^', '.', '6', 0x00 },
- { '/', 'N', 'J', 'U', '&', '1', '7', 0x00 },
- { '*', 'M', 'K', 'I', '*', '2', '8', 0x00 },
- { 0x03, ',', 'L', 'O', '(', '3', '9', 0x00 },
- { '-', '.', ':', 'P', ')', 0x00, 0x00, 0x00 },
+ { 0x18, 'C', 'F', 'R', '$', 0x00, 0x00, 0x00 },
+ { 0x19, 'V', 'G', 'T', '%', '0', '4', 0x00 },
+ { '=', 'B', 'H', 'Y', '^', '0', '5', 0x00 },
+ { '/', 'N', 'J', 'U', '&', '.', '6', 0x00 },
+ { '*', 'M', 'K', 'I', '*', '1', '7', 0x00 },
+ { 0x03, ',', 'L', 'O', '(', '2', '8', 0x00 },
+ { '-', '.', ':', 'P', ')', '3', '9', 0x00 },
{ '+', '?', '"', '{', '_', 0x00, 0x00, 0x00 },
{ 0x0d, '*', '~', '}', '+', 0x00, 0x00, 0x00 }
},
@@ -224,13 +224,13 @@ const u8 mbc55x_keyboard_device::s_code_table[2][12][8] =
{ 0x10, '<', 'a', 'q', '1', 0x00, 0x1b, '\\' },
{ 0x11, 'z', 's', 'w', '2', ' ', 0x09, 0x08 },
{ 0x12, 'x', 'd', 'e', '3', 0x00, 0x0d, 0x7f },
- { 0x13, 'c', 'f', 'r', '4', '0', '4', 0x00 },
- { 0x14, 'v', 'g', 't', '5', 0x00, '5', 0x00 },
- { '=', 'b', 'h', 'y', '6', '.', '6', 0x00 },
- { '/', 'n', 'j', 'u', '7', '1', '7', 0x00 },
- { '*', 'm', 'k', 'i', '8', '2', '8', 0x00 },
- { 0x03, ',', 'l', 'o', '9', '3', '9', 0x00 },
- { '-', '.', ';', 'p', '0', 0x00, 0x00, 0x00 },
+ { 0x13, 'c', 'f', 'r', '4', 0x00, 0x00, 0x00 },
+ { 0x14, 'v', 'g', 't', '5', '0', '4', 0x00 },
+ { '=', 'b', 'h', 'y', '6', '0', '5', 0x00 },
+ { '/', 'n', 'j', 'u', '7', '.', '6', 0x00 },
+ { '*', 'm', 'k', 'i', '8', '1', '7', 0x00 },
+ { 0x03, ',', 'l', 'o', '9', '2', '8', 0x00 },
+ { '-', '.', ';', 'p', '0', '3', '9', 0x00 },
{ '+', '/', '\'', '[', '-', 0x00, 0x00, 0x00 },
{ 0x0d, '*', '`', ']', '=', 0x00, 0x00, 0x00 }
}
diff --git a/src/mame/machine/mega32x.cpp b/src/mame/machine/mega32x.cpp
index f16e2318705..b8607d8506a 100644
--- a/src/mame/machine/mega32x.cpp
+++ b/src/mame/machine/mega32x.cpp
@@ -935,7 +935,7 @@ void sega_32x_device::m68k_pwm_w(offs_t offset, uint16_t data)
pwm_w(offset,data);
}
-void sega_32x_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void sega_32x_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
for (int s = 0; s < samples; s++)
{
@@ -1742,7 +1742,7 @@ void sega_32x_device::device_start()
set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b));
}
- m_stream = stream_alloc(2, 2, 48000 * 4);
+ m_stream = stream_alloc_legacy(2, 2, 48000 * 4);
m_32x_pwm_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sega_32x_device::handle_pwm_callback), this));
m_32x_dram0 = std::make_unique<uint16_t[]>(0x40000/2);
diff --git a/src/mame/machine/mega32x.h b/src/mame/machine/mega32x.h
index 97c7512ca13..e56db24fdb3 100644
--- a/src/mame/machine/mega32x.h
+++ b/src/mame/machine/mega32x.h
@@ -110,7 +110,7 @@ protected:
virtual uint32_t palette_entries() const override { return 32*32*32/**2*/; }
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
void update_total_scanlines(bool mode3) { m_total_scanlines = mode3 ? (m_base_total_scanlines * 2) : m_base_total_scanlines; } // this gets set at each EOF
diff --git a/src/mame/machine/mm1kb.cpp b/src/mame/machine/mm1kb.cpp
index 1b3f660d358..c411afc615b 100644
--- a/src/mame/machine/mm1kb.cpp
+++ b/src/mame/machine/mm1kb.cpp
@@ -124,7 +124,7 @@ INPUT_PORTS_START( mm1_keyboard )
PORT_START("Y5")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?')
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC2\xB4 '") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00B4) PORT_CHAR('`')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC2\xB4 '") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00B4,'\'') PORT_CHAR('`')
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x96")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':')
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
diff --git a/src/mame/machine/nl_tank.cpp b/src/mame/machine/nl_tank.cpp
index e956d12a09c..152d7fe01d3 100644
--- a/src/mame/machine/nl_tank.cpp
+++ b/src/mame/machine/nl_tank.cpp
@@ -9,25 +9,6 @@
#include "netlist/devices/net_lib.h"
-static NETLIST_START(NE556_DIP)
- NE555(A)
- NE555(B)
-
- NET_C(A.GND, B.GND)
- NET_C(A.VCC, B.VCC)
-
- DIPPINS( /* +--------------+ */
- A.DISCH, /* 1DISCH |1 ++ 14| VCC */ A.VCC,
- A.THRESH, /* 1THRES |2 13| 2DISCH */ B.DISCH,
- A.CONT, /* 1CONT |3 12| 2THRES */ B.THRESH,
- A.RESET, /* 1RESET |4 NE556 11| 2CONT */ B.CONT,
- A.OUT, /* 1OUT |5 10| 2RESET */ B.RESET,
- A.TRIG, /* 1TRIG |6 9| 2OUT */ B.OUT,
- A.GND, /* GND |7 8| 2TRIG */ B.TRIG
- /* +--------------+ */
- )
-NETLIST_END()
-
NETLIST_START(tank)
SOLVER(Solver, 16000)
@@ -42,8 +23,6 @@ NETLIST_START(tank)
ALIAS(VCC, V5)
ALIAS(P, V5)
- LOCAL_SOURCE(NE556_DIP)
-
RES(R4, RES_K(3.3))
RES(R5, RES_K(3.3))
RES(R6, RES_K(3.3))
diff --git a/src/mame/machine/octo_kbd.cpp b/src/mame/machine/octo_kbd.cpp
index 8398078dad9..3129cdc5d61 100644
--- a/src/mame/machine/octo_kbd.cpp
+++ b/src/mame/machine/octo_kbd.cpp
@@ -82,7 +82,7 @@ static INPUT_PORTS_START( octopus_keyboard )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F23")
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F26")
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT)
// 0x20
PORT_START("LINE4")
@@ -108,7 +108,7 @@ static INPUT_PORTS_START( octopus_keyboard )
// 0x30
PORT_START("LINE6")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*')
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@ \\") PORT_CHAR('@') PORT_CHAR('\\')
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@ \\") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') PORT_CHAR('`') // keytop shows backslash but it produces tic
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12))
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
@@ -172,7 +172,7 @@ static INPUT_PORTS_START( octopus_keyboard )
PORT_START("LINEC")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL))
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("_") PORT_CHAR('_')
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH)
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F14")
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad .") PORT_CODE(KEYCODE_DEL_PAD)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 3") PORT_CODE(KEYCODE_3_PAD)
@@ -182,7 +182,7 @@ static INPUT_PORTS_START( octopus_keyboard )
PORT_START("LINED")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 \xE2\x82\xA4") PORT_CODE(KEYCODE_3) PORT_CHAR('3')
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 \xE2\x82\xA4") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0xA3)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F21")
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
diff --git a/src/mame/machine/p2000t.cpp b/src/mame/machine/p2000t.cpp
index 459c6a97d34..06adeb063f4 100644
--- a/src/mame/machine/p2000t.cpp
+++ b/src/mame/machine/p2000t.cpp
@@ -12,25 +12,25 @@
#include "emu.h"
#include "includes/p2000t.h"
-#define P2000M_101F_CASDAT 0x01
-#define P2000M_101F_CASCMD 0x02
-#define P2000M_101F_CASREW 0x04
-#define P2000M_101F_CASFOR 0x08
-#define P2000M_101F_KEYINT 0x40
-#define P2000M_101F_PRNOUT 0x80
-
-#define P2000M_202F_PINPUT 0x01
-#define P2000M_202F_PREADY 0x02
-#define P2000M_202F_STRAPN 0x04
-#define P2000M_202F_CASENB 0x08
-#define P2000M_202F_CASPOS 0x10
-#define P2000M_202F_CASEND 0x20
-#define P2000M_202F_CASCLK 0x40
-#define P2000M_202F_CASDAT 0x80
-
-#define P2000M_303F_VIDEO 0x01
-
-#define P2000M_707F_DISA 0x01
+#define P2000M_101F_CASDAT 0x01
+#define P2000M_101F_CASCMD 0x02
+#define P2000M_101F_CASREW 0x04
+#define P2000M_101F_CASFOR 0x08
+#define P2000M_101F_KEYINT 0x40
+#define P2000M_101F_PRNOUT 0x80
+
+#define P2000M_202F_PINPUT 0x01
+#define P2000M_202F_PREADY 0x02
+#define P2000M_202F_STRAPN 0x04
+#define P2000M_202F_CASENB 0x08
+#define P2000M_202F_CASPOS 0x10
+#define P2000M_202F_CASEND 0x20
+#define P2000M_202F_CASCLK 0x40
+#define P2000M_202F_CASDAT 0x80
+
+#define P2000M_303F_VIDEO 0x01
+
+#define P2000M_707F_DISA 0x01
/*
Keyboard port 0x0x
@@ -44,40 +44,44 @@
*/
uint8_t p2000t_state::p2000t_port_000f_r(offs_t offset)
{
- if (m_port_101f & P2000M_101F_KEYINT)
- {
- return (
- m_keyboard[0]->read() & m_keyboard[1]->read() &
- m_keyboard[2]->read() & m_keyboard[3]->read() &
- m_keyboard[4]->read() & m_keyboard[5]->read() &
- m_keyboard[6]->read() & m_keyboard[7]->read() &
- m_keyboard[8]->read() & m_keyboard[9]->read());
- }
- else
- if (offset < 10)
- {
- return m_keyboard[offset]->read();
- }
- else
- return 0xff;
+ if (m_port_101f & P2000M_101F_KEYINT)
+ {
+ return (m_keyboard[0]->read() & m_keyboard[1]->read() & m_keyboard[2]->read()
+ & m_keyboard[3]->read() & m_keyboard[4]->read() & m_keyboard[5]->read()
+ & m_keyboard[6]->read() & m_keyboard[7]->read() & m_keyboard[8]->read()
+ & m_keyboard[9]->read());
+ }
+ else if (offset < 10)
+ {
+ return m_keyboard[offset]->read();
+ }
+ else
+ return 0xff;
}
-
/*
Input port 0x2x
bit 0 - Printer input
bit 1 - Printer ready
bit 2 - Strap N (daisy/matrix)
- bit 3 - Cassette write enabled
- bit 4 - Cassette in position
- bit 5 - Begin/end of tape
- bit 6 - Cassette read clock
+ bit 3 - Cassette write enabled, 0 = Write enabled
+ bit 4 - Cassette in position, 0 = Cassette in position
+ bit 5 - Begin/end of tape 0 = Beginning or End of tap
+ bit 6 - Cassette read clock Flips when a bit is available.
bit 7 - Cassette read data
+
+ Note: bit 6 & 7 are swapped when the cassette is moving in reverse.
*/
uint8_t p2000t_state::p2000t_port_202f_r()
{
- return (0xff);
+ uint8_t data = 0x00;
+ data |= !m_mdcr->wen() << 3;
+ data |= !m_mdcr->cip() << 4;
+ data |= !m_mdcr->bet() << 5;
+ data |= m_mdcr->rdc() << 6;
+ data |= !m_mdcr->rda() << 7;
+ return data;
}
@@ -95,7 +99,11 @@ uint8_t p2000t_state::p2000t_port_202f_r()
*/
void p2000t_state::p2000t_port_101f_w(uint8_t data)
{
- m_port_101f = data;
+ m_port_101f = data;
+ m_mdcr->wda(BIT(data, 0));
+ m_mdcr->wdc(BIT(data, 1));
+ m_mdcr->rev(BIT(data, 2));
+ m_mdcr->fwd(BIT(data, 3));
}
/*
@@ -110,10 +118,7 @@ void p2000t_state::p2000t_port_101f_w(uint8_t data)
bit 6 - \
bit 7 - Video disable (0 = enabled)
*/
-void p2000t_state::p2000t_port_303f_w(uint8_t data)
-{
- m_port_303f = data;
-}
+void p2000t_state::p2000t_port_303f_w(uint8_t data) { m_port_303f = data; }
/*
Beeper 0x5x
@@ -127,10 +132,7 @@ void p2000t_state::p2000t_port_303f_w(uint8_t data)
bit 6 - Unused
bit 7 - Unused
*/
-void p2000t_state::p2000t_port_505f_w(uint8_t data)
-{
- m_speaker->level_w(BIT(data, 0));
-}
+void p2000t_state::p2000t_port_505f_w(uint8_t data) { m_speaker->level_w(BIT(data, 0)); }
/*
DISAS 0x7x (P2000M only)
@@ -148,10 +150,7 @@ void p2000t_state::p2000t_port_505f_w(uint8_t data)
video refresh is disabled when the CPU accesses video memory
*/
-void p2000t_state::p2000t_port_707f_w(uint8_t data)
-{
- m_port_707f = data;
-}
+void p2000t_state::p2000t_port_707f_w(uint8_t data) { m_port_707f = data; }
void p2000t_state::p2000t_port_888b_w(uint8_t data) {}
void p2000t_state::p2000t_port_8c90_w(uint8_t data) {}
diff --git a/src/mame/machine/p2000t_mdcr.cpp b/src/mame/machine/p2000t_mdcr.cpp
new file mode 100644
index 00000000000..75d860e5bac
--- /dev/null
+++ b/src/mame/machine/p2000t_mdcr.cpp
@@ -0,0 +1,321 @@
+// license:BSD-3-Clause
+// copyright-holders:Erwin Jansen
+/**********************************************************************
+
+ Philips P2000T Mini Digital Cassette Recorder emulation
+
+**********************************************************************/
+
+#include "emu.h"
+#include "p2000t_mdcr.h"
+#include "formats/p2000t_cas.h"
+
+DEFINE_DEVICE_TYPE(MDCR, mdcr_device, "mdcr", "Philips Mini DCR")
+
+READ_LINE_MEMBER(mdcr_device::rdc)
+{
+ // According to mdcr spec there is cross talk on the wires when writing,
+ // hence the clock signal is always false when writing.
+ if (m_recording)
+ return false;
+
+ return m_fwd ? m_rdc : m_rda;
+}
+
+READ_LINE_MEMBER(mdcr_device::rda)
+{
+ return m_fwd ? m_rda : m_rdc;
+}
+
+READ_LINE_MEMBER(mdcr_device::bet)
+{
+ return tape_start_or_end();
+}
+
+READ_LINE_MEMBER(mdcr_device::cip)
+{
+ return true;
+}
+
+READ_LINE_MEMBER(mdcr_device::wen)
+{
+ return true;
+}
+
+WRITE_LINE_MEMBER(mdcr_device::rev)
+{
+ m_rev = state;
+ if (m_rev)
+ {
+ rewind();
+ }
+
+ if (!m_rev && !m_fwd)
+ {
+ stop();
+ }
+}
+
+WRITE_LINE_MEMBER(mdcr_device::fwd)
+{
+ m_fwd = state;
+ if (m_fwd)
+ {
+ forward();
+ }
+
+ if (!m_rev && !m_fwd)
+ {
+ stop();
+ }
+}
+
+WRITE_LINE_MEMBER(mdcr_device::wda)
+{
+ m_wda = state;
+}
+
+WRITE_LINE_MEMBER(mdcr_device::wdc)
+{
+ if (state)
+ {
+ write_bit(m_wda);
+ };
+}
+
+void mdcr_device::device_add_mconfig(machine_config &config)
+{
+ CASSETTE(config, m_cassette);
+ m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED |
+ CASSETTE_SPEAKER_MUTED);
+ m_cassette->set_interface("p2000_cass");
+ m_cassette->set_formats(p2000t_cassette_formats);
+}
+
+mdcr_device::mdcr_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
+: device_t(mconfig, MDCR, tag, owner, clock)
+, m_cassette(*this, "cassette")
+, m_read_timer(nullptr)
+{
+}
+
+void mdcr_device::device_start()
+{
+ m_read_timer = timer_alloc();
+ m_read_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100));
+
+ save_item(NAME(m_fwd));
+ save_item(NAME(m_rev));
+ save_item(NAME(m_rdc));
+ save_item(NAME(m_rda));
+ save_item(NAME(m_wda));
+ save_item(NAME(m_recording));
+ save_item(NAME(m_fwd_pulse_time));
+ save_item(NAME(m_last_tape_time));
+ save_item(NAME(m_save_tape_time));
+ // Phase decoder
+ save_item(STRUCT_MEMBER(m_phase_decoder, m_last_signal));
+ save_item(STRUCT_MEMBER(m_phase_decoder, m_needs_sync));
+ save_item(STRUCT_MEMBER(m_phase_decoder, m_bit_queue));
+ save_item(STRUCT_MEMBER(m_phase_decoder, m_bit_place));
+ save_item(STRUCT_MEMBER(m_phase_decoder, m_current_clock));
+ save_item(STRUCT_MEMBER(m_phase_decoder, m_clock_period));
+}
+
+void mdcr_device::device_pre_save()
+{
+ m_save_tape_time = m_cassette->get_position();
+}
+
+void mdcr_device::device_post_load()
+{
+ m_cassette->seek(m_save_tape_time, SEEK_SET);
+}
+
+void mdcr_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ if (!m_recording && m_cassette->motor_on())
+ {
+ // Account for moving backwards.
+ auto delay = std::abs(m_cassette->get_position() - m_last_tape_time);
+
+ // Decode the signal using the fake phase decode circuit
+ bool newBit = m_phase_decoder.signal((m_cassette->input() > +0.04), delay);
+ if (newBit)
+ {
+ // Flip rdc
+ m_rdc = !m_rdc;
+ m_rda = m_phase_decoder.pull_bit();
+ }
+ }
+ m_last_tape_time = m_cassette->get_position();
+}
+
+void mdcr_device::write_bit(bool bit)
+{
+ m_recording = true;
+ m_cassette->change_state(CASSETTE_RECORD, CASSETTE_MASK_UISTATE);
+ m_cassette->output(bit ? +1.0 : -1.0);
+ m_phase_decoder.reset();
+}
+
+void mdcr_device::rewind()
+{
+ m_fwd = false;
+ m_recording = false;
+ m_cassette->set_motor(true);
+ m_cassette->change_state(CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
+ m_cassette->go_reverse();
+}
+
+void mdcr_device::forward()
+{
+ // A pulse of 1us < T < 20 usec should reset the phase decoder.
+ // See mdcr spec for details.
+ constexpr double RESET_PULSE_TIMING = 2.00e-05;
+ auto now = machine().time().as_double();
+ auto pulse_delay = now - m_fwd_pulse_time;
+ m_fwd_pulse_time = now;
+
+ if (pulse_delay < RESET_PULSE_TIMING)
+ {
+ m_phase_decoder.reset();
+ }
+
+ m_fwd = true;
+ m_cassette->set_motor(true);
+ m_cassette->change_state(m_recording ? CASSETTE_RECORD : CASSETTE_PLAY,
+ CASSETTE_MASK_UISTATE);
+ m_cassette->go_forward();
+}
+
+void mdcr_device::stop()
+{
+ m_cassette->change_state(CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
+ m_cassette->set_motor(false);
+}
+
+bool mdcr_device::tape_start_or_end()
+{
+ auto pos = m_cassette->get_position();
+ return m_cassette->motor_on() &&
+ (pos <= 0 || pos >= m_cassette->get_length());
+}
+
+void p2000_mdcr_devices(device_slot_interface &device)
+{
+ device.option_add("mdcr", MDCR);
+}
+
+//
+// phase_decoder
+//
+
+mdcr_device::phase_decoder::phase_decoder(double tolerance)
+: m_tolerance(tolerance)
+{
+ reset();
+}
+
+bool mdcr_device::phase_decoder::pull_bit()
+{
+ if (m_bit_place == 0)
+ return false;
+ auto res = BIT(m_bit_queue, 0);
+ m_bit_place--;
+ m_bit_queue >>= 1;
+ return res;
+}
+
+bool mdcr_device::phase_decoder::signal(bool state, double delay)
+{
+ m_current_clock += delay;
+ if (state == m_last_signal)
+ {
+ if (m_needs_sync == 0 && m_current_clock > m_clock_period &&
+ !within_tolerance(m_current_clock, m_clock_period))
+ {
+ // We might be at the last bit in a sequence, meaning we
+ // are only getting the reference signal for a while.
+ // so we produce one last clock signal.
+ reset();
+ return true;
+ }
+ return false;
+ }
+
+ // A transition happened!
+ m_last_signal = state;
+ if (m_needs_sync > 0)
+ {
+ // We have not yet determined our clock period.
+ return sync_signal(state);
+ }
+
+ // We are within bounds of the current clock
+ if (within_tolerance(m_current_clock, m_clock_period))
+ {
+ add_bit(state);
+ return true;
+ };
+
+ // We went out of sync, our clock is wayyy out of bounds.
+ if (m_current_clock > m_clock_period)
+ reset();
+
+ // We are likely halfway in our clock signal..
+ return false;
+};
+
+void mdcr_device::phase_decoder::reset()
+{
+ m_last_signal = false;
+ m_current_clock = {};
+ m_clock_period = {};
+ m_needs_sync = SYNCBITS;
+}
+
+void mdcr_device::phase_decoder::add_bit(bool bit)
+{
+ if (bit)
+ m_bit_queue |= bit << m_bit_place;
+ else
+ m_bit_queue &= ~(bit << m_bit_place);
+
+ if (m_bit_place <= QUEUE_DELAY)
+ m_bit_place++;
+
+ m_current_clock = {};
+}
+
+bool mdcr_device::phase_decoder::sync_signal(bool state)
+{
+ m_needs_sync--;
+ if (m_needs_sync == SYNCBITS - 1)
+ {
+ // We can only synchronize when we go up
+ // on the first bit.
+ if (state)
+ add_bit(true);
+ return false;
+ }
+ if (m_clock_period != 0 && !within_tolerance(m_current_clock, m_clock_period))
+ {
+ // Clock is way off!
+ reset();
+ return false;
+ }
+
+ // We've derived a clock period, we will use the average.
+ auto div = SYNCBITS - m_needs_sync - 1;
+ m_clock_period = ((div - 1) * m_clock_period + m_current_clock) / div;
+ add_bit(state);
+ return true;
+}
+
+// y * (1 - tolerance) < x < y * (1 + tolerance)
+bool mdcr_device::phase_decoder::within_tolerance(double x, double y)
+{
+ assert(m_tolerance > 0 && m_tolerance < 1);
+ return (y * (1 - m_tolerance)) < x && x < (y * (1 + m_tolerance));
+}
diff --git a/src/mame/machine/p2000t_mdcr.h b/src/mame/machine/p2000t_mdcr.h
new file mode 100644
index 00000000000..9b312ed42d7
--- /dev/null
+++ b/src/mame/machine/p2000t_mdcr.h
@@ -0,0 +1,177 @@
+// license:BSD-3-Clause
+// copyright-holders:Erwin Jansen
+/**********************************************************************
+
+ Philips P2000t Mini Digital Cassette Recorder Emulation
+
+**********************************************************************
+
+ +12V 1 8 !WCD
+ OV (signal) 2 9 !REV
+ OV (power) 3 A !FWD
+ GND 4 B RDC
+ !WDA 6 C !RDA
+ !BET 7 D !CIP
+ E !WEN
+
+**********************************************************************/
+
+#ifndef MAME_MACHINE_P2000T_MDCR_H
+#define MAME_MACHINE_P2000T_MDCR_H
+
+#pragma once
+
+#include "imagedev/cassette.h"
+
+/// \brief Models a MCR220 Micro Cassette Recorder
+///
+/// Detailed documentation on the device can be found in this repository:
+/// https://github.com/p2000t/documentation/tree/master/hardware
+///
+/// This device was built in the P2000t and was used as tape storage.
+/// It used mini-cassettes that were also used in dictation devices.
+/// The P2000t completely controls this device without user intervention.
+class mdcr_device : public device_t
+{
+public:
+ mdcr_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock);
+
+ /// \brief The read clock, switches state when a bit is available.
+ ///
+ /// This is the read clock. The read clock is a flip flop that switches
+ /// whenever a new bit is available on rda. The original flips every 167us
+ /// This system flips at 154 / 176 usec, which is within the tolerance for
+ /// the rom and system diagnostics.
+ ///
+ /// Note that rdc & rda are flipped when the tape is moving in reverse.
+ DECLARE_READ_LINE_MEMBER(rdc);
+
+ /// The current active data bit.
+ DECLARE_READ_LINE_MEMBER(rda);
+
+ /// False indicates we have reached end/beginning of tape
+ DECLARE_READ_LINE_MEMBER(bet);
+
+ /// False if a cassette is in place.
+ DECLARE_READ_LINE_MEMBER(cip);
+
+ /// False when the cassette is write enabled.
+ DECLARE_READ_LINE_MEMBER(wen);
+
+ /// True if we should activate the reverse motor.
+ DECLARE_WRITE_LINE_MEMBER(rev);
+
+ /// True if we should activate the forward motor.
+ /// Note: A quick pulse (<20usec) will reset the phase decoder.
+ DECLARE_WRITE_LINE_MEMBER(fwd);
+
+ /// The bit to write to tape. Make sure to set wda after wdc.
+ DECLARE_WRITE_LINE_MEMBER(wda);
+
+ /// True if the current wda should be written to tape.
+ DECLARE_WRITE_LINE_MEMBER(wdc);
+
+protected:
+ virtual void device_start() override;
+ virtual void device_pre_save() override;
+ virtual void device_post_load() 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;
+
+private:
+ /// \brief A Phase Decoder used in a Philips MDCR220 Mini Cassette Recorder
+ ///
+ /// A phase decoder is capable of converting a signal stream into a
+ /// a series of bits that go together with a clock signal. This phase
+ /// decoder is conform to what you would find in an Philips MDCR220
+ ///
+ /// Signals are converted into bits whenever the line signal
+ /// changes from low to high and vice versa on a clock signal.
+ ///
+ /// A transition on a clock boundary from low to high is a 1.
+ /// A transition on a clock boundary from high to low is a 0
+ /// An intermediate transition halfway between the clock boundary
+ /// can occur when there are consecutive 0s or 1s. See the example
+ /// below where the clock is marked by a |
+ ///
+ /// 1 0 1 1 0 0
+ /// RDA: _|----|____|--__|----|__--|__--
+ /// RDC: _|-___|-___|-___|-___|-___|-___
+ /// ^ ^
+ /// |-- clock signal |-- intermediate transition.
+ ///
+ /// This particular phase decoder expects a signal of
+ /// 1010 1010 which is used to derive the clock T.
+ /// after a reset.
+ class phase_decoder
+ {
+ using time_in_seconds = double;
+
+ public:
+ /// Creates a phase decoder with the given tolerance.
+ phase_decoder(double tolerance = 0.15);
+
+ /// Pulls the bit out of the queue.
+ bool pull_bit();
+
+ /// Returns true if a new bit can be read, you can now pull the bit.
+ bool signal(bool state, double delay);
+
+ /// Reset the clock state, the system will now need to resynchronize on 0xAA.
+ void reset();
+
+ private:
+ // add a bit and reset the current clock.
+ void add_bit(bool bit);
+
+ // tries to sync up the signal and calculate the clockperiod.
+ bool sync_signal(bool state);
+
+ // y * (1 - tolerance) < x < y * (1 + tolerance)
+ bool within_tolerance(double x, double y);
+
+ double m_tolerance;
+
+ static constexpr int SYNCBITS = 7;
+ static constexpr int QUEUE_DELAY = 2;
+
+ public:
+ // Needed for save state.
+ bool m_last_signal{ false };
+ int m_needs_sync{ SYNCBITS };
+ uint8_t m_bit_queue{ 0 };
+ uint8_t m_bit_place{ 0 };
+ time_in_seconds m_current_clock{ 0 };
+ time_in_seconds m_clock_period{ 0 };
+ };
+
+
+ void write_bit(bool bit);
+ void rewind();
+ void forward();
+ void stop();
+ bool tape_start_or_end();
+
+ bool m_fwd{ false };
+ bool m_rev{ false };
+ bool m_rdc{ false };
+ bool m_rda{ false };
+ bool m_wda{ false };
+
+ bool m_recording{ false };
+ double m_fwd_pulse_time{ 0 };
+ double m_last_tape_time{ 0 };
+ double m_save_tape_time{ 0 };
+
+ required_device<cassette_image_device> m_cassette;
+ phase_decoder m_phase_decoder;
+
+ // timers
+ emu_timer *m_read_timer;
+};
+
+
+DECLARE_DEVICE_TYPE(MDCR, mdcr_device)
+
+#endif // MAME_MACHINE_P2000T_MDCR_H
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index c2562d8765c..bcc8b4b7ea0 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -14809,6 +14809,7 @@ mobigo2
@source:generalplus_gpl16250_nand.cpp
wlsair60 // Wireless Air 60
kiugames
+jak_camp
jak_car2
jak_gtg
jak_sspop
@@ -16726,7 +16727,8 @@ in207100 // Informer 207/100
@source:informer_207_376.cpp
in207376 // Informer 207/376
-@source:informer_213ae.cpp
+@source:informer_213.cpp
+in213 // Informer 213
in213ae // Informer 213 AE
@source:instantm.cpp
@@ -19000,6 +19002,7 @@ mariorou
dobouchn
kattobas
konslot
+konslot2
koropens
kzaurus
pwrchanc
@@ -31511,6 +31514,9 @@ shorsem // 2000.?? Star Horse (main screens)
shorsel // 2000.12 Star Horse (live and backup)
shors2k1 // 2002.01.09 Star Horse 2001 (satellite, Rev B)
shors2k2 // 2002.12.09 Star Horse 2002 (sound, Export/Taiwan)
+shors2k2l // 2002.07 Star Horse 2002 (live)
+shors2k2m // 2002.05 Star Horse 2002 (main screens)
+shors2k2s // 2002.07 Star Horse 2002 (sound and backup, Rev A)
shorsep // 2003.12.01 Star Horse Progress (satellite, Rev A)
shorsepm // 2003.?? Star Horse Progress (main screens, Rev B)
shorseps // 2003.12.02 Star Horse Progress (sound & backup, Rev A)
@@ -35393,6 +35399,9 @@ d50 //
d50o //
d550 //
+@source:roland_jd800.cpp
+jd800 //
+
@source:roland_jv80.cpp
jv880 //
diff --git a/src/mame/mess.flt b/src/mame/mess.flt
index 8ab3ca34c44..87309974e8b 100644
--- a/src/mame/mess.flt
+++ b/src/mame/mess.flt
@@ -422,7 +422,7 @@ indigo.cpp
indy_indigo2.cpp
informer_207_100.cpp
informer_207_376.cpp
-informer_213ae.cpp
+informer_213.cpp
instruct.cpp
inteladv.cpp
intellec4.cpp
@@ -803,6 +803,7 @@ rmnimbus.cpp
roland_cm32p.cpp
roland_d10.cpp
roland_d50.cpp
+roland_jd800.cpp
roland_jv80.cpp
roland_jx3p.cpp
roland_jx8p.cpp
diff --git a/src/mame/video/gic.cpp b/src/mame/video/gic.cpp
index 54691b43e3c..9f9f8d8aff8 100644
--- a/src/mame/video/gic.cpp
+++ b/src/mame/video/gic.cpp
@@ -118,7 +118,7 @@ void gic_device::device_start()
m_vblank_timer->adjust( screen().time_until_pos(1, END_ACTIVE_SCAN + 18 ), 0, screen().scan_period() );
// allocate the audio stream
- m_stream = stream_alloc( 0, 1, clock()/(2*228) );
+ m_stream = stream_alloc_legacy( 0, 1, clock()/(2*228) );
m_ram.resolve_safe(0xff);
}
@@ -252,7 +252,7 @@ void gic_device::device_timer(emu_timer &timer, device_timer_id id, int param, v
#define GIC_AUDIO_BYTE 0x96
-void gic_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void gic_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
{
stream_sample_t *buffer = outputs[0];
diff --git a/src/mame/video/gic.h b/src/mame/video/gic.h
index 7735535d122..a393b88c4e2 100644
--- a/src/mame/video/gic.h
+++ b/src/mame/video/gic.h
@@ -74,7 +74,7 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override;
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
/* timers */
static const device_timer_id TIMER_VBLANK = 0;
diff --git a/src/mame/video/pdp1.cpp b/src/mame/video/pdp1.cpp
index 6f2462196a6..793f9ea5a56 100644
--- a/src/mame/video/pdp1.cpp
+++ b/src/mame/video/pdp1.cpp
@@ -37,17 +37,17 @@ inline void pdp1_state::pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint
*/
void pdp1_state::video_start()
{
- m_typewriter_color = color_typewriter_black;
+ m_typewriter->m_color = color_typewriter_black;
/* alloc bitmaps for our private fun */
m_panel_bitmap.allocate(panel_window_width, panel_window_height, BITMAP_FORMAT_IND16);
- m_typewriter_bitmap.allocate(typewriter_window_width, typewriter_window_height, BITMAP_FORMAT_IND16);
+ m_typewriter->m_bitmap.allocate(typewriter_window_width, typewriter_window_height, BITMAP_FORMAT_IND16);
/* set up out bitmaps */
pdp1_draw_panel_backdrop(m_panel_bitmap);
const rectangle typewriter_bitmap_bounds(0, typewriter_window_width-1, 0, typewriter_window_height-1);
- m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_bitmap_bounds);
+ m_typewriter->m_bitmap.fill(pen_typewriter_bg, typewriter_bitmap_bounds);
}
@@ -84,7 +84,7 @@ uint32_t pdp1_state::screen_update_pdp1(screen_device &screen, bitmap_ind16 &bit
pdp1_draw_panel(m_panel_bitmap);
copybitmap(bitmap, m_panel_bitmap, 0, 0, panel_window_offset_x, panel_window_offset_y, cliprect);
- copybitmap(bitmap, m_typewriter_bitmap, 0, 0, typewriter_window_offset_x, typewriter_window_offset_y, cliprect);
+ copybitmap(bitmap, m_typewriter->m_bitmap, 0, 0, typewriter_window_offset_x, typewriter_window_offset_y, cliprect);
return 0;
}
@@ -353,28 +353,28 @@ enum
};
-void pdp1_state::pdp1_typewriter_linefeed()
+void pdp1_typewriter_device::linefeed()
{
uint8_t buf[typewriter_window_width];
int y;
- assert(typewriter_window_width <= m_typewriter_bitmap.width());
- assert(typewriter_window_height <= m_typewriter_bitmap.height());
+ assert(typewriter_window_width <= m_bitmap.width());
+ assert(typewriter_window_height <= m_bitmap.height());
for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++)
{
- std::copy_n(&m_typewriter_bitmap.pix16(y+typewriter_scroll_step, 0), typewriter_window_width, buf);
- draw_scanline8(m_typewriter_bitmap, 0, y, typewriter_window_width, buf, m_palette->pens());
+ std::copy_n(&m_bitmap.pix16(y+typewriter_scroll_step, 0), typewriter_window_width, buf);
+ draw_scanline8(m_bitmap, 0, y, typewriter_window_width, buf, m_driver_state->m_palette->pens());
}
const rectangle typewriter_scroll_clear_window(0, typewriter_window_width-1, typewriter_window_height-typewriter_scroll_step, typewriter_window_height-1);
- m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window);
+ m_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window);
}
-void pdp1_state::pdp1_typewriter_drawchar(int character)
+void pdp1_typewriter_device::drawchar(int character)
{
static const char ascii_table[2][64] =
- { /* n-s = non-spacing */
- { /* lower case */
+ { // n-s = non-spacing
+ { // lower case
' ', '1', '2', '3',
'4', '5', '6', '7',
'8', '9', '*', '*',
@@ -392,7 +392,7 @@ void pdp1_state::pdp1_typewriter_drawchar(int character)
'h', 'i', '*',/*Lower Case*/ '.',
'*',/*Upper Case*/ '*',/*Backspace*/ '*', '*'/*Carriage Return*/
},
- { /* upper case */
+ { // upper case
' ', '"', '\'', '~',
'\202',/*implies*/ '\203',/*or*/ '\204',/*and*/ '<',
'>', '\205',/*up arrow*/ '*', '*',
@@ -419,58 +419,58 @@ void pdp1_state::pdp1_typewriter_drawchar(int character)
switch (character)
{
case 034:
- /* Black */
- m_typewriter_color = color_typewriter_black;
+ // Black
+ m_color = color_typewriter_black;
break;
case 035:
- /* Red */
- m_typewriter_color = color_typewriter_red;
+ // Red
+ m_color = color_typewriter_red;
break;
case 036:
- /* Tab */
+ // Tab
m_pos = m_pos + tab_step - (m_pos % tab_step);
break;
case 072:
- /* Lower case */
+ // Lower case
m_case_shift = 0;
break;
case 074:
- /* Upper case */
+ // Upper case
m_case_shift = 1;
break;
case 075:
- /* Backspace */
+ // Backspace
if (m_pos)
m_pos--;
break;
case 077:
- /* Carriage Return */
+ // Carriage Return
m_pos = 0;
- pdp1_typewriter_linefeed();
+ linefeed();
break;
default:
- /* Any printable character... */
+ // Any printable character...
if (m_pos >= 80)
- { /* if past right border, wrap around. (Right???) */
- pdp1_typewriter_linefeed(); /* next line */
- m_pos = 0; /* return to start of line */
+ { // if past right border, wrap around. (Right???)
+ linefeed(); // next line
+ m_pos = 0; // return to start of line
}
- /* print character (lookup ASCII equivalent in table) */
- pdp1_draw_char(m_typewriter_bitmap, ascii_table[m_case_shift][character],
+ // print character (lookup ASCII equivalent in table)
+ m_driver_state->pdp1_draw_char(m_bitmap, ascii_table[m_case_shift][character],
8*m_pos, typewriter_write_offset_y,
- m_typewriter_color); /* print char */
+ m_color); // print char
- if ((character!= 040) && (character!= 056)) /* 040 and 056 are non-spacing characters */
- m_pos++; /* step carriage forward */
+ if ((character!= 040) && (character!= 056)) // 040 and 056 are non-spacing characters
+ m_pos++; // step carriage forward
break;
}
diff --git a/src/mame/video/prehisle.cpp b/src/mame/video/prehisle.cpp
index b9c23d22920..765f97a7095 100644
--- a/src/mame/video/prehisle.cpp
+++ b/src/mame/video/prehisle.cpp
@@ -150,7 +150,7 @@ void prehisle_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c
uint16_t const attr = spriteram16[offs + 2];
uint16_t const code = attr & 0x1fff;
uint16_t const color = spriteram16[offs + 3] >> 12;
- uint32_t const priority = (color < 0x4) ? 0 : GFX_PMASK_1; // correct?
+ uint32_t const priority = GFX_PMASK_4 | ((color < 0x4) ? 0 : GFX_PMASK_2); // correct?
bool flipx = attr & 0x4000;
bool flipy = attr & 0x8000;
int16_t sx = spriteram16[offs + 1] & 0x1ff;
@@ -182,9 +182,9 @@ uint32_t prehisle_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
{
screen.priority().fill(0, cliprect);
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 1);
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1);
+ m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2);
+ m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4);
draw_sprites(screen, bitmap, cliprect);
- m_tx_tilemap->draw(screen, bitmap, cliprect, 0);
return 0;
}
diff --git a/src/tools/castool.cpp b/src/tools/castool.cpp
index eb9973ad48d..0b2b4230f8b 100644
--- a/src/tools/castool.cpp
+++ b/src/tools/castool.cpp
@@ -38,6 +38,7 @@
#include "formats/mz_cas.h"
#include "formats/orao_cas.h"
#include "formats/oric_tap.h"
+#include "formats/p2000t_cas.h"
#include "formats/p6001_cas.h"
#include "formats/phc25_cas.h"
#include "formats/pmd_cas.h"
@@ -90,6 +91,7 @@ const struct SupportedCassetteFormats formats[] = {
{"mz", mz700_cassette_formats ,"Sharp MZ-700"},
{"orao", orao_cassette_formats ,"PEL Varazdin Orao"},
{"oric", oric_cassette_formats ,"Tangerine Oric"},
+ {"p2000t", p2000t_cassette_formats ,"Philips P2000T"},
{"pc6001", pc6001_cassette_formats ,"NEC PC-6001"},
{"phc25", phc25_cassette_formats ,"Sanyo PHC-25"},
{"pmd85", pmd85_cassette_formats ,"Tesla PMD-85"},
diff --git a/src/tools/unidasm.cpp b/src/tools/unidasm.cpp
index 1c6c9b1a160..b5a175c1d96 100644
--- a/src/tools/unidasm.cpp
+++ b/src/tools/unidasm.cpp
@@ -483,8 +483,8 @@ static const dasm_table_entry dasm_table[] =
{ "nsc8105", be, 0, []() -> util::disasm_interface * { return new m680x_disassembler(8105); } },
{ "pace", le, -1, []() -> util::disasm_interface * { return new pace_disassembler; } },
{ "patinho_feio", le, 0, []() -> util::disasm_interface * { return new patinho_feio_disassembler; } },
- { "pdp1", be, 0, []() -> util::disasm_interface * { return new pdp1_disassembler; } },
- { "pdp8", be, 0, []() -> util::disasm_interface * { return new pdp8_disassembler; } },
+ { "pdp1", be, -2, []() -> util::disasm_interface * { return new pdp1_disassembler; } },
+ { "pdp8", be, -1, []() -> util::disasm_interface * { return new pdp8_disassembler; } },
{ "pic16", le, -1, []() -> util::disasm_interface * { return new pic16_disassembler; } },
{ "pic16c5x", le, -1, []() -> util::disasm_interface * { return new pic16c5x_disassembler; } },
{ "pic1670", le, -1, []() -> util::disasm_interface * { return new pic1670_disassembler; } },